akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

struct elem{
    unsigned int i;
    int v;
};

int partition(
        struct elem* ary,
        int p, int r)
{
    int i =0;
    int j = 0;
    struct elem x, buf;
    x = ary[r];
    i = p;
    for (j = p; j < r; j++) {
        if (ary[j].v <= x.v) {
            buf = ary[j];
            ary[j] = ary[i];
            ary[i] = buf;
            i++;
        }
    }
    buf = x;
    ary[r] = ary[i];
    ary[i] = buf;
    return i;
}

void quick_arg_sort(
        const double *ary,
        int *sorted_index) {
}


struct elem A[100100];
int main() {
    int i, n, k;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &(A[i].v));
    }
    k = partition(A, 0, n-1);
    for (i = 0; i < n; i++) {
        if (i) {
            printf(" ");
        }
        if (i == k) {
            printf("[");
        }
        printf("%d", A[i].v);
        if (i == k) {
            printf("]");
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2524
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int N = 2e5 + 100;

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

void solve()
{
    int L1 = 0;
    int L2 = 0;
    int L3 = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] <= A) L1++;
        if (a[i] > A && a[i] <= B) L2++;
        if (a[i] > B) L3++;
    }
    cout << min(min(L1,L2),L3);
}
int main()
{
    nhap();
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n)cin >> a[i];
	int now = (n+1)%2;
	sort(ALL(a));
	rep(i,n)
	{
		
		if(i%2&&n%2==1)
		{
			now+=2;
		}
		if(a[i]!=now)
		{
			cout<<0<<endl;
			return 0;
		}
		if(i%2&&n%2==0)
		{
			now+=2;
		}
		
	}
	ll ans = 1;
	rep(i,n/2)
	{
		ans = ans*2;
		ans%=INF;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<cstdio>
#include<string.h>
#include<cmath>
using namespace std;
int lst[3] = { 1,100,10000 };
int main() {
	int d, n;
	cin >> d >> n;
	if (n == 100) {
		cout << lst[d] * (n + 1) << endl;
	}
	else {
		cout << lst[d] * n << endl;
	}
	return 0;
}

Measured memory_bytes: 3560
#include <stdio.h>
#include <stdlib.h>

int cmpnum(const void * n1, const void * n2)
{
	if (*(long *)n1 > *(long *)n2)
	{
		return -1;
	}
	else if (*(long *)n1 < *(long *)n2)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

int main(void) {

  long n;
  scanf("%ld", &n);
  long a[n],b[n],dif[n];
  long need = 0;
  long change = 0;
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  for (long i = 0; i < n; i++) {
    scanf("%ld", &b[i]);
    dif[i] = a[i]-b[i];
    if (dif[i] < 0) {
      need += -dif[i];
      change++;
    }
  }
  qsort(dif, n, sizeof(long), cmpnum);
  for (long i = 0; i < n; i++) {
    if (need <= 0 || dif[i] <= 0) {
      break;
    }
    need -= dif[i];
    change++;
  }
  if (need <= 0) {
    printf("%ld\n", change);
  } else {
    printf("-1\n");
  }

  return 0;
}

Measured memory_bytes: 3324
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i <= i##_len; ++i)
#define rep3(i, l, r) for (int i = l, i##_len = (r); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = l, i##_len = (r); i <= i##_len; ++i)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef int64_t Int;
typedef long double Ld;

using namespace std;
template <class T>
using Graph = vector<vector<T>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 62;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

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

template <typename T>
inline T Gcd(T a, T b) {
    T c;
    while (b) {
        c = b;
        b = a % b;
        a = c;
    }
    return a;
}

Int Lcm(Int a, Int b) {
    if (a < b) {
        swap(a, b);
    }

    return a / Gcd(a, b) * b;
}

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

    int a, b, c;
    cin >> a >> b >> c;

    if (a == b) {
        cout << c << endl;
    } else if (b == c) {
        cout << a << endl;
    } else {
        cout << b << endl;
    }

    return 0;
}


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


int main() {

    int N;
    cin >> N;
    
    map<string,int> Si;
    string wk;
    for(int i=0;i<N;i++){
      cin >> wk;
      if(Si.count(wk)){
        Si.at(wk)+=1;
      }else{
        Si[wk]=1;
      }
    }
  
  int max_wk = 0;
  for (auto p : Si) {
  	auto k = p.first;
  	auto v = p.second;
    max_wk=max(max_wk,p.second);
  }

    for (auto p : Si) {
  	auto k = p.first;
  	auto v = p.second;
    if(v==max_wk)
      cout << k << endl;
  }
    return 0;    
}


Measured memory_bytes: 25216
#include <iostream>
#include <string>

using namespace std;

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



    int count = 0; 
    
    for (int i = 0; i < 3; i++) 
        if (x[i] == '1') count++;
    
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

flag = True

N = int(input())
pos = [0]*N
for i in range(N):
    x, y, h = map(int, input().split())
    if h > 0:
        flag = False
    pos[i] = (h, x, y)

pos = list(reversed(sorted(pos)))

def dist(p1, p2):
    (x1, y1) = p1
    (x2, y2) = p2
    return abs(x1-x2) + abs(y1-y2)

if flag:
    # dp = makelist(101, 101)
    # for (_, x, y) in pos:
    ()
else:
    for y in range(101):
        for x in range(101):
            (h1, x1, y1) = pos[0]
            H = dist((x, y), (x1, y1)) + h1

            flag = True
            for (h1, x1, y1) in pos[1:]:
                if h1 == 0:
                    if H - dist((x, y), (x1, y1)) > 0:
                        flag = False
                        break
                else:
                    if dist((x, y), (x1, y1)) + h1 != H:
                        flag = False
                        break
            if flag:
                print(" ".join(map(str, [x, y, H])))
                break


Measured memory_bytes: 44784
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

#define REP(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define fi first
#define sc second
#define pb push_back
#define double long double
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int>> vpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<int, int> pii;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;

const i64 MOD = 1000000007;
const i64 INF = 2e15;

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

	string s;
	cin >> s;

	int n = s.size();
	vvi dp(n + 1, vi(13));
	dp[0][0] = 1;

	REP(i, 0, n - 1) {
		REP(j, 0, 12) {
			if (s[i] == '?') {
				REP(k, 0, 9) {
					dp[i + 1][(10 * j + k) % 13] += dp[i][j];
					dp[i + 1][(10 * j + k) % 13] %= MOD;
				}
			}
			else {
				int k = s[i] - '0';
				dp[i + 1][(10 * j + k) % 13] += dp[i][j];
				dp[i + 1][(10 * j + k) % 13] %= MOD;
			}
		}
	}

	cout << dp[n][5] << endl;
	
	return 0;
}

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

