akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
#define F first
#define S second
#define fi(a, b) for(ll i=(a);i<=b;i++)
#define fj(a, b) for(ll j=(a);j<=b;j++)
#define fid(a, b) for(ll i=(a);i>=b;i--)
#define fjd(a, b) for(ll i=(a);i>=b;j--)

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    os << "]";
	return os;
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class T> ostream& operator<<(ostream &os, multiset<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, unordered_map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}

// Kevin Mathew T
// Birla Institute of Technology, Mesra
// LinkedIn - https://www.linkedin.com/in/KevinMathewT/
// GitHub - https://github.com/KevinMathewT
// CodeForces - https://codeforces.com/profile/KevinMathew
// CodeChef - https://www.codechef.com/users/KevinMathew
// HackerRank - https://www.hackerrank.com/KevinMathew

const ll N = 210, M = 1e9 + 7;
ll n;
string s;

void solve(){
	cin >> s;
	n = s.size();

	ll len = 0;

	fi(0, n - 1){
		ll flag = 1;
		if((i + i + 1) >= n - 1) break;
		fj(0, i) if(s[j] != s[j + i + 1]) flag = 0;
		if(flag) len = i + 1;
	}

	cout << 2 * len << "\n";
}

int main(){
	//freopen("input.txt", "r", stdin);		//Comment
	//freopen("output.txt", "w", stdout);		//this out.
	ios::sync_with_stdio(false);			//Not
	cin.tie(NULL);							//this.
	cout.tie(0);							//or this.

	// ll T;
	// cin >> T;
	// while(T--)
		solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    sort(A.rbegin(),A.rend());
    ll maxV = 0;
    for(int i=1;i<N;i++){
        maxV = max(maxV,min(A[i],A[0]-A[i]));
    }
    for(int i=1;i<N;i++){
        if(min(A[i],A[0]-A[i]) == maxV){
            cout << A[0] <<" " <<A[i] << endl;
            return 0;
        }
    }


    return 0;
}

