akhauriyash/Code-Regression huggingface dataset:
/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.09.08 03:27:21
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;



struct StronglyConnectedComponents {
private:
    vector<vector<int>> g, rg;
    vector<int> order; 
    vector<bool> visited;
    int V;
    void dfs(int v) {
        if (visited[v]) return;
        visited[v] = true;
        for (int u : g[v]) dfs(u);
        order.push_back(v);
    }
    void rdfs(int v, int c) {
        if (comp[v] != -1) return;
        comp[v] = c;
        for (int u : rg[v]) rdfs(u, c);
    }
public:
    vector<vector<int>> Graph; 
    vector<int> comp; 
    StronglyConnectedComponents(int v) : V(v) {
        g.resize(v);
        rg.resize(v);
        visited.resize(v);
        comp.resize(v);
    }
    void add_edge(int from, int to) {
        g[from].push_back(to);
        rg[to].push_back(from);
    }
    void build() {
        Graph = vector<vector<int>>();
        order = vector<int>();
        visited.assign(V, false);
        comp.assign(V, -1);
        for (int i = 0; i < V; i++) dfs(i);
        reverse(order.begin(), order.end());
        int number = 0;
        for (int i = 0; i < V; i++) {
            if (comp[order[i]] == -1) {
                rdfs(order[i], number++);
            }
        }
        Graph.resize(number);
        for (int i = 0; i < V; i++) {
            for (int v : g[i]) {
                if (comp[i] == comp[v]) continue;
                Graph[comp[i]].push_back(comp[v]);
            }
        }
    }
};
int main() {
    int n,m;cin >> n >> m;
    StronglyConnectedComponents scc(n);
    for (int i = 0; i < m; i++) {
        int a,b;cin >> a >> b;
        scc.add_edge(a,b);
    }
    scc.build();
    vector<vector<int>> b(n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        b[scc.comp[i]].push_back(i);
        ans = max(ans,scc.comp[i] + 1);
    }
    cout << ans << endl;
    for (int i = 0; i < n; i++) {
        if (b[i].size() == 0) break;
        cout << b[i].size() << " ";
        for (int j = 0; j < b[i].size(); j++) {
            cout << b[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

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

int main() {
  int w,a,b;
  cin >> w >> a >> b;
  if(a <= b){
    if(b <= a+w){
      cout << 0 << endl;
    }
    else {
      cout << b-a-w << endl;
    }
  }
  else {
    if(a <= b+w){
      cout << 0 << endl;
    }
    else {
      cout << a-b-w << endl;
    }
  }
  
  return 0;
}


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

using namespace std;

string arr[100001];

signed main()
{
	int n=0,k=0, r=0,s=0,p=0,res=0;
	string t="";
	cin >> n >> k >> r >> s >> p >> t;
	for (int i=0; i<t.size(); i++)
	{
		arr[i%k]+=t[i];
	}
	for (int i=0; i<k; i++)
	{
		for (int j=0; j<arr[i].size(); j++)	
		{
			int last = j;
			for (int l=j+1; l<arr[i].size(); l++)
			{
				if (arr[i][l]==arr[i][j])
				{
					last = l;
				}
				else
					break;
			}
			int len = last-j+1;
			int coeff = 0;
			if (arr[i][j]=='r')
				coeff = p;
			if (arr[i][j]=='s')
				coeff = r;
			if (arr[i][j]=='p')
				coeff = s;
			res+=coeff*((len+1)/2);
			//cout << len << ' ' << coeff << endl;
			j = last;
		}
	}
	cout << res;
	return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};
int tot[111111];
int main(void){
	int n;
	scanf("%d",&n);
	for(int e=0;e<n;e++){
		int r;
		scanf("%d",&r);
		tot[r]++;
	}
	int q;
	scanf("%d",&q);
	lld ans = 0;
	for(int e=1;e<111111;e++) ans += (lld)e*(lld)tot[e];
	while(q--){
		int a,b;
		scanf("%d%d",&a,&b);
		ans -= (lld)a*(lld)tot[a];
		ans += (lld)b*(lld)tot[a];
		printf("%lld\n",ans);
		tot[b] += tot[a];
		tot[a] = 0;
	}
	return 0;
}


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

const int Maxm = 4015;
const int Maxn = 2005;
const int Inf = 1000000000;

int n;
int pos[2][Maxn];
int BIT[Maxm];
int dp[Maxn][Maxn];

void Update(int ind, int val)
{
	for (int i = ind; i < Maxm; i += i & -i)
		BIT[i] += val;
}

int Get(int ind)
{
	int res = 0;
	for (int i = ind; i > 0; i -= i & -i)
		res += BIT[i];
	return res;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= 2 * n; i++) {
		char c; int a; scanf(" %c %d", &c, &a);
		pos[c == 'B'][a] = i;
	}
	fill((int*)dp, (int*)dp + Maxn * Maxn, Inf);
	dp[0][0] = 0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if (i + 1 <= n) {
				int add = pos[0][i + 1] - 1 - Get(pos[0][i + 1]);
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + add);
			}
			if (j + 1 <= n) {
				int add = pos[1][j + 1] - 1 - Get(pos[1][j + 1]);
				dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + add);
				Update(pos[1][j + 1], 1);
			}
		}
		for (int j = 1; j <= n; j++)
			Update(pos[1][j], -1);
		if (i + 1 <= n) Update(pos[0][i + 1], 1);
	}
	printf("%d\n", dp[n][n]);
	return 0;
}

