akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <climits>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define in1(n) cin>>n;
#define in2(n, k) cin>>n>>k;
#define in3(n, k, s) cin>>n>>k>>s;
#define scn(t) scanf("%d", &t)
#define scnld(t) scanf("%ld", &t)
#define scnlld(t) scanf("%lld", &t)
#define scnc(t) scanf("%c", &t)
#define scns(t) scanf("%s", t)
#define scnf(t) scanf("%f", &t)
#define scnlf(t) scanf("%lf", &t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define nloop(i, j, k, in) for (int i = j; i < k; i += in)
#define rloop(i, j, k, in) for (int i = j; i >= k; i -= in)
#define rep(i, j) nloop(i, 0, j, 1)
#define rrep(i, j) rloop(i, j, 0, 1)
#define inar(n, a) \
    rep(i, n)\
        cin>>a[i];
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert(B <= A && A <= C)
#define MP make_pair
#define PB push_back
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)\
{\
return (a.second < b.second);\
}
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define fast  \
    ios_base::sync_with_stdio(false);\
    cin.tie(NULL);
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
const double pi = acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

int main()
{
    fast
    int n; string s;
    in2(n, s)
    int r = n-1, l = 0;
    int ans = 0;
    while(r > l){
        if(s[l] == 'W' && s[r] == 'R') l++, r--, ans++;
        else if(s[l] == 'W') r--;
        else if(s[r] == 'R') l++;
        else r--, l++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3768
import java.util.Scanner;

public class Main {
	static int[] subTreeSize;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int n = sc.nextInt();
		int x = sc.nextInt();
		int d = Math.abs(x - sc.nextInt());
		for (int i = 0; i < n - 1; i++) {
			int dif = Math.abs(x - sc.nextInt());
			d = gcd(d, dif);
		}
		
		System.out.println(d);
	}
	
	static int gcd(int x, int y) {
		if (y == 0)
			return x;
		return gcd(y, x % y);
	}
}


Measured memory_bytes: 46508
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int maxn=100000+10,mo=1000000007;
ll a[maxn],A,B;
int tree[maxn*4],f[maxn];
int i,j,k,l,r,t,n,m,ans;
void change(int p,int l,int r,int a,int b){
    if (l==r){
        (tree[p]+=b)%=mo;
        return;
    }
    int mid=(l+r)/2;
    if (a<=mid) change(p*2,l,mid,a,b);else change(p*2+1,mid+1,r,a,b);
    tree[p]=(tree[p*2]+tree[p*2+1])%mo;
}
int query(int p,int l,int r,int a,int b){
    if (a>b) return 0;
    if (l==a&&r==b) return tree[p];
    int mid=(l+r)/2;
    if (b<=mid) return query(p*2,l,mid,a,b);
    else if (a>mid) return query(p*2+1,mid+1,r,a,b);
    else return (query(p*2,l,mid,a,mid)+query(p*2+1,mid+1,r,mid+1,b))%mo;
}
int main(){
    scanf("%d%lld%lld",&n,&A,&B);
    if (A<B) swap(A,B);
    fo(i,1,n) scanf("%lld",&a[i]);
    a[0]=-A;
    a[n+1]=a[n]+A;
    f[0]=1;
    change(1,0,n,0,f[0]);
    l=0;r=0;
    fo(i,1,n+1){
        while (a[i]-a[r+1]>=A) r++;
        if (i>=2&&a[i-1]-a[i-2]<B) l=i-2;
        if (a[i]-a[i-1]>=A) f[i]=f[i-1];
        (f[i]+=query(1,0,n,l,min(i-2,r)))%=mo;
        if (i<=n&&a[i+1]-a[i-1]>=B) change(1,0,n,i,f[i]);
    }
    ans=f[n+1];
    (ans+=mo)%=mo;
    printf("%d\n",ans);
}


Measured memory_bytes: 2304
/*
 * Matheus Oliveira
 * 09:18:12 01/09/2019
 * d.cpp
*/
#include <bits/stdc++.h>
using namespace std;

#define EPS
#define INF
#define MAXN
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define debug(x) printf("%s: %d\n", #x, x);
#define debugarr(x, ini, fim) printf("%s: ", #x); for(int i = ini; i <= fim; i++) printf("%d%c", x[i], (i == fim) ? '\n' : ' ');

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

ll apsum(ll n) { return (n * (1 + n)) / 2LL; }

int main() {
	ll n;
	scanf("%lld", &n);
	printf("%lld\n", apsum(n-1LL));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    int cnt=0;
    while(true){
        if(a%2!=0 or b%2!=0 or c%2!=0){
            cout<<cnt<<endl;
            return 0;
        }
        if(a==b and b==c){
            cout<<"-1"<<endl;
            return 0;
        }
        int x,y,z;
        x=(b+c)/2;
        y=(a+c)/2;
        z=(a+b)/2;
        a=x;
        b=y;
        c=z;
        cnt++;
    }






    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pdd              pair<double, double>
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
 {
    return (a*b)/gcd(a, b);
 }
bool sortByVal(const pair<int, int> &a,
               const pair<int, int> &b)
{
    return (a.second < b.second);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
int main()
{
    fast;
    double i,j,n,c=0,d=0,e=0,f=0,m,sum=0,l;
    cin>>l;
    c=l/3.0;
    d=c*c*c;
    cout<<fixed<<setprecision(12)<<d;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
int t[100];
int cmp(int x,int y)
{
    if(x>y)
        return y;
    return x;
}
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    t[0]=a+b;
    t[1]=a+c;
    t[2]=b+c;
    printf("%d\n",cmp(t[0],cmp(t[1],t[2])));
    return 0;
}


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

#define ll long long
#define mod 1000000007
#define f(i, a, b) for (long long i = a; i < b; i++)
#define rep(i, a, b) for (long long i = a; i <= b; i++)
#define fm(i, a, b) for (long long i = a; i > b; i--)
#define repm(i, a, b) for (long long i = a; i >= b; i--)
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define pqmaxi priority_queue<int>
#define pqmaxl priority_queue<ll>
#define pqmini priority_queue<int, vi, greater<int>>
#define pqminl priority_queue<ll, vl, greater<ll>>
#define all(x) x.begin(), x.end()
#define test     \
    ll test;     \
    cin >> test; \
    while (test--)
#define pb(i) push_back(i)
#define mp(i, j) make_pair(i, j)
#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL)

int main()
{
    fast;
    ll n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    ll s1 = a + b;
    ll yc = 0;
    ll ycb = 0;
    ll len = s.length();
    f(i, 0, len)
    {
        if (s[i] == 'a')
        {
            if (yc < s1)
            {
                cout << "Yes\n";
                yc++;
            }
            else
            {
                cout << "No\n";
            }
        }
        else if (s[i] == 'b')
        {
            ycb++;
            if (yc < s1)
            {
                if (ycb <= b)
                {
                    cout << "Yes\n";
                    yc++;
                }
                else
                {
                    cout << "No\n";
                }
            }
            else
            {
                cout << "No\n";
            }
        }
        else
        {
            cout << "No\n";
        }
    }
}

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

#define INF (1<<18)



int main() {
    ll x,y;
    cin>>x>>y;

    ll ans = 0;
    ll temp = x;

    while(temp <= y){
        temp *= 2;
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[1]*n
for _ in range(m):
    a,b=map(int,input().split())
    if h[a-1]==h[b-1]:
        l[a-1]=0
        l[b-1]=0
    elif h[a-1]>h[b-1]:
        l[b-1]=0
    else:l[a-1]=0    
print(sum(l)) 

Measured memory_bytes: 19968
#include<stdio.h>
int main(void)
{
  char s[200001];
  int flag=0,i,count,max=0;
  scanf("%s",s);

  while(s[i]!='\0'){
    if(s[i]=='A' && flag==0){
      count=0;
      flag=1;
    }
    count++;
    if(s[i]=='Z'){
      if(max<count){
	max=count;
      }
    }
    i++;
  }
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 384
//https://atcoder.jp/contests/abc139/tasks/abc139_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    string s; cin>>s;
    string t; cin>>t;
    ll ans=0;
    REP(i,s.size()){
        if(s[i]==t[i])++ans;
    }    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b){
        if(a==0&&b==0)
            break;
        for(int i=0;i<a;i++)
            {
            for(int j=0;j<b;j++)
                {cout<<"#";}
                cout<<endl;
            }
            cout<<endl;

    }
    return 0;
}


Measured memory_bytes: 3044
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <climits>
#include <ctype.h>
using namespace std;

#define PI acos(-1.0)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second

#define eps 1e-8
#define mod 1000000007

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> vvi;

struct Matrix {
    vvi data;
    int r, c;
    Matrix(int row, int col, bool identity = false) : r(row), c(col) {
        data.assign(row, vector<int>(col, 0));
        if (identity) {
            for (int i = 0; i < r; ++i) {
                data[i][i] = 1;
            }
        }
    }
    Matrix operator * (Matrix& other) {
        int m = r, n = c, p = other.c;
        Matrix res(m, p);
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < p; ++j) {
                for (int k = 0; k < n; ++k) {
                    res.data[i][j] += data[i][k] * other.data[k][j];
                }
            }
        }
        return res;
    }
};

// 扩展欧几里得算法 res[1] * a + res[2] * b = res[0] = gcd(a, b)
vector<int> extendGcd(int a, int b) {
    if (b == 0) {
        return {a, 1, 0};
    } else {
        vector<int> tmp = extendGcd(b, a % b);
        return {tmp[0], tmp[2], tmp[1] - (a / b) * tmp[2]};
    }
}

// 矩阵快速幂
Matrix matrix_power(Matrix base, ll exp) {
    int n = base.r;
    Matrix res(n, n, true);
    while (exp) {
        if (exp & 1) {
            res = res * base;
        }
        base = base * base;
        exp >>= 1;
    }
    return res;
}

// 带模快速幂
ll power_mod(ll base, int exp) {
    ll res = 1;
    while (exp) {
        if (exp & 1) res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

// 快速幂
ll power(ll base, int exp) {
    ll res = 1;
    while (exp) {
        if (exp & 1) res *= base;
        base *= base;
        exp >>= 1;
    }
    return res;
}

// 求逆元
ll inv(ll a) {
    return power_mod(a, mod - 2);
}

#define MAXFAC 100010

ll fac[MAXFAC];

void initFac() {
    fac[0] = 1;
    for (int i = 1; i < MAXFAC; ++i) {
        fac[i] = i * fac[i - 1] % mod;
    }
}

ll Combine(ll a, ll b) {
    return (fac[a] * inv(fac[b]) % mod) * inv(fac[a - b]) % mod;
}

/******************************** template ********************************/
#define MAXN 2010
int q, h, s, d;
int n;

int main() {
    cin >> q >> h >> s >> d;
    cin >> n;
    int tmp = min(4 * q, min(2 * h, s));

    if (d < 2 * tmp) {
        ll res = 1LL * (n / 2) * d;
        if (n % 2) res += tmp;
        cout << res;
    } else {
        cout << 1LL * n * tmp;
    }

    return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	stack<char> ans;
	FOR(i,0,n){
		if(!ans.empty() && ans.top() != s[i]){
			ans.pop();
		}else{
			ans.push(s[i]);
		}
	}
	ANS(n - ans.size());
	return 0;
}


Measured memory_bytes: 512
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var r = Number(lines[0]);

 var ans = [];
 ans.push(Math.PI * r * r);
 ans.push(Math.PI * 2 * r);
  
 console.log(ans.join(' '));
 
});


Measured memory_bytes: 16480
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int arr[100]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
    int k;
    scanf("%d",&k);
    printf("%d",arr[k-1]);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define rep(i,a,b) for(int i=a;i<b;i++)
#define reprev(i,a,b) for(int i=b-1;i>=a;i--)
#define all(c) c.begin(),c.end()
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vin(a,n) vi a(n); rep(i,0,n) cin>>a[i];
#define vout(a,n) rep(i,0,n) cout<<a[i]<<" "; cout<<endl;
#define mapp map<int,int>
#define pb push_back
#define mp  make_pair
#define mod 1000000007
#define mod2 998244353
#define tr(container, it) \
for(auto it = container.begin(); it != container.end(); it++)
 
bool comps(const pair<int,int> &a, const pair<int,int> &b) {return (a.second<b.second);} 

int fac[100001];
int power(int x, unsigned int y)
{ 
    int temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
}

int powerp(int x, unsigned int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}

int binomialCoeff(int n, int k)
{  
    // Base Cases  
    if (k == 0 || k == n)  
        return 1;  
  
    // Recur  
    return binomialCoeff(n - 1, k - 1) +  
                binomialCoeff(n - 1, k);  
}
void precomp()
{ 
    fac[0] = 1; 
    for (int i=1 ; i<=100000; i++) 
        fac[i] = fac[i-1]*i%mod;
}
int modInverse(int n, int p) {return powerp(n, p-2, p);}
int nCrModPFermat(int n, int r, int p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r   
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 
signed main()
{
    
    IOS
    string s;
    cin>>s;
    if(s=="ABC") cout<<"ARC";
    else cout<<"ABC";
    return 0;
}

Measured memory_bytes: 3616
//  Created by Sengxian on 2017/6/3.
//  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 = 100000 + 3;
int n, a, b, h[MAX_N];

bool check(int x) {
	ll cnt = 0, t = (ll)b * x;
	for (int i = 0; i < n; ++i)
		if (h[i] > t) cnt += (h[i] - t + a - 1) / a;
	return cnt <= x;
}

int main() {
	n = readInt(), a = readInt(), b = readInt();
	for (int i = 0; i < n; ++i) h[i] = readInt();
	a -= b;
	int l = 0, r = 1e9;
	while (r - l > 1) {
		int mid = (l + r) / 2;
		if (check(mid)) r = mid;
		else l = mid;
	}
	printf("%d\n", r);
	
	return 0;
}


Measured memory_bytes: 640
unittest
{
	assert( [ "1 2 1 1" ].solve == 2 );
	assert( [ "3 5 -4 -2" ].solve == -6 );
	assert( [ "-1000000000 0 -1000000000 0" ].solve == 1000000000000000000 );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto a = 0L;
	auto b = 0L;
	auto c = 0L;
	auto d = 0L;
	input.front.formattedRead!"%s %s %s %s"( a, b, c, d );
	
	return max( a * c, a * d, b * c, b * d );
}


Measured memory_bytes: 2900
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  ll a, b;

  cin >> a >> b;

  ll ans = 0;
  while((ans-1)*(a-1) + a < b){
    ans++;
  }

  cout << ans << endl;

  return 0;
}


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

typedef long long ll;
int main() {
    while(true) {
        ll n, m;
        cin >> n >> m;
        if(!n && !m) break;
        vector<ll> v(n+1, 0);
        vector<ll> v2;
        for(int i=1;i<n+1;i++) cin >> v[i];
        for(int i=0;i<n+1;i++) {
            for(int j=i;j<n+1;j++) {
                v2.push_back(v[i]+v[j]);
            }
        }

        sort(v2.begin(), v2.end());
        ll ma = 0;
        for(int i=0;i<v2.size();i++) {
            vector<ll>::iterator itr = upper_bound(v2.begin(), v2.end(), m-v2[i]);
            int d = distance(v2.begin(), itr);
            if(d > 0) {
                ma = max<ll>(ma, v2[i]+v2[d-1]);
            }
        }
        cout << ma << endl;
    }
}

Measured memory_bytes: 10796
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x, y;
    cin >> x >> y;
    int ans = 1 << 30;
    if (x <= y) { ans = min(ans, y - x); }
    if (-x <= y) { ans = min(ans, 1 + y + x); }
    if (x <= -y) { ans = min(ans, 1 - y - x); }
    if (-x <= -y) { ans = min(ans, 2 + x - y); }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int a[3][3];
  for(int i = 0; i < 3; i++) {
    for(int j = 0; j < 3; j++){
      cin >> a[i][j];
    }
  }
  int n;
  cin >> n;
  vector<int> b(n);
  for(int i = 0; i < n; i++){
    cin >> b[i];
  }
  bool c[3][3] ;
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++) {
      c[i][j] = 0;
    }
  }
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(a[j][k] == b[i]){
          c[j][k] = true;
        }
      }
    }
  }
  bool ans;
  if(
    (c[0][0] && c[0][1] && c[0][2])
    || (c[1][0] && c[1][1] && c[1][2])
    || (c[2][0] && c[2][1] && c[2][2])
    || (c[0][0] && c[1][0] && c[2][0])
    || (c[0][1] && c[1][1] && c[2][1])
    || (c[0][2] && c[1][2] && c[2][2])
    || (c[0][0] && c[1][1] && c[2][2])
    || (c[2][0] && c[1][1] && c[0][2])
   ){
     cout << "Yes" << endl;
   }else{
     cout << "No" << endl;
   }
}

