akhauriyash/Code-Regression huggingface dataset:
#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 rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    int ans = 0;
    ans += a[2]-a[1];
    a[0] += ans;
    if((a[2]-a[0])%2 == 0) ans += (a[2]-a[0])/2;
    else ans += (a[2]-a[0])/2+2;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//pbds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>   using orderedSet =tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;
///use less_equal in pbds template to work as multiset...................................................
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
//BFS+DFS
#define boundary(i,j) (i>=0 && i<n && j>=0 && j<m)
int X[]={-1,1,0,0};
int Y[]={0,0,1,-1};
ll a[200005];
ll pref[200006];
ll mod=1e9+7;
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int n;
     cin>>n;
     for(int i=1; i<=n; i++)
        cin>>a[i];
     for(int i=n; i>=1; i--)
        pref[i]=(a[i]+pref[i+1])%mod;
    ll ans=0;
    for(int i=1; i<n; i++)
    {
        ans=(ans%mod+(a[i]*pref[i+1])%mod)%mod;
    }
    cout<<ans<<endl;

}





Measured memory_bytes: 6748
#include<iostream>
#include<algorithm>
using namespace std;
int dp[1001][8];
int can[8][7]={0,0,0,0,0,0,0,1,3,5,7,0,0,0,2,3,6,7,0,0,0,1,2,3,5,6,7,0,4,5,6,7,0,0,0,1,3,4,5,6,7,0,2,3,4,5,6,7,0,1,2,3,4,5,6,7};
int nots[3][4]={0,1,2,3,0,1,4,5,0,2,4,6};
int main(){
	int n;
	char z;
	cin>>n>>z;
	for(int i=0;i<n;i++){
		for(int j=0;j<8;j++){
			dp[i][j]=0;
		}
	}
	int set;
	if(z=='J')set=0;
	if(z=='O')set=1;
	if(z=='I')set=2;
	for(int i=4;i<8;i++){
		bool ok=true;
		for(int j=0;j<4;j++){
			if(nots[set][j]==i){
				ok=false;
			}
		}
		if(ok){
			dp[0][i]=1;
		}
	}
	for(int i=1;i<n;i++){
		cin>>z;
		if(z=='J')set=0;
		if(z=='O')set=1;
		if(z=='I')set=2;
		for(int j=0;j<8;j++){
			for(int k=0;k<8;k++){
				bool ok=false;
				for(int r=0;r<7;r++){
					if(can[k][r]==j){
						ok=true;
					}
				}
				for(int r=0;r<4;r++){
					if(nots[set][r]==j){
						ok=false;
					}
				}
				if(ok){
					dp[i][j]+=dp[i-1][k];
				}
			}
			dp[i][j]%=10007;
		}
	}
	int ans=0;
	for(int i=0;i<8;i++){
		ans+=dp[n-1][i];
	}
	cout<<ans%10007<<endl;
	return 0;
}

Measured memory_bytes: 1192
#include <stdio.h>

int main(void)
{
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if ((0 <= x - r) && (x + r <= W) && (0 <= y - r) && (y + r <= H)) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}



Measured memory_bytes: 2096
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
#endif

int visited[100][100];
int memo[100][100];
bool solve(int x, int y){
    if(visited[x][y]){ return memo[x][y]; }
    visited[x][y] = 1;
    if(x <= 1 && y <= 1){
        return false;
    }
    bool win = false;
    for(int i=1;i<=x/2;i++){
        win |= !solve(x - i * 2, y + i);
    }
    for(int i=1;i<=y/2;i++){
        win |= !solve(x + i, y - i * 2);
    }
    return memo[x][y] = win;
}

