akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int K = sc.nextInt();

        int[] A = new int[N];
        int[] C = new int[200000];
        int count = 0;
        for(int i = 0; i < N; i++){
            A[i] = sc.nextInt();
            if(C[A[i]-1] == 0)
                count++;
            C[A[i]-1]++;
        }
        sc.close();

        Arrays.sort(C);
        int ans = 0;
        if(count <= K){
            System.out.println(ans);
        } else {
            for(int i = 200000-count; i < 200000-K; i++){
                ans += C[i];
            }
            System.out.println(ans);
        }
    }
}

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


using namespace std;

typedef long long int ll;

int main()
{
    string s,t;
    cin>>s>>t;
    int i,cnt=0;
    for(i=0;i<s.length();++i){
        if(s[i]!=t[i]){
            cnt++;
        }
    }
    cout<<cnt;
}

Measured memory_bytes: 3920
#include<bits/stdc++.h>
using namespace std;
int a[100];
int main(){
	int n,m,sum=0,x;
	bool b=1;
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>a[i],sum+=a[i];
	x=sum/(4*m);
	sort(a,a+n);
	for(int i=n-1;i>=n-m;i--){
		if(sum%(4*m)==0){
			if(a[i]<x)b=0;
		}
		else if(a[i]<=x)b=0;
	}
	if(b)cout<<"Yes\n";
	else cout<<"No\n";
} 

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fromIntegral . fst . fromJust . BS.readInteger

getInt = readInt <$> BS.getLine

twoList :: [Int]
twoList = [64, 32, 16, 8, 4, 2, 1]

judge :: [Int] -> Int -> Int
judge (x:xs) n | n >= x = x
               | otherwise = judge xs n

main = do
  n <- getInt
  print $ judge twoList n

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];

int main()
{
    ll N;
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    std::multiset<ll> st;
    ll ans = 0;
    REP(i, N)
    {
        int n = N - i - 1;
        ll m = A[n];
        auto it = st.lower_bound(m + 1);
        if (it == st.end())
            ans++;
        else
            st.erase(it);
        st.insert(m);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    double n;
    vector<double> v;
    while( cin >> n ){
        v.push_back( n );
    }
    double a = v[0];
    double b = v[0];
    for(int i=0 ; i < v.size() ; i++ ){
        a = max( a , v[i] );
        b = min( b , v[i] );
    }
    cout << (a-b) << endl;
}

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

using ll=long long;

int main(){

int N;
string S;

cin>>N;
cin>>S;

if(N%2==0){

if(S.substr(0,N/2)==S.substr(N/2,N/2)){
cout << "Yes" << endl;
} else{
cout << "No" << endl;
}

} else {
cout << "No" << endl;
}

}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int genzai = 0;
		double result = 1d/(double)n;
		//System.out.println(result);
		double ans = 0;
		ArrayList<Double> arr=new ArrayList<>();
		if(k==1) {
			ans=1;
		}else {
			for(int i=1;i<=n;i++) {
				genzai = i;
				while(true) {
					if(genzai>k-1) {
						arr.add(result);
						result = 1d/(double)n;;
						break;
					}
					genzai=genzai*2;
					result=result*0.5d;
				}
			}
			for(double d:arr) {
				ans+=d;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 26324
n, m, x = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
b = Array.new(n + 1, 0)
a.each do |i|
  b[i] = 1
end
left = b[0..x].inject(:+)
right = b[x..(n-1)].inject(:+)
puts [left, right].min

Measured memory_bytes: 1788
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    def dfsv(u,pu=-1,d=0):
        dist[u]=d
        for cu in to[u]:
            if cu==pu:continue
            dfsv(cu,u,d+1)

    def dfsu(u,pu=-1,d=0):
        res=dist[u]
        for cu in to[u]:
            if cu==pu:continue
            if dist[cu]>d+1:
                ret=dfsu(cu,u,d+1)
                if ret>res:res=ret
        return res

    to=defaultdict(list)
    n,u,v=MI()
    u,v=u-1,v-1
    for _ in range(n-1):
        a,b=MI1()
        to[a].append(b)
        to[b].append(a)
    dist=[0]*n
    dfsv(v)
    #print(dist)
    print(dfsu(u)-1)




main()

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

#define ll long long 
const int MAXN = 1e5 + 5;
int NUM_NODE = 1;

int n;
ll L;
char str[MAXN];
int depth[MAXN], nex[MAXN][2];
ll ans;

ll getGrundy(ll x){
	if(x <= 0)
		return 0;
	for(int i = 60; i >= 0; --i){
		if((x%(1LL<<i)) == 0)
			return (1LL<<i);
	}
	return 1;
}

int main(){
	memset(nex, -1, sizeof nex);
	scanf("%d%*c%lld%*c", &n, &L);
	for(int i = 0; i < n; ++i){
		scanf("%[^\n]%*c", str);
		int curPos = 0, j = 0;
		while(str[j] != '\0'){
			int ch = str[j]-'0';
			// printf("(%c)", str[j]);
			if(nex[curPos][ch] == -1){
				depth[NUM_NODE] = depth[curPos]+1;
				// printf("Depth[%d] = %d\n", NUM_NODE, depth[NUM_NODE]);
				nex[curPos][ch] = NUM_NODE++;
			}
			curPos = nex[curPos][ch];
			++j;
		}
		// printf("\n");
	}
	for(int i = 0; i < NUM_NODE; ++i){
		if(nex[i][0] == -1){
			ans ^= getGrundy(L-depth[i]);
			// printf("%lld (%lld\n", L-depth[i], getGrundy(L-depth[i]));
		}
		if(nex[i][1] == -1){
			ans ^= getGrundy(L-depth[i]);
			// printf("%lld (%lld\n", L-depth[i], getGrundy(L-depth[i]));
		}
	}
	// printf("%lld\n", ans);
	if(ans)
		printf("Alice\n");
	else
		printf("Bob\n");
}

Measured memory_bytes: 1536
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if((a * b)%2 == 0){
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }
  }
}


Measured memory_bytes: 22740
import numpy as np
a, b= map(str, input().split())
ab = int(a+b)
c = 4
d = -1

while np.power(c, 2) < ab + 1:
     if np.power(c, 2) != ab:
        c  += 1
     else:
        d = np.power(c, 2) 
        break

if d != -1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 12480
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,b,c,d;
  b=1;
  c=0;
  d=0;
  cin >>N;
  vector<int> vec(N);
  
  for(int i=0;i<N; i++){
    cin >> vec.at(i);
  }
  for(int j=0; j<N; j++){
    if(vec.at(b-1)==2){
      d =d+1;
      break;
    }
    else{
      b = vec.at(b-1);
      d =d+1;
    }
  }
  if(vec.at(b-1)==2){
    cout <<d <<endl;
  }
  else{
    cout <<-1 <<endl;
  }
  
  
}

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

