akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


// int factrial(int n){
//   if(n == 0) return 1;
//   return n*factrial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   return fact(n) / (fact(n-k)*fact(k));
// }

int answer(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

ll b[200010];
int main(){
  int N;
  cin >> N;
  int ans =0;
  rep(i,N){
    int a;
    cin >> a;
    while(a%2==0){
      ans++;
      a/=2;
    }
  }
  cout << ans << endl;
}






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

int main() {
    string s;cin>>s;
    int mod=1e9+7;
    ll dp[4]{};
    dp[0]=1;
    for (char c:s)
        for (int j=3;j>=0;j--) {
            if (c=='?')
                dp[j]=dp[j]*3%mod;
            if (j>0&&(c=='?'||c=="ABC"[j-1]))
                dp[j]=(dp[j]+dp[j-1])%mod;
        }
    cout<<dp[3]<<endl;
    return 0;
}

Measured memory_bytes: 3728
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		char C[] = S.toCharArray();
		int temp = 0;
		int ans = 0;
		String s = "";
		int n[] = new int[N];
		for (int i = 1; i < N; i++) {
			String s1 = S.substring(0, i);
			String s2 = S.substring(i, N);
			for (int j = 0; j < s1.length(); j++) {
				CharSequence cs = s1.substring(j, j + 1);
				if (s2.contains(cs) && !s.contains(cs)) {
					temp++;
				}
				s += cs;
			}
			if (temp > ans) {
				ans = temp;
			}
			temp = 0;
			s = "";
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 24020
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int main(){
    int n,m;cin>>n>>m;
    ll res = pow(2,m)*(1900*m+100*(n-m));
    cout<<res<<endl;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int val[105];
int main(){
  int a,b;
  scanf("%d %d", &a, &b);
  long long int res = b;
  for (int i = 1; i < a; i++) res *= b - 1;
  printf("%d\n", res);
  return 0;
}


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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	string S;
	cin >> S;
	map<char, int> t;
	for (int i = 0; i < 4; ++i) {
		t[S[i]]++;
	}

	if (t.size() == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}



	return 0;
}


Measured memory_bytes: 764
#include<iostream>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i++){
        int val;
        cin>>val;
        if(val>=k)ans++;
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define alll(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define endl '\n'
int a[2005];
int32_t main()
{
    int n,k,q;
    cin>>n>>k>>q;
    vector<int> v;
    ii cin>>a[i],v.push_back(a[i]);
    sort(all(v));
    int ans = 2e9;
    for(int i=0;i<v.size();++i) {
        for(int j=1;j<=n;++j) if(a[j] < v[i]) a[j] = 0;
        vector<int> tmp, tot;
        for(int j=1;j<=n;++j) {
            if(!a[j])
            {
                sort(all(tmp));
                for(int i=0;i<(int)tmp.size()-k+1;++i) tot.push_back(tmp[i]);
                tmp.clear();
            }
            else tmp.push_back(a[j]);
        }
        if(tmp.size())
        {
            sort(all(tmp));
            for(int i=0;i<(int)tmp.size()-k+1;++i) tot.push_back(tmp[i]);
        }
        if(tot.size() < q) break;
        else
        {
            sort(all(tot));
            ans = min(ans, tot[q-1] - tot[0]);
        }
    }
    cout << ans << endl;
}


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

int main(){
    long long a, b, c, K; cin >> a >> b >> c >> K;
    vector<long long> A(a); for (auto &X : A) cin >> X; sort(A.begin(), A.end(), greater<long long>());
    vector<long long> B(b); for (auto &X : B) cin >> X; sort(B.begin(), B.end(), greater<long long>());
    vector<long long> C(c); for (auto &X : C) cin >> X; sort(C.begin(), C.end(), greater<long long>());
    priority_queue<long long> que;

    for (long long i = 0; i < a; i++) {
        for (long long j = 0; j < b; j++) {
            for (long long k = 0; k < c; k++) {
                if ((i+1)*(j+1)*(k+1) <= K) que.emplace(A[i] + B[j] + C[k]);
                else break;
            }
        }
    }

    for(int i = 0; i < K; i++) {
        cout << que.top() << '\n'; que.pop();
    }
    return 0;
}

Measured memory_bytes: 1404
#include "bits/stdc++.h"
using namespace std;
#define int long long
#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 FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;


signed main(){
	map<int,int>mp;
	mp[4]=mp[6]=mp[9]=mp[11]=1;
	mp[2]=2;
	int x,y;
	cin>>x>>y;
	if(mp[x]==mp[y])out("Yes");
	else out("No");
}

Measured memory_bytes: 3596
from fractions import gcd

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

N = int(input())
A = getlist()

X = [0] * N
Y = [0] * N

X[0] = A[0]
for i in range(1, N):
	X[i] = gcd(X[i - 1], A[i])

Y[-1] = A[-1]
for i in range(1, N):
	Y[-1 - i] = gcd(Y[- i], A[-1 - i])

ans = []

ans.append(X[-2])
ans.append(Y[1])

for i in range(1, N - 1):
	ans.append(gcd(X[i - 1], Y[i + 1]))


print(max(ans))

Measured memory_bytes: 16148
#include <iostream>
using namespace std;
int main(void){
	int prime[10002];
	int sum[10002];
	prime[1] = 2;
	prime[2] = 3;
	sum[1] = 2;
	sum[2] = 5;
	int ptr=3;
	for(int num=5; ptr<=10000; num++){
		bool f = false;
		for(int i=1; i<ptr; i++){
			if(prime[i]*prime[i] > num){
				break;
			}
			if(num%prime[i]==0) {
				f = true;
				break;
			}
		}
		if(!f) {
			prime[ptr++] = num;
			sum[ptr-1] = sum[ptr-2] + prime[ptr-1];
		}
	}
	int n;
	while(cin >> n){
		if(!n) break;
		cout << sum[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#pragma region header
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a / gcd(a, b) * b ;
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
bool isprime(int n) { //素数判定
    if(n==1)return false;
    if(n==2)return true;
    for(int i = 2;i<=sqrt(n);i++) {
        if(n%i==0) return false;
    }
    return true;
}
/* ----------------------end----------------------- */
#pragma endregion

signed main() {
    string s;cin >> s;
    if(s.size()==1) {
        printf("YES\n");
        return 0;
    }
    map<char,int> mp;
    set<char> st;
    for(auto &p:s) st.insert(p),mp[p]++;
    if(st.size()<=2&&s.size()>2) {
        printf("NO\n");
        return 0;
    }
    int ma = -1,mi = inf;
    for(auto p:mp) chmax(ma,p.second),chmin(mi,p.second);
    cout << (ma-mi>1||ma>s.size()/2?"NO\n":"YES\n");
    return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>

#define ff first
#define ss second

using namespace std;
using pii=pair<int,int>;
using ll=long long;

int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
    
    ll n,d;
    cin>>n>>d;
    int answer=0;
    for(int i=0; i<n; i++){
        ll x,y;
        cin>>x>>y;
        if(x*x+y*y<=d*d) answer+=1;
    }
    cout<<answer;


    return 0;
}


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

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}

const int N = 3e3 + 10;
int a[N][N];
ll dp[2][N][4];
int n, m, k;

int main() {
    n = qr(), m = qr(), k = qr();
    while (k--) {
        int x = qr(), y = qr(), z = qr();
        a[x][y] = z;
    }
    repi(i, 1, n)repi(j, 1, m) {
            dp[i & 1][j][0] = max({dp[i - 1 & 1][j][0], dp[i - 1 & 1][j][1], dp[i - 1 & 1][j][2], dp[i - 1 & 1][j][3]});
            dp[i & 1][j][1] = dp[i & 1][j][0] + a[i][j];
            repi(u, 1, 3)
                dp[i & 1][j][u] = max({dp[i & 1][j][u], dp[i & 1][j - 1][u - 1] + a[i][j], dp[i & 1][j - 1][u]});
        }
    pl(max({dp[n & 1][m][0], dp[n & 1][m][1], dp[n & 1][m][2], dp[n & 1][m][3]}));
    return 0;
}

Measured memory_bytes: 39108
n = int(input())
ls = []
for i in range(n):
    x, l = map(int, input().split())
    ls.append([x-l, x+l])
ls.sort()

now = ls[0]

ans = n

for i in range(1,n):
    if now[1] > ls[i][0]:
        ans -= 1
        if now[1] >= ls[i][1]:
            now = ls[i]
    else:
        now = ls[i]

print(ans)

Measured memory_bytes: 20104
#17D8104026C 宮地拓海 Air_conditioner123 Python

n = int(input())
dic = set()
count = 0
for i in range(n):
    s = input().split()
    if s[0] == "insert":
        dic.add(s[1])
    else:
        if s[1] in dic:
            print("yes")
        else:
            print("no")
            


Measured memory_bytes: 30988
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll a, b, c, m, n, ans;

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

    int s;
    cin >> s;

    vi ss(1e6);

    ss[0] = s;
    rep(i, 1e6)
    {
        //奇数
        if (ss[i] % 2)
            ss[i + 1] = 3 * ss[i] + 1;
        else
            ss[i + 1] = ss[i] / 2;

        rep(j, i)
        {
            if (ss[j] == ss[i + 1])
            {
                cout << (i + 1) + 1 << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;


#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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

template<typename T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


const int N = 1e5 + 5;
int arr[N];
int acc[N];
int n;

bool valid(int val) {
    range(i, 1, n) {
        if (arr[i] < val)acc[i] = -1;
        else acc[i] = 1;
        acc[i] += acc[i - 1];
    }

    Tree<pii> X;
    X.insert({0, 0});
    ll res = 0;
    range(i, 1, n) {
        int cnt = X.order_of_key(mp(acc[i], n + n));
        res += cnt;
        X.insert(mp(acc[i], i));
    }

    //cout << val << " " << res  << " " << (res*2 >= 1LL * n * (n + 1) / 2) << endl;
    return (res * 2 >= 1LL * n * (n + 1) / 2);
}

int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n;
    vi v(n);
    range(i, 1, n)cin >> arr[i], v[i - 1] = arr[i];
    sort(ALL(v));
    v.resize(unique(ALL(v)) - v.begin());

    //loop(i,SZ(v))valid(v[i]);

    int s = 0, e = SZ(v) - 1;
    while (s < e) {
        int mid = s + (e - s + 1) / 2;
        if (valid(v[mid]))
            s = mid;
        else
            e = mid - 1;
    }

    cout << v[e] << endl;


    return 0;
}


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

int main() {
  string S;
  cin >> S;
  
  for (int i = 0; i < 4; i++) {
    int count = 0;
    for (int j = 0; j < 4; j++) {
      if (i == j) continue;
      if (S.at(i) == S.at(j)) {
        count++;
      }
    }
    if (count != 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n;i++)
vector<int> v={100,101,102,103,104,105};

int dfs(int x) {
    if (x == 0) return 1;
    if (x < 0) return 0;
    int ret = 0;
    rep(i, 6) {
        ret |= dfs(x - v[i]);
    }
    return ret;
}


int main() {
    int X;
    cin >> X;
    int a = (X / 100);
    int b = a * 5;
    if (a * 100 <= X && X <= a * 100 + b) {
        cout << "1" << endl;
    }
    else {
        cout << "0" << endl;
    }
    /*
    rep(i, 2000) {
        if (i < 1000) continue;
        cerr << i << endl;
        cout << i << ", " << dfs(i) << endl;

    }
    */
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int a[9], k, fl=1;
int main() {
	int i, j;
	for(i=0; i<5; i++) cin>>a[i];
	cin>>k;
	for(i=1; i<5; i++) if(a[i] - a[0] > k) fl=0;
	if(fl) cout<<"Yay!";
	else cout<<":( ";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

typedef long long s64;

const int MaxN = 15;
const int MaxM = MaxN * (MaxN - 1) / 2;
const int M = 1000000007;

int n, m;
int out[MaxN];

int mul[1 << MaxN];

int f[1 << MaxN];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int u, v;
		cin >> u >> v, --u, --v;

		out[u] |= 1 << v;
	}

	mul[0] = 1;
	for (int s = 1; s < 1 << n; ++s)
		mul[s] = mul[s ^ (s & -s)] << 1;

	f[0] = 1;
	for (int s = 1; s < 1 << n; ++s)
		if ((s ^ (~s >> 1)) & 1)
		{
			for (int t = s; t; --t &= s)
			{
				int v = s ^ t;

				int sum = f[v];
				for (int i = 0; i < n; ++i)
				{
					if (v >> i & 1)
						sum = (s64)sum * (mul[out[i] & t] - 1) % M;
					if (t >> i & 1)
						sum = (s64)sum * mul[out[i] & v] % M;
				}

				f[s] = (f[s] + sum) % M;
			}
		}

	int res = 1;
	for (int i = 0; i < m; ++i)
		res = res * 2 % M;

	cout << (res + M - f[(1 << n) - 1]) % M << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <math.h>
#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.1415926535897932384626433;

///////////////////////////
////Prime Creator//////////
///////////////////////////
//bool Prime[100001] = {};
//void createPrime() {
//	ll n = 100001;
//	rep(i, 0, n) Prime[i] = true;
//	Prime[0] = false;
//	Prime[1] = false;
//	rep(i, 2, n) {
//		if (Prime[i]) {
//			rep(j, 2, n) {
//				if (j*i >= n)break;
//				Prime[j*i] = false;
//			}
//		}
//	}
//}
///////////////////////////
///////////////////////////

/////////////////////////
//Warshal Floyid/////////
/////////////////////////
//initialize`
//static const ll LL_MAX = (ll)1 << 55;
//static const ll WF_MAX = 300;
//rep(i, 0, N)rep(j, 0, N) wf[i][j] = LL_MAX;
//ll wf[WF_MAX][WF_MAX];
//void WarshalFloyid(int size) {
//	rep(k, 0, size)rep(i, 0, size)rep(j, 0, size)wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
//}

//union find

ll sum(ll cnt, vector<ll> v) {
	ll total = 0;
	rep(i, v.size() - cnt, v.size()) total += v[i];
	return total;
}
int main() {
	ll N, W; cin >> N >> W;
	ll w[100], v[100];
	ll minW = (ll)1 << 55;
	rep(i, 0, N) {
		cin >> w[i] >> v[i];
		if (minW > w[i]) {
			minW = w[i];
		}
	}
	vector<ll> a, b, c, d;
	rep(i, 0, N) {
		if (w[i] == minW)a.push_back(v[i]);
		else if (w[i] == minW + 1)b.push_back(v[i]);
		else if (w[i] == minW + 2)c.push_back(v[i]);
		else if (w[i] == minW + 3)d.push_back(v[i]);
	}
	a.push_back(0);
	b.push_back(0);
	c.push_back(0);
	d.push_back(0);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	sort(d.begin(), d.end());

	ll maxV = 0;
	rep(i, 0, a.size()) {
		rep(j, 0, b.size()) {
			rep(k, 0, c.size()) {
				rep(l, 0, d.size()) {
					if (W >= i * minW + j * (minW + 1) + k * (minW + 2) + l * (minW + 3)) {
						ll A = sum(i, a);
						ll B = sum(j, b);
						ll C = sum(k, c);
						ll D = sum(l, d);
						maxV = max(maxV, A + B + C + D);
					}
				}
			}
		}
	}
	cout << maxV << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
vector<string> str(1001);
vvi tag(1001);

void print(int pos, int level);

signed main()
{
    Int(n);
    Rep(i, n+1) {
        int tmp;
        cin >> tmp >> str[i];
        tag[tmp].pb(i);
    }
    print(0, 0);
    return 0;
}

void print(int pos, int level)
{
    rep(i, tag[pos].size()) {
        rep(k, level) {
            cout << '.';
        }
        cout << str[tag[pos][i]] << endl;
        print(tag[pos][i], level+1);
    }
}

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

int main() {

  ios::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);

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

  vector<int> a(n);
  int ans = 0;

  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (i)  ans = max(ans, a[i] - a[i-1]);
  }

  ans = max(ans, a[0] + k - a[n-1]);
  cout << k - ans << '\n';
} 


Measured memory_bytes: 1024
// atcoder/abc167/D/mani.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

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

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

const int N = 2 * 1e5 + 5;
vec<int> g[N];
lli cost[N];

void rec(int curr, lli c)
{
  cost[curr] = c;
  each (next, g[curr]) {
    if (cost[next] != -1) continue;
    rec(next, c + 1);
  }
  return ;
}

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

  lli n;
  lli k;
  while (cin >> n >> k) {
    fill(g, g + N, vec<int>());
    for (int i = 0; i < n; ++i) {
      int x;
      cin >> x;
      --x;
      g[i].push_back(x);
    }

    fill(cost, cost + N, -1);
    rec(0, 0);

    map<lli, lli> m;
    for (int i = 0; i < n; ++i) {
      m[cost[i]] = i;
    }

    if (m.count(k)) {
      cout << m[k] + 1 << endl;
      continue;
    }

    for (int i = 0; i < n; ++i) {
      if (cost[i] == -1) continue;
      const int j = g[i][0];
      if (cost[i] < cost[j]) continue;
      lli z = (k - cost[j]) % (abs(cost[j] - cost[i]) + 1);
      cout << m[cost[j] + z] + 1 << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 37804
class Combination:
    def __init__(self, n_max, mod=10**9+7):
        # O(n_max + log(mod))
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max+1):
            f = f * i % mod
            fac.append(f)
        f = pow(f, mod-2, mod)
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

# 同じ色が隣り合う確率...1/M
# 隣り合う箇所...N-1
# ちょうどn箇所隣り合う確率...(N-1)Cn * (1/M)^n * ((M-1)/M)^(N-1-n)
# 全パターン...M^N

N, M, K = map(int, input().split())
mod = 998244353
comb = Combination(202020, mod)
ans = 0
for n in range(0, K+1):
    ans += comb(N-1, n) * pow(M-1, N-1-n, mod) % mod
ans = ans * M % mod
print(ans)


Measured memory_bytes: 24872
# coding: utf-8

from itertools import accumulate

def getAccumulate(A):
    return list(accumulate(A))

def solve(A):
    accum = getAccumulate(A)
    l_index = 0
    r_index = 2
    accum_max = accum[-1]

    diff = accum_max
    for i in range(1, len(A)-2):
        while accum[i] > accum[l_index] + accum[l_index + 1]:
            l_index += 1
        while accum_max + accum[i] > accum[r_index] + accum[r_index + 1]:
            r_index += 1
        
        left = accum[l_index]
        center = accum[i] - accum[l_index]
        right = accum[r_index] - accum[i]
        last = accum_max - accum[r_index]
        diff = min(diff, max(left, center, right, last) - min(left, center, right, last))
        
    return diff

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    print(solve(A))



Measured memory_bytes: 24180
<?php
fscanf(STDIN, "%d %e", $A, $B);
$c = bcmul(bcmul($A, $B), 100);
if (strlen($c) < 3) {
    $ans = 0;
} else {
    $len = strlen($c);
    $ans = substr($c, 0, $len - 2);
}
printf("%d", $ans);


Measured memory_bytes: 16120
{-# LANGUAGE BangPatterns, MultiWayIf #-}

import Control.Applicative ((<$>))
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as BS


main :: IO ()
main = do
  n <- read <$> getLine
  s <- VU.unfoldrN n BS.uncons <$> BS.getLine
  print $ VU.maximum
    $ VU.map (\ !gap -> test gap s (VU.drop gap s))
    $ VU.tail $ VU.generate n id

test :: Int -> VU.Vector Char -> VU.Vector Char -> Int
test threshold v1 v2
 = VU.foldr (\ (!c1, !c2) cont !prev !maxi ->
              let now_ = prev+1 
              in if | c1 /= c2 -> cont 0 maxi
                    | now_ >= threshold -> threshold
                    | otherwise -> cont now_ (max now_ maxi))
   (\ !prev !maxi -> maxi)
   (VU.zip v1 v2) 0 0


Measured memory_bytes: 508
#include <stdio.h>
int main(void){
  int x, y;
  int i, j;
  while(1){
    scanf("%d %d\n", &x, &y);
    if(x==0 && y==0)break;
      for(i=0; i<x; i++){
        for(j=0; j<y; j++){
          printf("#");
        }
        printf("\n");
      }
      printf("\n");
    }
    return 0;
  }


Measured memory_bytes: 2616
#include <bits/stdc++.h>
using namespace std;
#define V(i) vector<i>
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define crep(i,N,n) for (__typeof(n) i = N; i < n; i++)
#define all(v) v.begin(), v.end()
#define F for
typedef long long ll;
typedef long l;
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
int main()
{
    ll t,k;
    cin>>t>>k;
    V(ll) a(t),op(t);
    rep(i,t)
    {
        cin>>a[i];
    }
    op[0] = 0;
    op[1] = abs(a[1] - a[0]);
    crep(i,2,t)
    {
        ll mn = LONG_MAX;
        F(ll j=1;j<=k && i-j>=0;j++)
        {
            ll dis = abs(a[i] - a[i - j]) + op[i-j];
            mn = min(mn,dis);
        }
        
        op[i] = mn;
    }
    cout<<op[t-1];
    

    return 0;
}

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

typedef pair<int, int> P;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    for(int i = 0; i < H; ++i){
        cin >> s[i];
    }


    int dist[H][W];
    fill(dist[0], dist[H], INF);
    queue<P> que;
    rep(i,H){
      rep(j,W){
        if(s[i][j] == '#'){
              dist[i][j] = 0;
              que.push(P(i, j));
        }
      }
    }

    int ans = 0;
    while(!que.empty()){
        P p = que.front();
        que.pop();
        int x = p.first;
        int y = p.second;
        
        for(int i = 0; i < 4; ++i){
            int nx = x + dx[i], ny = y + dy[i];
            if(nx < 0 || nx >= H || ny < 0 || ny >= W)  continue;
            if(s[nx][ny] == '#')    continue;
            
            if(dist[nx][ny] > dist[x][y] + 1){
                dist[nx][ny] = dist[x][y] + 1;
                que.push(P(nx, ny));
                ans = max(ans, dist[nx][ny]);
                s[nx][ny] = '#';
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
    vector<int> v(3);
    for(int i = 0; i < 3; i++){
        cin >> v.at(i);
    }
    sort(v.begin(), v.end());
    int ans = v.at(0) + v.at(1);
    cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
s=input()
for p in range(4):
    first=p//2
    second=p%2
    l=[first,second]+[0]*(n-2)
    for i in range(1,n):
        l[(i+1)%n]=[l[i-1],1-l[i-1]][::(-1)**int(s[i]=="o")][l[i]]
    for i in range(n):
        if s[i]!="ox"[int(l[(i-1)%n]==l[(i+1)%n])-l[i]]:break
    else:
        print("".join("WS"[x] for x in l))
        exit()
print(-1)

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)
#define INF 1e18

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int MAX_N=300;

int main(){
	int n;
	cin>>n;
	for(ll i=n;i>=0;i--){
		if(ll(sqrt(i))*ll(sqrt(i))==i){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, d: "List[int]"):
    n = N // 2
    d = sorted(d)
    print(d[n] - d[n-1] )
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, d)

if __name__ == '__main__':
    main()


Measured memory_bytes: 15220
//97 A

#include<stdio.h>
#include<stdlib.h>

int main(void){
	int a,b,c,d;
	scanf("%d %d %d %d", &a,&b,&c,&d);
	
	int ab, bc, ac;
	ab = abs(b - a);
	bc = abs(c - b);
	ac = abs(c - a);
	
	if((ab <= d && bc <= d) || ac <= d){
		printf("%s\n","Yes");
	} else {
		printf("%s\n","No");
	}
	
	return 0;
}
	

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>using vv = vector<vector<T>>; template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

// permutation
struct Combination {
    vector<ll> fact, ifact;
    Combination(int n) : fact(n + 1), ifact(n + 1) {
        fact[0] = 1;
        for (int i = 0; i < n; ++i) fact[i + 1] = fact[i] * (i + 1) % MOD;
        ifact[n] = mpow(fact[n], MOD - 2);
        for (int i = n; i > 0; --i) ifact[i - 1] = ifact[i] * i % MOD;
    }
    ll operator ()(int n, int k) { return fact[n] * ifact[n - k] % MOD/* * ifact[k] % MOD*/; }
    ll mpow(ll x, ll n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }
} C(1e5);

int N, K;
vv<int> graph_input, graph;
bool possible = true;

vector<bool> visited;
void pre_dfs(int v) {
    for (int u : graph_input[v]) {
        if (!visited[u]) {
            visited[u] = true;
            graph[v].push_back(u);
            pre_dfs(u);        
        }
    }
}

ll dfs(int v, bool root) {
    if (root && graph[v].size() >= K) {
        possible = false;
        return 0;
    }
    else if (!root && graph[v].size() >= K - 1) {
        possible = false;
        return 0;
    }
    else if (graph[v].size() == 0) {
        return 1;
    }

    ll ret = root ? C(K - 1, graph[v].size()) : C(K - 2, graph[v].size());

    for (int u : graph[v]) {
        ll s = dfs(u, false);

        if (!possible) break;
        
        ret = ret * s % MOD;
    }

    return ret;
}

int main() {
    cin >> N >> K;
    graph_input.resize(N);
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph_input[a].push_back(b);
        graph_input[b].push_back(a);
    }
    
    graph.resize(N);
    visited.resize(N, false);
    visited[0] = true;
    pre_dfs(0);

    if (K == 1) {
        if (N == 1) {
            write(1);
        }
        else {
            write(0);
        }
        return 0;
    }
    else if (K == 2) {
        if (N == 1) write(2);
        else if (N == 2) write(2);
        else write(0);
        return 0;
    }
    else {
        ll ans = dfs(0, true);
        
        if (!possible) write(0);
        else write(ans * K % MOD);
    }
}

Measured memory_bytes: 16256
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
void nextarr(ll a[],ll n,ll m)
{
    ll i,j;
    for(i=n-1;i>=0;i--)
    {
        if(a[i]!=m)
        {
            a[i]++;
            for(j=i+1;j<n;j++)
            {
                a[j] = a[i];
            }
            return;

        }
        if(i==0)
        {
            a[i]++;
            for(j=i+1;j<n;j++)
            {
                a[j] = a[i];
            }
            return;
        }
    }
}
int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    ll p[60],q[60],r[60],s[60];
    cin>>n>>m>>k;
    ll a[n];
    for(i=0;i<n;i++)
        a[i]  =1;
    ll ans = 0;
    for(i=0;i<k;i++)
    {
        cin>>p[i]>>q[i]>>r[i]>>s[i];
    }
    while(a[0]<=m)
    {
        /*cout<<"array =  ";
        for(i=0;i<n;i++)
            cout<<a[i]<<" ";
        cout<<endl;*/
        x = 0;
        for(i=0;i<k;i++)
        {
            if(a[q[i]-1]-a[p[i]-1]==r[i])
            {
                x+= s[i];
            }
        }


        ans = max(ans,x);
        nextarr(a,n,m);
    }
    cout<<ans<<endl;
    return 0;
}



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

int main()
{
    clock_t start = clock();

    int num;
    cin >> num;

    vector<int> stickList;
    for (int i = 0; i < num; i++)
    {
        int input;
        cin >> input;
        stickList.push_back(input);
    }

    sort(stickList.begin(), stickList.end());

    int count = 0;
    for (int x = 0; x < num - 2; x++)
    {
        int xStick = stickList.at(x);
        for (int y = x + 1; y < num - 1; y++)
        {
            int yStick = stickList.at(y);

            int shorterTwoSum = xStick + yStick;

            for (int z = y + 1; z < num; z++)
            {
                int zStick = stickList.at(z);

                if (zStick < shorterTwoSum)
                {
                    count++;
                }
                else
                {
                    break;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a=100000;
    for(int i=0;i<n;i++){
        a=a*1.05;
        int b;
        b=a/1000;
        if(a%1000!=0){
            a=(b+1)*1000;
        }
    }
    cout << a<<endl;
}


Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextLine() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, e := strconv.Atoi(nextLine())
	if e != nil {
		panic(e)
	}
	return i
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		num = nextInt()
		nums = append(nums, num)
	}
	return
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func sumSlice(nums []int) int {
	sum := 0
	for _, n := range nums {
		sum += n
	}
	return sum
}

func binarySearch(target int, list []int) int {
	left := 0
	right := len(list) - 1
	mid := (left + right) / 2

	for {
		if list[mid] < target {
			left = mid + 1
		} else {
			right = mid
		}
		mid = (left + right) / 2
		if left >= right {
			break
		}
	}
	return mid
}

func main() {
	scanner.Split(bufio.ScanWords) // switch to separating by space
	// scanner.Buffer([]byte{}, 1000000009) // switch to read large size input
	N := nextInt()
	v := 2
	count := 0

	for N > v {
		v *= 5
		count += N / v
	}

	if N%2 == 1 {
		count = 0
	}

	fmt.Println(count)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n"
void solve()
{
    ll mod = 1e9 + 7;
    ll n, m;
    cin >> n >> m;
    char Data[n + 1][m + 1] = {};
    ll dp[n + 1][m + 1] = {};
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 1; j <= m; j++)
        {
            cin >> Data[i][j];
        }
    }
    dp[1][1] = 1;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 1; j <= m; j++)
        {
            if (Data[i][j] == '.')
            {
                if (!(i == 1 and j == 1))
                {
                    dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
                }
            }
        }
    }
    cout << dp[n][m] << endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll T = 1;
    while (T--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 12432
h,w=map(int,input().split())
tra=[list(map(int,input().split())) for i in range(10)]
ll=[[tra[i][j] for j in range(10)] for i in range(10)]
for i in range(10**3-1):
    for i in range(10):
        for j in range(10):
            if i!=j:
                ll[i][j]=min(ll[i][j],min(ll[i][o]+tra[o][j] for o in range(10) if o!=i and o!=j))
ans=0
for i in range(h):
    for j in map(int,input().split()):
        if j==-1 or j==1:continue
        ans+=ll[j][1]
print(ans)

Measured memory_bytes: 3064
import java.util.*;

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();
        String ans = "NO";
        for(int i=1;i<=105;i++){
            int cur = i*A;
            if(cur%B==C){
                ans = "YES";
                break;
            }
        }
        System.out.println(ans);
    }
}


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

using namespace std ;

#define N 200007

int n , num[20] , val[N] ;
int C[N] , Cnt[N] ;

int main()
{
    scanf("%d" , &n ) ;
    for(int i = 1 ; i <= n - 1 ; i++ ){ int u , v , w ; scanf("%d%d%d" , &u , &v , &w ) ; val[u] ^= w , val[v] ^= w ;  }
    for(int i = 0 ; i <= n - 1 ; i++ ) num[val[i]]++ ;
    int ans = 0 , ed = 0 ;
    for(int i = 1 ; i < ( 1 << 15 ) ; i++ ){
        for(int j = 0 ; j < 15 ; j++ ) if( ( i >> j ) & 1 ) C[i] = C[i] ^ ( j + 1 ) ;
    }
    for(int i = 1 ; i <= 15 ; i++ ) ans += num[i] / 2 ;
    for(int i = 1 ; i <= 15 ; i++ ) if( num[i] & 1 ) ed |= ( 1 << ( i - 1 ) ) ;
    for(int i = 1 ; i < ( 1 << 15 ) ; i++ ) Cnt[i] = Cnt[i >> 1] + ( i & 1 ) ;
    for(int i = 1 ; i < ( 1 << 15 ) ; i++ ){
        Cnt[i]-- ;
        if( C[i] ) continue ;
        for(int k = ( i - 1 ) & i ; k ; k = ( k - 1 ) & i ){
            if( C[k] == 0 ) Cnt[i] = min( Cnt[i ^ k] + Cnt[k] , Cnt[i] ) ;
        }
    }
    printf("%d\n" , ans + Cnt[ed] ) ;
    return 0 ;
}

Measured memory_bytes: 896
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
 
double dp[3005][3005] = {0.0};
 
signed main()
{
    tezz
      
    memset(dp,0.0,sizeof(dp));
    int n;
    cin>>n;
    vector<double> v(n);
    for(double &x:v) cin>>x;
 
    dp[0][0] = 1 - v[0];
    dp[0][1] = v[0];
    for(int i=1;i<n;i++){
        dp[i][0] = dp[i-1][0]*(1 - v[i]);
    }
 
 
    for(int i=1;i<n;i++){
        for(int j=1;j<=n;j++){
            dp[i][j] = v[i]*dp[i-1][j-1] + (1-v[i])*dp[i-1][j];
        }
    }
 
    /*for(int i=0;i<n;i++){
        for(int j=0;j<=n;j++) cout<<dp[i][j]<<' ';
            cout<<endl;
    }*/
 
    double ans=0;
    for(int i=n;i>n/2;i--) {ans += dp[n-1][i]; }//cout<<dp[n-1][i]<<" ";}
 
    cout<<setprecision(15)<<ans;
}


Measured memory_bytes: 141568
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        if((a==1 && b==2)||(a==2 && b==1)){
            System.out.println(3);
        }
        if((a==2 && b==3)||(a==3 && b==2)){
            System.out.println(1);
        }
        if((a==1 && b==3)||(a==3 && b==1)){
            System.out.println(2);
        }
    }
}

Measured memory_bytes: 21844