Measured memory_bytes: 16000
#include <stdio.h>
#include <math.h>
int main(){
	int n,d;
	int x[100][100];
	double ans1[100],ans2,ans4;
	int ans3;
	int tmp;
	int count=0;

	scanf("%d%d",&n,&d);

	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			scanf("%d",&x[i][j]);
		}
	}
	for(int i=0;i<n;i++){
		//ans1[k] = 0;
		for(int k=n-1;k>i;k--){
			ans1[k] = 0;
			for(int j=0;j<d;j++){
				tmp = x[i][j]-x[k][j];
				ans1[k] += pow(tmp,2);
			}
			ans2 = sqrt(ans1[k]);
		
			if(int(ans2)==ans2){
				count++;
			}
		}
	}
	printf("%d\n",count);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&!(1<<i);}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mul(int a, int b) {return ((a%MOD)*(b%MOD))%MOD;}
int add(int a, int b) {return (a+b)%MOD;}
int sub(int a, int b) {return (((a-b)%MOD)+MOD)%MOD;}
int __div(int a, int b) {return mul(a, powmod(b, MOD-2, MOD));} //if MOD is prime;
const int inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int32_t main(void)
{
	IOS;
	int n, k; cin>>n>>k;
	vi h(n);
	for(int i = 0; i < n; i++)
		cin>>h[i];
	int dp[n];
	// memset(dp, 0, sizeof(dp));
	dp[0]=0;
	for(int i = 1; i < n; i++) {
		int mn = inf;
		for(int j = 1; j <= k; j++) {
			if(i-j<0)
				break;
			mn=min(mn, dp[i-j]+abs(h[i]-h[i-j]));
		}
		dp[i]=mn;
	}
	// for(int i = 0; i < n; i++)
	// 	cout<<dp[i]<<" ";
	// cout<<endl;
	cout<<dp[n-1]<<endl;
	time();	
	return 0;
}

Measured memory_bytes: 1792
fun main(args:Array<String>){
    var (a,b,c,d)= readLine()!!.split(" ").map(String::toInt)
    while(true){
        c-=b
        if(c<=0){
            println("Yes")
            return
        }
        a-=d
        if(a<=0){
            println("No")
            return
        }
    }
}

Measured memory_bytes: 36372
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define  fill(st,et,val,arr) for(int i=st;i<=et;i++)arr[i]=val;
#define all(v) v.begin(),v.end()
template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = ch == '-', ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}
 
const int M=1e9 + 7;
const int MAX=1e5+7;
using namespace std;
bool comp(pair<int,int> &a,pair<int,int> &b)
{
	if(a.first!=b.first)
	   return a.first<b.first;
	else
		return a.second>b.second;
}
void printQ(deque<int> q)
{
	for(int i=0;i<q.size();i++)
	{
		cout<<q[i]<<" ";
	}
	cout<<endl;
}
struct p{
	int x;
	int y;
};
int32_t main() 
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	string d;cin>>d;
	if(d=="SUN")
	{
		cout<<7<<endl;
		return 0;
	}
	if(d=="SUN")
	{
		cout<<7<<endl;
		return 0;
	}
	if(d=="MON")
	{
		cout<<6<<endl;
		return 0;
	}
	if(d=="TUE")
	{
		cout<<5<<endl;
		return 0;
	}
	if(d=="WED")
	{
		cout<<4<<endl;
		return 0;
	}
	if(d=="THU")
	{
		cout<<3<<endl;
		return 0;
	}
	if(d=="FRI")
	{
		cout<<2<<endl;
		return 0;
	}
	if(d=="SAT")
	{
		cout<<1<<endl;
		return 0;
	}
	return 0;
}














Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;   // cont number of ones from 0 to n in  binarry representation
#define ll long long