int main() {
	long long N, M, ans = 0;
	cin >> N >> M;
	if (N == 1 && M == 1) {
		ans = 1;
	} else if (N == 1) {
		ans = M - 2;
	} else if (M == 1) {
		ans = N - 2;
	} else {
		ans = (N - 2) * (M - 2);
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    long long x,k,d;
    long long ans;
    cin >> x >> k >> d;
    if(x < 0) x = -x;
    if(k < (double)x / d){
        ans = x - k*d;
    }else{
        long long n = x / d + 1;
        /*if(k % x != 0){
            n++;
        }*/
        long long ans1 = x-n*d;
        //cout << ans1 << endl;
        long long ans2 = ans1 + d;
        long long amari = k - n;
        if(amari % 2 == 0) ans = ans1;
        else ans = ans2;

    }
    cout << abs(ans) << endl;
}

Measured memory_bytes: 3628
import sys,math,copy,queue,itertools,bisect
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
MOD = 10**9 + 7
INF = 10**15

N = NI()
A = LI()
ans = 0
if N % 2 == 0:
    for i in range(1,N,2):
        ans += A[i]
    x = ans
    for i in range(0,N,2):
        x = x + A[i] - A[i+1]
        ans = max(ans,x)
else:
    dp = [0 for _ in range(3)]
    for i in range(N):
        ai = A[i]
        if i % 2 == 0:
            dp[1] = max(dp[0],dp[1])
            dp[0] = dp[0] + ai
        if i % 2 == 1:
            dp[2] = max(dp[1],dp[2])
            dp[1] += ai
        if i % 2 == 0 and i > 0:
            dp[2] += ai
    ans = max(dp[1],dp[2])
print (ans)



Measured memory_bytes: 102608
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<queue>
#define Max 100005
using namespace std;




priority_queue<pair<int,int> >q;

int main(){
	
	long long int n;
	scanf("%lld",&n);
	n = ((n*(n+1))/2)-n;
	printf("%lld\n",n);
	return 0;
}

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

int main() {
    int n,x,t,a;
    cin >> n >> x >> t;
    a = n / x;
    if(n%x!=0){
        a++;
    }
    cout << a*t << endl;
    return 0;
}



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

int main(){
    int n;
    cin>>n;
    cout<<n<<":";
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            cout<<" "<<i;
            n/=i;
        }

    }

    if(n!=1)cout<<" "<<n;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1168
n,k = input().split()
list = input().rstrip().split()
dict = {}

for i in range(int(n)):
    if list[i] in dict:
        dict[list[i]] +=1
    else:
        dict[list[i]] = 1
count = 0
if len(dict) > int(k):
    count = int(n)
    max_val = max(dict.values())
    keys_of_max_val = [key for key in dict if dict[key] == max_val]
    if len(keys_of_max_val) > int(k):
        count = int(n)- int(k)*max_val
    else:
        work = 0
        for keys, vals in sorted(dict.items(), key=lambda x: -x[1]):
            count -= vals
            work +=1
            if work == int(k):
                break
print(count)

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

