akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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; }

int main() {
    string a, b;
    cin >> a >> b;
    if (a.size() != b.size()) {
        if (a.size() > b.size()) cout << "GREATER" << endl;
        else cout << "LESS" << endl;
    } else {
        bool flag = true;
        for (int i = 0, n = a.size(); i < n; i++) {
            if (a[i] - '0' > b[i] - '0') {
                cout << "GREATER" << endl;
                flag = false;
                break;
            } else if (a[i] - '0' < b[i] - '0') {
                cout << "LESS" << endl;
                flag = false;
                break;
            }
        }
        if (flag) cout << "EQUAL" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    static PriorityQueue<String> queue;
    static int n;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        queue = new PriorityQueue<>();
        pushStandard(1,0,"a");
        while(queue.size()>0) p(queue.poll());
    }
    
    private static void pushStandard(int depth, int max, String str) {
        if(depth == n) {
            queue.add(str);
            return;
        }
        for(int i = 0; i<=max+1; i++) {
            char nc = (char)('a' + i);
            //p(str+nc);
            pushStandard(depth+1, (i==max+1)?max+1:max, str+nc);
        }
    }

    public static <T> void p(T message) {
        System.out.println(message);
    }

}

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

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

  if ( a * b % 2 == 0 ) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int K, A, B;
    bool result = false;
	cin >> K >> A >> B;
	
	int amari;
	amari = B / K;
	if(  amari * K >= A){
    	cout <<"OK"<< endl; 
    }else{
     	cout << "NG" <<endl; 
    }
}

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

const int N = 200000+5;

int n;
string s;
int memo[N][3];

int main(){
	cin >> s;
	n = s.size();
	memo[1][1] = 1;
	memo[1][2] = 0;
	for(int i=2; i<=n; i++){
		for(int j = 1; j <= 2; j++){
			memo[i][j] = 1 + memo[i-j][3-j];
			if(i - j - j >= 0 and s.substr(i-j,j) != s.substr(i-j-j,j)) memo[i][j] = max(memo[i][j],1 + memo[i-j][j]);
		}
	}
	cout << max(memo[n][1],memo[n][2]) << endl;
	return 0;
}


Measured memory_bytes: 2948
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.tokaichi", "r", stdin);
	string str = "";
	map <int, char, greater<int> > shop;

	int i = 0;
	while (getline (cin, str ) ){
		char name = 'A' + i;
		int s1, s2;
		stringstream ss(str);
		ss >> s1 >> s2;

		if (s1 == 0 && s2 == 0){
			break;
		} // end if
		shop.insert (make_pair (s1+s2, name ) );
		++i;
		if (i < 5) {
			continue;
		} // end if

		map<int, char, greater<int> >::iterator it = shop.begin();
		cout << (*it).second << ' ' << (*it).first << endl;

		i = 0;
		shop.clear();
	} // end while
		
	return 0;
}

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

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

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    CIN(N);
    vi A(N),B(N);
    rep(i,N){
        cin>>A[i];
        B[i]=A[i];
    }
    sort(all(B),greater<int>());
    int max=B[0];
    rep(i,N){
        int cur=A[i];
        if(cur==max) printf("%d\n",B[1]);
        else printf("%d\n",max);
    }

    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	rep(i, 100000000) {
		if (a % 2 || b % 2 || c % 2) {
			cout << i << endl;
			endre;
		}
		int a1 = b / 2 + c / 2, b1 = a / 2 + c / 2, c1 = a / 2 + b / 2;
		a = a1, b = b1, c = c1;
	}
	cout << -1 << endl;
	endre;
}

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

int main(){
	
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int t=0;
	while(true){
		if(t%2==0){
			c = c-b;
		}else{
			a = a-d;
		}
		if(c<1){
			cout<<"Yes\n";
			break;
		}else if(a<1){
			cout<<"No\n";
			break;
		}
		t++;
	}
	return 0;
}

Measured memory_bytes: 3636
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
c = gets.split.map(&:to_i)
n = gets.to_i
p = []
n.times do
  x = gets.to_i
  p << x
end
ap = []
bp = []
cp = []
a.each do |i|
  if p.count(i) != 0
    ap << 1
  else
    ap << 0
  end
end
b.each do |j|
  if p.count(j) != 0
    bp << 1
  else
    bp << 0
  end
end
c.each do |k|
  if p.count(k) != 0
    cp << 1
  else
    cp << 0
  end
end
x = []
x << ap
x << bp
x << cp
an = 0
for l in 0..2
  if x[l][0] == 1 && x[l][1] == 1 && x[l][2] == 1
    an = 1
    break
  elsif x[0][l] == 1 && x[1][l] == 1 && x[2][l] == 1
    an = 1
    break
  end
