akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long c = Long.parseLong(sa[1]);
		long[] x = new long[n + 2];
		long[] v = new long[n + 2];
		for (int i = 1; i <= n; i++) {
			sa = br.readLine().split(" ");
			x[i] = Long.parseLong(sa[0]);
			v[i] = Long.parseLong(sa[1]);
		}
		x[n + 1] = c;
		br.close();

		long[] maxR = new long[n + 1];
		long val = 0;
		for (int i = 1; i <= n; i++) {
			val -= x[i] - x[i - 1];
			val += v[i];
			maxR[i] = Math.max(val, maxR[i - 1]);
		}

		val = 0;
		long ansR = maxR[n];
		for (int i = n; i >= 1; i--) {
			val -= (x[i + 1] - x[i]) * 2;
			val += v[i];
			ansR = Math.max(ansR, val + maxR[i - 1]);
		}

		long[] maxL = new long[n + 2];
		val = 0;
		for (int i = n; i >= 1; i--) {
			val -= x[i + 1] - x[i];
			val += v[i];
			maxL[i] = Math.max(val, maxL[i + 1]);
		}

		val = 0;
		long ansL = maxL[1];
		for (int i = 1; i <= n; i++) {
			val -= (x[i] - x[i - 1]) * 2;
			val += v[i];
			ansL = Math.max(ansL, val + maxL[i + 1]);
		}
		System.out.println(Math.max(ansR, ansL));
	}
}


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


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

    sort(a,a + N);

    long nnum[N+1];
    for(int i=0;i<=N;i++) nnum[i] = 0;

    long cont=1;
    for(int i=0;i<N-1;i++){
        if(a[i] != a[i+1]){
            nnum[a[i]] = cont;
            cont = 0;
        }
        cont++;
        if(i==N-2) nnum[a[N-1]]=cont;
    }

    long npicknum[N+1];
    for(int i=0;i<=N;i++) npicknum[i] = 0;
    
    long long tot=0;
    for(int i=1;i<=N;i++){
        npicknum[i] = nnum[i]*(nnum[i]-1)/2;
        tot += npicknum[i];
    }

    for(int i=0;i<N;i++){
        cout << tot - (nnum[ac[i]]*(nnum[ac[i]]-1)/2) + ((nnum[ac[i]]-1)*(nnum[ac[i]]-2)/2) << endl;
    }
}


Measured memory_bytes: 8832
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = null;
		try {
			scanner = new Scanner(System.in);
			execute(scanner);
		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private static void execute(Scanner scanner) {
		String s = scanner.nextLine();
		int count = 0;
		for (StringBuilder stringBuilder = new StringBuilder(s); stringBuilder.length() > 1;) {
			int end = stringBuilder.length() - 1;
			if (stringBuilder.charAt(0) == stringBuilder.charAt(end)) {
				stringBuilder.deleteCharAt(end).deleteCharAt(0);
				continue;
			}
			if (stringBuilder.charAt(0) == 'x') {
				stringBuilder.deleteCharAt(0);
				count++;
				continue;
			}
			if (stringBuilder.charAt(end) == 'x') {
				stringBuilder.deleteCharAt(end);
				count++;
				continue;
			}
			count = -1;
			break;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 28348
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N,M; cin >> N >> M;
    VI A(M);
    LL acc = 0;
    REP(i,M){
        cin >> A[i];
        acc += A[i];
    }
    if(acc > N) cout << -1 << endl;
    else cout << N-acc << endl;
    

}


Measured memory_bytes: 3700
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    char s;
    cin>>s;
    if(s=='A')cout<<"T"<<endl;
    else if(s=='T')cout<<"A"<<endl;
    else if(s=='C')cout<<"G"<<endl;
    else cout<<"C"<<endl;

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string yesno(bool ans){
  return (ans?"YES":"NO");
}
int main() {
  int r,g,b;cin>>r>>g>>b;
  int ans=r*100+g*10+b;
  cout<<yesno(ans%4==0)<<endl;
  return 0;
}


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

using namespace std;

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

using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

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

    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= m; ++j){
            if((n-i)*j + (m-j)*i == k){
                Yes();
                return 0;
            }
        }
    }

    No();

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2010,M=2e5+10;
struct node{int to,num;};
vector<node>v[N];
int n,m,ans[M][2],num[N],q[M*10];
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
        {int x,y;scanf("%d%d",&x,&y);v[x].push_back((node){y,i});}
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)num[j]=0;
        int hd=1,tl=0;
        for(int j=0;j<v[i].size();j++)
            num[v[i][j].to]=v[i][j].num,q[++tl]=v[i][j].to;
        while(hd<=tl)
        {
            int s1=q[hd++],z=num[s1];
            for(int j=0;j<v[s1].size();j++)
            {
                int s2=v[s1][j].to;
                if(s2==i)ans[v[s1][j].num][0]=1;
                else if(num[s2]!=-1)
                {
                    if(!num[s2])num[s2]=z,q[++tl]=s2;
                    else if(num[s2]!=z)num[s2]=-1,q[++tl]=s2;
                }
            }
        }
        for(int j=0;j<v[i].size();j++)
            ans[v[i][j].num][1]|=num[v[i][j].to]==-1;
    }
    for(int i=1;i<=m;i++)printf("%s\n",ans[i][0]==ans[i][1]?"same":"diff");
}


