akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;

	char s[10][10];
	int x[8] = {-1,0,1,-1,1,-1,0,1};
	int y[8] = {1,1,1,0,0,-1,-1,-1};


void witch(){
	int imax = 0,jmax = 0,kmax,maxcount = 0,count1,count2;
	int ax,ay;
	vector<int> vec,maxvec;
	for(int i = 1;i <= 8;i++){
		for(int j = 1;j <= 8;j++){
			count2 = 0;
			if(s[i][j] == '.'){
				for(int k = 0;k < 8;k++){
					ay = i+y[k];
					ax = j+x[k];
					if(s[ay][ax] == 'o'){
						count1 = 1;
						while(1){
							ay += y[k];
							ax += x[k];
							if(s[ay][ax] == 'o')count1++;
							else if(s[ay][ax] == 'x'){
								count2 += count1;
								vec.push_back(k);
								break;
							}
							else break;
						}
					}
				}
				if(count2 >= maxcount){
					maxcount = count2;
					imax = i;
					jmax = j;
					maxvec.clear();
					copy(vec.begin(),vec.end(),back_inserter(maxvec));
				}
				vec.clear();
			}
		}
	}
	if(maxcount > 0){
		s[imax][jmax] = 'x';
		for(int i = 0;i < maxvec.size();i++){
			ay = imax;
			ax = jmax;
			while(1){
				ay += y[maxvec[i]];
				ax += x[maxvec[i]];
				if(s[ay][ax] == 'x')break;
				else s[ay][ax] = 'x';
			}
		}
	}
}

void mami(){
	int imax = 0,jmax = 0,kmax,maxcount = 0,count1,count2;
	int ax,ay;
	vector<int> vec,maxvec;
	for(int i = 8;i >= 1;i--){
		for(int j = 8;j >= 1;j--){
			count2 = 0;
			if(s[i][j] == '.'){
				for(int k = 0;k < 8;k++){
					ay = i+y[k];
					ax = j+x[k];
					if(s[ay][ax] == 'x'){
						count1 = 1;
						while(1){
							ay += y[k];
							ax += x[k];
							if(s[ay][ax] == 'x')count1++;
							else if(s[ay][ax] == 'o'){
								count2 += count1;
								vec.push_back(k);
								break;
							}
							else break;
						}
					}
				}
				if(count2 >= maxcount){
					maxcount = count2;
					imax = i;
					jmax = j;
					maxvec.clear();
					copy(vec.begin(),vec.end(),back_inserter(maxvec));
				}
				vec.clear();
			}
		}
	}
	if(maxcount > 0){
		s[imax][jmax] = 'o';
		for(int i = 0;i < maxvec.size();i++){
			ay = imax;
			ax = jmax;
			while(1){
				ay += y[maxvec[i]];
				ax += x[maxvec[i]];
				if(s[ay][ax] == 'o')break;
				else s[ay][ax] = 'o';
			}
		}
	}
}

void game(int d){
	int d1 = d,d2;
	while(1){
		mami();
		witch();
		d2 = 0;
		for(int i = 1;i <= 8;i++){
			for(int j = 1;j <= 8;j++){
				if(s[i][j] == '.')d2++;
			}
		}
		if(d1 == d2)break;
		d1 = d2;
	}
}

int main(){
	int d = 0;
	for(int i = 0;i < 10;i++){
		for(int j = 0;j < 10;j++){
			s[i][j] = ',';
		}
	}
	for(int i = 1;i <= 8;i++){
		for(int j = 1;j <= 8;j++){
			cin >> s[i][j];
			if(s[i][j] == '.'){
				d++;
			}
		}
	}

	game(d);

	for(int i = 1;i <= 8;i++){
		for(int j = 1;j <= 8;j++){
			cout << s[i][j];
		}
		cout << endl;
	}

	return 0;
}

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