end
if an == 1
  puts "Yes"
elsif x[0][0] == 1 && x[1][1] == 1 && x[2][2] == 1
  puts "Yes"
elsif x[2][0] == 1 && x[1][1] == 1 && x[0][2] == 1
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o set
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll idx=2;
    ll ans=a[0]-1;
    for(int i=1;i<n;i++){
        if(a[i]==idx){
            idx++;
            continue;
        }
        ll cnt=(a[i]-1)/idx;
        ans+=cnt;
        a[i]-=cnt*idx;
        //cout << ans << endl;
    }
    cout << ans << endl;
}


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

int main(){
    int n;
    cin >> n;
    priority_queue<
      double,                // 要素の型はint
      vector<double>,   // 内部コンテナはstd::vector (デフォルトのまま)
      greater<double>   // 昇順 (デフォルトはstd::less<T>)
    > que;
    double v;
    double ans=0;
    double num1,num2;

    for(int i=0; i<n; i++){
        cin >> v;
        que.push(v);
    }

    for(int i=0; i<n-1; i++){
        num1=que.top();
        que.pop();
        num2=que.top();
        que.pop();
        que.push((num1+num2)/2);
//        cout << num1 << ' ' << num2 << endl;
    }

    cout << que.top() << endl;
    que.pop();
}

Measured memory_bytes: 3756
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);
      String a = scanner.nextLine();
      
      for(int m=0;m<a.length();m++) {
        char aa = a.charAt(m);
        if(Character.isLowerCase(aa) == true) {
          System.out.println("a");
        }else{
          System.out.println("A");
        }
      }
    }
}

Measured memory_bytes: 35716
#include<stdio.h>
int main(){
    int n,T,i,cost=1001;
    int c[100];
    int t[100];
    
    scanf("%d %d",&n,&T);
    for(i = 0; i < n; i++) scanf("%d %d",&c[i],&t[i]);
    
    for(i = 0; i < n; i++){
        if(c[i] < cost && t[i] <= T) cost = c[i];
    }
    
    if(cost >= 1001) printf("TLE\n");
    else printf("%d\n",cost);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long t,j,n,m;
    cin>>n>>m;
    long long a[n],p=0;
    for(j=0;j<n;j++)
    cin>>a[j];
    sort(a,a+n);
    if(m>=n)
    cout<<0;
    else{
        for(j=0;j<=n-m-1;j++)
        p=p+a[j];
        cout<<p;
    }
    return 0;
  
}


Measured memory_bytes: 1792
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
    var a = parseInt(input[0], 10);
    
    b = Math.sqrt(a);
    c = Math.floor(b);
    
    for (var i =1;i<=c;i++){ if (a%i == 0){var d=i;
                                 e=a/d;}}
    console.log(d+e-2) ;


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

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


int main(){
    int n;
    cin >> n;
    int c = 0;
    while (true)
    {
        if(1000*c >= n) break;
        c++;
    }

    cout<<(1000*c)-n<<endl;
    
}