Measured memory_bytes: 7552
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int a,b,c,d;
		Scanner scan = new Scanner(System.in);

	    a= Integer.parseInt(scan.next());
	 
	    b= Integer.parseInt(scan.next());
	    
	    c=a*b;
	    d=a*2+b*2;
	    System.out.println(c+" "+d);

	}

}

Measured memory_bytes: 25980
N,T = list(map(int,input().split()))

A =[list(map(int,input().split())) for i in range(N)]

A.sort(key = lambda x:x[0])

INF = float("inf")

DP = [[-INF]*(T+3001) for i in range(N+1)]

DP[0][0] = 0

for i in range(N):
    for j in range(T):
        DP[i+1][j] = max(DP[i+1][j],DP[i][j])
        DP[i+1][j+A[i][0]] = max(DP[i+1][j+A[i][0]],DP[i][j+A[i][0]],DP[i][j]+A[i][1])
score = 0
for i in range(N):
    for j in range(T+A[i][0]):
        score = DP[i+1][j] if DP[i+1][j]>score else score

print(score)

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


const int MOD = 1e9+7;

//xのn乗
ll mod_pow(ll x, ll n) {// O(log(n))
    ll res = 1;
    while (n > 0) {//繰り返し二乗法
        if (n & 1) res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}

int main(){
  int n;
  cin>>n;
  ll ans=mod_pow(10,n)%MOD-(2*mod_pow(9,n)%MOD-mod_pow(8,n)%MOD)%MOD;
  if(ans<0) ans+=MOD;
  cout<<ans<<endl;

}

Measured memory_bytes: 3632
def resolve():
    from scipy.sparse.csgraph import shortest_path
    import scipy
    import numpy as numpy
    n, m = map(int, input().split())
    row = [None] * m
    col = row[:]
    data = row[:]
    for i in range(m):
        row[i], col[i], data[i] = map(int, input().split())
        row[i] -= 1
        col[i] -= 1
    a = scipy.sparse.csr_matrix((data, (row, col)), shape=(n, n)).toarray()
    s, p = shortest_path(a, return_predecessors=True, directed=False)
    l = [[True] * n for _ in range(n)]
    for start in range(n - 1):
        for goal in range(start + 1, n):
            path = get_path(start, goal, p)
            for i in range(len(path) - 1):
                l[path[i]][path[i + 1]] = False
                l[path[i + 1]][path[i]] = False
    ans = 0
    for i, j in zip(row, col):
        if l[i][j]:
            ans += 1
    print(ans)


def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])


def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]


resolve()


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