Measured memory_bytes: 256
//  Teamsix

// Sifat Ansary

#include<stdio.h>
#include <cstring>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<utility>
char a[9999999+99];
using namespace std;
int fact(int n)
{
    int i,k=1;

    for(i=1;i<=n;i++)
        k*=i;

    return k;
}

#define ll long long
#define MAX 10000000

int rep[100110];
int M = 0;
int find_rep(int x)
{
    if(rep[x]==x)
        return x;
    return /*rep[x]= */find_rep(rep[x]);
}

int x,y;
int main()
{

    int n,q,qq;

    cin>>n>>q;
    for(int i=0;i<n;i++)
        rep[i]=i;
    while(q--)
    {
        cin>>qq>>x>>y;
        if(qq==0)
        {
            int repu=find_rep(x);
            int repv=find_rep(y);

            rep[repu]=rep[repv];
          /*  for(int i=0;i<n;i++)
            {
                if(rep[i]==y)
                    rep[i]=x;
            }  */

        }
        else
        {
            if(find_rep(x)==find_rep(y))
            {
                cout<< "1"<<endl;
            }
            else
            {
                cout<< "0"<<endl;
                //rep[x]=x;
                //rep[y]=y;
            }


        }

    }



    return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define all(a) a.begin(),a.end()
#define endl '\n'
#define y1 y123123
#define int ll

using namespace std;

const int N = 3e3 + 3;
const int inf = 1e9 + 3;
const int md = 1e9 + 7;

int n;
int a[N];
long double b[N];

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

    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);

    b[1] = a[1];

    for(int i = 2; i <= n; ++i){
        b[i] = (a[i] + b[i - 1]) / 2.0;
    }

    cout << b[n];

}


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


