akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int a, b,cnt=0;
    bool ans = true;
    cin >> a;
    vector<int>sq(a),ss(a);
    rep(i, a)cin >> sq[i];
    iota(all(ss), 1);
    rep(i, a)if (sq[i] != ss[i])cnt++;
    if (cnt == 2 || cnt == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}

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

int c[11][11];

int main() {
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> c[i][j];
        }
    }
    for (int k = 0; k < 10; k++) {
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    int sum = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int a;
            cin >> a;
            if (a == -1 || a == 1) continue;
            sum += c[a][1];
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
int main(){
	int a,b,h;	
	cin>>a>>b>>h;
	int x=(a+b)*h/2;
	cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 3596
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
const int maxK = 1e5+1000;
int u,v,q[maxK],f[maxK],K;
bool vis[maxK];
int front,rear;
int main(){
	memset(f,0x3f,sizeof(f));
	memset(vis,false,sizeof(vis));
	scanf("%d",&K);
	front = rear = 0;
	for (int i=1;i<min(9,K);i++) f[i] = i,q[rear++] = i;
	while (front != rear){
		u = q[front++];
		if (front == K+100) front = 0;
		for (int i=0;i<=9;i++){
			v = (u * 10 + i) % K;
			if (f[v] > f[u] + i){
				f[v] = f[u] + i;
				if (!vis[v]){
					q[rear++] = v;
					if (rear == K+100) rear = 0;
					vis[v] = true;
				}
			}
		}
		vis[u] = false;
	}
//	for (int i=0;i<K;i++){
//		printf("%d %d\n",i,f[i]);
//	}
	printf("%d\n",f[0]);
	return 0;
}
/*
f[i]表示%K余数为i的最小数字和
f[i * j % K] = min(f[i * j % K],f[i] + j); 


*/





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

su=[26**i for i in range(1,20)]
from itertools import accumulate
wa = list(accumulate(su)) 
import bisect
c = 0
n = n-1
if n>26:
    c=bisect.bisect_left(wa, n)
    n=n-wa[c-1]
m = n
k=26
bi=[]
for i in range(c+1):
    
      bi.append(n % k)
      n = (n-n%k)//k
      
al=[chr(ord('a') + i) for i in range(26)]

li = [al[i] for i in bi]
li.reverse()
if m in su:
  li.append('a')

mojiretu = ''.join(li)

print(mojiretu)

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

int N;
vector<int> L;

int main(int argc, char* argv[]){
  cin >> N;
  for(int i = 0; i < 2*N; i++){
	int tmp;
	cin >> tmp;
	L.push_back(tmp);
  }
  sort(L.begin(),L.end());
  int ans = 0;
  for(int i = 0; i < N; i++)
	ans += L[i*2];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    ans += B[A[i]-1]
    if i != 0 and A[i] - A[i-1] == 1:
        ans += C[A[i]-2]

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

int main(){
  int n,k;
  cin >> n >> k;
  int h[n];
  rep(i,n)cin >> h[i];
  sort(h,h+n);
  if(n-k<1)cout << 0 << endl;
  else {
    ll res=0;
    rep(i,n-k)res+=h[i];
    cout << res << endl;
  }
}


Measured memory_bytes: 1024
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


def solve():
    T = input()
    S = T.replace('?', 'D')

    return S


def main():
    print(solve())


if __name__ == "__main__":
    main()


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

int main(){

    int h,w;
    string s;
    cin>>h>>w;

    for(int i=0;i<w+2;i++) cout<<"#";
    cout<<endl;

    for(int i=0;i<h;i++){

        cin>>s;
        cout<<"#"<<s<<"#"<<endl;

    }

    for(int i=0;i<w+2;i++) cout<<"#";
    cout<<endl;







    return 0;
}

Measured memory_bytes: 256
def main():
    from builtins import int, map, list, print, len
    import sys
    from bisect import bisect_right

    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N, M, K = input_number_list()
    A = input_number_list()
    B = input_number_list()
    time_A = [A[0]]
    time_B = [B[0]]
    for i in range(1, len(A)):
        time_A.append(time_A[i - 1] + A[i])
    for i in range(1, len(B)):
        time_B.append(time_B[i - 1] + B[i])
    idx_a = bisect_right(time_A, K) - 1
    time = time_A[idx_a]
    idx_b = -1
    if len(A) - 1 == idx_a:
        idx_b = bisect_right(time_B, K - time) - 1
    ans = idx_a + idx_b + 2
    idx_b = bisect_right(time_B, K - time) - 1
    ans = max(ans, idx_a + idx_b + 2)
    while True:
        if idx_a < 0:
            break
        time -= A[idx_a]
        idx_a -= 1
        idx_b = bisect_right(time_B, K - time) - 1
        ans = max(ans, idx_a + idx_b + 2)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 47460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MX 100005
ll dp[MX];
int A[MX], N;

ll go(int pos){
    if (pos > N) return 0;
    if (dp[pos] != -1) return dp[pos];
    ll x = 0, y = INT_MAX;
    if (pos + 1 <= N) x = abs(A[pos] - A[pos+1]) + go(pos+1);
    if (pos + 2 <= N) y = abs(A[pos] - A[pos+2]) + go(pos+2);
    return dp[pos] = min(x, y);
}

int main()
{
    memset(dp, -1, sizeof(dp));
    scanf("%d", &N);
    for (int i = 1; i <= N; i++){
        scanf("%d", &A[i]);
    }
    ll res = go(1);
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 6144
import itertools
import copy


def nuri(a, b, _):
    # 行の塗り替え
    if len(a)!=0:
        for aa in a:
            for i in range(w):
                _[aa][i] = 0
    # 列の塗り替え
    if len(b)!=0:
        for bb in b:
            for i in range(h):
                _[i][bb] = 0
    return sum(map(sum, _))


h, w, k = map(int, input().split())
c = []  # 0:白, 1:黒
for i in range(h):
    s = input()
    _ = []
    for j in range(w):
        if s[j] == ".":
            _.append(0)
        else:
            _.append(1)
    c.append(_)

iterh = [i for i in range(h)]
iterw = [i for i in range(w)]

count = 0
for i in range(h):
    lih = itertools.combinations(iterh, i)
    for lih_ in lih:
        for j in range(w):
            liw = itertools.combinations(iterw, j)
            for liw_ in liw:
                _ = copy.deepcopy(c)
                if nuri(lih_, liw_, _) == k:
                    count += 1
print(count)


Measured memory_bytes: 9340
N = int(input())
A = list(map(int, input().split(' ')))

def multi_all(A):
  s = 1
  for a in A:
    s *= a
  return s

M = multi_all(A)

if N == 1: print(A[0])
else:
  S = 0
  for a in A:
    S += M / a
  print(M/S)


Measured memory_bytes: 2940
def abc142_b():    
    n, k = map(int,input().split())
    h = list(map(int,input().split()))
    cnt = 0
    for i in range(len(h)):
        if h[i] >= k:
            cnt += 1

    print(cnt)

if __name__ == '__main__':
    abc142_b()

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

int main() {
	int a[100][100], b[100], n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++)scanf("%d", &a[i][j]);
	}
	for (int i = 0; i < m; i++) scanf("%d", &b[i]);
	for (int i = 0; i < n; i++) {
		int c = 0;
		for (int j = 0; j < m; j++) c += a[i][j] * b[j];
		printf("%d\n", c);
	}
}


Measured memory_bytes: 3224
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int p;
		int correctAns = 0;
		int penalties = 0;
		String s;
		int[] Problems = new int[n];
		//initialize array
		for(int i = 0; i < n; i++) {
			Problems[i] = 0;
		}
		for(int i = 0; i < m; i++) {
			p = in.nextInt();
			s = in.nextLine();
			//String wa = new String("WA");
			if(s.equals(" WA")) {
				if(Problems[p-1] != -1) {
					Problems[p-1]++;
				}	
			} else if (Problems[p-1] != -1) {
				correctAns++;
				penalties += Problems[p-1];
				//if visited set to -1
				Problems[p-1] = -1;
			}
		}
		System.out.println(correctAns + " " + penalties);
	}
}


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