int main(){
	long long a,b,x;
	cin >> a >> b >> x;
	a--;
	long long ans=(b/x+1)-(a/x+1);
	if(a<0)ans=b/x+1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//According to all known laws of aviation, there is no way that a bee should be able to fly.
 //Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
 //Because bees don't care what humans think is impossible.
 #include <bits/stdc++.h>
 #define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 #define mod 1000000007
 #define endl "\n"
 using namespace std ;
 using bigint = long long int ;
 using vi = vector<int> ;
 bigint arr[300011] ;

 int main(){
     bigint A , B ; cin >> A >> B ;
     bigint G = gcd( A , B ) ;
     bigint ans = 1 ;
     for( bigint i = 2 ; i * i <= G ; i++ ){
         if( G % i == 0 ){
         while( G % i == 0 ){
             G /= i ;
            }
             ans++ ;
         }
     }
     if( G > 1 )
         ans++ ;
     cout << ans << endl ;
     return 0 ;
 }


Measured memory_bytes: 3636
/// 23-01-2018
/// MD:NUR ALAM
/// Eastern University of Bangladesh

#include "bits/stdc++.h"

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rep(i, N) for (int i = 0; i < (N); ++i)
#define repp(i, a, b) for (int i = (a); i < (b); ++i)
#define fo(i, a, b) for (int i = (a); i <(b); ++i)
#define fors(i, s) for (int i = 0; s[i]; ++i)
#define rs(x) scanf("%s", (x))
#define mp make_pair
#define pb push_back
#define mso(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)

using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef long double lu;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<pii> vpll;
typedef pair<ll,ll> Pll;
typedef map<string,int>msi;
typedef set<ll>se;

template<class t> void _r(t &x) { cin >> x; }
void _r(int &x) { scanf("%d", &x); }
void _r(int64_t &x) { scanf("%lld", &x); }
void _r(double &x) { scanf("%lf", &x); }
void _r(char &x) { scanf(" %c", &x); }
void _r(char *x) { scanf("%s", x); }
void r() {}
template<class t, class... u> void r(t &head, u &... tail) { _r(head); r(tail...); }
template<class t> void _w(const t &x) { cout << x; }
void _w(const int &x) { printf("%d", x); }
void _w(const int64_t &x) { printf("%lld", x); }
void _w(const double &x) { printf("%.16f", x); }
void _w(const char &x) { putchar(x); }
void _w(const char *x) { printf("%s", x); }
template<class t,class u> void _w(const pair<t,u> &x) {_w(x.f); putchar(' '); _w(x.s);}
void w() {}
template<class t, class... u> void w(const t &head, const u &... tail) { _w(head); putchar(sizeof...(tail) ? ' ' : '\n'); w(tail...); }
template<class t, class... u> void debug(const t &head, const u &... tail) {
#ifdef HOME
#endif
}

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

int main(){

    int n;
    r(n);
    w(48-n);
}


Measured memory_bytes: 256
/*
  AUTHOR:SOURABH
  CREATED:09:02:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

ll fact[2000010];
ll inv_fact[2000010];

ll modex(ll x,ll y)
{
    x=x%mod;
    ll r=1;
    while(y>0)
    {
        if(y%2==1)
            r=(r*x)%mod;
        y/=2;
        x=(x*x)%mod;
    }
    return r;
}

ll mm(ll x,ll y)
{
    x=x%mod;
    y=y%mod;
    return (x*y)%mod;
}

void build(void)
{
    fact[0]=1;
    ll i;
    fs(i,1,2000010)
    {
        fact[i]=mm(fact[i-1],i);
    }
    inv_fact[2000009]=modex(fact[2000009],mod-2);
    fr(i,2000008)
    {
        inv_fact[i]=mm(inv_fact[i+1],i+1);
    }
}

ll C(ll n,ll r)
{
    if(n<r)
        return 0;
    ll res=fact[n];
    res=mm(res,inv_fact[n-r]);
    res=mm(res,inv_fact[r]);
    return res;
}

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

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll t,r1,c1,r2,c2,ans,i;
    build();
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>r1>>c1>>r2>>c2;
        ans=0;
        fs(i,r1,r2+1)
        {
            ans=(ans+(C(i+1+c2,c2)-C(i+c1,c1-1)+mod)%mod)%mod;
            //cout<<ans<<endl;
        }
        cout<<ans<<"\n";
    }
    return 0;
}






























Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
	
	int k;
	string s;
	cin >> k;
	cin >> s;
	if ((int)s.size() > k)
		cout << s.substr(0, k) << "...\n";
	else
		cout << s << "\n";
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(ll i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 62;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T, class U> inline bool chmin(T& a, const U& b){ if(a > b){ a = b; return 1; } return 0; }
template<class T, class U> inline bool chmax(T& a, const U& b){ if(a < b){ a = b; return 1; } return 0; }
template<class T, class U> inline bool change(T& a,U& b){if(a > b){swap(a,b);return 1;}return 0;}
template<class T>
T gcd(T a,T b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
template<class T>
T lcm(T a,T b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
template<class T>
inline bool isp(T n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
vector<ll> fac(cmax),finv(cmax),inv(cmax);

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if(fac[0] == 0)COMinit();
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}
int amari(ll n){
    return abs(n) % 2;
}
int shou(ll n){
    if(n < 0){
        return (-n + 1) / 2;
    }
    else{
        return -(n / 2);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll N;
    cin >> N;
    if(N == 0){
        cout << "0\n";
        return 0;
    }
    vector<int> ans;
    while(1){
        if(N == 1){
            ans.emplace_back(1);
            break;
        }
        ans.emplace_back(amari(N));
        N = shou(N);
    }
    reverse(all(ans));
    rep(i,ans.size()){
        cout << ans[i];
    }
    cout << "\n";
}

Measured memory_bytes: 26508
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b) cout << c << endl;
  else if(b == c) cout << a << endl;
  else cout << b << endl;
}

Measured memory_bytes: 3620
<?php
    fscanf(STDIN, "%d", $N);

    define('MOD', pow(10,9) + 7);

    $p = array();

    for ($i = 2; $i <= 1000; $i++) {
        $p[$i] = 1;
    }

    for ($i = 2; $i <= 1000; $i++) {
        if ($p[$i] == 1) {
            $loop = 1000 / $i;
            for ($j = 2; $j <= $loop; $j++) {
                $p[$i*$j] = 0;
            }
        }
    }

    // for ($i = 2; $i < 1000; $i++) {
    //     if ($p[$i]) echo $i . PHP_EOL;
    // }

    for ($i = $N; $i > 1; $i--) {
        $tmp = $i;
        for ($j = 2; $j <= $i; $j++) {
            if ($p[$j] == 0) continue;
            while ($tmp % $j == 0) {
                // echo $tmp . " " . $j . " ";
                $sum[$j]++;
                $tmp /= $j;
            }
        }
    }

    // var_dump($sum);

    $ans = 1;

    if (is_array($sum)) {
        foreach ($sum as $v) {
            $ans *= ($v + 1);
            $ans %= MOD;
        }        
    }

    echo $ans . PHP_EOL;
    

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
  int n,i;
  int a=0;
  scanf("%d",&n);
 
  for(i=0;i<3;i++){
    if(n%10==7){
      a=1;
    }
    n=n/10;
  }
  if(a==1)
    printf("Yes");
  else 
    printf("No");
  return 0;
}

Measured memory_bytes: 1724
import java.util.Scanner;
import java.util.*;
 class Main{
public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
if(Math.abs(num1 + num2) % 2 ==0 || num1 - num2 ==0 ){
        System.out.println(Math.abs(num1 + num2) / 2);
}else{
  System.out.println("IMPOSSIBLE");
}
}
}



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

using namespace std;

using ll = long long;

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

    ll n;
    cin >> n;

    ll T = 1, A = 1;
    for (int i = 0; i < n; ++i) {
        ll a, b;
        cin >> a >> b;

        ll n = max((T + a - 1) / a, (A + b - 1) / b);
        T = n * a;
        A = n * b;
    }

    cout << T + A << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int f[20][20];
char num[25];
int main(){
	int n,i,j,k,cnt2,cnt5;
	long long ans=0,x,y;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",num);
		int m=strlen(num),p=0;
		
		x=0ll;
		for(j=0;j<m;j++)
		{
			if(num[j]=='.')
				p=m-j-1;
			else
			x=x*10+num[j]-'0';
		}
		for(j=p+1;j<=9;j++)
			x*=10;
		
		y=x;
		cnt2=cnt5=0;
		while(y%2==0)
		{
			cnt2++;
			y>>=1;
			if(cnt2==18)
				break ;
		}
		while(y%5==0)
		{
			cnt5++;
			y/=5;
			if(cnt5==18)
				break ;
		}
		
		for(j=0;j<=18;j++)
		{
			for(k=0;k<=18;k++)
			{
				if(min(cnt2+j,cnt5+k)>=18)
					ans+=f[j][k];
			}
		}
		f[cnt2][cnt5]++;
	}
	cout<<ans<<endl;
}
/*

*/


Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <cassert>
#include <iomanip>
#include <atcoder/all>
using namespace atcoder;
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
  ll T;scanf("%lld", &T);
  for(int i=0;i<T;i++){
    ll a, b, c, d;scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    printf("%lld\n", floor_sum(a, b, c, d));
  }
}



