akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
#define int long long
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
    int n;
    cin >> n;
    string a[n];
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep (i, 0, n) {
        cin >> a[i];
        if (a[i] == "AC") {
            ac++;
        } else if (a[i] == "WA") {
            wa++;
        } else if (a[i] == "TLE") {
            tle++;
        } else {
            re++;
        }
    }
    cout << "AC x " << ac << "\nWA x " << wa << "\nTLE x " << tle << "\nRE x "
         << re << "\n";
}


Measured memory_bytes: 6724
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] x = new int[n];
		int count = 0;

		for(int i = 0; i < n; i++){
			x[i] = Integer.parseInt(br.readLine());
		}

		for(int i = 0; i < n; i++){
			
			if(isPrime(x[i])){
				count++;
			}

		}

		System.out.println(count);

	}

	static boolean isPrime(int x){

		if(x == 2){
			return true;
		}

		if(x < 2 || (x % 2) == 0){
			return false;
		}

		int i = 3;

		while(i <= Math.sqrt(x)){

			if((x % i) == 0){
				return false;
			}

			i += 2;

		}

		return true;

	}

}

Measured memory_bytes: 30152
import java.util.Scanner;

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

		if (S.equals("Sunny")) {
			System.out.println("Cloudy");
		} else if (S.equals("Cloudy")) {
			System.out.println("Rainy");
		} else {
			System.out.println("Sunny");
		}
	}
}



Measured memory_bytes: 20564
#include <bits/stdc++.h>
#define ull unsigned long long
// #define _CRT_DISABLE_PERFCRIT_LOCKS

using namespace std;

int main(int argc, char const *argv[]) {
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ull n;
    std::cin >> n;
    std::map<int, int> f;
    double upp = sqrt(n);
    for (int x = 1; x <= upp; x++) {
        for (int y = 1; y <= upp; y++) {
            for (int z = 1; z <= upp; z++) {
                ull fi = x*x + y*y + z*z + x*y + y*z + z*x;
                if (fi > n) break;
                f[fi]++;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        std::cout << f[i] << '\n';
    }
}


Measured memory_bytes: 3860
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>
 
#define INT unsigned long long int
#define FOR1(n) for(int i=0;i<n;i++)
#define FOR2(j, n) for(int j=0;j<n;j++)
#define FOR3(i, m, n) for(int i=m;i<=n;i++)
#define PINT(d) printf("%d\n", d);
#define PDOUBLE(lf) printf("%lf\n", lf);
#define PSTR(s) printf("%s\n", s);
#define ALL(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX_N 100000
#define MAX_TIME 1e9 * 2000
 
using namespace std;
 
main(){
	long long int n, x;
	cin >> n >> x;
	long long int a[n];
	FOR1(n) cin >> a[i];
	long long int b[n];
	long long int ans = MAX_TIME;
	
	//魔法を唱える回数をk回に固定する
	FOR2(k, n){
		long long int sum = 0;
		FOR2(i, n){
			long long int tmp;
			tmp = a[(n - k + i) % n];
			
			if(k != 0 && tmp > b[i]){
			    tmp = b[i];
			}
			
			sum += tmp;
			b[i] = tmp;
		}
		ans = min(sum + k * x, ans);
	}
	
	cout << ans;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <bitset>
#include <utility>
#include <ctime>
#include <cassert>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef vector<pair<int, pair<int, int> > > viii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<vii> vvii;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) cin>>((a)[i])  
#define md 1000000007
#define MAXN 200005

int main()
{   
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin>>x;
    cout<<48-x;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	ios::sync_with_stdio(0);cin.tie(0);
    	int n,m,sum=0;
    	cin>>n>>m;
    	vector<int> v(n);
    	for(int &x: v)
    	{
    		cin>>x;sum+=x;
    	}
    	bool b;
    	if(sum%(4*m))b=true;
    	else b = false;
    	sum /=(4*m);
    	int cnt =0;
    	for(int x: v)
    	{
			if(b)
			{
				if(x>sum)cnt++;
			}
			else
			{
				if(x>=sum)cnt++;
			}
    	}
    	if(cnt<m)
    		cout<<"No\n";
    	else cout<<"Yes\n";
    }


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

class Program
{
    void Run()
    {
        var sc = new Scanner();
        long w = sc.NextLong();
        long h = sc.NextLong();
        long x = sc.NextLong();
        long y = sc.NextLong();


        Console.WriteLine("{0} {1}", (double)w * h / 2, 2 * x == w && 2 * y == h ? 1 : 0);
    }

    static void Main(string[] args)
    {
        new Program().Run();
    }

    static long Gcd(long a, long b)

    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


Measured memory_bytes: 13140
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    vector<queue<int> > q(3);
    for(int i=0; i<3; ++i){
        string s;
        cin >> s;
        for(char c : s)
            q[i].push(c - 'a');
    }

    int i = 0;
    while(!q[i].empty()){
        int j = q[i].front();
        q[i].pop();
        i = j;
    }
    cout << (char)('A' + i) << endl;

    return 0;
}

Measured memory_bytes: 256
/**
**	author : Raghav
**	codechef:raghav_456
**	codeforces:raghavramola7
**/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define endl 			"\n"
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void Raghav()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(10);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	Raghav();
	int n;
	cin >> n;
	int l = n / 100;
	int r = n % 100;
	if (l > 0 && l < 13)
	{
		if (r > 0 && r < 13)
			cout << "AMBIGUOUS";
		else
			cout << "MMYY";
	}
	else
	{
		if (r > 0 && r < 13)
			cout << "YYMM";
		else
			cout << "NA";
	}


	return 0;
}

Measured memory_bytes: 3488
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int[]x = new int[n];
    int[]y = new int[m];
 
    for(int i=0; i<n; i++) {
    	x[i] = sc.nextInt();
    }
    Arrays.sort(x);
    for(int i=0; i<m; i++) {
    	y[i] = sc.nextInt();
    }
    Arrays.sort(y);
    if(x[n-1]+1 <= y[0]){
    	if(X < x[n-1]+1 && x[n-1]+1 <= Y) {
    	System.out.println("No War");
    	}else {
       		System.out.println("War");
    	}
    }else {
   		System.out.println("War");
   	}
    }
}