int main(){
	ll n;
	cin>>n;
	vector<vector<pair<ll,ll>>>ro(n+1);
	for(int i=0;i<n-1;i++){
		ll a,b,c;
		cin>>a>>b>>c;
		ro[a].push_back({b,c});
		ro[b].push_back({a,c});
	}
	queue<ll>que;
	ll q,k;
	cin>>q>>k;
	ll dis[114514];
	for(int i=1;i<=n;i++)dis[i]=-1;
	que.push(k);
	dis[k]=0;
	while(!que.empty()){
		ll x=que.front();
		que.pop();
		for(int i=0;i<ro[x].size();i++){
			if(dis[ro[x][i].first]!=-1)continue;
			dis[ro[x][i].first]=dis[x]+ro[x][i].second;
			que.push(ro[x][i].first);
		}
	}
	for(int i=0;i<q;i++){
		ll a,b;
		cin>>a>>b;
		cout<<dis[a]+dis[b]<<endl;
	}
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

    string s;
    cin >> s;

    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

#define pan(i,n) for(int i=0;i<n;i++)
#define pans(i,n,a) for(int i=a;i<n;i++)
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
#define inf 100007
#define P pair<ll,ll>

using namespace std; 

int main(){
    int n,m;
    cin>>n>>m;
    vi a(m);
    ll sum=0;
    pan(i,m){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum<=n) cout<<n-sum;
    else cout<<-1;
}

Measured memory_bytes: 3632
fn main() {
    let sc = std::io::stdin();
    let mut sc = Scanner { reader: sc.lock() };
    let n: usize = sc.read();
    let x: Vec<i64> = sc.read_vec(n);
    let m: usize = sc.read();
    let k: usize = sc.read();
    let a: Vec<usize> = (0..m).map(|_| sc.read::<usize>() - 1).collect();

    let mut t: Vec<usize> = (0..(n - 1)).collect();
    for &a in a.iter() {
        t.swap(a, a - 1);
    }

    let result = pow(t, k);
    let mut ans: Vec<i64> = vec![0; n - 1];
    for i in 0..(n - 1) {
        ans[i] = x[result[i] + 1] - x[result[i]];
    }

    let mut cur = x[0];
    println!("{}", cur);
    for i in 0..(n - 1) {
        cur += ans[i];
        println!("{}", cur);
    }
}

fn pow(mut t: Vec<usize>, mut e: usize) -> Vec<usize> {
    let n = t.len();
    let mut result = (0..n).collect::<Vec<usize>>();
    while e > 0 {
        if e & 1 == 1 {
            result = (0..n).map(|i| result[t[i]]).collect();
        }
        e >>= 1;
        t = (0..n).map(|i| t[t[i]]).collect();
    }
    result
}

pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 11792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String str = sc.next();
		int x = 0;
		int[] nums = new int[n];
		String[] strs = str.split("");
		for(int i=0; i<strs.length; i++) {
			if(strs[i].equals("I")) {
				x += 1;
				nums[i] = x;
			}else if(strs[i].equals("D")) {
				x -= 1;	
				nums[i] = x;
			}
		}
		int max = Integer.MIN_VALUE;
		for(int i=0; i<nums.length; i++) {
			max = Math.max(max, nums[i]);
		}
		if(max < 0) {
			System.out.println(0);
		}else {
			System.out.println(max);
		}
	}
}


Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 1e4
#define MOD 1000000007
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
vi inde(MAX,0);
ll cal(int num, int div){
    int ans=1;
    while(true){
        if(num%div==0){num/=div; ans++;}
        else break;
    }
    if(!inde[div])inde[div]+=ans; else inde[div]+=ans-1;
    return 0;
}
int main(){
    vector<bool>Primecheck(MAX+1,true);
    vector<int>Primenumber(MAX+1,0); //Primearray
    int Primecounter =0;                  //Primearray counter;
    for(int i = 2; i<MAX+1;i++){
        if(Primecheck[i]){
            for(int j = 2;i*j<MAX;j++)
                Primecheck[i*j] = false;//素数ならPrimearrayに格納してその倍数を全てfalseに
            Primenumber[Primecounter] = i;
            Primecounter++;
        }
    }
    ll num; cin>>num;
    ll ans=1;
    for(int n=(int)num; n>1; n--){
        for(int i=0; i<Primecounter;i++){
            if(Primenumber[i]>n)break;
            if(n%Primenumber[i]==0){cal(n,Primenumber[i]);}
        }
    }
    for(int i=0; i<num+1; i++){
        if(inde[i]){ans*=inde[i]; ans%=MOD;}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

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; }
const long long INF = 1LL << 60;
typedef pair<int, int> PR;

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define fr(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}
//cout<<""<<endl;

int main(){
  int N;
  string S;
  cin>>S;
  N=S.size();
  if(S[N-1]=='s')cout<<S+"es"<<endl;
  else cout<<S+'s'<<endl;
}



Measured memory_bytes: 3608
#pragma GCC optimize("O3")
// #include <atcoder/all>
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int n;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n;
  vector<int> t(n);
  vector<int> res(n);
  vector<int> kt(n);
  R(i,n){
    int x,y;
    cin >> x >> y;
    x--;y--;
    t[x] = n - y - 1;
    kt[x] = i;
  }
  int ma = 0;
  int ost = -1;
  R(i,n){
    maxi(ma,t[i]);
    if(ma == i){
      for(int j = ost + 1; j <= i; j++){
        res[kt[j]] = i - ost;
      }
      ost = i;
    }
  }
  R(i,n)cout << res[i] << "\n";
}


Measured memory_bytes: 7952
#include "bits/stdc++.h"
using namespace std;
 
struct info {
    int x, y, h;
};
 