int main(){
    ll x, y;
    cin >> x >> y;
    if(abs(x - y) <= 1){
        cout << "Brown" << '\n';
    }else{
        cout << "Alice" << '\n';
    }
    return 0;
    int i = 8;
    for(int j=0;j<50;j++){
        prints(i, j, solve(i, j) ? 'A' : 'B');
    }
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;

//y mod x=y xor x
// y xor x <x
//(yの最上位bit <= xの最上位bit)
//x>yなら y mod x=y= y xor x
//x<=y y=x+(y xor x)
//y-x=y xor x


// 上i桁目まで見てxの状態

//dp[i]:=i番目まで見て、(x,y)としてあり得る数

//dp[i][j][k][l][m]:=i番目まで見て、j=ここまでyがRと一致してるか、
//k=ここまでyがLと一致してるか,l=ここまでxがRと一致してるか、
//r=ここまでxがLと一致してるか

ll dp[61][2][2][2][2][2];
void solve(ll l,ll r) {
	//ll l, r; cin >> l >> r;
	dp[60][1][1][1][1][1] = 1;
	per(i, 60) {
		ll s = (ll)1 << i;
		//i桁目を
		//xは0,yは0にする
		bool samer = false;
		bool samel = false;
		if (r&s) {
			samer = true;
		}
		if (l&s) {
			samel = true;
		}
		rep(j, 2) {
			rep(k, 2) {
				if (k == 1 && samel)continue;
				rep(m, 2) {
					rep(n, 2) {
						rep(z, 2) {
							if (n == 1 && samel)continue;
							int nexj = j & (!samer);
							int nexm = m & (!samer);
							(dp[i][nexj][k][nexm][n][z] += dp[i + 1][j][k][m][n][z]) %= mod;
						}
					}
				}
			}
		}
		//xは0,yは1にする
		rep(j, 2) {
			if (j == 1 && !samer)continue;
			rep(k, 2) {
				rep(m, 2) {
					rep(n, 2) {
						if (n == 1 && samel)continue;
						int nexk = k & (samel);
						int nexm = m & (!samer);
						(dp[i][j][nexk][nexm][n][0] += dp[i + 1][j][k][m][n][0]) %= mod;
					}
				}
			}
		}

		//xは1,yは1にする
		rep(j, 2) {
			if (j == 1 && !samer)continue;
			rep(k, 2) {
				rep(m, 2) {
					if (m == 1 && !samer)continue;
					rep(n, 2) {
						rep(z, 2) {
							int nexk = k & (samel);
							int nexn = n & (samel);
							(dp[i][j][nexk][m][nexn][0] += dp[i + 1][j][k][m][n][z]) %= mod;
						}
					}
				}
			}
		}
	}
	ll ans = 0;
	rep(i, 2) {
		rep(j, 2) {
			rep(k, 2) {
				rep(m, 2) {
					rep(z, 2) {
						ans += dp[0][i][j][k][m][z];
						if (ans >= mod)ans -= mod;
				    }
			    }
			}
		}
	}
	cout << ans << endl;
}

void sample(int l,int r) {
	int ans = 0;
	for (int x = l; x <= r; x++) {
		for (int y = x; y <= r; y++) {
			if (y % x == (y^x)) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}
void test(ll x, ll y) {
	//cout << "test" << endl;
	//sample(x, y);
	solve(x, y);
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//init();
	ll l, r; cin >> l >> r; test(l, r);
	//solve();

	//cout << "finish" << endl;
	//stop
	return 0;
}

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

int main()
{
    int n;
    double x, sum = 0;
    string u;

    ci >> n;
    
    rep(i, n) {
	ci >> x >> u;

	if(u == "JPY") sum += x;
	else sum += x * 380000.0;
    }

    co << sum << en;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
 
    ll n;
    cin >> n;
 
    vector<ll> s(n+1);
    s[0] = 0;
    rep1(i, n+1){
        ll a;
        cin >> a;
        s[i] = s[i-1] + a;
    }
 
    sort(s.begin(), s.end());
 
    map<ll, ll> num;
    rep(i, n+1){
        ++num[s[i]];
    }
 
    // rep(i, n+1) cout << s[i] << " ";
    // cout << endl;
 
    ll res = 0;
    for(auto iter = num.begin(); iter != num.end(); ++iter){
        ll m = iter->second;
        if(m == 0) ++res;
        if(m > 1) res += m * (m-1) / 2;
    }
 
    cout << res << endl;
 
 
    return 0;
}

Measured memory_bytes: 14336
#include<iostream>
#include<climits>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
int main(){
  int n,k,tmp,s=0;
  cin>>n>>k;
  vector<int>a(200000,0);
  for(int i=0;i<n;i++){
    cin>>tmp;
    if(a[tmp-1]==0)s++;
    a[tmp-1]++;
  }
  sort(a.begin(),a.end());
  a.erase(a.begin(),a.begin()+200000-s);
  cout<<(s<=k?0:accumulate(a.begin(),a.begin()+s-k,0))<<endl;
  return 0;
}

Measured memory_bytes: 1024
N = int(input())

dp = [10**100]*(N + 10**6)
dp[0] = 0
delta = [1, 6, 6**2, 6**3, 6**4, 6**5, 6**6, 9, 9**2, 9**3, 9**4, 9**5]
for i in range(0, N):
    for d in delta:
        dp[i+d] = min(dp[i+d], dp[i] + 1)
print(dp[N])

Measured memory_bytes: 53724
//どうかACをお恵みくださいお願いしますお願いしますお願います何もしませんから
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            string[] n = Console.ReadLine().Split();
            int A = int.Parse(n[0]);
            int B = int.Parse(n[1]);
            if((B-1)%(A-1)==0)
            {
                Console.WriteLine((B - 1) / (A - 1));
            }
            else
            {
                Console.WriteLine((B - 1) / (A - 1) + 1);
            }
        }
    }
}

Measured memory_bytes: 27564
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;
const int N = 1e6 + 10;

long long modpow(long long n, long long k, long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}