int main() {
    string n;
    cin >> n;
    if ((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3])){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define  pb push_back
#define nl "\n"
#define fastScan ios_base::sync_with_stdio(0); cin.tie(NULL);
#define int long long int
using namespace std;
int vis[123456];
vector<int>adj[123456];
int dp1[123456];
int dp2[123456];
int mod;
void dfs(int src)
{
	int sum1=1,sum2=1;
	vis[src]=1;
	for(int i=0;i<adj[src].size();i++)
	{
		int v=adj[src][i];
		if(vis[v]==1)
			continue;
		dfs(v);
		sum1=(sum1%mod*dp2[v]%mod)%mod;
		sum2=(sum2%mod*((dp1[v]%mod+dp2[v]%mod)%mod)%mod)%mod;
	}
	dp1[src]=sum1;
	dp2[src]=sum2;
}
signed main()
{
	fastScan;
	int n;cin>>n;
	mod=(int)(1e9+7);
	for(int i=1;i<n;i++)
	{
		int a,b;cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	dfs(1);
	cout<<(dp1[1]%mod+dp2[1]%mod)%mod<<nl;
}


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

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()
#define what_is(x) #x << " is " << (x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e5 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

int n, w;
pii a[N];
int dp[(int)1e4 + 123];

int main() {
    cin >> n >> w;
    for(int i = 1; i <= n; i ++)
        cin >> a[i].F >> a[i].S;
    for(int i = 1; i <= w; i ++) {
        dp[i] = dp[i - 1];
        for(int j = 1; j <= n; j ++) {
            if(i - a[j].S >= 0) {
                dp[i] = max(dp[i], dp[i - a[j].S] + a[j].F);
            }
        }
    }
    cout << dp[w] << '\n';
    return 0;
}



Measured memory_bytes: 3144
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long MOD = 1000000007;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                int A = line[0];
                int B = line[1];
                int C = line[2];

                int ret = A + B;
                ret = Math.Min(ret, A + C);
                ret = Math.Min(ret, B + C);
                Console.WriteLine(ret);
            }

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int A, B, Q;
	cin >> A >> B >> Q;
	vector<ll> s(A + 2), t(B + 2), x(Q);

	s[0] = t[0] = (ll)-10e12;
	s[A + 1] = t[B + 1] = (ll)10e12;
	REP(i, A) cin >> s[i + 1];
	REP(i, B) cin >> t[i + 1];
	REP(i, Q) cin >> x[i];

	REP(i, Q) {
		ll pos = x[i];
		int idxS = lower_bound(s.begin(), s.end(), pos) - s.begin();
		int idxT = lower_bound(t.begin(), t.end(), pos) - t.begin();

		ll ans1, ans2, ans3, ans4;
		ll nextS = s[idxS]	- pos;
		ll prevS = pos		- s[idxS - 1];
		ll nextT = t[idxT]	- pos;
		ll prevT = pos		- t[idxT - 1];
		ans1 = max(nextS, nextT);
		ans2 = max(prevS, prevT);
		ans3 = min((2 * nextS + prevT), (nextS + 2 * prevT));
		ans4 = min((2 * prevS + nextT), (prevS + 2 * nextT));

		ll res = min(ans1, ans2);
		res = min(res, ans3);
		cout << min(res, ans4) << endl;
	}

	return 0;
}


