akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  int a,b,c,d;
  cin>>a>>c>>b>>d;
  int ta=b-a,tb=d-c;
  int e = b-tb;
  int f = d+ta;
  int g = a-tb;
  int h = c+ta;
  cout<<e<<' '<<f<<' '<<g<<' '<<h<<endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>  
#include <stdlib.h> 
#include <string.h> 
#include <math.h>   


int main(void)
{
    char a[100], b[100];
    int len;

    scanf("%s", &a);
    len = strlen(a);

    for (int i = 0; i < len; i++) {
        b[i] = a[len - i-1];
    }
    b[len] = '\0';
    
    if (strcmp(a, b) != 0) {
        puts("No");
        return 0;
    }
    
    char c[50];
    char d[50];
    for (int i = 0; i < len / 2; i++) {
        c[i] = a[i];
    }
    c[len / 2] = '\0';
    for (int i = 0; i < len/2; i++) {
        d[i] = c[len/2 - i - 1];
    }
    d[len/2] = '\0';

    if (strcmp(c, d) != 0) {
        puts("No");
        return 0;
    }

    char e[50];
    char f[50];
    for (int i = 0; i < len/2 ; i++) {
        e[i] = a[((len + 3) / 2)+i-1];
    }
    e[len / 2] = '\0';
    for (int i = 0; i < len / 2; i++) {
        f[i] = e[len / 2 - i - 1];
    }
    f[len / 2] = '\0';


    if (strcmp (e, f) != 0) {
        puts("No");
        return 0;
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 128
def fun(Z,z):
    for i in range(z-1):
        for j in range(10):
            for p in range(10):
                q=(j-p)%10
                Z[i+1][j]+=Z[i][p]*Z[0][q]
    return Z

N=int(raw_input())
I=raw_input()
d=0
e=0
s=0
for i in range(1, N+1):
    if I[-i]=='*':
        if i%2: d+=1
        else:   e+=1
    else:
        k=int(I[-i])
        if i%2: s+=k
        else:   s+= (k*2)/10 + (k*2)%10
req=(10-s%10)%10
m=int(raw_input())
A=map(int, raw_input().split())
B=map(lambda x: (x*2)/10 + (x*2)%10, A)
D=[[0 for i in range(10)] for j in range(d)]
E=[[0 for i in range(10)] for j in range(e)]
if d>0:
    for i in A:
        D[0][i]=1
if e>0:
    for i in B:
        E[0][i]=1

D=fun(D,d)
E=fun(E,e)
ans=0
for i in range(10):
    if d>0 and e>0:
        j=(req-i)%10
        ans+=D[-1][i]*E[-1][j]
    elif d>0:
        ans=D[-1][req]
    else:
        ans=E[-1][req]
print ans

Measured memory_bytes: 9588
n, k = map(int, input().split())
MOD = 10 ** 9 + 7
a = list(map(int, input().split()))
a.sort()

SIZE = 10 ** 5 + 1
fact = [0] * SIZE
inv = [0] * SIZE
finv = [0] * SIZE
fact[0], fact[1] = 1, 1
inv[1] = 1
finv[0], finv[1] = 1, 1
for i in range(2, SIZE):
    fact[i] = fact[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD


def combination(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fact[n] * (finv[r] * finv[n - r] % MOD) % MOD

ans = 0
for i in range(k - 1, n):
    ans += a[i] * combination(i, k - 1)
    ans %= MOD

a.reverse()
for i in range(k - 1, n):
    ans -= a[i] * combination(i, k - 1)
    ans %= MOD

print(ans)


Measured memory_bytes: 19152
N = int(input())
S = input()
from math import factorial


cnt = 0

ans = 1
mod = 10 ** 9 + 7
for i in range(2 * N):
    s = S[i]
    if s == "W":
        if cnt == 0:
            print(0)
            exit()
        else:
            if cnt % 2 == 0:
                ans *= cnt
                ans %= mod
                cnt -= 1
            else:
                cnt += 1
    else:
        if cnt % 2 == 0:
            cnt += 1
        else:
            ans *= cnt
            ans %= mod
            cnt -= 1
if cnt != 0:
    print(0)
    exit()
ans *= factorial(N)
ans %= mod
print(ans)


Measured memory_bytes: 4456
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブScanner scan = new Scanner(System.in);

        Scanner scan = new Scanner(System.in);

        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();

        int X = scan.nextInt();

        int count = 0;

        for(int a = 0; a <= A; a++ ) {
        	for(int b = 0; b <= B; b++) {
        		for(int c = 0; c <= C; c++) {
        			int total = 500 * a + 100 * b + 50 * c;
        			// 合計がxに一致
        			if(total == X) {
        				// 方法をカウント
        				count++;
        			}
        		}
        	}
        }

        System.out.println(count);
	}

}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n<65){
    cout<<0<<'\n';
  }
  else if(n<=90){
    cout<<1<<'\n';
  }
  else if(n<97){
    cout<<0<<'\n';
  }
  else if(n<=122){
    cout<<2<<'\n';
  }
  else{
    cout<<0<<'\n';
  }
  return(0);
}


