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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
#define MEM( arr, i ) memset( arr, i, sizeof (arr) )
#define Push push_back
#define Pair make_pair
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
const lli mod = 1000000007;


void precal() {

	return;
}

bool solve() {
	lli n = 1;
	string s;
	if ( cin >> n );
	else return false;
	
	vcL num( 6, 0 );
	
	for (int i = 0; i < 6; ++i) {
		cin >> num[i];
	}
	
	bool a = false, b = false, c = false;
	if ( num[0] < num[3] ) a = true;
	if ( num[1] < num[4] ) b = true;
	if ( num[2] < num[5] ) c = true;
	
	lli _max = 0;
	
	if ( a and b and c ) {
		for (int i = 0; i <= n/num[0]; ++i) {
			for (int j = 0; j <= (n-i*num[0])/num[1]; ++j) {
				lli k = (n-i*num[0]-j*num[1])/num[2];
				_max = max( _max, i*(num[3]-num[0]) + j*(num[4]-num[1]) + k*(num[5]-num[2]) );
			}
		}
		n += _max;
	}
	else if ( a and b ) {
		for (int i = 0; i <= n/num[0]; ++i) {
			_max = max( _max, i*(num[3]-num[0]) + (n-i*num[0])/num[1]*(num[4]-num[1]) );
		}
		n += _max;
		n += (n/num[5])*(num[2]-num[5]);
	}
	else if ( a and c ) {
		for (int i = 0; i <= n/num[0]; ++i) {
			_max = max( _max, i*(num[3]-num[0]) + (n-i*num[0])/num[2]*(num[5]-num[2]) );
		}
		n += _max;
		n += (n/num[4])*(num[1]-num[4]);
	}
	else if ( b and c ) {
		for (int i = 0; i <= n/num[1]; ++i) {
			_max = max( _max, i*(num[4]-num[1]) + (n-i*num[1])/num[2]*(num[5]-num[2]) );
		}
		n += _max;
		n += (n/num[3])*(num[0]-num[3]);
	}
	else if ( a ) {
		n += (n/num[0])*(num[3]-num[0]);
		for (int i = 0; i <= n/num[4]; ++i) {
			_max = max( _max, i*(num[1]-num[4]) + (n-i*num[4])/num[5]*(num[2]-num[5]) );
		}
		n += _max;
	}
	else if ( b ) {
		n += (n/num[1])*(num[4]-num[1]);
		for (int i = 0; i <= n/num[3]; ++i) {
			_max = max( _max, i*(num[0]-num[3]) + (n-i*num[3])/num[5]*(num[2]-num[5]) );
		}
		n += _max;
	}
	else if ( c ) {
		n += (n/num[2])*(num[5]-num[2]);
		for (int i = 0; i <= n/num[3]; ++i) {
			_max = max( _max, i*(num[0]-num[3]) + (n-i*num[3])/num[4]*(num[1]-num[4]) );
		}
		n += _max;
	}
	else {
		for (int i = 0; i <= n/num[3]; ++i) {
			for (int j = 0; j <= (n-i*num[3])/num[4]; ++j) {
				lli k = (n-i*num[3]-j*num[4])/num[5];
				_max = max( _max, i*(num[0]-num[3]) + j*(num[1]-num[4]) + k*(num[2]-num[5]) );
			}
		}
		n += _max;
	}
	
//	cout << "max: " << _max << '\n';
	cout << n << '\n';
	
	return true;
}

int main() {
	precal();
	int t = INT_MAX;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		if ( !solve() ) break;
	}
	return 0;
}


Measured memory_bytes: 256
use std::env;
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let a = read::<i32>();
    let b = read::<i32>();
    let c = read::<i32>();

    let mut v = vec![];
    v.push(a); v.push(b); v.push(c);
    v.sort();
    //println!("{:?}", v);
    println!("{}", v[0] + v[1]);
}


Measured memory_bytes: 4352
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

def integral(li):
    res = [li[0]]
    for a in li[1:]:
        res.append(res[-1] + a)
    return res