Measured memory_bytes: 3712
#!/usr/bin/env python3

# 下、右、上、左、右下、右上、左下、左上
dy = [1, 0, -1, 0, 1, -1, 1, -1]
dx = [0, 1, 0, -1, 1, 1, -1, -1]


def main():
    h, w = map(int, input().split())
    grid = []

    for i in range(h):
        grid.append(list(input()))

    # print(h,w,grid,sep=' ')

    for i in range(h):
        for j in range(w):
            # print(i,j,sep=' ')

            if grid[i][j] == '#':
                continue

            cnt = 0

            for k in range(8):
                y = i + dy[k]
                x = j + dx[k]
                # print(k,x,y,sep='~')

                if y >= 0 and y < h and x >= 0 and x < w:
                    if grid[y][x] == '#':
                        cnt += 1
                else:
                    continue
            grid[i][j] = cnt
        # print(grid[i])

    for i in range(h):
        for j in range(w):
            print(grid[i][j], end="")

        print('')


main()


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

int main(){
  ll n;cin>>n;
  string str;
  for(int i=1;i<=99;i++)
  {
    ll x=pow(26,i);
 	if(n<=x){
      n-=1;
      for(int j=1;j<=i;j++){
          str+=97+(n%26);
        	n/=26;
      }
      break;
    }
    else n-=x;
  }
  reverse(str.begin(),str.end());
  cout<<str;
}

Measured memory_bytes: 4084
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, K = MI()
    p = LI()

    sum_i = sum(p[0:K])
    max_ans = sum_i
    max_i = 0
    ans = 0
    for i in range(1, N-K+1):
        sum_i = sum_i - p[i-1] + p[K+i-1]
        #print(i,p[i-1],p[K+i-1])
        #print(sum_i)
        #for j in range(i+1,i+K):
        #    sum_i += p[j]
        #print("sum",sum_i)
        if max_ans <= sum_i:
            max_ans = sum_i
            max_i = i
    #print("max",max_i) 
    for j in range(max_i,max_i+K):
        #print("max_i",j)  
        ans += sum(range(1, p[j] + 1))/p[j]
    
    print(ans)




if __name__ == "__main__":
	main()

