akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

void call(){

	int n,c=1;;
	cin >> n;

	char f;

	for (int i = 0; i < n; ++i)
	{
		cin >> f;

		if (f=='Y')
		{
			c=0;
		}
	}

	if (c==1)
	{
		cout << "Three" << endl;
	}
	else{
		cout << "Four" << endl;
	}

	return;
}

int main()
{
	int t;
	t=1;

	for (int i = 0; i < t; ++i)
	{
		call();
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pd(x) cerr<<"//"<<(x)<<endl;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q,l,r;
ll x[500005],y[500005],z[500005];
ll dp[500005][6],sc[500005][6];
//bool check[5005];
//char s[500005],t[500005];
bool flag,dame;

ll  fact[400005];
ll rfact[400005];
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<400000; i++){
        fact[i] = (fact[i-1]*i) % mod;
        rfact[i] = rui(fact[i],mod - 2);
    }
}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;
}

int main(){
	cin >> n >> m;
	if(n == m){
		p(2*n);
	}else{
		p(max(n,m) * 2 -1);
	}
	return 0;
}


Measured memory_bytes: 25088
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin>>n;
    VI hoge(n);
    VI p(n);
    VI q(n);
    rep(i,n) hoge[i] = i+1;
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    
    int a=0,b=0;
    int cnt=1;
    
    while(next_permutation(all(hoge))){
        if(p==hoge) a=cnt;
        if(q==hoge) b=cnt;
        cnt++;
    }
    
    int ans=a-b;
    if(ans<0) ans*=-1;
    ANS;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#include <iterator>
#include <stdio.h>
#define ll long long
#define ull unsigned long long int
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ff first
#define ss second
#define sz(a) int((a).size())
#define all(a) (a).begin(),(a).end()
#define fr(i,p,n) for(int i=p;i<n;i++)
#define precise cout << std::setprecision(10) << std::fixed;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
ll M=1000000007;
//ll M=  998244353;
typedef pair<int, int> pairs;

int main()
{
    fastio; precise;
    int T=1;
    //cin>>T;
    while(T--){
        int n;
        cin>>n;
        double p[n];
        fr(i,0,n) cin>>p[i];
        double dp[n+1][n+1];
        memset(dp,0.0,sizeof(dp));
        double ans=0.0;
        dp[0][0]=1.0;
        ans=0;
        fr(i,1,n+1){
        fr(j,0,i+1){
        if(j==0) dp[i][j]=dp[i-1][j]*(1.0-p[i-1]);
        else  dp[i][j]=dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1.0-p[i-1]);
        //cout<<dp[i][j]<<" ";
        if(i==n && j>n/2) ans+=dp[i][j];
        }

        }
        cout<<ans<<endl;

    }
     return 0;
}


Measured memory_bytes: 74060
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;

