akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

const int minus_table[3]={2,1,0};

const int mul_table[3][3]={
	{0,0,0},
	{0,1,1},
	{0,1,2}
};

const int plus_table[3][3]={
	{0,1,2},
	{1,1,2},
	{2,2,2}
};

int get_num(char now,int tansaku) {
	if(now=='P')return tansaku%3;
	if(now=='Q')return (tansaku/3)%3;
	if(now=='R')return (tansaku/9)%3;
	return now-'0';
}

int main_stack_num;
int main_stack[100];

int enzansi_stack_num;
char enzansi_stack[100];
int calc_stack_num;
char calc_stack[100];

int main(void) {
	int i;
	char now_siki[100];
	int tansaku;
	int count;
	while(1) {
		scanf("%s",now_siki);
		if(now_siki[0]=='.' && now_siki[1]==0)break;
		count=0;
		for(tansaku=0;tansaku<27;tansaku++) {
			main_stack_num=enzansi_stack_num=calc_stack_num=0;
			for(i=0;now_siki[i];i++) {
				if(now_siki[i]=='-' || now_siki[i]=='+' ||
						now_siki[i]=='*' || now_siki[i]=='(' ||
						now_siki[i]==')') {
					if(enzansi_stack_num>0) {
						if(now_siki[i]=='(') {
							enzansi_stack[enzansi_stack_num++]=now_siki[i];
						} else if(now_siki[i]==')') {
							while(enzansi_stack_num>0 &&
									enzansi_stack[enzansi_stack_num-1]!='(') {
								calc_stack[calc_stack_num++]=
									enzansi_stack[--enzansi_stack_num];
							}
							if(enzansi_stack_num>0)enzansi_stack_num--;
						} else {
							while(enzansi_stack_num>0 &&
									enzansi_stack[enzansi_stack_num-1]=='-' &&
									now_siki[i]!='-') {
								calc_stack[calc_stack_num++]=
									enzansi_stack[--enzansi_stack_num];
							}
							enzansi_stack[enzansi_stack_num++]=now_siki[i];
						}
					} else {
						enzansi_stack[enzansi_stack_num++]=now_siki[i];
					}
				} else {
					calc_stack[calc_stack_num++]=now_siki[i];
				}
			}
			while(enzansi_stack_num>0) {
				calc_stack[calc_stack_num++]=
					enzansi_stack[--enzansi_stack_num];
			}
			for(i=0;i<calc_stack_num;i++) {
				if(calc_stack[i]=='-') {
					if(main_stack_num<1)return 1;
					main_stack[main_stack_num-1]=minus_table
						[main_stack[main_stack_num-1]];
				} else if(calc_stack[i]=='*') {
					if(main_stack_num<2)return 1;
					main_stack[main_stack_num-2]=mul_table
						[main_stack[main_stack_num-2]][main_stack[main_stack_num-1]];
					main_stack_num--;
				} else if(calc_stack[i]=='+') {
					if(main_stack_num<2)return 1;
					main_stack[main_stack_num-2]=plus_table
						[main_stack[main_stack_num-2]][main_stack[main_stack_num-1]];
					main_stack_num--;
				} else {
					main_stack[main_stack_num++]=get_num(calc_stack[i],tansaku);
				}
			}
			if(main_stack[0]==2)count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define lli long long int
#define fr(i,a,b) for(int i=a;i<b;i++)
#define bfr(i,a,b) for(int i=a;i>=b;i--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
#define tc int t;cin>>t;while(t--)
#define mod 1000000007 
#define all(vec) vec.begin(),vec.end()  
#define ld long double
#define pb push_back

#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 

/*
bool comp(pair<lli,lli> &a,pair<lli,lli> &b)
{
    if()
}*/




int main()
{
                       
         

       
                    
          fio
          

         string s;
         cin>>s;
         if(s[2]==s[3] && s[4]==s[5])cout<<"Yes";
         else cout<<"No";
        
          
          
          

         










          





                     
return 0;}

Measured memory_bytes: 256
//Jay Shree Krishna
#include"bits/stdc++.h"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long int
#define inf 1e18
#define sr string
#define mod 1000000007
#define start int t;cin>>t;while(t--)
#define db(x) cout<<#x<<"="<<x<<"\n"
#define db2(a,b)cout<<#a<<": "<<a<<" , "<<#b<<": "<<b<< endl;
#define db3(a,b,c)cout<<#a<<": "<<a<<" , "<<#b<<": "<<b<<" , "<<#c<<": "<<c<<endl;
#define forr(i,n) for (int i = 0; i < n; i++)
#define fr(i,n) for (int i = 1; i <= n; i++)
#define rep(i,j,k) for(int i = j; i < k; i++)
#define rp(i,j,k) for(int i = j; i <=k; i++)
#define nn "\n"
#define en "\n"
#define vvi vector<vector<int>>
#define vi vector<int>
#define si set<int>
#define mlsi multiset<int>
#define vc vector<char>
#define vs vector<string>
#define vli vector<long long int>
#define vpii vector<pair<int,int>>
#define pii pair<int,int>
#define mii map<int,int>
#define msi map<string,int>
#define mci map<char,int>
#define mpiii map<pair<int,int>,int>
#define um unordered_map
#define umii unordered_map<int,int>
#define umsi unordered_map<string,int>
#define umci unordered_map<char,int>
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sortv(x) sort(x.begin(),x.end())
#define sorta(x,n) sort(x,x+n)
#define sorted(x) is_sorted(x.begin(),x.end())
#define print_all(x) for(auto t:x) cout<<t<<" ";cout<<en;
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define go(x) for(auto &[u,v]:x)
#define in(x) cin>>x
#define inn(x,y) cin>>x>>y
#define innn(x,y,z) cin>>x>>y>>z
#define innnn(x,y,z,v) cin>>x>>y>>z>>v
#define oo(x) cout<<x<<endl
#define oo2(x,y) cout<<x<<" "<<y<<endl
#define o3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define ood(n,x) cout<<fixed<<setprecision(n)<<x<<"\n"
#define sz(x) x.size()
#define ff first
#define ss second
#define ooy cout<<"YES\n"
#define oon cout<<"NO\n" 
#define rr return
#define cc continue

using namespace std;

template<class T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
void read(vli &a,int n){
    a.resize(n);
    forr(i,n) cin>>a[i];
}


bool fine=0;
vli a;
ll n,m;
void solve(){
    ll a,b,c,d;
    innn(a,b,c);
    in(d);
    ll ans=b*d;
    ckmax(ans,b*c);
    ckmax(ans,a*c);
    ckmax(ans,a*d);
    oo(ans);
}

int main(){
    #ifndef ONLINE_JUDGE 
    freopen("input1.txt", "r", stdin); 
    freopen("error.txt", "w", stderr); 
    freopen("output1.txt", "w", stdout); 
    #endif
    fast; 
   if(fine){
        start{
            solve();
        }
   }
   else solve();
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define ll long long
#define int long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;




int32_t main()
{
    int h,w;
    cin>>h>>w;
    //int ct=0;
    if(min(h,w)==1){
        cout<<1<<endl;
    }
    else if((h*w)%2==0)
    cout<<(h*w)/2<<endl;
    else
        cout<<(h*w)/2+1<<endl;

 return 0;
}



Measured memory_bytes: 256
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())
N = int(input())
B = [int(input()) for _ in range(N)]

tate = [[a11, a21, a31], [a12, a22, a32], [a13, a23, a33]]
yoko = [[a11, a12, a13], [a21, a22, a23], [a31, a32, a33]]
naname = [[a11, a22, a33], [a13, a22, a31]]

for tripe in tate + yoko + naname:
    a, b, c = tripe
    if a in B and b in B and c in B:
        print("Yes")
        break
else:
    print("No")


Measured memory_bytes: 38384
X = list(input())
A = [0]*(len(X)-2)
B = [0]*(len(X)-2)
for i in range(len(X)-2):
  A[i] = int("".join(X[i:i+3]))
for i in range(len(X)-2):
  B[i] = abs(A[i]-753)
print(min(B))


Measured memory_bytes: 38256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;

int main(void){
 int N;
 int ans=0;
 cin>>N;
 while(N>0){
  if(N%10==2)ans++;
  N/=10;
 }
 cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;



int n;
int a[100100];
int md[100100];
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i < n; ++i)
    {
        if (a[i] < a[i-1])
        {
            int j = i;
            while (j && a[j] < a[j-1] && md[j-1] < 2)
                --a[j-1],
                ++md[j-1],
                j--;
        }
    }
    bool bla = 1;
    for (int i = 0; i < n-1; ++i)
        if (a[i] > a[i+1] || md[i] > 1) bla = 0;
    if (bla)
        puts("Yes");
    else puts("No");

    return 0;
}


Measured memory_bytes: 1024
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N,M;
    R(N,M);
    if(N%2){
        int ll=N/2,rr=N/2+1;
        FOR(i,1,M){
            W(ll,rr);
            ll--;
            rr++;
        }
    }
    else{
        int ll=N/2,rr=N/2+1;
        bool done=0;
        FOR(i,1,M){
            if(rr-ll>=N/2&&!done)rr++,done=1;
            W(ll,rr);
            ll--;
            rr++;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
def solve():
    x = raw_input()
    y = raw_input()
 
    a, b = len(x), len(y)
    x1 = [0 for k in range(b+1)]
    for i in xrange(a):
        e1 = x[i]
        x2 = x1+[]
        for j in xrange(b):
            if e1 == y[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1] < x1[j]:
                x1[j+1] = x1[j]
    return x1[-1]
 
n = input()
for i2 in range(n):
    print solve()

Measured memory_bytes: 6416
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;


struct edge {ll from, to, cost; };

edge es[9000];
ll d[5000];
ll N,V,E,P;
bool negative[MAX],reach[MAX];

bool bellmanford(ll s){
    rep(i,V) d[i]=LLINF;
    d[s]=0;
    rep(cnt,100010){
        bool update = false;
        rep(i,E){
            edge e=es[i];
            if(d[e.from] != LLINF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if(cnt==V) return true; 
        if(!update) break;
    }
    return false;
}

void detection(){
    rep(i,V){
        reach[i]=false;
        negative[i]=false;
    }
    rep(i,V){
        if(d[i]!=LLINF) reach[i]=true;
    }
    rep(loop,V){
        rep(i,E){
            edge e=es[i];
            if(d[e.from]!=-LLINF && d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                if(reach[e.to]) negative[e.to]=true;
            }
            if(negative[e.from]==true){
                negative[e.to]=true;
            }
        }
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    cin>>V>>E>>P;
    rep(i,E){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        c-=P;c*=-1;
        es[i]={a,b,c};
    }
    bellmanford(0);
    detection();
    if(negative[V-1]){
        cout<<-1<<endl;
    }
    else{
        if(-d[V-1]<0) cout<<0<<endl;
        else cout<<-d[V-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <cstdlib>

using namespace std;

int func(int y, int m, int d);

int main()
{
	int w;
	w = func(1000,1, 1);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int y, m, d, x, z;
		cin >> y >> m >> d;
		x = func(y, m, d);
		z = w - x;
		cout << z << endl;
	}
}

int func(int y, int m, int d)
{
	int a, b, c;
	a = y - 1;
	a = ((2 * (a / 3) ) + a % 3)  * (20 * 5 + 19 * 5) +(a / 3) * (20 * 10);
	b = m - 1;
	if(y % 3 == 0) b = b * 20;
	else b = (b / 2 + b % 2) * 20 + (b / 2) * 19;
	c = a + b + d;
	return c; 
} 

Measured memory_bytes: 1160
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n=I()
data=MXI()
s=sorted(data, key=lambda x: x[1])
sm=0
for i in range(n):
    sm+=s[i][0]
    if sm<=s[i][1]:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")

Measured memory_bytes: 55616
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
int hai[33]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51,0};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll a = 0,b = 0,c = 0,d = 0,e = 0,n = 0,ans = 0;
  string s,ss,sss;
  cin>>n;
  cout<<hai[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {

        while (true)
        {
            String[] aryStr = Console.ReadLine().Split(' ');

            int num1 = int.Parse(aryStr[0]);
            int num2 = int.Parse(aryStr[1]);

            if (num1 == 0 && num2 == 0)
            {
                break;
            }

            if (num1 > num2)
            {
                Console.WriteLine("{0} {1}", num2, num1);
            }
            else if ( num1 < num2 )
            {
                Console.WriteLine("{0} {1}", num1, num2);
            }
            else
            {
                Console.WriteLine("{0} {1}", num1, num2);
            }
            
        }

    }
}

Measured memory_bytes: 9412
#include<stdio.h>
#define N 10000

int linearSearch();
int S[N],n,key;

int main(){
  int i,q,c=0,T[N];

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

  scanf("%d",&q);
  for(i=0 ; i<q ; i++){
    scanf("%d",&T[i]);
  }

  for(i=0 ; i<q ; i++){
    key=T[i];
    if(linearSearch())c++;
  }

  printf("%d\n",c);
  return 0;
}
int linearSearch(){
  int i=0;
  
  S[n]=key; //??????

  while(S[i] != key)i++;

  if(i==n) return 0; //?????´???????????´???

  return 1;//?????´????????´???

}

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

int main() {
  int N;
  double a, ans=0;
  cin >> N;
  string str;
  vector<double> item(N);

  cout << fixed;
  
  for (int i = 0; i < N; i++) {
    cin >> a >> str;
    //cout << a << endl;
    if (str == "JPY") {
      //cout << str << endl;
      item.at(i) = a;
    } else item.at(i) = a * 380000;
  }
  
  sort(item.begin(), item.end());
  for (int j = 0; j < N; j++) {
    ans = ans + item.at(j);
    //cout << ans << endl;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define what(x) cout<<#x<<" is "<<x<<endl;
using namespace std;


template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

ll powmod(ll a,ll b,ll mod) {
    ll res=1;a%=mod;
    //assert(b>=0);
    for(;b;b>>=1){
        if(b&1)res=res*a%mod;a=a*a%mod;
    }
    return res;
}

void solve(){
	ll n;
	cin>>n;
	cout<<(1000-((n%1000==0)?1000:n%1000))<<endl;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tc=1;
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	#endif
	// cin>>tc;
    while(tc--)solve();
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<cmath>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    
    if((A + B) % 2 == 0){
        cout << (A + B)/2 << endl;
    }
    else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 256
W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]

W_ = [0, W] 
H_ = [0, H]

for l in lst:
    if l[2] == 1 and W_[0] < l[0]:
        W_[0] = l[0]
    elif l[2] == 2 and l[0] < W_[1]:
        W_[1] = l[0]
    elif l[2] == 3 and H_[0] < l[1]:
        H_[0] = l[1]
    elif l[2] == 4 and l[1] < H_[1]:
        H_[1] = l[1]
        
width = W_[1] - W_[0] if W_[1] - W_[0] > 0 else 0
height = H_[1] - H_[0] if H_[1] - H_[0] > 0 else 0

print(width * height)

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

#define int long long

signed main(){
	int n,m,x;
	scanf("%lld %lld %lld", &n, &m, &x);
	int c[15],a[15][15];
	for (int i=0; i<n; i++){
		scanf("%lld",&c[i]);
		for (int j=0; j<m; j++)
			scanf("%lld",&a[i][j]);
	}
	int mn=2e18;
	for (int mask=0; mask<(1<<n); mask++){
		int sum=0,ma=mask;
		int ul[15]={0};
		for (int j=0; j<n; j++){
			if (ma&1){
				sum+=c[j];
				for (int k=0; k<m; k++)
					ul[k]+=a[j][k];
			}
			ma=ma>>1;
		}
		bool ulie=1;
		for (int i=0; i<m; i++) if (ul[i]<x){
			ulie=0;
			break;
		}
		if (ulie) mn=min(sum,mn);
	}
	if (mn!=2e18) printf("%lld\n",mn);
	else printf("-1\n");
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++) cin >> vec.at(i);
  sort(vec.begin(), vec.end());

  cout << vec.at(N - 1) - vec.at(0) << endl;
}


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

ll N, M;
vector<ll> divisor;
ll m = 1; //最大公約数

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

  /*最大公約数mとしてm*(b1+b2+...+bN) = Mより、Mはmの倍数*/
  /*よってMの約数に答えがある*/

  for(int i = 1; i*i <= M; i++){ if(M % i == 0){ divisor.push_back(i);divisor.push_back(M/i); }}
  sort(divisor.begin(), divisor.end());  /*こうしなくてもO(√M)で行けると思うが面倒なので

  /*条件として、b1～bNが1以上、よってM/mがN以上あること*/
  int n = divisor.size()-1;
  while(n>0 && M/divisor[n] < N) n--;
  m = divisor[n];

  cout << m << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int a[222222], b[222222];
int main() {
	int n, q;
	cin >> n;
	rep(i, n)cin >> a[i];
	cin >> q;
	while (q--) {
		int k;
		cin >> k;
		cout << lower_bound(a, a + n, k) - a << endl;
	}
	return 0;
}


Measured memory_bytes: 3468
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M,K=MI()
    A=LI()
    B=LI()
    AS=[0]*(N+1)
    BS=[0]*(M+1)
    
    for i in range(N):
        AS[i+1]=AS[i]+A[i]
        
    for i in range(M):
        BS[i+1]=BS[i]+B[i]

    import bisect
    
    ans=0
    for i in range(N+1):
        at=AS[i]
        bt=K-at
        if bt<0:
            break
        j=bisect.bisect_right(BS,bt)-1
        temp=i+j
        ans=max(ans,temp)
        
    print(ans)
        

            

main()


Measured memory_bytes: 108776
#include <bits/stdc++.h>
using namespace std;
int dp[110][5][2];

int main(){
	ios::sync_with_stdio(0);
	cout << setprecision(10) << fixed;
	string s;
	int k;
	cin >> s >> k;
	int n = s.size();
	dp[0][0][0] = 1;
	for (int i = 0; i < n; ++i){
		int sd = s[i] - '0';
		for (int j = 0; j <= k; ++j){
			for (int less = 0; less < 2; ++less){
				for (int d = 0; d <= (less ? 9 : sd); ++d){
					dp[i + 1][j + (d != 0)][less || (d < sd)] += dp[i][j][less];
				}
			}
		}
	}
	cout << dp[n][k][0] + dp[n][k][1];
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,k,ans;
    cin>>n>>k;
    ans=n/k;
    if(n%k!=0)
        ans+=1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <string>
#include <vector>

using namespace std;
int main() {
    int N, M, K, ans = 0, arr[30] = {};
    cin >> N >> M;
    for(int i = 0; i < N; i++) {
        cin >> K;
        for(int j = 0; j < K; j++) {
            int a;
            cin >> a;
            arr[a-1]++;
        }

        for(int j = 0; j < M; j++){
            if (arr[j] == N) {
                ans++;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

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

int a[105];

int main(){
	int n, sum;
	cin >> n >> sum;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	int cnt = 0;
	for (int i = 1; i <= n; i++){
		if (sum >= a[i]){
			cnt++;
			sum -= a[i];
		}
		else break;
	}
	if (cnt == n && sum > 0) cnt--;
	cout << cnt << '\n';
	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 rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }

int main() {
    vector<int> v(4, 0);
    rep(i, 3) {
        int a, b; cin >> a >> b;
        v[a-1]++;
        v[b-1]++;
    }
    sort(all(v));
    if (v[0] == 1 && v[1] == 1 && v[2] == 2 && v[3] == 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <unordered_set>
#include <unordered_map>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
#define debug( fmt, ... ) \
        fprintf( stderr, \
                  fmt "\n", \
                  ##__VA_ARGS__ \
        )

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 30;
const double EPS = 1e-10;

double zero(double d) {
    return d < EPS ? 0.0 : d;
}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    os << '[';
    rep(i, a.size()) os << (i ? " " : "") << a[i];
    return os << ']';
}

string toString(int i) {
    stringstream ss;
    ss << i;
    return ss.str();
}

const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
    ll res = 1ll;
    ll x = a;
    while (k != 0) {
        if ((k & 1) == 1)
            res = (res * x) % M;
        x = (x * x) % M;
        k >>= 1;
    }
    return res;
}

struct prepare {
	prepare() {
	    cout.setf(ios::fixed, ios::floatfield);
	    cout.precision(8);
	    ios_base::sync_with_stdio(false);
	}
} _prepare;

int main() {
	string s;
    cin >> s;

    int g = 0, p = 0;
    tr(it, s) {
        if(*it == 'g')
            g++;
        else
            p++;
    }

    cout << s.size() / 2 - p << endl;

    return 0;
}


Measured memory_bytes: 640
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
#from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import combinations
def run():
    N, *S = read().split()
    dic = defaultdict(lambda:0)
    for s in S:
        dic[s] += 1
    dic = sorted(dic.items(), key = lambda x:x[1], reverse=True)
    num = dic[0][1]
    ret = []
    for s, n in dic:
        if n != num:break
        ret.append(s)
    print('\n'.join(sorted(ret)))


if __name__ == "__main__":
    run()

Measured memory_bytes: 45300
#include<stdio.h>
    int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b)printf("a < b\n");
    else if(a>b)printf("a > b\n");
    else if(a==b)printf("a == b\n");
 return 0;
 }

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

int main() {
    int N, K;
    cin >> N >> K;
    int d[K];
    int sun;

    set<int> S; /* 定義 */
    

    for (int i = 0; i < K; i++) {
        cin >> d[i];
        for (int j = 0; j < d[i]; j++) {
            cin >> sun;
            S.insert(sun);
        }
    }
    cout << N-S.size() << endl;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
INF = 1001001001

N = int(input())
X = list(map(int, (input().split())))

ans = INF
for i in range(1, 101):
    tmp = 0
    for j in range(N):
        tmp += (X[j] - i) * (X[j] - i)
    ans = min(ans, tmp)

print(ans)


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;


typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int

const int hell=1000000007;


int pw(int a,int b)
{
  int x=a;
  rep(i,1,b){a=a*x;
    a%=10000000000LL;}
  return a;
}



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

bool cmp(pii a,pii b)
{
  return a.SS<b.SS;
}

int solve()
{  
 
 string a;
 cin>>a;
 rep(i,0,a.size()-1)
 {
  if(a[i]==a[i+1])
  {
    cout<<"Bad";
    return 0;
  }
 }
 cout<<"Good";

    return 0;
}


signed main()
{  int t=1;
//pri();
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   cin.exceptions(cin.failbit);                                                                    




  clock_t time_req;

    // Without ung pow function
                                                                                                                   

  //cin>>t;

    int k=1;
   while(t--)
     {
      // cout<<"Case #"<<k<<":"<<" ";k++;
      solve();
     

     }

         time_req = clock() - time_req;
    //cout <<endl<< "Processor time taken is "
     // << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;


    return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#define ll long long
#define rg register
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=2e5+5;
int n;
char s[maxn];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc == '-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

int main(){
	scanf("%s",s+1); n=strlen(s+1);
	ll ans=0,ss=0;
	for(rg int i=1;i<n;){
		if(s[i] == 'A') ss++,i++;
		else if(s[i] == 'B' && s[i+1] == 'C') ans+=ss,i+=2;
		else ss=0,i++;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 384
"""
comb(n,r)
a1, a2, ..., an から2つの数をcomb(ai,aj)が最大になるように選ぶ


2 4 6 9 11
"""

n = int(input())
As  = list(map(int, input().split()))
A_sort = sorted(As)
A_max = max(As)

ans = 100000000000
for a in A_sort[:-1]:
    d1 = abs(A_max / 2 - ans)
    d2 = abs(A_max / 2 - a)
    if d1 >= d2:
        ans = a
print(A_max,ans)


Measured memory_bytes: 14428
H,W,N = map(int, input().split())

grid = {}
for _ in range(N):
    a,b = map(int, input().split())

    for i in range(3):
        for j in range(3):
            if 0 < a-i <= H-2 and 0 < b-j <= W-2:
                if a-i not in grid:
                    grid[a-i] = {}
                if b-j not in grid[a-i]:
                    grid[a-i][b-j] = 0
                grid[a-i][b-j] += 1
ans = [0 for i in range(10)]
for a,bb in grid.items():
    for cnt in bb.values():
        ans[cnt] += 1
    
print((H-2)*(W-2) - sum(ans))
for i in range(1,10):
    print(ans[i])


Measured memory_bytes: 142748
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[5];
	scanf("%s",s),s[3]='S';
	int cur=0,ans=0;
	for(int i=0;i<=3;i++)
	{
		if(s[i]=='R') cur++;
		else ans=max(ans,cur),cur=0;
	}
	printf("%d",ans);
}

Measured memory_bytes: 3812
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // ceil()

int
main(int argc, char** argv)
{
	double v;

	while (scanf("%lf", &v) != EOF)
	{
		double t = v / 9.8;
		double y = 4.9 * t * t;
		int n = ceil((y + 5) / 5);
		printf("%d\n", n);
	}

	return 0;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
using namespace std;
int main()
{
      string s;
        cin>>s;
    vector<string>vect;

       for(int i=0;i<s.length();)
       {
            if(i==0)
            {
                string r=s.substr(i,1);
                 vect.push_back(r);
            
                    i++;
              }

            else
            {
                string str=vect[vect.size()-1];
                   string p=s.substr(i,1);
                     if(str.length()==1)
                     {
                          if(p!=str)
                          {
                             vect.push_back(p);
                               i++;
                          }

                          else
                          {

                                if(i+1 < s.length())
                              {
                                p=s.substr(i,2);
                               vect.push_back(p);
                                i=i+2;
                              }
                                else
                                break;
                          }

                     }
                     else
                    {
                        vect.push_back(p);

                           i++;
                      }
            }
       }
          int sie=vect.size();
            cout<<sie;
}


Measured memory_bytes: 10996
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define ll long long
const int N=1e5+7;

vector<int> g[N];
bool vis[N];
int d[N],dgr[N]; //in-degree

void dfs(int u){
	vis[u]=1;
	for(int v: g[u]){
		if(vis[v]) continue;
		d[v]=max(d[v],d[u]+1);
		dgr[v]--;
		if(!dgr[v]) dfs(v);
	}
}


int main(){
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\User\\Documents\\input.txt","r",stdin);
#endif
	int T,i,j;
	int n,m;

	cin>>n>>m;
	int u,v;
	for(i=0;i<m;++i){
	    scanf("%d %d",&u,&v);
	    g[u].PB(v);
	    dgr[v]++;
	}
	for(i=1;i<=n;i++){
		if(!vis[i] && !dgr[i]){
			dfs(i);
		}
	}
	int res=0;
	for(i=1;i<=n;++i){
	    res=max(res,d[i]);
	}
	printf("%d\n",res);

		
	return 0;
}

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

int main() {
  long long N;
  long long a[50];

  cin >> N;
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
  }

  long long ans = 0;
  while (1) {
    long long sum = 0;
    long long n[50];
    for (long long i = 0; i < N; i++) {
      n[i] = a[i] / N;
      sum += n[i];
      a[i] = a[i] % N;
    }
    for (long long i = 0; i < N; i++) {
      a[i] += sum - n[i];
    }
    ans += sum;
    if (sum == 0ll) {
      break;
    }
  }

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


Measured memory_bytes: 256
package main

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

func main() {
	fmt.Println(resolve(parseProblem(os.Stdin)))
}

func parseProblem(r io.Reader) (n, p int) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	n, p = scanInt(sc), scanInt(sc)
	return n, p
}

func resolve(n, p int) int {
	t := primeFactories(p)
	max := 1
	for k, ex := range t {
		max *= pow(k, ex/n)
	}
	return max
}

func pow(n, i int) (res int) {
	res = 1
	for i > 0 {
		if i&1 == 1 {
			res *= n
		}
		i >>= 1
		n *= n
	}
	return res
}

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

func primeFactories(n int) (terms map[int]int) {
	terms = map[int]int{}
	num := n
	for f := 2; f*f < n; f++ {
		if num%f != 0 {
			continue
		}
		ex := 0
		for num%f == 0 {
			num /= f
			ex++
		}
		terms[f] = ex
	}
	if num > 1 {
		terms[num] = 1
	}
	return
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
    while(1){
	int n,m;
	cin>>n>>m;
	if(n==0)break;
	vector<vector<int> > b(n,vector<int>(m,0));
	bitset<512> bits[512];
	for(int i=0;i<n;i++){
	    string s;
	    cin>>s;
	    for(int j=0;j<m;j++){
		b[i][j] = s[j]-'0';
		bits[i][j] = b[i][j];
	    }
	}
	if(n <= m ){
	    ll res = 0;
	    for(int i=0;i<(1<<n);i++){
	    	bitset<512> bit;
		ll cnt = 0;
		for(int j=0;j<n;j++){
		    if( (i>>j) & 1 ){
			cnt++;
			bit ^= bits[j];
		    }
		}
		if( bit.count() == 0 ){
		    res = max(res,cnt);
		}
	    }
	    cout<<res<<endl;
	}else{
	    vector<vector<ll> > dp( 2,vector<ll> ( 1<<m , -1 ) );
	    dp[0][0] = 0;
	    vector<ll> num(n,0);
	    //cout<< ( 1<<m ) <<endl;
	    for(int i=0;i<n;i++)for(int j=0;j<m;j++) num[i] |= b[i][j]<<j;
	    for(int i=0;i<n;i++){
		for(int j=0;j< (1<<m) ; j++){
		    if( dp[ i%2 ][j] < 0 ) continue;
		    dp[ (i+1)%2 ][j] = max( dp[ (i+1)%2 ] [j] , dp[i%2][j] );
		    //cout<<(j^num[i])<<endl;
		    dp[ (i+1)%2 ][ j^num[i] ] = max( dp[ (i+1)%2 ][j^num[i] ] ,dp[i%2][j] + 1);
		    dp[i%2][j] = -1;
		}
	    }
	    cout<<dp[n%2][0]<<endl;
	}
    }
    return 0;
}



Measured memory_bytes: 52136
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a=0,b=0,c=0,d,n=1,x=0,y;
    VI m(5);
    string s,s1,s2;
    cin >> x >> y;
    if(x==y){
        cout << -1 << endl;
        return 0;
    }
    else if(x%y!=0){
        cout << x << endl;
        return 0;
    }      
    cout << -1 << endl;
    return 0;
} 

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

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000

using namespace std;
typedef long long ll;

int main() {
    int K, S;
    cin >> K >> S;
    ll count = 0;
    REP(i, K+1){
        REP(j, K+1){
            if (0 <= S - (i+j) && S - (i+j) <= K){
                count++;
            }
        }
    }
    cout << count;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){

    int N;cin>>N;
    LL a[N];REP(i,N)cin>>a[i];

    LL ans=999999999999999999LL;

    for(int i=-100;i<=100;i++){
        LL res=0;
        REP(j,N)res+=(a[j]-i)*(a[j]-i);
        ans=min(ans,res);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 int main() {
int X,A,B;
   cin >> X>>A>>B;
   if(A>=B) cout <<"delicious" <<endl;
   else{
   if(X+A>=B)cout <<"safe"<<endl;
   else cout <<"dangerous" <<endl;
     
   }
   
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int m = sc.NextInt();

        int answer = (n - 1) * (m - 1);

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

char tu(char c) {
	return toupper(c);
}

int main() {

	string word, text;
	int count = 0;

	cin >> word;
	transform(word.begin(), word.end(), word.begin(), tu);

	while (cin >> text, text.compare("END_OF_TEXT")) {

		if (word.length() != text.length()) {
			continue;
		} else {
			transform(text.begin(), text.end(), text.begin(), tu);
			if (word.compare(text) == 0)
				count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1192
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = int.Parse(Console.ReadLine());



            int[,] houseA = new int[3, 10];
            Initilize(houseA);
            int[,] houseB = new int[3, 10];
            Initilize(houseB);
            int[,] houseC = new int[3, 10];
            Initilize(houseC);
            int[,] houseD = new int[3, 10];
            Initilize(houseD);

            for (int i = 0; i < count; i++)
            {
                string[] Residents = Console.ReadLine().Split();

                switch (int.Parse(Residents[0]))
                {
                    case 1:
                        houseA[int.Parse(Residents[1]) - 1, int.Parse(Residents[2]) - 1] += int.Parse(Residents[3]);
                        break;

                    case 2:
                        houseB[int.Parse(Residents[1]) - 1, int.Parse(Residents[2]) - 1] += int.Parse(Residents[3]);
                        break;

                    case 3:
                        houseC[int.Parse(Residents[1]) - 1, int.Parse(Residents[2]) - 1] += int.Parse(Residents[3]);
                        break;

                    case 4:
                        houseD[int.Parse(Residents[1]) - 1, int.Parse(Residents[2]) - 1] += int.Parse(Residents[3]);
                        break;
                }
            }
            OutputLine(houseA);
            SplitLine();
            OutputLine(houseB);
            SplitLine();
            OutputLine(houseC);
            SplitLine();
            OutputLine(houseD);

        }
        static void Initilize(int[,] house)
        {
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    house[i, j] = 0;
                }

            }
        }
        static void OutputLine(int[,] house)
        {
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    Console.Write(" " + house[i, j]);
                }
                Console.WriteLine();
            }
        }
        static void SplitLine()
        {
            for (int i = 0; i < 20; i++)
            {
                Console.Write("#");
            }
            Console.WriteLine();
        }
    }
}



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

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

  ll ans = 0;
  for (int i = 1; i <= N; i++) {
    ll k = N / i;
    ans += i * (k * (k + 1) / 2);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612