Measured memory_bytes: 36156
import java.util.*;

public class Main {

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

        int n = sc.nextInt();
        int m = sc.nextInt();

        int array[] = new int[n + 1];

        int ans = 0;
        int wa = 0;

        for (int i = 0; i < m; i++) {
            int prb = sc.nextInt();
            String res = sc.next();

            if (array[prb] == -1) continue;

            if (res.equals("AC")) {
                wa += array[prb];
                ans++;
                array[prb] = -1;
            } else {
                array[prb]++;
            }
        }

        System.out.println(ans + " " + wa);

        sc.close();

    }

}

Measured memory_bytes: 60344
#include <set>
#include <cstring>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <unistd.h>

#define REP(i,n) for(int i=0; i<(int)(n); i++)

char buffer[1024 * 1024];
int pos = 0;
int end = 0;

inline int mygetchar(){
  if(pos == end){
    end = read(0, buffer, sizeof(buffer));
    pos = 0;
  }
  return buffer[pos++];
}

__attribute__((always_inline)) int getInt(){
  int ret = 0, c;
  c = mygetchar();
  while(!isdigit(c)) c = mygetchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = mygetchar();
  }
  return ret;
}

using namespace std;

int ux[1000001];
int uy[1000001];

int ucntyoko[500];
int ucnttate[500];
int ucntnaname[2];

int nx[1000001];
int ny[1000001];

int ncntyoko[500];
int ncnttate[500];
int ncntnaname[2];