Measured memory_bytes: 3120
<?php
fscanf(STDIN, "%d %d %d", $a, $b, $c );

$numbers = array();
$numbers[] = $a;
$numbers[] = $b;
$numbers[] = $c;

sort( $numbers );

if( $numbers[ 0 ] == 5 and $numbers[ 1 ] == 5 and $numbers[ 2 ] == 7 ){
  echo "YES";
}
else{
  echo "NO";
}
?>

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
    int x;
    std::cin >> x;
    if(x>=2100)std::cout << 1 << std::endl;
    else{
        int a=x%100,b=x-x%100;
        
        if(a*20>b)std::cout << 0 << std::endl;
        else std::cout << 1 << std::endl;
    }
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    private static boolean debug = true;
    private static boolean elapsed = true;

    private int N;
    private int T;
    private int[] A;

    private void solve(Scanner sc, PrintWriter out) {
        N = sc.nextInt();
        T = sc.nextInt();
        A = new int[N];
        for (int i = 0; i < N; ++i) {
            A[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;;
        int max = 0;
        int count = 0;
        for (int i = 0; i < N; ++i) {
            if (A[i] < min) {
                min = A[i];
            } else {
                int diff = A[i] - min;
                if (diff == max) {
                    ++count;
                } else if (diff > max) {
                    max = diff;
                    count = 1;
                }
            }
        }

        out.println(count);
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new Main().solve(sc, out);
        out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            System.err.println((G - S) + "ms");
        }
    }
}

