akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#define maxn 105
using namespace std;
int dp[2][maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&dp[1][i]);
    }
    for(int i=1;i<=n;i++){
        scanf("%d",&dp[2][i]);
    }
    for(int i=1;i<=2;i++){
        for(int j=1;j<=n;j++){
            dp[i][j]+=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    printf("%d\n",dp[2][n]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f;








void sol()
{   char a;
    cin>>a;
    
    
    
    
    cout<< char(++a) <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

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

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

  int len = S.length();
  int ans = 0;
  for (int i=0; i<len/2; i++) {
    if (S[i] != S[len-1-i]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if (n > 1)
        result -= result / n;
    return result;
}
int32_t main()
{   
     IOS;
     
     ll n,m,i,j,k;
     cin>>n;
     if(n==2) return cout<<1,0;
     // if(n==3) return 
     m=n-1;
     // set<ll> v;
     // vector<ll> v1;
     ll ans=0;
     for(i=2;i*i<=n;i++)
     {
       if(n%i==0)
       {
         ll x=i;
         // v.insert(x);
         ll y=n/i;
         ll x1=0;
         ll y1=0;
         ll temp=n,temp1=n;
         while(temp%x==0) temp/=x;
         if(temp%x==1) ans++;
         if(x==y) continue;
         // v.insert(y);
         while(temp1%y==0) temp1/=y;
         if(temp1%y==1) ans++;
         // cout<<temp%x<<' '<<temp1%y<<endl;
       }
     }
     // cout<<ans<<endl;
     // v.insert(n);
     for(i=2;i*i<=m;i++)
     {
       if(m%i==0)
       {
         ll x=i;
         ll y=m/i;
         // if(v.count(x)) ans++;
         ans++;
         if(x==y) continue;
         ans++;
         // if(v.count(y)) ans++;
       }
     }
     ans+=2;
     // for(i=2;i*i<=n)
     // ans+=phi(m);
     // cout<<phi(m)<<endl;
     cout<<ans;

     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int a, b, x1;
    double x;
    scanf("%d %d", &a, &b);
    x = (a + b) / 2.0;
    x1 = x;
    if(x-x1 == 0.0) printf("%d\n", x1);
    else printf("%d\n", x1+1);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        System.out.println(area(x, y) + " " + circumference(x, y));
    }

    private static int area(int x, int y) { return x * y; }
    private static int circumference(int x, int y) { return 2 * (x + y); }
}

Measured memory_bytes: 26060
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int a,b;
	cin>>a>>b;
	switch(a){
		case 0:if(b<100)cout<<b;else cout<<101;break;
		case 1:if(b<100)cout<<b<<"00";else cout<<10100;break;
		case 2:if(b<100)cout<<b<<"0000";else cout<<1010000;break; 
	}
    return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main{

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String S, T; 

        S = sc.next();
        T = sc.next();

        if(T.length()-1 == S.length() && S.equals(T.substring(0,T.length() - 1))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

        sc.close();
    }
    
}

Measured memory_bytes: 35652
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,M,C;
    cin >> N >> M >> C;
    vector<int>B(M);
    for(int i = 0; i < M; i++) {
        cin >> B[i];
    }
    vector<vector<int>>A(N,vector<int>(M));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        int cnt = 0;
        for(int j = 0; j < M; j++) {
            cnt+=B[j]*A[i][j];
        }
        if(cnt+C > 0) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3584
//
// Created on 2020/05/03.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    string ans;
    string s;
    cin>>s;
    if(s == "ABC"){
        ans = "ARC";
    }else{
        ans = "ABC";
    }

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


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
int main(){
	int n,m;
	sc(n);sc(m);
	pf("%d\n",n*(n-1)/2+m*(m-1)/2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for(int i=0;i<M;i++)
    cin >> B.at(i);
  int temp;
  int cnt = 0;
  //count
  for(int i=0;i<N;i++){
    int sum = 0;
    for(int j=0;j<M;j++){
      cin >> temp;
      sum += temp * B.at(j);
    }
    sum += C;
    if (sum > 0)
      cnt++;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(b>=c)
	{
		cout<<"delicious";
	}
	else if(c-b<=a)
	{
		cout<<"safe";
	}
	else
	{
		cout<<"dangerous";
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    string s;
    cin >> s;
    string ans = "Yes";
    int n = s.size();
    rep(i, (n-1)/2) {
        if (s[i]!=s[n-1-i]) ans = "No";
    }
    int m = (n-1)/2;
    rep(i, m) {
        if (s[i]!=s[m-1-i]) ans = "No";
        if (s[i+m+1]!=s[n-1-i]) ans = "No";
    }
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
l, r = map(int, input().split())
ans = l*r%2019
for i in range(l, r):
  for j in range(i+1, r+1):
    if i*j%2019 == 0:
      print(0)
      sys.exit()
    elif ans > i*j%2019:
      ans = i*j%2019
print(ans)


Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int max(int a, int b){
	return a >= b ? a : b;
}

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

int euclid(int a, int b){
  if(a < b){
    int tmp = a;a = b;b = tmp;
  }
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  int a,b;
  scanf("%d %d",&a,&b);
	printf("%d",(b-a+1)*(b-a)/2-b);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>

int main(void){
    
    int A,B,C;

    scanf("%d %d %d",&A,&B,&C);

    if(A+B < C){
        printf("NO\n");
    }else{
        if (A > C){
            printf("NO\n");
        }else{
            printf("YES\n");
        }
    }
}

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

class Program {
    static int N;
    static List<Tuple<int, int>> tupleList = new List<Tuple<int, int>>();
    static int[] l;
    static int[] len = new int[3];

    static int ans;

    static void Main(string[] args) {
        int[] st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        N = st[0];

        //A, B, Cを配列で持つことで、ループ処理を可能にする
        len[0] = st[1];
        len[1] = st[2];
        len[2] = st[3];

        l = new int[N];
        for (int i = 0; i < N; i++) {
            l[i] = int.Parse(Console.ReadLine());
        }

        //解答となる数値
        ans = int.MaxValue;

        tupleList.Add(new Tuple<int, int>(0, 0));
        tupleList.Add(new Tuple<int, int>(0, 0));
        tupleList.Add(new Tuple<int, int>(0, 0));
        tupleList.Add(new Tuple<int, int>(0, 0));

        dfs(0, l);

        Console.WriteLine(ans);
    }

    static void dfs(int depth, int[] l) {
        if (depth < N) {
            //各竹について、4つのグループに入る可能性がある
            for (int i = 0; i < 4; i++) {
                tupleList[i] = new Tuple<int, int>(tupleList[i].Item1 + l[depth], tupleList[i].Item2 + 1);

                dfs(depth + 1, l);
                //抜けたら選択を戻す
                tupleList[i] = new Tuple<int, int>(tupleList[i].Item1 - l[depth], tupleList[i].Item2 - 1);
            }
        } else {
            int tmp = 0;
            for (int i = 0; i < 3; i++) {
                if (tupleList[i].Item2 == 0) {
                    return;
                }
                tmp += Math.Abs(len[i] - tupleList[i].Item1) + 10 * (tupleList[i].Item2 - 1);
            }
            ans = Math.Min(ans, tmp);
        }
    }
}

Measured memory_bytes: 17488
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n, k; cin >> n >> k;
	vi v(n); rep(i, 0, n) cin >> v[i];
	ll lo = *max_element(all(v)) - 1;
	ll hi = 1LL<<55;
	ll p, P, m;
	while(hi - lo > 1) {
		p = P = (lo + hi) / 2;
		m = 1;
		rep(i, 0, n) {
			if(v[i] > p) {
				p = P;
				++m;
			}
			p -= v[i];
		}
		(m <= k ? hi : lo) = P;
	}
	P(hi);
	return 0;
}

Measured memory_bytes: 3296
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<ll> b(n-1);
  rep(i,n-1) cin >> b[i];
  ll ans = b[0] + b[n-2];
  for (int i = 1; i < n-1; ++i) {
    ans += min(b[i], b[i-1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//In the name of God!
#include <bits/stdc++.h>

using namespace std;
const int maxn = 20 + 12;

int a[maxn];
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    for(int i = 1; i < n - 1; i++)
        if((a[i] > a[i - 1] && a[i] < a[i + 1]) || (a[i] < a[i - 1] && a[i] > a[i + 1]))
            ans++;
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define EM 100000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
using vint = vector<int>;
using vLL = vector<LL>;

int main(){
    string s;
    cin >> s;
    vector<vector<int>> dp(s.size()+10, vector<int>(13, 0));
    s += ".";
    reverse(s.begin(), s.end());
    int d = 1;
    LL mod = 1e9+7;
    dp[0][0] = 1;
    for(int i = 1;i < s.size();i++){
        if(s[i] == '?'){
            for(int j = 0;j < 10;j++){
                int dd = d*j%13;
                for(int k = 0;k < 13;k++){  dp[i][(k+dd)%13] += dp[i-1][k];dp[i][(k+dd)%13] %= mod; }
            }
        }else{
            int dd = d*(s[i]-'0')%13;
            for(int k = 0;k < 13;k++){  dp[i][(k+dd)%13] += dp[i-1][k];dp[i][(k+dd)%13] %= mod; }
        }
        d = d*10%13;
    }
    cout << dp[s.size()-1][5] << endl;
}

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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=1050;
char a[N];
int main()
{
    scanf("%s",a);
    string s=a;
    int n=s.size();
    if(s[n-1] != 's'){
        s+='s';
    }
    else{
        s+="es";
    }
    printf("%s",s.c_str());

}


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

int main(){
	int N;
	cin >> N;
	int p[N], max = 0;
	for(int i=0; i<N; i++){
		cin >> p[i];
		if(max < p[i]){
			max = p[i];
		}
	}
	int ans = 0;
	for(int i=0; i<N; i++){
		ans = ans + p[i];
	}
	ans = ans - max/2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 251
int main()
{
  int n,A[N],i;
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&A[i]);

  for(i=1;i<=n;i++)
    {printf("node %d: key = %d, ",i,A[i]);
      if(i!=1)printf("parent key = %d, ",A[i/2]);
      if(i*2<=n)printf("left key = %d, ",A[i*2]);
      if(i*2+1<=n)printf("right key = %d, ",A[i*2+1]);
      printf("\n");
    }
  return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
signed main(){
    int n;
    cin>>n;
    int k;
    cin>>k;
    int cnt=0;
    for(int i=0;i<n;i++){
        int h;
        cin>>h;
        if(k<=h)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            return N % 2 == 0 ? N : N * 2;
        }


        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

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

#define ELETYPE int

#define MAXNUM ((int)(1e6))	// MAXNUM未満を扱える
#define ELESIZE (sizeof(ELETYPE) << 3)
#define TABLESIZE ((int)(MAXNUM / ELESIZE) + 1)

int numOfBits(ELETYPE);

int main()
{
	ELETYPE table[TABLESIZE] = {3, 0}, mask = (ELESIZE - 1), shift;
	int i, j, k, f, l, n, p, num;
	int arr[] = {2, 3, 5}, max = MAXNUM >> 1;
	
	for (shift = 0; ELESIZE >> shift > 1; ++shift);
	
	for (i = 0; i < 3; ++i) {
		for (j = arr[i] << 1; j < MAXNUM; j += arr[i]) {
			table[j >> shift] |= (1 << (j & mask));
		}
	}
	
	k = 1;
	p = 7;
	while (p <= max) {
		if (p % 3 && p % 5) {
			f = 0;
			l = 1;
			for (j = 7; j * j <= p;) {
				if (!(p % j)) {
					f = 1;
					break;
				}
				j += 2 * (1 + l);
				l ^= 1;
			}
			if (!f) {
				for (i = p << 1; i < MAXNUM; i += p) {
					table[i >> shift] |= (1 << (i & mask));
				}
			}
		}
		
		p += 2 * (1 + k);
		k ^= 1;
	}
	
	while (scanf("%d", &n) != EOF) {
		num = 0;
		max = (n >> shift);
		for (i = 0; i < max; ++i) {
		    num += numOfBits(~table[i]);
		}
		
		num += numOfBits((~table[max] & ((0xffffffff >> (ELESIZE - (n & mask) - 1)))));
		printf("%d\n", num);
	}
	
	return 0;
}

int numOfBits(ELETYPE bits)
{
	bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
	bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
	bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
	bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
	return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

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

int main(){
	int n;
	cin >> n;
	bool a = false;
	for (int i = 1; i < 10; i++) {
		if ((n % i == 0) && (n / i < 10)) {
			a = true;
		}
	}

	if (a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

using namespace std;
const long long INF = (long long) (1e18)+1;

int main() {
  long long n, m;
  cin >> n >> m;
  long long ans_1 = n % m;
  long long ans_2 = abs(n - (n / m + 1) * m);

  // cout << ans_1 << " " << ans_2 << endl;
  cout << min(ans_1, ans_2) << endl;
  return 0;
}

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

namespace ConsoleApp15
{
    class Class58
    {
        static void Main()
        {
            //入力
            var HW = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = HW[0], W = HW[1];
            List<string> a = new List<string>();
            for (int i = 0; i < H; i++)
            {
                string r = Console.ReadLine();
                if (r.Contains('#')) a.Add(r);
            }


            //計算
            List<int> j = new List<int>();
            foreach(string s in a)
            {
                for(int i=0;i<s.Length;i++)
                    if (s[i] == '#')
                    {
                        if (!j.Contains(i)) j.Add(i);
                    }
            }
            j = j.OrderBy(x => x).ToList();
            if (j.Count() != 0)
                foreach (string c in a)
                {
                    foreach (int i in j)
                        Console.Write(c[i]);
                    Console.WriteLine();
                }
        }
    }
}


Measured memory_bytes: 13524
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;




int main() {
    int n;
    cin >> n;
    vector<int> a(n),ans(n);
    rep(i, n)  cin >> a[i];
    rep(i, n)ans[a[i]-1]=i;
    rep(i, n)cout << ans[i]+1<<" ";
}


Measured memory_bytes: 1536
#include <iostream>
#include <cmath>
#include <iomanip>

#define PI 3.14159265358979

using namespace std;

int main(){
  double a, b, x;
  cin >> a >> b >> x;
  double ans_rad = .0;
  if (x / a >= a * b / 2){
    ans_rad = atan((a * a * a)/(2.0*(a*a*b - x)));
  }
  else{
    ans_rad = atan(2.0*x/(a*b*b));
  }
  
  cout << fixed << setprecision(10) << 90.0 - ans_rad / (double)PI * 180.0 << endl;
  return 0;
}

Measured memory_bytes: 256
//  Created by Sengxian on 2017/5/27.
//  Copyright (c) 2017年 Sengxian. All rights reserved.
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
inline int readInt() {
	int n = 0, ch = getchar();
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) n = n * 10 + ch - '0', ch = getchar();
	return n;
}

const int MAX_N = 2000 + 3, MAX_M = 2000 + 3;
char str[MAX_N][MAX_M];
int n, m, q, sum[3][MAX_N][MAX_M];

const int dx[] = {0, 1, 0};
const int dy[] = {1, 0, 0};

inline bool check(int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < m && (str[x][y] == '1');
}

void prepare() {
	for (int k = 0; k < 3; ++k)
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < m; ++j)
				sum[k][i + 1][j + 1] = sum[k][i + 1][j] + sum[k][i][j + 1] - sum[k][i][j] + (check(i, j) && check(i + dx[k], j + dy[k]));
}

inline int getSum(int k, int x1, int y1, int x2, int y2) {
	return sum[k][x2][y2] - sum[k][x1][y2] - sum[k][x2][y1] + sum[k][x1][y1];
}

int main() {
	n = readInt(), m = readInt(), q = readInt();
	for (int i = 0; i < n; ++i) scanf("%s", str[i]);
	
	prepare();
	
	while (q--) {
		int x1 = readInt() - 1, y1 = readInt() - 1, x2 = readInt(), y2 = readInt();
		int s = getSum(2, x1, y1, x2, y2);
		s -= getSum(0, x1, y1, x2 - 1, y2 - 1) + getSum(1, x1, y1, x2 - 1, y2 - 1);
		if (y2 - y1 > 1) s -= getSum(0, x2 - 1, y1, x2, y2 - 1);
		if (x2 - x1 > 1) s -= getSum(1, x1, y2 - 1, x2 - 1, y2);
		printf("%d\n", s);
	}
	
	return 0;
}


Measured memory_bytes: 52736
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define TEST(...)                                                              \
    { printf("! "), printf(__VA_ARGS__); }
#else
#define TEST(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 1e9 + 7;
class {
  public:
    int n;
    vector<int> V[maxn];
    i64 d[maxn], sz[maxn], fa[maxn], ans[maxn], szfa[maxn];
    i64 inv[maxn], fac[maxn], invfa[maxn];
    void solve() {
        fac[0] = 1;
        invfa[0] = 1;
        inv[1] = 1;
        for (int i = 2; i < maxn; ++i)
            inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
        for (int i = 1; i < maxn; ++i) {
            fac[i] = fac[i - 1] * i % MOD;
            invfa[i] = invfa[i - 1] * inv[i] % MOD;
        }
        cin >> n;
        for (int i = 1; i < n; ++i) {
            int u, v;
            cin >> u >> v;
            V[u].push_back(v);
            V[v].push_back(u);
        }
        dfs(1, -1);
        dfs2(1, -1);
        for (int i = 1; i <= n; ++i) {
            cout << ans[i] << '\n';
        }
    }
    void dfs(int u, int f) {
        sz[u] = 1;
        d[u] = 1;
        for (int v : V[u]) {
            if (v != f) {
                dfs(v, u);
                sz[u] += sz[v];
                (d[u] *= d[v] * invfa[sz[v]] % MOD) %= MOD;
            }
        }
        (d[u] *= fac[sz[u] - 1]) %= MOD;
    }

    void dfs2(int u, int f) {
        if (u == 1) {
            fa[1] = 1;
            szfa[1] = 0;
            ans[u] = d[u];
        } else {
            fa[u] = d[f] * fac[sz[u]] % MOD * fac[n - sz[u] - 1] % MOD * fa[f] %
                    MOD;
            (fa[u] *= invfa[sz[f] - 1] * pw(d[u], MOD - 2) % MOD *
                      invfa[szfa[f]] % MOD) %= MOD;
            szfa[u] = n - sz[u];
            ans[u] = fac[n - 1] * d[u] % MOD * fa[u] % MOD * invfa[sz[u] - 1] %
                     MOD * invfa[szfa[u]] % MOD;
        }
        for (int v : V[u]) {
            if (v != f) {
                dfs2(v, u);
            }
        }
    }
    i64 pw(i64 a, i64 b) {
        i64 res = 1;
        while (b) {
            if (b & 1ll)
                res = res * a % MOD;
            a = a * a % MOD;
            b >>= 1;
        }
        return res;
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 26484
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define rrep(i, n) for (int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for (int i=(int)(n);i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=(int)(r)-1;i>=l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;
using vpii=vector<pii>;
using ll=long long;

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int inf = TEN(18)*3+10;

int N;
int A[100010];

signed main()
{
	cin >> N;
	rep(i, N + 1) cin >> A[i];

	int sum = accumulate(all(A), 0ll);

	int ans = 0;
	int c = 1;

	rep(i, N + 1) {
		ans += c;
		c -= A[i];

		if (c < 0) {
			puts("-1");
			return 0;
		}

		sum -= A[i];
		c = min(2 * c, sum);
	}

	cout << ans << endl;
}




Measured memory_bytes: 4380
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9 + 7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4] ={ 1,0,-1,0 };
int dy[4] ={ 0,1,0,-1 };

int N, M, a[2000], b[2000];
vector<int> in[1000], out[1000];

int s;
bool vis[1000];
bool found = false;
vector<int> v;
set<int> st;
void dfs(int i){
	vis[i] = true;
	rep(j, out[i].size()){
		if(out[i][j] == s){
			found = true;
			v.pb(i);
			st.insert(i);
			return;
		}
		if(vis[out[i][j]]) continue;
		dfs(out[i][j]);
		if(found){
			v.pb(i);
			st.insert(i);
			return;
		}
	}
}

signed main() {
	cin >> N >> M;
	rep(i, M){
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		out[a[i]].pb(b[i]);
		in[b[i]].pb(a[i]);
	}
	rep(i, N){
		rep(j, N) vis[j] = false;
		s = i;
		dfs(i);
		if(found) break;
	}
	if(found){
		reverse(all(v));
		rep(i, M){
			if(st.count(a[i]) == 1 && st.count(b[i]) == 1){
				vector<int> v2;
				set<int> st2;
				int tmp = 0;
				rep(j, v.size()*2){
					if(tmp == 0 && v[j%v.size()] == b[i]) tmp = 1;
					if(tmp == 1){
						v2.pb(v[j%v.size()]);
						st2.insert(v[j%v.size()]);
					}
					if(tmp == 1 && v[j%v.size()] == a[i]) tmp = 2;
				}
				v = v2;
				st = st2;
			}
		}
		cout << v.size() << endl;
		rep(i, v.size()) cout << v[i]+1 << endl;
	}
	else{
		cout << -1 << endl;
	}
	
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++) cin>>A[i];
  int ans=0,f=0;
  while(1){
    for(int i=0;i<N;i++){
      if(A[i]%2==1){
        f=1;
        break;
      }else A[i]/=2;
    }
    if(f==1) break;
    else ans++;
  }
  cout<<ans<<endl;
}

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

using namespace std;

int main() {
  #define int long long
  string s;
  cin >> s;
  int d = 1;
  int acc = 0;
  vector<int> data(2019);
  data.at(0) = 1;
  int ans = 0;
  int m = 0;
  int n = s.size();
  for (int i = n - 1; i >= 0; i--) {
    m = s.at(i) - '0';
    acc = (d * m + acc) % 2019;
    ans += data.at(acc);
    data.at(acc)++;
    d = d * 10 % 2019;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 3716
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;

int N, A, B;


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

  if (N == 1) {
    cout << "Hello World" << endl;
  } else {
    cin >> A >> B;
    cout << A+B << endl;
  }

  return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
main(){
  int i,n,m;
  for(i=1;;i++){
    scanf("%d %d",&n,&m);
    if(n==0 && m==0)break;
    if(n>m)printf("%d %d\n",m,n);
    else printf("%d %d\n",n,m);
  }
  return 0;
}


Measured memory_bytes: 2064
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include<cstring>
#define max(x,y) x>y?x:y
using namespace std;
const int maxn=1011111;
int f[maxn];
int d[maxn];
int find(int x)
{
    if(f[x]==x)
        return x;

    int r=find(f[x]);
    d[x]=d[f[x]]+d[x];//当前x到她老祖宗的距离等于他现在的距离加上她爸爸到老祖宗的距离

    return f[x]=r; //把每个子节点合并到他的祖先
}


int fix(int x,int y,int z)
{
    int fx=find(x);
    int fy=find(y);
    if(fx==fy)
        return z==d[y]-d[x];
    f[fy]=fx;//把x当作y的爸爸；
    d[fy]=d[x]+z-d[y];
    return 1;
}





int main()
{
    int n,m;
    int lose=1;
    cin>>n>>m;
    for(int i=1;i<=n;i++)//初始化：先把所有点的爸爸都设为自己；
        f[i]=i;
    for(int i=1;i<=m;i++)
    {
        int x,y,z;
        cin>>x>>y>>z;

        if(lose)
            lose=fix(x,y,z);

    }

    if(lose)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 4736
function main(lines) {
    const n = lines.split('\n')[0]
    const An = lines.split('\n')[1].split(' ').map(Number)
    // 初期の配列
    console.log(An.join(' '))

    for(let i=1; i<n; i++){
        value = An[i]
        let j = i - 1
        while(j>=0 && value<An[j]){
            An[j+1] = An[j]
            j--
        }

        An[j+1] = value

        console.log(An.join(' '))
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 16520
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7

import heapq
class Heapq:
    def __init__(self, que=[], asc=True):
        if not asc:
            que = [-a for a in que]
        self.__que = que
        heapq.heapify(self.__que)
        self.__sign = 1 if asc else -1

    def pop(self):
        return heapq.heappop(self.__que) * self.__sign

    def push(self, value):
        heapq.heappush(self.__que, value * self.__sign)

    def pushpop(self, value):
        return heapq.heappushpop(self.__que, value * self.__sign) * self.__sign

    def top(self):
        return self.__que[0] * self.__sign

    def size(self):
        return len(self.__que)

def sol():
    N, M, start, end = map(int, input().split())
    start -= 1
    end -= 1
    edgeA = [[] for _ in range(N)]
    edgeB = [[] for _ in range(N)]

    for _ in range(M):
        fr, to, a, b = map(int, input().split())
        fr -= 1
        to -= 1
        edgeA[fr].append((to, a))
        edgeA[to].append((fr, a))
        edgeB[fr].append((to, b))
        edgeB[to].append((fr, b))

    minDistA = [float('inf')] * N
    minDistB = [float('inf')] * N

    que = Heapq([])
    que.push((0, start))

    while que.size():
        dist, now = que.pop()

        if minDistA[now] <= dist:
            continue

        minDistA[now] = dist

        for to, cost in edgeA[now]:
            if minDistA[to] > dist + cost:
                que.push((cost + dist, to))

    que = Heapq([])
    que.push((0, end))

    while que.size():
        dist, now = que.pop()

        if minDistB[now] <= dist:
            continue

        minDistB[now] = dist

        for to, cost in edgeB[now]:
            if minDistB[to] > dist + cost:
                que.push((cost + dist, to))

    ans = [float('inf')] * (N + 1)
    for day in range(N)[:: -1]:
        newDist = minDistA[day] + minDistB[day]
        ans[day] = min(ans[day + 1], newDist)

    offset = 10**15
    for a in ans[: N]:
        print(offset - a)

sol()

Measured memory_bytes: 81848
import collections

N = int(input())
A = list(map(int, input().split()))  # (N,)
Q = int(input())
B, C = zip(*[list(map(int, input().split())) for _ in range(Q)])  # (Q,), (Q,)

cur_sum = 0
value_count_map = collections.defaultdict(int)
for a in A:
    cur_sum += a
    value_count_map[a] += 1

for b, c in zip(B, C):
    b_cnt = value_count_map.get(b, 0)
    value_count_map[b] = 0
    value_count_map[c] += b_cnt
    cur_sum += (b_cnt * (c - b))
    print(cur_sum)


Measured memory_bytes: 109796
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int main()
 {
   int a,b;
   char op;
   while(cin>>a>>op>>b)
   {
     int result;
     if(op=='?') break;
     else 
     {
       if(op=='+') result=a+b;
       else if(op=='-') result=a-b;
       else if(op=='*') result=a*b;
       else result=a/b;    
     }                 
     cout<<result<<endl;   
   }
   //while(1);
   return 0;
 }
 

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string n;
  cin>>n;
  int sum=0;
  for(int i=0;i<n.size();i++){
    int d=n.at(i)-'0';
    sum+=d;
  }
  if(stoi(n)%sum==0){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}

Measured memory_bytes: 256
n, m  = map(int,input().split())

a = []
for i in range(n):
  a.append(list(map(int,input().split())))

a.sort()
ans = 0
for i in a:
  if m >= i[1]:  
    m -= i[1]
    ans += i[0]*i[1]
  else:
    ans += i[0]*m
    break
print(ans)


Measured memory_bytes: 27756
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String s = r.readLine();
		int n = Integer.parseInt(s);

		int x1 = (int) ((double) n / 1.1);
		int x2 = (int) ((double) n / 1.0);

		boolean found = false;

		for (int i = x1; i <= x2; ++i) {
			if ((Math.floor(i * 1.08)) == n) {
				System.out.println(i);
				found = true;
				break;
			}
		}
		if (!found) {
			System.out.println(":(");
		}

		r.close();
	}
}

Measured memory_bytes: 21588
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a+b+c >= 22) cout << "bust" << endl;
    else{
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int n,i,ai,max,min;

  double sum;

  sum=0.0;

  max=-1000000;

  min=1000000;

  scanf("%d",&n);

  for(i=0;i<n;i++){

  scanf("%d",&ai);

  if(ai<min){   min=ai;

  }

  if(max<ai){

  max=ai;

  }

  sum=sum+ai;

  }

  printf("%d %d %.0lf\n",min,max,sum);

  return 0;

 }
 

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

int main() {
	char a;
	cin >> a;
	switch (a)
	{
	case 'A':
		cout << 'T';
		break;
	case 'T':
		cout << 'A';
		break;
	case 'G':
		cout << 'C';
		break;
	case 'C':
		cout << 'G';
		break;
	default:
		break;
	}
}

Measured memory_bytes: 256
package main

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

func main() {
	r := readFloat64()

	fmt.Println(2 * r * math.Pi)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 1752
import java.util.Scanner;
     
    public class Main {
    	public static void main (String[] args) {
    		Scanner sc = new Scanner(System.in);
    		
    		int N = sc.nextInt();
    		
    		if (N % 2 == 0) {
    			System.out.println(N);
    		} else {
    			System.out.println(N * 2);
    		}
    		
    		
    	}
    }

Measured memory_bytes: 23380
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
int main(int argc, char** args)
{
    char str[30];
    unsigned long maxVal=0;
    unsigned long maxPos=0;
    unsigned long pos=0,val=0;
    unsigned long n=0;
    unsigned long result=0;
    memset(str,'\0',sizeof(str));
    
    fgets( str,sizeof(str), stdin);
    n=atol(str);
    
    for( int i=0; i<n; i++ )
    {
        fgets( str,sizeof(str), stdin);
        pos=atol(strtok(str," "));
        val=atol(strtok(NULL," "));
        if( maxPos<pos )
        {
            maxPos=pos;
            maxVal=val;
        }
    }
    result=maxPos+maxVal;
    printf("%ld\n",result);
    fflush(stdout);
}


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

using namespace std;
using ll = long long;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main() {
  int n;
  ll x;
  cin >> n >> x;
  vector<ll> v(n);
  for (int i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    v[i] = abs(a - x);
  }
  ll ans = v[0];
  for (int i = 1; i < n; ++i) {
    ans = gcd(ans, v[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*; 
import java.lang.*; 

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int Z = scan.nextInt();
		
		System.out.println(Z);
		System.out.println(X);
		System.out.println(Y);		
	}
}

Measured memory_bytes: 23124
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = getLine >>= putStrLn . which "Yes" "No" . elem '7'

Measured memory_bytes: 3736
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define P pair<int, int>
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define int long long

signed main() {
  int H, W;
  while(cin >>H >>W && H){
    int T = H * H + W * W;
    int ansh = 200, answ = 200, anst = 40000;
    FOR(h, 1, 200){
      FOR(w, h + 1, 200){
        int t = h * h + w * w;
        if(t < T || (t == T && h <= H)) continue;
        if(t < anst || (t == anst && h < ansh)){
          anst = t;
          ansh = h;
          answ = w;
        }
      }
    }
    cout <<ansh <<" " <<answ <<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
# ABC142D - Disjoint Set of Common Divisors
def divisors(n: int) -> set:
    div = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            div.add(i), div.add(n // i)
    return div


def main():
    A, B = map(int, input().split())
    divs = sorted(divisors(A) & divisors(B))
    divs.pop(0)
    groups = set()
    for i in divs:
        if all(i % x for x in groups):
            groups.add(i)
    ans = len(groups) + 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 5120
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)


signed main(){
    int n,p;
    cin>>n>>p;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    int dp[10000]={};
    dp[0] = 1;
    
    rep(i,n){
        for(int j=6000;j>=0;j--){
            dp[j+v[i]] += dp[j];
        }
    }
    
    int sum = 0;
    rep(i,6000){
        if(i%2==p && dp[i])sum+=dp[i];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 384