int main(){
ll n,k;
cin>>n>>k;
int ar[n];
for(int i=0;i<n;i++)cin>>ar[i];
ll dp[n];
dp[0]=0,dp[1]=abs(ar[0]-ar[1]);
for(int i=2;i<n;i++){
    vector<ll>v ;
    int a=i-1;
  for(int j=a;j>=0 &&j>a-k;j--)    
	v.push_back(dp[j]+abs(ar[j]-ar[i]));

  dp[i]=*min_element(v.begin(),v.end());
}
  cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 1408
import java.io.*;
import java.util.PriorityQueue;
import java.util.Queue;

public class Main {
    private static int LINE_NUMBER = 0;
    private static int CODE_NUMBER = 0;
    private static int BIAS = 0;

    private static int solver(int[] coe, int[] src) {

        int sum = BIAS;
        for (int i = 0; i < CODE_NUMBER; i++) {
            sum += (coe[i] * src[i]);
        }
        if(sum > 0){
            return 1;
        }else{
            return 0;
        }
    }


    public static void main(String[] args) {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);


        try {
            String[] inputArray = br.readLine().split(" ");
            LINE_NUMBER = Integer.parseInt(inputArray[0]);
            CODE_NUMBER = Integer.parseInt(inputArray[1]);
            BIAS = Integer.parseInt(inputArray[2]);
        } catch (Exception e) {
            e.printStackTrace();
        }

        int[] coe = new int[CODE_NUMBER];
        int[] src = new int[CODE_NUMBER];
        int answer = 0;
        try {
            String[] inputArray = br.readLine().split(" ");
            for (int j = 0; j < CODE_NUMBER; j++) {
                coe[j] = Integer.parseInt(inputArray[j]);
            }

            for (int line = 0; line < LINE_NUMBER; line++) {
                String[] srcArray = br.readLine().split(" ");
                for (int idx = 0; idx < CODE_NUMBER; idx++) {
                    src[idx] = Integer.parseInt(srcArray[idx]);
                }
                answer += solver(coe, src);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(answer);

    }
}

Measured memory_bytes: 22740
n = int(input())
h = list(map(int, input().split()))

import numpy as np

def bunkatsu(group): # groupを分割して
    #print('group', group)
    if group == [0]*len(group):
        return 0

    tmp = []
    group_split = []
    ans = 0
    for i,e in enumerate(group):
        
        if e != 0:
            tmp.append(e-1)
        elif len(tmp)>0:
            #print('tmp',tmp)
            ans += 1 + bunkatsu(tmp)
            tmp = []
    if len(tmp)>0:
        ans += 1 + bunkatsu(tmp)

    #print('group, ans',group, ans)
    return ans

print(bunkatsu(h))

Measured memory_bytes: 21536
#include<bits/stdc++.h>
using namespace std;
                    
                    
int main(){
    string s, s1;
    cin >> s;
    int ans = 0;
    int c1, c2;
    c1 = 0;
    c2 = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '0'){
            c1++;
        } else {
            c2++;
        }
    }

    ans = 2 * min(c1, c2);

    cout << ans << endl;

    return 0;
            
}

Measured memory_bytes: 512
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int MAX_N = 10000;

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

    string s;

    cin >> s;

    int gn = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'g') {
            gn++;
        }
    }
    int ans = gn - s.size() / 2 - s.size() % 2;

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <typeinfo>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> data(N);
    for (int i = 0; i < N; i++){
        cin >> data.at(i);
    }
    int ans = 0;
    bool finish = false;
    while(true){
        for (int i = 0; i < N; i++){
            if (data.at(i) % 2 == 1){
                finish = true;
            }
        }
        if (finish){
            break;
        }
        ans++;
        for (int i = 0; i < N; i++){
            data.at(i) = data.at(i) / 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}


#pragma endregion

//065 B-Trained?

int main(void) {
	int n, a[100001], c[100001], i;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);

	int cnt = 0;
	i = 0;
	memset(c, 0, sizeof(c));
	while (1) {
		if (c[i]) {
			cnt = -1; break;
		}
		if (a[i] == 2) {
			cnt++; break;
		}
		c[i] = 1;
		i = a[i] - 1;
		cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}






Measured memory_bytes: 2936
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    
    ll Res = 0;
    for (ll n = 1; n*n <= N; ++n) {
        if (N%n == 0) {
            ll m = N/n;
            if (n >= m-1) continue;
            Res += (m-1);
        }
    }
    cout << Res << endl;

    return 0;
}


Measured memory_bytes: 256
H, W, M = map(int, input().split())

h = [0] * H
w = [0] * W
boms = set()

for _ in range(M):
    x, y = map(int, input().split())
    h[x - 1] += 1
    w[y - 1] += 1
    boms.add((x, y))

h_max = max(h)
w_max = max(w)

h_idx = [x + 1 for x, y in enumerate(h) if y == h_max]
w_idx = [x + 1 for x, y in enumerate(w) if y == w_max]