Measured memory_bytes: 46092
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int h, w;
    int i, j;
    while(1){
        scanf("%d %d", &h, &w);
        if(h==0 && w==0) break;
        for(i=0; i<h; i++){
            for(j=0; j<w; j++){
                if(i%2 == 0){
                    if(j%2 == 0){
                        printf("#");
                    }else{
                        printf(".");
                    }
                }else{
                    if(j%2 == 0){
                        printf(".");
                    }else{
                        printf("#");
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

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

using ll=long long;
ll f(ll x){
    if(x<0) return 0;
    ll res=0;
    for(int i=0;i<50;i++){
        //cerr<<"#"<<endl;
        ll y=x>>i;
        ll a=(y>>1);
        ll b=(1LL<<i);
        int c=(a*b)&1;
        // cerr<<c<<endl;
        if(y&1){
            c+=((x-(y<<i))+1)&1;
        }
        // cerr<<c<<endl;
        if(c%2){
            res+=(1LL<<i);
        }
    }
    return res;
}

int main(){
    ll a,b;
    cin>>a>>b;
    //cerr<<f(a)<<endl;
    //return 0;
    a--;
    cout<<(f(b)^f(a))<<endl;
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        long ansCount = 0;
        var s = Console.ReadLine().Select(c => c - '0').Reverse().ToArray();
        int n = s.Length;
        long[] ten = new long[n];
        ten[0] = 1;
        for(int i = 0; i < n - 1; i++)
        {
            ten[i + 1] = (ten[i] * 10) % 2019;
        }
        long[] ans = new long[n];
        ans[0] = s[0];
        if (ans[0] == 0) ansCount++;
        for(int i = 0; i < n -1; i++)
        {
            ans[i + 1] = (ans[i] + (s[i+1] * ten[i+1]) )% 2019;
            if (ans[i + 1] == 0) ansCount++;
        }
        var a = ans.GroupBy(x => x);
        foreach(var ele in a)
        {
            if(ele.Count() > 1)
            {
                ansCount += (ele.Count() * (ele.Count() - 1)) / 2;
            }
        }
        Console.WriteLine(ansCount);

    }


}





Measured memory_bytes: 30532
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define mod 1000000007

const int sz=2e3+5;
ll inf=1e15;

ll n,dp[sz];

ll f(ll sm){
    // cout<<c<<" "<<sm<<endl;
    if(sm>n) return 0;
    if(sm==n) return 1;
    ll &res=dp[sm];
    if(res!=-1){
        return res;
    }
    res=0;
    for(int i=n-sm;i>=3;i--){
        res=(res+f(sm+i))%mod;
    }

    return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        cin>>n;
        ll ar[n],ar2[n];
        for(int i=0;i<n;i++){
            ll x,y;
            cin>>x>>y;
            ar[i]=(x+y);
            ar2[i]=(x-y);
        }
        sort(ar,ar+n);
        sort(ar2,ar2+n);
        ll ans=abs(ar2[0]-ar2[n-1]);
        ans=max(ans,abs(ar[0]-ar[n-1]));
        cout<<ans;
        // for(int c=1;c<)
    }

    return 0;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//繰り返し二乗法
int modPow(long long a, long long n, long long p) {
    if (n == 0) return 1; // 0乗にも対応する場合
    if (n == 1) return a % p;
    if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
    long long t = modPow(a, n / 2, p);
    return (t * t) % p;
}

int main()
{
    lol result{0};
    lol n; cin >> n;
    FOR(i, 1, n-1)
    {
        lol k = n/i;
        lol r = n%i;
        if(n%i == 0)
            result += (k-1);
        else result += k;
    }
    

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=1e5+5;
int n,lim_l[N],lim_r[N],ans[N];
bool dif;

namespace utils{
	template <class T> inline void apx(T &x,const T y){
		x<y?x=y:0;
	}
	template <class T> inline void apn(T &x,const T y){
		x>y?x=y:0;
	}
	inline int nxi(FILE *fd=stdin){
		int x=0;
		char c;
		while(((c=fgetc(fd))>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=fgetc(fd));
		while(x=x*10-48+c,(c=fgetc(fd))>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

namespace G{
	int cnt,fir[N],fa[N],dep[N];
	struct edge{
		int to,nx;
	}eg[N<<1];

	inline void add(const int a,const int b){
		//printf("add: %d %d\n",a,b);
		eg[++cnt]=(edge){b,fir[a]};
		fir[a]=cnt;
	}

	void dfs_dep(const int x){
		for(int i=fir[x]; i; i=eg[i].nx){
			const int y=eg[i].to;
			if(y==fa[x]) continue;
			fa[y]=x;
			dep[y]=dep[x]+1;
			dfs_dep(y);
		}
	}

	bool dfs_vld(const int x){
		if(lim_r[x]==-1){
			lim_r[x]=(dep[x]==dif?1e6:1e6+1);
			lim_l[x]=(dep[x]==dif?-1e6:-1e6-1);
		}
		for(int i=fir[x]; i; i=eg[i].nx){
			const int y=eg[i].to;
			if(y==fa[x]) continue;
			if(!dfs_vld(y)) return 0;
			apn(lim_r[x],lim_r[y]+1);
			apx(lim_l[x],lim_l[y]-1);
		}
		assert(((lim_l[x]^lim_r[x])&1)==0);
		return lim_l[x]<=lim_r[x];
	}

	void dfs_ans(const int x){
		for(int i=fir[x]; i; i=eg[i].nx){
			const int y=eg[i].to;
			if(y==fa[x]) continue;
			ans[y]=ans[x]<lim_l[y]?ans[x]+1:ans[x]-1;
			dfs_ans(y);
		}
	}
}

int main(){
	n=nxi();
	memset(lim_r+1,-1,n*sizeof(int));
	for(int i=1; i<n; ++i){
		const int a=nxi(),b=nxi();
		G::add(a,b);
		G::add(b,a);
	}
	G::dfs_dep(1);
	for(int q=nxi(),i=1; i<=q; ++i){
		const int x=nxi(),v=nxi();
		lim_l[x]=lim_r[x]=v;
		if(i==1) dif=(v&1)^(G::dep[x]&1);
		else if(((v&1)^(G::dep[x]&1))!=dif){
			puts("No");
			return 0;
		}
	}
	if(!G::dfs_vld(1)){
		puts("No");
		return 0;
	}
	ans[1]=lim_l[1];
	G::dfs_ans(1);
	puts("Yes");
	for(int i=1; i<=n; ++i){
		printf("%d\n",ans[i]);
	}
	return 0;
}


Measured memory_bytes: 7936
l = []
while True:
  a,op,b = input().split()
  if op == '?':
    break
  A = int(a)
  B = int(b)
  if op == '+':
    l.append(A+B)
  elif op == '-':
    l.append(A-B)
  elif op == '*':
    l.append(A*B)
  elif op == '/':
    l.append(A//B)
for i in l:
  print(i)

Measured memory_bytes: 7672
import java.math.BigDecimal;
        import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        
        long[][][] dp = new long[n+1][n+1][a*n+1];
        
        dp[0][0][0] = 1;

        for (int i = 0; i < n; i++) {
            for (int k = 0; k < n; k++) {
                for (int j = 0; j <= a*n; j++) {
                    dp[i + 1][k][j] += dp[i][k][j];
                    if (j >= x[i]) dp[i + 1][k + 1][j] += dp[i][k][j - x[i]];
                }
            }

        }

        long ans = 0;
        for (int k = 1; k <= n; k++) {
            ans += dp[n][k][k * a];
        }
        System.out.println(ans);

    }

}

Measured memory_bytes: 83912
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s[n - 1 - i]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
L,R = map(int,input().split())

l = L % 2019
r = min(R-L+l,2019)

ans = 2019

if r == 2019:
    print(0)
    exit()

for i in range(l,r+1):
    for j in range(l,i):
        ans = min(ans,i*j % 2019)

print(ans)


Measured memory_bytes: 3060
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = 0
L = [0]*n
for i in range(n-1):
  for j in range(i+1, n):
    c = min(j-i, abs(x-i) + 1 + abs(j-y))
    L[c] += 1
print(*L[1:], sep="\n")

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <math.h>
#include <string>

int main(void);
int combination(int n);
bool combination_sub();

int main(){
	int n;				//入力されるデータセット
	int cnt = 0;		//データセット入力カウント
	int result[50];		//組み合わせ個数を格納する配列

	while (std::cin >> n){
	//while (cnt < 2){
		//std::cin >> n;
		result[cnt] = combination(n);
		cnt++;
	}

	for (int i = 0; i < cnt; i++){
		std::cout << result[i] << std::endl;
	}

	//while (1);
	return 0;
}

int combination(int n){
	int rtn = 0;
	
	//全部同じ場合
	for (int x = 0; x <= 9; x++){
		if (x * 4 == n){
			rtn++;
		}
	}

	//「全部同じ」以外の場合
	for (int a = 0; a <= 9; a++){
		for (int b = 0; b <= 9; b++){
			for (int c = 0; c <= 9; c++){
				for (int d = 0; d <= 9; d++){
					if (!((a == b) && (a == c) && (a == d))){
						if ((a + b + c + d) == n){
							rtn++;
						}
					}
				}
			}
		}
	}

	return rtn;
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

const int P = 1e9 + 7;

int64_t fact(int n) {
    int64_t r = 1;
    for (int i = 2; i <= n; i++) {
        r *= i;
        r %= P;
    }
    return r;
}

int main() {
    int n, m;
    cin >> n >> m;
    if (n < m) swap(n, m);

    int64_t r = (fact(n) * fact(m)) % P;

    if (n == m) {
        r *= 2;
        r %= P;
        cout << r << endl;

    } else if (n == m + 1) {
        cout << r << endl;

    } else {
        cout << 0 << endl;
    }

    return 0;
}

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

int c()
{
    long long a;
    long double b;
    std::cin >> a >> b;

    long double ans = a * b;
    std::cout << (long long)ans << std::endl;
    
    return 0;
}

int main(int argc, const char * argv[])
{
    c();
    return 0;
}


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


int main()
{
    vector<int> v;
    int N;
    cin >> N;
    int a;
    int m=1;
    int m2=1;
    rep(i, N){
        cin >> a;
        vector<int> vv{a,m,m2};
        sort(vv.begin(), vv.end());
        m = vv[2]; m2 = vv[1];
        v.push_back(a);
    }
    rep(i, N){
        if (v[i] == m) cout << m2 << endl;
        else cout << m << endl;
    }

    return 0;
}



Measured memory_bytes: 2548
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(){
		start = goal = 0;
	}
	Info(int arg_start,int arg_goal){
		start = arg_start;
		goal = arg_goal;
	}
	int start,goal;
};


int main(){

	int N,M,K,P;
	int POW[16] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768};
	scanf("%d %d %d %d",&N,&M,&K,&P);

	int** dist = new int*[N+1];
	for(int i = 1; i <= N; i++){
		dist[i] = new int[N+1];
		for(int k = 1; k <= N; k++){
			if(i != k)dist[i][k] = BIG_NUM;
			else{
				dist[i][k] = 0;
			}
		}
	}

	int from,to,cost;
	for(int i = 0; i < M; i++){
		scanf("%d %d %d",&from,&to,&cost);
		dist[from][to] = cost;
		dist[to][from] = cost;
	}

	for(int mid = 1; mid <= N; mid++){
		for(int st = 1; st <= N; st++){
			if(dist[st][mid] == BIG_NUM)continue;
			for(int gl = 1; gl <= N; gl++){
				if(dist[mid][gl] == BIG_NUM)continue;
				dist[st][gl] = min(dist[st][gl],dist[st][mid]+dist[mid][gl]);
			}
		}
	}

	int start,goal;
	vector<Info> V;

	for(int i = 0; i < K; i++){
		scanf("%d %d",&start,&goal);
		V.push_back(Info(start,goal));
	}

	bool FLG = true;

	for(int i = 0; i < K; i++){
		if(dist[P][V[i].start] == BIG_NUM || dist[P][V[i].goal] == BIG_NUM){
			FLG = false;
			break;
		}
	}

	if(!FLG){
		printf("Cannot deliver\n");
		return 0;
	}

	int digit = 2*K;
	int limit = POW[digit];

	int** dp = new int*[limit];
	for(int i = 0; i < limit; i++){
		dp[i] = new int[digit];
		for(int k = 0; k < digit; k++)dp[i][k] = BIG_NUM;
	}

	for(int i = 0; i < K; i++){
		dp[POW[2*i]][2*i] = dist[P][V[i].start];
	}

	bool check[digit];
	int next_state;

	for(int state = 0; state < limit; state++){
		for(int node = 0; node < digit; node++){
			if(dp[state][node] != BIG_NUM){

				for(int loop = 0; loop < digit; loop++){
					if(state & (1 << loop)){
						check[loop] = true;
					}else{
						check[loop] = false;
					}
				}

				from = (node%2 == 0)?V[node/2].start:V[node/2].goal;

				for(int i = 0; i < K; i++){
					if(check[2*i] == false){
						next_state = state + POW[2*i];
						dp[next_state][2*i] = min(dp[next_state][2*i],dp[state][node] + dist[from][V[i].start]);
					}
				}

				for(int i = 0; i < K; i++){
					if(check[2*i] == true && check[2*i+1] == false){
						next_state = state + POW[2*i+1];
						dp[next_state][2*i+1] = min(dp[next_state][2*i+1],dp[state][node]+dist[from][V[i].goal]);
					}
				}
			}
		}
	}

	int ans = BIG_NUM;
	for(int i = 0; i < digit; i++)ans = min(ans,dp[limit-1][i]);

	printf("%d\n",ans);

	return 0;
}

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

using namespace std;

int n,m,x,y,z,sum[110],an;
char hoge[20];
vector<string> s,t;

int main(void) {
    cin >> n;
    for (x=0 ; x<n ; x++) {
        cin >> hoge;
        s.push_back(hoge);
    }
    cin >> m;
    for (x=0 ; x<m ; x++) {
        cin >> hoge;
        t.push_back(hoge);
    }
    sort(s.begin(), s.end());

    for (x=0 ; x<n ; x++) {
        if (x != 0 && s[x] == s[x-1]) {
            sum[z-1]++;
            continue;
        }

        for (y=0 ; y<m ; y++) if (s[x] == t[y]) sum[z]--;
        sum[z]++;
        z++;
    }
    sort(sum, sum+z);
    z--;
    an = sum[z];
    if (an < 0) an = 0;
    cout << an << "\n";








}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

using Event = pair<int, pii>;

int H;
int W;
int N;
int ans;
vector<Event> es;

int main() {
  scanf("%d%d%d", &H, &W, &N);
  rep(i, N) {
    int x, y;
    scanf("%d%d", &x, &y);
    es.eb(Event(x, pii(0, y)));
    es.eb(Event(x-1, pii(1, y)));
  }
  sort(all(es));

  ans = H;
  int cury = 1;
  int curx = 1;
  for (auto &e : es) {
    int x = e.first;
    int cmd, y;
    tie(cmd, y) = e.second;
    //printf("cmd: %d, x: %d, y: %d, curx: %d cury: %d\n", cmd, x, y, curx, cury);
    if (cmd == 0) {
      cury += x-curx;
      if (cury == y) cury--;
    } else if (cmd == 1) {
      cury += x-curx;
      if (cury >= y) {
        ans = x;
        break;
      }
    } else assert(0);
    curx = x;
  }
  
  printf("%d\n", ans);  
}


Measured memory_bytes: 8304
import java.util.Scanner;
import java.util.Random;
import java.io.*;

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

		System.out.println(gcd(n1, n2));
		// System.out.println(n1 + " " + n2);
	}

	public static int gcd(int num1, int num2) {
		if (num1 == num2)
			return num1;

		if (num1 > num2)
			return gcd(num1 - num2, num2);
		return gcd(num1, num2 - num1);
	}
}


Measured memory_bytes: 26220
#include <cmath>
#include <complex>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

typedef complex<int> point;
#define X real()
#define Y imag()

constexpr int MAX_SIZE = 500;
string board[MAX_SIZE];

bool operator<(const point& a, const point& b) {
	return a.X != b.X ? a.X < b.X : a.Y < b.Y;
}

inline int dist2(const point& a, const point& b) {
	const int diffX = a.X - b.X;
	const int diffY = a.Y - b.Y;
	return diffX * diffX + diffY * diffY;
}

inline double dist(const point& a, const point& b) {
	return sqrt(dist2(a, b));
}

int calc(const point& start, const point& to) {
	const point d = (to - start) / static_cast<int>(dist(to, start));
	int res = 0;
	point current = start;

	while(current != to) {
		if(board[current.Y][current.X] != '.') res |= (1 << (board[current.Y][current.X] - 'A'));
		current += d;
	}

	return res;
}

void update(queue<int>& que, vector<pair<int, int>>& can_erase, int value) {
	value = ~value;

	for(int i = 0; i < static_cast<int>(can_erase.size());) {
		can_erase[i].first &= value;
		if(can_erase[i].first == 0) {
			que.push(can_erase[i].second);
			can_erase.erase(can_erase.begin() + i);
		}
		else {
			++i;
		}
	}
}

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

	int h, w;
	cin >> h >> w;

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

	vector<vector<point>> tiles(26);
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if(board[i][j] != '.') {
				tiles[board[i][j] - 'A'].emplace_back(j, i);
			}
		}
	}

	vector<bool> used(26, true);
	vector<pair<int, int>> can_erase;

	for(int i = 0; i < 26; ++i) {
		if(tiles[i].size() == 0 || dist2(tiles[i][0], tiles[i][1]) == 1) continue;

		used[i] = false;
		if(tiles[i][1] < tiles[i][0]) swap(tiles[i][0], tiles[i][1]);

		if(tiles[i][0].X == tiles[i][1].X) {
			can_erase.emplace_back(calc(tiles[i][0] + point(0, 1), tiles[i][1]), i);
		}
		else if(tiles[i][0].Y == tiles[i][1].Y) {
			can_erase.emplace_back(calc(tiles[i][0] + point(1, 0), tiles[i][1]), i);
		}
		else {
			point start(tiles[i][0].X, tiles[i][1].Y);
			can_erase.emplace_back(calc(start, tiles[i][0]) | calc(start, tiles[i][1]), i);

			start = point(tiles[i][1].X, tiles[i][0].Y);
			can_erase.emplace_back(calc(start, tiles[i][0]) | calc(start, tiles[i][1]), i);
		}
	}

	queue<int> que;
	update(que, can_erase, 0);

	int ans = 0;
	while(!que.empty()) {
		int color = que.front();
		que.pop();

		if(used[color]) continue;
		used[color] = true;
		++ans;

		update(que, can_erase, (1 << color));
	}

	cout << ans * 2 << endl;

	return EXIT_SUCCESS;
}

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

int solve() {
    int A, B;
    cin >> A >> B;
    int N = 100;
    vector<vector<int>> X(N, vector<int>(N));
    for ( int i = 0; i < N; i++ ) {
        X[i][N-1] = 1;
        if ( i & 1 ) {
            for ( int j = 1; j < N; j++ ) {
                X[i][j] = 1;
            }
        }
    }
    int a = 1, b = 1;
    int ah = 0, aw = N-1, bh = N-1, bw = 0;
    for ( ; a < A; a++ ) {
        aw -= 2;
        if ( aw <= 0 ) {
            aw = N-3;
            ah += 2;
        }
        X[ah][aw] = 1;
    }
    for ( ; b < B; b++ ) {
        bw += 2;
        if ( bw >= N-1 ) {
            bw = 2;
            bh -= 2;
        }
        X[bh][bw] = 0;
    }

    cout << N << " " << N << "\n";
    for ( int i = 0; i < N; i++ ) {
        for ( int j = 0; j < N; j++ ) {
            char c = (X[i][j] == 1) ? '#' : '.';
            cout << c;
        }
        cout << "\n";
    }
    return 0;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
    ll n;
    cin >> n;
    vll A(n + 1), s(n + 1), ans(n + 1);
    for (ll i = 0; i <= n; i++) s[i] = i, A[i] = i, ans[i] = i;
    for (ll i = 2; i * i <= n; i++){
        if (s[i] != i) continue;
        for (ll j = i * i; j <= n; j += i){
            if (s[j] == j) s[j] = i;
        }
    }
    for (ll i = 2; i * i <= n; i++){
        if (s[i] != i) continue;
        for (ll j = i * i; j <= n; j += i){
            ll l = 0;
            while(A[j] % i == 0){
                ++l;
                A[j] /= i;
            }
            ans[j] *= (l + 1);
        }
    }
    ll sum = 0;
    // for (int i = 0; i <= n; i++){
    //     cout << ans[i] << " ";
    // }
    // cout << endl;
    for (int i = 1; i <= n; i++){
        if (A[i] != 1){
            ans[i] *= 2;
        }
        // s[i] *= i;
        sum += ans[i];
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 237592
N,M=map(int,input().split())
A=list(map(int,input().split()))

Q=[None]*M
for i in range(M):
  b,c=map(int,input().split())
  Q[i]=[b,c]
  
Q=sorted(Q,key=lambda x:x[1])[::-1]

A=sorted(A)
ind=0
for i in range(len(Q)):
  b,c=Q[i]
  for p in range(b):
    if ind+p>=len(A):
      print(sum(A))
      exit(0)
    if A[ind+p]<c:
      A[ind+p]=c
    else:
      break
  ind+=b
else:
  print(sum(A))

Measured memory_bytes: 25928
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
String b=sc.nextLine();
int a=Integer.parseInt(b);
String line=sc.nextLine();
String s[]=line.split(" ",0);
int iti[]=new int[a];
for(int i=0;i<a;i++){
iti[i]=Integer.parseInt(s[i]);
}
int ans=0;
for(int i=0;i<a;i++){
while((iti[i]/2)*2==iti[i]){
ans++;
iti[i]/=2;
}
}
System.out.println(ans);
    }
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

signed main(){

  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a==c)puts("0");
  else puts("1");

}

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

class Program {
  static void Main() {
    var s = Console.ReadLine();
    var n = int.Parse(s);
    var sn = s.Select(x => int.Parse(x.ToString())).Sum();
    Console.WriteLine(n % sn == 0 ? "Yes" : "No");
  }
}

Measured memory_bytes: 11220
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

void trace(int A[], int N);

int main(int argc, char const *argv[])
{
    int N;
    int i;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    trace(A,N);
    for (int i = 1; i < N; ++i)
    {
        int tmp = A[i];
        for (int j = i - 1; j >= 0; --j)
        {
            if(tmp >= A[j]){
                A[j + 1] = tmp;
                break ;
            }else if (tmp < A[j])
            {
                A[j + 1] = A[j];
                if(j == 0){
                    A[j] = tmp;
                    break ;
                }
            }
        }
        trace(A, N);
    }
    return 0;

}

void trace(int A[], int n){
    int i;
    rep(i,n - 1) cout << A[i] << " ";
    P(A[n - 1]);
}

Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  long N,K;
  cin>>N>>K;
  long H[200010];
  for (int i=0;i<N;i++) cin>>H[i];
  sort(H,H+N);
  long sum=0;
  for (int i=0; i<N-K; i++) sum+=H[i];
  printf("%ld\n",sum);
}


Measured memory_bytes: 1792
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>

bool check(int y, int x, int h, int r){
  int rr = r * 2, yy = y * y, xx = x * x, hh = h * h;
  if(sqrt(yy + xx) < rr) return true;
  if(sqrt(yy + hh) < rr) return true;
  if(sqrt(xx + hh) < rr) return true;
  return false;
}

int main() {
  int y, x, h;
  while(cin >>y >>x >>h && y){
    int n; cin >>n;
    REP(i, n){
      int r; cin >>r;
      if(check(y, x, h, r)) cout <<"OK" <<endl;
      else cout <<"NA" <<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define N 666666
int arr[N];
vector<int> v; 
map<int,int> vis,mp;
signed  main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
		mp[arr[i]]++;
	} 
	
	for(int i=1;i<=n;i++){
		if(!vis[arr[i]]) 
			v.push_back(mp[arr[i]]);
		vis[arr[i]]=1;
	}
	
	sort(v.begin(),v.end());
	if(v.size()<=k){
		cout<<"0";
	} 
	else{
		int add=0;
		int t=-1*(k-v.size());
		for(int i=0;i<t;i++){
			add+=v[i];
		//	cout<<v[i];
		}
		 //cout<<"-";
		cout<<add;
	}
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end()
#define P pair<int , int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

  int r;  cin >> r;
  cout << r*r << endl;

  return 0;
}


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

int main(){
	int T[101][101];
	int r, c;
	int i, j;
	cin >> r >> c;
	for( i=0; i<r; i++ )
		for( j=0; j<c; j++ ) cin >> T[i][j];

	for( i=0; i<=r; i++ ) T[i][c] = 0;
	for( j=0; j<=c; j++ ) T[r][j] = 0;

	for( i=0; i<r; i++ ){
		for( j=0; j<c; j++ ){
			T[i][c] += T[i][j];
			T[r][j] += T[i][j];
			T[r][c] += T[i][j];
		}
	}

	for( i=0; i<=r; i++ ){
		for( j=0; j<=c; j++ ){
			if(j)cout << " ";
			cout << T[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
using namespace std;
int main() {
  int n, x;
  int dat[7];
  while(cin >> n, n) {
    for(int i=0; i<7; i++) dat[i]=0;
    for(int i=0; i<n; i++) {cin >> x; if(x/10>6) x=60; dat[x/10] ++;}
    for(int i=0; i<7; i++) cout << dat[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1e18;



int main() {
  ll n,k;
  cin>>n>>k;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  ll dp[k+1];
  rep(i,k+1)dp[i]=1;
  dp[0]=0;
  rep(i,k+1){
    ll now=0;
    rep(j,n){
      if ((i-a[j])>=0){
        if (dp[i-a[j]]==0) now=1;
        //cout<<dp[i-a[j]]<<"i-a"<<(i-a[j])<<endl;
        //break;
      }
    }
    if (now==1)dp[i]=1;
    else dp[i]=0;
  //  cout<<dp[i]<<"i"<<i<<endl;
  }
  if (dp[k]==1)cout<<"First";
  else cout<<"Second";
}


Measured memory_bytes: 4376
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100;
const int MAX_W = 10000;
int DP[MAX_N+1][MAX_W+1];
int v[MAX_N];
int w[MAX_N];

int main()
{
	int n,W;
	scanf("%d%d",&n,&W);
	rep(i,n){
		scanf("%d%d",&v[i],&w[i]);
	}
	rep(i,n){
		rep(j,W+1){
			if(j<w[i]){
				DP[i+1][j] = DP[i][j];
			}else{
				DP[i+1][j] = max(DP[i][j],DP[i+1][j-w[i]] + v[i]);
			}
		}
	}
	printf("%d\n",DP[n][W]);
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

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

using i64=int64_t;

void solve(){
    i64 x;
    cin >> x;
    cout << x/11*2+(x%11==0?0:1+(x%11>6)) << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int ans = 0;
    if(n/1000==(n%1000)/100){
        if((n%1000)/100==(n%100)/10) ans = 1;
    }
    if((n%1000)/100==(n%100)/10){
        if((n%100)/10==n%10) ans = 1;
    }
    cout << (ans==1 ? "Yes" : "No");
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  ll A,B,C,K;
  cin >> A >> B >> C >> K;
  ll ans;
  if(K%2==0) ans=A-B;
  else ans=B-A;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("03")
#pragma GCC target("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define sz(x) (ll)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define nl "\n"
 
const int mod=10e7+7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	for(int i=s.size()-2;i>=0;i--) {
		string ans=s.substr(0, i+1);
		int flag=0;
		if(ans.size()%2==1) {
			continue;
		}
		for(int i=0;i<ans.size()/2;i++) {
			if(ans[i]!=ans[i+ans.size()/2]) {
				flag=1;
				break;
			}
		}
		if(!flag) {
			cout << i+1 << nl;
			return 0;
		}
	}
}


Measured memory_bytes: 3620
N,M = map(int,input().split())
li = [list(map(int,input().split())) for i in range(N)]
li=sorted(li,key=lambda x: x[0])
m_sum=0
for i in li:
	buy=min(M,i[1])
	m_sum+=i[0]*buy
	M-=buy
print(m_sum)

Measured memory_bytes: 29796
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    # From the problem statement, the quotient and remainder of N is the
    # the same k when m is the favorite number.
    #   N = k*m + k = k*(m+1)
    # Here, k is the remainder when N is divided by m, so k < m.
    ans = 0
    for k in range(1, int(N**0.5)+1):
        if N % k == 0:
            m = N // k - 1
            if k >= m:
                break
            ans += m

    return ans


if __name__ == '__main__':
    print(main())


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

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

	int A[4][101];

	for (int i = 1; i <= 2; i++) {
		for (int j = 1; j <= N; j++)cin >> A[i][j];
	}

	int max = 0;
	
	for (int i = 1; i <= N; i++) {

		int candies = 0;

		for (int j = 1; j <= i; j++) {
			candies += A[1][j];
		}

		for (int j = i; j <= N; j++) {
			candies += A[2][j];
		}

		if (max < candies)max = candies;
	}

	cout << max;
}

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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = INT_MAX;
    for(int y = -100; y <= 100; y++){
        int cost = 0;
        for(int x : a){
            cost += (x-y)*(x-y);
        }
        ans = min(ans, cost);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// 5/2 リアルタイム参加

#include <iostream>
#include <math.h>
using namespace std;

int main() {
    long long X;
    cin >> X;

    long long yokin = 100;
    long long years = 0;

    while (yokin < X) {
        yokin = (long long)floor((double)yokin * 1.01);
        years++;
        // cout << yokin << endl;
    }
    
    cout << years << endl;;
}


Measured memory_bytes: 3748
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
string L="ABCDEFGHIJKLMNOPQRSTUVWXYZ",A=" ',-.?"+L,C=L+" .,-'?";
string B="101 000000 000011 10010001 010001 000001 100101 10011010 "
	"0101 0001 110 01001 10011011 010000 0111 10011000 "
	"0110 00100 10011001 10011110 00101 111 10011111 1000 "
	"00110 00111 10011100 10011101 000010 10010010 10010011 10010000";
int bin2dec(string s){
	int x=0,i=0;
	for(;i<s.size();i++)x=x*2+s[i]-'0';
	return x;
}
int main(){
	vector<string>x(32);
	stringstream ss(B);
	string s,s1;
	int i=0,n;
	for(;i<32;i++){
		ss>>s;
		x[i]=s;
	}
	while(getline(cin,s)){
		s1="";
		for(i=0;i<s.size();i++)s1+=x[A.find(s[i])];
		n=s1.size()%5;
		if(n)s1+=string(5-n,'0');
		s="";
		for(i=0;i<s1.size();i+=5)s+=C[bin2dec(s1.substr(i, 5))];
		cout<<s<< endl;
	}
}

Measured memory_bytes: 1212
#include <iostream>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main(){
    int a;
    int b;
    int ans;
    cin >> a >> b;
    ans=a*b;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
inline ll read(){
	ll x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
ll n,A,B;
int main(){
	n=read(),A=read(),B=read();
	if((B-A)&1){
		printf("%lld\n",min((A+B-1)>>1,(n-A+n-B+1)>>1));
	}
	else{
		printf("%lld\n",(B-A)>>1);
	}
	return 0;
}


Measured memory_bytes: 3736