Measured memory_bytes: 71792
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  bool f=0;
  for(int i=1;i<1000;i++)
    f|=((a*i)%b==c);
  cout<<(f?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[]
for i in range(n):
  x=int(input())
  a.append(x)
d={}
f=0
maxi=0
for i in range(n):
  if((a[i]-1) in d):
    d[a[i]]=d[a[i]-1]+1
  else:
    d[a[i]]=1

for i in d:
  if(i==0):
    maxi=d[i]
  else:
    if(d[i]>maxi):
      maxi=d[i]

print(n-maxi)



Measured memory_bytes: 34976
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }

    vector<vector<bool>> dp1(n + 1, vector<bool>(k)), dp2(n + 1, vector<bool>(k));
    irep(i, n) rep(j, k)
    {
        if (i == 0) {
            dp1[i][j] = dp2[n - i][j] = (j == 0);
        } else {
            dp1[i][j] = dp1[i - 1][j] || (j - a[i - 1] >= 0 && dp1[i - 1][j - a[i - 1]]);
            dp2[n - i][j] = dp2[n - (i - 1)][j] || (j - a[n - i] >= 0 && dp2[n - (i - 1)][j - a[n - i]]);
        }
    }

    int result = 0;
    rep(i, n)
    {
        vector<int64_t> psum(k + 1);
        psum[0] = 0;
        rep(j, k)
        {
            psum[j + 1] = psum[j] + (dp2[i + 1][j] ? 1 : 0);
        }

        int64_t cnt = 0;
        rep(j, k)
        {
            if (dp1[i][j]) {
                cnt += psum[max(0L, k - j)] - psum[max(0L, k - a[i] - j)];
            }
        }
        if (cnt == 0) {
            result++;
        }
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 6912
H,W=map(int,input().split())
a=[]
for i in range(H):
    a.append(list(input()))
for i in range(len(a)):
    a[i]=['#']+a[i]+['#']
b=[]
for i in range(W+2):
    b.append('#')
print(''.join(b))
for i in range(len(a)):
    print(''.join(a[i]))
print(''.join(b))

Measured memory_bytes: 63580
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
BC = []
for j in range(m):
    b, c = map(int, input().split())
    BC.append((b, c))
BC = sorted(BC, key=lambda x: x[1], reverse=True)
D = []
for b, c in BC:
    D.extend([c for i in range(b)])
    if len(D) >= n:
        D = D[:n]
        break
for x in range(len(D)):
    if A[x] > D[x]:
        break
else:
    x += 1
print(sum(A[x:]) + sum(D[:x]))

Measured memory_bytes: 23276
#include "bits/stdc++.h"
using namespace std;

int main(){
  
  int n,t,a;
  cin >>n >>t >>a;
  
  vector<int>h(n);
  for(int i=0; i<n; i++)cin >>h[i];
  
  double ans = 10000;
  int anss = 0;
  
  for(int i=1; i<=n; i++){
    double w;
    w = abs(a-(t-h[i-1]*0.006));
    if(ans>w){
      ans = w;
      anss = i;
    }
  }
  
  cout <<anss <<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

map<ll, ll> primes;

void primefactorize(ll n)
{
    while (n % 2 == 0)
    {
        n /= 2;
        primes[2]++;
    }

    for (int i = 3; i <= sqrt(n); i += 2)
    {
        while (n % i == 0)
        {
            n /= i;
            primes[i]++;
        }
    }
    if (n > 2)
        primes[n]++;
}

int main()
{
    ll N;
    cin >> N;
    if (N == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    for (int i = 2; i <= N; i++)
    {
        primefactorize(i);
    }
    /*
    for (auto elem : primes) {
        cout << elem.first << " " << elem.second << endl;
    }
    */

    ll o3 = 0, o5 = 0, o15 = 0, o25 = 0, o75 = 0;
    for (auto elem : primes)
    {
        if (elem.second + 1 >= 75)
        {
            o75++;
        }
        if (elem.second + 1 >= 25)
        {
            o25++;
        }
        if (elem.second + 1 >= 15)
        {
            o15++;
        }
        if (elem.second + 1 >= 5)
        {
            o5++;
        }
        if (elem.second + 1 >= 3)
        {
            o3++;
        }
    }
    //cout << o3 << " " << o5 << " " << o25 << endl;

    ll ans = 0;
    ans += o75;
    ans += o25 * (o3 - 1);
    ans += o15 * (o5 - 1);
    ans += (o5 * (o5 - 1) / 2) * (o3 - 2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        double b = sc.nextDouble();
        
        long c = (long)(b * 100.0 + 0.5);
        long ans = a * c /100;
        System.out.println(ans);
    }
}

Measured memory_bytes: 37312
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#define STDIN freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);
using namespace std;

int main()
{
    //STDIN;
    queue<long long> que;
    //vector<long long> vec;
    for (long long i = 1; i <= 9; i++)
    {
        que.push(i);
        //vec.push_back(i);
    }

    int n; cin >> n;
    int cnt = 0;
    long long now = 0;
    while (cnt != n)
    {
        now = que.front();
        que.pop();
        int d = now % 10;
        if (d != 0) que.push(now*10+d-1);
        que.push(now*10+d);
        if (d!=9) que.push(now*10+1 + d);
        cnt++;
    }
    cout << now << endl;
}



Measured memory_bytes: 1792
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
L = list(map(int, input().split()))

S = sum([abs(v) for v in L])
if len(list(filter(lambda x: x < 0, L))) % 2 == 0:
    print(S)
else:
    print(S-2*(min([abs(v) for v in L])))


Measured memory_bytes: 63592
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
map<ll,ll> mp;
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
ll dp[100005];
int main(){
ll n;
cin>>n;
vector<ll> a(n);
for(int i=0;i<n;i++)cin>>a[i];
sort(all(a));
ll ma=a[n-1];
ll mid=a[n-1]/2;
ll ch=-1;
if(a[n-1]%2==1)ch=mid+1;
auto ite=lower_bound(all(a),mid);
if(*ite==ma)ite--;
if(mid==*ite||ch==*ite){
    cout<<ma<<" "<<*ite<<endl;
}
else {
    ll r=*ite;
    if(ite==a.begin()){
        cout<<ma<<" "<<*ite<<endl;
        return 0;
    }
    ite--;
    ll l=*ite;
    if(ch==-1){
        if(r-mid>mid-l){
            cout<<ma<<" "<<l<<endl;

        }
        else{
            cout<<ma<<" "<<r<<endl;
        }
    }
    else{
        if(r-ch>mid-l){
            cout<<ma<<" "<<l<<endl;
        }
        else{
            cout<<ma<<" "<<r<<endl;
        }
    }
}
return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int h1 = sc.nextInt();
        int m1 = sc.nextInt();
        int h2 = sc.nextInt();
        int m2 = sc.nextInt();
        int k = sc.nextInt();

        int c = (h2 - h1) * 60 + (m2 - m1);

        System.out.println(c - k);

    }

}


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


int main() {
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int> x(N);
	vector<int> y(M);
	for (int i = 0; i < N; i++)
	{
		cin >> x[i];
	}
	for (int i = 0; i < M; i++)
	{
		cin >> y[i];
	}
	x.push_back(X);
	y.push_back(Y);

	int XMAX = *max_element(x.begin(), x.end());
	int YMIN = *min_element(y.begin(), y.end());

	if (XMAX < YMIN) cout << "No War" << endl;
	else cout << "War" << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    int ans = 1;
        
    REP(j, 2, 4000000) {
        bool exist1 = false, exist2 = false;
        while(A % j == 0) {
            exist1 = true;
            A /= j;
        }
        while(B % j == 0) {
            exist2 = true;
            B /= j;
        }
        if (exist1 && exist2) ans++;
    }
    if (A == B && A != 1) ans++;
    cout << ans << endl;
    


    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;

const ll mod = 1000000007;
const double pi = 3.1415926535897932384626;

ll powmod(ll a, ll b) {ll res = 1; ll rem = a % mod; for (; b; b >>= 1) {if (b & 1) res = (res * rem) % mod; rem = (rem * rem) % mod;} return res;}

int ara[18];

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
    
    ll n = 0ll;
    int k = 0;
    scanf("%lld %d", &n, &k);

    for (int i = 1; i <= k; ++i) {
	int a = 0;
	scanf("%d", &a);
	ara[a] = 1;
    }

    for (ll i = n; ; ++i) {
	ll a = i;
	bool check = true;
	while (a) {
	    int b = a % 10;
	    a /= 10;
	    if (ara[b]) {
		check = false;
		break;
	    }
	}

	if (check) {
	    printf("%lld\n", i);
	    return 0;
	}
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 120000
#define offset 
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int  main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    string txt;
    cin>>txt;
    if (txt=="ABC")
        cout<<"ARC\n";
    else
        cout<<"ABC\n";

}
// PLUS ULTRA!
    


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
int n,a,b,i,flag,zhan[4005],top,ans[4005];
char s[15];
int query(int x,int y){
	printf("? %d %d\n",x,y);
	fflush(stdout);
	scanf("%s",s);
	if(s[0]=='Y')
		return 1;
	else
		return 0;
}
int main(){
	//freopen("7.in","r",stdin);
    //freopen("7.out","w",stdout);
   	a=read();b=read();
   	if(b>=a){
   		printf("Impossible\n");
		return 0;
	}
	n=a+b;
	for(i=0;i<n;i++){
		if(top==0){
			top++;
			zhan[top]=i;
		}
		else{
			flag=query(zhan[top],i);
			if(flag==0){
				zhan[top]=0;
				top--;
			}
			else{
				top++;
				zhan[top]=i;
			}
		}
	}
	
	for(i=0;i<n;i++)
		ans[i]=query(zhan[top],i);
	cout<<"! ";
	for(i=0;i<n;i++)
		pus(ans[i],0);
	cout<<endl;
    return 0;
}

Measured memory_bytes: 724
#include<bits/stdc++.h>
   using namespace std;
   #define bolt ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   #define text_wali_bakchodi freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
   #define F first
   #define S second
   #define pb push_back
   #define lb lower_bound
   #define ub upper_bound
   #define endl "\n"
   typedef long long ll;
   typedef long double ld;
   const ll mod = 998244353 ;
   const ld pi=3.1415926535897932384626433;
   const ll inf = 1e18;
   bool isprime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
   ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
   ll power(ll x,ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=((res%mod)*(x%mod))%mod;y=y>>1;x=((x%mod)*(x%mod))%mod;}return res;}
   ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
   ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
   ll max(ll a,ll b){ll sol=a>b?a:b;return sol;}
   ll min(ll a,ll b){ll sol=a<b?a:b;return sol;}
   ll mul(ll a,ll b){return ((a%mod)*(b%mod))%mod;}
   ll add(ll a,ll b){return ((a%mod)+(b%mod))%mod;}
   int main()
   {
      bolt;
      ll p;
      ll n;
      cin>>p>>n;
      vector <ll> a(n);
      for (ll i=0;i<n;i++)
      {
         cin>>a[i];
      }
      ll ans=a[n-1]-a[0];

      for (ll i=1;i<n;i++)
      {
         ans=min(ans,a[i-1]+p-a[i]);
      }
      cout<<ans;
   }


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

int main() {
  int a,b,c;
  cin >> a>>b>>c;

  if (a<c&&c<b) {
    cout << "Yes" << endl;
  }
 else if(b<c&&c<a){
  cout << "Yes" << endl;
}
 else{cout<<"No"<<endl;}

}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  string s;
  cin >> s;
  ll N = s.size();

  ll ans = N*(N-1)/2 + 1; // nC2: 全組合せ

  // 両端が同じ文字の部分文字列 dabcd と、両端を取り除いた部分文字列 abc は重複しているので除く
  vector<ll> hist(26, 0);
  for (char c: s) {
    hist[c-'a']++;
  }
  for (ll x : hist) {
    if (x>=2)
      ans -= x*(x-1)/2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")
//Use above if bruteforcing with lots of small operations. Or just use it anytime, there's no downside.
//AVX is better slightly
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))

const ll inf = (1LL<<62);
const int iinf = (1<<30);
//CLOCKS_PER_SEC



int main(){
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    //ios_base::sync_with_stdio(0); cin.tie(0);
    //ifstream cin ("test.in");
    ll x;
    cin >> x;
    ll start = 100;
    int cnt = 0;
    while (start < x){
        start += start / 100;
        cnt++;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3596
#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 c[20][1500];

int area( int px, int py, int x, int y){
	return c[y][x] - c[y][px] - c[py][x] + c[py][px];
}

int main(){
	int h, w, k;
	cin >> h >> w >> k;
	for( int i = 0; i < h; ++i ){
		string s; cin >> s;
		for( int j = 0; j < w; ++j ){
			c[i+1][j+1] = c[i][j+1] + c[i+1][j] - c[i][j];
			if( s[j] == '1' ) c[i+1][j+1] += 1;
		}
	}
	int ans = inf;
	for( int cond = 0; cond < (1<<(h-1)); ++cond ){
		int pre_x = 0;
		int columncnt = 0;
		for( int x = 1; x <= w; ++x ) {
			int pre_y = 0;
			for( int y = 1; y <= h; ++y ){
				if( cond & (1<<(y-1)) || y == h ){
					if( area( pre_x, pre_y, x, y ) > k ){
						pre_x = x-1;
						++columncnt;
						break;
					}
					pre_y = y;
				}	
			}
			// 縦線 x-1 で切ったあと，x-1 から x の範囲で条件を満たしているとは限らないので再検証
			pre_y = 0;
			for( int y = 1; y <= h; ++y ){
				if( cond & (1<<(y-1)) || y == h ){
					if( area( pre_x, pre_y, x, y ) > k ){
						columncnt = inf;
					}
					pre_y = y;
				}	
			}
		}
		ans = min( ans, columncnt+__builtin_popcount(cond) );
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FORD(i, a, b) for (int i=(a); i>(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define SZ(x) ((int)(x).size())
#define BACK(x) prev((x).end())
#define HASK(x, y) ((x).find(y) != (x).end())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
 
const int maxN = 1 << 19;

long long T[20][20];

void solve()
{
	int n;
	scanf ("%d", &n);
	FOR(i, 1, n+1) if (i % 10 != 0)
	{
		int a = i % 10, b = i;
		while (b >= 10)
			b /= 10;
		T[a][b]++;
	}
	
	long long res = 0;
	FOR(i, 1, 10) FOR(j, 1, 10)
		res += T[i][j] * T[j][i];
	printf("%lld\n", res);
}
 
int main()
{
	int t = 1;
	//scanf ("%d", &t);
	FOR(tid, 1, t+1)
	{
		//printf("Case #%d: ", tid);
		solve();
	}
	return 0;
}





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

#define fastIO      ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define asc(s)      sort(s.begin(), s.end())
#define des(s)      sort(s.rbegin(), s.rend())
#define pb(x)       push_back(x)
#define mp(x, y)    make_pair(x, y)
#define all(v)      v.begin(), v.end()
#define rev(v)      reverse(v.begin(), v.end())
#define lower(s)    transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s)    transform(s.begin(), s.end(), s.begin(), ::toupper);
#define MOD         1000000007
#define PI          3.14159265358979

typedef long long ll;

template <typename TH>
void _dbg(const char *sdbg, TH h) { cerr << sdbg << "=" << h << "\n"; }
template <typename TH, typename... TA>
void _dbg(const char *sdbg, TH h, TA... t)
{
    while (*sdbg != ',')
    {
        cerr << *sdbg++;
    }
    cerr << "=" << h << ",";
    _dbg(sdbg + 1, t...);
}

#ifndef ONLINE_JUDGE
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug
#endif

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

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

vector<string> split(string s)
{
    istringstream buf(s);
    istream_iterator<string> beg(buf), end;
    vector<string> list(beg, end);
    return list;
}

bool isvowel(char c)
{
    string s = "aeiouAEIOU";
    if (find(s.begin(), s.end(), c) != s.end())     return true;
    return false;
}

vector <ll> sieve(ll n)
{
    vector<bool> prime(n + 1, true);
    prime[0] = prime[1] = 0;

    for (int i = 2; i * i <= n; i++)
    {
        if (prime[i])
            for (int j = i * i; j <= n; j += i)
            {
                prime[j] = 0;
            }
    }

    vector <ll> p;

    for(int i=2; i<=prime.size();i++)
        if(prime[i])
            p.pb(i);
    
    return p;        
}

bool isprime(int n)
{
    for(int i=2;i*i<=n;i++)
    {
        if(n%i==0)
            return false;
    }

    return true && (n!=1);
}

int ncr(ll n, ll r) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 

    C[0] = 1; 

    for (ll i = 1; i <= n; i++) 
    { 
        for (ll j = min(i, r); j > 0; j--) 
            // nCj = (n-1)Cj + (n-1)C(j-1); 
            C[j] = (C[j] + C[j-1])%MOD; 
    } 

    return C[r]; 
}

bool special(string s)
{
    for(int i=0;i<s.size();i++)
    {
        if(s[i] == ' ')
            continue;
        
        if(s[i] == '#')
            return true;
        
        else
            return false;
    }
    return false;
}

vector <ll> ans;

bool cmp(string &a, string &b)
{
    return (a.size() < b.size() )|| (a.size() == b.size() && a < b);
}

void solve()
{
    ll n,k;
    cin >> n >> k;

    n = n%k;

    cout << min(n, abs(n-k));
}

int main()
{
    fastIO
   


    int t = 1;
    // cin >> t;

    for(int i=1;i<=t;i++)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
aa = (0..1300).group_by{|x| (x*0.08).floor}
bb = (0..1300).group_by{|x| (x*0.1).floor}
a, b = gets.split.map(&:to_i)
n = (aa[a] & bb[b])
p n.empty? ? -1 : n.min


Measured memory_bytes: 1788
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
int main() {
    vector<int> M;
    int sum = 0, diff = 10e7, tmp = 0, x = 1;
    for (int i = 0; i < 5; ++i) {
        int a; cin >> a; M.push_back(a);
        if (diff >= a % 10 && a % 10 != 0) {
            diff = a % 10, tmp = a;
        }
    }
    for (int i = 0; i < 5; ++i) {
        if (M[i] == tmp && x == 1) {
            x--; continue;
        }
        if (M[i] % 10 == 0) sum += M[i];
        else sum += M[i] + (10 - (M[i] % 10));
    }
    printf("%d\n", sum + tmp);
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  double N, M, D;
  cin >> N >> M >> D;
  double p;
  if (D == 0) {
    p = N / (N * N);
  } else {
    p = (N - D) * 2.0 / (N * N);
  }
  cout << fixed << setprecision(15);
  cout << (M - 1) * p << endl;
  return 0;
}


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

int main(void){
    int h,w; cin >> h >> w;
    vector<string> S(h);
    for(int i=0; i<h; i++) cin >> S[i];
    bool ans=true;
    int A[4]={-1,0,1,0};
    int B[4]={0,1,0,-1};


    bool breakflg=false;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){

            if(S[i][j]=='#'){ //上、右、下、左に要素があってかつ＃かどうかをチェックする
                bool flg=false;
                if(i!=0   && S[i+A[0]][j+B[0]]=='#') flg=true;
                if(j!=w-1 && S[i+A[1]][j+B[1]]=='#') flg=true;
                if(i!=h-1 && S[i+A[2]][j+B[2]]=='#') flg=true;
                if(j!=0   && S[i+A[3]][j+B[3]]=='#') flg=true;
                
                if(!flg){
                    ans=false; breakflg=true; break;
                }
            }
        }
        if(breakflg) break;
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

int main() {
  int N;
  cin >> N;
  int state = 1;
  vector<int> a(N);
  for(int i=0; i<N; i++)
    cin >> a.at(i);
  
  int cnt = 0;
  for(int i=0; i<N; i++){
    state = a.at(state-1);
    cnt++;
    if(state == 2){
      cout << cnt << endl;
      break;
    }
  }
  if(state != 2)
    cout << -1 << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <random>

#define int long long
#define x first
#define y second

using namespace std;

void solve() {
	int n;
	string s;
	cin >> n >> s;
	if (n % 2 == 1) {
		cout << "No" << endl;
		return;
	}
	string a = "";
	for (int i = n / 2; i < n; i++) a.push_back(s[i]);
	for (int i = n / 2; i < n; i++) s.pop_back();
	if (a == s) cout << "Yes" << endl;
	else cout << "No" << endl;
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n = 1;
	//cin >> n;
	while (n--)	solve();

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i=0; i < n; i++)
using namespace std;
#define PI 3.14159265358979

int main()
{
    string s;
    cin >> s;
    rep(i, s.length()) {
        cout << "x";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int>moji(3);
  for(int i=0;i<3;i++){
  cin>>moji.at(i);
  }
sort(moji.begin(),moji.end());
  reverse(moji.begin(),moji.end());
  cout<<moji.at(0)*10+moji.at(1)+moji.at(2)<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
using namespace std;
const int maxn = 1e5+500;  //数据范围

const ll mod = 1e9+7;
int A[maxn],B[maxn];

int main(){
    int n;cin>>n;
    FOR(i,1,n+1)scanf("%d",&A[i]);
    FOR(i,1,n)scanf("%d",&B[i]);
    ll ans=0;
    FOR(i,1,n){
        ll tmp=B[i];
        if(B[i]>A[i]){
            B[i]-=A[i];
            A[i]=0;
        }
        else A[i]-=B[i],B[i]=0;
        if(B[i]>A[i+1]){
            B[i]-=A[i+1];
            A[i+1]=0;
        }
        else A[i+1]-=B[i],B[i]=0;
        ans+=tmp-B[i];
    }
    cout<<ans<<endl;
}


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

int main(){
  string s;
  ll ans=0,g=0;
  cin>>s;
  for(int i=0;i<(int)s.size();i++){
    if(s[i]=='g') {
      if(g>0) {ans++;g--;}
      else g++;
    }
    else if(g>0) g--;
    else {ans--;g++;}
    //cout<<g<<endl;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> a(N), b(N);
    rep(i, N) cin >> a[i];
    rep(i, N) cin >> b[i];
    
    long long a_sum = 0, b_sum = 0;
    rep(i, N) a_sum += a[i];
    rep(i, N) b_sum += b[i];
    long long a_cnt = 0, b_cnt = 0;
    rep(i, N) {
        int k = max((b[i] - a[i] + 1) / 2, 0);
        a[i] += k * 2;
        a_cnt += k;
    }
    rep(i, N) {
        int k = a[i] - b[i];
        b[i] += k;
        b_cnt += k;
    }
    if (a_cnt > b_sum - a_sum || b_cnt > b_sum - a_sum) {
        cout << "No\n";
        return 0;
    }
    if (b_sum - a_sum - b_cnt == (b_sum - a_sum - a_cnt) * 2) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 384
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
void solve(); int main() { solve(); return 0; }

void solve() {
  int n, m; cin >> n >> m;
  vector<pair<int,int>> K;
  loop(i,0,m) {
    int a, b;
    cin >> a >> b;
    int S = 0;
    loop(j,0,b) {
      int c;
      cin >> c; c--;
      S |= 1<<c;
    }
    K.emplace_back(S, a);
  }
  
  const int INF = 1001001001;
  vector<int> dp(1<<n, INF);
  dp[0] = 0;
  for (ll S=0; S<1<<n; S++) {
    for (auto&&k: K) {
      int T = S | k.first;
      dp[T] = min(dp[T], dp[S] + k.second);
    }
  }
  
  int ans = dp.back();
  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 3652
! 2019.12.22
!
      program answer
      implicit none
      integer(8) :: A,B
      integer(8) :: over
      integer(8) :: ans
      integer(8),external :: Euclid
!
      read(*,*) A,B
      over = Euclid(A,B)
      ans = A*B/over
      write(*,*) ans
      end program answer
!------------------------------------------------
      function Euclid(x,y) result(res)
!------------------------------------------------
      implicit none
      integer(8) :: x,y
      integer(8) :: res
      integer :: x1,y1
      intrinsic abs
!
      x1 = x
      y1 = y
!
      do
        res = x1 - y1
        if(res > 0) then
          x1 = res
        else if(res < 0) then
          y1 = -res
        else if(res == 0) then
          res = x1
          exit
        end if
      end do
      end function Euclid

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

using namespace std;

template <typename T>
T gcd(T a, T b) {
  while (a) {
    b %= a;
    std::swap(a, b);
  }
  return b;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t A, B;
  cin >> A >> B;
  cout << lcm(A, B) << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int max=0;
        int min=100000;
        for(int i=0;i<5;i++) { 
            int x = sc.nextInt(); 
            max=Math.max(max, x);
            min=Math.min(min, x);
        }
        int k=sc.nextInt();
        if(max-min>k){
        System.out.println(":(");
        }
        else{
            System.out.println("Yay!");
        }
    }  
}


Measured memory_bytes: 23252
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

int N, K;
int A[200001];

signed main()
{
	cin >> N >> K;
	REP(i, N) cin >> A[i];

	for (int i = K; i < N; i++)
	{
		YesNo(A[i - K] < A[i]);
	}
}



Measured memory_bytes: 4664
#include <stdio.h>

int main(void) {
  int x;
  int y;
  int z;
  int w;
  scanf("%d %d %d", &x,&y,&z);
  w = x;
  x = y;
  y = w;
  w = x;
  x = z;
  z = w;
  printf("%d %d %d\n", x,y,z);
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,ll>pa;

const int N=2e5+100;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;


int main()
{
    ll t1,t2;cin>>t1>>t2;
    ll a1,a2,b1,b2;
    cin>>a1>>a2>>b1>>b2;
    if(a1>b1) {
        swap(a1,b1);
        swap(a2,b2);
    }
    ll len1=(a1-b1)*t1;
    ll len2=(a2-b2)*t2;
    ll ans=0;
    if(len1+len2==0){
         puts("infinity");
    }
    else if(len1+len2<0) {
        puts("0");
    }
    else {
          ans=(-len1)/(len1+len2);
         ans*=2;
         if((-len1)%(len1+len2)!=0) ans++;
         cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 3576