int main(){
  int n;
  while(cin >> n){
    vector<int> a(n); cin >> a;

    int s = accumulate(ALL(a), 0);
    
    bitset<2000*2000+1> check;
    check[0] = true;

    REP(i,n){
      check |= (check << a[i]);
    }

    int ans;
    
    FORE(i,(s+1)/2,s){
      if(check[i]){
        ans = i;
        break;
      }
    }

    cout << ans << endl;
  }

  return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
typedef map<int,int> mp;

const int MOD = 1e9 + 7;


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

    int n;
    cin >> n;
    vi p(n), q(n);
    rep(i, n){
        cin >> p[i];
    }
    rep(i, n){
        cin >> q[i];
    }

    bool f = true;
    rep(i, n){
        if(p[i] > q[i]){
            f = true;
            break;
        }else{
            f = false;
            break;
        }
    }

    if(f){
        swap(p, q);
    }

    bool f2 = false;
    int cnt = 0;
    do{
        rep(i, n){
            if(p[i] != q[i]){
                f2 = false;
                break;
            }else{
                f2 = true;
            }
        }
        cnt++;
    } while(next_permutation(all(p)) && !f2);

    cout << cnt-1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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



	string a;
	cin >> a;
	int ans = 0;
	REP(i, 3) {
		if (a[i] == '1')ans++;
	}
	
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
import sys
import math
import bisect

def solve(a, b):
    n = b - a - 1
    A = sum(list(range(1, n + 1)))
    return A - a

def main():
    a, b = map(int, input().split())
    print(solve(a, b))

if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) {
        string sa;
        cin >> sa;
        sort(sa.begin(), sa.end());
        s[i] = sa;
    }
    sort(s.begin(), s.end());
    ll ans = 0;
    int now = 0;
    rep(i, n) {
        if (i==0) continue;
        if (s[i]!=s[i-1]) {
            now = i;
            continue;
        }
        ll v = i-now;
        ans += v;

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


Measured memory_bytes: 5888
#include<iostream>
using namespace std;
	
int main(){
	int a,b,c,x;
	
	cin >> a >> b >> c ;
	
	if(a > b){
		x = a;
		a = b;
		b = x;	
	}
	if(b > c){
		x = b;
		b = c;
		c = x; 
	}
	if(a > b){
		x = a;
		a = b;
		b = x;
	}		
	cout << a << " " << b << " " << c << endl;

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
# define M_PI           3.14159265358979323846  /* pi */
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	int count = 0;
	int result = 200;

	for (int i = 0; i < N; i++) {
		cin >> A.at(i);

		while (true) {
			if (A.at(i) % 2 != 0 || A.at(i) == 0) {
				break;
			}

			else if (A.at(i) % 2 == 0) {
				A.at(i) = A.at(i) / 2;
				count++;
			}
		}

		result = min(result, count);
		count = 0;
	}

	cout << result << endl;
}

Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

   private static final String INPUT_FILE_PATH = "";

   static void solve(InputReader in, PrintWriter out) {
      int[] a = new int[6];
      for (int i = 1; i <= 5; i++) {
         a[i] = in.nextInt();
         if (a[i] == 0) {
            out.println(i);
            return;
         }
      }
   }

   private static class InputReader {
      private BufferedReader br;
      private StringTokenizer st;

      public InputReader(InputStream inputStream) {
         this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);
         this.st = null;
      }

      public String nextToken() {
         while (st == null || !st.hasMoreTokens()) {
            try {
               st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
               throw new RuntimeException(e);
            }
         }
         return st.nextToken();
      }

      public int nextInt() {
         return Integer.parseInt(nextToken());
      }

      public long nextLong() {
         return Long.parseLong(nextToken());
      }

      public double nextDouble() {
         return Double.parseDouble(nextToken());
      }
   }

   public static void main(String[] args) throws Exception {
      InputStream inputStream = INPUT_FILE_PATH.isEmpty()
         ? System.in
         : new FileInputStream(new File(INPUT_FILE_PATH));
      OutputStream outputStream = System.out;

      InputReader inputReader = new InputReader(inputStream);
      PrintWriter printWriter = new PrintWriter(outputStream);

      solve(inputReader, printWriter);

      printWriter.close();
   }

}


Measured memory_bytes: 32740
#include<stdio.h>
 
int main(void)
{
  	int N;
  	int count=0;
  	int i=0;
    // 整数の入力
    scanf("%d",&N);
  	int P[N],min;
  	for(i=0;i<N;i++){
      	scanf("%d",&P[i]);
    }
    // 処理
    min=P[0];
   	for(i=0;i<N;i++){
    	if(P[i]<=min){
          	count++;
          	min=P[i];
        }
    }
      printf("%d\n",count);
    return 0;
    //自分より後ろの中から最小値とのみ比較すればよかった
}


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