minus = -1
for x in h_idx:
    for y in w_idx:
        if not (x, y) in boms:
            minus = 0
            break

print(h_max + w_max + minus)

Measured memory_bytes: 176700
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int h, w;
vector<vector<int> > a(80), b(80);
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h>>w;
    for (int i = 0; i < h; i++)
    {
        for(int j=0;j<w;j++){
            int tempa;
            cin>>tempa;
            a[i].push_back(tempa);
        }
        
    }
    for (int i = 0; i < h; i++)
    {
        for(int j=0;j<w;j++){
            int tempa;
            cin>>tempa;
            b[i].push_back(tempa);
        }
    }
    bool dp[h+1][w+1][80*80+1];
    for(int i=0;i<=h;i++){
        for(int j=0;j<=w;j++){
            for(int k=0;k<=80*80;k++){
                dp[i][j][k]=false;
            }
        }
    }
    dp[0][0][abs(a[0][0]-b[0][0])]=true;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int d=abs(a[i][j]-b[i][j]);
            for(int l=0;l<=80*80-80;l++){
                if(i==0&&j==0)continue;
                if(i!=0){
                    if(dp[i-1][j][l+d]||dp[i-1][j][abs(l-d)]){
                        dp[i][j][l]=true;
                    }
                }
                if(j!=0){
                    if(dp[i][j-1][l+d]||dp[i][j-1][abs(l-d)]){
                        dp[i][j][l]=true;
                    }
                }
            }
        }
    }
    for(int k=0;k<=80*80;k++){
        if(dp[h-1][w-1][k]){
            cout<<k<<"\n";
            return 0;
        }
    }
}



Measured memory_bytes: 41344
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

a,b=map(int,input().split())
print(a*b)

Measured memory_bytes: 61912
#ifdef debug
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>
//#include "optimization.h"

using namespace std;

#define vec vector
#define ALL(x) (x).begin(), (x).end()

typedef unsigned int ui;
typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

    int n;

//    cin >> n;
for(;cin >> n;) {
    if(n == 3) {
        cout << "2 5 63\n";
    }else if(n == 4) {
        cout << "2 5 20 63\n";
    }else {
        vec< int > used(3e4 + 1);
        used[2] = 1;
        used[6] = 1;
        used[10] = 1;
        used[15] = 1;
        used[27] = 1;

        vec< int > ost;

        for(int x = 2;x <= 3e4;x++) {
            if(!used[x]) {
                ost.push_back(x);
            }
        }

        mt19937 rnd(42);

        while(1) {
            shuffle(ALL(ost), rnd);

            int sm = 2 + 6 + 10 + 15 + 27;
            int md = 0;
            int nd = n - 5;

            set< int > have = {2, 6, 10, 15, 27};

            for(int x : ost) {
                if(nd <= 1) break;
                if(x % 2 == 0 || x % 3 == 0 || x % 5 == 0) {
                    sm += x;
                    md = (md + x) % 30;
                    nd--;
                    have.insert(x);
                }
            }

            if(nd) {
                for(int x : ost) {
                    if(have.count(x)) continue;
                    if((x + md) % 30 == 0 && __gcd(x, sm) > 1) {
                        have.insert(x);
                        sm += x;
                        nd--;
                        break;
                    }
                }
            }

            if(nd == 0) {
                for(int x : have) {
                    cout << x << " ";
                }
                cout << "\n";
                return 0;
                int g = 0;
                for(int x : have) {
                    if(!g) g = x;
                    else g = __gcd(g, x);
                }
                if(g > 1) {
                    cout << n << " a\n";
                    return 0;
                }
                for(int x : have) {
                    if(__gcd(x, sm) == 1) {
                        cout << n << " b\n";
                        return 0;
                    }
                }
                cout << "OK\n";
                break;
            }
        }
    }
}

    return 0;
}



Measured memory_bytes: 1536
from heapq import heapify,heappush,heappop
N = int(input())
A = list(map(int, input().split()))

A.sort()
a = A.pop()
q = []
heappush(q,-a)
ans = 0
while A:
  #print(A,q)
  b = A.pop()
  a = -heappop(q)
  ans += a
  heappush(q,-b)
  heappush(q,-b)
  
print(ans)

Measured memory_bytes: 31788
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
import functools

n = int(input())
A = [int(input()) for i in range(n)]
maxv = -2*10**9
minv = A[0]
for i in range(1,n):
    maxv = max(maxv,A[i] - minv)
    minv = min(minv,A[i])
print(maxv)


Measured memory_bytes: 14244
def ketanowa(p):
    ans=0
    p=str(p)
    for i in p:
        ans+=int(i)
    return ans