int main() {
    int N;
    info P[100];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> P[i].x >> P[i].y >> P[i].h;
    for (int Cx = 0; Cx <= 100; Cx++) {
        for (int Cy = 0; Cy <= 100; Cy++) {
            int Ch = 0;
            for (int i = 0; i < N; i++) {
                if (P[i].h > 0) Ch = abs(Cx - P[i].x) + abs(Cy - P[i].y) + P[i].h;
            }
            bool check = true;
            for (int i = 0; i < N; i++) {
                if (max(Ch - abs(Cx - P[i].x) - abs(Cy - P[i].y), 0) != P[i].h) check = false;
            }
            if (check) {
                cout << Cx << " " << Cy << " " << Ch << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int main() {
    int X;
    int Y;
    int A;
    int B;
    int C;
    long long sum = 0;

    cin >> X >> Y >> A >> B >> C;

    vector <int> red(A);
    vector <int> green(B);
    vector <int> noc(C);

    for (int i = 0; i < A; ++i) {
        cin >> red[i];
    }

    for (int i = 0; i < B; ++i) {
        cin >> green[i];
    }

    for (int i = 0; i < C; ++i) {
        cin >> noc[i];
    }


    sort(red.begin(), red.end(), greater<int>());
    sort(green.begin(), green.end(), greater<int>());
    sort(noc.begin(), noc.end(), greater<int>());
    int offset[3] = {0, 0, 0};

    while (X && Y) {
        int redChoice = offset[0] < red.size() ? red[offset[0]] : -1;
        int greenChoice = offset[1] < green.size() ? green[offset[1]] : -1;
        int nocChoice = offset[2] < noc.size() ? noc[offset[2]] : -1;

        if (nocChoice > max(redChoice, greenChoice)) {
            int redEnd = offset[0]+X-1 < red.size() ? red[offset[0]+X-1] : -1;
            int greenEnd = offset[1]+Y-1 < green.size() ? green[offset[1]+Y-1] : -1;

            if (redEnd < greenEnd) { // not sure
                --X;
                sum += noc[offset[2]++];
            } else {
                --Y;
                sum += noc[offset[2]++];
            }
        } else {
            if (redChoice > greenChoice) {
                --X;
                sum += red[offset[0]++];
            } else {
                --Y;
                sum += green[offset[1]++];
            }
        }
    }

    while (X) {
        int redChoice = offset[0] < red.size() ? red[offset[0]] : -1;
        if (offset[2] < noc.size() && noc[offset[2]] > redChoice) {
            sum += noc[offset[2]++];
        } else {
            sum += red[offset[0]++];
        }
        --X;
    }

    while (Y) {
        int greenChoice = offset[1] < green.size() ? green[offset[1]] : -1;
        if (offset[2] < noc.size() && noc[offset[2]] > greenChoice) {
            sum += noc[offset[2]++];
        } else {
            sum += green[offset[1]++];
        }
        --Y;
    }

    cout << sum << endl;

    return 0;
}

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

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

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

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

int main(){
	int n, m, K;
	scanf("%d%d%d", &n, &m, &K);
	bool ans = false;
	for (int i = 0; i <= n; ++i)
		for (int j = 0; j <= m; ++j)
			ans |= K == i * m + j * n - i * j * 2;
	puts(ans ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
string str;
ll dp[MAX_N][13];

void solve() {
	cin >> str;
	N = sz(str);
	dp[0][0] = 1;
	rep(i, 0, N) {
		rep(j, 0, 13) {
			rep(k, 0, 10) {
				if(str[i] == '?' || str[i] - '0' == k) {
					ADD(dp[i + 1][(j * 10 + k) % 13], dp[i][j]);
				}
			}
		}
	}
	cout << dp[N][5] << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 10704
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

int main()
{
  string s;
  int ans=0,rain=0;
  cin >> s;
  rep(i,3){
    if(s[i]=='R')rain++;
    else rain=0;
    if(ans<rain)ans=rain;
  }
  cout << ans <<endl;
  return 0;

}

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

const int maxn = 2e3 + 3;
int n, m, q, a[maxn][maxn], b[maxn][maxn], c[maxn][maxn];

char mp[maxn][maxn];

int V(int u, int v, int x, int y) {
	--u; --v;
	return a[x][y] - a[u][y] - a[x][v] + a[u][v];
}

int E(int u, int v, int x, int y) {
	return b[x][y] - b[u - 1][y] - b[x][v] + b[u - 1][v]
		+ c[x][y] - c[u][y] - c[x][v - 1] + c[u][v - 1];
}

int main() {
	scanf("%d%d%d", &n, &m, &q);
	for(int i = 1; i <= n; ++i)
		scanf("%s", mp[i] + 1);
	for(int i = 1; i <= n; ++i)
	for(int j = 1; j <= m; ++j)
		mp[i][j] -= '0';
	for(int i = 1; i <= n; ++i)
	for(int j = 1; j <= m; ++j) {
		a[i][j] = mp[i][j] + a[i][j - 1];
		b[i][j] = (mp[i][j] == 1 && mp[i][j - 1]) + b[i][j - 1];
		c[i][j] = (mp[i][j] == 1 && mp[i - 1][j]) + c[i][j - 1];
	}
	for(int j = 1; j <= m; ++j)
	for(int i = 1; i <= n; ++i) {
		a[i][j] += a[i - 1][j];
		b[i][j] += b[i - 1][j];
		c[i][j] += c[i - 1][j];
	}
	for(int i = 0, u, v, x, y; i < q; ++i) {
		scanf("%d%d%d%d", &u, &v, &x, &y);
		printf("%d\n", V(u, v, x, y) - E(u, v, x, y));
	}
	return 0;
}


Measured memory_bytes: 52736
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int n ;cin >> n;
    vector<ll> ar(n);
    bool t = false;
    rep(i,n){
        cin >> ar[i];
        if (ar[i] == 0) t = true;
    }
    if (t) {cout << 0 << endl; return 0;}
    ll ans = 1;
    t = true;
    rep(i,n){
        long double b = 1e18;
        long double c = ar[i];
        ll cc = ar[i];
        long double d = b / c;
        long double e = ans;
        if (e > d){
            t = false;
            break;
        }
        else ans *= cc;
    }
    if (t && ans <= ll(1e18)) cout << ans << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 3960
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define pii pair<int,int> 
signed main(){
    fast;
    int n,r;
    cin>>n>>r;
    if(n>=10)
    	cout<<r;
    else{
    	int ans = r + (10-n)*100;
    	cout<<ans;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int f[10005];
int main(){
	int h,n,a,b;scanf("%d%d",&h,&n);
	memset(f,0x1f,sizeof(f)),f[h]=0;
	for(int i=0;i<n;i++){
		scanf("%d%d",&a,&b);
		for(int j=h;j;j--){
			f[max(0,j-a)]=min(f[max(0,j-a)],f[j]+b);
		}
	}
	printf("%d",f[0]);
	return 0;
} 

Measured memory_bytes: 256
n = int(input())
# A = []
# B = []
AB = []

for i in range(n):
    ab = list(map(int, input().split()))
    AB.append(ab)

AB = sorted(AB, key=lambda x: x[1])
#print(AB)
#print(sorted(AB, key=lambda x: x[1]))

current = 0
ans = True
for i in range(n):
    time = AB[i][0]
    now = current + time

    if now <= AB[i][1]:
        current += time
        continue
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 55172
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * https://atcoder.jp/contests/abc170/submissions/14453474 を参考に作成
 */
public class Main {

	/** 計算するための最大値 */
	private static final int INF = Integer.MAX_VALUE >> 1;
	/** X,Y座標の差分一覧 */
	private static final int[] DXS = { 1, -1, 0, 0 };
	private static final int[] DYS = { 0, 0, 1, -1 };
	/** 通過可能の文字 */
	private static final char OK = '.';

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int h = scanner.nextInt(), w = scanner.nextInt(), k = scanner.nextInt();
			int x1 = scanner.nextInt() - 1, y1 = scanner.nextInt() - 1;
			int x2 = scanner.nextInt() - 1, y2 = scanner.nextInt() - 1;
			boolean[][] c = new boolean[h][w];
			IntStream.range(0, h).forEach(i -> {
				char[] ci = scanner.next().toCharArray();
				IntStream.range(0, w).forEach(j -> c[i][j] = (ci[j] == OK));
			});
			int[][] dist = new int[h][w];
			IntStream.range(0, h).forEach(i -> Arrays.fill(dist[i], INF));
			boolean[][] visited = new boolean[h][w];
			IntStream.range(0, h).forEach(i -> Arrays.fill(visited[i], false));
			int steps = -1;
			Queue<Data> queue = new ArrayDeque<>();
			queue.add(new Data(x1, y1, 0));
			dist[x1][y1] = 0;
			visited[x1][y1] = true;
			while (!queue.isEmpty()) {
				Data data = queue.poll();
				if ((x2 == data.x) && (y2 == data.y)) {
					steps = data.depth;
					break;
				}
				IntStream.range(0, DXS.length).forEach(i -> {
					for (int j = 1; j <= k; j++) {
						int nX = data.x + DXS[i] * j;
						int nY = data.y + DYS[i] * j;
						int nDepth = data.depth + 1;

						if (!((nX >= 0) && (nX < h) && (nY >= 0) && (nY < w))) {
							break;
						}
						if ((!c[nX][nY]) || (dist[nX][nY] < nDepth)) {
							break;
						}
						if (!visited[nX][nY]) {
							queue.add(new Data(nX, nY, nDepth));
							dist[nX][nY] = nDepth;
							visited[nX][nY] = true;
						}
					}
				});
			}
			System.out.println(steps);
		}
	}

	/**
	 * x,yと深さを格納するクラス
	 */
	private static class Data {
		int x;
		int y;
		int depth;

		public Data(int x, int y, int depth) {
			super();
			this.x = x;
			this.y = y;
			this.depth = depth;
		}
	}
}


Measured memory_bytes: 68428
from scipy import misc
N,P = (int(x) for x in input().split())
A = list(map(int, input().split()))
o = sum(x % 2 == 1 for x in A)
e = sum(x % 2 == 0 for x in A)
if P == 0:
    sum0 = sum(misc.comb(o, i, exact=True) for i in range(0, o+1, 2))
    print(sum0*(2**e))
else:
    sum1 = sum(misc.comb(o, i, exact=True) for i in range(1, o+1, 2))
    print(sum1*(2**e))

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mkp make_pair

#define se second
#define fi first



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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int a,b,c;
    cin >>a>>b>>c;

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << a+b+c - max(a,max(b,c)) << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

#define rep(i,N) repf(i,0,N)
#define reps(i,N) repfs(i,0,N)
#define repf(i,a,b) for(int i=a;i<b;i++)
#define repfs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<"."
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<"."
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"."
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d<<"."
#define da(arr,N){if(isDebugMode){rep(i,N){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N){rep(j,M){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
int n;
int m[10000][101];
void factorize(int num,int primes[]){
	bool is_roop=true;
	while(is_roop){
		is_roop=false;
		for(int i=2;i*i<=num;i++)
			if(num%i==0){
				is_roop=true;
				num/=i;
				primes[i]++;
				break;
			}
	}
	primes[num]++;
}


void reset(){
	rep(i,10000)
		rep(j,101) m[i][j]=false;
}
void solve(){
	int primes[101]={};
	reps(i,n){
		factorize(i,primes);
	}
	int ans=0;
	reset();
	reps(i,100){
		if(primes[i]<4) continue;
		reps(j,100){
			if(i==j||primes[j]<4) continue;
			reps(q,100){
				if(i==q||j==q||primes[q]<2) continue;
				if(m[i*j][q]) continue;
				else{
					ans++;
					m[i*j][q]=true;
				}
			}
		}
	}
	reset();
	reps(i,100){
		if(primes[i]<24) continue;
		reps(j,100){
			if(i==j||primes[j]<2) continue;
			if(m[i][j]) continue;
			else{
				ans++;
				m[i][j]=true;
			}
		}
	}
	reset();
	reps(i,100){
		if(primes[i]<14) continue;
		reps(j,100){
			if(i==j||primes[j]<4) continue;
			if(m[i][j]) continue;
			else{
				ans++;
				m[i][j]=true;
			}
		}
	}
	if(primes[2]>=74) ans++;
	cout<<ans<<endl;
}

int main(){
	cin>>n;
	solve();
	return 0;
}


Measured memory_bytes: 4224
#include <iostream>
using namespace std;
bool flag[10000001];

int main(){
    int n;
    for(int i=0;i <= 10000000;i++){
        if(i<=1)flag[i]=false;
        else flag[i]=true;
    }
    for(int i=2;i * i <= 10000000 ;i++){
        if(flag[i]==true){
            for(int j=i*2 ; j<=10000000 ; j=j+i){
                flag[j] = false;
            }
        }
    }
    while(cin>>n,n){
        for(int i=n;i!=0;i--){
            if(flag[i]&&flag[i-2]&&flag[i-6]&&flag[i-8]){
                cout<<i<<endl;
                break;
            }
        }
    }
}

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

int main(void){
    long long int n , m ;
    cin >> n >> m ;
    long long int a ,b ;
    a = m ;
    b = n ;
    long long int ans = 1 ;
    if(n <= 1 && m <= 1){
        ans = 0 ;
    }else if(n <= 1){
       
        for(int i = 0 ; i < 2 ; i++){
            ans = ans * m ;
            m = m - 1 ;

        }
        ans = ans / 2 ;
    }else if(m <= 1){
       
        for(int i = 0 ; i < 2 ; i++){
            ans = ans * n ;
            n = n - 1 ;

        }
        ans = ans / 2 ;
    }else{
        int ansa , ansb  ;
        ansa = 1 ;
        ansb = 1 ;
         for(int i = 0 ; i < 2 ; i++){
            ansa = ansa * n ;
            n -- ;

        }
         for(int j = 0 ; j < 2 ; j++){
            ansb = ansb * m ;
            m -- ;

        }
        
        ans = (ansa / 2) + (ansb / 2)  ;

    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%s", $T);

$answer = "No\n";
for ($i = 0; $i < strlen($S); $i++) {
	$x = substr($S, $i) . substr($S, 0, $i);
	if ($x == $T) {
		$answer = "Yes\n";
	}
}

echo $answer;


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
////////////////////////////////////////

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    
    int n,m;cin>>n>>m;
    ll c[m+1];rep(i,1,m)cin>>c[i];
    ll dp[m+1][n+1]; fill(dp[0],dp[m+1],inf);
    rep(i,0,m)dp[i][0]=0;
    rep(i,1,m){
        rep(j,0,n){
            dp[i][j]=dp[i-1][j];
            if(j-c[i]>=0){
                ll q=min(dp[i][j-c[i]],dp[i-1][j-c[i]])+1;
                dp[i][j]=min(q,dp[i][j]);
            }
        }
    }
    /*(i,0,m){
        rep(j,0,n){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[m][n]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 11440
#include<iostream>
using namespace std;
static const int MAX = 100;

void trace(int A[], int n){
  for(int i=0; i<n; i++ ){
    if(i>0)cout<<' ';
    cout<<A[i];
  }
  cout<<endl;   
}

int selectionSort(int A[],int N){
  int times = 0;
  for (int i=0; i<N; i++ ){
    int minj=i;
    for(int j=i; j<N; j++){
      if(A[j] < A[minj]){
        minj = j;
      }
    }
    if( i!=minj ){
      swap(A[i],A[minj]);
      times++;
    }
  }
  trace(A,N);
  return times;
}

int main(){
  int n, a[MAX], times;

  cin >> n;

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

  times = selectionSort(a,n);
  cout << times << endl;

  return 0;
}


Measured memory_bytes: 3092
n = int(input())
l_list = list(map(int,input().split()))
c = 0
for hoge in l_list:
  c += hoge
e = 0
for poge in l_list:
  if c-poge <= poge:
    e += 1
if e == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    int x, y, a;
    vec v(N, 0);
    REP(i, N - 1){
        cin >> x >> y >> a;
        v[x] ^= a;
        v[y] ^= a;
    }
    vec cnt(16, 0);
    for(int i: v) cnt[i]++;
    int ans = 0;
    int X = 0;
    REP(i, 15){
        ans += cnt[i + 1] / 2;
        if(cnt[i + 1] % 2) X ^= bit(i);
    }

    vec dp(bit(15), INF);
    dp[0] = 0;
    FOR(n, 1, 15 + 1){
        int comb = bit(n) - 1;
        while(comb < bit(15)){
            int tmp = 0;
            REP(i, 15) if((comb >> i) & 1) tmp ^= (i + 1);
            if(tmp == 0){
                REP(i, 15) REP(j, 15) if(i != j && bit_exist(comb, i) && bit_exist(comb, j)){
                    int k = ((i + 1) ^ (j + 1)) - 1;
                    if(bit_exist(comb, k)) Min(dp[comb], dp[comb ^ bit(i) ^ bit(j) ^ bit(k)] + 2);
                    else Min(dp[comb], dp[comb ^ bit(i) ^ bit(j) ^ bit(k)] + 1);
                }
            }

            x = comb & -comb, y = comb + x;
            comb = ((comb & ~y) / x >> 1) | y;
        }

    }
    ans += dp[X];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main(){
    int n, x, count=0, a, b, c;
    while(1){
        cin >> n >> x;
        if(n==0 && x==0){
            break;
        }
        a = n;
        while(1){
            b = x-a-1;
            c = 1;
            if(a <= x/3){
                break;
            }
            while(1){
                if(b <= c){
                    break;
                }
                if(a > b){
                    count++;
                }
                b--;
                c++;
            }
            a--;
        }
        
        cout << count << endl;
        
        count = 0;
    }
    
    return 0;
}


Measured memory_bytes: 3080
n = int(input())
et=0
arr = list(map(int , input().split()))
count = [0 for i in range(0,10)]
for i in range(0 , n):
	if arr[i]>=1 and arr[i]<=399:
		count[0]=count[0]+1
	elif arr[i]>=400 and arr[i]<=799:
		count[1]=count[1]+1
	elif arr[i]>=800 and arr[i]<=1199:
		count[2]=count[2]+1
	elif arr[i]>=1200 and arr[i]<=1599:
		count[3]=count[3]+1
	elif arr[i]>=1600 and arr[i]<=1999:
		count[4]=count[4]+1
	elif arr[i]>=2000 and arr[i]<=2399:
		count[5]=count[5]+1
	elif arr[i]>=2400 and arr[i]<=2799:
		count[6]=count[6]+1
	elif arr[i]>=2800 and arr[i]<=3199:
		count[7]=count[7]+1
	else:
		et = et+1
mn =1000
mx =0
tot=0
for i in range(0, 8):
	if count[i]>0:
		tot=tot+1
if tot==0:
	print(1,et)
else:
	print(tot , tot+et)


Measured memory_bytes: 62284
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max = 1e5 + 7;
string lst[Max];

int main()
{
	int n;
	cin >> n;
	int mi = 1e9, ma = -7;
	for (int i = 1; i <= n; i++)
	{
		int t;
		cin >> t;
		mi = min(mi, t);
		ma = max(ma, t);
	}
	cout << ma - mi;
}

Measured memory_bytes: 5508
#include<bits/stdc++.h>
using namespace std;
bitset<4000001>kk;
int num[2100],n,sum;
int main() { 
	scanf("%d",&n);
	for(int i=1;i<=n;++i) { 
		scanf("%d",&num[i]);
		sum+=num[i];
	} 
	kk[0]=1;
	for(int i=1;i<=n;++i) { 
		kk|=(kk<<num[i]);
	} 
	for(int i=(sum+1)/2;;++i) { 
		if(kk[i]) { 
			printf("%d",i);
			return 0;
		} 
	} 
	return 0;
} 


Measured memory_bytes: 1792
sA = input().rstrip()
sB = input().rstrip()
sC = input().rstrip()
next = 'a'
while True:
    #print(next,sA,sB,sC)
    if next == 'a' and len(sA) == 0:
        print("A")
        break
    elif next == 'b' and len(sB) == 0:
        print("B")
        break
    elif next == 'c' and len(sC) == 0:
        print("C")
        break

    if next == 'a':
        next = sA[0]
        sA = sA[1:]
    elif next == 'b':
        next = sB[0]
        sB = sB[1:]
    elif next == 'c':
        next = sC[0]
        sC = sC[1:]

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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define MAXX 500005
#define INF INT_MAX

#define PI   3.14159265358979323846264338327950

#define PB push_back
#define PF push_front
#define F first
#define S second

#define fixx(n) fixed << setprecision(n)

#define ll 	 long long

#define mod  1000000007

map<int, bool> m;

int main()
{
	FAST;
	int a, b;
	cin >> a >> b;
	m[a] = true;
	m[b] = true;
	for(int i = 1; i <= 3; i ++){
		if(!m[i]){
			cout << i;
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
typedef long long ll;

int main(){
  string s, t;
  int a, b;
  string u;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;

  if(s == u) a--;
  if(t == u) b--; 

  cout << a << " " << b << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[101][101],b[10001];
int main ()
{
	int h,w;
	scanf("%d%d",&h,&w);
		int i,j,t,k=0;
		scanf("%d",&t);
		for(i=0;i<t;i++)
			scanf("%d",&b[i]);
		for(i=0;i<h;i++)
		{
			if(i%2==0)
				for(j=0;j<w;j++)
				{
					a[i][j]=k+1;
					b[k]--;
					if(b[k]==0)
						k++;
				}
			if(i%2==1)
				for(j=w-1;j>=0;j--)
				{
					a[i][j]=k+1;
					b[k]--;
					if(b[k]==0)
						k++;
				}
		}
		for(i=0;i<h;i++)
		{
			for(j=0;j<w-1;j++)
				printf("%d ",a[i][j]);
			printf("%d\n",a[i][w-1]);
		}
		return 0;
	}



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

int main(){
    double a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<a*b/2.000000000<<" ";
    if(c*d!=0 && a/c==2 && b/d==2)cout<<1;
    else cout<<0;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Scanner;

public class Main {
	
	public static boolean is_ok(int x, int y, int h, int w){
		if(x < 0 || x >= w || y < 0 || y >= h){
			return false;
		}else{
			return true;
		}
	}
	
	public static int MAX = 50;
	
	public static int[][] move_dir = new int[][]{{1, 0},{-1, 0},{0, 1},{0, -1}};
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		boolean[][][][] visited = new boolean[MAX][MAX][MAX][MAX];
		boolean[][] is_wall = new boolean[MAX][MAX];
		
		LinkedList<Integer> x1_queue = new LinkedList<Integer>();
		LinkedList<Integer> y1_queue = new LinkedList<Integer>();
		LinkedList<Integer> x2_queue = new LinkedList<Integer>();
		LinkedList<Integer> y2_queue = new LinkedList<Integer>();
		LinkedList<Integer> time_queue = new LinkedList<Integer>();
		
		while(true){
			final int W = sc.nextInt();
			final int H = sc.nextInt();
			
			if(W == 0 && H == 0){
				break;
			}
			
			final int in_x1 = sc.nextInt() - 1;
			final int in_y1 = sc.nextInt() - 1;
			final int in_x2 = sc.nextInt() - 1;
			final int in_y2 = sc.nextInt() - 1;
			
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					for(int k = 0; k < H; k++){
						for(int l = 0; l < W; l++){
							visited[i][j][k][l] = false;
						}
					}
					
					is_wall[i][j] = sc.nextInt() == 1;
				}
			}
			
			x1_queue.clear();
			y1_queue.clear();
			x2_queue.clear();
			y2_queue.clear();
			time_queue.clear();
			
			x1_queue.add(in_x1);
			y1_queue.add(in_y1);
			x2_queue.add(in_x2);
			y2_queue.add(in_y2);
			time_queue.add(0);
			
			visited[in_y1][in_x1][in_y2][in_x2] = true;
			
			boolean flag = false;
			while(!time_queue.isEmpty()){
				final int x1 = x1_queue.poll();
				final int y1 = y1_queue.poll();
				final int x2 = x2_queue.poll();
				final int y2 = y2_queue.poll();
				final int time = time_queue.poll();
				
				//System.out.println(x1 + " " + y1 + " " + x2 + " " + y2 + " " + time);
				
				if(time >= 100){
					break;
				}
				
				if(x1 == x2 && y1 == y2){
					flag = true;
					System.out.println(time);
					break;
				}
				
				for(int[] move : move_dir){
					int nx1 = x1 + move[0];
					int ny1 = y1 + move[1];
					int nx2 = x2 - move[0];
					int ny2 = y2 - move[1];
					
					if(!is_ok(nx1, ny1, H, W) || is_wall[ny1][nx1]){
						nx1 = x1;
						ny1 = y1;
					}
					
					if(!is_ok(nx2, ny2, H, W) || is_wall[ny2][nx2]){
						nx2 = x2;
						ny2 = y2;
					}
					
					//System.out.println(!is_ok(nx1, ny1, H, W));
					
					//System.out.println(y1 + " " + ny1 + " " + nx1 + " " + ny2 + " " + nx2);
					
					if(!visited[ny1][nx1][ny2][nx2]){
						visited[ny1][nx1][ny2][nx2] = true;
						x1_queue.add(nx1);
						y1_queue.add(ny1);
						x2_queue.add(nx2);
						y2_queue.add(ny2);
						time_queue.add(time + 1);
					}
				}
			}
			
			if(!flag){
				System.out.println("NA");
			}
			
		}
		
	}

}

Measured memory_bytes: 133064
import sys
N = int(input())
A = [int(i) for i in input().split()]
B = list(sorted(A))
if A == B:
    print("YES")
    sys.exit()
for i in range(N):
    for j in range(i,N):
        if i == j:
            continue
        A[i],A[j]=A[j],A[i]
        if A == B:
            print("YES")
            sys.exit()
        A[i],A[j]=A[j],A[i]
print("NO")


Measured memory_bytes: 3064
use std::io::{self, Read, Write};
use std::str::{self, FromStr};

pub struct IO<R: Read, W: Write>(R, io::BufWriter<W>);

impl<R: Read, W: Write> IO<R, W> {
    pub fn new(reader: R, writer: W) -> Self {
        Self(reader, io::BufWriter::new(writer))
    }

    pub fn read<T: FromStr>(&mut self) -> T {
        let token = self
        .0
        .by_ref()
        .bytes()
        .map(|b| b.unwrap())
        .skip_while(|&b| (b as char).is_whitespace())
        .take_while(|&b| !(b as char).is_whitespace())
        .collect::<Vec<u8>>();

        unsafe { str::from_utf8_unchecked(token.as_slice()) }
        .parse()
        .ok()
        .expect("Can't parse it.")
    }

    pub fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


fn main() {
    let (r, w) = (io::stdin(), io::stdout());
    let mut rw = IO::new(r.lock(), w.lock());

    let (a, b): (i32, i32) = (rw.read(), rw.read());
    println!("{}", if (a * b) & 1 == 0 { "Even" } else { "Odd" });
}

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

int main()
{
	int N, M, i;
	char S[100];
	
	scanf("%d %s", &N, S);
	
	if(N%2!=0){ printf("No"); return 0; }
	
	M=N/2;
	
	for(i=0; i<M; i++){
		if(S[i]!=S[i+M]){ printf("No"); return 0; }
	}
	
	printf("Yes");
	
return 0;
}

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;  ///1e9+7

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///
long long n,m,c;

void _case()
{
    cin>>n>>m>>c;
    long long a[n][m],b[m],ans=0,x;
    for(int i=0;i<m;i++) cin>>b[i];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++) cin>>a[i][j];
    }
    for(int i=0;i<n;i++){
        x=0;
        for(int j=0;j<m;j++) x+=(a[i][j]*b[j]);
        if(x+c>0) ans++;
    }
    cout<<ans<<'\n';
}

main()
{
//    fastio();
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3600