Measured memory_bytes: 3836
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int cmpAsc(const void* a, const void* b){
    int x = *(int*)a, y = *(int*)b;
    if(x > y){
        return 1;
    }
    if(x < y){
        return -1;
    }
    return 0;
}

int main(){
    int n;
    scanf("%d", &n);
    int x[n], y[n];
    rep(i, 0, n){
        scanf("%d", &x[i]);
        y[i] = x[i];
    }
    qsort(y, n, sizeof(int), cmpAsc);
    int m = (n-1)/2;
    rep(i, 0, n){
        if(x[i] <= y[m]){
            printf("%d\n", y[m+1]);
        }else{
            printf("%d\n", y[m]);
        }
    }

    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define endl '\n'
const long long inf = 1e17;

void solvetask(){
    long long n,m,l; cin >> n >> m >> l;
    vector<vector<long long>> a(n+1, vector<long long>(n+1, inf)), ans;
    ans = a;
    for (int i=0; i<m; i++){
        int u,v,c; cin >> u >> v >> c;
        a[u][v] = a[v][u] = c;
    } 
    for (int k=1; k<=n; k++){
        for (int i=1; i<=n; i++){
            for (int j=1; j<=n; j++){
                a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
            }
        }
    }
    for (int i=1; i<=n; i++){
        for (int j=1; j<=n; j++){
            if (a[i][j] <= l) ans[i][j] = 0;
        }
    }
    for (int k=1; k<=n; k++){
        for (int i=1; i<=n; i++){
            for (int j=1; j<=n; j++){
                ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j] + 1);
            }
        }
    }
    int q; cin >> q;
    while(q--){
        int i,j; cin >> i >> j;
        cout << (ans[i][j] == inf ? -1 : ans[i][j]) << endl;
    }
}
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t=1; //cin >> t;
    while(t--) solvetask();
}

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

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> A(Q);
    vector<int> scores(N+1);
    for(int i=1;i<=N;i++) {
        scores[i] = K-Q;
    }
    for(int i=1;i<=Q;i++) {
        cin >> A[i];
    }
    for(int i=1;i<=Q;i++) {
        scores[A[i]]++;
    }
    for(int i=1;i<=N;i++) {
        if(scores[i]<=0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

int main() {
    int N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    for (int i = 0; i < N; i++) cin >> w[i] >> v[i];
    
    ll inf = 1e18;
    vector<ll> dp(100001, inf);
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 100000; j >= v[i]; j--) {
            dp[j] = min(dp[j], dp[j-v[i]]+w[i]);
        }
    }
    ll ans = 0;
    for (int i = 0; i <= 100000; i++) {
        if (dp[i] <= W) ans = max(ans, (ll)i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

int main()
{
    int A,B;
    cin >> A >> B;
    cout << A*B << endl;
    return 0;
}

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

int main()
{
	int n, m;
	while (cin >> n >> m, n) {
		vector<int> v1(n), v2(m);
		int sum1 = 0, sum2 = 0;
		for (int i = 0;i < n; i++) {
			cin >> v1[i];
			sum1 += v1[i];
		}
		for (int i = 0;i < m; i++) {
			cin >> v2[i];
			sum2 += v2[i];
		}
		sort(v1.begin(), v1.end());
		sort(v2.begin(), v2.end());
		int r1 = -1, r2;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (sum1-v1[i]+v2[j] == sum2+v1[i]-v2[j]) {
					r1 = v1[i];
					r2 = v2[j];
					break;
				}
			}
			if (r1 != -1) break;
		}
		if (r1 == -1) cout << -1 << endl;
		else cout << r1 << " " << r2 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

int main() {
  long long X;
  std::cin >> X;
  long long cur = 100;
  int ans = 0;
  while (cur < X) {
    ++ans;
    cur += cur / 100;
  }
  std::cout << ans << '\n';
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

map<pi, int> MAP;
vector<int> adj[100010];
int t[100010];
int Max=0;

void dfs(int now, int par, int color)
{
    int nuri = 1;
    for(auto u:adj[now]){
        if (u==par) continue;
        if (nuri==color) nuri++;
        int idx = MAP[mp(now, u)];
        t[idx] = nuri;
        Max = max(Max, nuri);
        dfs(u,now,nuri);
        nuri++;
    }
}

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

    rep(i, n-1){
        int a, b; cin>>a>>b;
        MAP[mp(a, b)] = i;
        MAP[mp(b, a)] = i;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    dfs(1,0,0);
    cout << Max << endl;
    rep(i, n-1){
        cout << t[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 19328
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
  int out=0;
  cin>>a>>b>>c;
  int div=0;
   div = c/a;
   out = b*div;
  //住所は、安城市　篠目町4丁目9－1　です。
  /*
  残念ながら、自宅には車がとめられません。
駐車は、篠目公園(ささめこうえん)にお願いします。添付参照。
500ｍくらいです。歩いても数分ですが、連絡もらえれば迎えにいきます。
公園の東南部に10台くらいとめられます。
いっぱいの場合は公園の東側の道路に路上駐車している人が多いです。

バローの方が近いですが、21時で店が終了です。
閉鎖はされないので、遅くなっても出られますが、おススメはしません。
昼間に打つようなことがある場合はよいと思います。

  */
  cout<<out<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}




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

  ll N ;cin >> N ;
  ll K ; cin >> K;

  ll ans = 0;
  rep(i,N){
    ll x ; cin >> x;
    ans += min( x, abs(x-K));
  }

  cout << ans*2 << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  
  return 0;
}


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

using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> da(n);
    int k=0;
    for(int i=0;i<n;i++){
        cin >> da[i];
        k=max(k,da[i]);
    }
    vector<int> c(k+1);
    for(int i=0;i<n;i++){
        c[da[i]]++;
    }
    vector<int> ans(n,-1);
    for(int i=0;i<k;i++){
        c[i+1]=c[i]+c[i+1];
    }
    for(int i=n-1;i>-1;i--){
        ans[c[da[i]]-1]=da[i];
        c[da[i]]--;
    }
    for(int i=0;i<n;i++){
        if(i==n-1){
            cout <<ans[i] << endl;
        }
        else{
            cout <<ans[i] << ' ';
        }
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n ;
    cin >> n ;
    ll ans = 0 ;
    ll a, b ;
    REP(i,n){
        cin >> a ;
        if(i==0){
            ans += a/2 ;
            b = a%2 ;
            continue ;
        }
        if(a==0){
            b = 0 ;
            continue ;
        }
        ans += b ;
        a -= b ;
        ans += a/2 ;
        b = a%2 ;
    }
    
    cout << ans << endl ;
    

    return 0;
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch=='A')return 1;
  else if(ch=='C')return 2;
  else if(ch=='G')return 3;
  else if(ch=='T')return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return 1+(key%(M-1)); }

int find(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if( strcmp(H[h],str) == 0 )return 1;
    else if( strlen(H[h]) == 0 )return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++)H[i][0]='\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);

    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)){
	printf("yes\n");
      }else{
	printf("no\n");
      }
    }
  }
  return 0;
}