def main():
    temp=input().split(" ")
    n=int(temp[0])
    a=int(temp[1])
    if n*a%2==0:
        print("Even")
    else:
        print("Odd")

    

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
from collections import defaultdict
import heapq

def main():
	n, k = map(int, input().split())
	td = [0]*n
	group = defaultdict(list)
	for i in range(n):
		td[i] = list(map(int, input().split()))
		group[td[i][0]].append(td[i][1])

	grouplist = list(group.values())
	for g in grouplist:
		g.sort(reverse=True)
	grouplist.sort(key=lambda x: -x[0])

	non_maxes = []
	result = 0
	base = 0

	# i stands for total num of netas - 1
	for i in range(min(len(grouplist), k)):
		bonus = (i+1)*(i+1)
		# only use grouplist[0] to grouplist[i]
		for j, basic in enumerate(grouplist[i]):
			# new group we should add at least one neta
			if j == 0:
				if len(non_maxes) > k - (i+1):
					remove = heapq.heappop(non_maxes)
				else:
					remove = 0
				# always add each max value
				base += basic - remove
			elif len(non_maxes) < k - (i+1):
				heapq.heappush(non_maxes, basic)
				base += basic
			# new groups non-max value is larger than prior groups non-max value
			elif non_maxes and non_maxes[0] < basic:
				base += basic - non_maxes[0]
				heapq.heapreplace(non_maxes, basic)
		result = max(result, base+bonus)
	print(result)


if __name__ == '__main__':
    main()

Measured memory_bytes: 46272
from functools import reduce


def maximum_profit(profit_minrate, rate):
    profit, minrate = profit_minrate
    return max(profit, rate-minrate), min(minrate, rate)

if __name__ == "__main__":
    R = [int(input()) for _ in range(int(input()))]
    print(reduce(maximum_profit, R, (-float("inf"), float("inf")))[0])

Measured memory_bytes: 16188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 2929000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


int main(){
    ll i,j;
    vector<P> v;
    ll n,m;
    cin>>n>>m;
    for(i=0;i<n;i++){
        ll a;
        cin>>a;
        v.pb(P(a,1));
    }
    for(i=0;i<m;i++){
        ll b,c;
        cin>>b>>c;
        v.pb(P(c,b));
    }

    sort(v.begin(),v.end(),greater<P>());

    ll sum=0;
    ll left=n;
    ll po=0;

    while(left>0){
        if(v[po].se<left){
            sum+=v[po].se*v[po].fi;
            left-=v[po].se;
        }
        else {
            sum+=left*v[po].fi;
            left=0;
        }
        po++;
    }
    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

vll a, p;

ll f(ll n, ll x) {
    if (n == 0) {
        return (x <= 0 ? 0 : 1);
    } else if (x <= 1 + a[n - 1]) {
        return f(n - 1, x - 1);
    } else {
        return p[n - 1] + 1 + f(n - 1, x - 2 - a[n - 1]);
    }
}

int main()
{
    ll N, X; cin >> N >> X;
    a.push_back(1), p.push_back(1);
    rep(i, N) {
        a.push_back(a[i] * 2 + 3);
        p.push_back(p[i] * 2 + 1);
    }

    cout << f(N, X) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        int _10000 = -1;
        int _5000 = -1;
        int _1000 = -1;

        for (int i = 0; i <= N; i++) {
            for (int j = 0; j <= N - i; j++) {
                int k = N - i - j;
                if (i + j + k == N && 10000 * i + 5000 * j + 1000 * k == Y) {
                    _10000 = i;
                    _5000 = j;
                    _1000 = k;
                    System.out.printf("%d %d %d\n", _10000, _5000, _1000);
                    sc.close();
                    return;
                }
            }
        }

        System.out.printf("%d %d %d\n", _10000, _5000, _1000);
        sc.close();
    }
}

Measured memory_bytes: 21972
import math
while True :
  n = int(input())
  if n==0:
    break;
  i = list(map(int, input().split(' ')))
  avg = sum(i)/n
  j = list(map(lambda x: (x-avg)**2, i))
  print("{:.5f}".format(math.sqrt(sum(j)/n)))

Measured memory_bytes: 7816
/* You can't connect the dots looking forward 
   you can only connect them looking backwards. */

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed;
#define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl;
#define inf 1000000007
#define INF 1000000000000000000LL
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 1000696969
#define flusz fflush(stdout);
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define BIT bitset<N>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)

#define int long long
#define N 500007

int test;

int n,k;

VI g;

