akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int n = in.nextInt();
        BigInteger b = BigInteger.ONE;
        for (int i = 0; i < n; i++) {
            long t = in.nextLong();
            BigInteger bt = BigInteger.valueOf(t);
            b = lcm(b, bt);
        }
        System.out.println(b);
    }

    BigInteger lcm(BigInteger a, BigInteger b) {
        return a.multiply(b).divide(a.gcd(b));
    }
}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Long>{
    @Override public Long get(Object key){return containsKey(key)?super.get(key):0L;}
    public void add(T key,long v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final long v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Long>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

Measured memory_bytes: 23508
// Problem : A - Registration
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 


int solve(){


string a,b;cin>>a>>b;
string c="";
rep0(a.size()) c+=b[i];
// for(int i=0;i<a.size();i++)
if(a!=c) cout<<"No";
else cout<<"Yes";

    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl;
#define rep(i,n) for(ll i = 0;i < n;++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0);

const ll INF = 1e9+7;

// 各桁の和
template<typename T>
T digit(T num){
  T sum = 0;
  while(num){
    sum += num % 10;
    num /= 10;
  }
  return sum;
}

template<typename T>T gcd(T a,T b){
  if(b == 0)
    return a;
  return gcd(b,a%b);
}
template<typename T>T lcm(T a, T b){
  T g = gcd(a,b);
  return a/g*b; 
}
template<typename T>T power(T a,T b){
  T tmp = 1;
  rep(i,b){
    tmp *= a;
  }
  return tmp;
}
int main(){
  int n;cin>>n;
  vector<int> a(n);rep(i,n)cin>>a[i];
  int m = 0;
  auto tmp = max_element(all(a));
  int me = tmp - a.begin();
  rep(i,n){
    if(i == me)continue;
	m = max(m,a[i]);
  }
  int mn = *tmp;
  rep(i,n){
    if(i == me)print(m)
    else print(mn)
  }
  
  return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n,m;
  cin >> n >> m;
  int a[n],b[n];
  rep(i,n)cin >> a[i] >> b[i];
  vector<int> s[m];
  rep(i,n){
    if(a[i]<=m)s[m-a[i]].push_back(b[i]);
  }
  ll ans = 0;
  priority_queue<int> q;
  drep(i,m){
    for(int x:s[i])q.push(x);
    if(!q.empty()){
      ans += q.top();
      q.pop();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 9672
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
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;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  string S;

  cin>>S;

  int N=S.length();

  int ans=INF;
  rep(i,N-1){
    if(S[i]!=S[i+1]) chmin(ans,max(i+1,N-i-1));
  }

  if(ans==INF) ans=N;
  cout<< ans<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 512
N = int(input())
S = list(input())

Alphabet = 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'
Alphabet = Alphabet.split(',')

for i in range(0, len(S)):
    for q in range(0, 26):
        if S[i] == Alphabet[q]:
            if q + N > 25:
                S[i] = Alphabet[q + N - 26]
            else:
                S[i] = Alphabet[q + N]
            break

S = ''.join(S)
print(S)

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

int n, k;
long long ans;

long long calc(int cnt) {
  long long res = 1ll * cnt * (cnt - 1) * (cnt - 2);
  res += cnt;
  res += 1ll * cnt * (cnt - 1) * 3;
  return res;
}

int main() { 

  cin >> n >> k;

  if (k == 1) {
    ans = calc(n);
  } else {
    ans = calc(n / k);
    if (k % 2 == 0) {
      ans += calc((n / (k / 2)) - (n / k));  
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int n, c = 0;
  cin >> n;
  v1i v(n);
  rep(i, n){
    cin >> v[i];
    while(v[i] % 2 == 0){
      v[i] /= 2;
      ++c;
    }
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque


h, w = map(int, input().split())
a = [input() for i in range(h)]

q = deque([(0, 0)])
while q:
    i, j = q.pop()
    cnt = 0
    if i == h - 1 and j == w - 1:
        break
    for nxt_i, nxt_j in [(i + 1, j), (i, j + 1)]:
        if not(0 <= nxt_i < h and 0 <= nxt_j < w):
            continue
        if a[nxt_i][nxt_j] == "#":
            cnt += 1
            q.append((nxt_i, nxt_j))
    if cnt != 1:
        print("Impossible")
        exit()

cnt = 0
for i in range(h):
    cnt += a[i].count("#")
if cnt != h + w - 1:
    print("Impossible")
else:
    print("Possible")

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

using namespace std;

const int mxn = 1e6;
int pn = 0;
bool flag[mxn + 11];
int prime[mxn + 11];
int ans = 0;

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

void init(){
    memset(flag, true, sizeof(flag));
    for (int i = 2; i <= mxn; i++){
        if (flag[i]){
            prime[pn++] = i;
            for (int j = i + i; j <= mxn; j += i){
                flag[j] = false;
            }
        }
    }
}

void split(long long n){
    for (int i = 0; i < pn && prime[i] * 1LL * prime[i] <= n; i++){
        if (n % prime[i] == 0){
            while (n % prime[i] == 0){
                n /= prime[i];
            }
            ans++;
        }
    }
    if (n > 1LL)
        ans++;
}

int main(){
    init();
    long long a, b;
    scanf("%lld %lld", &a, &b);
    long long d = gcd(a, b);
    if (d == 1LL) {
        puts("1");
        return 0;
    }
    split(d);
    printf("%d\n",ans + 1);
    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	int cnt;bool flag=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		if(x==y){
			cnt++;
			if(cnt==3) flag = 1;
	    }
		else cnt=0;
	}
	if(flag)cout<<"Yes";else cout<<"No";
	return 0;
}

Measured memory_bytes: 3628
S=str(input())
N=len(S)

S1 = S[0:int((N-1)/2)]
S2 = S[int((N+3)/2)-1:N]

if S==S[::-1] and S1==S1[::-1] and S2==S2[::-1]:
  print("Yes")
else:
  print("No")

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

int main()
{
    string S, T;
    cin >> S >> T;
    cout << T << S << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque


def main():
    N = int(input())
    adj = [{} for _ in range(N)]
    ans = [float("inf")] * N
    for i in range(N-1):
        u, v, w = map(int, input().split())
        adj[u-1][v-1] = w
        adj[v-1][u-1] = w
    q = deque([(0, 0)])
    while len(q):
        cur, dist = q.popleft()
        ans[cur] = dist % 2
        for nxt in adj[cur]:
            if ans[nxt] == float("inf"):
                q.append((nxt, dist + adj[cur][nxt]))
    for i in range(N):
        print(ans[i])


if __name__ == "__main__":
    main()


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

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

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

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}

int grcd(int a,int b) {
  if(a < b) return grcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}


int main()
{
    ll N;
    string S;

    cin >> N >> S;

    if(N<=3){
        cout << 0 << endl;
        return 0;
    }

    ll tot;

    ll R=0,G=0,B=0;

    rep(i,N){
        if(S[i]=='R'){
            R++;
        }else if(S[i]=='G'){
            G++;
        }else{
            B++;
        }
    }

    tot=R*G*B;

    ll d=1,cot=0;

    while((2*d)<N){
        int i=0;
        while((i+2*d) <N){
            if(S[i] != S[i+d] && S[i+d] != S[i+2*d] && S[i] != S[i+2*d]){
                cot++;
            }
            i++;
        }
        d++;
    }   

   cout << tot-cot << endl;

 
    return 0;

}

Measured memory_bytes: 3580
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int H, W;
string S[8];
int vis[8][8];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(cin >> H >> W) {
        rep(y, H)cin >> S[y];

        MEM(vis, 0);
        queue<pii> Q;
        Q.push(mp(0,0));
        while(sz(Q)) {
            int y, x;
            tie(y, x) = Q.front(); Q.pop();
            if(y < 0 || x < 0 || y >= H || x >= W || S[y][x]=='.' || vis[y][x]++)continue;
            
            if(y + 1 < H && S[y + 1][x] == '#')Q.push(mp(y + 1, x));
            else if(x + 1 < W && S[y][x + 1] == '#')Q.push(mp(y, x + 1));
        }
        bool allVisited = true;
        rep(y, H)rep(x, W)if(!vis[y][x] && S[y][x] == '#') {
            allVisited = false;
        }
        if(vis[H - 1][W - 1] && allVisited)cout << "Possible" << endl;
        else cout << "Impossible" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define YN(f) (f?"YES":"NO")
#define yn(f) (f?"Yes":"No")	
#define INF 123456789123456
#define MOD (int)(1e9+7)
#define MAX_N 10
#define MAX_V 1



signed main(){
	int N, l, r, temp[MAX_N], sum = 0;
	cin>>N;
	for(int i = 0; i < N; i++){
		cin>>l>>r;
		sum += r-l+1;
	}
	
	cout<<sum<<endl;;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long n,l[86];
int main(){
cin >> n;
l[0]=2;
l[1]=1;
for(int i=2;i<=n;i++)
{
l[i]=l[i-1]+l[i-2];
}
cout << l[n] << endl;
system("pause");
return 0;
}

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

int64_t zettaichi(int64_t x){
  if(x >= 0){
    return x;
  }
  else{
    x = -x;
    return x;
  }
}

int main()
{
  int64_t n,k;
  cin >> n >> k;
  int64_t min = 0;

  int64_t a,b,c;
  a = n % k;    c = a - k;
  b = zettaichi(c);
  if(a > b){
    min = b;
  }
  else{
    min = a;
  }
  cout << min << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(void) {

	int a[3];

	cin >> a[0] >> a[1] >> a[2];

	sort(a, a + 3);

	if (a[0] + a[1] == a[2])cout << "Yes\n";
	else cout << "No\n";
	

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String args[]) {
 
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
 
        int n = s1.length();
        int m = s2.length();
 
        int dp[][] = new int[n+1][m+1];

        for(int i=n-1;i>=0;i--){
            for(int j=m-1;j>=0;j--){
                if(s1.charAt(i) == s2.charAt(j)){
                    dp[i][j] = 1 + dp[i+1][j+1];
                }
                else{
                    dp[i][j] = Math.max(dp[i+1][j],dp[i][j+1]);
                }
            }
        }

        int len = dp[0][0];
        char ans[] = new char[len];
        int k = 0;
        int i = 0;
        int j = 0;
        while(i < n && j < m){
                if(s1.charAt(i) == s2.charAt(j)){
                    ans[k++] = s1.charAt(i);
                    i++;
                    j++;
                }
                else{
                    if(dp[i+1][j] > dp[i][j+1]){
                        i++;
                    }
                    else{
                        j++;
                    }
                }
         }

        System.out.print(ans);
        
    }
}

Measured memory_bytes: 81520
#include <bits/stdc++.h>
using namespace std;
#define __Mammamia__                ios_base :: sync_with_stdio(false);
#define ll                          long long
#define MAXN                        1000007

int main ()
{
    __Mammamia__

    int n, k; cin >> n >> k;
    int rock, paper, scissor, points = 0; cin >> rock >> scissor >> paper; cin.ignore();

    string str, temp; cin >> str;
    //cout << "Str : " << str << endl;

    for (int i = 0; i < str.size(); ++i)
    {
        //cout << "Str[i] " << str[i] << endl;
        if (str[i] == 'r')
        {
            //cout << "I : " << i << " type : R " << endl;
            if (i - k >= 0 && str[i - k] == 'p') {str[i] = '.';}
            else {str[i] = 'p'; points += paper;}
        }
        else if (str[i] == 'p')
        {
            //cout << "I : " << i << " type : P " << endl;
            if (i - k >= 0 && str[i - k] == 's') {str[i] = '.';}
            else {str[i] = 's'; points += scissor;}
        }
        else if (str[i] == 's')
        {
            //cout << "I : " << i << " type : S " << endl;
            if (i - k >= 0 && str[i - k] == 'r') {str[i] = '.';}
            else {str[i] = 'r'; points += rock;}
        }
        //cout << "I : " << i << " points : " << points << endl;
    }
    cout << points << endl;



    return 0;
}





Measured memory_bytes: 512
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)n; ++i)

char s[20];

int main(){
	int x, y, an = 0;
	scanf("%d%d", &x, &y);
	f(i, 0, x + 1)f(j, 0, x + 1){
		int t = y - i - j;
		if (t >= 0 && t <= x)++an;
	}
	printf("%d\n", an);
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl); 
#define cop(a) for(auto x:(a)){cout << x << endl;}

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

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr int MOD = 1e9+7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){
    int n;
    scanf("%d", &n);
    vector<pair<double, double>> xy(n);
    rep(i, n)
        scanf("%lf%lf", &xy[i].first, &xy[i].second);
    sort(xy.begin(), xy.end());
    double sm = 0;
    do{
        rep(i, n-1)
            sm += sqrt((xy[i+1].first-xy[i].first)*(xy[i+1].first-xy[i].first)+(xy[i+1].second-xy[i].second)*(xy[i+1].second-xy[i].second));
    }while(next_permutation(xy.begin(), xy.end()));
    
    for(int i = 1; i <= n; ++i) sm /= i;
    ppp(sm);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++)
    cin>>a.at(i);
  sort(a.begin(),a.end());
  bool x=true;
  if(!(a[0]*2-a[N-1]==0 || a[0]*2-a[N-1]==1))
    cout<<"Impossible"<<endl;
  else if(a[0]*2-a[N-1]==0){
  map<int,int>M;
    for(int i=1;i<=N-1;i++)M[i]=0;
    for(int i=0;i<N;i++)
     M.at(a[i])++;
                for(int i=a[0];i<=a[N-1];i++){
                if(i==a[0]){if(M.at(i)!=1){x=false;break;}}
                            else{if(M.at(i)<=1){x=false;break;}}
                             
                }
    if(x)cout<<"Possible"<<endl;
                              else
                                cout<<"Impossible"<<endl;
  }else{
                    map<int,int>M;
     for(int i=1;i<=N-1;i++)M[i]=0;
    for(int i=0;i<N;i++)
     M.at(a[i])++;
                for(int i=a[0];i<=a[N-1];i++){
                if(i==a[0]){if(M.at(i)!=2){x=false;break;}}
                            else{if(M.at(i)<=1){x=false;break;}}
                             
                }
                  if(x)cout<<"Possible"<<endl;
                              else
                                cout<<"Impossible"<<endl;
  
  }
  return 0;
}

Measured memory_bytes: 3644
/**
 *    author:  morato
 *    created: 13.09.2020 09:32:11
**/
#include <bits/stdc++.h>

using namespace std;

const int N = 2005;
const int64_t MOD = 1e9 + 7;

int64_t fact[N], inv[N];

int64_t mod(int64_t a, int64_t b = MOD) {
  a %= b;
  if (a < 0) a += b;
  return a;
}

int64_t expo(int64_t b, int64_t e) {
  if (!e) return 1;
  int64_t u = expo(b, e / 2ll);
  u = mod(u * u);
  if (e & 1) u = mod(u * b);
  return u;
}

void setup() {
  fact[0] = inv[0] = 1;
  for (int i = 1; i <= 2000; i++) {
    fact[i] = mod(fact[i - 1] * i);
  }
  for (int i = 1; i <= 2000; i++) {
    inv[i] = expo(fact[i], MOD - 2);
  }
}

int64_t C(int64_t n, int64_t k) {
  return mod(mod(fact[n] * inv[n - k]) * inv[k]);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  setup();
  int64_t n; cin >> n;
  int64_t ans = (n >= 3);
  for (int64_t i = 2; i <= n; i++) {
    int64_t bolas = n - 3 * i;
    if (bolas < 0) break;
    ans = mod(ans + C(i + bolas - 1, bolas));
  }
  cout << ans << '\n';
  return 0;
}

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

#define MAXN 100010
#define ll long long
#define mod 1000000007

using namespace std;

int n, m, k;
int ans, tot;

int a[MAXN];

string s;

int main(){
	int t;
	int x, y, z;
	cin >> x >> y >> z;
	swap(x, y);
	swap(x, z);
	cout << x << " " << y << " " << z << endl;
	
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
s = input()
# ２文字以上の回文でない→ abcabc...の形のみ？

cs = Counter(s)
cnts = [val for itr, val in cs.items()]
if (max(cnts) - min(cnts) <= 1 and len(cnts) == 3) or (max(cnts) == min(cnts) == 1 and len(cnts) <= 2):
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
template <class T> inline bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> inline bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main() {
	int n, W;
	cin >> n >> W;
	int* v = new int[ n ];
	int* w = new int[ n ];
	rep( i, 0, n ){
		cin >> w[ i ] >> v[ i ];
	}
	ll lim = accumulate( v, v + n, 0ll ) + 1;
	ll* * dp = new ll*[ n + 1 ];
	dp[ 0 ] = new ll[ ( n + 1 ) * ( lim ) ];
	rep( i, 1, n + 1 ){
		dp[ i ] = dp[ 0 ] + i * ( lim );
	}
	fill( dp[ 0 ], dp[ 0 ] + ( n + 1 ) * ( lim ), INF );
	dp[ 0 ][ 0 ] = 0;
	rep( i, 0, n ){
		rep_d( j, lim, 0 ){
			if (j - v[ i ] >= 0){
				chmin( dp[ i + 1 ][ j ], dp[ i ][ j - v[ i ] ] + w[ i ] );
			}
			chmin( dp[ i + 1 ][ j ], dp[ i ][ j ] );
		}

	}

	int index = 0;
	rep( i, 0, lim ){
		if (dp[ n ][ i ] <= W)
			index = i;
	}
	printf( "%d\n", index );
}

Measured memory_bytes: 79104
import itertools

S = [input() for _ in range(3)]
MX = 2000
ans = MX*3
s = ['','','']
for s[0],s[1],s[2] in list(itertools.permutations(S,3)):
  d = [[[False for _ in range(MX)] for _ in range(3)] for _ in range(3)]
  for i in range(3):
    for j in range(3):
      if i >= j:
        continue
      for k in range(len(s[i])):
        f = True
        for ni in range(k,len(s[i])):
          nj = ni-k
          if nj >= len(s[j]):
            break
          if s[i][ni] == '?' or s[j][nj] == '?':
            continue
          if s[i][ni] != s[j][nj]:
            f = False
        d[i][j][k] = f
  
  def check(i,j,k):
    if k >= len(s[i]):
      return True
    return d[i][j][k]
  
  for x in range(MX):
    for y in range(MX):
      if not check(0,1,x):
        continue
      if not check(1,2,y):
        continue
      if not check(0,2,x+y):
        continue
      tmpans = 0
      tmpans = max(len(s[0]),tmpans)
      tmpans = max(x+len(s[1]),tmpans)
      tmpans = max(x+y+len(s[2]),tmpans)
      ans = min(tmpans,ans)

print(ans)

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

long long N;
vector<long long> A;



// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin >> N;
    for (int i = 0; i < N; i++) {
        long long a;
        cin >> a;
        A.push_back(a);
    }

    vector<pair<long long, long long>> t(N, pair<long long, long long>(0, 0));
    for (int i = 0; i < N; i++) {
        if (i + A[i] < N) {
            t[i+A[i]].first++;
        }
        if (i - A[i] >= 0) {
            t[i-A[i]].second++;
        }
    }

    long long result = 0;
    for (int i = 0; i < N; i++) {
        result += t[i].first * t[i].second;
    }
    cout << result << endl;
    return 0;
}


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

int main() {
    string s;
    cin >> s;
    if (s[0] == 'S') {
        cout << "Cloudy\n";
    } else if (s[0] == 'C') {
        cout << "Rainy\n";
    } else {
        cout << "Sunny\n";
    }
}

Measured memory_bytes: 256
from collections import deque

n, m = map(int,input().split())

e = [[] for i in range(n)]
for i in range(m):
    f, t = map(int,input().split())
    f -= 1
    t -= 1
    e[f].append(t)
    e[t].append(f)

INF = 10**9
dist = [INF] * n
dist[0] = 0
d = deque()
d.append([0, 0])

while d:
    f, c = d.pop()
    if c >= 2:
        break
    for t in e[f]:
        if c + 1 < dist[t]:
            dist[t] = c + 1
            d.appendleft([t, c+1])
print('POSSIBLE') if dist[n-1] <= 2 else print('IMPOSSIBLE')

Measured memory_bytes: 50932
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin >> n >> k;
	int arr[n];
	
	for(int i=0;i<n;i++)cin >> arr[i];
	int dp[n];
	for(int i=0;i<n;i++)dp[i]=INT_MAX;
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);

	for(int i=2;i<n;i++){
	for(int j=i-1;j>=0 && j>=i-k;j--)
	dp[i]=min(dp[j]+abs(arr[i]-arr[j]),dp[i]);
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<deque>
#include<functional>
#include<numeric>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
/////////////////////

#ifdef _DEBUG
ll const INF = 41;
#else
ll const INF = 1e18 + 41;
#endif
int const N = 1e5 + 41;

int n, a[N];
ll ans0, ans1;

void bad(){
	printf("-1\n");
	exit(0);
}

ll calc(ll q){
	fi(0, n){
		q = q / a[i] * a[i];
	}
	return q;
}

void solve(){
	ll l = 0;
	ll r = INF;
	while(r-l>1){
		ll m = (l+r)/2;
		if(calc(m) <= 2){
			l = m;
		}else{
			r = m;
		}
	}
	ans1 = l;
	
	l = 0;
	r = INF;
	while(r-l>1){
		ll m = (l+r)/2;
		if(calc(m) < 2){
			l = m;
		}else{
			r = m;
		}
	}
	ans0 = r;
	if(calc(r) != 2) bad();
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d",&n);
	fi(0, n) scanf("%d",&a[i]);

	solve();

	printf("%lld %lld\n",ans0,ans1);

	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>


using namespace std;
using ll = long long;

int N;
int a, b, c, d;
string str;
bool flag = true;
int note[200001];

int main()
{
	cin >> N >> a >> b >> c >> d;
	cin >> str;
	if (c < d)
	{
		flag = true;
		bool rec = false;
		for (int i = a - 1; i < c - 1; i++)
		{
			if (str.substr(i, 2) == "##")
			{
				flag = false;
				break;
			}
		}
		rec = false;
		for (int i = b - 1; i < d - 1; i++)
		{
			if (str.substr(i, 2) == "##")
			{
				flag = false;
				break;
			}
		}
	}
	else
	{
		flag = false;
		for (int i = b - 2; i < d - 1; i++)
		{
			if (str.substr(i, 3) == "...") 
			{
				flag = true;
			}
		}
		if (flag)
		{
			for (int i = a - 1; i < c; i++)
			{
				if(str.substr(i, 2) == "##")
				{
					flag = false;
					break;
				}
			}
			for (int i = b - 1; i < d - 1; i++)
			{
				if (str.substr(i, 2) == "##")
				{
					flag = false;
					break;
				}
			}
		}
	}
	if (flag)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

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

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

    if (n[0] == n[1] && n[1] == n[2] || n[1] == n[2] && n[2] == n[3])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


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

#define pb push_back
#define vi vector < int >
#define ii pair < int, int >
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define ll long long
#define X first
#define Y second
#define mp make_pair
#define FOR( i, lo, hi ) for( int i = (lo);i < (hi);i++ )
#define DFOR( i, hi, lo ) for( int i = (hi);i >= (lo);i-- )
#define pqueue priority_queue

using namespace std;

int a, b, c;

int main()
{
	cin >> a >> b >> c;
	cout << max( c - ( a - b ), 0 ) << "\n";
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def eratosthenes(n):
    p = []
    t = [-1] * n

    for i in range(2, int(math.ceil(math.sqrt(n)))):
        if t[i] == -1:
            p.append(i)
            t[i] = i
            for j in range(2*i, n, i):
                if t[j] == -1:
                    t[j] = i

    for j in range(i+1, n):
        if t[j] == -1:
            p.append(j)
            t[j] = j

    return p, t

P, T = eratosthenes(10**6+1)

class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)

def factor(a):
    ps = Counter()
    while a != 1:
        f = T[a]
        while a % f == 0:
            ps[f] += 1
            a //= f
    return ps

@mt
def slv(N, A):
    lcm = Counter()
    for a in A:
        ps = factor(a)
        for k in ps.keys():
            lcm[k] = max(lcm[k], ps[k])

    M = Mod(10**9+7)
    l = 1
    for k, v in lcm.items():
        l = M.mul(l, M.pow(k, v))

    ans = 0
    for a in A:
        ans = M.add(ans, M.div(l, a))
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))

    N = 10000
    # A = [random.randint(1, 10**6) for _ in range(N)]
    # print(slv(N, A))


if __name__ == '__main__':
    main()


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

const int Nmax=200010;

int main() {
	ll N;
	cin >> N;
	string S[Nmax];
	char c[Nmax];
	ll cnt[5]={};
	for(int i=0;i < N;i++){
		cin >> S[i];
		string str(S[i]);
		c[i] = str[0]; //1文字目を抜きだす
		if(c[i]=='M') cnt[0]++;
		if(c[i]=='A') cnt[1]++;
		if(c[i]=='R') cnt[2]++;
		if(c[i]=='C') cnt[3]++;
		if(c[i]=='H') cnt[4]++;
	}
	ll ans=0;
	for(int i=0;i < 3;i++){
		for(int j=i+1;j < 4;j++){
			for(int k=j+1;k < 5;k++){
				ans += cnt[i]*cnt[j]*cnt[k];
			}
		}
	}
	cout << ans << endl;
	
  	return 0;
}

Measured memory_bytes: 6912
#pragma GCC optimize("-O3")
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<cmath>
#define LL long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
 
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void Out(int x){
    if(x>9) Out(x/10);
    putchar('0'+x%10);
}
LL gcd(LL x,LL y){
    if(!y) return x;
    return gcd(y,x%y);
}
LL qpow(LL x,LL y,LL P){
    LL re=1;
    while(y){
        if(y&1) re=re*x%P;
        x=x*x%P;y>>=1;
    }
    return re;
}
const int N=1e5+10;
LL n,x,y;
int main(){
	scanf("%lld%lld",&n,&x);
	y=gcd(n,x);
	y=n-y;
	y=y+y+y;
	printf("%lld\n",y);
	return 0;
}
/*

*/

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

namespace ITP1_11_B
{
	class Program
	{
		// faces[] = { 0, 1, 2, 3, 4, 5, 6 };
		//   0
		// 3 1 2 4
		//   5
		static void Main(string[] args)
		{
			string s1 = Console.ReadLine();
			string[] faces = s1.Split();

			string s2 = Console.ReadLine();
			int count = int.Parse(s2);
			for (int i = 0; i < count; i++) {
				string s3 = Console.ReadLine();
				string[] str = s3.Split();

				Dice dice = new Dice(faces);
				// 上面を探す
				int c = 0;
				while (dice.Top != str[0]) {
					if (c < 3) {
						dice.MoveN();
					} else if (c < 4) {
						dice.MoveE();
					} else if (c < 5) {
						dice.MoveE();
						dice.MoveE();
					} else if (c < 6) {
						break;
					}
					c++;
				}
				// 正面を探す
				c = 0;
				while (dice.South != str[1]) {
					if (c < 3) {
						dice.MoveCW();
					} else {
						break;
					}
					c++;
				}
				// 右側面
				Console.WriteLine(dice.East);
			}
			//Console.WriteLine("Hit Any Key");
			//Console.ReadLine();
		}
	}

	class Dice
	{
		//   1
		// 4 2 3 5
		//   6
		public string Top { get; private set; }
		public string North { get; private set; }
		public string South { get; private set; }
		public string East { get; private set; }
		public string West { get; private set; }
		public string Bottom { get; private set; }
		public Dice(string[] faces)
		{
			Top = faces[0];
			North = faces[4];
			South = faces[1];
			East = faces[2];
			West = faces[3];
			Bottom = faces[5];
		}
		public void MoveN()
		{
			// T<-S<-B<-N<-T
			string tmp = Top;
			Top = South;
			South = Bottom;
			Bottom = North;
			North = tmp;
		}
		public void MoveS()
		{
			// T<-N<-B<-S<-T
			string tmp = Top;
			Top = North;
			North = Bottom;
			Bottom = South;
			South = tmp;
		}
		public void MoveE()
		{
			// T<-W<-B<-E<-T
			string tmp = Top;
			Top = West;
			West = Bottom;
			Bottom = East;
			East = tmp;
		}
		public void MoveW()
		{
			// T<-E<-B<-W<-T
			string tmp = Top;
			Top = East;
			East = Bottom;
			Bottom = West;
			West = tmp;
		}
		public void MoveCW()
		{
			// N<-W<-S<-E<-N
			string tmp = North;
			North = West;
			West = South;
			South = East;
			East = tmp;
		}
		public void MoveCCW()
		{
			// N<-E<-S<-W<-N
			string tmp = North;
			North = East;
			East = South;
			South = West;
			West = tmp;
		}
	}
}

Measured memory_bytes: 8908
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

ll frac[100100];
ll ifrac[100100];

void gen(){
  frac[0]=1;
  ifrac[0]=1;
  FOR(i, 1, 100001){
    frac[i] = mod(frac[i-1]*i, MOD);
    ifrac[i] = modinv(frac[i], MOD);
  }
}

ll comb(ll n, ll k){
  if(n<0)return 0;
  if(n<k)return 0;
  if(k<0)return 0;
  ll ans = mod(frac[n]*ifrac[k], MOD);
  ans = mod(ans*ifrac[n-k], MOD);
  return ans;
}

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, M;
  cin >> N >> M;
  gen();
  if(N>M)swap(N, M);
  if(M-N>1){
    cout << 0;
  }else if(M-N==1){
    cout << mod(frac[M]*frac[N],MOD);
  }else{
    cout << mod(frac[M]*frac[N]*2,MOD);    
  }
  
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

ll dp[55][5005];

int main(int argc, char* argv[])
{
    long n, a;
    scanf("%ld%ld", &n, &a);

    vector<long> x(n);
    long i,j;
    for(i=0; i<n; i++) {
        scanf("%ld", &x[i]);
        x[i] -= a;
    }
    sort(x.begin(), x.end());

    dp[0][50*n]=1;
    for(i=1; i<=n; i++) {
        for(j=0; j<=2*50*n; j++) {
            dp[i][j] += dp[i-1][j];
            if(j-x[i-1]>=0 && j-x[i-1]<=2*50*n) dp[i][j] += dp[i-1][j-x[i-1]];
        }
    }
    printf("%lld\n", dp[n][50*n]-1);

    return 0;
}


Measured memory_bytes: 2176
#include<iostream>

using namespace std;
int fib(int n);
int memo[45];
int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

int fib(int n){
  if(n==0 || n == 1){
    return 1;
  }else if(memo[n] != 0){
    return memo[n];
  }else{
    return memo[n] = fib(n-1) + fib(n-2);
  }
}



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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  int ans=0;
  if(A>B)swap(A, B);
  if(B>C)swap(B, C);
  if(A%2==B%2 && A%2==C%2)ans = (C*2-A-B)/2;
  else if(A%2==B%2)ans=(C*2-A-B)/2;
  else ans = (C*2-A-B)/2+2;
  
  cout << ans <<endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
   ;
    //サンプルコード;;
    //ABC076-A;;
    ;;
    int a, b, k;;;
    cin >> a >> b >> k;;;
    ;;
    vector<int> klst;;;
    if(0<k-1){;;;
        for(int i = 0; i <= k-1; ++i){;;;
        bool flg = true;;;
        if(a+i<=b){;;;
            for(int j = 1; j <=  klst.size(); ++j){;;
    int val_0_ = klst[j-1]; if(val_0_==a+i){ flg = false; break;;};;}
            if(flg){ cout << (a+i) << endl;; klst.push_back(a+i);;;}
        ;};;
    ;};;
    ;;}
    else {;;;
        for(int i = 0; i >= k-1; --i){;;;
        bool flg = true;;;
        if(a+i<=b){;;;
            for(int j = 1; j <=  klst.size(); ++j){;;
    int val_1_ = klst[j-1]; if(val_1_==a+i){ flg = false; break;;};;}
            if(flg){ cout << (a+i) << endl;; klst.push_back(a+i);;;}
        ;};;
    ;};;
    ;;};;
    if(k-1<0){;;;
        for(int i = k-1; i <= 0; ++i){;;;
        bool flg = true;;;
        if(b-i>=a){;;;
            for(int j = 1; j <=  klst.size(); ++j){;;
    int val_2_ = klst[j-1]; if(val_2_==b-i){ flg = false; break;;};;}
            if(flg){ cout << (b-i) << endl;; klst.push_back(b-i);;;}
        ;};;
    ;};;
    ;;}
    else {;;;
        for(int i = k-1; i >= 0; --i){;;;
        bool flg = true;;;
        if(b-i>=a){;;;
            for(int j = 1; j <=  klst.size(); ++j){;;
    int val_3_ = klst[j-1]; if(val_3_==b-i){ flg = false; break;;};;}
            if(flg){ cout << (b-i) << endl;; klst.push_back(b-i);;;}
        ;};;
    ;};;
    ;;};;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    Scanner scanner = new Scanner(System.in);
	    int a = scanner.nextInt();
	    int b = scanner.nextInt();
	    if (a < b) {
	        System.out.println("a < b");
        } else if (a > b) {
            System.out.println("a > b");
        } else {
            System.out.println("a == b");
        }
	    scanner.close();
    }
}



Measured memory_bytes: 26028
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		int max = 0;
		if(a >= k){
			max = 1 * k;
		}else if(b > k - a){
			max = a;
		}else{
			max = a - (k - a - b);
		}
		System.out.println(max);
	}

}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli d, g;
  while (cin >> d >> g) {
    g /= 100;

    vector<pair<int, lli>> v(d);
    each (i, v) {
      cin >> i.first >> i.second;
      i.second /= 100;
    }

    const int D = 10 + 5;
    const int N = 10 * 100 * 3;
    const lli inf = 1LL << 60;
    static lli dp[D][N];
    fill(&dp[0][0], &dp[D - 1][N - 1] + 1, -inf);
    dp[0][0] = 0;

    for (int i = 0; i < v.size(); ++i) {
      for (int solved = 0; solved <= 10*100; ++solved) {
        for (int added = 0; added <= v[i].first; ++added) {
          int x = added * (i + 1);
          int y = v[i].second * (added == v[i].first);
          dp[i + 1][solved + added] = max(dp[i + 1][solved + added], dp[i][solved] + x + y);
        }
      }
    }

    int mn = 1 << 29;
    for (int i = 0; i < N; ++i) {
      if (g <= dp[d][i]) mn = min(mn, i);
    }
    cout << mn << endl;
  }

  return 0;
}


Measured memory_bytes: 640