void solve(){
   int n,m,c;
   cin >> n >> m >> c;
   vector<int>b(m);
   for(int i = 0;i<m;i++) cin >> b[i];
   int ans = 0;
   while(n--){
    vector<int>a(m);
    for(int i = 0;i<m;i++) cin >> a[i];
    int sum = 0;
    for(int i = 0;i<m;i++) sum += (a[i]*b[i]);
    sum += c;
    if(sum>0) ans++;
   }
   cout <<ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3664
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	int A,B;
	char op;
	cin >> A;
	cin >> op;
	cin >> B;

	int ans;
	if (op == '+') ans = A + B;
	else ans = A - B;

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


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static Map<Integer, Long> map = new HashMap<>();

	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(System.in);
		String[] conf = scanner.nextLine().split(" ");
		int insertCount = Integer.parseInt(conf[0]);
		long rank = Long.parseLong(conf[1]);

		for (int i = 0; i < insertCount; i++) {
			String[] inputs = scanner.nextLine().split(" ");
			addIfExistsElseThenPut(Integer.valueOf(inputs[0]), Long.valueOf(inputs[1]));
		}

		ArrayList<Integer> keys = new ArrayList<>();
		keys.addAll(map.keySet());
		keys.sort(Comparator.naturalOrder());
		long currentRank = 0;
		for (Integer key: keys) {
			currentRank += map.get(key);
			if (currentRank >= rank) {
				System.out.println(key);
				break;
			}
		}
	}

	private static void addIfExistsElseThenPut(int item, long number) {
		if (map.containsKey(item)) {
			map.put(item, map.get(item) + number);
		} else {
			map.put(item,  number);
		}
	}
}


Measured memory_bytes: 126292
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"

inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    X=I()
    d=100
    u=105
    i=1
    while True:

        if X<d*i:
            print(0)
            exit()
        if X<=u*i and X>=d*i:
            print(1)
            exit()
        else:
            i+=1

if __name__ == "__main__":
    main()