int a,b;

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

    FOR(i,1,n){
        int x;
        cin >> x;

        if (x==k){
            cout << "POSSIBLE";
            return;
        }

        g.pb(x);
    }

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

    g.erase(unique(g.begin(),g.end()),g.end());

    if (g.back()<k){
        cout << "IMPOSSIBLE";
        return;
    }

    int gcd = g[0];

    for(auto it:g){
        gcd = __gcd(gcd,it);
    }

    if (k%gcd==0){
        cout << "POSSIBLE";
    }else{
        cout << "IMPOSSIBLE";
    }

    return;
}

int32_t main()
{
    boost

    test=1;

    while(test--)
    {
        solve();
    }

  return 0;
}


Measured memory_bytes: 1400
import Foundation

class Scanner {
    static func readInt() -> Int {
        return Int(readLine()!)!
    }
    
    static func readIntArr() -> [Int] {
        return readLine()!.split(separator: " ").map { Int($0)! }
    }
    
    static func readM(_ n: Int) -> [[Int]] {
        var res = [[Int]]()
        for _ in 0..<n {
            res.append(readIntArr())
        }
        return res
    }
    
    static func readUknownIntMat() -> [[Int]] {
        var res = [[Int]]()
        while let line = readLine() {
            res.append(line.split(separator: " ").map { Int($0)! })
        }
        return res
    }
    
    static func readString() -> String {
        return readLine()!
    }
}

class Printer {
    static func printIntArray(_ arr: [Int]) {
        print(arr.map { String($0) }.joined(separator: " "))
    }
}

var arr = [Int](repeating: 0, count: 64)
let n  = Scanner.readInt()
let nums = Scanner.readIntArr()
for num in nums {
    for i in stride(from: 0, to: 64, by: 1) {
        let j = 1<<i
        arr[64-i-1] += (num&j != 0 ? 1 : 0)
        
    }
}
var res = 0
for i in stride(from: 63, through: 0, by: -1) {
    let j = 1<<(64-i-1)
    res = (res + (((j)%1000000007 * (arr[i]%1000000007))%1000000007 * (nums.count-arr[i])))%1000000007
}
print(res)


Measured memory_bytes: 42212
import java.util.Scanner
import java.util.TreeSet


//
fun _Do() {

    val N_ = scan.nextInt()
    var a = Array(N_,{0})
    for(i in 0 until N_)
        a[i] = scan.nextInt()
    
    //--------
    var t = TreeSet<Int>()
    
    for(i in a.indices){
        
        when(t.contains(a[i])){
            false -> t.add(a[i])
            else -> t.remove(a[i])
        }
    }

    println(t.count())
}

var scan = Scanner(System.`in`)

fun strings(N:Int):Array<String>{
    var _s = Array(N,{""})
    for (i in _s.indices) {
        _s[i] = scan.next()
    }
    return _s
}

fun ints(N:Int):Array<Int>{
    var _s = Array(N,{0})
    for (i in _s.indices) {
        _s[i] = scan.nextInt()
    }
    return _s
}

fun longs(N:Int):Array<Long>{
    var _s = Array<Long>(N,{0})
    for (i in _s.indices) {
        _s[i] = scan.nextLong()
    }
    return _s
}
//
fun main( argv : Array<String> ) {
    _Do()
}


Measured memory_bytes: 57768
#include <bits/stdc++.h>
using namespace std;
int n;
int d[1000];
int main(){
  cin>>n;
  for (int i=1;i<=n;i++)
    cin>>d[i];
  int ans=0;
  for (int i=1;i<=n;i++)
    for (int j=i+1;j<=n;j++)
      	ans+=d[i]*d[j];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>
#include <boost/multiprecision/cpp_int.hpp>

#pragma warning(disable:4996)

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  bool ans = false;
  int a_ = a%b;
  for (int i = 0; i < b; ++i) {
    if ((a_*i) % b == c) {
      ans = true;
      break;
    }
  }
  cout << (ans ? "YES" : "NO") << endl;
  return 0;
}


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

int main() {
  int N, T, A;
  cin >> N >> T >> A;
  vector<int> vec(N);
   for (int i = 0; i < N; i++) {
     cin >> vec.at(i);
   }
  vector<double> t(N,0);
   for (int i = 0; i < N; i++) {
     t.at(i) = T - vec.at(i) * 0.006;
   }
  double a = A - t.at(0);
  int x = 0;
  if (a < 0)
    a = a * ( -1);
   for (int i = 0; i < N; i++) {
     double b = A - t.at(i);
     if (b < 0)
       b = b * (-1);
     if (b <= a) {
       a = b;
       x = i + 1;
     }
   }
  cout << x << endl;
}

Measured memory_bytes: 3616
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn gcd(x: u64, y: u64) -> u64 {
    if x == 0 {
        y
    } else {
        gcd(y % x, x)
    }
}