Measured memory_bytes: 16100
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int ans;
  if(a!=b&&b==c){ans=2;}
  else if(a==b&&b!=c){ans=2;}
  else if(a==c&&b!=c){ans=2;}
  else if(a==b&&a==c){ans=1;}
  else{ans=3;}
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
constexpr i64 MOD = 1e9 + 7;

map<int, int> cnt;

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int k = i;

        while (k > 1) {
            int ok = 0;
            for (int j = 2; j * j <= k; j++) {
                if (k % j == 0) {
                    ok = 1;
                    int c = 0;
                    while (k % j == 0) {
                        k /= j;
                        c++;
                    }
                    cnt[j] += c;
                    break; 
                }
            }
            if (!ok) {
                cnt[k] += 1;
                k /= k;
            }
        }
    }

    i64 ans = 1;
    for (auto& p: cnt) {
        ans *= p.second + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
#include <iomanip>
#include <map>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Graph = vector<vector<T>>;

void printFixedDouble(double d, int fix) {
    cout << std::fixed;
    cout << std::setprecision(fix) << d << endl;
}

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

    int fibonatti[45];

    fibonatti[0] = 1;
    fibonatti[1] = 1;
    for (int i = 2; i <= n; i++) {
        fibonatti[i] = fibonatti[i - 1] + fibonatti[i - 2];
    }

    cout << fibonatti[n] << endl;

}


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

