akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0

for i in range(N):    
    for j in range(N):
        ok = True
        for k in range(N):
            if A[i][j] > A[i][k] + A[k][j]:
                print(-1)
                exit()
            if i != k and j != k:
                if A[i][j] == A[i][k] + A[k][j]:
                    ok = False
        if ok:
            ans += A[i][j]

print(ans//2)


Measured memory_bytes: 43868
#include <cstdio>
#include <iostream>

int main()
{
    int A, B;
    scanf("%d", &A);
    scanf("%d", &B);
    int ans = 0;
    ans = A + (B > 0 ? B : -B);
    if (ans < A * B) {
        ans = A * B;
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
import sys
from itertools import accumulate
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    S = list(accumulate(A))
    minimum = 10**18
    for i, c in enumerate(S):
        if i == N - 1: continue
        minimum = min(minimum, abs(2 * c - S[-1]))
    print(minimum)

if __name__ == "__main__":
    main()


Measured memory_bytes: 100948
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	//min(a,b)...a,bの小さいほう
	//max(a,b)...     大きいほう
	int a;
	int b;
	int c;
	int d;
	int e;
	std::cin >> a >> b;
	if (a > 8) {
		cout << ":(" << "\n";
	}
	else if(b > 8) {
		cout << ":(" << "\n";
	}
	else {
		cout << "Yay!" << "\n";
	}
	
	std::cin >> e;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int c=1;
	for(int i=1;i<=a;i++){
		if(c*2<c+b){
			c=c*2;
		}
		else{
			c=c+b;
		}
	}
	cout<<c<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<vector>
using namespace std;
#define ll long long int


int main()
{
	ll X,upper = 119;
	cin>>X;
	for(ll a = 0; a <=upper ; a++)
	{
		for(ll b = 0; b <=a ; b++)
		{
			{
				if(((pow(a,5))-(pow(b,5)))==X)
				{
					cout<<a<<" "<<b<<endl;
					return 0;
				}
				if(pow(a,5)+pow(b,5) == X)
				{
					cout<<a<<' '<<(-1*b)<<endl;
					return 0;
				}
			}
		}
		
	}
}

Measured memory_bytes: 3972
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
  scanf("%d %d %d", a1, a2, a3);
  return 0;
}


struct prod {
    int a;
    int b;
    int cost;
};

#define NUM_MAX 40
// 99*40
#define INF 0x01010101
#define A_MAX 10
#define B_MAX 10
#define SA_MAX (A_MAX*NUM_MAX)
#define SB_MAX (B_MAX*NUM_MAX)

int main(void) {
    int num = get_int();
    int ma, mb;
    static struct prod prods[NUM_MAX];
    get_int2(&ma, &mb);

    int i;
    for(i = 0; i < num; i++) {
        int a, b, cost;
        get_int3(&a, &b, &cost);
        prods[i] = (struct prod){a, b, cost};
    }

    static int dp[NUM_MAX+1][SA_MAX+1][SB_MAX+1];
    memset(dp, 0x01, sizeof(int)*(NUM_MAX+1)*(SA_MAX+1)*(SB_MAX+1));
    dp[0][0][0] = 0;
    int a, b;
    for(i = 1; i <= num; i++) {
        struct prod prod = prods[i-1];
        for(a = 0; a <= SA_MAX; a++) {
            for(b = 0; b <= SB_MAX; b++) {
                // stay
                dp[i][a][b] = min(dp[i][a][b], dp[i-1][a][b]);
                if(a >= prod.a && b >= prod.b) {
                    // choose
                    dp[i][a][b] = min(dp[i][a][b], dp[i-1][a-prod.a][b-prod.b]+prod.cost);
                }
            }
        }
    }
    int ans = INF;
    for(i = 1; i <= SA_MAX; i++) {
        int a = i*ma;
        int b = i*mb;
        if(a > SA_MAX || b > SB_MAX) break;
        ans = min(ans, dp[num][a][b]);
    }
    printf("%d\n", ans == INF ? -1 : ans);
    return 0;
}

Measured memory_bytes: 25856
/*
[aising2019] A - Bulletin Board
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int N, H, W;

ll solve() { return (N - H + 1) * (N - W + 1); }

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

    cout << solve() << endl;

    return 0;
}


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

int main() {
  string L[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  string s;
  cin >> s;
  rep(i, 7) {
    if (s == L[i]) {
      cout << (7-i) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}

void solve(){
  ll h,w; cin>>h>>w;
  auto A=make_v(h,w,0);
  auto B=make_v(h,w,0);
  rep(i,h)rep(j,w) cin>>A[i][j];
  rep(i,h)rep(j,w) cin>>B[i][j];
  ll M=20000;
  vector<vector<vector<bool>>> dp=make_v(h,w,M,false);
  ll x=abs(A[h-1][w-1]-B[h-1][w-1]);
  dp[h-1][w-1][x]=true;
  rep(i,h-1,-1,-1)rep(j,w-1,-1,-1){
    ll x=abs(A[i][j]-B[i][j]);
    if(i+1<h){
      rep(k,M){
        if(dp[i+1][j][k]){
          dp[i][j][k+x]=true;
          dp[i][j][abs(k-x)]=true;
        }
      }
    }
    if(j+1<w){
      rep(k,M){
        if(dp[i][j+1][k]){
          dp[i][j][k+x]=true;
          dp[i][j][abs(k-x)]=true;
        }
      }
    }
  }
  rep(k,M){
    if(dp[0][0][k]){
      cout<<k<<"\n";
      return;
    }
  }
}

Measured memory_bytes: 18560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
template<class T> inline bool chmin(T& a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
int main(){
    ll n,m;cin>>n>>m;
    vl g[100010];
    vl h(100010);
    queue<ll> q;
    vl dp(100010);
    rep(i,m){
        ll x,y;cin>>x>>y;
        g[x].pb(y);
        h[y]++;
    }
    rrep(i,n){
        if(h[i]==0)q.push(i);
    }
    while(q.size()){
        ll now=q.front();q.pop();
        for(auto next:g[now]){
            h[next]--;
            if(h[next]==0){
                chmax(dp[next],dp[now]+1);
                q.push(next);
            }
        }
    }
    ll ans=0;
    rrep(i,n)chmax(ans,dp[i]);
    //cout<<dp[1]<<" "<<dp[2]<<" "<<dp[3]<<" "<<dp[4]<<endl;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7296
#include <iostream>
using namespace std;
void ABC90(void);
void ABC91(void);
void ABC92(void);
void ABC93(void);
void ABC94(void);
void ABC95(void);
void ABC96(void);
void ABC97(void);
void ABC98(void);
void ABC99(void);

int main(void){
    ABC97();
}

void ABC97(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if((abs(a-b)<=d&&abs(b-c)<=d)||abs(a-c)<=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
#define inf (ll)1e9

#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x, i, j) cerr << #x << "------------" << "\n";cerr << "from " << i << " to " << j << "\n";for(ll k=i; k<=j; k++) cerr << x[k] << " ";cerr << "\n"; cerr.flush();

#define MAXN 10010

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

	double n, k;
	cin >> n >> k;
	double prob = 0;
	for(int i=1; i<=n; i++){
		if(i >= k){
			prob+= ((double)1)/((double)n);
			// debugone(prob);
		}
		else{
			double x = i;
			double temp = 1;
			while(x < k){
				temp*= 0.5;
				// debugone(temp);
				x*= 2;
			}
			prob += temp* (((double)1)/((double)n));
			// debugone(prob);
		}
	}
	cout.precision(10);

	cout << fixed << prob << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

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

  std::vector<int> v(3);
  v[0] = a+b;
  v[1] = a-b;
  v[2] = a*b;
  sort(ALL(v));

  cout << v[2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<tuple>
#include<stdio.h>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Q;
ll longinf=1ll<<60;
int inf=1<<29;
int dh[]={1,-1,0,0};
int dw[]={0,0,1,-1};
//mleしなければぜんぶllでかく。
int main(){
      cin.tie(0);
      ios::sync_with_stdio(false);
      ll n,a,b;
      cin>>n>>a>>b;
      cout<<min(a,b)<<" "<<max(0ll,a+b-n)<<endl;

      return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

vi f(int n,int n0,int nd,int p){
	vi a(n);
	a[0]=n0;
	for(int i=1;i<n;i++) a[i]=(a[i-1]*58+nd)%(p+1);
	sort(a.begin(),a.end());
	return a;
}

int n,m,n0,nd,m0,md;
vl date,nx;

ll Query(int k,int x){
	ll K=nx[k],res;
	if(k){
		res=date[k]-x;
		date[k-1]+=res;
		date[k]+=(K==n?0:date[K])-res;
	}
	else res=date[K];
	date[0]=0;
	nx[k]=(K==n?n:nx[K]);
	return res;
}

int main(){
	cin>>n>>m>>n0>>nd>>m0>>md;
	vi a=f(n,n0,nd,m),b=f(m,m0,md,n);
	date=nx=vl(n+1);
	ll I=n+1,tmp=0,res=0;
	for(int i=0;i<m;i++) if(b[i]) date[b[i]]++;
	for(int i=0;i<=n;i++) nx[i]=i+1;
	for(int i=0;i<n;i++) if(a[i]){
		while(I&&tmp<a[i]){
			I--;
			tmp+=date[I];
		}
		if(I){
			res+=a[i];
			tmp-=Query(I,tmp-a[i]);
		}
		else{
			res+=tmp;
			tmp-=Query(I,0);
		}
	}
	cout<<res<<endl;
}

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

using namespace std;

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    int s = 0;
    for(auto &x: a) cin >> x, s += x;
    n -= s;
    if(n < 0) cout << "-1";
    else cout << n;


    return 0;
}



Measured memory_bytes: 3656
#include<bits/stdc++.h>
using  namespace std;
int main()
{
long long int n;
cin>>n;
long long int arr[n][3];
long long int arr1[n][3];
for(long long int i=0;i<n;i++)
{
	for(long long int j=0;j<3;j++)
	{
		cin>>arr[i][j];
	}
}

arr1[0][0]=arr[0][0];
arr1[0][1]=arr[0][1];
arr1[0][2]=arr[0][2];
for(long long int i=1;i<n;i++)
{
	for(int j=0;j<3;j++)
	{
		arr1[i][j]=max(arr1[i-1][(j+1)%3],arr1[i-1][(j+2)%3])+arr[i][j];
	}
}

long long int mx=max(arr1[n-1][0],arr1[n-1][1]);

mx=max(mx,arr1[n-1][2]);
cout<<mx<<endl;

	return 0;
}

Measured memory_bytes: 4992
numList = []
for i in range(int(input())):
    numList.append(i + 1)

for i in range(int(input())):
    a, b = list(map(int, input().split(',')))
    a, b = a - 1, b - 1
    tmp = numList[a]
    numList[a] = numList[b]
    numList[b] = tmp

for num in numList:
    print(num)



Measured memory_bytes: 5596
n,m=map(int,input().split())
arr=[]
for i in range(n):
	x,y=map(int,input().split())
	arr.append([x,y])
arr=sorted(arr,key=lambda item:item[0])
ans=0
req=m 
for i in range(len(arr)):
	tt=min(arr[i][1],req)
	ans+=(tt*arr[i][0])
	req-=tt
	if req<=0:
		break
print(ans)

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  a -= b;
  cout << max(0,c-a) << endl;
  return 0;
}


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

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

	long long s = 0;
	vector<int> av(n);
	for (auto& a : av) {
		cin >> a;
		s += a;
	}

	long long s2 = 0;
	for (int i = 1; i < n; i += 2) {
		s2 += av[i];
	}

	vector<long long> ret(n);
	ret[0] = s - 2 * s2;
	for (int i = 1; i < n; ++i) {
		ret[i] = 2 * av[i - 1] - ret[i - 1];
	}

	for (auto& r : ret) {
		cout << r << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 2432
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

using ll = long long;

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

#define mp make_pair
#define mt make_tuple

/* ----------- debug ---------- */

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p);

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1000000007;
// const ll MOD = 998244353;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
inline T sq(T a) { return a * a; }

template <typename T>
T gcd(T a, T b) {
    if (a > b) return gcd(b, a);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

ll pcnt(ll b) {
    return __builtin_popcountll(b);
}

template <typename T>
T iceil(T n, T d) {
    return (n + d - 1) / d;
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

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

    int ans = 1;
    while (true) {
        if (s == 4 || s == 2 || s == 1) break;
        s = ((s % 2) ? s * 3 + 1 : s / 2);
        ++ans;
    }

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


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	boolean[][] map;
	int MAX = 12;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			map = new boolean[MAX+2][MAX+2];
			
			for(int i=1;i<=MAX;i++) {
				String str = sc.next();
				for(int j=1;j<=MAX;j++) map[i][j] = str.charAt(j-1) == '1';
			}
			
			int ans = 0;
			
			for(int i=1;i<=MAX;i++) for(int j=1;j<=MAX;j++) {
				if(map[i][j]) {
					ans++;
					dfs(j, i);
				}
			}
			System.out.println(ans);
		}
	}
	
	int dx[] = {-1,0,1,0};
	int dy[] = {0,-1,0,1};
	
	void dfs(int x, int y) {
		if(!map[y][x]) return;
		map[y][x] = false;
		for(int i=0;i<4;i++) dfs(x+dx[i], y+dy[i]);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include <iostream>
using std::cin;
using std::cout;
using std::endl;

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

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

    int max = X[0];
    int min = X[0];
    for(int i = 1; i < N; i++){
        if(X[i] > max){
            max = X[i];
        }
        if(X[i] < min){
            min = X[i];
        }
    }

    int mindis = -1;
    for(int P = min; P <= max; P++){
        int distance = 0;
        for(int i = 0; i < N; i++){
            distance += (X[i] - P)*(X[i] - P);
        }
        if(mindis == -1){
            mindis = distance;
        }
        else{
            if(mindis > distance){
                mindis = distance;
            }
        }
    }

    cout << mindis << endl;

    return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main()
{
    int n;
    cin >> n;
    cout << "ABC" << n << endl;
    return 0;
}

Measured memory_bytes: 3596
// Molecular Formula
import java.util.*;

public class Main {
	static String formula;
	static int pos;
	static Map<String, Integer> table;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		table = new HashMap<String, Integer>();
		while (true) {
			String atom = sc.next();
			if (atom.equals("END_OF_FIRST_PART"))
				break;
			int weight = sc.nextInt();
			table.put(atom, weight);
		}
		while (true) {
			formula = sc.next();
			pos = 0;
			if (formula.equals("0"))
				break;
			int result = formula();
			if (result == -1)
				System.out.println("UNKNOWN");
			else
				System.out.println(result);
		}
		sc.close();
	}

	static int formula() {
		int result = 0;
		while (pos < formula.length()) {
			int t = molecule();
			if (t == -1)
				return -1;
			result += t;
		}
		return result;
	}

	static int molecule() {
		int result = 0;
		char c = formula.charAt(pos);
		if (c == '(') {
			pos++;
			while (formula.charAt(pos) != ')')
				result += molecule();
			pos++;
			result *= number();
		} else {
			result = atom();
			if (result == -1)
				return -1;
			if (pos < formula.length()
					&& Character.isDigit(formula.charAt(pos)))
				result *= number();
		}
		return result;
	}

	static int atom() {
		String atom = formula.substring(pos, ++pos);
		if (pos < formula.length()
				&& Character.isLowerCase(formula.charAt(pos)))
			atom += formula.charAt(pos++);
		if (table.containsKey(atom))
			return table.get(atom);
		return -1;
	}

	static int number() {
		int result = 0;
		while (pos < formula.length() && Character.isDigit(formula.charAt(pos))) {
			result *= 10;
			result += formula.charAt(pos++) - '0';
		}
		return result;
	}
}

Measured memory_bytes: 20416
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<cmath>
#include<stack>
#include<cstdio>
using namespace std;
struct node
{
    int val;
    node* next;
};
/*
 99992149
      123
 */
int isSu(long long int x)
{
    long long int up = sqrt(x);
    for(int i = 2;i<=up;i++)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
int main()
{
    int h,w,ans; //h是行，w是列 #是黑色，.是白色
    cin>>h>>w;
    char masu[102][102];
    int dp[102][102]={0};
    for(int i = 1;i<=h;i++)
        for(int j = 1;j<=w;j++)
        {
            cin>>masu[i][j];
        }
    /*
    for(int i = 1;i<=h;i++)
    {for(int j = 1;j<=w;j++)
    {
        cout<<masu[i][j];
    }
        cout<<endl;
    }*/
    /*if(masu[1][1]=='#')
        dp[1][1]++;
     非必要修改
     dp这里是#的连续段数啊！！！！
     */
    if(masu[1][1]=='#')
        dp[1][1]++;
    for(int i = 2;i<=h;i++)
    {
        
        if(masu[i][1]==masu[i-1][1]&&masu[i][1]=='#')
            dp[i][1]=dp[i-1][1];
        else if(masu[i][1]!=masu[i-1][1]&&masu[i][1]=='#')
            dp[i][1]=dp[i-1][1]+1;
        else
            dp[i][1]=dp[i-1][1];
    }
    for(int j = 2;j<=w;j++)
    {
        if(masu[1][j]==masu[1][j-1]&&masu[1][j]=='#')
            dp[1][j]=dp[1][j-1];
        else if(masu[1][j]!=masu[1][j-1]&&masu[1][j]=='#')
            dp[1][j]=dp[1][j-1]+1;
        else
            dp[1][j]=dp[1][j-1];
    }
    int t1,t2;
    for(int i=2;i<=h;i++)
        for(int j = 2;j<=w;j++)
        {
            if(masu[i][j]==masu[i-1][j]&&masu[i][j]=='#')
                t1=dp[i-1][j];
            else if(masu[i][j]!=masu[i-1][j]&&masu[i][j]=='#')
                t1=dp[i-1][j]+1;
            else
                t1=dp[i-1][j];
            if(masu[i][j]==masu[i][j-1]&&masu[i][j]=='#')
                t2=dp[i][j-1];
            else if(masu[i][j]!=masu[i][j-1]&&masu[i][j]=='#')
                t2=dp[i][j-1]+1;
            else
                t2=dp[i][j-1];
            //cout<<t1<<" "<<t2<<endl;
            dp[i][j]=min(t1,t2);
        }
    /*
    for(int i = 1;i<=h;i++)
    {for(int j = 1;j<=w;j++)
    {
        cout<<dp[i][j];
    }
        cout<<endl;
    }*/
    //只要连在一起，就可以减少！ dp应该表达，连续段数，而不是普通的！
    
    
    cout<<dp[h][w]<<endl;
    return 0;
}



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

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
for i in range(0, N + 1, 4):
    total = i
    for j in range(0, N + 1, 7):
        total += j
        if total == N:
            print("Yes")
            sys.exit()
        elif total > N:
            break
print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const int INF = 1e9;
double temp_start = 3000.0;
double temp_end = 10; 
int climb_loop = 10000000;
double temp;

int main(){
  int seed = 12345;
  mt19937 eng(seed);
  uniform_real_distribution<> uniform_01;

  // input
  int D;
  cin >> D;
  int c[26];
  rep(i,26) cin >> c[i];
  int s[D+1][26];
  rep(i,D) rep(j,26) cin >> s[i+1][j];
  
  // define parameter
  int last[D+1][26];
  int t[D+1];
  rep(i,D+1) rep(j,26) last[i][j] = 0;
  
  // calculate initial content climbing
  int content = 0;
  for(int day = 1; day <= D; day++) {
    int content_after = -INF;
    int best_kind = 0;
    rep(kind,26) {
      int res = content + s[day][kind];
      rep(j,26) {
        if(j == kind) last[day][j] = day;
        else last[day][j] = last[day-1][j];
        res -= c[j] * (day - last[day][j]);
      }
      if(res > content_after) {
        best_kind = kind;
        content_after = res;
      }
    }
    t[day] = best_kind;
    content = content_after;
    rep(j,26) {
      if(j == t[day]) last[day][j] = day;
      else last[day][j] = last[day-1][j];
    }
  }
   
  // simulated annealing
  rep(x,climb_loop) {
    int d = (eng() % D) + 1;
    int q = eng() % 26;
    if(q != t[d]) {
      temp = temp_start + (temp_end - temp_start)*x/climb_loop;
      int diff = s[d][q] - s[d][t[d]];
      int cur = d;
      while(cur <= D && last[cur][t[d]] == d) {
        diff -= c[t[d]] * (d - last[cur-1][t[d]]);
        last[cur][t[d]] = last[cur-1][t[d]];
        cur++;
      }
      cur = d;
      while(cur <= D && last[cur][q] < d) {
        diff += c[q] * (d - last[cur][q]);
        last[cur][q] = d;
        cur++;
      }
      if(diff > 0 || uniform_01(eng) < exp((double)diff/temp)) {
        t[d] = q;
        content += diff;
      } else {
        int day = d;
        while(day <= D && last[day][t[d]] < d) {
          last[day][t[d]] = d;
          day++;
        }
        day = d;
        while(day <= D && last[day][q] == d) {
          last[day][q] = last[day-1][q];
          day++;
        }
      }
    }
  }
  // output
  for(int day = 1; day <= D; day++) cout << t[day]+1 << endl;
  return 0;
}


Measured memory_bytes: 4364
#include <stdio.h>
#include <math.h>
int main(void)
{
  double x1,y1,x2,y2;
  scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

  printf("%f\n",sqrt(pow((x2-x1),2.0)+pow((y2-y1),2.0)));

  return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <cmath>

using namespace std;

class Point{
public:
  double x, y, z;
};
class Telescope{
public:
  double x, y, z, l;
};

double norm(Point);
double norm(Telescope);
double dot(Telescope, Point);

main(){
  int n, m;
  Point in[500];
  bool can[500];
  Telescope tele[50];
  while(1){
    cin >> n;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin >> in[i].x >> in[i].y >> in[i].z;
      can[i]=false;
    }

    cin >> m;
    for(int i=0;i<m;i++){
      cin >> tele[i].x >> tele[i].y >> tele[i].z >> tele[i].l;
    }

    double nf, ns, d, t;
    
    for(int i=0;i<m;i++){
      nf=norm(tele[i]);
      for(int j=0;j<n;j++){
	if(can[j]) continue;
	ns=norm(in[j]);
	d=dot(tele[i], in[j]);
	double tmp=d/nf/ns;
	t=acos(tmp);
	if(tele[i].l>=t) can[j]=true;
      }
    }
    int count=0;
    for(int i=0;i<n;i++){
      if(can[i]) count++;
    }
    cout << count << endl;
  }
  return 0;
}

double norm(Point data){
  return sqrt(data.x*data.x+data.y*data.y+data.z*data.z);
}

double norm(Telescope data){
  return sqrt(data.x*data.x+data.y*data.y+data.z*data.z);
}
double dot(Telescope a, Point b){
  return a.x*b.x+a.y*b.y+a.z*b.z;
}

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

int main() {
  int64_t a, b, c;
  cin >> a >> b >> c;
  
  if ((a % 2) * (b % 2) * (c % 2) == 0 ) {
    cout << 0 << endl;
  }
  else {
    cout << min(min((a * b),(b * c)),(c * a)) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define lli long long int
#define X first
#define Y second
#define fw(i, start, end) for (lli i = start; i < end; ++i)
#define fe(i, start, end) for (lli i = start; i <= end; ++i)
#define L(T)  \
    lli T;    \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
int main()
{
    FASTIO
    lli n;
    cin >> n;
    lli sum = 0;
    fe(i, 1, n)
    {
        if (i % 3 == 0 || i % 5 == 0)
        {
            sum += 0;
        }

        else
            sum += i;
        // cout << sum << "\n";
    }
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int n,a[100000],MIN,MAX;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i){
            MIN=min(MIN,a[i]);
            MAX=max(MAX,a[i]);
        }
        else MIN=MAX=a[i];
    }
    if(MAX-MIN>1)cout<<"No\n";
    else if(MAX==MIN)cout<<(MAX==n-1||2*MAX<=n?"Yes\n":"No\n");
    else{
        int num=0;
        for(int i=0;i<n;i++)if(a[i]==MAX)num++;
        cout<<(n-num+num/2>=MAX&&n-num<=MIN?"Yes\n":"No\n");
    }
}

Measured memory_bytes: 640
// Biscuit_Generator
// https://atcoder.jp/contests/abc125/tasks/abc125_a
// date: 2020-08-15T19:20:35.753917

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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(ll) a;i<(ll) b;i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _repd(i,n) repdi(i,0,n)
#define repdi(i,a,b) for(ll i=(ll) b-1;i>=(ll) a;i--)
#define repd(...) _overload3(__VA_ARGS__,repdi,_repd,)(__VA_ARGS__)

#define all(x) x.begin(),x.end()
#define SIZE(x) ((ll)(x).size())

#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

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

template<typename T, typename ...Args>
void CIN(T& first, Args&... args) {
    ((cin >> first), ..., (cin >> args)); //C++17
}

template<char Sep, typename T, typename ...Args>
void COUNT_NL(const T& first, const Args&... args) {
    ((cout << first), ..., (cout << Sep << args)); //C++17
}

template<typename... Words>
void COUT(Words... words) {
    COUNT_NL<' '>(words...);
    cout << endl;
    return;
}

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange

int solve(void) {
    string s;
    CIN(s);
    ll cnt=0;
    ll top=0;
    rep(i,3) {
        if (s[i]== 'R') {
            cnt ++;
            chmax(top,cnt);
        } else {
            cnt = 0;
        }
    }
    COUT(top);
    return 0;
}

int main(void){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);

    solve();
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
ull solve(ll x, int level, vll P, vll Len)
{
    if (x == 1)
    {
        return 0;
    }
    if (level == 1)
    {
        return min(3LL, x - 1);
    }
    if (x <= Len[level] / 2)
    {
        return solve(x - 1, level - 1, P, Len);
    }
    if (x == Len[level] / 2 + 1)
    {
        return P[level - 1] + 1;
    }
    else
    {
        return solve(x - Len[level - 1] - 2, level - 1, P, Len) + P[level - 1] + 1;
    }
}
int main()
{
    ll N, X;
    cin >> N >> X;
    vll P(N + 1), B(N + 1), Len(N + 1);
    P[0] = 1;
    Len[0] = 1;
    rep(i, N)
    {
        P[i + 1] = 2 * P[i] + 1;
        B[i + 1] = 2 * B[i] + 2;
        Len[i + 1] = P[i + 1] + B[i + 1];
    }
    ll x = X, level = N, ans = 0;

    cout << solve(X, N, P, Len);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define endl "\n"
#endif
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
#define yes cout << "Yes\n";
#define no cout << "No\n";
#define yesno(f) \
    if (f)       \
        yes else no;
#define noo \
    { no return; }
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;

void solve() {
    string s, t;
    cin >> s >> t;
yesno (t.substr(0, s.length()) == s);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // int t;cin >> t;while(t--)
    solve();
    return 0;
}


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

typedef long long LL;

const int N=100000,mod=998244353;

int add(int a,int b,int p=mod){return a+b>=p?a+b-p:a+b;}
int sub(int a,int b,int p=mod){return a-b<0?a-b+p:a-b;}
int mul(int a,int b,int p=mod){return (LL)a*b%p;}
void sadd(int &a,int b,int p=mod){a=add(a,b,p);}
void ssub(int &a,int b,int p=mod){a=sub(a,b,p);}
void smul(int &a,int b,int p=mod){a=mul(a,b,p);}

int n,a[N+9],cnt[N+9];

void into(){
  scanf("%d",&n);
  for (int i=1;i<=n;++i){
    scanf("%d",&a[i]);
	++cnt[a[i]];
  }
}

int ans;

void Get_ans(){
  if (a[0]) return;
  ans=1;
  for (int i=2;i<=n;++i) smul(ans,a[i]?cnt[a[i]-1]:0);
}

void work(){
  Get_ans();
}

void outo(){
  printf("%d\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 4468
#include<iostream>
#include<cmath>
using namespace std;
typedef long double LD;

int main() {
	int n;
	cin >> n;
	for (int x = 0;x < n;x++) {
		LD a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		LD od = ((d - a)*(d - a)) + ((e - b)*(e - b));
		LD rw = (c + f)*(c + f);
		LD id = (c - f)*(c - f);

	 if (rw <od)cout << 0 << endl;
		else if(od<id) {
			if (c < f)cout << -2 << endl;
			else cout << 2 << endl;
		}
		else cout << 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>

using namespace std;

int main()
{   int A,B,C;
    cin>>A>>B>>C;
    if (A==B && A!=C)
        cout<<C<<endl;
    else if (A==C && A!=B)
        cout<<B<<endl;
    else
        cout<<A<<endl;
    return 0;
}


Measured memory_bytes: 256
n,a,b=map(int,input().split())
p=1000000007

#2^n
nlist=[]#create n(10)=?(2)<-reversed
A=n
while A>=2:
    B=A%2
    nlist.append(B)
    A=A//2
nlist.append(A)
twoexplist=[2]#2,2^2,2^2^2,%p 2^(2^i)
for i in range(len(nlist)):
    twoexplist.append((twoexplist[i]*twoexplist[i])%p)
#2^n=2*2^2*2^2^2 [1,1,1]
twoexp=1
for i in range(len(nlist)):
    if nlist[i]==1:
        twoexp=(twoexp*twoexplist[i])%p

#nCa
ca=1
for i in range(a):
    ca=(ca*(n-i))%p
aa=1
for i in range(a):
    aa=(aa*(i+1))%p
plist=[]
A=p-2
while A>=2:
    B=A%2
    plist.append(B)
    A=A//2
plist.append(A)
aaexplist=[aa]#(aa)^(2^i)
for i in range(len(plist)):
    aaexplist.append((aaexplist[i]*aaexplist[i])%p)
aaexp=1
for i in range(len(plist)):
    if plist[i]==1:
        aaexp=(aaexp*aaexplist[i])%p
nCa=(ca*aaexp)%p

#nCb
cb=1
for i in range(b):
    cb=(cb*(n-i))%p
bb=1
for i in range(b):
    bb=(bb*(i+1))%p
bbexplist=[bb]#(bb)^(2^i)
for i in range(len(plist)):
    bbexplist.append((bbexplist[i]*bbexplist[i])%p)
bbexp=1
for i in range(len(plist)):
    if plist[i]==1:
        bbexp=(bbexp*bbexplist[i])%p
nCb=(cb*bbexp)%p

print((twoexp-1-nCa-nCb)%p)

Measured memory_bytes: 39792
#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 <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int a, b, x;
        cin >> a >> b >> x;
        if (a * a * b <= 2 * x) {
            double h = 1. * x / a / a;
            double Y = 2. * (b - h);
            double R = sqrt(a * a + Y * Y);
//            double ans = 180. * asin(Y / R) / acos(-1);
            double ans = 180. * atan2(Y, a) / acos(-1);
//            if (ans < 0 || ans > 90) {
//                exit(-1);
//            }
            cout << ans << endl;
            return;
        } else {
            double Y = b;
            double S = 1. * x / a;
            double X = 2. * S / Y;
            double R = sqrt(X * X + Y * Y);
//            double ans = 180. * asin(Y / R) / acos(-1);
            double ans = 180. * atan2(Y, X) / acos(-1);
//            if (ans < 0 || ans > 90) {
//                exit(-1);
//            }
            cout << ans << endl;
        }

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
n,d = map(int,input().split())
x=[0 for _ in range(n)]
ans=0

for i in range(n):
    x[i] = list(map(int,input().split()))
for i in range(n-1):
    for j in range(n-1-i):
        j+=i+1
        check=0
        for k in range(d):
            check+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k])
        check=check**(1/2)
        if(check%1==0):
            ans+=1
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

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

        int n = scanner.nextInt();
        int[] a = new int[n];
        int[] forward = new int[n + 1];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
            forward[i + 1] = gcd(a[i], forward[i]);
        }

        int best = forward[n];
        int current = 0;
        for (int i = 1; i < n; i++) {
            best = Math.max(best, gcd(current, forward[n - i]));
            current = gcd(current, a[n - i]);
        }
        best = Math.max(best, current);
        System.out.println(best);
    }

    private static int gcd(int a, int b) {
        int min = Math.min(a, b);
        int max = Math.max(a, b);
        if (min == 0) return max;
        return gcd(min, max % min);
    }
}

Measured memory_bytes: 62924
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

#include <bits/stdc++.h>
using namespace std;



int main() {
    int R;

    cin >> R;
    cout << 2 * M_PI * R << endl;
}

Measured memory_bytes: 3800
#include <stdio.h>

int main (){
    char str[1210];
    int alpha[40] = {};

    for(int i=0; scanf("%c",&str[i]) != EOF; i++){
        for(int j = 65;j<=90;j++){
            if(str[i] == j || str[i] == j + 32){
                alpha[j-65] += 1;
            }
        }
    }
    for(int k = 0; k <= 25; k++){
        printf("%c : %d\n",k + 97, alpha[k]);
    }

}


Measured memory_bytes: 2696
#include<iostream>
#include<algorithm>
#include<set>
#include<string>
#include<vector>
#include<cstring>
#include<set>
#include<queue>
#include<map>
#include<climits>
#include<cmath>
#include<iomanip>

#define F first
#define S second
#define vi vector
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define FORR(i,a,b) for(int i=a;i>=b;i--)
#define mod 1000000007
#define pb push_back
#define ll long long int
#define db double
#define all(v) v.begin(),v.end()
using namespace std;



ll expo(ll n){
    ll t;
    if(n==0)return 1;
    else if(n==1) return 2;
    t=expo(n/2);
    if(n%2){
        return t*t*2;
    }
    else return t*t;
}

//ffrom geek for geek
ll exponentMod(ll A, ll B, ll C)  
{  
    if (A == 0)  
        return 0;  
    if (B == 0)  
        return 1;  
    ll y;  
    if (B % 2 == 0) {  
        y = exponentMod(A, B / 2, C);  
        y = (y * y) % C;  
    }  
    else {  
        y = A % C;  
        y = (y * exponentMod(A, B - 1, C) % C) % C;  
    }  
  
    return (ll)((y + C) % C);  
}

/*
vi<ll> v;
 
ll dsufind(ll x){
    if(v[x]<0){
        return x;
    }
    v[x]=dsufind(v[x]);
    return v[x];
}
 
 
 
void dsujoin(ll x,ll y){
    x=dsufind(x);
    y=dsufind(y);
    
    if(x==y)
    return;
    if(v[x]>v[y])swap(x,y);
    v[y]+=v[x];
    v[x]=y;
}
 */

 



int main(){
   ll n,k;
   cin>>n>>k;
   ll arr[n+1];
   FORE(i,1,n){
       cin>>arr[i];}
       arr[0]=INT_MAX;
    ll dp[n+1];
    dp[0]=INT_MAX;
    dp[1]=0;
    FORE(i,2,n){
        dp[i]=INT_MAX;
        for(int j=i-1,l=k;j>0 && l>0;l--,j--)
        dp[i]=min(dp[i],(dp[j]+abs(arr[i]-arr[j])));
      //cout<<dp[i]<<" "<<i<<"\n";
    }

    cout<<dp[n]<<"\n";
}

Measured memory_bytes: 1792
#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>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
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)
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;

#define ALL(a) (a).begin(),(a).end()
#define INF 1e+9
#define MAX_V 300

struct edge {
    int to;
    int cost;
};
using P = pair<ll, ll>;

int main(){
  ll n;cin>>n;
  VL a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end(),greater<ll>());
  vector<ll> d;
  ll ans=0;
  ll count=0;
  ll num=0;
  priority_queue<ll> stack;
  int key=0;
  while(num<n-1){
    stack.push(a[num]);
    num++;
    ans+=stack.top();
    key++;
    if(num==1){stack.pop();key=0;}
    if(key==2){stack.pop();key=0;}
  }
  cout<<ans<<endl;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

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

    int n, k;
    cin >> n >> k;

    ll sum = 0;
    for(int i=0; i<n; i++){
        int t;
        cin >> t;
        sum += 2*min(abs(t - k), t);
    }

    cout << sum << endl;


    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void) {
	// your code goes here
    
    double a,b,c;
    double s,l,h;
    double rad;
    
    scanf("%lf %lf %lf",&a,&b,&c);
    
    rad = c * 3.14159265359 / 180.0;
    
    h = b*b - pow(b*cos(rad),2);
    h = sqrt(h);
    
    s = h * a / 2;
    
    l = a + b + sqrt(a*a + b*b - 2*a*b*cos(rad));
    
    printf("%f\n%f\n%f\n",s,l,h);
    
	return 0;
}