pub fn primes(x: u64) -> Vec<u64> {
    let x_ = x as usize;
    let mut ps = vec![];
    let mut is_prime = vec![true; x_ + 1];

    if x >= 2 {
        for i in 2..x_ + 1 {
            if is_prime[i] {
                ps.push(i as u64);
            }
            if i * i <= x_ {
                for j in 2..(x_ / i) + 1 {
                    is_prime[i * j] = false;
                }
            }
        }
    }
    ps
}

use std::collections::HashSet;
fn factors(n: u64, ps: &Vec<u64>) -> u64 {
    let mut m = n;
    let mut hs = HashSet::new();
    for &p in ps {
        while m % p == 0 {
            hs.insert(p);
            m /= p;
        }

        if m == 1 {
            break;
        }
    }
    if m != 1 {
        hs.insert(m);
    }
    //println!("{}, {:?}, {:?}", n, ps, hs);
    hs.len() as u64
}

fn main() {
    let v = read_vec::<u64>();
    let a = v[0];
    let b = v[1];

    let g = gcd(a, b);
    let root_g = {
        let mut i: u64 = 1;
        while i*i < g {
            i+=1;
        }
        i
    };

    let ps = primes(root_g + 1);
    //println!("{:?}", ps);
    let ans = factors(g, &ps);
    println!("{}", ans + 1);
}


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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(a) a.begin(), a.end()
#define ll long long
#define mod 1e9+7

using namespace std;

int main()
{
  ll a, b;
  char op;
  cin >> a >> op >> b;
  if (op == '+') {
    cout << a + b << endl;
  } else {
    cout << a - b << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int A[N],B[N],C[N-1];
  REP(i,N){
    cin>>A[i];
    A[i]--;
  }
  REP(i,N){
    cin>>B[i];
  }
  REP(i,N-1){
    cin>>C[i];
  }
  int ans=B[A[0]];
  int prev=A[0];
  FOR(i,1,N){
    ans+=B[A[i]];
    if(A[i]==prev+1)ans+=C[prev];
    prev=A[i];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, M = read_ints()
    dist = [
        [math.inf]*N for _ in range(N)
    ]

    for i in range(N):
        dist[i][i] = 0

    A, B, C = [], [], []
    for _ in range(M):
        a, b, c = read_ints()
        a -= 1
        b -= 1
        A.append(a)
        B.append(b)
        C.append(c)
        dist[a][b] = dist[b][a] = c

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][k]+dist[k][j], dist[i][j])

    count = M
    for i in range(M):
        is_shortest = False
        for j in range(N):
            if dist[j][A[i]] == dist[j][B[i]]+C[i]:
                is_shortest = True
        if is_shortest:
            count -= 1
    return count


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 75052
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

int main() {
	IOS();
	ll n, m;
	cin >> n >> m;
	vector<ll> a(m), dp(n + 1, 0);
	vector<bool> ok(n + 1, true);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		ok[a[i]] = false;
	}
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		if (!ok[i]) {
			dp[i] = 0;
		} else {
			dp[i] = dp[i - 1];
			if (i >= 2) dp[i] += dp[i - 2];
			dp[i] %= MOD;
		}
	}
	dump(dp[n]);
	return 0;
}

Measured memory_bytes: 1792
S = input()

week = {'SUN': 0,
        'MON': 1,
        'TUE': 2,
        'WED': 3,
        'THU': 4,
        'FRI': 5,
        'SAT': 6}


today = week[S]

if today > 0:
    nextsunday = 7 - today
elif today == 0:
    nextsunday = 7