int main(){
  int n = getInt();
  int u = getInt();
  int v = getInt();
  int m = getInt();

  memset(ux, -1, sizeof(ux));
  memset(uy, -1, sizeof(uy));
  memset(nx, -1, sizeof(nx));
  memset(ny, -1, sizeof(ny));

  REP(i,n) REP(j,n){
    int t = getInt();
    ux[t] = j; uy[t] = i;
  }
  REP(i,n) REP(j,n){
    int t = getInt();
    nx[t] = j; ny[t] = i;
  }

  int uans = 0;
  int nans = 0;

  REP(i,m){
    int t = getInt();

    if(ux[t] != -1){
      if(++ucnttate[uy[t]] == n) uans++;
      if(++ucntyoko[ux[t]] == n) uans++;
      if(ux[t] == uy[t])
        if(++ucntnaname[0] == n) uans++;
      if(ux[t] == n - 1 - uy[t])
        if(++ucntnaname[1] == n) uans++;
    }
    if(nx[t] != -1){
      if(++ncnttate[ny[t]] == n) nans++;
      if(++ncntyoko[nx[t]] == n) nans++;
      if(nx[t] == ny[t])
        if(++ncntnaname[0] == n) nans++;
      if(nx[t] == n - 1 - ny[t])
        if(++ncntnaname[1] == n) nans++;
    }

    if(n == 1){
      nans = min(1, nans);
      uans = min(1, uans);
    }

    if(uans >= u && nans >= v){
      puts("DRAW"); return 0;
    }else if(uans >= u){
      puts("USAGI"); return 0;
    }else if(nans >= v){
      puts("NEKO"); return 0;
    }
  }

  puts("DRAW");

  return 0;
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
ll mods = 1000000007;

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

    
    string s,t;
    cin >> s >> t;
    bool ans=true;

    rep(i,s.size()) if(s[i]!=t[i]) ans=false;
    if(ans==true) print("Yes");
    else print("No");
    return 0;

}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {
        try (final Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            String S = sc.next();
            // いったん白黒を数える、かつ境目の数も数える
            int border = 0;
            int b = 0;
            int w = 0;
            char prev = S.charAt(0);
            for (int i = 0; i < N; i++) {
                char c = S.charAt(i);
                b += c == '#' ? 1 : 0;
                w += c == '.' ? 1 : 0;
                if (c != prev) {
                    border += 1;
                }
                prev = c;
            }

            if (border == 1 && S.charAt(0) == '#') {
                // 境目が1つで黒からはじまる場合小さい方の数を採用
                System.out.println(Math.min(b, w));
            } else {
                // 境目ごとに左の黒、右の白の和を求めていく
                int leftB = 0;
                int rightW = w;
                int min = 0;
                prev = S.charAt(0);
                for (int i = 1; i < N; i++) {
                    char c = S.charAt(i);
                    leftB += prev == '#' ? 1 : 0;
                    rightW -= prev == '.' ? 1 : 0;
                    if (c != prev) {
                        int sum = leftB + rightW;
                        min = min == 0 ? sum : Math.min(min, sum);
                    }
                    prev = c;
                }
                System.out.println(min);
            }
        }
    }

}


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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int T,N;
string S;

ll gcd(ll x,ll y)
{
	return y ? gcd(y,x % y) : x;
}