Measured memory_bytes: 1152
#include <queue>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define N 100100
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(x, a, b) for(int x=a; x<=b; x++)
#define drp(x, a, b) for(int x=a; x>=b; x--)
int deg[N], d[N], n, vis[N], a[N], tot, num[N], l[N], ans=1, fac[N], inv[N];
vector<pair<int, int> > fu;
queue<int> q;
int power(int a, int k){
	int ret=1;
	while(k)
	{
		if(k&1) ret=1ll*ret*a%mod;
		a=1ll*a*a%mod; k>>=1;
	}
	return ret;
}
int C(int n, int m){
	return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int pr(int n){
	return 1ll*fac[2*n]*inv[n]%mod*power((mod+1)>>1, n)%mod;
}
void init(){
	fac[0]=1;
	rep(i, 1, n) fac[i]=1ll*fac[i-1]*i%mod;
	inv[n]=power(fac[n], mod-2);
	drp(i, n, 1) inv[i-1]=1ll*inv[i]*i%mod;
}

int st[N<<1];
void renew(int &x, const int y){
	x += y;
	if(x < 0) x += mod;
	if(x >= mod) x -= mod;
}
int getdp(){
	int fr = 0;
	rep(i, 1, tot) st[i + tot] = st[i];
	rep(i, 1, tot) if(l[st[i]]){
		fr = i;
		break;
	}
	reverse(st + fr + 1, st + fr + tot);
	int a = fr + l[st[fr]] - 1, b = a + 1, c = 1;
	rep(i, fr + 1, fr + tot - 1)if(l[st[i]]){
		int na = i + l[st[i]] - 1, nb = na + 1, cc = 0;
		if(a < i) renew(cc, c);
		if(b < i) renew(cc, c);
		a = na;
		b = nb;
		c = cc;
	}
	int ans = 0;
	if(a < fr + tot) renew(ans, c);
	if(b < fr + tot) renew(ans, c);
	return ans;
}

int que[N], h, t;
int main(){
	scanf("%d", &n);
	init();
	rep(i, 1, n)
	{
		scanf("%d", a+i);
		deg[a[i]]++;
	}
	rep(i, 1, n) if(deg[i]>2) return puts("0"), 0;
	rep(i, 1, n) d[i]=deg[i];
	rep(i, 1, n) if(!d[i]) q.push(i);
	while(!q.empty())
	{
		int u=q.front(); q.pop();
		vis[u]=1;
		if(--d[a[u]]==0) q.push(a[u]);
	}
	rep(i, 1, n) if(vis[i] && deg[i]>1) return puts("0"), 0;
	rep(i, 1, n) if(vis[i] && !deg[i])
	{
		int x=i, cnt=0;
		for(; vis[x]; x=a[x]) cnt++;
		l[x]=cnt;
	}
	
	rep(i, 1, n) if(!vis[i])
	{
		int x=i, fl=0, ass=1; tot=0;
		for(; !vis[x]; x=a[x]) st[++tot]=x, fl|=bool(l[x]), vis[x]=1;
		if(!fl) num[tot]++;
		else
		{/*
			int p=0; fu.clear();
			if(l[i]) fu.pb(mp(l[i], 0));
			for(p++, x=a[i]; x!=i; x=a[x]) if(l[x]) fu.pb(mp(l[x], p));
			fu.pb(mp(fu[0].fi, fu[0].se+tot));
			int sz=fu.size();
			rep(i, 1, sz-1)
			{
				if(fu[i].fi>fu[i].se-fu[i-1].se) ass=0;
				if(fu[i].fi<fu[i].se-fu[i-1].se) ass=2ll*ass%mod;
			}*/
			ass=getdp();
		}
		ans=1ll*ans*ass%mod;
	}
	rep(i, 1, n) if(num[i])
	{
		int m=num[i], ass=0;
		rep(j, 0, m/2)
		{
			int tmp=1;
			tmp=1ll*tmp*power(i, j)%mod;
			tmp=1ll*tmp*C(m, 2*j)%mod;
			tmp=1ll*tmp*fac[2*j]%mod;
			tmp=1ll*tmp*inv[j]%mod;
			tmp=1ll*tmp*power((mod+1)>>1, j)%mod;
			if(i>1 && (i&1))
				tmp=1ll*tmp*power(2, m-2*j)%mod;
			ass=(ass+tmp)%mod;
		}
		ans=1ll*ans*ass%mod;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 3584
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello{
    public static void Main(){
        var alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        var input = Console.ReadLine().Split(' ').Select(long.Parse).ToList();
        var h = input[0];
        var w = input[1];
        var ans = "";
        for(var i = 0;i < h;i++){
            var line = Console.ReadLine().Split(' ').ToArray();
            if(line.Contains("snuke")){
                ans = $"{alph[Array.IndexOf(line,"snuke")]}{i + 1}";
            }
        }
        Console.WriteLine(ans);
        
    }
}


Measured memory_bytes: 13280
#include <bits/stdc++.h>
using namespace std;

int main() {

    //値の取得
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;

  int time, ans;
  time = (H2 - H1) * 60 + (M2 - M1);

  ans = (time / K - 1) * K + time % K;

  cout << ans << endl;
}


Measured memory_bytes: 3636
N, M = map(int, input().split())

ans = 0
if N==1 and M==1:
    ans = 1
elif N==1:
    ans = max(0, M-2)
elif M == 1:
    ans = max(0, N-2)
elif N==2 or M==2:
    ans = 0
else:
    ans = (M-2)*(N-2)
print(ans)

Measured memory_bytes: 61828
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

void solve() {
	string a, b, c; cin >> a >> b >> c;
	cout << (char)toupper(a[0]) << (char)toupper(b[0]) << (char)toupper(c[0]);
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <numeric>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>
#include <cctype>
#include <string>

struct Roadwork {
	int from, until, position;
};
int main() {
	int n, q; std::cin >> n >> q;
	std::vector<Roadwork> roadworks(n); for (auto& r : roadworks) std::cin >> r.from >> r.until >> r.position;
	std::sort(roadworks.begin(), roadworks.end(), [](const Roadwork& a, const Roadwork& b) {return a.from - a.position < b.from - b.position; });
	const auto comparator = [](const Roadwork& a, const Roadwork& b) {return a.position > b.position; };
	std::priority_queue<Roadwork, std::vector<Roadwork>, decltype(comparator)> queue(comparator);
	std::vector<int> position(q); for (auto& d : position) std::cin >> d;
	int i = 0;
	for (const auto d : position) {
		while (i < n && roadworks[i].from <= roadworks[i].position + d) {
			if (roadworks[i].position + d < roadworks[i].until) {
				queue.push(roadworks[i]);
			}
			++i;
		}
		while (!queue.empty() && queue.top().until <= queue.top().position + d) {
			queue.pop();
		}
		if (queue.empty()) {
			std::cout << "-1\n";
		}
		else {
			std::cout << queue.top().position << '\n';
		}
	}
}


Measured memory_bytes: 6896
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; ++i)
typedef long long ll;
using namespace std;
const int INF = 1e9;

int main() {
    int n;
    string s, t;
    cin >> n >> s >> t;

    rep(i, n) {
        bool flag = true;
        for (int j = i; j < n; ++j) {
            if (s[j] != t[j - i])
                flag = false;
        }
        if (flag) {
            cout << n + i << endl;
            return 0;
        }
    }

    cout << n * 2 << endl;

    return 0;
}


Measured memory_bytes: 3576
#include<iostream>
using namespace std;
const int INF = 1000000000;

int main(){
    while(true){
        int n, m;
        cin >> n >> m;
        if(n==0 && m==0)
            break;
        int c[100][100];
        int t[100][100];
        for(int i=0; i<m; i++){
            for(int j=0; j<m; j++){
                if(i==j){
                    c[i][j] = 0;
t[i][j] = 0;
                }
                else{
                    c[i][j] = INF;
t[i][j] = INF;
                }
            }
        }
        for(int i=0; i<n; i++){
            int a, b, C, T;
            cin >> a >> b >> C >> T;
            c[a-1][b-1] = C;
c[b-1][a-1] = C;
            t[a-1][b-1] = T;
t[b-1][a-1] = T;
        }
    for(int k=0;k<m;k++){
      for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
          if(c[i][j]>c[i][k]+c[k][j]){
            c[i][j] = c[i][k]+c[k][j];
          }
          if(t[i][j]>t[i][k]+t[k][j]){
            t[i][j] = t[i][k]+t[k][j];
          }
        }
      }
    }
    int k;
    cin >> k;
    int p,q,r;
    for(int i=0;i<k;i++){
      cin >> p >> q >> r;
      if(r == 0){
        cout << c[p-1][q-1] << endl;
      }
      else{
        cout << t[p-1][q-1] << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3104
// D.cpp
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAX_N = 5e3 + 200;
const ll INF = 0x3f3f3f3f3f3f3f3f;

int n, A, B, pi[MAX_N], pos[MAX_N];
ll dp[MAX_N][MAX_N];

int main()
{
    scanf("%d%d%d", &n, &A, &B);
    for (int i = 1; i <= n; i++)
        scanf("%d", &pi[i]), pos[pi[i]] = i;
    memset(dp, 0x3f, sizeof(dp)), dp[0][0] = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j < i; j++)
            if (dp[i - 1][j] != INF)
                if (pos[i] > pos[j])
                {
                    dp[i][i] = min(dp[i][i], dp[i - 1][j]);
                    dp[i][j] = min(dp[i][j], dp[i - 1][j] + B);
                }
                else
                    dp[i][j] = min(dp[i][j], dp[i - 1][j] + A);
    }
    printf("%lld\n", *min_element(dp[n], dp[n] + 1 + n));
    return 0;
}

Measured memory_bytes: 215120
/*    ####################  */
/*   # I_LOVE_THUY_LINH #  */
/*  ####################  */
#include <bits/stdc++.h>
#define ll long long
#define db double
#define ld long double
#define ii pair<int,int>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vii vector<ii>
#define matrix vector<vector<ll>>
#define fir first
#define sec second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define sz(a) int((a).size())
#define ms(s,val) memset(s,val,sizeof(s))
#define bitcount(n) __builtin_popcountll(n)
#define getbit(s,k) ((s >> k)&1)
#define turnbit(s,k) (s | (1<<k))
#define offbit(s,k) (s & ~(1<<k))
#define flipbit(s,k) (s ^ (1<<k))
#define prec(n) fixed<<setprecision(n)
#define sqr(x) (ll)(x)*(ll)(x)
#define lcm(a,b) ((ll)a/__gcd((ll)a,(ll)b)*(ll)(b))
#define gcd(a,b) __gcd(a,b)
using namespace std;
const int INF = int(1e9);

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = (n/(a + b))*a;
    ans += min(n % (a + b),a);
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main() {
    int64_t k, q;
    cin >> k >> q;
    vector<int64_t> d(k);
    for (int64_t& D : d) {
        cin >> D;
    }
    vector<int64_t> n(q), x(q), m(q);
    for (int64_t i = 0; i < q; i++) {
        cin >> n[i] >> x[i] >> m[i];
    }

    for (int64_t i = 0; i < q; i++) {
        vector<int64_t> copy_d(k);
        for (int64_t j = 0; j < k; j++) {
            copy_d[j] = (d[j] % m[i] == 0 ? m[i] : d[j] % m[i]);
        }

        //最終項を求める
        int64_t final = x[i] % m[i] //初項
                         //kで割れる分
                         + accumulate(copy_d.begin(), copy_d.end(), (int64_t)0) * ((n[i] - 1) / k)
                         //kで割った余りの分
                         + accumulate(copy_d.begin(), copy_d.begin() + (n[i] - 1) % k, (int64_t)0);

        //n - 1個から失敗する分を引く
        cout << n[i] - 1 - final / m[i] << endl;
    }
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>

using namespace std;

typedef long long ll;

const ll q = 10000000000 + 7;

int main() {
	
	ll n;
	cin >> n;
	vector<ll> p(n);
	vector<ll> pIndex(n+1);
	for (ll i = 0; i < n; i++)
	{
		cin >> p[i];
		pIndex[p[i]] = i+1;
	}

	multiset<ll> s;

	s.insert(0);
	s.insert(0);
	s.insert(n + 1);
	s.insert(n + 1);

	sort(p.begin(), p.end(), greater<ll>());


	ll a, b, index, c, d; // index
	ll sum = 0;
	for (ll x = n; x > 0; x--)
	{
		index = pIndex[x];
		s.insert(index);
		auto it = s.lower_bound(index);
		it--;
		b = *it;
		it--;
		a = *it;
		it++;
		it++;
		it++;
		c = *it;
		it++;
		d = *it;
		sum += x * (b - a) * (c - index);
		sum += x * (index - b) * (d - c);
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 6528
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.StringTokenizer;

public class Main  implements Runnable {
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
    }
    public void run() {
    	FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long x = Long.parseLong(sc.next());
		long ans = 0;
		ans += x/11l*2l;
		x = x%11;
		if(x > 0)
		{
			x = x-6;
			ans++;
		}
		if(x > 0)
		{
			x = x-5;
			ans++;
		}

		out.printf("%d", ans);
		out.flush();
	}

    
    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }
    }
}

Measured memory_bytes: 23380
from collections import*
(n,m),*c = [[*map(int,i.split())]for i in open(0)]
g = [[]for _ in range(n+1)]

for a,b in c:
    g[a]+=[b]
    g[b]+=[a]

q=deque([1])
r=[0]*(n+1)

while q:
    v=q.popleft()
    for i in g[v]:
        if r[i]==0:
            r[i]=v
            q.append(i)

print("Yes",*r[2:],sep="\n")


Measured memory_bytes: 60256
def main():
    n = int(input())
    l = list(map(int, input().split()))

    maxv = max(l)
    maxi = l.index(maxv)

    print('Yes') if maxv < sum(l[:maxi] + l[maxi+1:]) else print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
def main():
    N = int(input())
    A = []
    for _ in range(N):
        A.append(int(input()))
    sort_A = sorted(A)
    max_A = sort_A[-1]
    max_se_A = sort_A[-2]
    for a in A:
        if a == max_A:
            print(max_se_A)
        else:
            print(max_A)
    return 0

if __name__ == '__main__':
    main()

Measured memory_bytes: 14088
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] P = new int[N];
        for(int i=0;i<N;i++){
            P[i]=sc.nextInt();
        }
        Arrays.sort(P);
        for(int i=0;i<=1000;i++){
            int k = Arrays.binarySearch(P, X-i);
            if(k<0){
                System.out.println(X-i);
                return;
            }
            k = Arrays.binarySearch(P, X+i);
            if(k<0){
                System.out.println(X+i);
                return;
            }
        }
        System.out.println(ans);
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 35948
#include<cstdio>
int abs(int n){
if(n<0)n=-n;
return n;
}
int main(){
int x,a,b;
scanf("%d%d%d",&x,&a,&b);
if(abs(a-x)>abs(b-x))printf("B\n");
else printf("A\n");
return 0;
}

Measured memory_bytes: 128
import io, sys, atexit, os

import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations


def li ():
	return list (map (int, input ().split ()))


def num ():
	return map (int, input ().split ())


def nu ():
	return int (input ())


def find_gcd ( x, y ):
	while (y):
		x, y = y, x % y
	return x


mm = 1000000007



def solve ():
	t = 1
	for it in range (t):
		n,m,c=num()
		b=li()
		cc=0
		for i in range(n):
			a=li()
			ss=c
			for j in range(m):
				ss+=a[j]*b[j]
			if(ss>0):
				cc+=1
		print(cc)





if __name__ == "__main__":
	solve ()

Measured memory_bytes: 5844
/*
*	User: Isanchez_Aguilar
*	Problem: AtCoder ABC134B - Golden Apple
*/
#include <bits/stdc++.h>

using namespace std;
using Long = long long;

int main(void)
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int k, n;
	int heights[100001];

	cin >> n >> k;
	
	for (int i = 0; i < n; ++i)
		cin >> heights[i];

	int dp[100001];

	dp[0] = 0;
	for (int i = 1; i < n; ++i)
	{
		dp[i] = INT_MAX;

		for (int j = 1; i - j >= 0 and j <= k; ++j)
			dp[i] = min(dp[i], dp[i - j] + abs(heights[i] - heights[i - j]));
	}

	cout << dp[n - 1];

	return 0;
}

Measured memory_bytes: 1024
s = input()
data = [0,0,0]
for i in s:
    if i == 'a':
        data[0] += 1
    elif i == 'b':
        data[1] += 1
    else:
        data[2] += 1

#print(data)
if max(data)-min(data) <= 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 39536
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
    int a,b;
    char op;
    scanf("%d %c %d",&a,&op,&b);
    while(op!='?'){
        switch(op){
            case '+':
            cout<<a+b<<endl;
            break;
            case '-':
            cout<<a-b<<endl;
            break;
            case '/':
            cout<<a/b<<endl;
            break;
            case '*':
            cout<<a*b<<endl;
            break;
            //case '?':
            //break;
        }
        cin>>a>>op>>b;
    }
}