int main(){
    int x, y, temp;
    
    while(true){
        cin >> x >> y;
        
        if(x == 0 && y == 0){
            break;
        } else if(x > y){
            temp = x;
            x = y;
            y = temp;
        }
        
        cout << x << " " << y << endl;
    }
    
    return 0;
}



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

int main(){
    string S;
    string ans = "";
    int w;

    cin >> S;
    cin >> w;

    for(int i=0;i<S.length();i++){
        if(i%w==0){
            ans += S[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/**
*    author:  boutarou
*    created: 11.07.2020 20:55:06
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define fcout cout << fixed << setprecision(15)
using lint = long long;
using P = pair<int, int>;

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

const double PI = 3.1415926535897932;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int l, r, d;
    cin >> l >> r >> d;
    cout << (r / d) - (l - 1) / d << endl;
    
    return 0;
}

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

int main() {
	string s; cin >> s;
	int a, b, c, d;
	a = s[0] - '0';
	b = s[1] - '0';
	c = s[2] - '0';
	d = s[3] - '0';

	if (a + b + c + d == 7) cout << a << '+' << b << '+' << c << '+' << d << '=' << 7 << endl;
	else if (a + b + c - d == 7) cout << a << '+' << b << '+' << c << '-' << d << '=' << 7 << endl;
	else if (a + b - c + d == 7) cout << a << '+' << b << '-' << c << '+' << d << '=' << 7 << endl;
	else if (a + b - c - d == 7) cout << a << '+' << b << '-' << c << '-' << d << '=' << 7 << endl;
	else if (a - b + c + d == 7) cout << a << '-' << b << '+' << c << '+' << d << '=' << 7 << endl;
	else if (a - b + c - d == 7) cout << a << '-' << b << '+' << c << '-' << d << '=' << 7 << endl;
	else if (a - b - c + d == 7) cout << a << '-' << b << '-' << c << '+' << d << '=' << 7 << endl;
	else if (a - b - c - d == 7) cout << a << '-' << b << '-' << c << '-' << d << '=' << 7 << endl;

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


Measured memory_bytes: 256
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=r;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=r;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int n,i,a[524288];
    scanf("%d",&n);
    for(i = 1;i <= n;i++){scanf("%d",&a[i]);}
    if(n%2==0){
        for(i=n;i>=2;i-=2){if(i!=n){printf(" ");}printf("%d",a[i]);}
        for(i=1;i<=n;i+=2){printf(" %d",a[i]);}
    }
    else{
        for(i=n;i>=1;i-=2){if(i!=n){printf(" ");}printf("%d",a[i]);}
        for(i=2;i<=n;i+=2){printf(" %d",a[i]);}
    }
    return 0;
}

Measured memory_bytes: 2816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            long X = long.Parse(line);

            
            for(long i = 0; i < 120; i++)
            {
                for (long j = i+1; j < 120; j++)
                {
                    if (j * j * j * j * j - i * i * i * i * i  == X)
                    {
                        Console.WriteLine(j + " " + i);
                        return;
                    }

                    if (i * i * i * i * i + j * j * j * j * j == X)
                    {
                        Console.WriteLine(i + " -" + j);
                        return;
                    }
                }
            }

        }
    }
}


Measured memory_bytes: 27472
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

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

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

const int Maxn = 100010;

ll a[Maxn], b[Maxn];
P p[Maxn];

int n;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        p[i] = P(a[i] + b[i], i);
    }
    sort(p, p + n, greater<P>());
    ll sum1 = 0, sum2 = 0;
    for (int i = 0; i < n; ++i) {
        int idx = p[i].second;
        if (i % 2 == 0){
            sum1 += a[idx];
        }else{
            sum2 += b[idx];
        }
    }

    cout << sum1 - sum2 << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
namespace imzzy{
	#define endl '\n'
	#define ccf std::cout<<"phi**k"<<endl
	#define rgi register int
	#define ll long long
	class fastin{private:int _ch,_f;
	public:inline fastin&operator>>(char&c){c=getchar();return*this;}
	template<typename _Tp>inline fastin&operator>>(_Tp&_x){
	_x=0;while(!isdigit(_ch))_f|=(_ch==45),_ch=getchar();
	while(isdigit(_ch))_x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
	_f&&(_x=-_x,_f=0);return*this;}fastin(){_ch=_f=0;}
	}fin;class fastout{private:int _num[32],_head;
	public:inline fastout&operator<<(char c){putchar(c);return*this;}
	template<typename _Tp> inline fastout&operator<<(_Tp _x){
	_Tp _k;if(_x==0){putchar('0');return *this;}if(_x<0)putchar('-'),_x=-_x;
	while(_x>0)_k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
	while(_head>0)putchar(_num[_head]),--_head;return*this;}fastout(){_head=0;}
	}fout;inline void P_INIT(){
	#ifdef D_STDOUT_UNBUFFERED
	setbuf(stdout,NULL);
	#endif
}}using namespace imzzy;
// ----------------------------
// #define int ll
// using namespace std;
const int maxn=200004,maxm=2004;
const int mod=1000000007,inf=1201201201;

inline ll powmod(ll a,ll b) {
	ll res=1;
	while(b>0) {
		if(b&1) (res*=a)%=mod;
		(a*=a)%=mod,b>>=1;
	} return res;
}
int f[maxm<<1][maxm<<1],x[maxn],y[maxn];
ll fact[maxm<<2],invfact[maxm<<2];
inline ll C(int n,int m) {return fact[n]*invfact[m]%mod*invfact[n-m]%mod;}
signed main()
{P_INIT();
	// freopen("yy.in","r",stdin);
	// freopen("yy.out","w",stdout);
	int n,ans=0; fin>>n;
	for(rgi i=1;i<=n;++i) fin>>x[i]>>y[i],++f[maxm-x[i]][maxm-y[i]];
	for(rgi i=1;i<maxm<<1;++i) for(rgi j=1;j<maxm<<1;++j)
		(f[i][j]+=f[i-1][j]+f[i][j-1])%=mod;
	for(rgi i=1;i<=n;++i) (ans+=f[maxm+x[i]][maxm+y[i]])%=mod;
	fact[0]=invfact[0]=1;
	for(rgi i=1;i<maxm<<2;++i)
		fact[i]=fact[i-1]*i%mod,invfact[i]=invfact[i-1]*powmod(i,mod-2)%mod;
	for(rgi i=1;i<=n;++i) (ans+=mod-C(2*(x[i]+y[i]),2*x[i]))%=mod;
	fout<<(ans*500000004ll)%mod;
	return 0;
}
// ----------------------------
// by imzzy


Measured memory_bytes: 67992
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		boolean[][] cards=new boolean[4][13];
		int n=scan.nextInt();
		int number;
		String mark;
		for(int i=0;i<n;i++){
			mark=scan.next();
			number=scan.nextInt();
			if(mark.equals("S")){
				cards[0][number-1]=true;
			}else if(mark.equals("H")){
				cards[1][number-1]=true;
			}else if(mark.equals("C")){
				cards[2][number-1]=true;
			}else{
				cards[3][number-1]=true;
			}
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<13;j++){
				if(!cards[i][j]){
					if(i==0){
						System.out.println("S "+(j+1));
					}else if(i==1){
						System.out.println("H "+(j+1));
					}else if(i==2){
						System.out.println("C "+(j+1));
					}else{
						System.out.println("D "+(j+1));
					}
				}
			}
		}
		scan.close();
	}
}

Measured memory_bytes: 18100
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()

int main()
{
  int n, m;
  cin >> n >> m;
  vector<pair<pair<int,int>, int>>city(m);
  vector<pair<int,int>>ans(m);
  int y[n];
  for (int i = 0; i < n; ++i) {
    y[i] = 0;
  }

  for (int i = 0; i < m; ++i) {
    cin >> city[i].first.second >> city[i].first.first;
    city[i].second = i;
  }
  sort(all(city));
  for (int i = 0; i < m; ++i) {
    y[city[i].first.second-1] += 1;
    ans[city[i].second].first = city[i].first.second;
    ans[city[i].second].second = y[city[i].first.second-1];
  }
  for (int i = 0; i < m; ++i) {
    printf("%06d%06d\n", ans[i].first, ans[i].second);
  }

  return 0;
}


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

int main(){
    string S;
    cin >> S;
    
    int cnt = 0;
    for(int i = 0;i < S.size();i++){
        if(S[i] == 'x') cnt++;
    }
    
    if(cnt > 7) cout << "NO" << endl;
    else cout << "YES" << endl;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

ll mod=1000000007;

int main()
{
    ll n,ans=1;
    cin>>n;
    vector<ll> a(n);
    vector<ll> c(n+1);    //color
    for (ll i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    c[0]=3;
    
    for (ll i = 0; i < n; i++)
    {
        ans=(ans*c[a[i]])%mod;
        c[a[i]]--;
        c[a[i]+1]++;

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

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

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



    const int INF = 0x3f3f3f3f;
    const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
    const int NMAX = 1e7 + 5;
    const int MOD = 1e9 + 7;
    #define endl "\n"

    char grid[6][6];
    int H,W,K;

    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        cin>>H>>W>>K;
        int count =0;
        for (int i = 0; i < H; ++i)
        {
            for (int j = 0; j < W; ++j)
            {
                cin>>grid[i][j];
            }
        }
        for(int i=0 ; i<(1<<H) ; ++i){
            for(int j=0 ; j<(1<<W) ; ++j){
                int blackSquare = 0;
                int tempi = i;
                int tempj = j;
                for(int n=0 ; n<H ; n++){
                    for(int m=0 ; m<W ; m++){
                        if(((tempj>>m)&1)==0 && ((tempi>>n)&1)==0 && grid[n][m]=='#')
                            blackSquare++;
                    }
                }
                if(blackSquare == K)
                    count++;
            }
        }
        cout<<count<<endl;
        return 0;
    }


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod 1000000007
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int dp[110][4][4][4];
signed main(){
	int n,ans=0;
	cin>>n;
	dp[0][0][0][0]=1;
	for(int a=1;a<=n;a++){
		f(b,4){
			f(c,4){
				f(d,4){
					f(e,4){
						if((((a>=3&&c==0)||(a>=4&&b==0))&&d==2&&e==1)||((a>=3&&c==0)&&d==1&&e==2)||(c==2&&(d==0||(a>=4&&b==0))&&e==1))continue;
						dp[a][c][d][e]+=dp[a-1][b][c][d];
						dp[a][c][d][e]%=mod;
					}
				}
			}
		}
	}
	f(i,4){
		f(j,4){
			f(k,4){
				ans+=dp[n][i][j][k];
				ans%=mod;
			}
		}
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
using static System.Math;
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var a = new bool[h, w];
        for (int i = 0; i < h; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < w; j++)
                if (line[j] == "1") a[i, j] = true;
        }
        var ans = goDP(a, h, w);
        Console.WriteLine(ans * ans);
    }
    static int goDP(bool[,] a, int h, int w)
    {
        var dp = new int[h, w];
        var ans = 0;
        for (int i = 0; i < h; i++)
            if (!a[i, 0]) { dp[i, 0] = 1; ans = 1; }
        for (int i = 1; i < w; i++)
            if (!a[0, i]) { dp[0, i] = 1; ans = 1; }
        if (h == 1 | w == 1) return ans;
        for (int i = 1; i < h; i++)
            for (int j = 1; j < w; j++)
            {
                if (a[i, j]) dp[i, j] = 0;
                else dp[i, j] = Min(dp[i, j - 1], Min(dp[i - 1, j], dp[i - 1, j - 1])) + 1;
                ans = Max(ans, dp[i, j]);
            }
        return ans;
    }
}




Measured memory_bytes: 45420
import itertools
N,M,X = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
B = list(itertools.product([0,1], repeat=N))
sums = {}
anss = []
for i in range(N):
    for b in B:
        ans = 0
        Point = [0]*M
        count = 0
        for z in b:
            if z == 1:
                for k in range(M):
                    Point[k] += A[count][k+1]
                ans += A[count][0]
                if M == len([Point[n] for n in range(M) if Point[n] >= X]):
                    anss.append(ans)
            count += 1
if len(anss) != 0:
    print(min(anss))
else:
    print(-1)


Measured memory_bytes: 20016
#include <stdio.h>

long max(long a, long b) {
    if (a > b)
        return a;
    else
        return b;
}

long solve_sub(int a[], long pos) {
    static long memo[2 * 100000];
    static int flag[2 * 100000];

    if (flag[pos]) {
        return memo[pos];
    }

    long answer;
    if (pos == 0) {
        answer = a[pos];
    }
    else {
        answer = a[pos] + solve_sub(a, pos - 2);
    }

    memo[pos] = answer;
    flag[pos] = 1;
    return answer;
}

long solve(int a[], long pos) {
    static long memo[2 * 100000];
    static int flag[2 * 100000];

    if (flag[pos]) {
        //fprintf(stderr, "[pos=%ld,return=%ld](memo)\n", pos, memo[pos]);
        return memo[pos];
    }
 
    long answer;
    if (pos == 1) {
        answer = max(a[0], a[1]);
    }
    else if (pos == 2) {
        answer = max(max(a[0], a[1]), a[2]);
    }
    else if (pos % 2 == 1) {
        long tmp1 = a[pos] + solve(a, pos - 2);
        long tmp2 = solve_sub(a, pos - 1);
        answer = max(tmp1, tmp2);
    }
    else {
        long tmp1 = a[pos] + solve(a, pos - 2); //posにある整数を選ぶ場合
        long tmp2 = solve(a, pos - 1);     //posにある整数を選ばない場合
        answer = max(tmp1, tmp2);
    }

    memo[pos] = answer;
    flag[pos] = 1;
    //fprintf(stderr, "[pos=%ld,return=%ld]\n", pos, answer);
    return answer;
}

int main(void) {
    int n;
    int a[2 * 100000];

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

    printf("%ld\n", solve(a, n - 1));
    return 0;
}


Measured memory_bytes: 11840
#include <cstdio>
#include <utility>

using namespace std;

pair<int,int> card[8];
int m;
int dp[8][1005];
int g;

void debug(){
	const int mj = 30;
	for(int i=0;i<=m;i++){
		for(int j=0;j<mj;j++){
			printf("%2d ",dp[i][j]);
		}
		puts("");
	}
}

int main(){
	while(1){
		scanf("%d",&m);
		if(m==0){break;}
		int a,b;
		for(int i=1;i<=m;i++){
			scanf("%d %d",&a,&b);
			card[i] = pair<int,int>(a,b);
		}
		for(int i=0;i<=m;i++){
			for(int j=0;j<=1000;j++){
				if(j == 0){ dp[i][j] = 1; continue;}
				if(i == 0 || j == 0){ dp[i][j] = 0; continue;}
				dp[i][j] = 0;
				dp[i][j] += dp[i-1][j];
				for(int k=1;k<=card[i].second;k++){
					if(j >= card[i].first * k){
						dp[i][j] += dp[i-1][j - card[i].first * k];
					}
				}
			}
		}
		//debug();
		scanf("%d",&g);
		for(int i=0;i<g;i++){
			scanf("%d",&a);
			//printf("dp[%d][%d]=",m,a);
			printf("%d\n",dp[m][a]);
		}
	}
}

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

int mod = 1000000007;

int main()
{
    int N;
    cin >> N;
    while(true)
    {
        bool x = true;
        for (int i = 2; i * i <= N; i++)
        {
            if (N % i == 0)
                x = false;
        }
        if(x)
            cout << N;
        N++;
        if(x)
            break;
    }
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n, 0));
    REP(i, n) REP(j, n) cin >> a[i][j];

    vector<vector<int>> adj = a;
    REP(k, n) REP(i, n) REP(j, n) adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);

    bool flag = true;
    REP(i, n) REP(j, n) if(adj[i][j] != a[i][j]) flag = false;

    if(!flag){
        cout << -1 << endl;
        return 0;
    }

    REP(i, n) REP(j, n) REP(k, n){
        if(i != k && j != k && adj[i][j] == adj[i][k] + adj[k][j]) a[i][j] = 0;
    }
    
    LL ans = 0;
    REP(i, n){
        REP(j, n){
            ans += a[i][j];
        }
    }
    cout << ans/2 << endl;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
inline int ri() {
	int r; cin >> r; return r;
}


int main()
{
	int k, a, b;
	cin >> k >> a >> b;
	bool res = false;
	for(int i = k; i < b * 2; i += k) {
		if(a <= i && i <= b)res = true;
	}
	cout << (res ? "OK" : "NG") << endl;
}

Measured memory_bytes: 3632
n = gets.to_i
a = gets.split.map(&:to_i)

a.map!.with_index {|ai, i| ai - i - 1}

a.sort!
b = a.length % 2 == 0 ? a[(a.length / 2) - 1] : a[a.length / 2]
puts a.map{|x| (x - b).abs}.inject(:+)


Measured memory_bytes: 17636
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

class Point{
public:
  int n,walk;
  Point(int n = 0,int walk = 0):n(n),walk(walk){}
  bool operator < (const Point &s) const{ return walk > s.walk;}
};

int main(){
  int i,j,n;
  while(1){
    Point p[10000];
    cin >> n;
    if(n == 0) break;
    int a,b;
    for(i=0;i<n;i++){
      cin >> p[i].n >> a >> b;
      p[i].walk = a + b;
    }
    sort(p,p+n);
    cout << p[0].n << " " << p[0].walk << endl;

  }
  return 0;
}

Measured memory_bytes: 940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))


int main(){
    int k;  cin >> k;
    string s; cin >> s;
    if(s.size()<=k) cout << s << endl;
    else{
        REP(i, k) cout << s[i];
        cout <<"..." << endl;
    }
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;
typedef long long li;


template <long long mod>
struct modint {
    long long x;

    modint<mod>(): x(0LL) {}
    modint<mod>(const long long _data) {
        if (_data < 0) {
            x = (_data % mod + mod) % mod;
        } else if (_data >= mod) {
            x = _data % mod;
        } else {
            x = _data;
        }
    }

    bool operator==(const modint<mod>& op) const {
        return x == op.x;
    }

    bool operator!=(const modint<mod>& op) const {
        return !((*this) == op);
    }

    modint<mod> operator-() const {
        if (x == 0) {
            return modint(0);
        }
        return modint(mod - x);
    }

    modint<mod> operator+(const modint<mod>& op) const {
        const long long newdata = x + op.x;
        if (newdata >= mod) {
            return modint<mod>(newdata - mod);
        } else {
            return modint<mod>(newdata);
        }
    }

    modint<mod> operator-(const modint<mod>& op) const {
        return *this + (-op);
    }

    modint<mod> operator*(const modint<mod>& op) const {
        return modint<mod>(x * op.x % mod);
    }

    modint<mod> pow(const long long n) const {
        if (n == 0) {
            return modint<mod>(1);
        }
        modint<mod> sq = pow(n / 2);
        if (n & 1) {
            return (*this) * sq * sq;
        } else {
            return sq * sq;
        }
    }

    modint<mod> inverse() const {
        return pow(mod - 2);
    }

    modint<mod> operator/(const modint<mod>& op) const {
        return (*this) * op.inverse();
    }

    friend modint<mod> operator/(const long long dividend, const modint<mod>& divisor) {
        return modint<mod>(dividend) / divisor;
    }

    static modint<mod> factorial(const long long n) {
        static std::vector<modint<mod>> cache(1, 1);

        while (cache.size() <= n) {
            modint<mod> next = cache.back() * cache.size();
            cache.push_back(next);
        }
        return cache[n];
    }

    static modint<mod> combination(const long long n, const long long k) {
        if (k < 0 || n < k) {
            return modint<mod>(0);
        }

        if (n < 1e6) {
            return factorial(n) / (factorial(k) * factorial(n - k));
        }

        modint<mod> ret(1);
        for (int i = 1; i <= k; ++i) {
            ret = ret * modint<mod>(n - i + 1) / modint<mod>(i);
        }
        return ret;
    }
};

typedef modint<1000000007> mint;


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

    li n, h, d;
    cin >> n >> h >> d;

    mint factsum = 0;
    for (int i = 0; i < n; ++i) {
        factsum = factsum + mint::factorial(i + 1);
    }

    vector<mint> dp(h + 1);
    dp[0] = mint::factorial(n);

    mint prevsum = dp[0];
    queue<mint> q;
    q.push(dp[0]);
    for (int i = 1; i <= h; ++i) {
        while (q.size() > d) {
            prevsum = prevsum - q.front();
            q.pop();
        }
        dp[i] = prevsum * factsum;

        q.push(dp[i]);
        prevsum = prevsum + dp[i];
    }

    cout << (dp[h] / factsum).x << endl;

    return 0;
}

Measured memory_bytes: 24168
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define rep(i,n) for (int i=0; i<(n); ++i)

using namespace std;
using ll = long long;

map<string,int>m;

int main (){   
    int N;
    
    cin >> N;
    vector<string> S(N);
    

    for (int i=0;i<N;i++){
        cin >> S[i];
        m[S[i]]++;
    }

    int max = 0;
    for(const auto& x : m){
        
        if(x.second > max){
            max=x.second;
        }

    }

    for (auto it = m.begin(); it != m.end(); it++) {
        if(it->second == max){
            cout << it->first << endl;
        }
    }
  
}

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

    
    
  }
  
}



Measured memory_bytes: 3108
using System;
class Program
{
	static void Main(string[] args)
	{
        int k = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
        if(s.Length <= k) Console.WriteLine(s);
        else {
            Console.WriteLine(s.Substring(0, k)+"...");
        }

	}
}

Measured memory_bytes: 17660
S = input()
W = S.split()
ws = {}
for w in W:
    if not w in ws:
        ws[w] = [1, len(w)]
    else:
        ws[w][0] += 1
print(max(ws.items(), key = lambda x: x[1][0])[0], max(ws.items(), key = lambda x: x[1][1])[0])

Measured memory_bytes: 7404
s = int(input())
arr = []

arr.append(s)

while s > 4:
    if s % 2 == 0:
        s = s // 2
        arr.append(s)
    else:
        s = 3 * s + 1
        arr.append(s)

if s == 3:
    print(9)
else:
    print(len(arr) + 3)

Measured memory_bytes: 3060
function Main(input){
  input = input.split(' ');
  var a = input[0];
  var b = input[1];
  if(a * b % 2 === 0){
    console.log('Even');
  }else{
    console.log('Odd');
  }
}
  
 Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29516
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	int cur = 0;
	vi A(N,0);
	FOR(i, 1, N) {
		if (S[i - 1] == 'A' && S[i] == 'C') {
			cur++;
		}
		A[i] = cur;
	}
	REP(i, Q) {
		int l, r;
		cin >> l >> r;
		l--; r--;
		int ret = A[r];
		ret -= A[l];
		cout << ret << endl;
	}
	return 0;
}


Measured memory_bytes: 1488
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i = s; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using field = vector<vector<int>>;

int main() {
  int n;
  cin >> n;
  field G(n);
  vector<P> input(n-1);
  rep(i,0,n-1) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
    input[i] = P(a,b);
  }
  map<P,int> ans;
  vector<bool> seen(n,false);
  queue<int> q;
  vector<int> c(n,0);
  q.push(0);
  int md = 0;
  while(!q.empty()) {
    int v = q.front(); q.pop();
    seen[v] = true;
    int cnt = 1;
    for (auto nv : G[v]) {
      if (seen[nv]) continue;
      if (cnt == c[v]) cnt++;
      c[nv] = ans[P(v,nv)] = ans[P(nv,v)] = cnt++;
      md = max(md,cnt-1);
      q.push(nv);
    }
  }
  cout << md << endl;
  for (auto p : input) {
    cout << ans[p] << endl;
  }
  return 0;
}


Measured memory_bytes: 22536
#include<iostream>
using namespace std;
int main()
{
  long long n;
  while(cin>>n&&n){
    int a=0;
    long long b=1;
    long long s=0;
    bool negative=n<0;
    if(negative)n=-n;
    while(n>0){
      int t=n%10;
      //printf("n = %lld\n" , n);
      if(negative){
	if(!(a&1)&&t>0){
	  n+=10;
	  s+=b*(10-t);
	}else{
	  s+=b*t;
	}
      }else{
	if(a&1&&t>0){
	  n+=10;
	  s+=b*(10-t);
	}else{
	  s+=b*t;
	}
      }
      n/=10;
      b*=10;
      a++;
    }
    printf("%lld\n",s);
  }
  return 0;
}

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

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int N,T;

int main(){
    INIT;
    cin >> N >> T;
    int ans = 1001;
    REP(i,N) {
        int c,t; cin >> c; cin >> t;
        if(t <= T && c < ans) ans = c;
    }
    if(ans == 1001) cout << "TLE" << "\n";
    else cout << ans << "\n";
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
i = 0
ans = 1
if 0 in a:
    print(0)
else:
    while ans<10**18 and i < len(a):
        ans*=a[i]
        i+=1
    if ans<=10**18:
        print(ans)
    else:
        print(-1)

Measured memory_bytes: 84624
import math
from collections import deque
from collections import defaultdict

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

n = readInt()
a = readInts()

ans=0

def inodd():
	global a
	for i in range(n):
		if a[i]%2==1:
			return 1
	return

while 1:
	if inodd():
		break
	ans+=1
	for i in range(n):
		a[i]=a[i]//2

print(ans)

Measured memory_bytes: 3444
hoge = input()
ss = list(map(int,input().split()))
s = set(ss)
ninobaisu = {i * 2 for i in range(501)}
sannnobaisu = {i * 3 for i in range(334)}
gonobaisu = {i * 5 for i in range(201)}
intersection = s & ninobaisu
a = intersection - sannnobaisu
b = a - gonobaisu
if len(b) == 0:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3064
A, B, Q = map(int, input().split())
inf = 10 ** 11
S = [-inf] + [int(input()) for i in range(A)] + [inf]
T = [-inf] + [int(input()) for i in range(B)] + [inf]
X = [int(input()) for i in range(Q)]
import bisect

for q in range(Q):
    x = X[q]
    s1 = bisect.bisect_right(S, x)
    s2 = s1 - 1
    t1 = bisect.bisect_right(T, x)
    t2 = t1 - 1
    s1, s2 = S[s1], S[s2]
    t1, t2 = T[t1], T[t2]
    dis1 = abs(x - s1) + abs(s1 - t1)
    dis2 = abs(x - s2) + abs(s2 - t2)
    dis3 = abs(x - t1) + abs(t1 - s1)
    dis4 = abs(x - t2) + abs(t2 - s2)
    dis5 = abs(x - s1) + abs(s1 - t2)
    dis6 = abs(x - s2) + abs(s2 - t1)
    dis7 = abs(x - t1) + abs(t1 - s2)
    dis8 = abs(x - t2) + abs(t2 - s1)
    dis = min(dis1, dis2, dis3, dis4, dis5, dis6, dis7, dis8)
    print(dis)

Measured memory_bytes: 16140
N = gets.chomp.to_i
A = gets.chomp.split(" ").map(&:to_i)

if A.select{|n| n % 2 == 0}.all?{|n| n % 3 == 0 || n % 5 == 0} then
  puts "APPROVED"
else
  puts "DENIED"
end

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

#define ll long long
#define ld long double
#define pb push_back
#define pr pair<ll, ll>
#define vct vector<ll>
#define vpt vector<pr>
#define st set<ll>
#define pq priority_queue<ll>
#define mat vector<vector<ll> >
#define all(x) x.begin(),x.end()
#define F(i, n) for(i = 0; i < (1LL*n); i++)
#define Fr(i, n) for(i = n - 1; i >= 0; i--)

struct custom_hash{
    static uint64_t splitmix64(uint64_t x){
        x += 0x9e3779b97f4a7c15;x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<long long, long long, custom_hash>

void prv(vct v){for (ll i=0;i<v.size();i++)cout<<v[i]<<" ";cout << "\n";}
void prn(ll n){cout<<n<<"\n";}
void prs(string n){cout<<n<<"\n";}
void deb(string s, ll n){cout<<s<<" : "<<n<<"\n";}
void prmt(mat m){for(ll i=0;i<(1LL*m.size());i++)prv(m[i]);}

mat getRzMat(mat mt, ll m,ll n, ll ini=0){mt.assign(m,vector<ll>(n,ini));return mt;}

ll poww(ll x, ll y, ll m){
    ll res = 1;
    while (y){
        if (y%2 == 0){x = (x * x) % m;y = y / 2;}
        else{res = (res * x) % m;y--;}
    }
    return res;
}

vct divsors(ll n){
    vct ans;//ans.push_back(1);
    for(ll i=1;i<=sqrt(n);i++){if(n%i==0){ans.push_back(i);if(i!=(n/i))ans.push_back(n/i);}}
    sort(ans.begin(),ans.end());
    return ans;
}
vct sieve(ll n){
    vct ans(n+1,-1);
    for(ll i=2;i<=n;i++){
        if(ans[i]==-1){
            for(ll j=i;j<=n;j+=i)if(ans[j]==-1)ans[j]=i;
        }
    }
    return ans;
}
mat mt;
ll n, k, m, l, r, x, y, z, ans=0;
ll t, t1, t2;
ll q;
ll i, j;
ll a, b, c, d, w;
ll mod = 1000000007;
ll cas=0;

void solve(){
    cin>>n>>x>>t1;
    ans=(n+(x-1))/x;
    prn(ans*t1);
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    ll t = 1;
    // cin >> t;
    cas=1;
    while (t--){
        solve();
        cas++;
    }
    return 0;
}



Measured memory_bytes: 3632