string decode(string s,int a,int b)
{
	FOR(i,0,N) if(s [i] != ' '){
		int d = s [i] - 'a';
		(d += 26 - b) %= 26;
		while(d % a){
			d += 26;
		}
		(d /= a) %= 26;
		s [i] = d + 'a';
	}
	FOR(i,0,N - 3){
		if(s.substr(i,4) == "this" || s.substr(i,4) == "that"){
			return s;
		}
	}
	return "";
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> T;
	cin.ignore();
	FOR(testCase,0,T){
		getline(cin,S);
		N = S.size();
		string ans;
		FOR(i,1,26) if(gcd(26,i) == 1){
			FOR(j,0,26){
				string res = decode(S,i,j);
				if(res.empty() == false){
					ans = res;
					break;
				}
			}
			if(ans.empty() == false) break;
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
class UnionFind
{
public:
  int par[100005];
  int depth[100005];
  int nGroup[100005];
 
  UnionFind(int n) {
    init(n);
  }
 
  void init(int n) {
    for(int i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }
 
  int root(int x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }
 
  bool same(int x, int y) {
    return root(x) == root(y);
  }
 
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return;
 
    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
} 
int main() {
ll n,k; cin>>n;
ll a[n+1]={};
rep(i,n) cin>>a[i];
ll ca = 1000;
ll f1 = 0, f2 = 0;
for(ll i=0; i<n; i++){
if(a[i]<a[i+1]){
f1 = ca/a[i];
f2 = a[i];
ca = ca - f1*a[i];
i++;
while(1){
if(a[i]>a[i+1]){
ca += f1*a[i];
f1 = 0;
f2 = 0;
break;}
if(i==n){
break;}
i++;
}
//i--;
continue;}
}
if(f1>0){
ca+=f1*f2;}
cout << ca << endl;}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s,t;
	cin >> s >> t;
	vl ssum(s.size() + 1, 0), tsum(t.size() + 1, 0);
	rep(i, ssum.size()-1) {
		ssum[i + 1] = ssum[i] + (s[i] - '@');
	}
	rep(i, tsum.size()-1) {
		tsum[i + 1] = tsum[i] + (t[i] - '@');
	}
	int q, a, b, c, d;
	cin >> q;
	rep(i, q) {
		cin >> a >> b >> c >> d;
		bool ans = ((ssum[b]-ssum[a-1])%3==(tsum[d]-tsum[c-1])%3);
		cout << (ans ? "YES" : "NO") << endl;
	}
}


Measured memory_bytes: 2512
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def main():
    vowel = ['a','e','i','o','u']
    c = input()
    if c in vowel:
        print("vowel")
    else:
        print("consonant")
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 38636
import sys
sys.setrecursionlimit(2*10**7)


def dfs(y,x,h,w):
    graph[y][x] = 0
    for ny,nx in (y+1,x),(y-1,x),(y,x+1),(y,x-1),(y+1,x+1),(y-1,x-1),(y-1,x+1),(y+1,x-1):
        if not (0<=ny<h and 0<=nx<w) or graph[ny][nx] ==0:
            continue
        else:
            dfs(ny,nx,h,w)
    return 

while True:
    w,h = map(int,input().split())
    if w ==0 and h == 0:
        break
    graph = []
    for i in range(h):
        c = list(map(int,input().split()))
        graph.append(c)
    ans = 0
    for i in range(h):
        for j in range(w):
            if graph[i][j] == 1:
                ans += 1
                dfs(i,j,h,w)
    print(ans)



Measured memory_bytes: 9416
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		if(s[1]+s[2]>s[0]+1){
			Console.WriteLine(-1);
			return;
		}
		var ans=new int[s[0]];
		int p=s[0]-s[1],k=1;
		for(int j = 1;j<=s[0];j++) {
			for(int i = p;i<p+s[1]&&k<=s[0];i++,k++) {ans[i]=k;}
			if(p==0){break;}
			if(s[2]-j>=p-s[1]+1){
				if(j>=s[2]){
					Console.WriteLine(-1);
					return;
				}
				for(int i = 0;i<p-s[2]+j;i++,k++) {ans[i]=k;}
				for(int i = p-1;k<=s[0];i--,k++) {ans[i]=k;}
				break;
			}
			if(p<0){
				Console.WriteLine(-1);
				return;
			}
			p=Max(p-s[1],0);
		}
		Console.WriteLine("{0}",String.Join(" ",ans));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 36184
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n == 1){
            System.out.println("Yes");
            System.out.println("2");
            System.out.println("1 1");
            System.out.println("1 1");
            System.exit(0);
        }

        int k = -1;
        for(int i = 1; i <= n ; i++){
            if((i * (i-1) /2) == n){
                k = i;
                break;
            }
        }

        if(k == -1){
            System.out.println("No");
            System.exit(0);
        }

        List<Integer>[] ans = new List[k];
        for(int i = 0; i < k;i++){
            ans[i] = new ArrayList<>();
        }
        int num = 1;
        for(int i = 0;i < k;i++){
            for(int j = i+1;j<k;j++){
                ans[i].add(num);
                ans[j].add(num);
                num++;
            }
        }


        System.out.println("Yes");
        System.out.println(k);
        for(int i = 0; i < k;i++){
            System.out.print(ans[i].size() + " ");
            for(int j = 0;j < ans[i].size();j++){
                if(j != 0){
                    System.out.print(" ");
                }
                System.out.print(ans[i].get(j));
            }
            System.out.println("");
        }
    }
}