vector<int> C(10010010);
int n;

void CountingSortx(vector<int> &A, vector<int> &B, int k){
    rep(i, k+1){
        C[i] = 0;
    }

    for (int i = 1; i <= n; i++){
        C[A[i]]++;
    }

    for (int i = 1; i <= k; i++){
        C[i] = C[i] + C[i-1];
    }

    for (int i = n; i > 0; i--){
        B[C[A[i]]] = A[i];
        C[A[i]]--;
    }
}

int main() {
    cin >> n;
    vector<int> A(n+1), B(n+1);
    for (int i = 1; i <= n ; i++){
        cin >> A[i];
    }

    CountingSortx(A, B, 10000);
    
    for (int i = 1; i <= n ; i++){
        cout << B[i];
        if(i == n){
            cout << endl;
        } else {
            cout << " ";
        }
    }

    return 0;
}


Measured memory_bytes: 57352
#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
//階乗
 vll comb(51,vl(51,-1));
 ll search(ll n, ll k){
   if(n==k||k==0){
     comb[n][k]=1;
     return 1;
   }
   if(comb[n][k]!=-1){
     return comb[n][k];
   }else{
     comb[n][k]=search(n-1,k-1)+search(n-1,k);
     return comb[n][k];
   }
 }
ll Factrial(ll num){
  if(num==1||num==0){
    return 1;
  }else if(num<0){
    printf("ERROR_minus\n");
    return 0;
  }else{
    return num*Factrial(num-1);
  }
}
 