int main() {
  int n;
  

  cin >> n;

  vector<int> p(n);
  for(int i = 0; i<n; i++){
    cin >> p.at(i);
  }

  int count = 0;
  for(int i = 0; i<n; i++){
    i = i;
    if(p.at(i) != i+1){
      
      count += 1;
    }
  }

  if(count == 0 || count == 2){
    cout << "YES" <<endl;
  }else{
    cout << "NO" << endl;
  }
}


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

int main(void){
	double x,y;

	while(cin>>x>>y){
		if(x < 35.5 && y < 71){
			cout<<"AAA\n";
		}
		else if(x < 37.5 && y < 77){
			cout<<"AA\n";
		}
		else if(x < 40 && y < 83){
			cout<<"A\n";
		}
		else if(x < 43 && y < 89){
			cout<<"B\n";
		}
		else if(x < 50 && y < 105){
			cout<<"C\n";
		}
		else if(x < 55 && y < 116){
			cout<<"D\n";
		}
		else if(x < 70 && y < 148){
			cout<<"E\n";
		}
		else{
			cout<<"NA\n";
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

template <class T>
void printArray(const vector<T>& a) {
  int n = a.size();
  for (int i = 0; i < n; i++) {
    cout << a[i] << " \n"[i == n - 1];
  }
}

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll sum = 0;
  REP(i, n) {
    cin >> a[i];
    sum ^= a[i];
  }
  vector<ll> ans;
  REP(i, n) { ans.push_back(sum ^ a[i]); }

  printArray(ans);
}

Measured memory_bytes: 6812
n = gets.strip.to_i

n.times.each do
  chs = gets.strip.gsub(/\-/, '').split("")

  train = []
  pos = -1

  for ch in chs
    case ch
      when '>'
      pos += 1
      when '<'
      pos -= 1
      else
      if pos < 0
        train.unshift ch
        pos += 1
      elsif pos >= train.length
        train.push ch
      elsif train[pos] != ch
        puts "train[#{pos}] != #{ch}"
      end
    end
  end

  puts train.join("")
end

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (size_t NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (size_t NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

bool dfs( int cur, int prev, int goal, int ban,  const vector<vector<int>>& edge )
{
	for( auto& next : edge[cur] )
	{
		if( next == ban ) continue;
		if( next == prev ) continue;
		if( next == goal )
			return true;
		if( dfs( next, cur, goal, ban, edge ) )
			return true;
	}
	return false;
}

bool reach( int n, int a, int b, const vector<vector<int>>& edge )
{
	return dfs( a, a, a, b, edge );
}

int main()
{
	int n, m;
	cin >> n >> m;
	
	vector< int > edgeN(n,0);
	vector< vector<int> > edge(n);
	REP( i, m )
	{
		int a, b;
		cin >> a >> b;
		edge[a-1].push_back( b-1 );
		edge[b-1].push_back( a-1 );
		++edgeN[a-1];
		++edgeN[b-1];
	}
	
	bool is = false;
	vector<int> sum;
	REP(i, n)
	{
		if( edgeN[i] % 2 != 0 )
		{
			cout << "No" << endl;
			return 0;
		}
		if( edgeN[i] / 2 >= 3 )
		{
			is = true;
		}
		else if( edgeN[i] / 2 == 2 )
		{
			sum.push_back( i );
		}
	}

	if( is || sum.size() >= 3 )
	{
		cout << "Yes" << endl;
	}
	else
	{
		if( sum.size() <= 1 )
		{
			cout << "No" << endl;
		}
		else if( reach( n, sum[0], sum[1], edge ) )
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	

	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N;
    cin >> N;
    veci cnt(4);
    REP(i,N) {
        string S;
        cin >> S;
        if(S == "AC") cnt[0]++;
        else if(S == "WA") cnt[1]++;
        else if(S == "TLE") cnt[2]++;
        else cnt[3]++;
    }
    cout << "AC x " << cnt[0] << endl;
    cout << "WA x " << cnt[1] << endl;
    cout << "TLE x " << cnt[2] << endl;
    cout << "RE x " << cnt[3] << endl; 
}

Measured memory_bytes: 3628
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
$A = $key->A[0];
$B = $key->A[1];
foreach($key->X[0] as $v) {
  $l[]=$v;
}
rsort($l);
$res=0;
for($i=0;$i<$B;$i++) {
  $res+=$l[$i];
}
printf("%d\n",$res);


Measured memory_bytes: 4084
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j) #a[0]=0だからbしか含まない形も考慮されてる
print(ans)

Measured memory_bytes: 47352
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=1e6+10,M2=1e6+10,M3=1e3+10,inf=1e9+10,mod=1e9+7;
vector<pii>ch[M];
int st[M],en[M];
set<int>stt;
pii cur[M];
int cnt[M];
main()
{
	int n,tmp,l,r,c;
	cin>>n>>tmp;
	int m=0;
	for(int i=1;i<=n;i++)cin>>l>>r>>c,ch[c].pb(mp(l,r));
	for(int i=1;i<=tmp;i++)
	{
		l=-1;
		sort(ch[i].begin(),ch[i].end());
		for(int j=0;j<ch[i].size();j++)
		{
			if(j==0){
				l=ch[i][j].F,r=ch[i][j].S;
				continue;
			}
			if(ch[i][j].F==r)
				r=ch[i][j].S;
			else
				st[++m]=l,en[m]=r,l=ch[i][j].F,r=ch[i][j].S;
		}
		if(l!=-1)
			st[++m]=l,en[m]=r;
	}
	for(int i=1;i<=m;i++)cur[i]=mp(st[i],en[i]);
	sort(cur+1,cur+m+1);
	for(int i=1;i<=m;i++)st[i]=cur[i].F,en[i]=cur[i].S;
	int ans=0;
	for(int i=1;i<=m;i++)
	{
		//cerr<<st[i]<<" "<<en[i]<<"******"<<endl;
		tmp=st[i]-1;
		if(!stt.size())
		{
			ans++;
			stt.insert(en[i]);
			cnt[en[i]]++;
			continue;
		}
		int ind=*stt.begin();
		if(ind>tmp)
		{
			ans++;
			cnt[en[i]]++;
			stt.insert(en[i]);
			continue;
		}
	//	cerr<<i<<" "<<ind<<endl;
		//ind=*stt.upper_bound(tmp);
		cnt[ind]--;
	//	cerr<<cnt[ind]<<" "<<ind<<" "<<i<<endl;
		if(cnt[ind]==0)
			stt.erase(ind);
		cnt[en[i]]++;
		stt.insert(en[i]);
	}
	cout<<ans;
}

Measured memory_bytes: 35328
//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }
int F(int n)
{
	int val=1;
	for(int i=2;i*i<=n;i++){
		int cnt=0;
		while(n%i==0)n/=i,cnt++;
		val*=(cnt+1);
	}
	if(n>1)val*=2;
	return val;
}
void solve(){
	int n;
	rd(n);
	int ans=0;
	for(int i=1;i<n;i++){
		ans+=F(n-i);
	}
	pp(ans);
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


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

int main(){
  string a,b,c;cin>>a>>b>>c;
  bool flag_a=true,flag_b=false,flag_c=false;
  int i=0,j=0,k=0;
  for(;;){
    if(flag_a){
      if(a[i]=='a')i++;
      else if(a[i]=='b'){
        j++;
        flag_a=false;
        flag_b=true;
      }
      else if(a[i]=='c'){
        k++;
        flag_a=false;
        flag_c=true;
      }
    }
    else if(flag_b){
      if(b[i]=='b')j++;
      else if(b[i]=='c'){
        k++;
        flag_b=false;
        flag_c=true;
      }
      else if(b[i]=='a'){
        i++;
        flag_b=false;
        flag_c=true;
      }
    }
    else if(flag_c){
      if(c[i]=='c')k++;
      else if(c[i]=='a'){
        i++;
        flag_c=false;
        flag_a=true;
      }
      else if(c[i]=='b'){
        j++;
        flag_c=false;
        flag_b=true;
      }
    }
    // cout<<i<<' '<<j<<' '<<k<<endl;
    if(i==a.size()||j==b.size()||k==c.size())break;
  }
  if(i==a.size())cout<<"A"<<endl;
  else if(j==b.size())cout<<"B"<<endl;
  else if(k==c.size())cout<<"C"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int  main()
{
  int a,l;
  cin>>a;
  char ar[a],br[a];
  scanf("%s%s",ar,br);
  for(l=0;l<strlen(ar);l++){
      cout<<ar[l]<<br[l];
  }
  cout<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int a, p;
    cin >> a >> p;
    cout << (a*3 + p)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  long long n,r = 0,g = 0,b = 0,x,y,z,ans = 0,i,j;string s;cin >> n >> s;
  for(i=0;i<n;i++){
    if(s[i]=='R') r++;
    else if(s[i]=='G') g++;
    else b++;
  }
  for(i=0;i<n;i++){
    if(s[i]=='R'){
      y = g;z = b;
      for(j=i+1;j<n;j++){
        if(s[j]=='G'){
          ans += z;y--;
        } else if(s[j]=='B') {
          ans += y;z--;
        }
      }
      r--;
    } else if(s[i]=='G'){
      x = r;z = b;
      for(j=i+1;j<n;j++){
        if(s[j]=='R'){
          ans += z;x--;
        } else if(s[j]=='B'){
          ans += x;z--;
        }
      }
      g--;
    } else {
      x = r;y = g;
      for(j=i+1;j<n;j++){
        if(s[j]=='R'){
          ans += y;x--;
        } else if(s[j]=='G'){
          ans += x;y--;
        }
      }
      b--;
    }
  }
  for(i=0;i<n;i++){
    for(j=1;i+j*2<n;j++){
      if(s[i] != s[i+j] && s[i+j] != s[i+j*2] && s[i+j*2] != s[i]) ans--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3644
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int m=sc.nextInt();
		int n=sc.nextInt();
		char arr[][]=new char[m][n];
		String s="";
		for(int i=0;i<m;i++){
			s=sc.next();
			for(int j=0;j<n;j++){
				arr[i][j]=s.charAt(j);
			}
		}
		int dp[][]=new int[m][n];
		int i=0;
		while(i<m){
			if(arr[i][0]!='#'){
				dp[i][0]=1;
				i++;
			}
			else{
				while(i<m){
					dp[i][0]=0;
					i++;
				}
			}
		}
		i=0;
		while(i<n){
			if(arr[0][i]!='#'){
				dp[0][i]=1;
				i++;
			}
			else{
				while(i<n){
					dp[0][i]=0;
					i++;
				}
			}
		}
		for(int j=1;j<m;j++){
			for(int k=1;k<n;k++){
				if(arr[j][k]!='#'){
					dp[j][k]=(dp[j-1][k]+dp[j][k-1])%1000000007;
				}
				else{
					dp[j][k]=0;
				}
			}
		}
		System.out.println(dp[m-1][n-1]);
	}
}


Measured memory_bytes: 47568
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <bitset>
#include <fstream>

#define ll long long
#define scani(x) scanf("%i", &x)
#define scanll(x) scanf("%I64d", &x)
#define scanfl(x) scanf("%f", &x)
#define scanch(x) scanf("%c", &x)
#define scans(x) scanf("%s", x);
#define printi(x) printf("%i", x);
#define printll(x) printf("%I64d", x);
#define printfl(x) printf("%f", x);
#define printch(x) printf("%c", x);
#define prints(x) printf("%s", x);
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define INFI (1 << 29)
#define INFL (1LL << 62)
#define sz(x) int(x.size())
#define fi first
#define se second
#define forn(i, n) for(ll i = 0; i < n; i++)
#define for1(i, n) for(ll i = 1; i <= n; i++)
#define ford(i, n) for(ll i = (n - 1); i >= 0; i--)
#define fori(i, n) for(ll i = n; i >= 1; i--)
#define fore(i, l, r) for(ll i = l; i <= r; i++)
#define get_bit(mask, x) (bool)(mask & (1LL << x))
#define set_bit(mask, x) (mask |= (1LL << x))
#define reset_bit(mask, x) (mask &= ~(1LL << x))
#define toggle_bit(mask, x) (mask ^= (1LL << x))

using namespace std;

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

    ll a, b;

    cin >> a >> b;

    cout << max((a + b), max((a - b), (a * b))) << "\n";

    return 0;
}


Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
taka_hp=a-d
aoki_hp=c-b
while True:
  if aoki_hp <=0:
    print("Yes")
    exit()
  else:
    aoki_hp -= b
    if taka_hp <= 0:
      print("No")
      exit()
    else:
      taka_hp -= d

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

#define ll long long
#define ld long long

int main() {
    int S, W; cin >> S >> W;
    string ans;
    if (W >= S) {
        ans = "unsafe";
    }
    else {
        ans = "safe";
    }
    cout << ans << endl;
}

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

signed main(){

  int n,t;
  cin>>n>>t;
  vector<int> imos(t+2);
  for(int i=0;i<n;++i){
    int l,r;
    cin>>l>>r;
    imos[l]++;
    imos[r]--;
  }
  for(int i=1;i<t+2;++i){
    imos[i] += imos[i-1];
  }

  cout<<(*max_element(imos.begin(),imos.end()))<<endl;

}


Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {

	static long[][] table;
	static final long UNK = -1;
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt(), p = scn.nextInt();
	
		int[] a = new int[n];
		table = new long[n + 1][2]; //n%2 is 0 or 1
		for (int i = 0; i < n; i++) {
			a[i] = scn.nextInt();
			table[i][0] = UNK;
			table[i][1] = UNK;
		}
		
		System.out.println(find(a, n, 0, 0, p));
		// pt();
	}

	private static long find(int[] array, int length, int i, int mod, int p) {
		// TODO Auto-generated method stub
		//base case
		if (i == length) {
			if (mod != (p % 2))  return 0;
			else return 1; //%2 == p%2, +1 to ct
		}
		long r = UNK;
		if (table[i][mod] == UNK)
			r = find(array, length, i + 1, (mod+array[i]) %2, p) + 
				find(array, length, i+1, mod, p);
		else
			r = table[i][mod];
		
		table[i][mod] = r;
		
		return table[i][mod];
	}

	


	private static void pt() {
		// TODO Auto-generated method stub
		for (int i = 0; i < table.length;  i++) {
			for (int j = 0; j< table[i].length; j++)
				System.out.print(table[i][j] + " ");
			
			System.out.println();
		} 
			
		
	}
}


Measured memory_bytes: 21716
import Control.Applicative

main = do
    [a, b, c] <- map read . words <$> getLine
    putStrLn . show $ solve a b c

solve :: Int -> Int -> Int -> Int
solve a b c
    | a == b && b == c = 1
    | a == b || b == c || c == a = 2
    | otherwise = 3


Measured memory_bytes: 508
while line = gets
  l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, v1, v2 = line.chomp.split(',').map(&:to_i)
  ratio = v1.to_f / (v1.to_f + v2.to_f)
  distance = [l1, l2, l3, l4, l5, l6, l7, l8, l9, l10]
  sum_distance = distance.inject(:+)

  i, y = 0, 0
  while y < sum_distance * ratio
    y += distance[i]
    i += 1
  end

  puts i
end

Measured memory_bytes: 8552
#include <iostream>

using namespace std;

int main()
{
	int n, a, b, c, d, e, f, g, h;

	while (true)
	{
		cin >> n;

		if (n == 0) { break; }

		for (int i = 0; i < n; i++)
		{
			cin >> a >> b >> c >> d >> e >> f >> g >> h;

			int p = a * e - b * f - c * g - d * h;
			int q = a * f + b * e + c * h - d * g;
			int r = a * g - b * h + c * e + d * f;
			int s = a * h + b * g - c * f + d * e;

			cout << p << ' ' << q << ' ' << r << ' ' << s << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 2976
#include <iostream>

using namespace std;

int main() {
  int n, m, l;
  long long a[100][100], b[100][100], c[100][100];
  cin >> n >> m >> l;
  for (int i = 0; i < n; ++i) {
    for (int k = 0; k < m; ++k) {
      cin >> a[i][k];
    }
  }
  for (int k = 0; k < m; ++k) {
    for (int j = 0; j < l; ++j) {
      cin >> b[k][j];
    }
  }

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < l; ++j) {
      c[i][j] = 0;
      for (int k = 0; k < m; ++k) {
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }

  for (int i = 0; i < n; ++i) {
    const char* sep = "";
    for (int j = 0; j < l; ++j) {
      cout << sep << c[i][j];
      sep = " ";
    }
    cout << endl;
  }
  return 0;
} 



Measured memory_bytes: 3320
#include<stdio.h>
int a[298];
int main(void){
    int i,j,k,n,x;

    while(1){
        scanf("%d %d",&n,&x);
        if(n == 0 && x == 0)
            break;
        for(i = 1;i <= n;i++)
            for(j = i + 1;j <= n;j++)
                for(k = j + 1;k <= n;k++)
                    a[i + j + k]++;
        printf("%d\n",a[x]);
        for(i = 0;i <= 297;i++)
            a [i] = 0;
    }
    return 0;
}

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

void Main()
{
    int64_t N;
    cin >> N;
    vector<int64_t> A(N - 1);
    for(int64_t i = 0; i < N - 1; ++i)
    {
        cin >> A[i];
    }

    vector<int64_t> result(N, 0);
    for(int64_t i = 0; i < N - 1; ++i)
    {
        ++result[A[i] - 1];
    }

    for(int64_t i = 0; i < N; ++i)
    {
        cout << result[i] << endl;
    }
}

int main()
{
    Main();
}


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

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

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

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

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


//edit
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        vector<string> S(N);
        map<string, Int> ss;
        for (int i = 0; i < N; ++i) {
            cin >> S[i];
            ss[S[i]]++;
        }

        Int max_v = 0;
        for (auto e : ss) {
            if (e.second > max_v) {
                max_v = e.second;
            }
        }
        vector<string> ans;
        for (auto e : ss) {
            if (e.second == max_v) {
                ans.push_back(e.first);
            }
        }
        sort(all(ans));
        for (auto e : ans) {
            cout << e << endl;
        }


    }
};


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

    Solve().solve();


    return 0;
}


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

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}


int main()
{
    /*A
    string s;
    cin>>s;
    bool flag = 0;
    for(int i=0;i<3;i++)
    {
        if(s[i]==s[i+1])
        {
            flag = 1;
        }
    }
    if(flag)
    {
        cout<<"Bad"<<endl;
    }
    else
    {
        cout<<"Good"<<endl;
    }
    */
    /*B
    int n,l;
    cin>>n>>l;
    vector <int> a(n);
    int sum=0;
    int minv=1000;
    int key=0;
    for(int i=0;i<n;i++)
    {
        a[i]=l+i;
        if(minv>abs(a[i]))
        {
            minv = abs(a[i]);
            key = a[i];
        }
        sum+=l+i;
    }
    cout<<sum-key<<endl;
    */

    /*C
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll total,count1,count2 =0;
    count1 = b/c+b/d-b/lcm(c,d);
    count2 = (a-1)/c+(a-1)/d-(a-1)/lcm(c,d);
    total = b-(a-1)-(count1-count2);
    cout<<total<<endl;
    */

    ll n;
    cin>>n;
    vector <pair <ll,ll>> p;
    for(ll i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        p.emplace_back(b,a);  //b=締め切り,a=作業時間
    } 
    sort(p.begin(),p.end());

    bool flag = 1;
    ll sum=0;
    int i=0;
    for(auto itr=p.begin();itr!=p.end();itr++)
    {
        sum += itr->second;
        if(sum>itr->first)
        {
            flag=0;
            break;
        }
    }

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

Measured memory_bytes: 6256
import java.util.*;
public class Main {
    public static void main(String args []){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int N = n;
        int sum=0;
        while(true){
            if(n-10>=0){
                sum+=n%10;
                n/=10;
            }
            else{
                sum+=n;
                break;
            }
        }
        if(N%sum==0) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 21972
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int t = sc.nextInt();
    int s = sc.nextInt();
    double ji = (double)d/s;
    if(t>=ji){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 35672
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000007
# define INF 2000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;

int main() {
	long long ans = 0, counter = 0, maxi = -1, mini = INF, pass = 0;
	//new
	ll a, b,k;
	cin >> a >> b>>k;
	ll ansa = max((ll)0, a - k);
	ll ansb = max((ll)0, b - max((ll)0,(k - a)));
	cout << ansa << " " << ansb << endl;
}

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

int main() {
  int n, m; cin >> n >> m;
  vector<pll> key(m);
  rep(i, m) {
    int a; cin >> key[i].first >> a;
    rep(j, a) {
      int b; cin >> b; b--;
      key[i].second |= 1<<b;
    }
  }
  vvll dp(m+1, vll(1<<n, 2e9));
  dp[0][0] = 0;
  rep(i, m) {
    rep(j, 1<<n) {
      dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
      dp[i+1][j | key[i].second] = min(dp[i+1][j | key[i].second], dp[i][j] + key[i].first);
    }
  }
  if (dp[m][(1<<n) - 1] == 2e9) cout << -1 << endl;
  else cout << dp[m][(1<<n) - 1] << endl;
  return 0;
}

Measured memory_bytes: 32384