Measured memory_bytes: 45216
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<math.h>

int main(void){
    int n;
    scanf("%d",&n);

    printf("%d\n",(10-n/100)*100 + (10-n%10) + (10-(n/10)%10)*10);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
using namespace std;


int main(void) {

  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    double x1, y1, x2, y2;
    double x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if( abs((y2-y1)*(x4-x3) - (y4-y3)*(x2-x1)) < 0.0000000001 ) cout << "YES" << endl;
    else cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 3196
N,K,C=map(int,input().split())
S=input()

L=[-1]*K
R=[-1]*K

ind=0
for i in range(N):
  if S[i]=="o":
    if ind>0 and i-L[ind-1]<=C:
      continue
    else:
      L[ind]=i
      ind+=1
  if ind==K:
    break
      
ind=K-1
for i in range(N):
  j = N-1-i
  if S[j]=="o":
    if ind<K-1 and R[ind+1]-j<=C:
      continue
    else:
      R[ind]=j
      ind-=1
  if ind==-1:
    break
ans=[]
for i in range(K):
  if L[i]==R[i]:
    ans.append(L[i]+1)
if not ans:
  exit()

for a in ans:
  print(a)
  

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

using namespace std;

int main(){
  string a;
  cin>>a;
  char ch=a[a.length()-1];
  switch(ch){
    case '3':
      puts("bon");
      break;
    case '0':
    case '1':
    case '6':
    case '8':
      puts("pon");
      break;
    default:
      puts("hon");
      break;
  }
}

Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        for(int i=0; i < 3;i++){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println(a[0] + " " + a[1] + " " + a[2]);
    }
}


Measured memory_bytes: 26360
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000007
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;
int cmp(const void *a, const void *b) {
    if((*(lli*)b - *(lli*)a) > 0) {
        return 1;
    } else if((*(lli*)b - *(lli*)a) < 0) {
        return -1;
    }
    return 0;
}

int main()
{
    int n, i, temp=0;
    char s[200000];
    scanf("%d",&n);
    scanf("%s",s);
    for(i=0; i<n; i++) {
        if(s[i]=='.') {
            temp++;
        }
    }
    int min = temp;
    for(i=0; i<n; i++) {
        if(s[i]=='#') {
            temp++;
        } else {
            temp--;
        }
        min = MIN(min, temp);
    }
    printf("%d",min);
    return 0;
}


Measured memory_bytes: 384
#include <utility>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>

using namespace std;
#define REP(i, n)  for(int i=0;i<(int)(n);++i)
#define FOR(i, b, n)  for(int i=b;i<(n);++i)
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define SS size()
#define ST first
#define ND second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
int n;
ll C;
vector<pll> su;

ll solve() {
   vl back(n+1); back[n] = 0;
   ll sum = 0;
   for(int i=n-1; i>=0; i--) {
       sum += su[i].ND;
       back[i] = max(back[i+1], sum - (C - su[i].ST));
   }
   sum = 0;
   ll ans = 0;
   for(int i=0; i<n; i++) {
       sum += su[i].ND;
       amax(ans, sum - su[i].ST);  //single pass
       amax(ans, sum - 2 * su[i].ST + back[i+1]); //right-back-left
   }
   return ans;
}


int main() {
    ios::sync_with_stdio(0);
    cin >> n >> C;
    ll x, v;
    ll ans = 0;
    REP(i,n) {cin >> x >> v; su.push_back({x,v});}
    sort(ALL(su));
    ans = solve();
    REP(i,n) su[i].ST = C - su[i].ST;
    sort(ALL(su));
    amax(ans, solve());
    cout << ans << endl;
}






















Measured memory_bytes: 2672
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define badi_val 10e13
int main(){	
	ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	   	string s;
	   	cin >> s;
	   	for(int i = 0 ; i < s.size() ; i++){
	   		if(s[i] == ','){
	   			cout << " ";
	   		}
	   		else
	   			cout << s[i] ;
	   	}
	  // 	cout << s << endl;

		return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define S second
#define F first

using namespace std;

const int N = 2e5 + 5, M = 2 * N;

int arr[N], b[N];

int main()
{
    vector<int> v;
    int n;
    scanf("%d", &n);
    for(int i = 1 ; i <= n ; i++) scanf("%d", arr + i);
    for(int i = n ; i ; i--)
    {
        int sum = 0;
        for(int j = i + i ; j <= n ; j += i)
        {
            sum += b[j];
        }
        if((sum&1) != arr[i]) b[i] = 1, v.emplace_back(i);
    }
    printf("%d\n", v.size());
    for(int i = 0 ; i < v.size() ; i++) printf("%d%c", v[i], " \n"[i == v.size() - 1]);

    return 0;
}


Measured memory_bytes: 5392
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);


	ll a, b, c;
	cin >> a >> b >> c;

	if (c - b - a <= 0) {
		cout << "No" << endl;
		return 0;
	}
	if (4 * a * b < (c - b - a) * (c - b - a)) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
 int a,b;
 char op;
 scanf("%d %c %d", &a, &op, &b);
 while( !(op =='?')){if ( op =='+' ){
  printf("%d\n",a+b);}
   else if ( op =='-' ){
   printf("%d\n",a-b);}
 else if ( op =='*' ){
printf("%d\n",a*b);}
 else if ( op =='/' ){
 printf("%d\n",a/b);} 
  else {}
  scanf("%d %c %d", &a, &op, &b);}
  return 0;}