long long modinv(long long a, long long m) {//modの逆元
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

ll linercomb(ll n,ll k, ll mod){//n,kの線形時間で求める
  ll ans=1;
  if(n/2<k)k=n-k;
  for(ll i=n;i>=n-k+1;i--){
    ans*=i;
    //ans%=mod;
  }
  for(ll i=1;i<=k;i++){
    ans/=i;
  }
  return ans;
}
int main(void){
  ll n,a,b;
  cin>>n>>a>>b;
  vector<long long> v(n);
  rep(i,n)cin>>v[i];
  sort(v.begin(),v.end());
  ld tmp=0;
  for(int i=n-a-1+1;i<n;i++){
    tmp+=v[i];
  }
  ld a2 = a;
  ld tmp2=tmp;
  tmp2/=(long double)a;
  cout<<setprecision(30)<<tmp2<<endl;
  ll num2=0;
  for(int i=n-a-1+1;i<n;i++){
    if(v[n-a-1+1]==v[i]){
      num2++;
    }else{
      break;
    }
  }
  ll num=0;
  for(int i=n-a-1-1+1;i>=0;i--){
    if(v[i]==v[n-a-1-1]){
      num++;
    }else{
      break;
    }
  }
  if(v[n-1]!=v[n-1-a-1]){
    //cout<<num2<<" "<<num<<endl;
    cout<</* num1+numCnum1 */search(num2+num,num2)<<endl;
  }else{
    ll ans=0;
    for(ll i=a;i<=min(num2+num,b);i++){
      ans+=search(num2+num,i);
      //cout<<i<<" "<<num<<" "<<num2<<endl;
      //cout<<search(num2+num,i)<<endl;
    }
    cout<<ans<<endl;
  }
  return 0;
}


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

int main(){
  int n,u,k[100],ar[100][100],i;
  int l,s;
  cin>>n;
  int j;
  for(i=0;i<n;i++){
    cin>>u>>k[i];
    for(j=0;j<k[i];j++){
      cin>>ar[u][j];
    }
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      l=0;
      for(s=0;s<k[i-1];s++){
	if(j==ar[i][s]){
	  cout<<"1";
	  l=1;
	  break;
	}
      }       
      if(l==0)cout<<"0";
      if(j<n)cout<<" ";
    }
    cout<<endl;
  }

  return 0;
}



Measured memory_bytes: 3124
n,k = map(int,input().split())
t = [0] * n
for _ in range(k):
    d = int(input())
    l = list(map(int,input().split()))
    for x in l:
        t[x-1] += 1