s1 = integral(a1)
s2 = integral(a2[::-1])[::-1]
ss = [x + y for x, y in zip(s1, s2)]
ans = max(ss)

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long int;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for(ll i=(ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
constexpr ll INF = 1ULL<<60;

int main() {
    ll n;
    cin >> n;
    // 0 → and, 1 → or
    vector<ll> s(n), t(n), u(n), v(n);
    REP(i, n) cin >> s[i];
    REP(i, n) cin >> t[i];
    REP(i, n) cin >> u[i];
    REP(i, n) cin >> v[i];

    vector<vector<ll>> ans(n, vector<ll>(n));
    REP(i, 64) {
        vector<ll> u2(n), v2(n);
        REP(j, n) u2[j] = !!(u[j]&1ULL<<i), v2[j] = !!(v[j]&1ULL<<i);
        
        vector<vector<ll>> used(n, vector<ll>(n));
        REP(j, n) if(s[j]==0 && u2[j]==1) REP(k, n) used[j][k] = 1;
        REP(j, n) if(t[j]==0 && v2[j]==1) REP(k, n) used[k][j] = 1;
        REP(j, n) REP(k, n) if(u2[j] == v2[k]) used[j][k] = u2[j];

        // 論理和が1の行の制約を満たせるように
        {
            vector<ll> zeros(n);
            REP(j, n) REP(k, n) zeros[k] += (used[j][k]==0);
            REP(j, n) if(s[j]==1 && u2[j]==1) {
                bool exist = false;
                REP(k, n) if(used[j][k]==1) exist = true;
                if(exist) continue;
                REP(k, n) if(t[k]==0 && v2[k]==0 && zeros[k]>=2) {
                    zeros[k]--;
                    used[j][k] = 1;
                    break;
                }
            }
        }
        // 列の制約を満たすように
        {
            vector<ll> zeros(n);
            REP(j, n) REP(k, n) zeros[j] += (used[j][k]==0);
            REP(j, n) if(t[j]==1 && v2[j]==1) {
                bool exist = false;
                REP(k, n) if(used[k][j]==1) exist = true;
                if(exist) continue;
                REP(k, n) if(s[k]==0 && u2[k]==0 && zeros[k]>=2) {
                    zeros[k]--;
                    used[k][j] = 1;
                    break;
                }
            }
        }
        
        REP(j, n) REP(k, n) ans[j][k] |= used[j][k]<<i;
    }

    auto check = [&] {
        REP(i, n) { 
            ll and1 = ans[i][0], or1 = 0, and2 = ans[0][i], or2 = 0;
            REP(j, n) {
                and1 &= ans[i][j];
                or1  |= ans[i][j];
                and2 &= ans[j][i];
                or2  |= ans[j][i];
            }
            if(s[i]==0 && u[i]!=and1) return false;
            if(s[i]==1 && u[i]!=or1) return false;
            if(t[i]==0 && v[i]!=and2) return false;
            if(t[i]==1 && v[i]!=or2) return false;
        }
        return true;
    };
    if(!check()) {
        cout << -1 << endl;
        return 0;
    }

    REP(i, n) REP(j, n) cout << ans[i][j] << (j==n-1?'\n':' ');

    return 0;
}

Measured memory_bytes: 7740
#include<bits/stdc++.h>
#define ALL(c) begin(c), end(c)
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e6+6;


ll solve(vector<int> a){
    int n = a.size();
    if(n==1) return 0;
    int m = n%2 ? 2 : 1;
    ll inf = 1e18;
    vector<vector<ll>> d(n+2, vector<ll>(m+1,-inf));
    d[n+1][0] = 0;
    d[n][0] = 0;
    for(int i=n-1;i>=0;--i){
        for(int j=0;j<=m;++j){
            ll res = -inf;
            for(int k=0;k<=j;++k){
                int p = i+k+2;
                if(p<=n+1) res = max(res, a[i] + d[p][j-k]);
            }
            d[i][j] = res;
            //cerr<<res<<' ';
        }//cerr<<endl;
    }
    
    ll ans = -inf;
    for(int k=0;k<=m;++k) if(k<n) ans= max(ans, d[k][m-k]);
    return ans;
}

int main(){
    //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);cin.tie(0);//cout.precision(12);cout<<fixed;
    
    int n;
    
    cin>>n;
    vector<int> a(n);
    for(auto &_ : a) cin>>_;
    
    
    cout<<solve(a)<<endl;
    
    
    return 0;
}


Measured memory_bytes: 15868
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    string s;
    cin >> s;
    reverse(ALL(s));
    ll n = s.length();
    s += '.';

    ll ans = 0, c = 0;
    REP(i,n){
        if (s[i] == 'A'){
            ans += c;
        }else if (s[i] == 'C' && s[i + 1] == 'B'){
            c++;
            i++;
        }else{
            c = 0;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)


function main()
    K = parseInt(readline())
    A,B = parseMap(split(readline()))
    for i in A:B
        if i % K == 0
            return "OK"
        end
    end
    return "NG"
end


println(main())

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

int main(){
    int N,A,B;
    int res=0;
    cin >> N;
    A=N/4+1;
    B=N/7+1;
    for (int a=0; a<A; ++a){
        for (int b=0; b<B; ++b){
            int total = 4*a+7*b;
            if(total==N) ++res;
        }
    }
    if(res != 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using LL = long long;

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); --(i))
#define SORT(x) sort(ALL((x)))
#define RSORT(x) sort(RALL((x)))
#define SZ(x) (int)(x).size()
#define debug(x) cerr << #x << " : " << x << '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const LL LINF = 1e18;

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

  LL ans;
  int A, B, K;
  cin >> A >> B >> K;

  if ((B - A + 1) / 2 < K) {
    FOR(i, A, B + 1) { cout << i << '\n'; }
  } else {
    FOR(i, A, A + K) { cout << i << '\n'; }
    FOR(i, B - K + 1, B + 1) { cout << i << '\n'; }
  }

  return 0;
}

Measured memory_bytes: 256
from decimal import Decimal 
a,b,c=map(int,input().split())
n=a*b
def d(n):
    l,r=0,10**20
    while abs(l-r)>Decimal(0.0000000000001):
        m=Decimal(l+r)/2
        if m**2>n:
            r=m
        else:
            l=m
    return r
if 2*d(n)<c-a-b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 5076
#include<bits/stdc++.h>
#define F 114514
using namespace std;int s[F],e[F],q;bool c[F];void a(bool t,bool r){if(t){if(c[q-1]!=r){if(q==1)e[0]++,c[0]=r;else{e[q-2]=e[q-1]+1;q--;}}else e[q-1]++;return;}if(c[q-1]!=r)s[q]=e[q-1],e[q]=s[q]+1,c[q]=r,q++;else e[q-1]++;return;}int main(){int n,t;while(true){cin>>n;if(!n)break;cin>>t;s[0]=0,e[0]=1,c[0]=t,q=1;for(int i=1;i<n;i++){cin>>t;a(i%2,t);}int o=0;for(int i=0;i<q;i++)if(!c[i])o+=e[i]-s[i];cout<<o<<endl;}return 0;}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
string s;
cin>>s;
int a=s.length();
if (s[a-1]=='3')
{
    cout<<"bon"<<endl;
}
else if (s[a-1]=='0'||s[a-1]=='1'||s[a-1]=='6'||s[a-1]=='8')
{
   cout<<"pon"<<endl;
}
else
{
    cout<<"hon"<<endl;
}


    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=200010,INF=0x7f7f7f7f;
lint ans=1;
char s[N];
int onecnt=0;
namespace T{
	const int E=N<<1;
	int to[E],bro[E],head[N],e=0;
	inline void init(){
		memset(head,-1,sizeof(head));
	}
	inline void ae(int u,int v){
		to[e]=v,bro[e]=head[u],head[u]=e++;
	}
	inline void add(int u,int v){
		ae(u,v),ae(v,u);
	}
	int dep[E],cnt[E];
	void dfs1(int x,int e){
		if(~e){
			dep[e]=1;
			cnt[e]=s[x]=='1';
		}
		for(int i=head[x],v;~i;i=bro[i]){
			if(i^e^1){
				dfs1(v=to[i],i);
				if(~e){
					cnt[e]+=cnt[i];
					apmax(dep[e],dep[i]+1);
				}
			}
		}
		if(~e){
			cnt[e^1]=onecnt-cnt[e];
		}
	}
	void dfs2(int x,int fa){
		int mx1=0,mx2=0,mn=s[x]=='1'?0:INF;
		int fr=0;
		for(int i=head[x];~i;i=bro[i]){
			if(dep[i]>mx1){
				mx2=mx1,mx1=dep[i];
				fr=i;
			}else if(dep[i]>mx2){
				mx2=dep[i];
			}
			if(cnt[i]){
				apmin(mn,dep[i]);
			}
		}
		ans+=max(min(mx1-1,mx2+1)-mn+1,0);
		for(int i=head[x],v;~i;i=bro[i]){
			if((v=to[i])!=fa){
				dep[i^1]=(fr!=i?mx1:mx2)+1;
				dfs2(v,x);
			}
		}
	}
}
inline lint Main(){
	int n=ni;
	T::init();
	for(int i=1;i<n;i++){
		T::add(ni,ni);
	}
	scanf("%s",s+1);
	for(int i=1;i<=n;i++){
		onecnt+=s[i]=='1';
	}
	T::dfs1(1,-1),T::dfs2(1,0);
	return ans;
}
int main(){
	printf("%lld\n",Main());
	return 0;
}

Measured memory_bytes: 17024
#include<bits/stdc++.h>
using namespace std;
int n;
string query(int x)
{
	cout<<x<<endl;
	fflush(stdout);
	string s; cin>>s;
	if(s=="Vacant") exit(0);
	return s;
}
int main()
{
	cin>>n;
	string a=query(0),b=query(n-1);
	int l=1,r=n-2;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		string k=query(mid);
		if(mid%2==0)
		{
			if(k==a) l=mid+1;
			else r=mid-1;
		}
		else
		{
			if(k==b) l=mid+1;
			else r=mid-1;
		}
	}
	return 0;
}

Measured memory_bytes: 852
def main():
    a, b = map(int, input().split())
    
    flg = 0
    for i in range(10000):
        tmp_a = int(i*0.08)
        tmp_b = int(i*0.1)
        if a == tmp_a and b == tmp_b:
            print(i)
            flg = 1
            break
    
    if flg == 0:
        print(-1)



if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

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

  vector<int> L(N);
  for(int i=0; i<N; ++i)
  {
    int l; cin >> l;
    L[i] = l;
  }
  sort(L.begin(), L.end());

  long long ans = 0;
  for(auto a = L.begin(); a != L.end()-1; ++a)
  {
    for(auto b = a + 1; b != L.end(); ++b)
    {
      int c = max(*a - *b + 1, *b - *a + 1);
      auto itrl = lower_bound(b+1, L.end(), c);
      auto itrr = lower_bound(b+1, L.end(), *b + *a);
      ans += itrr - itrl;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>


bool isPrime(int n){
  if(n==1)return false;
  for(int i=2;i*i <= n;i++){
    if(n%i==0)return false;
  }
  return true;
}


int main(){
  
  int a,b,n;
  while(true){
    scanf("%d %d %d",&a,&b,&n);
    if(a==0 && b==0 && n==0 )return 0;
    
    for(int i=0;i<n;a+=b,i++){
      while(!isPrime(a)){a+=b;}
    }
    printf("%d\n",a-b);
    }
  //  int i;
  //scanf("%d",&i);
  //printf("%d\n",isPrime(i));
  return 0;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}
 
int main() {
    FAST_IO();
    int N; cin >> N;
    string s;
    map<string, int> mp;
    rep(i, N) {
        cin >> s;
        sort(all(s));
        if(mp.find(s) == mp.end()) mp[s] = 1;
        else mp[s]++;
    }
    ll ans = 0;
    for(auto &x : mp) {
        ans += 1LL * (x.second - 1) * x.second / 2LL;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 11264
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        for (long i = 1; i <= 3500; i++) {
            for (long j = i; j <= 3500; j++) {
                long k = lcm(lcm(i, j), N);
                long a = k/i;
                long b = k/j;
                long c = k/N;
                if ((a+b+1) == (4*c)) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
    }

    private static long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b; // % is remainder
            a = temp;
        }
        return a;
    }


    private static long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }
}

Measured memory_bytes: 24020
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int N, K;
int x[100], y[100];

bool check(int top, int bottom, int right, int left) {
  int cnt = 0;
  rep(k, 0, N) {
    int cx = x[k];
    int cy = y[k];
    if (left <= cx && cx <= right && bottom <= cy && cy <= top) {
      ++cnt;
    }
  }

  return cnt >= K;
}

int dummy[1000000];

int main() {
  cin >> N >> K;
  rep(i, 0, N) { cin >> x[i] >> y[i]; }

  rep(i, 0, pow(N, 4)) { check(0, 0, 0, 0); }

  ll ans = numeric_limits<ll>::max();
  rep(i, 0, N) {
    rep(j, i, N) {
      rep(k, j, N) {
        rep(l, k, N) {
          ll top = max(y[i], max(y[j], max(y[k], y[l])));
          ll bottom = min(y[i], min(y[j], min(y[k], y[l])));
          ll left = min(x[i], min(x[j], min(x[k], x[l])));
          ll right = max(x[i], max(x[j], max(x[k], x[l])));

          if (check(top, bottom, right, left)) {
            chmin(ans, (top - bottom) * (right - left));
          }
        }
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 4072
#include<cstdio>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
    int n;
    pair<int,int> p[100000];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&p[i].first);
        p[i].second=i+1;
    }
    sort(p,p+n);
    for(int i=0;i<n;i++){
        printf("%d ",p[i].second);
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include<string>
using namespace std;
int n;
string s;
int main(){
  cin >> n;
  int a = 0;
  for(int i = 0; i < n; ++i){
    cin >> s;
    if(s == "Y") ++a;
  }
  if(a != 0) cout << "Four" << endl;
  else cout << "Three" << endl;
}

Measured memory_bytes: 256
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};

fn main() {
    input! {
        s: String,
    };

    let sc: Vec<char> = s.chars().collect();

    for i in 0..sc.len() {
        if sc.iter().filter(|&x| *x == sc[i]).count() != 2 {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 2088
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"
 
#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
typedef long long ll;
using namespace std;

int n,a,x,cnt;
bool p[30];
int main(){
	cin>>n;
	lp(30)
		p[i]=false;
	x=0;
	lp(n){
		cin>>a;
		x^=a;
		LP(30,j){
			if(a%2){
				p[j]=true;;
				break;
			}
			a/=2;
		}
	}
	cnt=0;
	for(int i=29;i>=0;i--){
		if(x/(1<<i)){
			if(p[i]==0){
				cout<<-1<<endl;
				return 0;
			}
			cnt++;
			x^=(1<<(i+1))-1;
		}
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A_array = list(map(int,input().split()))

start = 0
end = 0
ans = 0
a_sum = A_array[0]
a_xor = A_array[0]

for start in range(N):
    while end != (N-1):
        # print(start,end,a_sum,a_xor)
        a_sum_new = a_sum + A_array[end+1]
        a_xor_new = a_xor ^ A_array[end+1]
        if a_sum_new == a_xor_new:
            end += 1
            a_sum = a_sum_new
            a_xor = a_xor_new
        else:
            break
    # print("!",a_sum,a_xor,start,end)
    ans += (end-start+1)
    a_sum -= A_array[start]
    a_xor = a_xor ^ A_array[start]

print(ans)



Measured memory_bytes: 77900
using System;
using System.Text;

namespace ALDS1_11_A {
    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            int[,] map = new int[n + 1, n + 1];
            for(int i = 0; i < n; i++) {
                string[] input = Console.ReadLine().Split(' ');
                int u = int.Parse(input[0]);
                int k = int.Parse(input[1]);
                for(int j = 0; j < k; j++) {
                    map[u, int.Parse(input[2 + j])] = 1;
                }
            }
            
            StringBuilder h = new StringBuilder();
            for(int i = 1; i <= n; i++) {
                StringBuilder w = new StringBuilder();
                for (int j = 1; j <= n; j++) {
                    w.Append(" " + map[i, j]);
                }
                h.AppendLine(w.ToString().TrimStart());
            }
            Console.Write(h);
        }
    }
}

Measured memory_bytes: 9580
def main():
  INIT = 100
  
  query = []
  ans = []
  while True:
    q = int(input())
    if q == 0:
      break
    query.append(q)
  MAX = max(query)
  
  table = [INIT] * (MAX + 1)
  table[0] = 0
  all_item = [i * (i + 1) * (i + 2) // 6 for i in range(1, 181)]
  odd_item = [i for i in all_item if i % 2]
  eve_item = [i for i in all_item if not i % 2]
  
  for v in odd_item:
    for j in range(v, MAX + 1):
      tjv = table[j - v]
      if table[j] > tjv + 1:
        table[j] = tjv + 1
  
  for q in query:
    ans.append(table[q])
  
  for v in eve_item:
    for j in range(v, MAX + 1):
      tjv = table[j - v]
      if table[j] > tjv + 1:
        table[j] = tjv + 1
  
  for i, q in enumerate(query):
    print(table[q], ans[i])

main()


Measured memory_bytes: 13152
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b;
	cin>>a>>b;
	if(a > b){
		int t = a;a = b;b = t;
	}
	for(int i = a; i <= b; ++i){
		if((a * b * i) % 2 != 0){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1337;
const int MOD = 1e9+7;
char B[N][N];
int dp[N][N];
int main(){
    int h,w; cin >> h >> w;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cin >> B[i][j];
        }
    }
    dp[1][1] = 1;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(i-1 >= 1 && B[i-1][j] != '#'){
                dp[i][j] = (dp[i-1][j]+dp[i][j])%MOD;
            }
            if(j-1 >= 1 && B[i][j-1] != '#'){
                dp[i][j] = (dp[i][j-1]+dp[i][j])%MOD;
            }
        }
    }
    cout << dp[h][w];
}


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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
	 
const ll MAX = 10000000;
const ll inf = 5e18-1;

int main() {
	fastio;
	ll h,w,a,b;
	cin >> h >> w >> a >> b;
	f(i,0,h){
		f(j,0,w){
			ll x = ((i < b)^(j < a));
			cout << x;
		}
		cout << '\n';
	}
	return 0;
	}

Measured memory_bytes: 1280
#include <iostream>

using namespace std;

int main() {
	int a, b;
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0) break;
		if (a > b) cout << b << " " << a;
		else cout << a << " " << b;
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
    int r;
    cin>>r;
    double cir;
    cir=2*(M_PI)*r;
    cout<<fixed<<setprecision(5)<<cir<<endl;
}

Measured memory_bytes: 3788
import java.io.*;
import java.util.*;

public class Main{ 
   static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }

     long nextLong(){
          return Long.parseLong(next());
     }

 }
  
	public static void main(String[] args)throws Exception{
         //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
          Fast f=new Fast();
         PrintWriter out = new PrintWriter(System.out);
        // StringBuilder str=new StringBuilder();
         //  int x=Integer.parseInt(st.nextToken());
         
        //st=new StringTokenizer(br.readLine()); 

        
        int n=f.nextInt();
        int ans[]=new int[3];
        int a=0,b=0,c=0;
        for (int i=0;i<n;i++ ) {
            a=f.nextInt()+Math.max(ans[1],ans[2]);
            b=f.nextInt()+Math.max(ans[0],ans[2]);
            c=f.nextInt()+Math.max(ans[0],ans[1]);
            ans[0]=a;
            ans[1]=b;
            ans[2]=c;
        }
        
        int mh=Math.max(Math.max(ans[0],ans[1]),ans[2]);
        
        out.println(mh);
    out.close();

}
}




Measured memory_bytes: 54268
from sys import exit
from itertools import product

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

def primes(n):
    numbers = set(range(n, 1, -1))
    primes = []
    while numbers:
        p = numbers.pop()
        primes.append(p)
        numbers.difference_update(set(range(p*2, n+1, p)))
    return sorted(primes)

PRIMES = primes(10**6)

def pfact(x):
  res = dict()
  while x > 1:
    for p in PRIMES:
      if p >= x**0.5 + 1:
        res[x] = res.get(x, 0) + 1
        x = 1
        break
      if x % p == 0:
        res[p] = res.get(p, 0) + 1
        x //= p
        break
  return res

def prod(xs):
  res = 1
  for x in xs:
    res *= x
  return res

def divisors(n):
  P = list(pfact(n).items())
  res = []
  for ds in product(*[range(e+1) for (p, e) in P]):
    res.append(prod(P[i][0]**ds[i] for i in range(len(P))))
  return sorted(res)

def f(b, n):
  return 0 if n == 0 else f(b, n//b) + n % b

n = read()
s = read()

if n < s:
  print(-1); exit()

if n == s:
  print(s+1); exit()

for x in divisors(abs(n-s)):
  b = x + 1
  if f(b, n) == s:
    print(b); exit()

print(-1)


Measured memory_bytes: 131292
#include "bits/stdc++.h"
using namespace std;

int main() {
	 string word;
	 stack<int> S;
	 while (cin >> word) { // 入力がある限り読み込む
		 if (word == "+") {
			 int m1 = S.top();
			 S.pop();
			 int m2 = S.top();
			 S.pop();
			 S.push(m1 + m2);// 数を2 つpop して、和をpush する
				
		 }
		 else if (word == "-") {
			 int m1 = S.top();
			 S.pop();
			 int m2 = S.top();
			 S.pop();
			 S.push(m2 - m1);// 数を2 つpop して、差をpush する
				
		 }
		 else if (word == "*") {
			 int m1 = S.top();
			 S.pop();
			 int m2 = S.top();
			 S.pop();
			 S.push(m1 * m2);// 数を2 つpop して、積をpush する
				
		 }
		 else {
			int n = atoi(word.c_str());// word を数値にしてpush する
				S.push(n);
		 }
		
	 }
	 cout << S.top() << endl;// S の先頭要素を表示する。
	 return 0;
}


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

using namespace std;

int main()
{
    long long n,d,i,x,y,c=0;
    double di;
    cin>>n>>d;
    for(i=0;i<n;i++){
        cin>>x>>y;
        di=sqrt((x*x) + (y*y));
        if(di<=d)
            c++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 3684
#include<stdio.h>
int main(){
  int i, N, a, A[200000];
  long int count=0;
  scanf("%d", &N);
  for(i=0; i<N; i++){
    A[i]=0;
  }
  for(i=0; i<N; i++){
    scanf("%d", &a);
    if(i+a+1<N){
      A[i+a]++;
    }
    if((i-a+1)>0){
      count+=A[i-a];
    }
  }
  printf("%ld",count);
  return 0;
}

Measured memory_bytes: 2488
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n, a[100000], cnt = 0;
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
    if(a[i] % 2 == 1) cnt++;
  }

  if(cnt % 2 == 0) printf("YES\n");
  else printf("NO\n");

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
class P {
 public:
  double x, y;
  explicit P(double x, double y) : x{x}, y{y} {}
  P operator+(const P p) { return P(x + p.x, y + p.y); }
  P operator-(const P p) { return P(x - p.x, y - p.y); }
  double abs() { return sqrt(pow(x, 2) + pow(y, 2)); }
};
int main() {
  double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << fixed << setprecision(10) << (P(x1, y1) - P(x2, y2)).abs() << endl;
}



Measured memory_bytes: 3272
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>
using namespace std;

int main()
{
	int n;cin>>n;
	int cnt=0;
	for(int i=0;i<n;i++){
		int x,y; cin>>x>>y;
		if(x==y){
			cnt++;
		}
		else
			cnt=0;
		if(cnt==3){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N := sc.NextInt()

	fmt.Println((N - 1) / 2)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
import math
while True:
    n=int(input())
    if n==0:
        break

    scores=[]
    total=0

    scores=list(map(int,input().split(" ")))
    for score in scores:
        total+=score

    average=total/len(scores)
    hensa=0

    for score in scores:
        hensa+=(score-average)**2

    std=math.sqrt(hensa/len(scores))
    print("{:.8f}".format(std))




Measured memory_bytes: 5700
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,ta,tb,tc;
    cin>>a>>b>>c;
    int sum = 0;
    while(1)
    {
        if(a&1 || b&1 || c&1) break;
        if((a==b && b==c) ||(a&1 && b&1 && c&1))
        {
            sum = -1;
            break;
        }
        ta =a ; tb = b; tc = c;
        a = (tb+tc)/2;
        b = (ta+tc)/2;
        c = (ta+tb)/2;
        sum++;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
/* ****Abhi1998**** */
                     
                    #include<bits/stdc++.h>
                    #define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
                    #define ll          int long long
                    #define pb          push_back
                    #define endl        '\n'
                    #define piil         pair<ll ,ll >
                    #define vi          vector<ll>
                    #define all(a)      (a).begin(),(a).end()
                    #define F           first
                    #define S           second
                    #define sz(x)       (ll)x.size()
                    #define hell        1000000007
                    #define rep(i,a,b)  for(ll i=a;i<b;i++)
                    #define lbnd        lower_bound
                    #define ubnd        upper_bound
                    #define bs          binary_search
                    #define mp          make_pair
                    
                   
                    using namespace std;
                    
          
int main(){
  
    ll n;
    cin>>n;
    std::vector<ll> a(n),b(n);
    rep(i,0,n)
    {
     cin>>a[i];
     if(i!=0)
     b[i]=b[i-1]+abs(a[i]-a[i-1]);
else
     b[i]=abs(a[i]);
    }
    rep(i,0,n)
    {
     if(i==0)
     {
          cout<<b[n-1]+abs(a[n-1]-0)-(abs(a[0])+abs(a[0]-a[1])-abs(a[1]-0))<<endl;
     }
     if(i==n-1)
     {
          cout<<b[n-2]+abs(a[n-2]-0)<<endl;
     }
     if(i!=0 && i!=n-1)
     {
          cout<<b[n-1]+abs(a[n-1]-0)-(abs(a[i-1]-a[i])+abs(a[i+1]-a[i])-abs(a[i+1]-a[i-1]))<<endl;
     }

    }
    return 0;
}

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

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

    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    for (ll i = 0;i < n;i++){
        cin >> a[i] >> b[i];
    }

    ll ans = 0;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());

    for (ll i = 0; i < n; i++){
        a[i] += ans;
        if (a[i]%b[i] != 0){
            ans += b[i] - (a[i]%b[i]);
        }
    }

    cout << ans << "\n";
}

Measured memory_bytes: 4800
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n;
char s[N];
int ans[N];
bool cl(){
	for(int i=3;i<=n;i++){
		if(s[i-1]=='o'&&ans[i-1]==1||s[i-1]=='x'&&ans[i-1]==0)ans[i]=ans[i-2];
		else ans[i]=(ans[i-2]^1);
	}
	bool flag1=0;
	if(s[n]=='o'&&ans[n]||s[n]=='x'&&ans[n]==0) flag1=(ans[1]==ans[n-1]);
	else flag1=(ans[1]==(ans[n-1]^1));
	bool flag2=0;
	if(s[1]=='o'&&ans[1]||s[1]=='x'&&ans[1]==0) flag2=(ans[2]==ans[n]);
	else flag2=(ans[2]==(ans[n]^1));
	return (flag1&&flag2);
}
int main()
{
	//freopen("H:\\c++1\\in.txt","r",stdin);
	//freopen("H:\\c++1\\out.txt","w",stdout);
	scanf("%d",&n);
	scanf("%s",s+1);
	ans[1]=ans[2]=0;
	if(cl()){
		for(int i=1;i<=n;i++){
			if(ans[i])printf("S");else printf("W");
		}
		puts("");
		return 0;
	}
	ans[1]=1,ans[2]=0;
	if(cl()){
		for(int i=1;i<=n;i++){
			if(ans[i])printf("S");else printf("W");
		}
		puts("");
		return 0;
	}
	ans[1]=0,ans[2]=1;
	if(cl()){
		for(int i=1;i<=n;i++){
			if(ans[i])printf("S");else printf("W");
		}
		puts("");
		return 0;
	}
	ans[1]=1,ans[2]=1;
	if(cl()){
		for(int i=1;i<=n;i++){
			if(ans[i])printf("S");else printf("W");
		}
		puts("");
		return 0;
	}
	puts("-1");
	return 0;
}

Measured memory_bytes: 768
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];

        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);

        System.out.println(a[1] - a[0] + a[2] - a[1]);
    }
}

Measured memory_bytes: 22100
numList = []

a = -1
num = 0
while a != 0:
    if a == -1:
        a = int(input())

    else:
        numList = numList + [a]
        a = int(input())
        num += 1

for i in range(num):
    print("Case %d: %d" % (i+1, numList[i]))



Measured memory_bytes: 6088
input_line = [str(s) for s in input().split()]
input_line = input_line[::-1]
tmp_number = []
while(len(input_line) != 0):
    tmp = input_line[-1]
    if tmp == "+":
        tmp_number[-2] = tmp_number[-2] + tmp_number[-1]
        tmp_number.pop()
    elif tmp == "-":
        tmp_number[-2] = tmp_number[-2] - tmp_number[-1]
        tmp_number.pop()
    elif tmp == "*":
        tmp_number[-2] = tmp_number[-2] * tmp_number[-1]
        tmp_number.pop()
    else:
        tmp_number.append(int(tmp))
    input_line.pop()
print(tmp_number[0])

Measured memory_bytes: 7760
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
 
int main() {
 
  int long long t=0,i=0,j=0,X,Y,Z;
  int ans;

  cin >> X >> Y >> Z;
  
  cout << Z << " "<< X << " "<< Y << endl;
  return 0;
}

Measured memory_bytes: 256
A=["KIHBR","KIHABR","AKIHBR","KIHBAR","KIHBRA","AKIHABR","AKIHBAR","AKIHBRA","KIHABAR","KIHABRA","KIHBARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA","AKIHABARA"]
s=input()
if s in A:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 61592
#include <stdio.h>

int main(void)
{
	int m[100], f[100], r[100];
	int i;

		for (i = 0; i <= 100; i++)
		{
			scanf("%d %d %d", &m[i], &f[i], &r[i]);

			if ((m[i] == -1) && (f[i] == -1) && (r[i] == -1))break;

			else if (m[i] * f[i] < 0)
			     {
					printf("F\n");
			     }

			else if (m[i] + f[i] >= 80)
			     {
					printf("A\n");
			     }

			else if ((m[i] + f[i] >= 65) && (m[i] + f[i] < 80))
			     {
					printf("B\n");
			     }

			else if ((m[i] + f[i] >= 50) && (m[i] + f[i] < 65))
			     {
					printf("C\n");
			     }

			else if ((m[i] + f[i] >= 30) && (m[i] + f[i] < 50) && (r[i] >= 50))
			     {
				    printf("C\n");
			     }

			else if ((m[i] + f[i] >= 30) && (m[i] + f[i] < 50))
			     {
					printf("D\n");
			     }

			else if (m[i] + f[i] < 30)
			     {
					printf("F\n");
			     }

		}
	return 0;
}


Measured memory_bytes: 2060
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <string>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,P> pip;
typedef long long ll;
const int inf=1<<30;
const double pi=acos(-1);

vi n(3);

int main(){
	while(cin>>n[0]>>n[1]>>n[2]){
		int num=20-n[0]-n[1],tmp=0;
		for(int i=0;i<3;i++){
			if(n[i]<=num) tmp++;
		}
		num-=tmp;
		if(num>=4) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 1184
#include<cstdio>
int main(){
    char s[11],t[5]="YAKI";
    scanf("%s",s);
    for(int i=0;i<4;i++){
        if(s[i]!=t[i]){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
string a,b;
  cin>>a>>b;
  int n=a.length();
  int m=b.length();
  int dp[n+1][m+1];
  for(int i=0;i<=n;i++){
      for(int j=0;j<=m;j++){
        if((i==0)||(j==0)){
            dp[i][j]=0;
        }
      else{
      if(a[i-1]==b[j-1]){
      dp[i][j]=dp[i-1][j-1]+1;
      }
        else{
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
      }
    }
  }
  string ans;
  int i=n,j=m;
  while(i>0&&j>0){
  if(a[i-1]==b[j-1]){
  ans=b[j-1]+ans;
    i--;j--;
  }
    else if(dp[i-1][j]>dp[i][j-1]){
    i--;}
    else{
    j--;}
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll unsigned long long
#define pb push_back 
#define mp make_pair
#define sp ": "
#define cs "Case "
#define fi first
#define sn second 
#define po(x) x*x
/* STL */
#define vi vector<int>v
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxa(a) *max_element(a, a.size())
#define r(a) reverse(a.begin(),a.end())
/* loops */
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n)i=1;i<=(n);i++)
#define fa(i,a,n) for(__typeof(a)i=(a);i<=(b);i++)
/*Special*/
#define Ezio ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define db(something)   cerr<<#something<<" - "<<something<<"\n";         
int main()
{
  
   Ezio
   /*Variables*/
   /*Code*/
   ll n,x;
   vector<ll>v;
   ll ans=1;
   const ll m=1e18;
   int i;
   cin>>n;
   
   fr(i,n){
     cin>>x;
     if(x==0){
       cout<<0;
       return 0;
       }
     v.pb(x);
   }
   
   sort(all(v));
   
   fr(i,n){
     if(ans<=m/v[i])
     ans*=v[i];
     
     else{
       cout<<"-1"<<endl;
       return 0;
       }
   }
     
   cout<<ans<<endl;
   return 0;
}
    

Measured memory_bytes: 4260
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;



int main(){
    int count[4] = {};
    
    for (int i=0;i<6;i++) {
        int a;
        cin >> a;
        count[a-1] += 1;
    }
    
    int flag = 0;
    for (int i=0;i<4;i++) {
        if (count[i]==3) flag = 1;
    }
    
    if (flag == 1) cout << "NO" << endl;
    else cout << "YES" << endl;
    
    
    return 0;
}


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

int main()
{
    int x;
    while(cin >> x)
    {
        int sum = 0,i;
        for(i=1; ;i++)
        {
            sum += i;
            if(sum >= x)
                break;
        }
        cout << i << endl;
    }
    return 0;
}


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

namespace CSharp_AtCoder
{

    
    class Program
    {

        static int Solve(int N, int[,] plan)
        {
            int[,] dp = new int[N + 1, 3];            

            //dp
            for(int i = 1; i <= N; i++)
            {
                for(int j = 0; j < 3; j++)
                {
                    for(int k = 0; k < 3; k++)
                    {
                        if (j == k) continue;
                        dp[i, j] = Math.Max(dp[i, j], dp[i - 1, k] + plan[i - 1, j]);
                    }
                }
            }

            int res = -1;
            for(int j = 0; j < 3; j++)
            {
                if (res < dp[N, j]) res = dp[N, j];
            }

            return res;
        }

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int[,] plan = new int[N, 3];
            for(int i = 0; i < N; i++)
            {
                int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                for(int j = 0; j < 3; j++)
                {
                    plan[i, j] = input[j];
                }
            }

            Console.WriteLine(Solve(N, plan));
        }
    }
}


Measured memory_bytes: 17460
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

using namespace std;

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

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a * b) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>

int main(void) {
	int a, b;

	std::cin >> a >> b;

	std::cout << a + b / 2 << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n, sum=0;
  cin >> n;
  int l[n];
  for(int i=0; i<n; i++)
    cin >> l[i];
  sort(l, l+n);
  for(int i=0; i<n-1; i++)
    sum+=l[i];
  if(sum>l[n-1]) cout << "Yes";
  else cout << "No";
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int Z = sc.nextInt();
    int answer =0;
    //端からどん欲に座らせていく、椅子の残りがY+2Z未満になったら終わり
    while(X>=Y+2*Z){
      answer = answer +1;
      X=X-Z-Y;
    }
    System.out.println(answer);
      
  }
  

  
}

Measured memory_bytes: 21716
#include<stdio.h>
 
int main()
{
  int x1,x2,x3,x4,x5;
 
scanf("%d", &x1);
scanf("%d", &x2);
scanf("%d", &x3);
scanf("%d", &x4);
scanf("%d", &x5);

if(x1==0){
  printf("1");}
if(x2==0){
  printf("2");}
if(x3==0){
  printf("3");}
if(x4==0){
  printf("4");}
if(x5==0){
  printf("5");}
  return 0;
}


Measured memory_bytes: 1624
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;

signed main(){
	int a, b, ans = -INF;
	scanf("%lld%lld", &a, &b);
	chmax(ans, a+b);
	chmax(ans, a-b);
	chmax(ans, a*b);
	printf("%lld\n", ans);
	return 0;
}




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

using namespace std;

int main()
{
    int i,j,k,t,n,x;

    cin >> k >> n;

    int mx=0, arr[n];

    for(i=0; i<n; i++)
    {
        cin >> arr[i];
    }

    sort(arr, arr+n);

    for(i=1; i<n; i++)
        mx = max(mx, arr[i]-arr[i-1]);

    mx = max(k-arr[n-1]+arr[0], mx);

    cout << k-mx << endl;

    return 0;
}



Measured memory_bytes: 1024