Measured memory_bytes: 672
#include<iostream>
int main()
{
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++)
	{
		long double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		std::cout << (x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4) ? "YES" : "NO") << std::endl;
	}
	return 0;
}


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

int main (void){
  int N;
  cin >> N;
  
  vector<int> integers(N);
  
  for (int i = 0; i < N; i++) {
    cin >> integers.at(i);
  }
  
  int number = 0; // number of operations that Snuke can perform
  
  while (1){
    bool existOdd = false; // check if there exists an ood number
    
    // make existOdd true if there exists an ood residue
    for (int i = 0; i < N; i++) {
      if (integers.at(i) % 2 == 1){
        existOdd = true;
      }
    }
    
    // exit this roop if there exists an ood residue
    if (existOdd) break;
    
    //Replace each integer X on the blackboard by X divided by 2
    for (int i = 0; i < N; i++) {
      integers.at(i) /= 2;
    }
    
    //record the operation
    number++;
  }
  
  cout << number << endl;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    int m;
    vector<int> num;
    num.push_back(0);
    int sum1 = 0;
    for(int i = 0; i<n; i++){
        int place;
        cin >> place;
        sum1 = sum1+place;
        num.push_back(place);
    }
    cin >> m;
    for(int i =0;i<m;i++){
        int prob,sec11;
        cin >> prob >> sec11;
        cout << (sum1-num[prob]+sec11) << endl;
    }
}

Measured memory_bytes: 256
count = 0
N = int(input())
h = list(map(int, input().split()))
count =+ min(h)
h = list(map(lambda x:  x-min(h) ,h))
# if max(h) == 0:
#     print(count)
h.append(0)
while max(h) != 0:
    for i in range(len(h)):
        if h[i] <= 0:
            continue
        elif h[i-1] > 0:
            continue
        else:
            for j in range(i+1,len(h)+1):
                if h[j] > 0:
                    continue
                else:
                    count += 1
                    break
    h = list(map(lambda x:  x-1 ,h))
print(count)

Measured memory_bytes: 3064
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>


using namespace std;
long long MOD = 1000000007LL;

int main() {
	int A,B;
	cin >> A >> B;
	cout << max(max(A + B, A - B), A * B) << endl;

	return 0;
}

Measured memory_bytes: 256