ans = 0
for x in t:
    if x == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9192
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
using namespace std;
#define fr first
#define sc second
typedef pair<int,int> P;
int main(){
  int h,w;
  int mas[10][10000];
  while( cin >> h >> w , h ){
    for(int i = 0 ; i < h ; i++ ){
      for(int j = 0 ; j < w ; j++ ){
        cin >> mas[i][j];
      }
    }
    int ans = 0;
    for(int i = 0 ; i < (1 << h) ; i++ ){
      int sum = 0;
      for(int j = 0 ; j < w ; j++ ){
        int cnt = 0;
        for(int k = 0 ; k < h ; k++ ){
          cnt += mas[k][j]^(i>>k&1);
        }
        sum += max( h - cnt , cnt );
      }
      ans = max( sum , ans );
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1548
from collections import deque

S = deque(input())
Q = int(input())
flip = False # False: left side is the head
for i in range(Q):
  Query_i = list(map(str, input().split()))
  if Query_i[0]=='1':
    flip = not flip
  elif Query_i[1] == '1' and not flip:
    S.appendleft(Query_i[2])
  elif Query_i[1] == '1' and flip:
    S.append(Query_i[2])
  elif Query_i[1] == '2' and not flip:
    S.append(Query_i[2])
  elif Query_i[1] == '2' and flip:
    S.appendleft(Query_i[2])
if flip:
  S.reverse()
print(''.join(S))

Measured memory_bytes: 8692
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

aa = inputs[0][0]
pp = inputs[0][1]

# body
if $debugFlag
  p aa
  p pp
end

puts (aa*3 + pp)/2


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>constexpr bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>constexpr bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int INF = 1001001001;
constexpr long long LINF = 1001001001001001001ll;
constexpr int MOD = 1e9 + 7; //10^9
constexpr int EPS = 1e-9;
constexpr int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/


ll cnt(ll a,ll b,ll c){return b/c-a/c;}
#define int long long
signed main()
{
    int a,b,c,d; cin >> a >> b >> c >> d;
    ll e=lcm(c,d);
    a--;
    cout << b-a-cnt(a,b,c)-cnt(a,b,d)+cnt(a,b,e) << '\n';
}


Measured memory_bytes: 256
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
if s1 == 0:
  if s2 ==0 or s2 > 12:
    ans = 'NA'
  else:
    ans = 'YYMM'
elif s2 == 0:
  if s1 > 12:
    ans = 'NA'
  else:
    ans = 'MMYY'
elif s1 > 12 and s2 > 12:
  ans = 'NA'
elif s1 <= 12 and s2 <= 12:
  ans = 'AMBIGUOUS'
elif s1>12:
  ans = 'YYMM'
else:
  ans = 'MMYY'
print(ans)

Measured memory_bytes: 3064
using System;
using System.Linq;

static class Program
{
    static void Main()
    {
        var inputs = Console.ReadLine().Split(" ").Select(long.Parse).ToArray();
        var (a, b, c, d) = (inputs[0], inputs[1], inputs[2], inputs[3]);

        var candidates = new long[] { a * c, a * d, b * c, b * d };
        var answer = candidates.Max();
        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 28288
#include	<stdio.h>
int	main(void)
{
	int a,b,c;
	int n=0;

	scanf("%d %d %d",&a,&b,&c);
	
	while(a<=b){
		if(c%a==0){
			n++;
		}
		a++;
	}
	printf("%d\n",n);


	return	0;
}

Measured memory_bytes: 596
#include <iostream>
using namespace std;
typedef long long ll;
ll x;

int main(){
	cin >> x;
	if(x%11>6){
		cout << (x/11)*2 +2 << endl;
	}else if(x%11>0){
		cout << (x/11)*2 +1 << endl;
	}else{
		cout << (x/11)*2 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int r, c;
  cin >> r >> c;
  vector<vi> a(r);
  REP(i, r) {
    REP(j, c) {
      int aij;
      cin >> aij;
      a[i].push_back(aij);
    }
  }

  vi rsum(r, 0), csum(c, 0);
  int sum = 0;
  REP(i, r) {
    REP(j, c) {
      rsum[i] += a[i][j];
      csum[j] += a[i][j];
      sum += a[i][j];
    }
  }

  REP(i, r + 1) {
    if (i != r) {
      REP(j, c + 1) {
        if (j != c) {
          cout << a[i][j] << " ";
        } else {
          cout << rsum[i] << endl;
        }
      }
    } else {
      REP(j, c + 1) {
        if (j != c) {
          cout << csum[j] << " ";
        } else {
          cout << sum << endl;
        }
      }
    }
  }
}



Measured memory_bytes: 3104