int main()
{
    bool trueornot[100009];int somemod=1000000007;
    int stairs[100009];int a,b,c,i;
    cin>>a>>b;
    memset(trueornot,false,sizeof(trueornot)/sizeof(bool));
    for(i=0;i<b;i++)
    {cin>>c;trueornot[c]=true;}
    stairs[0]=stairs[1]=1;
    if(trueornot[1])stairs[1]=0;
    for(i=2;i<=a;i++)
    {
        if(trueornot[i])
            stairs[i]=0;
        else
            stairs[i]=(stairs[i-1]+stairs[i-2])%somemod;
    }
    cout<<stairs[a]<<endl;
    return 0;
}


Measured memory_bytes: 768
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
int main()
{
	int a,b;scanf("%d%d",&a,&b);
	if(a>=(b<<1)-1)puts("YES");else puts("NO");
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  	int X;
  	cin >> X;
  	int num[2];
  	num[0] = X/500;
  	num[1]= (X-500*num[0])/5;
  	int out = num[0]*1000 + num[1]*5;
  	cout << out << endl;
 	return 0; 
}

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

int main(void){
    string s;
    ll k;
    cin >> s >> k;
    bool flag = false;
    for(int i=0;i<s.length();i++){
        if(s[i]!='1' && i+1 <= k){
            flag = true;
            cout << s[i] << endl;
            break;
        }
    }
    if(flag == false){
        cout << 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.15f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll n;
double dp[310][310][310]; // dp[i][j][k] : 寿司が残り1個の皿がi枚、2個の皿がj枚、3個の皿がk枚の状態からすべての寿司をなくすのに必要な操作回数の期待値

double f(ll i, ll j, ll k) {
    if(dp[i][j][k] >= 0) {
        return dp[i][j][k];
    }
    if(i == 0 && j == 0 && k == 0) {
        return 0.0;
    }
    double res = 0.0;
    if(i > 0) {
        res += i*f(i-1, j, k);
    }
    if(j > 0) {
        res += j*f(i+1, j-1, k);
    }
    if(k > 0) {
        res += k*f(i, j+1, k-1);
    }
    res += n;
    res *= 1.0/(i+j+k);
    return dp[i][j][k] = res;
}

int main() {
    
    cin >> n;

    ll cnt1 = 0, cnt2 = 0, cnt3 = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        if(a == 1) {
            cnt1++;
        }
        else if(a == 2) {
            cnt2++;
        } 
        else if(a == 3) {
            cnt3++;
        } 
    }

    memset(dp, -1, sizeof(dp));

    exout(f(cnt1, cnt2, cnt3));
    re0;
}

Measured memory_bytes: 233088
N = int(input())
ans = ''
t = 0
count = 1
if N==0:
  ans = '0'
while N!=0:
  if N%(2**count)==0:
    ans += '0'
  else:
    ans += '1'
    N -= (-2)**(count-1)
  count += 1
print(ans[::-1])

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, D, X[101010], Y[101010];
int grp[1010][1010];

int cnts[3][2020][2020];

bool rect(int t, int x0, int y0, int x1, int y1)
{
	return (cnts[t][x1][y1] - cnts[t][x1][y0] - cnts[t][x0][y1] + cnts[t][x0][y0]) == (x1 - x0) * (y1 - y0);
}
bool test(i64 W)
{
	i64 bas = W / D; int aux = (int)(W % D);
	i64 ns[] = {bas * bas, bas * (bas + 1), (bas + 1) * (bas + 1)};
	for (int t = 0; t < 3; ++t) {
		for (int i = 0; i < D; ++i) {
			for (int j = 0; j < D; ++j) {
				cnts[t][i + 1][j + 1] = (grp[i][j] <= ns[t] ? 1 : 0);
				cnts[t][i + 1][j + 1 + D] = cnts[t][i + 1 + D][j + 1] = cnts[t][i + 1 + D][j + 1 + D] = cnts[t][i + 1][j + 1];
			}
		}
		for (int i = 0; i <= 2 * D; ++i) {
			for (int j = 1; j <= 2 * D; ++j) {
				cnts[t][i][j] += cnts[t][i][j - 1];
			}
		}
		for (int i = 1; i <= 2 * D; ++i) {
			for (int j = 0; j <= 2 * D; ++j) {
				cnts[t][i][j] += cnts[t][i - 1][j];
			}
		}
		continue;
		printf("%lld:\n", W);
		for (int i = 0; i <= 2 * N; ++i) {
			for (int j = 0; j <= 2 * N; ++j){
				printf("%d ", cnts[t][i][j]);
			}
			puts("");
		}
		puts("");
	}

	for (int i = 0; i < D; ++i) {
		for (int j = 0; j < D; ++j) {
			if (rect(2, i, j, i + aux, j + aux) && rect(1, i + aux, j, i + D, j + aux) && rect(1, i, j + aux, i + aux, j + D) && rect(0, i + aux, j + aux, i + D, j + D)) {
				return true;
			}
		}
	}
	return false;
}

int main()
{
	scanf("%d%d", &N, &D);
	for (int i = 0; i < N; ++i) scanf("%d%d", X + i, Y + i);

	for (int i = 0; i < N; ++i) {
		++grp[X[i] % D][Y[i] % D];
	}

	i64 left = 2, right = 1001001001;
	while (left < right) {
		i64 mid = (left + right) / 2;
		if (test(mid)) {
			right = mid;
		} else {
			left = mid + 1;
		}
	}
	printf("%lld\n", left - 1);

	return 0;
}


Measured memory_bytes: 52736
n,m = map(int,input().split())
A = list(map(int,input().split()))
judge = sum(A) / (4 * m)
ans = []
for i in range(n):
  if A[i] < judge :
    continue
  else:
    ans.append(A[i])
print("Yes") if len(ans) >= m else print("No")

Measured memory_bytes: 9140
#include <bits/stdc++.h>
#include<string>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    int sum_T=0,sum_H=0;
    for(int i=0;i<n;i++){
        string t,h;
        cin >> t >> h;
        if(t>h){
            sum_T+=3;
        }
        else if(t<h){
            sum_H+=3;
        }
        else{
            sum_T++;
            sum_H++;
        }
    }
    cout << sum_T << " " << sum_H << endl;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define REP(i, n) for(long long 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 ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
int main() {
  int s;
  char a,b,c;
  cin >> s;
  for (int bit = 0; bit < (1<<3);++bit) {
    int sum=s/1000;
    if(bit & (1<<0)) {
      sum+= (s/100)%10; 
      a = '+';
    } else {
      sum-= (s/100)%10; 
      a = '-';
    }
    if(bit & (1<<1)) {
      sum+= (s/10)%10; 
      b = '+';
    } else {
      sum-= (s/10)%10; 
      b = '-';
    }
    if(bit & (1<<2)) {
      sum+= s%10; 
      c = '+';
    } else {
      sum-= s%10; 
      c = '-';
    }

    if (sum == 7) {
      cout << s/1000 << a << (s/100)%10 << b << (s/10)%10<< c << s%10 << "=7";
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main() {
    int A, B; cin >> A >> B; A--, B--;
    vector<string> g(50,string(100,'#'));
    vector<string> g2(50,string(100,'.'));
    g.insert(g.end(),g2.begin(),g2.end());
    int i = 0; int j = 0;
    while(A--){
        g[i][j] = '.';
        j += 2;
        if(j >= 100){
            j -= 100;
            i += 2;
        }
    }
    i = 51; j = 0;
    while(B--){
        g[i][j] = '#';
        j += 2;
        if(j >= 100){
            j -= 100;
            i += 2;
        } 
    }
    cout << "100 100\n"; 
    REP(i,100) cout << g[i] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scanner=new Scanner(System.in);
		String string=scanner.nextLine();
		String[] str=string.split(" ");
		Stack<Integer> stack=new Stack<>();
		for(int i=0;i<str.length;i++){
			if(str[i].equals("+")){
				int tmp=stack.pop()+stack.pop();
				stack.push(tmp);
			}
			
			else if(str[i].equals("-")){
				int tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
			}
			else if(str[i].equals("*")){
				int tmp=stack.pop()*stack.pop();
				stack.push(tmp);
			}

			else stack.push(Integer.parseInt(str[i]));
		}
		System.out.println(stack.pop());
	}

}



Measured memory_bytes: 26196
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cctype>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(k,a,b) for(int k=(a); k < (b); k++)
#define FORE(k,a,b) for(int k=(a); k <= (b); k++)
#define REP(k,a) for(int k=0; k < (a); k++)

#define ALL(c) (c).begin(), (c).end()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define RANGE(lb, x, ub) ((lb) <= (x) && (x) < (ub))

#define dump(x) cerr << #x << ": " << (x) << endl;

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INF = 1000000000;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main(void) {
    int n, m; cin >> n >> m;
    VVI ks = VVI(m);
    REP(i, m) {
      int k; cin >> k;
      ks[i] = VI(k);
      REP(j, k) {
        cin >> ks[i][j];
      }
    }
    VI ps(m);
    REP(i, m) {
      cin >> ps[i];
    }

    int ret = 0;
    for (int i = 0; i < 1<<n; i++) {
      int ok = 1;
      for (int j = 0; j < m; j++) {
        int p = 0;
        for (auto k : ks[j]) {
          p += (i & (1 << (k-1))) > 0;
        }

        if (p % 2 != ps[j]) {
          ok = 0; break;
        }
      }

      ret += ok;
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ll h; cin >> h;
    ll ans = 0;
    ll n = 1;
    while (h > 0) {
        h /= 2;
        ans += n;
        n *= 2;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
// Created by martinezdiego on 23/4/19

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> mountains(n);
  for (auto & i: mountains) {
    cin >> i;
  }
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    bool ok = true;
    for (int j = 0; j < i; j++) {
      if (mountains[j] > mountains[i]) {
        ok = false;
        break;
      }
    }
    if (ok) cnt++;
  }
  cout << cnt + 1 << '\n';
}

Measured memory_bytes: 256
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
def main():
  a=int(input())
  print(num2alpha(a).lower())

main()

Measured memory_bytes: 9136
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,i,j,k,last,a[26][100005],len[26];
char s[100005],t[100005];
long long ans;
int main()
{
	scanf("%s%s",s+1,t+1);
	n=strlen(s+1),m=strlen(t+1);
	for (i=1;i<=n;i++)
	j=s[i]-'a',len[j]++,a[j][len[j]]=i;
	for (i=1;i<=m;i++)
	{
		j=t[i]-'a';
		if (!len[j])
		return printf("-1\n")&&0;
		k=upper_bound(a[j]+1,a[j]+len[j]+1,last)-a[j];
		if (k==len[j]+1)
		k=1;
		ans+=a[j][k]>last?a[j][k]-last:a[j][k]+n-last,last=a[j][k];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 8960
#include<iostream>
using namespace std;

int main() {
	long long h, n, a, s = 0;

	cin >> h >> n;

	for(long long i = 0; i < n; i++) {
		cin >> a;
		s += a;
	}
	cout << (s >= h ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()

N %= K
print(min(K-N, N))


Measured memory_bytes: 5460
import sys
import functools


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


@functools.lru_cache(maxsize=None)
def solve(h):
    if h <= 0:
        return 0

    ret_val = float("inf")
    for a, b in AB:
        val = b + solve(h - a)
        if val < ret_val:
            ret_val = val
        else:
            break
    return ret_val


sys.setrecursionlimit(100000)

H, N = inpl()
AB = [inpl() for i in range(N)]
AB.sort(key=lambda ab: (ab[0] / ab[1], -ab[0]), reverse=True)
# print(AB)
print(solve(H))


Measured memory_bytes: 30300
//69行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

//Simple Array Input
#define SAI int n;cin >> n;vi a(n);ain(a)
//Simple Graph Input
#define SGI(m) for(int i=0;i<m;i++){int a,b;cin >> a >> b;g[--a].pb(--b);g[b].pb(a);}
//Simple Tree Input
#define STI SGI(n-1)

typedef long long ll;
typedef long long integer;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){
    for(int i=0;i<a.size();i++)cout << a[i] << (i < a.size()-1 ? ' ' : '\n');
}
///////////////////////////////////////////////////////////

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);

    int a,b,c,d;cin >> a >> b >> c >> d;
    int i = 0;
    while(1){
    	if(i % 2 == 0){
    		c -= b;
    		if(c <= 0){
    			cout << "Yes" << '\n';
    			return 0;
    		}
    		i++;
    	}else{
    		a -= d;
    		if(a <= 0){
    			cout << "No" << '\n';
    			return 0;
    		}
    		i++;
    	}
    }
    return 0;
}
/*
 *!!CHECK!! 
 * 制約をよく読め：まず最も愚直な解法を考えろ
 * intの掛け算をしてる場合：overflowは大丈夫？
 * 制約の下限・上限は大丈夫？
 * 木構造は一直線にした時TLEしない？
 * */

/*
* DEBUG before you submit!
* 入力はされてる？
* vectorはサイズを初期化している？
* まずは変数が適切かをチェックする
* 特に二重ループ内部の変数が適切か？
* while文はカウンタがインクリメントされてるかチェック！
*/


Measured memory_bytes: 3636
#include<stdio.h>

int main() {
	double a,b,c,d,e,f,x,y;
	while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
		x = (c*e - b*f) / (a*e - d*b);
		y = (c*d - a*f) / (b*d - a*e);
		if (x == 0) x = 0;
		if (y == 0) y = 0;
		printf("%.3f %.3f\n",x,y);
	}
	
	return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  ll ans;
  if(k < a){
    ans = k;
  }else if(k < a+b){
    ans = a;
  }else{
    ans = a - (k - (a+b));
  }
  cout << ans << endl;
}

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

vector<int> g[5010];
int cnt[5010], ans[5010];

int main(){
  int n,m,a,b;
  scanf("%d%d",&n,&m);

  for(int i=0;i<m;i++){
    scanf("%d%d",&a,&b);
    g[a].push_back(b);
    cnt[b]++;
  }

  queue<int> q;
  for(int i=1;i<=n;i++){
    if(!cnt[i])q.push(i);
  }

  int f = 0, num = 0;
  while(q.size()){
    if(q.size() > 1)f = 1;
    int v = q.front(); q.pop();

    ans[num++] = v;
    for(int i=0;i<(int)g[v].size();i++){
      if(!(--cnt[g[v][i]]))q.push(g[v][i]);
    }
  }

  for(int i=0;i<n;i++)cout << ans[i] << endl;
  cout << f << endl;
}

Measured memory_bytes: 1940
#include <bits/stdc++.h>
#include <queue>
#define REP(i, n) for (ll i = 1; i <= n; i++)
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ll long long
#define ld long double
using namespace std;

int main()
{
    string N;
    int A, B, C, D;
    cin >> N;
    vector<int> nums(4);
    
    rep(i,4){
        nums[i] = N.at(i) - '0';
    }
    for (int tmp = 0; tmp < (1 << 3); tmp++)
    {
        bitset<3> bs(tmp);
        string s = bs.to_string();
        int ans = nums[0];
        string siki = "";
        siki += to_string(nums[0]);

        rep(i, s.size())
        {
            if (s.at(i) == '1')
            {
                siki += '+';
                siki += to_string(nums[i + 1]);
                ans += nums[i + 1];
            }
            else
            {
                siki += '-';
                siki += to_string(nums[i + 1]);
                ans -= nums[i + 1];
            }
        }
        if(ans == 7){
            cout << siki << "=7" << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int):
    N = str(N)
    if "7" in N:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    string S; cin >> S;
    bool flg = false;
    rep(i, S.size()-1) {
        if (S[i] == S[i+1]) flg = true;
    }
    cout << (flg ? "Bad" : "Good") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        ll N;
        cin >> N;
        string S, T;
        cin >> S >> T;

        ll ans = -1;
        ll cur = 0;

        if (S[cur] != T[cur]) {
                ans = 6;
                cur += 2;
        } else {
                ans = 3;
                ++cur;
        }

        while (cur < N) {
                bool p_ver = (S[cur-1] == T[cur-1] ? true : false);
                bool n_ver = (S[cur] == T[cur] ? true : false);
                if (p_ver and n_ver) ans = modc(ans, '*', 2), ++cur;
                else if (p_ver and not n_ver) ans = modc(ans, '*', 2), cur += 2;
                else if (not p_ver and n_ver) ++cur;
                else ans = modc(ans, '*', 3), cur += 2;
        }

        cout << ans << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<ll> t(n), a(n);
    rep(i, n) cin >> t[i] >> a[i];
    ll ct = 0, ca = 0;
    
    rep(i, n) {
        if ((ct <= t[i]) && (ca <= a[i])) {
            ct = t[i];
            ca = a[i];
            continue;
        }
        
        ll vm = max((ct + t[i] - 1) / t[i], (ca + a[i] - 1) / a[i]);
        ll vt = t[i] * vm;
        ll va = a[i] * vm;
        
        ct = vt;
        ca = va;
    }
    
    cout << (ct + ca) << endl;
    return 0;
}


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

#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.tie(nullptr);
#define int long long

using namespace std;

int32_t main() {
	fast
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int ans = max({a * c, a * d, b * c, b * d});
	cout << ans << endl;
}

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

namespace ABCO087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b, c;

            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;

            Console.WriteLine(c);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <math.h>

typedef long long ll;

ll a[12345];

void base26(ll x)
{
	ll cnt = 0;

	while (x)
	{
		a[++cnt] = x % 26;
		x /= 26;
	}
}

int main(void)
{
	ll n, i, next = 0;

	scanf("%lld", &n);

	while (n >= (ll)pow(26, next))
	{
		n -= (ll)pow(26, next);
		next++;
	}

	base26(n);

	for (i = next; i >= 1; i--)
		printf("%c", a[i] + 'a');
	return 0;
}

Measured memory_bytes: 2596
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut couter = vec![0; 100001];

    for na in &a {
        couter[*na] += 1;
    }

    let mut removed = 0;
    for c in &couter {
        if *c > 1 {
            removed += *c - 1;
        }
    }

    if removed % 2 != 0 {
        removed += 1;
    }

    println!("{}", n - removed);
}


Measured memory_bytes: 4112
N = int(input())
A = input().split()

ans = 1
zero_count = A.count("0")

if zero_count != 0:
    print(0)
else:
    for i in range(N):
        ans *= int(A[i])
        if ans > 10**18:
            ans = -1
            break

    print(ans)

Measured memory_bytes: 19240
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=100010;
int n,a[maxn],b[maxn],c[maxn];
long long d[maxn],ans;
int main() {
	scanf("%d",&n); 
	for(int i=1;i<=n;i++)
		scanf("%d",a+i);
	for(int i=1;i<=n;i++)
		scanf("%d",b+i);
	for(int i=1;i<=n;i++)
		scanf("%d",c+i);
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for(int i=n;i>=1;i--)
		d[i]=d[i+1]+(n-(int)(upper_bound(c+1,c+n+1,b[i])-c)+1);
	for(int i=1;i<=n;i++)
		ans+=d[upper_bound(b+1,b+n+1,a[i])-b];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

// ll c[2001][2001];
// ll comb(int a, int b){
//     if(a<b||b<0) return 0;
//     if(c[a][b] != 0) return c[a][b];
//     if(a == b || b == 0) return c[a][b] = 1;
//     return c[a][b] = (comb(a-1, b-1) + comb(a-1, b)) % MOD;
// }


vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    REP(i,n){
        fact[i+1]=fact[i]*(i+1)%MOD;
        if(i>0)inv[i+1]=MOD-inv[MOD%(i+1)]*(MOD/(i+1))%MOD;
        invfact[i+1]=invfact[i]*inv[i+1]%MOD;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%MOD;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%MOD)*invfact[k]%MOD;
}


int main(void)
{
    int n,k;
    cin >> n >> k;
    mod_build(n);
    REP(i, k){
        pr((comb(n-k+1,i+1)*comb(k-1, i))%MOD);
    }
}

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

using namespace std;

#define int long long

int vis[201][201];

int get(int a, int b)
{
	if (vis[a][b])
		return vis[a][b];
	if (b == 0)
	{
		vis[a][b] = a;
		return vis[a][b];
	}
	vis[a][b] = get(b, a % b);
	return vis[a][b];
}

inline int gcd(int a, int b, int c)
{
	return get(get(a, b), c);
}

signed main()
{
	int k;
	cin >> k;
	int ans = 0;
	for (register int i = 1; i <= k; i++)
	{
		for (register int j = 1; j <= k; j++)
		{
			for (register int l = 1; l <= k; l++)
			{
				ans += gcd(i, j, l);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3960
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	var arr [][]int
	a1 := make([]int, N)
	a2 := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a1[i])
	}
	for i := 0; i < N; i++ {
		fmt.Scan(&a2[i])
	}
	arr = append(arr, a1)
	arr = append(arr, a2)
	var sum []int
	for i := 1; i <= N; i++ {
		var count int
		for j := 1; j <= i; j++ {
			count += arr[0][j-1]
		}
		count += arr[1][i-1]
		for k := i + 1; k <= N; k++ {
			count += arr[1][k-1]
		}
		sum = append(sum, count)
	}
	sort.Ints(sum)
	fmt.Println(sum[len(sum)-1])
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll big = 1000000007;
const ll big2 = 1000000009;

ll n,m,k,T,q;

ll F[4000001] = {0};

bool mark[4000001] = {0};
set<ll> notin;

//bitset<4000001> BTS;
bitset<4000001> BTS2;

int main() {

    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,d;

    cin >> n;
    bitset<4000001> BTS;
    vl A(n);
    F[0] = 1;
    mark[0] = 1;

    for(ll c1 = 0; c1 < n; c1++){
        cin >> a;
        A[c1] = a;
    }
    random_shuffle(all(A));
   // BTS[0] = 1;
    BTS[0] = 1;
    for(ll c1 = 0; c1 < n; c1++){
        BTS |= (BTS << A[c1]);
    }

    vl nonz;
    for(ll c1 = 1; c1 < 4000001; c1++){

       // cout << c1 << ": " << BTS[c1] << "\n";

        if(BTS[c1])nonz.push_back(c1);
    }
    cout << nonz[(sz(nonz)-1)/2] << "\n";

    return 0;
}


Measured memory_bytes: 22252
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=100010;

int n;
int ar[22][22];
ll dp[(1<<21)];
ll func(ll mask)
{
    if(mask==(1<<n)-1){return 1;}
    if(dp[mask]==-1){
    ll ans=0;
    ll idx=0;
    for(ll i=0;i<n;++i)
    {
        if((mask&(1<<i))!=0){++idx;}
    }
    for(ll i=0;i<n;++i)
    {
        if(ar[idx][i]&&(mask&(1<<i))==0)
        {
            ans=(ans+func(mask|(1<<i)))%M;
        }
    }
    dp[mask]=ans;
    }
    return dp[mask];
}

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

    cin>>n;
    for(ll i=0;i<n;++i){
        for(ll j=0;j<n;++j){
            cin>>ar[i][j];
        }
    }
    memset(dp,-1,sizeof(dp));
    ll ans=func(0);

    cout<<ans<<endl;

    return (0);
}


Measured memory_bytes: 16640