Measured memory_bytes: 600
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

string int_to_string(int x)
{
    string s;
    while(x!=0)
    {
        s.push_back(48+x%10);
        x/=10;
    }
    return s;
}
int main()
{
    int a, b,i,cnt=0,l,j,k,flag;
    cin >>a >> b;
    string x, y;
    for(i=a;i<=b;i++)
    {
       x= int_to_string(i);
       l=x.size();
       flag=1;
       for(j=0,k=l-1; j<=l-1/2;j++,k--) if(x[j]!=x[k]){flag=0;break;}
       if(flag==1) cnt++;
    }
    cout <<cnt;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
///1<<3シフト演算子 とは　0001の1を三つずらして1000にする, これは8を表しておりつまりbitは0から7まで
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"Yes"<<endl
#define cno cout<<"No"<<endl
#define sp <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using ld = long double;

//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S  S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定　変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換


int main(){
    
    string s;
    cin >> s;
    map<char,ll> ma;
    int len = s.size();
    rep(i,len){
        ma[s.at(i)]++;
    }
    ll cnt = 0;
    for(char ch = 'a'; ch <= char('z'-1); ch++){
        for(char cha = char(ch+1); cha <= 'z'; cha++){
            cnt += ma[ch]*ma[cha];
        }
    }
    
    cout << cnt + 1 << endl;


}


Measured memory_bytes: 640
def waru(a,b):
  if a%b==0:
    return a//b
  else:
    return (a//b)+1
N,K=map(int,input().split())
A=list(map(int,input().split()))
ue=sum(A)
sita=1
for i in range(50):
  n=(ue+sita)//2
  L=[waru(i,n)-1 for i in A]
  if sum(L)>K:
    sita=n
  else:
    ue=n
  if ue==sita:
    print(ue)
    exit()
  elif ue-sita==1:
    n=sita
    L=[waru(i,n)-1 for i in A]
    if sum(L)>K:
      print(n+1)
      exit()
    else:
      print(n)
      exit()

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

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

    string s;
    cin >> s;

    for(int i=0; i<s.size(); i++){
        if(i % 2 == 0) printf("%c", s[i]);
    }
    puts("");
    
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

//ここから


using P=pair<int,int>;
void solve(){
  int n,m,q;
  cin>>n>>m>>q;
  vector<vector<int>>sum(n+1,vector<int>(n+1));
  vector<vector<int>>c(n+1,vector<int>(n+1));
  rep(i,m){
    int x,y;
    cin>>x>>y;
    x--;y--;
    c[x][y]++;
  }
  rep(i,n){
    rep(j,n){
      sum[i+1][j+1]=sum[i+1][j]+sum[i][j+1]-sum[i][j]+c[i][j];
    }
  }
  rep(i,q){
    int l,r;
    cin>>l>>r;
    l--;r--;
    cout<<sum[r+1][r+1]+sum[l][l]-sum[l][r+1]-sum[r+1][l]<<"\n";
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 2944
N =  int(input())
A = list(map(int, input().split()))
i = 0
while True:
    x =  list(map(lambda x: x%2 ,  A))
    if sum(x) == 0:
        i += 1
        A = list(map(lambda x: x//2 ,  A))
    else:
        break
print(i)

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

using namespace std;

typedef long long ll;

const ll INF=1000000007;

int main(){
        ll N;
        cin>>N;
        vector <ll> a(N);
        for(int i=0;i<N;i++){
                cin>>a[i];
        }
        if(N%2==1){
                a.push_back(0);
        }
        sort(a.begin(), a.end());
        for(int i=0;i<N;i+=2){
                if(a[i]!=a[i+1]){
                        cout<<0<<endl;
                        return 0;
                }
        }
        int res=1;
        for(int i=0;i<N/2;i++){
                res*=2;
                res%=INF;
        }
        cout<<res<<endl;
        return 0;
}


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

std::pair<int64_t, int64_t> get_nei(int64_t x, std::set<int64_t>::iterator &c, const std::set<int64_t>::iterator &e) {
  int64_t first = 0;
  int64_t second = 0;
  auto tmp = c;
  while (tmp != e) {
    if (*tmp < x) {
      first = x - *tmp;
      c = tmp;
      tmp++;
    } else {
      second = *tmp - x;
      break;
    }
  }
  return {first, second};
}

int main() {
  int_fast16_t a, b, q;
  std::cin >> a >> b >> q;
  std::set<int64_t> s, t;
  std::map<int64_t, int_fast16_t> x;
  std::vector<int64_t> ans(q);

  int64_t tmp;
  for (int_fast16_t i = 0; i < a; i++) {
    std::cin >> tmp;
    s.insert(tmp);
  }

  for (int_fast16_t i = 0; i < b; i++) {
    std::cin >> tmp;
    t.insert(tmp);
  }

  for (int_fast16_t i = 0; i < q; i++) {
    std::cin >> tmp;
    x.insert(std::make_pair(tmp, i));
  }

  auto s_itr = s.cbegin();
  auto t_itr = t.cbegin();
  const auto s_end = s.cend();
  const auto t_end = t.cend();
  for (const auto i : x) {
    const auto s_nei = get_nei(i.first, s_itr, s_end);
    const auto t_nei = get_nei(i.first, t_itr, t_end);

    int64_t dis = std::numeric_limits<int64_t>::max();
    if (s_nei.first != 0 && t_nei.first != 0) {
      dis = std::min(dis, std::max(s_nei.first, t_nei.first));
    }
    if (s_nei.second != 0 && t_nei.second != 0) {
      dis = std::min(dis, std::max(s_nei.second, t_nei.second));
    }
    if (s_nei.second != 0 && t_nei.first != 0) {
      dis = std::min(dis, s_nei.second * 2 + t_nei.first);
    }
    if (s_nei.first != 0 && t_nei.second != 0) {
      dis = std::min(dis, t_nei.second * 2 + s_nei.first);
    }
    if (s_nei.first != 0 && t_nei.second != 0) {
      dis = std::min(dis, s_nei.first * 2 + t_nei.second);
    }
    if (s_nei.second != 0 && t_nei.first != 0) {
      dis = std::min(dis, t_nei.first * 2 + s_nei.second);
    }
    ans[i.second] = dis;
  }

  for (const auto i : ans) {
    std::cout << i << std::endl;
  }
  return 0;
}

Measured memory_bytes: 17664
main :: IO ()
main = do
  [a, b, k] <- map read . words <$> getLine
  let s = solve2 b $ solve1 k a
  putStrLn $ show (fst s) ++ " " ++ show (snd s)

solve1 k a
  | (k - a) <= 0 = (0, a - k)
  | (k - a) > 0 = (k - a, 0)

solve2 b (k, a)
  | a > 0 = (a, b)
  | (k - b) <= 0 = (0, b - k)
  | (k - b) > 0 = (0, 0)

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007

int main() {
 long long a,b,c;
 cin>>a>>b>>c;

 if(a%2==0||b%2==0||c%2==0){
     cout<<0<<endl;
 }
 else {
     long long ans=min({a*b,b*c,a*c});
     cout<<ans<<endl;
 }
}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if ((i*500 + j*100 + k*50) == X):
                ans += 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;


int main() {

    string N;
    cin >> N;
    long long ans = 0;
    for (int i = 0; i < (1 << N.size()-1); i++) {
        int bit=i; 
        string tmp="";
        tmp += N[0];
        for (int j = 0; j < N.size()-1; j++) {
            if ((bit & (1 << j)) != 0) {
                ans += stoll(tmp);
                tmp = "";
                tmp += N[j + 1];
            }
            else {
                tmp += N[j + 1];
            }
        }
        if (tmp != "") {
            ans += stoll(tmp);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>

using namespace std;

int main()
{
    string n;
    cin >> n;
    if (n.length() == 2){
        cout << n << endl;
    }
    else if(n.length() == 3){
        for (int i=0; i<3; ++i){
            cout << n[2-i];
        }
        cout << endl;
    }
}



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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

//???????????¶??¨??¨?????´???????±???????.
pair<int,int> farthest_vertex(const vector<vector<pair<int,int>>> &graph,int v,int p){
    pair<int,int> res(v,0); //(??????????????????,?????¢)
    for(auto &e:graph[v]){
        if(e.first==p) continue;

        auto tmp=farthest_vertex(graph,e.first,v);
        tmp.second+=e.second;
        if(res.second<tmp.second) res=tmp;
    }
    return res;
}

void solve(){
    int n;
    cin >> n;

    vector<vector<pii>> graph(n);
    rep(i,0,n-1){
        int s,t,w;
        cin >> s >> t >> w;
        graph[s].push_back(make_pair(t,w));
        graph[t].push_back(make_pair(s,w));
    }
    auto tmp=farthest_vertex(graph,0,-1);
    cout << farthest_vertex(graph,tmp.first,-1).second << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

Measured memory_bytes: 16020
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//array = input[1].split(" ");
    array = input[1];

    var x = 0;
    var max = 0;
    for(var i=0; i < parseInt(input[0]); i++){
        if ("I" == array.charAt(i)) {
            x++;
            if(x > max) max = x;
        }else{
            x--;
        }
    }
      
	//出力
	console.log(max);


}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
using namespace std;
inline int read()
{
    int sum=0,t=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-') t=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        sum=sum*10+ch-'0';
        ch=getchar();
    }
    return sum*t;
}
int n;
long long t,a;
int ans;
long double minn=19260817;
int main()
{
    int x;
    n=read();
    t=read();a=read();
    for(register int i=1;i<=n;++i)
    {
        x=read();
        long double now=(long double)((long double)t-(long double)x*0.006);
        if(fabs(a-now)<minn)
        {
            minn=fabs(a-now);
            ans=i;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
K,N=map(int,input().split())
A=list(map(int,input().split()))
sub=(A[0]-0)+(K-A[N-1])
#print(A)
for i in range(N-1):
    if A[i+1]-A[i]>sub:
        sub=A[i+1]-A[i]
print(K-sub)

Measured memory_bytes: 77900
# -*- coding: utf-8 -*-
# map(int, input().split())
N = int(input())

zorome = 0
for n in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        zorome += 1
    else:
        zorome = 0
    if zorome == 3:
        print('Yes')
        exit()

print('No')

Measured memory_bytes: 62328
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;

int main(){
lint N,v=0;
cin>>N;
pair<lint,lint> p[N];
rep(i,N){
  lint a,b;
  cin>>a>>b;
  p[i]=make_pair(b,a);
}
sort(p,p+N);
rep(i,N){
  lint c,d;
  tie(c,d)=p[i];
  v+=d;
  if(v>c){
    cout<<"No";
    return 0;
  }
}
cout<<"Yes";
}

Measured memory_bytes: 3328