print(nextsunday)

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String O,E;
		O = sc.next();
		E = sc.next();
		for (int i=0;i<E.length();i++) {
			System.out.print(O.charAt(i));
			System.out.print(E.charAt(i));
		}
		if (O.length()>E.length()) {
			System.out.print(O.charAt(O.length()-1));
		}
	}
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int min = Math.min(a, b);
        int max = Math.max(a, b);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<max; i++) {
            sb.append(min);
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 21588
#include<stdio.h>

int main(){
	int loop = 0;
	int i,buf;
	while(true){
		scanf("%d",&loop);
		if(loop == 0){
			break;
		}
		int max = -1;
		int min = 1000;
		int ans = 0;
		for(i=0;i<loop;i++){
			scanf("%d",&buf);
			if(max < buf){
				max = buf;
			}
			if(min > buf){
				min = buf;
			}
			ans += buf;
		}
		ans -= (max + min);
		printf("%d\n",ans/(loop-2));
	}
}

Measured memory_bytes: 1028
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    char c[102][102]={};
    cin>>a>>b;
    for(int y=0;y<a;y++){
        for(int x=0;x<b;x++){
            cin>>c[x+1][y+1];
        }
    }
    
    for(int y=0;y<a+2;y++){
        for(int x=0;x<b+2;x++){
            //cout<<x<<"x"<<y<<"y";
            if(y==0||y>a){
                cout<<"#";
            }else if(x==0||x>b){
                cout<<"#";
            }else{
                cout<<c[x][y];
            }
        }
        cout<<endl;
    }
}



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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a != b ){
    if(a != c){
      cout << a << endl;
    }else{
      cout << b << endl;
    }
  }else{
    cout << c << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef int64_t llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64


int main(){
    string s;
    set<char> st;
    cin >> s;
    REP(i,s.length()){
        if(st.erase(s[i]) == 1){
            cout << "no" << endl;
            return 0;
        }
        else st.insert(s[i]);
    }
    cout << "yes" << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

const ll big=1000000007;

int main() {
  ll n,m;
  cin >> n >> m;
  map<ll,bool> a;
  rep(i,m){
    ll s;
    cin >> s;
    a[s]=true;
  }
  vl rec(n+1);
  rec[0]=1;
  if(a.count(1))rec[1]=0;
  else rec[1]=1;
  rep2(i,2,n+1){
    if(a.count(i))rec[i]=0;
    else rec[i]=(rec[i-1]%big+rec[i-2]%big) %big;
    if(rec[i]==0&&rec[i-1]==0)break;
  }
  cout << rec[n] << endl;
  
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    int a, b, t;
    cin >> a >> b >> t;
    if (a > t)
        cout << 0;
    else
        cout << (t / a) * b;
}

Measured memory_bytes: 3632
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, 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, insort, insort_left
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 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, C = MAP()
stc = [LIST() for _ in range(N)]
stc.sort(key=lambda x:(x[2], x[0]))

tmp_s = stc[0][0]
tmp_t = stc[0][1]
tmp_c = stc[0][2]

stc = stc[1:]
stc_new = []

for s, t, c in stc:
	if c == tmp_c and s == tmp_t:
		tmp_t = t
	else:
		stc_new.append((tmp_s, tmp_t))
		tmp_s = s
		tmp_t = t
		tmp_c = c
stc_new.append((tmp_s, tmp_t))

now = [0]*(10**5+1)

for s, t in stc_new:
	now[s-1] += 1
	now[t] -= 1

now_acc = list(accumulate(now))

print(max(now_acc))

Measured memory_bytes: 37652
import java.io.InputStream
import java.io.PrintStream
import java.util.*

class Abc087B(
    val input: InputStream,
    val output: PrintStream
) {
    /**
     * X は 50 の倍数である
     */
    fun proc() {
        val sc = Scanner(input)
        val a = sc.nextInt()
        val b = sc.nextInt()
        val c = sc.nextInt()
        val x = sc.nextInt()

        var result = 0
        for (ia in 0..a) {
            for (ib in 0..b) {
                for (ic in 0..c) {
                    if (ia * 500 + ib * 100 + ic * 50 == x) {
                        result++
                    }
                }
            }
        }
        output.print(result)
    }
}

fun main(args: Array<String>) {
    Abc087B(System.`in`, System.out).proc()
}


Measured memory_bytes: 31520
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String A;
    String B;
    String C;
    int countA = 0;
    int countB = -1;
    int countC = -1;
    char next = 'a';
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.A = sc.next();
        this.B = sc.next();
        this.C = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = null;
        
        while (true) {
        	if (next == 'a') {
        		countA++;
        		if (A.length() == countA) {
            		answer = "A";
            		break;
            	}
        		next = A.charAt(countA);
        	} else if (next == 'b') {
        		countB++;
        		if (B.length() == countB) {
            		answer = "B";
            		break;
            	}
        		next = B.charAt(countB);
        	} else if (next == 'c') {
        		countC++;
        		if (C.length() == countC) {
            		answer = "C";
            		break;
            	}
        		next = C.charAt(countC);
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}


Measured memory_bytes: 35504
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;

signed main() {
	int n;
	cin >> n;
	vector<string>S(n);
	vector<map<char, int>>m(n);
	rep(i, n) {
		cin >> S[i];
		for (auto j : S[i])m[i][j]++;
	}
	vector<int>v(26, INF);
	rep(i,n){
		rep(j, 26) {
			v[j] = min(v[j], m[i]['a' + j]);
		}
	}
	rep(i, 26) {
		char ch = 'a' + i;
		rep(j, v[i]) {
			cout << ch;
		}
	}
}

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

typedef long long ll;

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

  int m; cin >> m;
  vector<int> b(m);
  for(int i=0; i<m; i++) cin >> b[i];

  cout << includes(a.begin(),a.end(),b.begin(),b.end()) << endl;


}


Measured memory_bytes: 4308