int main () {
  string s;
  cin >> s;
  
  bool a = true;
  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0 && s[i] == 'L') {
      a = false;
    }
    if (i % 2 == 1 && s[i] == 'R') {
      a = false;
    }
  }
  if (a) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//turn on extra precision
//#pragma GCC target("fpmath=387")

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef string str;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
#define fbo find_by_order
#define ook order_of_key
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define watch(x) cout << (#x) << " is : " << (x) << newl

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
vi dirx = {0,0,1,-1};
vi diry = {1,-1,0,0};
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122) return char(x-32);
    if( 65 <= int(x) && int(x) <= 90) return x;
    return -1;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122) return x;
    if( 65 <= int(x) && int(x) <= 90) return char(x+32);
    return -1;
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57) return int(x-'0');
    if(97 <= int(x) && int(x) <= 122) return int(x-96);
    if(65 <= int(x) && int(x) <= 90) return int(x-64);
    return -1;
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1 = {l1,r1};
    pii p2 = {l2,r2};
    if(p1>p2)swap(p1,p2);
    return (p2.fi <= p1.se);
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1%MOD;
    else if(num2==1)return num1%MOD;
    else{
        ll temp = quickpow (num1,num2>>1LL,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2&1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template

int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int x,y; cin >> x >> y;
    for(int i = 0; i <= x; ++i){
        int l = i;
        int r = x - i;
        int leg = l * 2 + r * 4;
        if(leg == y) {cout << "Yes\n"; return 0;}
    }

    cout << "No\n";

    return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            double ans = (double)array[0] / array[1];
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000;

const int MAX = 510000;
const int MOD = 1000000007;
const long long INF = 1LL << 60;

const ll MAXINDx = 1001;
const ll MAXINDy = 1001;


ll dp[MAXINDx][MAXINDy] = {0};

vector<vector<int>> edges;
/*
int rec(int v){
    int res = 0;

    if(dp[v] > -1)return dp[v];

    for(auto nv: edges[v]){
        res = max(res, rec(nv) + 1);
    }
    return dp[v] = res;
}
*/
int main(){
    int H,W;
    char G[MAXINDx][MAXINDy] = {'.'};

    for(int i = 0; i < MAXINDx; i++){
        for(int j = 0; j < MAXINDy; j++){
            dp[i][j] = 0;
        }
    }

    dp[0][0] = 1;

    cin >>H>>W;
    for(int i = 0; i < H;i++){
        for(int j = 0; j < W; j++){
            cin >>G[i][j];
        }
    }

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

    for(int i = 0; i < H;i++){
        for(int j = 0; j < W; j++){
            for(int k = 0; k < 2; k++){
                if(i+dx[k] >= H || j+dy[k] >= W)continue;
                if(G[i+dx[k]][j+dy[k]] == '.'){
                    dp[i+dx[k]][j+dy[k]] += dp[i][j];
                    dp[i+dx[k]][j+dy[k]] = dp[i+dx[k]][j+dy[k]] % MOD;

                }
            }
        }
    }

    cout <<dp[H-1][W-1]<<endl;
    return 0;
}

/*Syakutori
while(cin >>b && b)){
      ll t = 1;
      long long int ansS = 1,ansT=0;
      long long int sum = 0;

      for(ll s = 1;s < 50000000;s++){

        while(t <  50000000 && sum+Rsum[t] < b){
          sum += Rsum[t];
          t++;
        }
        if(b == sum+Rsum[t]){
          if(ansT - ansS < t-s){
            ansS = s;
            ansT = t;
          }
          cout <<ansS<<" "<<ansT-ansS + 1<<endl;
          break;
        }
        if(t == s)++t;
        else sum -= Rsum[s];
        }
    }

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;

bool comp(const pair<int,int> a, const pair<int,int> b) {
    return a.second < b.second;
}

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


*/


Measured memory_bytes: 9088
import java.util.Scanner;
class Main{
public static void main(String[] a){
Scanner s=new Scanner(System.in);long N=s.nextLong();long M=s.nextLong();long X=1;
for(int i=1; i*i<=M; i++){
if(M%i==0 && i*N<=M)X=Math.max(X,i);
if(M%(M/i)==0 && (M/i)*N<=M)X=Math.max(X,(M/i));
}
System.out.println(X);
}
}

Measured memory_bytes: 23252
import numpy as np

c = [list(map(int, input().split())) for i in range(3)]
c = np.array(c)
b = c[0]
a1 = [0] * 3
a2 = c[1] - b
a3 = c[2] - b

if len(set(a2)) == 1 and len(set(a3)) == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 19632
#pow(a,b,mod)
#np.gcd.outer
#s.count, s.replace, s.index
from math import gcd
from functools import reduce
from itertools import product ##for i in z for j in z -> for i,j in product(z,z)   ||  for i,j in product(z,repeat=2)
#slice operation: sum(ans[slice(i*2,k+1,i)]) = sum(ans[i*2:k+1:i])

n,k=map(int,input().split(' '))
 
mod=10**9+7
 
ar=list(range(1,k+1))
ar.reverse()
 
ans=[0]*(k+1)
for i in ar:
	ava=(k-i)//i+1
	ans[i]=pow(ava,n,mod)-sum(ans[i*2:k+1:i])
print(sum(i*x for i,x in enumerate(ans))%mod)


Measured memory_bytes: 71532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	ll n,m,k;
	cin>>k>>n>>m;
	ll ans=0;
	while(k--){
		ll a,b;
		cin>>a>>b;
		ans+=(a/n)*(b/m)>0;
	}
	cout<<ans<<endl;
	return;
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}




Measured memory_bytes: 3636
import sys
#input = sys.stdin.buffer.readline

def main():
    N = int(input())
    S = [list(str(input())) for _ in range(2)]
    dp = [0 for _ in range(N)]
    MOD = 10**9+7
    
    if S[0][0] == S[1][0]:
        dp[0] = 3
        for i in range(1,N):
            if S[0][i-1] != S[0][i]:
                if S[0][i-1] == S[1][i-1]:
                    dp[i] = (dp[i-1]*2)%MOD
                else:
                    if S[0][i] == S[1][i]:
                        dp[i] = dp[i-1]
                    else:
                        dp[i] = (dp[i-1]*3)%MOD
            else:
                dp[i] = dp[i-1]
    else:
        dp[0] = dp[1] = 6
        for i in range(2,N):
            if S[0][i-1] != S[0][i]:
                if S[0][i-1] == S[1][i-1]:
                    dp[i] = (dp[i-1]*2)%MOD
                else:
                    if S[0][i] == S[1][i]:
                        dp[i] = dp[i-1]
                    else:
                        dp[i] = (dp[i-1]*3)%MOD
            else:
                dp[i] = dp[i-1]
                
    print(dp[-1]%MOD)

if __name__ == "__main__":
    main()


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

x = []
y = []
h = []
x_t, y_t, h_t = 0, 0, 0
for i in range(N):
    x_i, y_i, h_i = map(int, input().split())
    x.append(x_i)
    y.append(y_i)
    h.append(h_i)
    if h_i > 0 and h_t == 0:
        x_t = x_i
        y_t = y_i
        h_t = h_i

for i in range(101):
    for j in range(101):
        px = i
        py = j
        ph = h_t + abs(px - x_t) + abs(py - y_t)
        flag = True
        for k in range(N):
            if max(ph - abs(x[k] - px) - abs(y[k] - py), 0) != h[k]:
                flag = False
                break
        if flag:
            print(px, py, ph)
            break
    if flag:
        break

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int n, d, x, a;

	scanf("%d", &n);
	scanf("%d %d", &d, &x);
	for(int i=0; i<n; i++){
		scanf("%d", &a);
		for(int j=0; a*j+1<=d; j++){
			x++;
		}
	}
  	printf("%d\n", x);
	return 0;

}

Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n >> k;
	vector<ll>	aa(n);
	for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));
	sort(aa.begin(),aa.end());
	for(i=0;i<k;i++) {
		ans += aa[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#include "string"
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)


int32_t main() { 
    boost;
	int n,m;
	cin>>n>>m;
	int a[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i];
	vector<int>g[n+1];
	for(int i=0,u,v;i<m;i++){
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}     
	int ans  =0;
	for(int i=1;i<=n;i++){
		bool ok = true;
		for(int j:g[i]){
			if(a[i]<=a[j]){
				ok = false;
				break;
			}
		}
		if(ok)
			ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 10220
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		while(true){
			int n=stdIn.nextInt();
			if(n<1) return;
			for(int i=0;i<9;i++) n-=stdIn.nextInt();
			System.out.println(n);
		}
	}
}

Measured memory_bytes: 12000
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
typedef long long LL;
const int MaxN = 1e6;
using namespace std;
LL a[MaxN + 5] , sum[MaxN + 5];
int n;
int main()
{
	while(~scanf("%d" , &n)){
		for(int i = 1;i <= n;i++){
			scanf("%lld" , &a[i]);
			sum[i] = sum[i - 1] + a[i];
		}
		LL ans = 1LL << 60;
		for(int i = 1;i <= n - 1;i++){
			LL f = sum[i];
			LL e = sum[n] - sum[i];
			ans = min(ans , abs(f - e));
		}
		printf("%lld\n" , ans);
	}
}

Measured memory_bytes: 5760
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int a = Integer.parseInt(scanner.next());
        String s = scanner.next();

        if (a < 3200) {
            s = "red";
        }

        System.out.println(s);

    }
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(int i= (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    int n; cin >> n;
    vector<int> A(26, INF);
    REP(i, n) {
        string S; cin >> S;
        vector<int> tmp(26, 0);
        REP(j, S.length()) {
            tmp[S[j] - 'a']++;
        }
        REP(j, 26) {
            A[j] = min(A[j], tmp[j]);
        }
    }
    string alpha = "abcdefghijklmnopqrstuvwxyz";
    string ans = "";
    REP(i, 26) {
        REP(j, A[i]) {
            ans += alpha[i];
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3588
#include <iostream>

int main() {
    int five=0, seven=0;
    for (int i=0; i<3; ++i) {
        int x;
        std::cin >> x;
        if (x == 5) ++five;
        if (x == 7) ++seven;
    }
    std::cout << ( (five == 2 && seven == 1) ? "YES" : "NO" ) << std::endl;
    return 0;
}

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

using namespace std;

int main(){
  int d, r;
  double y = 0.0, x = 0.0, t = 90.0;
  while( scanf("%d,%d", &d, &r), d){
    y += d * sin( t / 180.0 * M_PI);
    x += d * cos( t / 180.0 * M_PI);
    t -= r;

  }
  printf("%d\n%d\n", (int)x, (int)y);
}

Measured memory_bytes: 1192
import sys
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17

S = input().strip()
n = len(S)
for i in range(n // 4):
    if S[i] != S[n // 2 - i - 1]:
        print("No")
        sys.exit()

for i in range(n // 4):
    if S[i + n // 2 + 1] != S[n // 2 - i + n // 2]:
        print("No")
        sys.exit()
for i in range(n // 2):
    if S[i] != S[n - i - 1]:
        print("No")
        sys.exit()
print("Yes")


Measured memory_bytes: 38384
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    A,B,M = inpm()
    a = inpl()
    b = inpl()
    ans = 10**20
    for _ in range(M):
        w,e,r = inpm()
        ans = min(ans,a[w-1]+b[e-1]-r)
    a.sort()
    ans = min(ans,min(a)+min(b))
    print(ans)
            
if __name__ == "__main__":
    main()

Measured memory_bytes: 66428
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[M];
        for (int i = 0; i < N; i++) {
            int k = sc.nextInt();
            for (int j = 0; j < k; j++) {
                int b = sc.nextInt()-1;
                a[b]++;
            }
        }
        int ans = 0;
        for(int c:a){
            if(c == N) ans++;
        }

        System.out.println(ans);
        sc.close();


    }

}


Measured memory_bytes: 25388
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <vector>
#define LL long long
using namespace std;
int a,b;
int main(){
	//freopen("in.txt","r",stdin);
 	scanf("%d %d",&a,&b);
 	if((a+b)%2){
 		printf("%d",(a+b)/2+1);
	 }else{
	 	printf("%d",(a+b)/2);
	 }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int power(int i,int j);
	
	int x,maxv=1;
	cin>>x;
	
	for(int i=2;i<=int(sqrt(x));++i)
	{
		for(int j=2;j<=10;j++)
		{
			if(power(i,j)<=x && power(i,j)>maxv)
			maxv=power(i,j);
		}
	}
	
	cout<<maxv;
	return 0;
}

int power(int i,int j)
{
	int ans=1;
	
	for(int l=1;l<=j;l++)
	ans*=i;
	
	return ans;
}

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

typedef long long ll;
typedef pair<ll, ll> pll;

const int MN = 100010;

vector<int> pr;
int pchk[MN];

void Sieve() {
    for(int i = 2; i < MN; i++) {
        if(!pchk[i]) {
            pr.push_back(i);
        }
        for(int j = 0; j < pr.size() && i * pr[j] < MN; j++) {
            pchk[ i * pr[j] ] = 1;
            if(i % pr[j] == 0) break;
        }
    }
}

int N;
ll S[100010];
pll C[100010];
map<pll, int> Cnt, Chk;

int main() {
    Sieve();

    scanf("%d", &N);

    for(int i = 0; i < N; i++) {
        scanf("%lld", &S[i]);
    }

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < pr.size() && 1LL * pr[j] * pr[j] * pr[j] <= S[i]; j++) {
            while(S[i] % (1LL * pr[j] * pr[j] * pr[j]) == 0) {
                S[i] /= (1LL * pr[j] * pr[j] * pr[j]);
            }
        }

        if(1) {
            ll n = S[i];
            ll tmp = 1;
            for(int j = 0; j < pr.size() && pr[j] <= 2000; j++) {
                if(n % pr[j] == 0 && n % (1LL * pr[j] * pr[j])) {
                    n /= pr[j];
                    tmp *= pr[j];
                }
            }

            ll t = sqrt(n);
            if(t * t == n) {
                C[i] = pll(tmp, t);
                Cnt[ C[i] ]++;
                continue;
            }
        }
        if(2) {
            ll n = S[i];
            ll tmp = 1;
            for(int j = 0; j < pr.size() && 1LL * pr[j] * pr[j] <= 5000000; j++) {
                if(n % (1LL * pr[j] * pr[j]) == 0) {
                    n /= (1LL * pr[j] * pr[j]);
                    tmp *= 1LL * pr[j] * pr[j];
                }
            }
            C[i] = pll(n, tmp);
            Cnt[ C[i] ]++;
        }
    }

    int ans = Cnt[ pll(1, 1) ]? 1 : 0;
    Chk[ pll(1, 1) ] = 1;
    for(int i = 0; i < N; i++) {
        if(Chk[ C[i] ]) continue;

        ll t1 = C[i].first;
        ll t2 = C[i].second;

        ans += max(Cnt[ C[i] ], Cnt[ pll(t2, t1) ]);

        Chk[ C[i] ] = 1;
        Chk[ pll(t2, t1) ] = 1;
    }

    printf("%d", ans);
}


Measured memory_bytes: 28032
n,k = map(int,input().split())
v = list(map(int,input().split()))
ansl = []
for i in range(min(k+1,n+1)):
    for j in range(i+1):
        v1 = v[0:j]
        v2 = v[n-(i-j):n]    
        v1.extend(v2)
        v1.sort()
        for x in range(k-i):
            if len(v1) != 0 and v1[0] < 0:
                del v1[0]
            else:
                break
        if len(v1) != 0:
            ansl.append(sum(v1))
        else:
            ansl.append(0)
ans = max(ansl)
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};


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

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

	int mink = min(n, k), res = -LINF;

	vector<int> a(n);

	rep(i,n){
		cin >> a[i];
	}

	for(int i = 0; i <= mink; ++i){
		for(int j = 0; j <= mink - i; ++j){
			vector<int> vec;
			for(int l = 0; l < i; ++l){
				vec.emplace_back(a[l]);
			}
			for(int l = 0; l < j; ++l){
				vec.emplace_back(a[n-l-1]);
			}
			sort(all(vec));
			int sum = 0, cnt = k - i - j;
			for(auto&& e : vec){
				if(cnt == 0 || e >= 0){
					sum += e;
				}else{
					--cnt;
				}
			}
			chmax(res, sum);
		}
	}

	cout << res << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  int N,i;
  cin >> N >> i;
  cout << N + 1 - i << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
using Int = long long;
static const Int MOD = 1e9 + 7;
int main() {
    unordered_map<Int, Int> p;
    auto prime = [&p](Int n) {
        for(Int i = 2; i * i <= n; i++) {
            while(n % i == 0) {
                p[i]++;
                n /= i;
            }
        }
        if(n != 1) p[n]++;
    };
    Int N, ans = 1;
    cin >> N;
    for (Int i = 1; i <= N; i++) prime(i);
    for (const auto& t : p) ans = (ans * (t.second + 1)) % MOD;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
using namespace std;
const int N = 1000000;


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

    for (int i = 1; i < 10; ++i) {
        if(n > 111 * (i-1) && n <= 111 * i)print(111*i);
    }
}


Measured memory_bytes: 256
_ = gets.chomp.to_i

cards = gets.split.map(&:to_i)
cards.sort!

sum_a = 0
sum_b = 0
cards.reverse.each_slice(2) do |(a, b)|
  sum_a += a
  sum_b += (b || 0)
end
puts sum_a - sum_b


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n),b(n),c(n);
    for(int i=0;i<n;i++)cin>>a[i];
    map<int,int> m1,m2;
    for(int i=0;i<n;i++){
        m1[a[i]+i]++;
        m2[i-a[i]]++;
    }
    int res=0;
    for(auto it:m1){
        res+=it.second*m2[it.first];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 42176
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  vector<int> A(N);
  for ( int i = 0; i < N; i++ ) cin >> A[i];
  sort(A.begin(),A.end());
  int cnt = 10000000;
  int mon = N;
  int i = 0;
  int j = 1;
  while( cnt ) {
    if ( mon == 1 ) break;
    A[j] -= A[i];
    if ( A[j] <= 0 ) {
      j++;
      mon--;
    } else if (A[j] < A[i]) swap(A[i],A[j]);
    cnt--;
  }
  cout << A[i] << endl;
  return 0;
}


Measured memory_bytes: 640
//
// Created by yamunaku on 2020/01/13.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

ll modpow(ll x, ll a){
    ll ans = 1;
    while(a){
        if(a & 1) ans = ans * x % MOD;
        a >>= 1;
        x = x * x % MOD;
    }
    return ans;
}

ll inv(ll x){
    return modpow(x, MOD - 2);
}

vector<ll> fact, invfact;

void buildFact(int n){
    fact = vector<ll>(n + 1, 1);
    invfact = vector<ll>(n + 1, 1);
    for(int i = 1; i <= n; i++){
        fact[i] = fact[i - 1] * i % MOD;
    }
    invfact[n] = inv(fact[n]);
    for(int i = n - 1; i >= 1; i--){
        invfact[i] = invfact[i + 1] * (i + 1) % MOD;
    }
}

ll bcomb(int n, int k){
    return fact[n] * invfact[k] % MOD * invfact[n - k] % MOD;
}

int main(){
    // CFS;
    int n, k;
    cin >> n >> k;
    vl a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    buildFact(n);
    ll ans = 0;
    rep(i, n){
        if(i >= k - 1) ans = (ans + a[i] * bcomb(i + 1 - 1, k - 1)) % MOD;
        if(i <= n - k) ans = ((ans - a[i] * bcomb(n - i - 1, k - 1)) % MOD + MOD) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;
void swap(int &a, int &b);

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int count = 0;
	for (int i = a; i <= b; ++i)
	{
		if (c%i == 0)
			count++;
	}
	cout << count << endl;

}

void swap(int &a, int &b)
{
	int temp = a;
	a = b;
	b = temp;
	return;
}




Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int p, q, r;
    cin >> p >> q >> r;
    cout << min(p + q, min(q + r, r + p)) << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <stdio.h>

int main(void) {
    int n, d, ans = 1;
    scanf("%d%d", &n, &d);
    int monitor_man         = d + 1;
    int monitor_range_right = monitor_man + d;
    while ( monitor_range_right < n ) {
        ans++;
        monitor_man += (2 * d + 1);
        monitor_range_right = monitor_man + d;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int r, d, xn;
  cin >> r >> d >> xn;
  
  for (int i = 0; i < 10; i++)
  {
    xn = r * xn - d;
    cout << xn << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;
#define fo(i,s,e_ex) for(i=s;i<e_ex;i++)
#define Fo(i,k,n) for(i=k;k<n?i<=n:i>=n;k<n?i+=1:i-=1)
#define endl '\n'
#define MOD 1000000007//998244353
#define pbb push_back
#define mpp make_pair
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define mset(arr,val) memset(arr,val,sizeof(arr))
ll n;
ll arr[105];
int dp[100005];
bool play(ll k){
	if(dp[k]!=-1) return dp[k];
	bool ans=false;
	ll i;
	fo(i,0,n){
		if(k>=arr[i]){
			bool myans=play(k-arr[i]);
			if(myans==false) ans=true;
		}
	}
	return dp[k]=ans;
}
void solve(ll caseno){
	ll i,j,k;
	cin>>n>>k;
	fo(i,0,n) cin>>arr[i];
	mset(dp,-1);
	cout<<(play(k)?"First":"Second")<<endl;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll t=1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		solve(i);
	}
	return 0;
}


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

int main(){
    int n, cnt = 1;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    int mx = p[0];
    for (int i = 1; i < n; i++){
        if (mx >= p[i]){
            cnt++;
        }
        mx = min(mx, p[i]);
    }
    cout << cnt << endl;
}   


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N =1e4 + 5;

int main(){
    int n;
  	scanf("%d",&n);
  	ll a[n];
  	scanf("%lld",&a[0]);
  	int ans = 1;
  	for(int i = 1;i < n;i++){
        scanf("%lld",&a[i]);
        if(a[i] <= a[0]) ans++,a[0]=a[i];
  	}
    printf("%d",ans);
    return 0;
}


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

int main(){

  const int H = 1023;
  int n, m, a;

  while(cin >> n >> m >> a){
    if((n|m|a) == 0) break;

    vector<vector<vector<bool> > > ami(H, vector<vector<bool> >(n, vector<bool>(n, 0)));
    int h, p, q, top=0;
    for(int i=0; i<m; i++){
      cin >> h >> p >> q;
      --p;
      --q;
      ami[h][p][q] = 1;
      top = max(top, h);
    }
    --a;

    for(int i=top; i>0; i--){
      if(a==0){
	if(ami[i][a][a+1]) a += 1;
      }
      else if(a==n-1){
	if(ami[i][a-1][a]) a -= 1;
      }

      else{
	if(ami[i][a-1][a]) a -= 1;
	else if(ami[i][a][a+1]) a+= 1;
      }
    }
    cout << a+1 << endl;
  }


  return 0;
}

Measured memory_bytes: 5332
a,b=map(int,input().split())

if (12.5*a)<=(10*b) and (12.5*(a+1))>(10*b):
  print(int(10*b))
elif a%2==0 and (10*b)<=(12.5*a) and (10*(b+1))>(12.5*a):
  print(int(12.5*a))
elif a%2==1 and (10*b)<=(12.5*a) and (10*(b+1))>((12.5*a)+0.5):
  print(int((12.5*a)+0.5))
else:
  print(-1)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>

using namespace std;

int n;
long long x,y;

int main(){
	scanf("%d%lld",&n,&x);	
	for (int i=1;i<n;++i){
		scanf("%lld",&y);
		x=x/(__gcd(x,y))*y;
	}
	printf("%lld",x);
	return 0;
}

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

int N;
vector<int> V;

int main() {
  cin >> N;
  int v;
  rep(i, N) {
    cin >> v;
    V.push_back(v);
  }
  sort(V.begin(), V.end());
  double ans=0.0;
  ans += V[0] / pow(2, N-1);
  for(int i=0; i<N-1; i++) {
    ans += V[i+1] / pow(2, N-1-i);
  }
  cout << fixed << setprecision(5) << ans << endl;
  return 0;
}



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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (auto&& e : h) cin >> e;
  int ans = 0;
  for (auto&& e : h) {
    if (e >= k) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 768
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]bool)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		m[a] = true
	}
	if len(m) == n {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <memory>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>

int main()
{
    std::ios_base::sync_with_stdio(0);

    std::string word;
    std::cin >> word;

    std::string yes = "Yes", no = "No";
    std::string output = yes;

    int length = word.length();

    for (int i = 1; i <= length; i = i + 2)
    {
        if (word[i - 1] == 'L')
        {
            output = no;
            break;
        }
        if (word[i] == 'R')
        {
            output = no;
            break;
        }
    }

    std::cout << output;

    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

string dec2mcxi(int d) {
	string ret;
	int m = d/1000;
	int c = (d%1000)/100;
	int x = (d%100)/10;
	int i = d%10;
	if(m > 1) {
		ret = ret ~ to!string(m);
	}
	if(m > 0) {
		ret = ret ~ "m";
	}
	if(c > 1) {
		ret = ret ~ to!string(c);
	}
	if(c > 0) { 
		ret = ret ~ "c";
	}
	if(x > 1) {
		ret = ret ~ to!string(x);
	}
	if(x > 0) { 
		ret = ret ~ "x";
	}
	if(i > 1) {
		ret = ret ~ to!string(i);
	}
	if(i > 0) { 
		ret = ret ~ "i";
	}
	return ret;
}

int mcxi2dec(string s) {
	int ret;
	while(!s.empty) {
		int tmp = 1;
		if('2' <= s[0] && s[0] <= '9') {
			tmp = s[0] - '0';
			s = s[1..$];
		}
		switch(s[0]) {
			case 'm':
				ret += tmp * 1000;
				break;
			case 'c':
				ret += tmp * 100;
				break;
			case 'x':
				ret += tmp * 10;
				break;
			case 'i':
				ret += tmp;
				break;
			default:
				break;
		}
		s = s[1..$];
	}
	return ret;
}

void main(){
	auto n = readInt();
	for(int i; i < n; ++i) {
		auto s = readln.strip.split;
		writeln(dec2mcxi(mcxi2dec(s[0]) + mcxi2dec(s[1])));
	}
}

Measured memory_bytes: 2852
#include <stdio.h>

int main(void){
    int r=0, g=0, b=0, sum=0;

       scanf( "%d %d %d",&r,&g,&b );
    
    sum = r * 100 + g * 10 + b;
    
    if( sum % 4 == 0)printf( "YES" );
    
    else printf( "NO" );

  return 0;
}

Measured memory_bytes: 128
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_061_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(5).
    01 N      PIC 9(2).
    01 M      PIC 9(2).

    01 INP2   PIC X(10).

    01 i      PIC 9(18).

    01 len    PIC 9(10).

    01 a      PIC 9(2).
    01 b      PIC 9(2).

    01 town1.
        03 town11 OCCURS 50.
            05 town PIC 9(2) VALUE 0.

    01 ans    PIC X(2).

    01 ZS     PIC Z(2)9.
    01 DUMMY  PIC X(1).

PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO N M.

    PERFORM VARYING i FROM 1 BY 1 UNTIL M < i
        ACCEPT INP2

        UNSTRING INP2
        DELIMITED BY SPACE
        INTO a b

        ADD 1 TO town(a)
        ADD 1 TO town(b)
    END-PERFORM.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
        MOVE town(i) TO ZS

    PERFORM UNANS

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans))

    END-PERFORM.

    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 384
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion


int32_t main() {
    make(string, s);
    cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int A, B, K;
  cin >> A >> B >> K;

  for(int i = A; i <= min(B, A + K - 1); i++){
    cout << i << endl;
  }
  for(int i = max(A + K, B - K + 1); i <= B; i++){
    cout << i << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
        int a,b,c,x,y;

        cin>>a>>b>>c>>x>>y;

        int min_num=min(x,y);

        cout<<min(a*min_num+b*min_num,c*2*min_num)+min(a*(x-min_num)+b*(y-min_num),c*2*max(x-min_num,y-min_num))<<endl;

        return 0;
}


Measured memory_bytes: 3640