Measured memory_bytes: 3140
import java.util.*;
 
public class Main{
 
  public static void main(String args[])
  {
    
   Scanner sc = new Scanner(System.in);
    
    int n= sc.nextInt();
    
    for(int i=1;i<=n;i++)
    {
      
     int count =0;
      
      for(int x =1;x<=100 ; x++)
      {
       for(int y=1;y<=100;y++)
       {
        for(int z= 1;z<=100;z++)
        {
          
          int sum = x*x + y*y + z*z + x*y + x*z + y*z;
          
           if(sum>i)
            break;
          
          if(sum==i)
            count++;
          
         
        }
         
       }
        
      }
      
      System.out.println(count);
      
      
    }
    
    
  }
  
  
}

Measured memory_bytes: 39908
from collections import defaultdict
s = input()

head = 0
tail = 1
ans = 0
before = ""
while True:
    ss = s[head:tail]
    if ss != before:
        before = ss
        head = tail
        tail = head + 1
        ans += 1
    else:
        tail += 1
    if tail == len(s)+1:
        print(ans)
        exit()




Measured memory_bytes: 3752
#include <iostream>

using namespace std;
using int64    = long long;
using PII      = pair<int, int>;
const int MAXN = 80;
const int INF  = 0x3f3f3f3f;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    int x,y;
    cin >> x >> y;
    cout << x*y << endl;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> m(n);
  rep(i, n) cin >> m[i];

  sort(m.begin(), m.end());
  rep(i, n) x -= m[i];
  cout << n + x / m[0] << endl;


  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		String nStr = String.valueOf(N);
		
		int ans = 0;
		
		for(int i = 1; i <= N; i ++) {
			String str = String.valueOf(i);
			String[] len = str.split("");
			if(len.length % 2 == 1) {
				ans++;
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 62160
#include <bits/stdc++.h>
using namespace std;

int main()
{
    size_t H, W, K;
    cin >> H >> W >> K;
    vector<string> c(H);
    for (string &s : c)
    {
        cin >> s;
    }

    size_t ans = 0;
    for (size_t i = 0; i < size_t(1 << H); i++)
    {
        for (size_t j = 0; j < size_t(1 << W); j++)
        {
            bitset<8> bi(i);
            bitset<8> bj(j);
            size_t count = 0;
            for (size_t k = 0; k < H; k++)
            {
                for (size_t l = 0; l < W; l++)
                {
                    if (bi[k] && bj[l] && c[k][l] == '#')
                    {
                        count++;
                    }
                }
            }
            if (count == K)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<string, int> P;
typedef pair<int, P> Q;

ll mod = 1000000007;
const ll INF = 100000000000000;
map<ll, ll> mp;
ll N, K, a[200010], sum[200010], ans;

ll pow_mod(ll x, ll y)
{
	if (y == 0) return 1;

	if (y % 2 == 0)
	{

	}
	else
	{

	}
}

int po(int x, int y)
{
	if (y == 0) return 1;
	return po(x, y - 1) * x;
}

int main()
{
	string s;

	cin >> s;

	if ("SUN" == s) cout << 7 << endl;
	if ("MON" == s) cout << 6 << endl;
	if ("TUE" == s) cout << 5 << endl;
	if ("WED" == s) cout << 4 << endl;
	if ("THU" == s) cout << 3 << endl;
	if ("FRI" == s) cout << 2 << endl;
	if ("SAT" == s) cout << 1 << endl;
	
	int www;
	cin >> www;
}

Measured memory_bytes: 256
import java.util.*
import kotlin.collections.ArrayList


fun primes(upperLimit: Int): List<Int> {
    val isPrime = Array(upperLimit + 1){true}
    for (i in 2 .. upperLimit) {
        if (i * i > upperLimit) break
        if (isPrime[i]) for (j in i * i .. upperLimit step i) {
            isPrime[j] = false
        }
    }
    return (2 .. upperLimit).filter(isPrime::get)
}
fun <T: Comparable<T>> List<T>.lowerBound(value: T): Int {
    var left = 0
    var right = size
    while (left < right) {
        val mid = (left + right) / 2
        if (this[mid] < value) left = mid + 1
        else right = mid
    }
    return right
}
fun main(args: Array<String>?): Unit {
    val (n, m, s, t) = readLine()!!.trim().split(' ').map(String::toInt)
    val nodes = Array(n * 2){ArrayList<Int>()}
    repeat(m){
        val (a, b) = readLine()!!.trim().split(' ').map(String::toInt)
        nodes[a * 2 - 2].add(b * 2 - 1)
        nodes[a * 2 - 1].add(b * 2 - 2)
        nodes[b * 2 - 2].add(a * 2 - 1)
        nodes[b * 2 - 1].add(a * 2 - 2)
    }
    val queue: Queue<Int> = ArrayDeque<Int>().apply { add(s * 2 - 2) }
    val minLength = Array(n * 2){-1}.apply { this[s * 2 - 2] = 0 }
    while (queue.isNotEmpty()) {
        val current = queue.poll()
        for (next in nodes[current]) if (minLength[next] == -1){
            minLength[next] = minLength[current] + 1
            queue.add(next)
        }
    }
    if (minLength[t * 2 - 2] == 2){
        println(2)
    }else if (minLength[t * 2 - 1] != -1) {
        val prime = primes(1000000).drop(1)
        println(prime[prime.lowerBound(minLength[t * 2 - 1])])
    }else {
        println(-1)
    }
}


Measured memory_bytes: 118180
from math import sqrt
while True:
    d, e = map(int, input().split())
    if d == e == 0:
        break

    mn = 10000
    for i in range(d // 2 + 1):
        mn = min(mn, abs(sqrt(i ** 2 + (d - i) ** 2) - e))

    print(mn)

Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;


signed main(){
  int N;
  ll ans = 0;
  cin >> N;
  vector<ll> v(N+1);
  v[0] = 0;
  FOR(i,0,N)cin >> v[i+1];
  FOR(i,1,N+1)v[i] += v[i-1];
  sort(ALL(v));
  set<ll> s;
  for(auto x:v)s.insert(x);
  for(auto x:s){
    ll n = upper_bound(ALL(v),x) - lower_bound(ALL(v),x);
    ans += n*(n-1)/2;
  }
  DEBUG(v);
  cout << ans << endl;
}


Measured memory_bytes: 11136
import math

a, b, h, m = [0] * 4

def format_input(filename = None):
	global a, b, h, m
	if filename == None:
		a, b, h, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		a = rng(1, 10**3)
		b = rng(1, 10**3)
		h = rng(0, 11)
		m = rng(0, 59)
		print(a, b, h, m)

def get_answer():
	answer = 0
	rad = 2.0 * math.pi * abs(float(h) / 12.0 + float(m) / 60.0 / 12.0 - float(m) / 60.0)
	answer = math.sqrt((float(a) * math.sin(rad))**2 + (float(a) * math.cos(rad) - float(b))**2)
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)


Measured memory_bytes: 9488
n=int(input())
s=[]
t=[]
for i in range(n):
    li=input().split()
    s.append(li[0])
    t.append(int(li[1]))

x=input()
a=s.index(x)
ans=0
for i in range(a+1,n):
    ans+=t[i]
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
  string A;
  cin >> A;
  if((A.at(0) == A.at(1)) && (A.at(1) == A.at(2))) {
    cout << "No" << endl;
  }
  else if(A.at(0) == A.at(1)) {
    if(A.at(2) == A.at(3)) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else if(A.at(0) == A.at(2)) {
    if(A.at(1) == A.at(3)) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else if(A.at(0) == A.at(3)) {
    if(A.at(1) == A.at(2)) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>

int main(){
	char n[10001];
	scanf("%s",n);
	int len = strlen (n);
	if(n[len-1]=='s'){
		printf("%s",n);
		printf("es\n");
	}
	else{
		printf("%s",n);
		printf("s\n");
	}
	return 0;
}

Measured memory_bytes: 1736
N = int(input())
S = input().strip()
cmax = 0
for k in range(1,N):
    X = S[:N-k]
    Y = S[k:]
    cur = 0
    cnt = 0
    for i in range(N-k):
        if X[i]!=Y[i]:
            cmax = max(cmax,min(cnt,k))
            cur = i
            cnt = 0
        else:
            cnt += 1
    cmax = max(cmax,min(cnt,k))
print(cmax)

Measured memory_bytes: 43356
"""
方針
(1) 累積和s_i = a_0 + a_1 + ... + a_{i-1}をとる
(2) 部分和s_i_j = a_i + ... + a_{j-1} = s_j - s_iについて、平均がk以上であるとき、
        s_j - s_i >= k * (j-i) = k*j - k*i
    ->  s_j - k*j >= s_i - k*iとなる(i, j), i < jのペアを数えればよいので
    b_i = s_i - k*iを計算する
(3) b_iを座標圧縮して0~nの範囲に変換する (b_i -> c_iになるとする) (大小関係のみ重要なので)
(4) 0~nの変換においてBITを用いて、順次c_iの値をカウントしていく
"""

class BIT:
    def __init__(self, n):
        self.size = n + 1
        self.tree = [0] * (n + 2)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


def submit():
    n, k = map(int, input().split())
    a = [int(input()) for _ in range(n)]

    # 累積和を求める
    s = [0]
    for ai in a:
        s.append(s[-1] + ai)

    # biを求める
    b = [s[i] - k * i for i in range(n + 1)]

    # ciを求める
    b_dict = {}
    cnt = 0
    for be in sorted(b):
        if be not in b_dict:
            b_dict[be] = cnt
            cnt += 1
    c = [b_dict[be] for be in b]

    # BITでciの出現個数を逐次カウント
    bit = BIT(n)
    ans = 0
    for ce in c:
        ans += bit.sum(ce + 1)
        bit.add(ce + 1, 1)
    print(ans)

    
if __name__ == "__main__":
    submit()

Measured memory_bytes: 94804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pl;
const int N = 2e3 + 50;
const ll MOD = 998244353;

int n, x, y;
vector<int>e[N];
int k[N], vis[N];
int ret[N][N];

void bfs(int t) {

    queue<pl> q;

    q.push(make_pair(t, 0));
    vis[t] = 1;

    while(!q.empty()) {
        pl now = q.front(); q.pop();
        int u = now.first;
        int dist = now.second;

        for(int i=0;i<e[u].size();i++) {
            int v = e[u][i];
            if(vis[v])continue;
            vis[v] = 1;

            int mi = min(t, v);
            int ma = max(t, v);
            //cout<<mi<<" "<<ma<<endl;
            if(!ret[mi][ma]) {
                //cout<<"dist: "<<dist+1<<endl;
                k[dist + 1] ++;
                ret[mi][ma] = 1;
            }

            q.push(make_pair(v, dist + 1));

        }
    }

}

int main() {
    cin>>n>>x>>y;
    for(int i=1;i<n;i++) {
        e[i].push_back(i+1);
        e[i+1].push_back(i);
    }
    e[x].push_back(y);
    e[y].push_back(x);

    for(int i=1;i<n;i++) {
        memset(vis, 0, sizeof(vis));
        bfs(i);
        //cout<<k[2]<<endl;
    }
    for(int i=1;i<n;i++){
        cout<<k[i]<<endl;
    }
	return 0;
}


Measured memory_bytes: 16768
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

// dp[i][j][k] := i日目の、i-1日目にパスタj、i-2日目にパスタkを食べた時の場合の数
int dp[101][3][3];
const int mod = 10000;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> mp(n + 1, INF);
    for (int i = 0; i < k; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        mp[a] = b;
    }

    dp[0][0][0] = 1;
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < 3; k++)
            {
                for (int t = 0; t < 3; t++)
                {
                    if (i > 1 && j == k && k == t)
                    {
                        continue;
                    }
                    if (mp[i] != INF && mp[i] != t)
                    {
                        continue;
                    }
                    (dp[i + 1][k][t] += dp[i][j][k]) %= mod;
                }
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            (ans += dp[n][i][j]) %= mod;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3180
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;
cs int N = 1e6 + 50; 
int n, ct[3], p[3];
char S[N]; int a[N];
bool ban[N];
void work(){
	if(ct[p[0]]<=0) return;
	int m=0; for(int i=1,la=-1;i<=n;i++)
	if(!ban[i])a[++m]=a[i]; n=m;
	memset(ban,0,sizeof(ban));
	a[n+1]=p[0];
	for(int i=1,l=0; i<=n+1 && ct[p[1]]>ct[p[0]]; i++)
	if(a[i]==p[0]){
		if(i-l<=2){ l = i; continue; }
		int z = (i-l-2)/2, o = l+1;
		if(l==0||i==n+1) z=(i-1)/2;
		while(z && ct[p[1]] > ct[p[0]])
		ban[o] = ban[o+1] = true,
		o += 2, --z, --ct[p[1]], --ct[p[2]];
		l = i;
	} 
	if(ct[p[1]]>ct[p[0]]) return;
	m=0; for(int i=1; i<=n; i++)
	if(!ban[i]) a[++m]=a[i]; n=m;
	for(int i=1,la=-1; i<=n; i++)
	putchar(a[i]+'A'), 
	assert(la!=a[i]), la=a[i];
	assert(ct[0]==ct[1]&&ct[1]==ct[2]);
}
void chk(){ if(ct[p[1]]==ct[p[2]]) work(), exit(0); }
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
//	freopen("my.out","w",stdout);
	#endif
	scanf("%s",S+1); n=strlen(S+1); int _n=0;
	for(int i=1; i<=n; i++)
	if(S[i]!=S[i-1])a[++_n]=S[i]-'A'; n=_n;
	for(int i=1; i<=n; i++) ++ct[a[i]];
	p[1] = 1, p[2] = 2;
	for(int i=0; i<3; i++)
	for(int j=i+1; j<3; j++)
	if(ct[p[i]] > ct[p[j]])
	swap(p[i], p[j]);
	if(ct[p[1]]==ct[p[2]])
	return work(), 0; a[n+1] = p[0];
	for(int i=1,l=a[1]==p[0]; i<=n+1; i++)
	if(a[i]==p[0]){
		if(i-l<=2){ l=i; continue; }
		int o=a[l+1], e=a[i-1]; 
		if(o==p[2]) --ct[p[2]], ban[l+1] = true, chk();
		if(e==p[2]) --ct[p[2]], ban[i-1] = true, chk(); l = i;
	} _n = 0;
	if(a[1]==p[2] && !ban[1]) --ct[p[2]], ban[1]=true, chk();
	if(a[n]==p[2] && !ban[n]) --ct[p[2]], ban[n]=true, chk();
	for(int i=1; i<=n; i++)
	if(!ban[i]) a[++_n] = a[i]; n = _n;
	memset(ban,0,sizeof(ban));
	for(int i=1; i<n; i++)
	if(a[i]==p[0]&&a[i+1]==p[2]){
		--ct[p[0]],--ct[p[2]];
		ban[i]=ban[i+1]=true,chk();
	} return 0;
} 

Measured memory_bytes: 9620
import math
import sys

def sa(Type= int):
    return [Type(x) for x in input().split()]

def solve(h, w):
    pats = ['#.', '.#']

    patIdx = 0

    for i in range(h):
        result = pats[patIdx]*math.ceil(w/2)
        print(result[:w])

        patIdx = 1 if patIdx == 0 else 0
        
    print()

if __name__ == '__main__':
    # sys.stdin = open('input.txt', 'r')

    while True:
        h, w = sa()

        if h == 0 and w == 0:
            break

        solve(h, w)


Measured memory_bytes: 5680
use std::io::Read;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).unwrap();
	let ints: Vec<_> = s.trim().split(" ").map(|i| i32::from_str_radix(i, 10).unwrap()).collect();
	if ints[0] + ints[1] + ints[2] >= 22 {
		println!("bust");
	} else {
		println!("win");
	}
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int h,w,H,W;
    cin >> H >> W >> h >> w;
    cout << (H*W)-(h*W+w*H)+h*w << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a[100005];
    int b[100005];
    int c[100005];
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<n; i++) cin >> b[i];
    for(int i=0; i<n; i++) cin >> c[i];
    sort(a, a+n);
    sort(b, b+n);
    sort(c, c+n);
    long long ans=0;
    for(int i=0; i<n; i++){
        int x=b[i];
        long long k1=lower_bound(a,a+n,x)-a;
        long long k2=n-(upper_bound(c,c+n,x)-c);
        //cout << k1 << " " << k2 << endl;
        ans += k1*k2;
    }
    cout << ans << endl;

}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
 
int main(){
    string s;
    cin >> s;
    bool flag = false;
    if(s[0] == s[1]){
        if(s[1] == s[2]) flag = true;
    }
    else if(s[1] == s[2]) {
        if(s[2] == s[3]) flag = true;
    }
    if(flag) cout << "Yes" << "\n";
    else cout << "No" << "\n";
    return 0;
}

Measured memory_bytes: 384
n,k = map(int,input().split())
sunuke = list()
count = 0

for i in range(k):
    d = int(input())
    sunuke.extend(list(map(int,input().split())))

for i in range(n):
    if sunuke.count(i+1) == 0:
        count += 1

print(count)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using longlong=long long;

[[maybe_unused]]auto cmn=[](auto&& a,auto b){if(a>b){a=b;return true;}return false;};
[[maybe_unused]]auto cmx=[](auto&& a,auto b){if(a<b){a=b;return true;}return false;};

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    std::map<std::string,int>map;
    int n;std::cin>>n;
    for(int i=0;i<n;i++){
        std::string s;std::cin>>s;
        map[s]++;
    }
    int m;std::cin>>m;
    for(int i=0;i<m;i++){
        std::string s;std::cin>>s;
        map[s]--;
    }
    int ans=0;
    for(auto&&p:map){
        cmx(ans,p.second);
    }
    std::cout<<ans<<std::endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)

N = int(input())
A = {}
B = {}
AplusB =[]

for i in range(N):
	a,b = map(int,input().split())
	A[i] = a
	B[i] = b
	AplusB.append((a+b,i))

AplusB.sort()
AplusB.reverse()


takahashi = 0
aoki = 0

for j in range(N):
	if(j%2 == 0):
		takahashi += A[AplusB[j][1]]
	else:
		aoki += B[AplusB[j][1]]

print(takahashi-aoki)


Measured memory_bytes: 35988
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    int r, g, b;

    cin >> r >> g >> b;
    cout << ((r * 100 + g * 10 + b) % 4 == 0 ? "YES":"NO") << endl;

    return 0;
}



Measured memory_bytes: 384
import sys
from collections import *

N,M=map(int,input().split())
adj=defaultdict(list)
for ln in sys.stdin:
    A,B=map(int,ln.split())
    A,B=A-1,B-1
    adj[A].append(B)
    adj[B].append(A)

a={0:0}
que=deque([0])
while que:
    u=que.popleft()
    for v in adj[u]:
        if v not in a:
            a[v]=u
            que.append(v)

if N-1-len(a)>0:
    print('No')
else:
    print('Yes')
    for i in range(1,N):
        print(a[i]+1)


Measured memory_bytes: 47412
#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

int a[100010];
vector<int> add;

int main(void){
	int n;
	cin >> n;
	rep(i,n) cin >> a[i];
	sort(a,a+n);
	reverse(a,a+n);

	int idx=0;
	while(idx+1<n && idx+1<a[idx+1]) idx++;

	int t=a[idx],r=idx;
	while(r<n&& idx<a[r]) r++; 

	//cout << t << " " << r << endl;

	int ans=min((t-idx)%2,(r-idx)%2);

	if(ans%2==0)
		puts("First");
	else
		puts("Second");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define repB(i, z, n) for(int i = n - 1; i >= z; i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;

int main(){
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> cor(N, 0);
    rep(i, 0, Q){
        int A;
        cin >> A;
        cor.at(A - 1)++;
    }
    rep(i, 0, N){
        if(K + cor.at(i) - Q > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
#include<iostream>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
const int MOD = 1000000007;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long 
signed main() 
{
    int n;
    cin>>n;
    int cnt1=0;
    int cnt2=0;
    int cnt3=0;
    int cnt4=0;
    while(n--)
    {
        string s;
        cin>>s;
        if(s=="AC")cnt1++;
        else if(s=="WA")cnt2++;
        else if(s=="TLE")cnt3++;
        else cnt4++;

    }
    cout<<"AC x "<<cnt1<<endl;
    cout<<"WA x "<<cnt2<<endl;
    cout<<"TLE x "<<cnt3<<endl;
    cout<<"RE x "<<cnt4<<endl;
    return 0; 
} 

Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
#define range(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) range(i, 0, n)
#define pb push_back

struct point {
    double x;
    double y;
};
int main()
{
    int n;
    int i = 0;
    cout << fixed;
    while (cin >> n, n > 0) {
        ++i;
        vector<point> P;
        rep(i, n)
        {
            double x, y;
            cin >> x >> y;
            point pnt;
            pnt.x = x;
            pnt.y = y;
            P.pb(pnt);
        }
        double sum = 0;
        range(i, 1, n - 1)
        {
            sum += (P[i].x - P[0].x) * (P[i + 1].y - P[0].y) - (P[i].y - P[0].y) * (P[i + 1].x - P[0].x);
        }
        cout << setprecision(0) << i << ' ' << setprecision(1) << abs(sum / 2) << endl;
    }
}



Measured memory_bytes: 3240
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    int water=0, sugar=0;
    for(int A=0; 100*A*a <= f; A++){
        for(int B=0; 100*(A*a+B*b) <= f; B++){
            int w = 100*(A*a+B*b);
            if(w==0) continue;
            int s = min((A*a+B*b)*e, f-w);
            for(int C=0; C*c<=s; C++) for(int D=0; D*d+C*c<=s; D++){
                int s_ = D*d + C*c;
                if(s_==0) continue;
                if(water==0 || (s_*(water+sugar) > sugar*(w+s_))){
                    water = w;
                    sugar = s_;
                }
            }
        }
    }

    if(water==0) water = 100*a;
    cout << water+sugar << " " << sugar << endl;
    return 0;}

Measured memory_bytes: 3604
using System;
using System.Globalization;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Char a = Char.Parse(Console.ReadLine());
            int b = a;
            if (b <= 90)
                Console.WriteLine("A");
            else
                Console.WriteLine("a");
        }
    }
}

Measured memory_bytes: 25880