Measured memory_bytes: 3632
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]-=(i+1)
median=-1
a.sort()
if n%2==0:
    median=(a[n//2]+a[n//2-1])//2
else:
    median=a[n//2]
def comp(x):
    su=0
    for i in a:
        su+=abs(i-x)
    return su
print(min(comp(median-1),comp(median),comp(median+1)))





Measured memory_bytes: 26020
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            abc079_b();
        }

        static void abc079_b()
        {
            // B - Lucas Number
            long N = long.Parse(Console.ReadLine());
            long[] Lucas = new long[87];
            Lucas[0] = 2;
            Lucas[1] = 1;
            for (int i=2; i <= N; i++) Lucas[i] = Lucas[i-1] + Lucas[i-2];
            long ans = Lucas[N];
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
import math
a,b,C = map(int, input().split())
c = math.radians(C)
h = b * math.sin(c)
s = a * h / 2
a2 = a - b * math.cos(c)
c2 = math.sqrt(h**2 + a2**2)
l = a + b + c2

print("%f" % s)
print("%f" % l)
print("%f" % h)

Measured memory_bytes: 7944
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main() {
  int N, K;
  cin >> N >> K;

  double p = 0.0;
  repp(i, 1, N) {
    int logK = ceil(log2(1.0 * K / i));
    logK = max(0, logK);
    p += 1 / (1.0 * N * pow(2, logK));
  }
  cout << setprecision(12) << p << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

static const int MAX = 100;
#define INF 2000000000000ll
int V, E;
long long dp[MAX][MAX];

void Warshall_Floyd()
{
	for (int k = 0; k < V; k++)
	{
		for (int i = 0; i < V; i++)
		{
			for (int j = 0; j < V; j++)
			{
				if (dp[i][k] == INF||dp[k][j]==INF)
				{
					continue;
				}

				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
}

int main()
{
	cin >> V >> E;
	for (int i = 0; i < V; i++)
	{
		for (int j = 0; j < V; j++)
		{
			if (i == j)
			{
				dp[i][j] = 0;
			}
			else
			{
				dp[i][j] = INF;
			}

		}
	}
	for (int i = 0; i < E; i++)
	{
		int s, t, d;
		cin >> s >> t >> d;
		dp[s][t] = d;
	}
	Warshall_Floyd();

	bool minus = false;
	for (int i = 0; i < V; i++)
	{
		if (dp[i][i] < 0)
		{
			minus = true;
		}
	}

	if (minus)
	{
		cout << "NEGATIVE CYCLE" << endl;
	}
	else
	{
		for (int i = 0; i < V; i++)
		{
			for (int j = 0; j < V; j++)
			{
				if (j != 0)
				{
					cout << " ";
				}
				if (dp[i][j] == INF)
				{
					cout << "INF";
				}
				else
				{
					cout << dp[i][j];
				}
			}
			cout << endl;
		}
	}
	return 0;


}




Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N;
    cin >> N;
    vector<int>T(N);
    for(int i = 0; i < N; i++) {
        cin >> T[i];
    }
    int ans = T[0];
    for(int i = 1; i < N; i++) {
        ans = ans/__gcd(ans,T[i])*T[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>

using namespace std;
#define inf 1e9


struct item{
    int l = inf, r = 0, t = inf, b = 0;
    void init() {
        l = inf, r = 0, t = inf, b = 0;
    }
};

vector<string> g(50);
vector<item> a(26);
vector<int> x;
bool f;

void perm(vector<int> p, int bit, int n) {
    if (f) return;
    if (n == x.size()) {
        bool ff = true;
        for (int i = 0; i < p.size(); i++) {
            int ho = x[p[i]];
            set<int> se;
            for (int j = i; j < x.size(); j++) se.insert(x[p[j]]);
            
            for (int h = a[ho].t; h < a[ho].b + 1; h++) {
                for (int w = a[ho].l; w < a[ho].r + 1; w++) {
                    int c = g[h][w]-'A';
                    set<int>::iterator it = se.find(c);
                    if (it == se.end()) ff = false;
                    if (!ff) break;
                }
                if (!ff) break;
            }
            if (!ff) break;
        }
        if (ff) f = true;
        return ;
    }
    
    for (int i = 0; i < x.size(); i++) {
        if (bit & 1<<i) continue;
        vector<int> a = p;
        a.push_back(i);
        perm(a, bit | 1<<i, n+1);
    }
}


int main(void){
    int n;
    cin >> n;
    while (n--) {
        int h, w;
        cin >> h >> w;
        g.clear();
        x.clear();
        a.clear();
        for (int i = 0; i < 26; i++) a[i].init();
        f = false;
        for (int i = 0; i < h; i++) {
            cin >> g[i];
            for (int j = 0; j < w; j++) if (g[i][j] != '.') {
                char c = g[i][j];
                int  t = c - 'A';
                a[t].l = min(a[t].l, j);
                a[t].r = max(a[t].r, j);
                a[t].t = min(a[t].t, i);
                a[t].b = max(a[t].b, i);
                t = g[i][j]-'A';
                x.push_back(t);
            } 
        }
        sort(x.begin(), x.end());
        x.erase(unique(x.begin(), x.end()), x.end());
        vector<int> t;
        
        perm(t,0,0);
        if (f) cout << "SAFE" << endl;
        else cout << "SUSPICIOUS" << endl;
    }
}

Measured memory_bytes: 3024
//Author: AnandRaj anand873
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test(t) int t;cin>>t;while(t--)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define rforn(i,b,a) for(int i=b-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl;

const int MOD = 1e9+7,MAX = 1e6+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{
	ll a,b;
	cin>>a>>b;
	ll lcm;
	lcm=a*b/__gcd(a,b);
	cout<<lcm<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;

#define REP(i,n) for(int i=0;i<n;i++)
#define EPS (1e-9)
#define INF (1e9 + 1)
#define PI (acos(-1))

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	ll c = (b / gcd(a, b));
	return c * a;
}

int bekijo(int a, int b) {
	int tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

int X, Y;

int main() {
	cin >> X >> Y;
	cout << X + Y / 2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

char s[100];

int main () {
        cin >> s;
        for (int i = 0; i < 19; i++) {
                if (s[i] == ',') {
                        cout << " ";
                } else {
                        cout << s[i];
                }
        }
        cout << endl;
        return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>

using namespace std;
#define endl '\n'
#define pb push_back
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) > "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	int n, x;
	cin >> n >> x;
	int m = in();
	int ans = fabs(m - x);

	REP(i, n) {
		cin >> m;
		ans = gcd(ans, fabs(m - x));
	}

	out(ans);

	return;
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <iostream>
#include <vector>
#include <map>
#include <sstream>
#include <string.h>
#include <algorithm>

#define INT_MIN (-2147483647 - 1)
#define INT_MAX 2147483647
#define lf double
#define ll long long int
#define f(i, n) for (ll i = 0; i < n; i++)

using namespace std;

int main()
{
    std::ios_base::sync_with_stdio(false);
    ll tc = 0, a = 0, b = 0, c = 0, x = 0, y = 0, m = 0, n = 0;

    string s1, s2;
    getline(cin, s1);
    getline(cin, s2);

    for (ll i = 0; i < s1.size(); i++)
    {
        if (s1[i] != s2[i])
            a++;
    }
    cout << a;

    return 0;
}

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>
#define ALL(V) V.begin(),V.end()
#define f1(a,b) for(int a=1;a<=b;a++)
#define f0(a,b) for(int a=0;a<b;a++)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define de(x) cout<<#x<<": "<<x<<endl
using namespace std;
const LL N=1e6+69, base=1024*1024,mod=998244353;
LL n,a,b,k,pot[N],dwu[N];
LL spot(LL a,LL b) {
    LL re=1;
    while(b!=0) {
        if(b%2==1) re*=a;
        b/=2;
        a*=a;
        re%=mod;
        a%=mod;
    }
    return re;
}
int32_t main(void) {
    pot[0]=1;
    f1(i,1e6) {
        pot[i]=pot[i-1]*i;
        pot[i]%=mod;
    }
    cin>>n>>a>>b>>k;
    f1(i,3e5+69) {
        dwu[i]=pot[n];
        dwu[i]*=spot(pot[i],mod-2);
        dwu[i]%=mod;
        dwu[i]*=spot(pot[n-i],mod-2);
        dwu[i]%=mod;
    }
    dwu[0]=1;
    LL wynik=0;
    f0(i,n+1) {
        LL ile=k-i*a;
        if(b==0) continue;
        if(ile%b!=0) continue;
        ile/=b;
        if(ile>n||ile<0) continue;
        wynik+=dwu[i]*dwu[ile];
        wynik%=mod;
    }
    cout<<wynik;
}
/*
300000 300000 300000 300000
*/


Measured memory_bytes: 13824
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;
int main(){
	int n;
	long long k;
	cin >>n>>k;
	int a;
	long long b;
	map<int,long long>arrey;
	for(int i=0;i<n;i++){
		cin >>a>>b;
		arrey[a]+=0;
		arrey[a]+=b;
		
	}
	//for(auto itr=arrey.begin();itr!=arrey.end();itr++){
	//	cout<<itr->first<<" "<<itr->second<<endl;
	//}
	long long total=0;
	auto itr=arrey.begin();

	while(total <k){
		
		total+=itr->second;
		//cout << itr->first << " " << total << endl;
		if(total <k){
		itr++;
		}
	}
	cout <<itr->first<<endl;
}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int sum = 0;
  int max_lost = 0;
  for (int i = 0; i < 5; i++) {
    int order;
    cin >> order;
    sum += order;
    int lost = 10 - order%10;
    if (lost == 10) lost = 0;
    
    sum += lost;
  	max_lost = max(max_lost, lost);
  }
  sum -= max_lost;
  cout << sum << endl;
  return 0;
}


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

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
char c[105][105];
bool pdx[105],pdy[105];
int n,m;
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            cin>>c[i][j];
    for(int i=1;i<=n;i++)
    {
        bool flag=0;
        for(int j=1;j<=m;j++)
            if(c[i][j]=='#')
                {flag=1;break;}
        if(flag==0)
            pdx[i]=1;
    }
    for(int i=1;i<=m;i++)
    {
        bool flag=0;
        for(int j=1;j<=n;j++)
            if(c[j][i]=='#')
                {flag=1;break;}
        if(flag==0)
            pdy[i]=1;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
            if(pdx[i]==0&&pdy[j]==0)
                cout<<c[i][j];
        if(!pdx[i])
            cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k=1;
  cin >> n;
  int a[n];
  bool t=true;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]==k)k++;
    if(a[i]==1)t=false;
  }
  if(t)cout << -1 << endl;
  else cout << n-(k-1) << endl;
}
  

Measured memory_bytes: 4408
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int souchi[11][11];
int xx[]={1,-1,0,0,0};
int yy[]={0,0,1,-1,0};

void f(int a,int b){
	int i;
	for(i=0;i<5;i++){
		if(a+xx[i]<0||10<=a+xx[i]||b+yy[i]<0||10<=b+yy[i])continue;
		souchi[a+xx[i]][b+yy[i]]^=1;
	}
}

int main() {
	int n=in();
	int i;
	for(i=0;i<n;i++){
		int a,b;
		int tmp[11][11];
		int res[11][11];
		for(a=0;a<10;a++){
			for(b=0;b<10;b++){
				cin>>tmp[a][b];
			}
		}
		int bit;
		for(bit=0;bit<1<<10;bit++){
			for(a=0;a<10;a++){
				for(b=0;b<10;b++){
					souchi[a][b]=tmp[a][b];
					res[a][b]=0;
				}
			}
			for(b=0;b<10;b++){
				if(bit>>b&1){
					f(0,b);
					res[0][b]=1;
				}
			}
			for(a=0;a<9;a++){
				for(b=0;b<10;b++){
					if(souchi[a][b]){
						f(a+1,b);
						res[a+1][b]=1;
					}
				}
			}
			bool ok=true;
			for(b=0;b<10;b++){
				if(souchi[9][b])ok=false;
			}
			if(ok){
				for(a=0;a<10;a++){
					for(b=0;b<10;b++){
						cout<<res[a][b];
						if(b!=9)cout<<" ";
					}
					cout<<endl;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];

    if( count(all(a), 5) == 2 &&
        count(all(a), 7) == 1){
            cout << "YES" << endl;
            return 0;
        }

        cout << "NO" << endl;

return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	
	ll a, b, c;
	cin >> a >> b >> c;
	
	ll ans = c;
	ll tmp = c - 60;
	rep(i, 61){
		tmp = (tmp + 60) % (a + b);
		if(a < tmp && tmp < a + b) ans += 60;
		else {
			cout << ans << endl;
			return 0;
		}
	}
	
	cout << -1 << endl;
	
	/*
	if(60 % (a + b) == 0){
		ll tmp = c % (a + b);
		if(a < tmp && tmp < a + b) cout << -1 << endl;
		else cout << c << endl;
	}else{
		ll ans = c;
		while(1){
			ll tmp = ans % (a + b);
			if(a < tmp && tmp < a + b) ans += 60;
			else{
				cout << ans << endl;
				break;
			}
		}
	}
	*/
	
	return 0;
}


Measured memory_bytes: 3100
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int length = sc.nextInt();
			ArrayList<Integer> nextList = new ArrayList<>();
			ArrayList<Integer> prevList = new ArrayList<>();
			ArrayList<Integer> nums = new ArrayList<>();
			for(int i = 0; i < length; i++) {
				int tmp = sc.nextInt();
				nextList.add(tmp);
				prevList.add(tmp);
				nums.add(tmp);
			}
			if(prevPermutation(prevList)) {
				printList(prevList);
			}
			printList(nums);
			if(nextPermutation(nextList)) {
				printList(nextList);
			}
		}
	}
	@SuppressWarnings("rawtypes")
	public static void printList(List list) {
		Iterator itr = list.iterator();
		if(itr.hasNext()) {
			System.out.print(itr.next());
			while(itr.hasNext()) {
				System.out.print(" " + itr.next());
			}
		}
		System.out.println();
	}
	public static boolean nextPermutation(ArrayList<Integer> nums) {
		if(nums.size() < 2) return false;
		int i = nums.size() - 2;
		for(;i >= 0 && nums.get(i) > nums.get(i+1);i--);
		if(i<0) return false;
		int j = i + 1;
		int k = nums.size() - 1;
		for(;nums.get(i) > nums.get(k); k--);
		int tmp = nums.get(i);
		nums.set(i, nums.get(k));
		nums.set(k, tmp);
		@SuppressWarnings("unchecked")
		List<Integer> tmpList = (List<Integer>) nums.clone();
		Collections.reverse(tmpList);
		while(tmpList.size()>nums.size() - j) tmpList.remove(tmpList.size()-1);
		while(nums.size()>j) nums.remove(nums.size()-1);
		nums.addAll(tmpList);
		return true;
	}
	public static boolean prevPermutation(ArrayList<Integer> nums) {
		if(nums.size() < 2) return false;
		int i = nums.size() - 2;
		for(;i >= 0 && nums.get(i) < nums.get(i+1);i--);
		if(i<0) return false;
		int j = i + 1;
		int k = nums.size() - 1;
		for(;nums.get(i) < nums.get(k); k--);
		int tmp = nums.get(i);
		nums.set(i, nums.get(k));
		nums.set(k, tmp);
		@SuppressWarnings("unchecked")
		List<Integer> tmpList = (List<Integer>) nums.clone();
		Collections.reverse(tmpList);
		while(tmpList.size()>nums.size() - j) tmpList.remove(tmpList.size()-1);
		while(nums.size()>j) nums.remove(nums.size()-1);
		nums.addAll(tmpList);
		return true;
	}
}


Measured memory_bytes: 26420
#include  <iostream>
#include  <vector>
#include  <string>
#include  <queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> the;
#define rep(i, n) for(int i = 0; i < n; i++)

int main()
{
	int h, w;
	cin >> h >> w;
	vector<string> field(h);
	rep(i, h)  cin >> field[i];
	if (field[0][0] == '#') {
		rep(i, h) {
			rep(j, w) {
				if (field[i][j] == '.')  field[i][j] = '#';
				if (field[i][j] == '#')  field[i][j] = '.';
			}
		}
	}
	//#count
	int cnt = 0;
	rep(i, h) {
		rep(j, w) {
			if (field[i][j] == '#')  cnt++;
		}
	}

	int dx[4] = { -1,0,1,0 };
	int dy[4] = { 0,-1,0,1 };
	//bfs
	vector<vector<int> > dist(h, vector<int>(w, -1));
	queue <the> Q;
	Q.push(the(0, 0));
	dist[0][0] = 0;

	while (!Q.empty()) {
		the v = Q.front();
		Q.pop();
		rep(i, 4) {
			the nv = the(v.first + dy[i], v.second + dx[i]);
			if (nv.first < 0 || nv.first >= h || nv.second < 0 || nv.second >= w)  continue;
			if (field[nv.first][nv.second] == '#')  continue;
			if (dist[nv.first][nv.second] != -1)  continue;
			Q.push(nv);
			dist[nv.first][nv.second] = dist[v.first][v.second] + 1;
		}
	}
	int ans = 0;
	if (dist[h - 1][w - 1] == -1)  ans = -1;
	else  ans = h * w - cnt - (dist[h - 1][w - 1] + 1);
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
if N == 0:
    print('0')
    exit()

ans = ''
while abs(N) > 0:
    if abs(N) % 2 == 0:
        ans += '0'
        N //= 2
    elif N < 0:
        N = (N - 1) // 2
        ans += '1'
    else:
        ans += '1'
        N //= 2
    N *= -1
print(ans[::-1])





Measured memory_bytes: 9476
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<set>
#define N 100000
#define IOS ios::sync_with_stdio(false)
#define INF 1e9
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
using namespace std;
int abs(int x)
{return x>0?x:-x;}
int sqr(int x)
{return x*x;}
//coding......
int main()
{
    int n;
    cin>>n;
    int a,b,c,d;
    a=n/1000;
    b=n%1000/100;
    c=n%100/10;
    d=n%10;
    if (a==b&&b==c||b==c&&c==d||a==b&&b==c&&c==d)
        cout << "Yes" << endl;
        else
            cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 764
#include<iostream>
using namespace std;
string t[2][2][2];
string u[192];
bool used[8];
int n,flg;
bool input();
 
bool check_ch(char,char);
string ra(string,int);
string rb(string,int);
string rc(string,int);
void dfs(int,int,int);
bool used_c(int);
bool check_x(string&,string&);
bool check_y(string&,string&);
bool check_z(string&,string&);
void print_f(string str){
  cout<<" "<<str[4]<<"  "<<endl;
  cout<<str[3]<<str[0]<<str[2]<<str[5]<<endl;
  cout<<" "<<str[1]<<"  "<<endl;
  cout<<endl;
}
 
int main(){
  /*
  print_f(rc("zabznq",0));
  print_f(rc("zabznq",1));
  print_f(rc("zabznq",2));
  print_f(rc("zabznq",3));
  print_f(rc("zabznq",4));
  */
  while(input()){
    for(int i=0;i<8;i++)used[i]=false;
     
    flg=0;
    dfs(0,0,0);
    if(flg)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}
 
void dfs(int x,int y,int z){
  //cout<<x<<' '<<y<<' '<<z<<endl;
  if(x==2){x=0;y++;}
  if(y==2){y=0;z++;}
  if(x==0&&y==0&&z==2)flg=1;
 
  for(int i=0;i<192;i++){
    if(flg)return;
    if(used[i/24]==true)continue;
     
    if(x>0)if(check_x(t[x-1][y][z],u[i])==false)continue;
    if(y>0)if(check_y(t[x][y-1][z],u[i])==false)continue;
    if(z>0)if(check_z(t[x][y][z-1],u[i])==false)continue;
 
    used[i/24]=true;
    t[x][y][z]=u[i];
    dfs(x+1,y,z);
    used[i/24]=false;
  }
   
}
 
 
 
bool input(){
  string in,str,str2;
  n=0;
  for(int i=0;i<8;i++){
    cin>>in;if(in=="0")return false;
    for(int j=0;j<6;j++){
      if(j<4)str=ra(in,j);
      else if(j==4)str=rb(in,1);
      else str=rb(in,3);
      for(int k=0;k<4;k++){
    str2=rc(str,k);
    u[n++]=str2;
      }
    }
     
  }
  return true;
}
 
string ra(string str,int x){
  char tmp;
  for(int i=0;i<x;i++){
    tmp=str[3];
    str[3]=str[0];
    str[0]=str[2];
    str[2]=str[5];
    str[5]=tmp;
  }
  return str;
}
string rb(string str,int x){
  char tmp;
  for(int i=0;i<x;i++){
    tmp=str[5];
    str[5]=str[4];
    str[4]=str[0];
    str[0]=str[1];
    str[1]=tmp;
  }
  return str;
}
string rc(string str,int x){
  char tmp;
  for(int i=0;i<x;i++){
    tmp=str[1];
    str[1]=str[2];
    str[2]=str[4];
    str[4]=str[3];
    str[3]=tmp;
  }
  return str;
}
 
bool used_c(int x){
  int y=x/24*24;
  for(int i=y;i<y+24;i++){
    if(used[i]==true)return true;
  }
  return false;
}
 
int checkch='A'-'a';
bool check_ch(char x,char y){
  return (x+checkch==y||x-checkch==y);
}
 
bool check_x(string &a,string &b){
  return check_ch(a[2],b[3]);
}
bool check_y(string &a,string &b){
  return check_ch(a[4],b[1]);
}
bool check_z(string &a,string &b){
  return check_ch(a[0],b[5]);
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
int main(){
    int a[5],k;
    rep(i,5)cin >> a[i];
    cin >> k;
    if(a[4]-a[0]>k)cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

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

#define N 2005

bitset <N> win[N], r[N], l[N];

int n;

char s[N];

int main() {
	scanf("%d", &n);
    for (int i = 2; i <= n; i ++) {
        scanf("%s", s+1);
        for (int j = 1; j < i; j ++) {
            if (s[j] == '1') win[i].set(j);
            else win[j].set(i);
        }
    }
    for (int i = 1; i <= n; i ++) r[i].set(i), l[i].set(i);
    for (int d = 2; d <= n; d ++) {
        int up = n - d + 1;
        for (int i = 1; i <= up; i ++) {
            int t = i + d - 1;
            if ((win[t]&r[i]&l[t-1]).any()) r[i].set(t);
            if ((win[i]&r[i+1]&l[t]).any()) l[t].set(i);
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i ++) if (r[1][i] && l[n][i]) ans ++;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

// 入力
int N;

// DP テーブル
double dp[3010][3010] = {}; 

int main() {
  cin >> N;
  double p[N];
  FOR(i,0,N) cin >> p[i];
  
  //初期条件
  dp[0][0] = 1.0;

  // ループ
  FOR(i,0,N) {
    FOR(j,0,i+1) {
      dp[i+1][j+1] += dp[i][j]*p[i];
      dp[i+1][j] += dp[i][j]*(1.0-p[i]);
    }
  }
  
  double ans = 0.0;
  FOR(j,(N-1)/2+1,N+1) ans += dp[N][j];
  
  cout << fixed << setprecision(10) << ans << endl;
 
}

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

//http://agc018.contest.atcoder.jp/tasks/agc018_a

using namespace std;

typedef long long LL;
typedef pair<LL,LL> pp;


int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	unordered_set<int> s(v.begin(), v.end());

	if (s.count(K) != 0) {
		cout << "POSSIBLE" << endl;
		exit(0);
	}
	if (K > v[N-1]) {
		cout << "IMPOSSIBLE" << endl;
		exit(0);
	}
	for (int i = 1; i < N; i++) {
		if (v[i] == v[i-1]) continue;
		if (K%(v[i]-v[i-1]) == 0) {
			cout << "POSSIBLE" << endl;
			exit(0);
		}
	}
	cout << "IMPOSSIBLE" << endl;
	exit(0);
}


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

int main() {
	int k, s;
	cin >> k >> s;
	int sum = 0;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			if (s - i - j <= k && s - i - j >= 0) {
				sum++;
			}
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
local n, m = io.read("*n", "*n")
local as, bs = {}, {}
local parent = {}
local sz = {}
for i = 1, n do
  parent[i] = i
  sz[i] = 1
end
local ret = n * (n - 1) // 2
for i = 1, m do
  as[i], bs[i] = io.read("*n", "*n")
end

local function uf_findroot(idx)
  local idx_update = idx
  while parent[idx] ~= idx do
    idx, parent[idx] = parent[idx], idx_update
  end
  parent[idx_update] = idx
  return idx
end
local ans = {}
for i = 1, m do
  ans[i] = 0
end
for i = m, 1, -1 do
  ans[i] = ret
  local a, b = as[i], bs[i]
  local ra, rb = uf_findroot(a), uf_findroot(b)
  if ra ~= rb then
    local sza, szb = sz[ra], sz[rb]
    ret = ret - sza * szb
    sz[ra] = sza + szb
    parent[rb], parent[b] = ra, ra
  end
end
print(table.concat(ans, "\n"))


Measured memory_bytes: 20544
main = do
    li <- getLine
    let [x,y] = map read $ words li
    let ans = compute x y
    putStrLn $ if ans then "Yes" else "No"

-- t + k = x, 2t + 4k = y
-- 2k = y - 2x, k = y/2 - x, t = x - k
compute x y = even y && k >= 0 && t >= 0
  where
    k = y `div` 2 - x
    t = x - k

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

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

inline int Pow(int a, int k) {
  int s = 1; 
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

const int N = 1e6 + 7;

// 29gg


void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
  // 34gg

}

void preprocess() {

}

void debug() {
  //  44gg
  if (true) {
  
  }
}

void solve() {
  preprocess();
  // 50gg
  int a, b, k; cin >> a >> b >> k;
  int GCD = __gcd(a, b);
  int cnt = 0;
  FORD(i, GCD, 1) {
    if (a % i == 0 and b % i == 0) {
      cnt++;
    }
    if (cnt == k) {cout << i << endl; return;}
  }
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

void output() {

}

#undef int
int main() {
#define int long long
	ios_base::sync_with_stdio(false);
	cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cfloat>
#define zero(x) (((x)>0?(x):-(x))<eps)

#define pause cout << " press ansy key to continue...",  cin >> chh
#define file_r(x) freopen(x,  "r",  stdin)
#define file_w(x) freopen(x,  "w",  stdout)
#define lowbit(x) ((x) & (-x))

#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, j, n, m) rep(i, n) rep (j, m)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)

#define pb push_back
#define X first
#define Y second
#define ins insert
#define rb rbegin
#define be begin
#define er erase
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define sqr(r) ((r) * (r))
#define dis(x1, y1, x2, y2) (((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
#define FASTIO ios::sync_with_stdio(false);cin.tie(0)

#define sc(x) cout << #x" = " << x << endl, system("pause")
#define sc2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl, system("pause")
#define sc3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl, system("pause")
#define sc4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl, system("pause")
#define sca(A, n, m) {                      \
  rep(i, n){                                    \
        rep(j, m - 1) cout << A[i][j] << " ";     \
        cout << A[i][m-1] << endl;              \
    }                                           \
}
#define sca1(A, n, m) {                    \
    FOR(i, 1, n){                                \
        FOR(j, 1, m-1) cout << A[i][j] << " ";   \
        cout << A[i][m] << endl;                \
    }                                           \
}

#define in(n) scanf("%d", &n)
#define in2(n, m) scanf("%d %d", &n, &m)
#define in3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define in4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)

using namespace std;
int chh;

typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<int, pii> pi3;
typedef vector< pair<int, int> > vpii;
typedef long long LL;

const int N = 105;

int n, m;
int a[N];

int main() {
    int maxi;
    while (~in2(n, m)) {
        maxi = 0;
        rep (i, m) in(a[i]), maxi = max(maxi, a[i]);
        if (maxi * 2 >= n) {
            printf("%d\n", n - (n - maxi) * 2 - 1);
        } else puts("0");
    }
    return 0;
}


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

int main(int argc, const char * argv[]) {
  int n, m;
  cin >> n >> m;
  vector<tuple<int, int ,int>> v(m);
  int p, y;
  for(int i = 0; i < m; i++){
    cin >> p >> y;
    get<0>(v[i]) = p;
    get<1>(v[i]) = y;
    get<2>(v[i]) = i;
  }
  sort(v.begin(), v.end());
  vector<int> cityCnt(n,0);
  for(int i = 0; i < m; i++){
    cityCnt[get<0>(v[i])-1]++;
    get<1>(v[i]) = cityCnt[get<0>(v[i])-1];
  }

  for(int i = 0; i < m; i++){
    swap(get<0>(v[i]), get<2>(v[i]));
  }

  sort(v.begin(), v.end());

  for(int i = 0; i < m; i++){
    printf("%06d%06d\n", get<2>(v[i]), get<1>(v[i]));
  }
  return 0;
}


Measured memory_bytes: 3072