akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

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

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


int main() {
	bool ans = false;
	string s, t;
	cin >> s >> t ;
	rep(i, s.size()) {
		bool yes = true;
		rep(j, s.size()) {
			if (s[j] != t[(j + i) % s.size()])yes = false;
		}
		if (yes) ans = true;
	}
	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar

using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
int h,w,k,x,y;
char a[801][801];
int d[801][801];
void input()
{
    cin>>h>>w>>k;
    up(i,1,h)
     up(j,1,w)
     {
     	cin>>a[i][j];
     	if (a[i][j]=='S')
		{
			x= i; y= j;
		}
     }
}
const int dx[]= {0,0,-1,1};
const int dy[]= {-1,1,0,0};
void bfs()
{
    queue<II> q;
    up(i,1,h)
     up(j,1,w)
      d[i][j] = -1;
    d[x][y]= 0;
    q.push(II(x,y));
    while (!q.empty())
	{
        II u= q.front(); q.pop();
        if (d[u.X][u.Y]==k) return;
		up(hi,0,3)
		{
			int nx= u.X+ dx[hi], ny= u.Y+ dy[hi];
			if (nx<1 or nx> h or ny<1 or ny> w or d[nx][ny]!=-1 or a[nx][ny]=='#') continue;
			d[nx][ny]= d[u.X][u.Y]+1; q.push(II(nx,ny));
		}
	}
}
void solve()
{
    bfs();

    int res= 1e8;
    up(i,1,h)
     up(j,1,w)
      if (d[i][j]<=k and d[i][j]!= -1)
	  {
        int dist;
        dist= min(i-1,h-i);
        dist= min(dist, min(j-1,w-j) );
        int tmp= ceil( float(dist)/k );

        res= min(res, tmp+1);
	  }

	cout<<res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive
    #define TASK "agc014_c"
  //  freopen(TASK".inp","r",stdin);
  //  freopen(TASK".out","w",stdout);

    input();
    solve();

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < n;) {
    if (s.substr(i, 3) == "ABC") {
      i += 3;
      ans++;
    }
    else {
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(void)
{
    unsigned long long int N;
    cin >> N;
    unsigned long long int A[N + 10];
    unsigned long long int ans = 1;
    int ans_over = -1;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        if(A[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    bool can = true;
    for (int i = 0; i < N; i++)
    {
        if (A[i] <= 1000000000000000000/ans)
        {
        ans *= A[i];
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mx 1e9
int main()
{
 int n;
 cin>>n;
 int x=n,y=0,z=0,m=0,a=0;
 while(n--)
 {
    string x;
    cin>>x;
    if(x=="AC")y++;
    else if(x=="WA")z++;
    else if(x=="TLE")m++;
    else
    a++;
 }
 cout<<"AC x "<<y<<endl;
 cout<<"WA x "<<z<<endl;
 cout<<"TLE x "<<m<<endl;
 cout<<"RE x "<<a<<endl;
}
 
   

Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

bool check(int n,vi &v){
    bool f=true;
    rep(i,n-1)f&=v[i]<v[i+1];
    return f;
}

void run(){
    int n;
    cin>>n;
    vi p(n);
    rep(i,n)cin>>p[i];
    if(check(n,p)){
        cout<<"YES"<<endl;
        return;
    }
    bool f=false;
    rep(i,n){
        Rep(j,i+1,n){
            swap(p[i],p[j]);
            f|=check(n,p);
            swap(p[i],p[j]);
        }
    }
    YES(f);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
	string t,u;
int main() {
	string s;

	cin>>s;	ll n=s.size();
	string S=s,k;
	bool ch=true;
	reverse(S.begin(),S.end());
	if(s!=S){
		ch=false;
	}
//	cout << ch<<endl;

	for(ll i=0;i<(n-1)/2;i++){
//		cout << i<<endl;
		t.push_back(s[i]);
		k=t;

	}
		reverse(k.begin(),k.end());
		if(t!=k){
			ch=false;
		}	
	for(ll i=(n+3)/2-1;i<n;i++){
//		cout << i<<endl;
		u.push_back(s[i]);
		k=u;
	}
		reverse(k.begin(),k.end());
		if(u!=k){
			ch=false;
		}	
	if(ch){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N,M,X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]

ans = -1
for i in range(1<<N):
    bit = [0] * N
    for j in range(N):
        div = 1 << j
        bit[j] = (i // div) % 2

    res = [0] * M
    cost = 0
    for n in range(N):
        if bit[n]==0:
            continue
        cost += CA[n][0]
        for m in range(1,M+1):
            res[m-1] += CA[n][m]

    flag = True
    for m in range(M):
        if res[m] < X:
            flag = False
            break
    
    if flag:
        if ans == -1:
            ans = cost
        else:
            ans = min(ans, cost)

print(ans)

Measured memory_bytes: 9160
# -*- coding: utf-8 -*-

A, B = map(int, input().split())

# 連続数であることが手掛かりになると思われる。
# f(A,B): A, A+1, ..., Bの排他的論理和を考える
# f(A,B): AのB-A個のXOR(偶数なら0、奇数ならA)と 0,1,2,...,B-AのXORのXOR
#
# 1: B-A個のXOR(偶数なら0、奇数なら1)
# 2: B-A-1個のXOR(偶数なら0、奇数なら1)
# 3: B-A-2個のXOR(偶数なら0、奇数なら1)
# ...
# B-A-1: 1個

# 結局わからないので解答見ながら記述。
# n XOR n=0から、A,Bで分離して、
# ※ 0=(1+...+A-1) XOR (1+...+A-1) を加える
# f(A,B) = f(1,A-1) XOR f(1,B)
# また、偶数nとn+1について、偶数の下1桁のビットは0なので、n XOR n+1 = 1
# よって、偶数個or奇数個で分けて計算すればいい。

# f(0, n): n+1個
# n+1が偶数
# * (n+1)//2が偶数: 1が偶数個=0
# * (n+1)//2が奇数: 1が奇数個=1
# n+1が奇数
# * (n+1)//2が偶数: n xor 1が偶数個=0
# * (n+1)//2が奇数: n xor 1が奇数個=1

def func(N):
    n = (N+1)//2
    if (N+1) % 2 == 0:
        if n % 2 == 0:
            return 0
        else:
            return 1
    else:
        if n % 2 == 0:
            return N
        else:
            return N^1

a = func(A-1)
b = func(B)
print(a^b)


Measured memory_bytes: 3064
object Main extends App {
  val read = scala.io.StdIn.readLine()
  val array =  read.split(" ").map(_.toInt).toVector
  val n = array(0)
  val k = array(1)
  val s = scala.io.StdIn.readLine()
  val result = s.zipWithIndex.map {case (c, i) =>
    if ((k-1) == i) {
      if (Character.isUpperCase(c) ) {
        c.toString.toLowerCase
      } else {
        c.toString.toUpperCase
      }
    } else {
      c.toString
    }
  }.mkString
  print(result)
}

Measured memory_bytes: 25380
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

char in[1100][1100];
long long dp[1100][1100];

int main() {
    int h, w;
    cin >> h >> w;

    for (int i = 0; i < h; i++) {
    	for (int j = 0; j < w; j++) {
    		cin >> in[i][j];
    	}
    }

    dp[0][0] = 1;

    for (int i = 0; i < h; i++) {
    	for (int j = 0; j < w; j++) {
    		if (in[i][j] == '#') {
    			continue;
    		}
    		if (i - 1 >= 0) {
    			dp[i][j] = (dp[i - 1][j] + dp[i][j]) % MOD;
    		}
    		if (j - 1 >= 0) {
    			dp[i][j] = (dp[i][j - 1] + dp[i][j]) % MOD;
    		}
    	}
    }
    cout << dp[h - 1][w - 1] << "\n";
    return 0;
}	

Measured memory_bytes: 13248
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <set>
//#inlcude<stringstream>
#define ll long long
#define MODD 1000000007
using namespace std;
int arr[1000000]={0};
int brr[1000000]={0};
int main() {
    int n;cin >>n;
    for(int i=1;i<=n;i++){
        cin >>arr[i];
    }
    for(int i=1;i<=n;i++){
        brr[i] = brr[i-1]+abs(arr[i]-arr[i-1]);
    }
    brr[n]+=abs(arr[n]);
    for(int i=1;i<=n;i++){
        int a =0;
        int b=0;
        if (i==1) b = abs(arr[i+1]),a = abs(arr[i])+abs(arr[i]-arr[i+1]);
        if(i>1)
         b = abs(arr[i-1]-arr[i+1]),a = abs(arr[i-1]-arr[i])+abs(arr[i]-arr[i+1]);
        cout<<brr[n]-a+b<<endl;
    }
    return 0;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  long long C[10][10];
  for(int i = 0; i < 10; ++i)
    for(int j = 0; j < 10; ++j)
      cin >> C[i][j];
  for(int k = 0; k < 10; ++k)
    for(int i = 0; i < 10; ++i)
      for(int j = 0; j < 10; ++j)
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
  long long ans = 0;
  for(int i = 0; i < H; ++i){
    for(int j = 0; j < W; ++j){
      int a;
      cin >> a;
      if(a < 0) continue;
      ans += C[a][1];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 300001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;
ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

int cnt;
int N;
set<int> st;
string cur;

void dfs()
{
    auto cur_number = stoi(cur);
    if(cur_number > N) return;
    if(st.find(cur_number) != st.end()) return;
    st.insert(cur_number);
    
    auto temp_str = to_string(cur_number);
    if(temp_str.size() % 2 && cur_number > 0)
    {
  //      cout << cur_number << endl;
        cnt += 1;
    }
    
    for(int i = 0; i < 10; i++)
    {
        cur += (char)(i + '0');
        
        dfs();
        
        cur.pop_back();
    }
}

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> N;
    
    for(int i = 0; i < 10; i++)
    {
        cur += (char)(i + '0');
        
        dfs();
        
        cur.pop_back();
    }
    
    
    cout << cnt << endl;
  
    return 0;
}


Measured memory_bytes: 4992
N = int(input())
ANs = list(map(int,input().split()))
 
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def lcm_base(x, y):
	return (x * y) // gcd(x, y)
	
lcmNum = ANs[0]
for a in ANs[1:]:
	lcmNum = lcm_base(lcmNum,a)
	
#print(lcmNum)
 
f = 0
for a in ANs:
	f += (lcmNum-1)%a
print(f)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
bool a[1111111];
void solve()
{
	a[1]=true; 
	for(int i=2;i<=1000000;i++)
		if(!a[i])
			for(int j=i+i;j<=1000000;j+=i)
				a[j]=true;
}
int wer[1111111];
int main()
{
	solve();
	//for(int i=2;i<=1000000;i++)
	//	cout<<a[i]<<" ";
	long long n;
	cin>>n;
	if(n==1){
		cout<<0<<endl;
		return 0;
	}
	long long ans=0;
	long long cnt=n;
	for(int i=2;i<=1000000;i++)
		if(!a[i])
			while(cnt%i==0){
				cnt/=i;
				wer[i]++; 
			}
	//for(int i=0;i<100;i++)
	//	cout<<wer[i]<<" ";
	for(int i=2;i<=1000000;i++)
		if(wer[i]!=0){
			int qwe=0;
			for(int j=1;j<=22;j++){
				qwe+=j;
				if(qwe>wer[i]){
					ans+=j-1;
					break;
				}
			}
		}
	if(cnt==n)
		cout<<1<<endl;
	if(cnt!=n){
		if(cnt>1000000)
			cout<<ans+1<<endl;
		else
			cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 4600
#include<bits/stdc++.h>
using namespace std;
bool pr[1000005];
int a[1000005] = {0, 0};
int main()
{
    memset(pr, true, sizeof(pr));
    for (int i = 2; i < 1000; i++)
        if (pr[i])
            for (int j = i * 2; j < 1000000; j += i)
                pr[j] = false;
    for (int i = 2; i < 1000000; i++)
        if (pr[i])
            a[i] = a[i - 1] + 1;
        else
            a[i] = a[i - 1];
    int n;
    while (~scanf("%d", &n))
        printf("%d\n", a[n]);
    return 0;
}




Measured memory_bytes: 8068
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>

using namespace std;

int main() {
	int n; cin >> n;
	vector<pair<int, int> > p(n);
	for (int i = 0; i < n; ++i) cin >> p[i].first, p[i].second = i;
	sort(p.begin(), p.end(), greater<>());
	set<int> se;
	se.insert(-1); se.insert(n);
	se.insert(p[0].second);
	long long ans = 0;
	for (int i = 1; i < n; ++i) {
		int now = p[i].second;
		auto r = se.lower_bound(now);
		auto l = r; l--;
		long long lcnt1 = now - *l, rcnt1 = *r - now;
		long long lcnt2 = 0, rcnt2 = 0;
		if (l != se.begin()) l--, lcnt2 = now - *l - lcnt1;
		r++;
		if (r != se.end()) rcnt2 = *r - now - rcnt1;
		ans += p[i].first * (lcnt1 * rcnt2 + rcnt1 * lcnt2);
		se.insert(now);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a.begin(), a.end());
    auto itr = lower_bound(a.begin(), a.end(), a.back() / 2);

    int r;
    if (*itr == a.back() / 2)
        r = *itr;
    else if (abs(2 * (*itr) - a.back()) < abs(2 * (*(itr - 1)) - a.back()))
        r = *itr;
    else
        r = *(itr - 1);
    cout << a.back() << " " << r << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
using namespace std;
void Main()
{
    int T,n,k;
    cin>>T;
    while(T--)
    {
        cin>>n>>k;
        if(!n)
        {
            cout<<"Bob"<<endl;
            continue;
        }
        if(k % 3 != 0) cout<<(n % 3 == 0 ? "Bob" : "Alice")<<endl;
        else
        {
            if(n %(k+1) == 0)
            {
                cout<<"Bob"<<endl;
                continue;
            }
            int num = (n %(k+1) -1) / 3;
            if(num == (k-1)/3) cout<<"Alice"<<endl;
            else cout<<(n % (k+1) %3 == 0 ? "Bob" : "Alice")<<endl;
        }
    }
}
int32_t main()
{
    IOS;
    int n,m;
    cin>>n>>m;
    cout<<(n*n-m)<<endl;
    return 0;
}


Measured memory_bytes: 256
//
//  A.cpp
//  CodeForcesProblems
//
//  Created by Jacob Murry on 1/6/20.
//  Copyright © 2020 Jacob Murry. All rights reserved.
//

//#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

class Solution {
    
};

int main(int argc, char * argv[]) {
    int N = 0;
    cin >> N;
    vector<int> dp(N, 0);
    vector<int> stones(N, 0);
    for(int i=0; i<N; ++i) {
        int h;
        cin>>h;
        stones[i] = h;
        //dp[n] = min(dp[i-1]+abs(stones[i-1]-h), dp[i-2]+abs(stones[i-2]-h))
        //base case is i==0 or i==1
        if(i==0) {
            dp[i] = 0;
        } else if(i==1) {
            dp[i] = abs(stones[0]-h);
        } else {
            dp[i] = min(dp[i-1]+abs(stones[i-1]-h), dp[i-2]+abs(stones[i-2]-h));
        }
    }
    cout << dp.back() << "\n";
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
using namespace std;

int main() {
    int t = 0;
    int n, m;
    while ( cin >> n >> m ) {
        if ( n == 0 && m == 0 ) break;

        // Case 1: 1
        int answer = 0;
        int D[21];
        for ( int i = 0; i < 21; i++ ) D[i] = 0;
        D[0] = n;
        while ( D[m] == 0 ) {
            int ND[21];
            for ( int i = 0; i < 21; i++ ) ND[i] = 0;
            for ( int i = 0; i+1 < 21; i++ ) {
                int m = D[i]/2;
                ND[i+1] += m;
                ND[i]   += D[i] % 2;
                ND[0]   += m;
            }
            for ( int i = 0; i < 21; i++ ) D[i] = ND[i];
            answer++;
        }
        cout << "Case " << ++t << ": " << answer << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int main(){
		int k,t,i,a[100],ans=0;
		scanf("%d%d",&k,&t);
		for(i=0;i<t;i++)scanf("%d",&a[i]);
		int max=0;
		for(i=0;i<t;i++){
				if(max<a[i]){
						max=a[i];
				}
		}
		if((k%2==0&&max<=k/2)||(k%2==1&&max<=k/2+1))puts("0");
		else{
				int tmp;
				if(k%2==0)tmp=max-k/2;
				else tmp=max-(k/2+1);
				printf("%d\n",tmp*2-1);
		}
		return 0;
}


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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int H,W,N;
    cin>>H>>W>>N;
    int cnt = 0,tem = 0;

    if(H>W){
        cnt = N/H;
        N = N%H;
    }else{
        cnt = N/W;
        N = N%W;
    }
    if(N>0)
        cnt++;
    cout<<cnt<<'\n';
}

Measured memory_bytes: 256
a,b=['light fly', 'fly', 'bantam', 'feather', 'light', 'light welter','welter', 'light middle', 'middle', 'light heavy', 'heavy'],[48, 51, 54, 57, 60, 64, 69, 75, 81, 91]
while 1:
    try:
        c=float(input())
    except:break
    for i in range(10):
        if c<=b[i]:
            print(a[i])
            break
    else: print(a[10])

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
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;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

struct SegmentTree {
    int n;
    vector<int> node;

    SegmentTree(vector<int> v){
        int sz = v.size();
        n = 1;
        while(n < sz) n*=2;
        node.resize(2*n-1, INF);
        REP(i,0,sz) node[i+n-1] = v[i];

        REPR(i,n-2,-1){
            node[i] = gcd(node[2*i+1],node[2*i+2]);
        }
    }

    void update(int loc, int val) {
        int x = loc+(n-1);
        node[x] = val;
        while(x>0) {
            x = (x-1)/2;
            node[x]=gcd(node[2*x+1],node[2*x+2]);
        }
    }

    int getgcd(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return node[k];
        int vl = getgcd(a, b, 2*k+1, l, (l+r)/2);
        int vr = getgcd(a, b, 2*k+2, (l+r)/2, r);
        return gcd(vl, vr);
    }
};

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    Vi a(n);
    REP(i,0,n) cin>>a[i];
    
    SegmentTree seg(a);
    
    int ans=1;
    REP(i,0,n){
        int tmp=gcd(seg.getgcd(0,i),seg.getgcd(i+1,n));
//        cout<<seg.getgcd(0,i)<<" "<<seg.getgcd(i+1,n)<<" "<<tmp<<endl;
        chmax(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


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

class Program {
    static void Main (string[] args) {
        var inp = Console.ReadLine().Split(' ');
        var inp2 = Console.ReadLine().Split(' ');

        var inp2i = new List<int>();

        for(int i = 0;i < int.Parse(inp[0]);i++) {
            inp2i.Add(int.Parse(inp2[i]));
        }

        inp2i.Sort();
        inp2i.Reverse();

        float inp2iNum = inp2i.Sum();

        for(int i = 0;i < int.Parse(inp[1]);i++) {
            if(inp2i[i] < inp2iNum / (4 * int.Parse(inp[1]))) {
                Console.WriteLine("No");
                return;
            }
        }

        Console.WriteLine("Yes");
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define double long double
int main() {
	int n;
	cin>>n;
	vector<pair<double, pair<int, int>>>v;
	for(int i=0; i<n; i++){
		int x, y;
		cin>>x>>y;
		double val=atan2(x, y);
		if(val<0){
			val+=2*M_PI;
		}
		v.pb({val, {x, y}});
	}
	sort(v.begin(), v.end());
	vector<pair<int, int>>vals;
	for(auto u:v){
		vals.pb({u.s.f, u.s.s});
	}
	for(auto u:v){
		vals.pb({u.s.f, u.s.s});
	}
	double ans=0;
	
	for(int i=1; i<=n; i++){
		for(int j=0; j+i-1<2*n; j++){
			double xx=0;
			double yy=0;
			for(int k=j; k<=j+i-1; k++){
				xx+=vals[k].f;
				yy+=vals[k].s;
			}
			ans=max(ans, sqrt(xx*xx+yy*yy));
		}
	}
	cout<<setprecision(20)<<ans;
	return 0;
}

Measured memory_bytes: 4216
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 N,M;
    cin>>N>>M;
    vector<int64> L(M);
    vector<int64> R(M);

    int64 Lmax=0,Rmin=N;

    for(int64 i=0;i<M;i++){
        cin>>L[i]>>R[i];
        Lmax=max(L[i],Lmax);
        Rmin=min(R[i],Rmin);
    }
    if(Rmin-Lmax+1>0){
        cout<<Rmin-Lmax+1<<endl;
    }else{
        cout<<"0"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1792
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        a: usize,
        b: usize,
        c: usize,
    }
    let flag = if a == b && b == c {
        false
    } else if a == b || b == c || c == a {
        true
    } else {
        false
    };

    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
    
}


Measured memory_bytes: 2188
# AOJ 0524: Searching Constellation
# Python3 2018.7.1 bal4u

def check(dx, dy):
	f = True
	for x, y in goal:
		if (x+dx, y+dy) not in tbl: 
			f = False
			break
	return f

while True:
	m = int(input())
	if m == 0: break
	goal, star, tbl = [], [], {}
	for i in range(m):
		goal.append(tuple(map(int, input().split())))
	for i in range(int(input())):
		x, y = map(int, input().split())
		star.append((x, y))
		tbl[x,y] = 1
	for x, y in star:
		dx, dy = x-goal[0][0], y-goal[0][1]
		if check(dx, dy): break
	print(dx, dy)


Measured memory_bytes: 5724
#include <iostream>

using namespace std;

int main(){

        int num[100];
        int n;

        cin >> n;

        for(int i = 0; i < n; i++) cin >> num[i];
        for(int j = (n - 1); j >= 0; j--){
                cout << num[j];
                if(j != 0) cout << " ";
        }
        cout << "\n";
        return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#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()

int main() {
    int N,cnt,mincnt=10000000000;
    cin>>N;
    int a[N];
    for(int k=0;k<N;k++){
        cin>>a[k];
    }
    for(int j=-100;j<101;j++){
        cnt=0;
        for(int i=0;i<N;i++){
        cnt+=pow((j-a[i]),2);
        }
        mincnt=min(cnt,mincnt);
    }
    cout<<mincnt<<"\n";
}

Measured memory_bytes: 256
N = int(input())
counter = 0
old_list = []
for i in range(N):
    word = input()
    if i == 0:
        old = word
        counter += 1
        old_list.append(word)
    else:
        if old[-1] == word[0] :
            if not (word in old_list):
                counter +=1
        old_list.append(word)
        old = word
if counter == N:
    print("Yes")
else:
    print("No")

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

#define x first
#define y second
#define x1 X1 
#define x2 X2
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }
inline int read ()
{
	int sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

const int MaxN = 2e5 + 100;

int N;
LL A[MaxN];

map <LL, int> S;

int main()
{
#ifdef hk_cnyali
	freopen("A.in", "r", stdin);
	freopen("A.out", "w", stdout);
#endif
	N = read();
	LL sum = 0;
	for (int i = 1; i <= N; ++i)
	{
		A[i] = read();
		sum += A[i];
		S[sum]++;
	}
	LL ans = 0; sum = 0;
	for (int i = 1; i <= N; ++i)
	{
		ans += S[sum];
		sum += A[i];
		S[sum]--;
	}
	cout<<ans<<endl;
	return 0;
}


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

typedef long long ll;
typedef int64_t in;
using namespace std;
#define INF 1000000007
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)


int main() {
    double w,h,x,y;
    cin >> w >> h >> x >> y;
    double s = w*h/2;
    int way=0;
    if(x == w/2 && y == h/2){
        way=1;
    } 
    printf("%f %d",s,way);
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
void LOG(const vector<int>& a) { for (int x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

i32 tax(i32 p, i32 x) {
  return p * (100 + x) / 100;
}

signed main() {
  while (true) {
    i32 x, y, s;
    cin >> x >> y >> s;
    if (s == 0) break;
    i32 ans = 0;
    FOR(a, 1, s) {
      FOR(b, 1, s) {
        i32 sum = tax(a, x) + tax(b, x);
        if (sum == s) {
          ans = max(ans, tax(a, y) + tax(b, y));
        }
        if (sum > s) {
          break;
        }
      }
    }
    cout << ans << endl;
  }
}



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

int main(void){

	int kousya[4][3][10], n, b, f, r, v;
	cin >> n;

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 10; k++){
				kousya[i][j][k] = 0;
			}
		}
	}

	for (int i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		kousya[b-1][f-1][r-1] += v;
	}

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 10; k++){
				cout << " " <<  kousya[i][j][k];
			}
			cout << endl;
		}
		if (i == 3) break;
		cout << "####################" << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
 
using namespace std;
#define sz(x) (int)(x).size()
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
const int N=3e5+5,MOD=1e9+7;
 
int n,m;

ll dp[1005][1005];
string a[1005];
int main()
{	

	cin>>n>>m;

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

	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(i==0 && j==0)dp[i][j]=1;
			if(i-1>=0 && a[i-1][j]!='#')dp[i][j]+=dp[i-1][j];
			if(j-1>=0 && a[i][j-1]!='#')dp[i][j]+=dp[i][j-1];
			dp[i][j]%=MOD;
		}
	}

	printf("%lld\n",dp[n-1][m-1]);

	
}
 

Measured memory_bytes: 9088
#include <iostream>
#include <vector>
#include <limits>
using namespace std;

bool canMake(vector<int> &v, int x) {
    int n = v.size();
    int sum = v[0], best = 0;
    
    for(int i = 1; i < n + 2; i += 2) {
        if(sum - best >= x) {
            if(i == n)
                return true;
            if(i < n) {
                best = min(best, sum - v[i]);
            }
        }

        if(i < n) {
            sum -= v[i];
        }

        if(i + 1 < n) {
            sum += v[i + 1];
        }
    }

    return false;
}

int main() {
    int n; cin >> n;
    vector<int> v(n, 0);
    vector<int> p(2, 0);

    for(int i = 0; i < n; i += 1) {
        cin >> v[i];
        p[i % 2] += v[i];
    }

    if(n % 2 == 0) {
        cout << max(p[0], p[1]) << " " << min(p[0], p[1]) << "\n";
        return 0;
    }  

    int ans = p[0];
    int best = 0;

    for(int lf = 0, rt = 1e8; lf <= rt;) {
        int mid = (lf + rt) / 2;
        if(canMake(v, mid)) {
            best = mid;
            lf = mid + 1;
        } else {
            rt = mid - 1;
        }
    }
    
    ans = max(ans, p[1] + best);
    cout << ans << " " << p[0] + p[1] - ans << "\n";
}

Measured memory_bytes: 1408
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int maxn = 1000000;
vector<bool> is_prime(maxn+1);
void sieve(){
    int p = 0;
    for(int i=0;i<=maxn;i++) is_prime[i]=true;
    is_prime[0]=false;
    is_prime[1]=false;
    for(int i=2;i<=maxn;i++){
        if(is_prime[i]){
            for(int j=i*2;j<=maxn;j+=i){
                is_prime[j]=false;
            }

        }
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    sieve();
    int ans = n;
    while(is_prime[ans]==false){
        ans++;
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
  int A = 0, B = 0, C = 0, D = 0;
  cin >> A >> B >> C >> D;
  int L = A + B;
  int R = C + D;
  if( L > R ){
    cout << "Left" << endl;
  }
  else if( L == R ){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;

queue<int> Q;
vector<int> v[111111], p[111111];
int parent[111111], visit[111111], group[111111];

void bfs(int start)
{
	int i;

	Q.push(start);
	visit[start] = 1;
	parent[start] = start;
	while (!Q.empty())
	{
		int t = Q.front(); Q.pop();

		for (i = 0; i < p[t].size(); i++)
		{
			int next = p[t][i];

			if (!visit[next])
			{
				parent[next] = start;
				visit[next] = 1;
				Q.push(next);
			}
		}
	}
}

int main(void)
{
	int n, m, k, i, j;

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

	while (m--)
	{
		int a, b;

		scanf("%d %d", &a, &b);

		v[a].push_back(b);
		v[b].push_back(a);

		p[a].push_back(b);
		p[b].push_back(a);
	}
	while (k--)
	{
		int c, d;

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

		v[c].push_back(d);
		v[d].push_back(c);
	}

	for (i = 1; i <= n; i++)
		if (!visit[i])
			bfs(i);

	for (i = 1; i <= n; i++)
		group[parent[i]]++;

	for (i = 1; i <= n; i++)
	{
		int cnt = group[parent[i]];
		
		for (j = 0; j < v[i].size(); j++)
			if (parent[v[i][j]] == parent[i])
				--cnt;
		
		printf("%d ", cnt - 1);
	}
	return 0;
}

Measured memory_bytes: 14960
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;

int N;
string S;

int main() {
    cin >> N >> S;
    int ans = 0;
    for (char f = '0'; f <= '9'; f++) {
        size_t i = S.find(f);
        if (i > N - 3) continue;
        for (char s = '0'; s <= '9'; s++) {
            size_t j = S.substr(i + 1).find(s);
            if (i + j + 1 > N - 2 || j > N - 2) continue;
            for (char t = '0'; t <= '9'; t++) {
                size_t k = S.substr(i + j + 2).find(t);
                if (i + j + k + 2 > N - 1 || k > N - 1) continue;
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
use std::char;
use std::io::Read;

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    let mut s: Vec<i32> = vec![0; m];
    let mut c: Vec<u32> = vec![0; m];
    for i in 0..m {
        s[i] = iter.next().unwrap().parse().unwrap();
        c[i] = iter.next().unwrap().parse().unwrap();
    }
    let mut ans :Vec<char> = vec![' '; n];

    for i in 0..m {
        let c = char::from_u32(c[i] + ('0' as u32)).unwrap();
        let index = (s[i]-1) as usize;
        if ans[index] != ' ' && ans[index] != c {
            println!("{}", -1);
            return;
        }
        ans[index] = c;
    }
    for i in 0..n {
        if ans[i] == ' ' {
            ans[i] = if i == 0 && n > 1 { '1' } else { '0' }
        }
    }
    if n > 1 && ans[0] == '0' {
        println!("{}", -1);
    }else {
        println!("{}", ans.into_iter().collect::<String>());
    }
}


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

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

	int n;
	cin>>n;
	vector<ll> a(n);
	for(int i=0; i<n; ++i){
		cin>>a[i];
	}
	ll ans = 0;
	map<int,int> cnt;
	cnt[a[0]+0]++;
	for(int j=1; j<n; ++j){
		ans += cnt[j - a[j]];
		cnt[a[j]+j]++;
	}
	cout << ans << '\n'; 

	return 0;
}


Measured memory_bytes: 21912
#include<stdio.h>
int main(void)
{
        int max,min,i,n,a[10000];
        scanf("%d",&n);
        scanf("%d",&a[0]);
        max=min=a[0];
        for(i=1;i<n;i++){
                scanf("%d",&a[i]);
                if(a[i]>max) max=a[i];
                else if(a[i]<min) min=a[i];
        }
        printf("%d\n",max-min);
        return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int a, b, c, d, e;

int main(){
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  printf("%d\n", min(a, min(b, c)) + min(d, e) - 50);
  return 0;
}

Measured memory_bytes: 1184
#!/usr/bin/env python3

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
# print(n, S, q, T)

def binary_search(arr, x):
    left = 0
    right = len(arr) - 1
    while left <= right:
        mid = int((left + right) / 2)
        if arr[mid] < x:
            left = mid + 1
        elif arr[mid] > x:
            right = mid - 1
        else:
            return mid
    return -1

S.sort()
count = 0
for i in range(q):
    if binary_search(S, T[i]) != -1:
        count += 1

print(count)



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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

vvll x;
vvll y;
ll N;

ll check(ll pos){
  ll pos_copy = pos<<1;
  ll ans = 0;
  vll flag(N, 0);
  REP(i,N){
    pos_copy>>=1;
    if(pos_copy%2==0) continue;
    ans++;
    ll L = x[i].size();
    REP(j,L){
      ll target = x[i][j];
      if(y[i][j]==0){
        if(flag[target]==2) return false;
        flag[target] = 1;
      }else{
        if(flag[target]==1) return false;
        flag[target] = 2;
      }
    }
  }
  pos_copy = pos<<1;
  REP(i,N){
    pos_copy>>=1;
    if(pos_copy%2==0){
      if(flag[i]==2) return false;
    }else{
      if(flag[i]==1) return false;
    }
  }
  return true;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(N);
  vll A(N);
  x.resize(N);
  y.resize(N);
  REP(i,N){
    IN(A[i]);
    REP(j,A[i]){
      ll x_tmp, y_tmp;
      IN(x_tmp, y_tmp);
      x[i].pb(x_tmp-1);
      y[i].pb(y_tmp);
    }
  }

  ll ans = 0;
  REP(i,1<<N){
    if(check(i)) chmax(ans, popcount(i));
  }

  OUT(ans);

  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 rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    char mo;
    cin >> mo;
    int a = (int)'a';
    if((int)mo>=97&&(int)mo<=(97+25)){
        cout << "a" << endl;
    }else{
        cout << "A" << endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
const int N=2e5+5;
int n,m;
int a[501][501];
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif
	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)cin>>a[i][j];

	vector<tuple<int,int,int,int>> ans;
	for(int i=0;i<n;i++)
		for(int j=0;j<m-1;j++)
		{
			if(a[i][j]%2)
			{
				a[i][j]--;
				a[i][j+1]++;
				ans.push_back({i+1,j+1, i+1,j+2});
			}
		}
	
	for(int i=0;i<n-1;i++)
		{
			if(a[i][m-1]%2)
			{
				a[i][m-1]--;
				a[i+1][m-1]++;
				ans.push_back({i+1,m, i+2,m});
			}
		}

	cout<<ans.size()<<"\n";
	for(auto i:ans)
	{
		int a,b,c,d;
		tie(a,b,c,d)=i;
		cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
	}


	
}

Measured memory_bytes: 9404
#include <bits/stdc++.h> 
#include <time.h>
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-10
using namespace std;
typedef long long ll;
const int mods = 1e9+7;
const int maxn = 2e5+10;
const int N = 1e5+10;
const int E = 2e5+10;  
int n,k;
string s;
//int pre[maxn];
int f[2][2100];
int top;
int main(){
	top = 2019;
	cin>>s;
	int t = 0;
	f[0][s[0]-'0'] = 1;
	t++;
	ll ans = 0;
	F(i,1,s.size()-1){
		F(j,0,top-1){
			f[t%2][(j*10+(s[i]-'0'))%top]=f[(t+1)%2][j];
		}
		f[t%2][s[i]-'0'] ++;
		ans += f[t%2][0];
		t++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3680
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;


int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n,q;
  cin>>n>>q;
  vector<ll> qs={n};
  rep(i,q){
    ll x;
    cin>>x;
    while(qs.size() && qs.back()>=x) qs.pop_back();
    qs.pb(x);
  }
  //cout<<qs;
  map<ll,ll> cnt;
  ll sum=qs.back();
  cnt[qs.back()]=1;
  rrep(i,qs.size()-1){
    map<ll,ll> tmp;
    for(auto it=cnt.lower_bound(qs[i]);it!=cnt.end();++it){
      tmp[it->X%qs[i]]+=it->Y;
      //cout<<*it<<"->"<<it->X%qs[i]<<endl;
      //cout<<sum<<"=>";
      sum-=it->X*it->Y;
      sum+=(it->X%qs[i])*it->Y;
      //cout<<sum<<endl;
    }
    cnt.erase(cnt.lower_bound(qs[i]),cnt.end());
    for(auto p:tmp) cnt[p.X]+=p.Y;
    cnt[qs[i]]+=(qs.back()-sum)/qs[i];
    //cout<<qs.back()-sum<<","<<qs[i]<<","<<(qs.back()-sum)%qs[i]<<endl;
    assert((qs.back()-sum)%qs[i]==0);
    sum=qs.back();
    //  for(auto p:cnt) cout<<p;cout<<endl;
  }
  vector<ll> re(n+1);
  for(auto p:cnt) re[p.X]=p.Y;
  //cout<<re;
  ll s=accumulate(all(re),0ll);
  ll ast=0;
  rep(i,n){
    s-=re[i];
    cout<<s<<endl;
    ast+=s;
  }
  //assert(ast==qs.back());
  return 0;
}


Measured memory_bytes: 11636
import math
A,B,C,D=map(int,input().split())

E = C*D//math.gcd(C,D)
all = B - A + 1
Cmod = B//C - (A-1)//C
Dmod = B//D - (A-1)//D
CDmod = B//E - (A-1)//E

print(all - Cmod - Dmod + CDmod)

Measured memory_bytes: 61644
#include<iostream>
#include<list>
#include<algorithm>
#include<vector>
#include<math.h>
#include<iterator>
#include<ctype.h>
using namespace std;
int main() 
{
	char c;
	cin>>c;
	if(c>='a' && c<='z') cout<<'a'<<endl;
	else cout<<'A'<<endl;
  return 0;
} 


Measured memory_bytes: 3620