Measured memory_bytes: 22512
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
string s;
int r,ans,n;
int main(){
	cin>>n>>s;
	for(int i=0;i<s.size();i++)
		if(s[i]=='R')
			r++;
	for(int i=0;i<r;i++)
		if(s[i]!='R')
			ans++;
	cout<<ans;
	return 0;
}

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    sort(A.begin(),A.end());
    int count = 0;
    for (int i=0;i<N-1;i++) {
        if (A[i] == A[i+1]) count++;
    }
    int ans = N - ((count+1)/2)*2;
    cout << ans << "\n";
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && a!=c) cout<<"Yes";
  else if(a==c && a!=b) cout<<"Yes";
  else if(b==c && a!=c) cout<<"Yes";
  else cout<<"No";
}


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

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
    
    ll N,A,B; cin>>N>>A>>B;
    vector<ll> X(N);
    REP(i,N)cin>>X[i];

    ll ans=0;
    for(int i=1;i<N;i++){
        ll dist=abs(X[i-1]-X[i]);
        if(dist*A>B){
            ans+=B;
        }else{
            ans+=A*dist;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x) // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;

    vector<set<ll> > v(n);

    for (ll i = 0; i < m; i++)
    {
        ll a, b;
        cin >> a >> b;
        v[a - 1].insert(b - 1);
        v[b - 1].insert(a - 1);
    }

    if (!v[0].empty())
    {
        for (auto i : v[0])
        {
            if(!v[i].empty())
            {
                if (v[i].find(n - 1) != v[i].end())
                {
                    cout << "POSSIBLE" << endl;
                    exit(0);
                }
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 28416
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    B = [SI() for _ in range(n)]

    BT = list(zip(*B))
    res = 0
    for a in range(n):
        is_good = True
        for i in range(n):
            if B[i][n - a:] + B[i][:n - a] != ''.join(BT[(i - a) % n]):
                is_good = False

        if is_good:
            res += n

    return res


print(main())


Measured memory_bytes: 3828
#include <iostream>

using namespace std;

int calc(int a, int b, int n) {
	int tmp = n-a-b;
	int count = 0;
	for (int c=0; c<10; c++) {
		for (int d=0; d<10; d++) {
			if (tmp == c+d)
				count++;
		}
	}
	return count;
}

void solve(int n) {
	int count = 0;
	for (int a=0; a<10; a++) {
		for (int b=0; b<10; b++) {
			count += calc(a,b,n);
		}
	}
	cout << count << endl;
}

int main() {
	int n;
	while (cin >> n) {
		solve(n);
	}
	return 0;
}

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

#define INF 2000000000

struct plan{
  int a,b,c;
  plan(int a=0,int b=0,int c=0): a(a),b(b),c(c) {}
};

int main(){

  int n;
  cin >> n;

  vector<plan> p(n);
  int a,b,c;
  for(int i=0;i<n;i++){
    cin >> a >> b >> c;
    p[i].a=a;
    p[i].b=b;
    p[i].c=c;
  }

  vector<vector<int>> dp(n+1,vector<int>(3,-1*INF));
  dp[0][0]=dp[0][1]=dp[0][2]=0;
  for(int i=0;i<n;i++){
    dp[i+1][0]=max(dp[i+1][0],max(dp[i][1]+p[i].a,dp[i][2]+p[i].a));
    dp[i+1][1]=max(dp[i+1][1],max(dp[i][0]+p[i].b,dp[i][2]+p[i].b));
    dp[i+1][2]=max(dp[i+1][2],max(dp[i][0]+p[i].c,dp[i][1]+p[i].c));
  }

  cout << max(dp[n][0],max(dp[n][1],dp[n][2])) << endl;

}

Measured memory_bytes: 6912
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
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;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,M; cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    rep(i,M) cin >> p[i] >> S[i];

    map<int,int> AC,WA;
    rep(i,M) {
        if (S[i] == "AC") {
            AC[p[i]] = 1;
        } else {
            if (AC[p[i]] == 0) WA[p[i]]++;
        }
    }
    int ansAC = 0;
    int ansWA = 0;
    for (auto i : AC) {
        ansAC += i.second;
    }
    for (auto i : WA) {
        if (AC[i.first] == 1)ansWA += i.second;
    }

    cout << ansAC << " " << ansWA << endl;
}

Measured memory_bytes: 11904
#include <iostream>
#include<algorithm>
#include <vector>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define max(x,y) (((x)>(y)) ? x:y)
#define min(x,y) (((x)<(y)) ? x:y)
#define FOR(a,b,c) for(b=(c);b<(a);b++)
#define ender {return 0;}
#define tosasuretu(a) (a*(a+1)/2)
inline long kaizyo(long);
int main() {
	int R;
	cin >> R;
	if (R < 1200) {
		cout << "ABC";
	}
	else if (R < 2800) {
		cout << "ARC";
	}
	else {
		cout << "AGC";
	}
	return 0;
}

inline long kaizyo(long x) {
	long ans = 1;
	for (int z = 0; z < x; z++) {
		ans *= (x - z);
	}
	return ans;
}




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

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

string lh, rh;

void solve() {
  int h = 0, b = 0;
  rep(i,4) {
    if (lh[i] == rh[i]) {h++; continue;}
    if (lh.find(rh[i]) != -1) b++;
  }
  cout<<h<<" "<<b<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>lh>>rh) {
    if (lh == "0" && rh == "0") {
      break;
    } else {
      solve();
    }
  }
  return 0;
}

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

int main(){

    int s;
    cin >> s;

    bool even, odd;
    if((s % 2) == 0){
        even = true;
        odd = false;
    }else{
        even = false;
        odd = true;
    }

    set<long long> n;
    n.insert(s);
    for(long long m = 2; m < 1e7; m++){
        
        if(even) s = s / 2;
        else if(odd) s = 3 * s + 1;

        if(n.find(s) != n.end()){
            cout << m << endl;
            break;
        }

        n.insert(s);
        if((s % 2) == 0){
            even = true;
            odd = false;
        }else{
            even = false;
            odd = true;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>

using namespace std;
int main(void){
    // Your code here!
    int N ;
    cin >> N;
    vector<int> table(N);
    
    for(int i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        table[tmp -1] = i+1;
    }
    
    for(int i = 0; i < N; i++){
        cout << table[i] << " ";
    }
    cout << endl;
    
}


Measured memory_bytes: 1152
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [usize; n],
    }

    let m = 1_000_000;
    let mut cnt = vec![0; m + 1];
    let mut ans = 0;
    for ai in a {
        cnt[ai] += 1;
    }
    for i in 0..=m {
        match cnt[i] {
            0 => continue,
            1 => ans += 1,
            _ => {}
        }
        for j in 2.. {
            let t = i * j;
            if t > m {
                break;
            }
            cnt[t] = 0;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 8760
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;




int main() {


	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	string S, T;
	cin >> S >> T;
	int cnt = 0;
	FOR(i, 0, S.length()) {
		if (S[i] != T[i])cnt++;
	}
	cout << cnt << endl;



	return 0;
}


Measured memory_bytes: 3796
N = int(input())
A = list(map(int,input().split()))
D = []
for id,a in enumerate(A):
  D.append([a,id])
D = sorted(D)[::-1]
D.append([0,0])
#Cumsum = [0]
#for i in D[::-1]:
#  Cumsum.append(i[0]+Cumsum[-1])
#Cumsum = Cumsum[::-1]
#print(Cumsum)
cnt = [0] * N
minid = D[0][1]
for i in range(N):
  d = D[i][0] - D[i+1][0]
  cnt[minid] += d * (i + 1)
  if D[i+1][1] < minid:
    minid = D[i+1][1]
for i in range(N):
  print(cnt[i])



Measured memory_bytes: 25796
#include <stdio.h>

int a[200],n,q,b[2000];

int solve(int,int);

int main(){

  int i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) scanf("%d",&b[i]);

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

    if(solve(0,b[i])==1) printf("yes\n");
    if(solve(0,b[i])==0) printf("no\n");
  }

  return 0;

}

int solve(int i,int m){

  int res;

  if(m==0) return 1;

  if(i>=n) return 0;

  return  res=solve(i+1,m) || solve(i+1,m-a[i]);

}

Measured memory_bytes: 584
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const double PI = 3.14159265358979;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

static const int bn = 32;

int main() {
	ll h, w; cin >> h >> w;
	char c[50][50] = {};

	rep(i, 0, h) {
		rep(j, 0, w) {
			cin >> c[i][j];
		}
	}

	ll y[4] = { 0,1,-1,0 };
	ll x[4] = { 1,0,0,-1 };

	rep(i, 0, h) {
		rep(j, 0, w) {
			if (c[i][j] == '#') {
				bool isB = false;
				rep(k, 0, 4) {
					ll ny = i + y[k];
					ll nx = j + x[k];
					if (ny >= 0 && ny < h && nx >= 0 && nx < w && c[ny][nx] == '#') {
						isB = true;
						break;
					}
				}

				if (!isB) {
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
Data = []
def diff(b):
    sum1 = 0
    for d in Data:
        sum1 += abs(b-d)
    return sum1

N = int(input())
Data = list(map(int,input().split()))
for i in range(N):
    Data[i] -= (i+1) 

Data.sort()
if N % 2 != 0:
    mid = Data[N//2]
    ans = diff(mid)
else:
    mid1 = Data[N//2-1]
    mid2 = Data[N//2]
    ans = min(diff(mid1),diff(mid2))

print(ans)

Measured memory_bytes: 26176
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

    double d[1000][1000];

int main() {

  const double l_max = 1000000.00;

  while( true ) {

    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    long long int x[1000], y[1000];
    for ( long long int i = 0; i < n; i++ ) {

      long long int b;
      cin >> b;
      b--;
      cin >> x[b] >> y[b];

    }

    for ( long long int i = 0; i < n; i++ ) {
      for ( long long int j = 0; j < n; j++ ) {
	long long int dx = x[i] - x[j];
	long long int dy = y[i] - y[j];
	dx *= dx;
	dy *= dy;
	if ( i == j || dx + dy > 2500 ) {
	  d[i][j] = l_max;
	}else {
	  d[i][j] = sqrt( dx + dy );
	}
      }
    }

    long long int m;
    cin >> m;
    for ( long long int m2 = 0; m2 < m; m2++ ) {

      long long int st, go;
      cin >> st >> go;
      st--;
      go--;

      bool flag[1000] = {};
      double s[1000] = {0.00};
      for ( long long int i = 0; i < n; i++ ) {
	s[i] = l_max;
      }
      s[st] = 0.00;
      long long int b[1000];
      b[go] = -1;

      while( true ) {

	long long int ne = -1;
	for ( long long int i = 0; i < n; i++ ) {
	  if ( flag[i] == false && ( ne == -1 || s[i] < s[ne] ) ) {
	    ne = i;
	  }
	}
	if ( ne == -1 ) break;
	flag[ne] = true;

	for ( long long int i = 0; i < n; i++ ) {
	  if ( s[i] > s[ne] + d[ne][i] ) {
	    s[i] = s[ne] + d[ne][i];
	    b[i] = ne;
	  }
	}

      }

      if ( b[go] == -1 ) {
	cout << "NA" << endl;
	continue;
      }

      vector< long long int > ans;

      long long int k = go;
      while( k != st ) {
	k = b[k];
	ans.push_back(k);
      }

      for ( long long int i = 0; i < ans.size(); i++ ) {
	cout << ans[ ans.size() - 1 - i ] + 1 << " ";
      }
      cout << go + 1 << endl;

    }

  }

  return 0;

}

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

using namespace std;

void fast();

/*
*
* Watch out! Another Buggy Code From Muhammad_Mamdouh, Happy Coding;
*
*/

int main()
{
    fast();
    int n, square = 0; cin >> n;

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

        if (i % 2 != 0 && x % 2 != 0)
            ++square;
    }

    cout << square;

    return 0;
}

void fast()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

Measured memory_bytes: 3620
n, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
ans = 0
frag = True
for i in range(n):
    if x >= a[i]:
        x -= a[i]
        ans += 1
    else:
        frag = False

if frag and x > 0:
    print(ans-1)
else:
    print(ans)


Measured memory_bytes: 3060
using System;

namespace abc096_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var tmp = Console.ReadLine().Split();
            var h = int.Parse(tmp[0]);
            var w = int.Parse(tmp[1]);
            var canvas = new int[h, w];
            for (var i = 0; i < h; i++)
            {
                var tmp2 = Console.ReadLine().ToCharArray();
                for (var j = 0; j < w; j++)
                {
                    if (tmp2[j] == '.')
                    {
                        canvas[i, j] = 0;
                    }
                    else
                    {
                        canvas[i, j] = 1;
                    }
                }
            }

            for (var i = 0; i < h; i++)
            {
                for (var j = 0; j < w; j++)
                {
                    if (canvas[i, j] == 0)
                    {
                        continue;
                    }
                    //上
                    try
                    {
                        if (canvas[i - 1, j] == 1)
                        {
                            continue;
                        }
                    }
                    catch (IndexOutOfRangeException) { }
                    //下
                    try
                    {
                        if (canvas[i + 1, j] == 1)
                        {
                            continue;
                        }
                    }
                    catch (IndexOutOfRangeException) { }
                    //左
                    try
                    {
                        if (canvas[i, j - 1] == 1)
                        {
                            continue;
                        }
                    }
                    catch (IndexOutOfRangeException) { }
                    //右
                    try
                    {
                        if (canvas[i, j + 1] == 1)
                        {
                            continue;
                        }
                    }
                    catch (IndexOutOfRangeException) { }

                    Console.WriteLine("No");
                    Environment.Exit(0);

                }
            }
            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 11092
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>

using std :: vector;

template <typename Tp>Tp Max(const Tp &a, const Tp &b) {return a > b ? a : b;}
template <typename Tp>Tp Min(const Tp &a, const Tp &b) {return a < b ? a : b;}

template <typename Tp>void Read(Tp &x) {
    Tp in = 0, f = 1; char ch = getchar();
    while(ch<'0' || ch>'9') {if(ch=='-') f = -1; ch = getchar();}
    while(ch>='0' && ch<='9') {in = in * 10 + ch - '0'; ch = getchar();}
    x = in * f;
}

typedef long long LL;

const int SN = 300000 + 10;

const int MOD = 1000000007;

struct Node {
    LL f[3];
};

struct Edge {
    int v, next;
}E[SN];

vector<Node> dp[SN];

int head[SN], root[SN], num, INV, TIME, n;

void Add_E(int u, int v) {
    E[++num].v = v, E[num].next = head[u], head[u] = num;
}

int merge(int x, int y) {

    if(dp[x].size() < dp[y].size()) std :: swap(x, y);

    int sumx = dp[x].size() - 1, sumy = dp[y].size() - 1;

    int f0 = 0, f1 = 0, f2 = 0;
    
    for(int i = 0; i <= sumy; i++) {
	
	f0 = f1 = f2 = 0;

	f0 = (dp[x][sumx - i].f[0] * dp[y][sumy - i].f[0]) % MOD;

	f1 = (dp[x][sumx - i].f[1] * dp[y][sumy - i].f[0]) % MOD;

	f1 = (f1 + dp[x][sumx - i].f[0] * dp[y][sumy - i].f[1]) % MOD;

	for(int j = 0; j <= 2; j++)
	    for(int k = 2; j + k >= 2; k--) 
		f2 = (f2 + dp[x][sumx - i].f[j] * dp[y][sumy - i].f[k]) % MOD;

	dp[x][sumx - i].f[0] = f0, dp[x][sumx - i].f[1] = f1, dp[x][sumx - i].f[2] = f2;
    }

    dp[y].clear();

    return x;
}

void Dfs(int u) {

    if(!head[u]) root[u] = ++TIME;

    int dep = 0;
    
    for(int i = head[u]; i; i = E[i].next) {
	int to = E[i].v;
	Dfs(to);
	if(!root[u]) root[u] = root[to];
	else dep = Max(dep, (int)Min(dp[root[u]].size(), dp[root[to]].size())),
		 root[u] = merge(root[u], root[to]);
    }
    
    int sumx = dp[root[u]].size() - 1;
    
    int k = root[u];
    
    for(int i = 0; i < dep; i++)
	dp[k][sumx - i].f[0] = (dp[k][sumx - i].f[0] + dp[k][sumx - i].f[2]) % MOD, dp[k][sumx - i].f[2] = 0;

    Node tmp;

    tmp.f[0] = INV, tmp.f[1] = INV, tmp.f[2] = 0;
    
    dp[k].push_back(tmp);
}

LL ksm(LL a, LL b) {

    LL ans = 1, B = a;

    while(b) {
	if(b & 1) ans = (ans * B) % MOD;
	B = (B * B) % MOD;
	b >>= 1;
    }
    
    return ans;
}

int main() {

    int x;
    
    Read(n);

    for(int i = 1; i <= n; i++) Read(x), Add_E(x, i);
    
    INV = ksm(2, MOD - 2);

    Dfs(0);

    int k = root[0];

    int sumx = dp[k].size() - 1;

    int ans = 0;
    
    for(int i = 0; i <= sumx; i++) 
	ans = (ans + dp[k][sumx - i].f[1]) % MOD;

    ans = (1LL * ans * ksm(2, n + 1)) % MOD;

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

    return 0;
}

Measured memory_bytes: 34160
#include <iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(i==0 || i==H-1 || j==0 || j==W-1){
                    cout<<"#";
                }
                else{
                    cout<<".";
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3096
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x:x*(-1),a))
heapq.heapify(a)
for i in range(m):
    x = heapq.heappop(a)*(-1)//2
    heapq.heappush(a,(x*(-1)))
print(sum(a)*(-1))

Measured memory_bytes: 20520
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll dp[3030][3030][5],v[3030][3030];


int main(void){
	int r,c,n,i,j,k;
	ll ans = -INFLL;
	std::cin >> r >> c >> n;
	for(k=0; k<n; ++k){
		std::cin >> i >> j;
		--i; --j;
		std::cin >> v[i][j];
	}
	for(i=0; i<=r; ++i){
		for(j=0; j<=c; ++j){
			for(k=0; k<4; ++k){
				dp[i+1][j][0] = std::max(dp[i+1][j][0],dp[i][j][k]);
				if(k<3){
					dp[i+1][j][0] = std::max(dp[i+1][j][0],dp[i][j][k]+v[i][j]);
				}
				dp[i][j+1][k] = std::max(dp[i][j+1][k],dp[i][j][k]);
				dp[i][j+1][k+1] = std::max(dp[i][j+1][k+1],dp[i][j][k]+v[i][j]);
			}
		}
	}
	for(k=0; k<4; ++k){
		ans = std::max(ans,dp[r][c][k]);
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 429832
#include <stdio.h>

int main(){
  int a,b,c,x=0,y=0;
  while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
    if((a*a+b*b)==c*c) x++;
    if(a==b) y++;
  }
  printf("%d\n%d\n",x,y);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1001001001;
const ll INFL = 1e17;
const int MOD = 1e9+7;


int main(){
	ll a;
	cin >> a;
	string b;
	cin >> b;
	int k = int(b[0]-'0')*100 + int(b[2]-'0')*10 + int(b[3]-'0');
	cout << a*k/100 << endl;
	return 0;
}

Measured memory_bytes: 3600
while 1:
    n,l = map(int,raw_input().split())
    if n == 0: break
    R = [0]*(l-1)
    L = [0]*(l-1)
    for i in xrange(1,n+1):
        d,p = raw_input().split()
        p = int(p)-1
        if d == "R": R[p] = i
        else: L[p] = i
    t = num = 0
    while sum(R)+sum(L) != 0:
        if R[-1] > 0: num = R[-1]
        R = [0]+R[:-1]
        if L[0]  > 0: num = L[0]
        L = L[1:]+[0]
        for i in xrange(l-1):
            if min(L[i],R[i]) > 0: R[i],L[i] = L[i],R[i]
        t += 1
    print t,num

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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line
int f(int x ){
	int res = 0 ;
	while(x%2 ==0){
		x /= 2;
		res ++ ;
	}
	return res;
}
ll lcm(ll a, ll b){
	return a / __gcd(a,b) * b;
}
int main()
{
	int n ,m;
	cin >> n >>m;
	vector<int> a(n);
	rep(i,n){
		cin >> a[i];
		// a-> a'
		if(a[i]%2 == 1){
			cout << 0 << endl;
			return 0 ;
		}
		a[i] /= 2;
	}
	int t = f(a[0]);
	rep(i,n){
		if(f(a[i])!= t ){
			cout << 0 << endl;
			return 0 ;
		}
		a[i] >>= t; //a[i] /= 2^t と一緒！！シフト演算　
	}
	m >>= t; //mも2^tで割る
	ll l = 1; 
	rep(i,n){
		l = lcm(l,a[i]);
		//l は余裕でlong long を超える
		if(l > m){
			cout << 0 << endl;
			return 0;
		}
	}
	m /= l;
		cout << (m+1)/2 << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

int L;
vector<pair<int, int> > g[40];

pair<int, int> required(int L) {
  int bit_length = 0;
  int set_bits = 0;

  while(L != 0) {
    set_bits += (L % 2);
    bit_length++;

    L /= 2;
  }

  return make_pair(bit_length, set_bits);
}

int main() {
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);

  cin >> L; L--;

  int sum = 0;

  while(L > 0) {
    pair<int, int> temp = required(L);
    int bit_length = temp.first;
    int set_bits = temp.second;

    if(set_bits == bit_length) {
      for(int i = 1;i <= bit_length;i++) {
        if(g[20-i].size() == 0) {
          g[20-i].push_back(make_pair(20-i+1, 0));
          g[20-i].push_back(make_pair(20-i+1, 1 << (i-1)));
        }
      }

      if((20-bit_length) != 1)
        g[1].push_back(make_pair(20-bit_length, sum));

      break;
    }

    for(int i = 1;i < bit_length;i++) {
      if(g[20-i].size() == 0) {
        g[20-i].push_back(make_pair(20-i+1, 0));
        g[20-i].push_back(make_pair(20-i+1, 1 << (i-1)));
      }
    }

    if((20-bit_length+1) != 1)
      g[1].push_back(make_pair(20-bit_length+1, sum));
    sum += (1 << (bit_length-1));
    L = L ^ (1 << (bit_length-1));
  }

  if(L == 0) {
    g[1].push_back(make_pair(20, sum));
  }

  int N = 20, M = 0;
  for(int i = 1; i <= N;i++) M += g[i].size();

  cout << N << " " << M << endl;

  for(int i = 1;i <= N;i++) {
    for(int j = 0;j < g[i].size();j++) {
      cout << i << " " << g[i][j].first << " " << g[i][j].second << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
def q35(n, p):
    count = 0
    for i in range(n-2):
        a = p[i:i+3]
        if min(a) != p[i+1] and max(a) != p[i+1]:
            count += 1
    return count

N = int(input())
p = [int(i) for i in input().split()]
print(q35(N, p))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

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

  if (n % 2 == 1){
    cout << 0 << endl;
    return 0;
  }

  vi d(n);
  rep(i,n) cin >> d.at(i);
  sort(d.begin(), d.end());
  int ans = d.at(n/2) - d.at(n/2-1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>

int main(void)
{
int a,b;
scanf("%d",&a);
scanf("%d",&b);
if(a == b)
{
printf("a == b\n");
}else{
if(a > b)
{
printf("a > b\n");
}else{
printf("a < b\n");
}
}
return 0;
}

Measured memory_bytes: 580
n,k=list(map(int,input().split()))
p_list=[0]
for i,p in enumerate(input().split()):
    p_i = int(p)
    p_list.append(p_list[i] + (p_i+1)/2)

p_max=0
for i in range(k,n+1):
    p_max=max(p_max,p_list[i]-p_list[i-k])
print(p_max)

Measured memory_bytes: 72176
N = gets.chomp.to_i
a_list = gets.chomp.split.map(&:to_i)
result = 0
current = 1
a_list.each do |x|
  if x == current
    current += 1
  else
    result += 1
  end
end

if N == result
  puts -1
else
  puts result
end

Measured memory_bytes: 16772
#include <bits/stdc++.h>
#define ll long long
#define arena ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main()
{
    arena
    
    ll n;
    cin>>n;
    
    ll arr[n];
    for(ll i=0;i<n;i++)
    cin>>arr[i];
    
    ll k=1;
    ll cnt=0;
    ll flag=1;
    for(ll i=0;i<n;i++)
    {
        if(k!=arr[i])
        {
            flag=0;
            cnt++;
        }
        else
        k++;
    }
    if(flag==0&&k==1)
    cout<<"-1";
    else
    cout<<cnt;
}

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

using namespace std;
int main () {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) {
        if (abs(a[i] - a[j]) % (n - 1) == 0) {
            cout << a[i] << " " << a[j] << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 210;
int n,k,mod;

inline int power(int a,int b){
	int ret=1;
	for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) ret=1ll*ret*a%mod;
	return ret;
}
int fac[N],ifac[N];
inline void init(int n){
	fac[0]=1;
	For(i,1,n) fac[i]=1ll*fac[i-1]*i%mod;
	ifac[n]=power(fac[n],mod-2);
	Dow(i,n-1,0) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
}
inline int C(int n,int m){
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

int f[N][N];
inline void upd(int &x,int y){
	x+=y;
	if (x>=mod) x-=mod;
}
inline int dp(int m,int n,int deg){
	For(i,0,n) For(j,0,m) f[i][j]=0;
	f[1][0]=1;
	For(i,1,n){
		FOR(j,0,m) if (i!=1||j!=0){
			f[i][j]=f[i-1][j];
			if (j) upd(f[i][j],f[i][j-1]);
			if (j&&j-1+(n-i+1)>deg) f[i][j]=0;
		}
		FOR(j,0,m) if (m-j+i-1>deg) f[i][j]=0;
	}
	int ret=0;
	FOR(i,1,m) upd(ret,f[n][i]);
	return ret;
}
inline int calc(int n,int deg){
	if (n==0) return 1;
	if (n==1) return 0;
	int ret=0;
	For(i,1,min(deg+1,n)) ret=(ret+1ll*C(n-1,i-1)*fac[n-i]%mod*fac[i-1]%mod*dp(i,n-i,deg))%mod;
	return ret;
}

int main(){
	n=read(),k=read(),mod=read();
	init(n);
	int ans=0;
	For(i,0,min(n,k+1)) ans=(ans+1ll*C(n,i)*fac[i]%mod*calc(n-i,k-i))%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 3924
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	int n, k; cin >> n >> k;
	vector<ll> p(n);
	for( auto &k : p ) cin >> k;
	vector<ll> sum(n+1, 0);
	for( int i = 0; i < n; ++i ){
		sum[i+1] = sum[i] + p[i];
	}
	ll summax = -1;
	int index = -1;
	for( int i = 0; i+k <= n; ++i ){
		if( sum[i+k] - sum[i] > summax ){
			summax = sum[i+k] - sum[i];
			index = i;
		}
	}
	cout << fixed << setprecision(12) << ((long double)summax+(long double)k)/2.0 << endl;
}

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

int main()
{
    int a, b, c, k, ans(0);

    cin >> a >> b >> c >> k;

    if (a >= k)
    {
        ans = k;
        k -= a;
    }
    else
    {
        ans = a;
        k -= a;
    }

    k -= b;

    if (k > 0)
    {
        ans -= k;
    }

    cout << ans << endl;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    ll ans = 0;
    cin >> N;
    rep(i, N) {
        ll temp;
        cin >> temp;
        ans += temp;
    }
    if(ans % 2) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256