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

const int ERA_PRE_MEIJI = -1;
const int ERA_MEIJI = 0;
const int ERA_TAISHO = 1;
const int ERA_SHOWA = 2;
const int ERA_HEISEI = 3;

const int ERA_BEGIN_YEAR[] = {1868, 1912, 1926, 1989}; 
const int ERA_BEGIN_MONTH[] = {9, 7, 12, 1};
const int ERA_BEGIN_DATE[] = {8, 30, 25, 8};

int compare_date(int y1, int m1, int d1, int y2, int m2, int d2);
int era_of_date(int year, int month, int date);
void print_date(int era, int year, int month, int date);

int main()
{
    int year, month, day;
    while (scanf("%d%d%d", &year, &month, &day) != EOF) {
        int era = era_of_date(year, month, day);
        print_date(era, year, month, day);
    }

    return 0;
}


// y1/m1/d1 と y2/m2/d2 を比較し、前者が早ければ負、後者が早ければ正、同じなら0を返す
int compare_date(int y1, int m1, int d1, int y2, int m2, int d2)
{
    if (y1 < y2) {
        return -1;
    } else if (y1 > y2) {
        return 1;
    }

    //y1 == y2
    if (m1 < m2) {
        return -1;
    } else if (m1 > m2) {
        return 1;
    }

    //y1 == y2, m1 == m2
    if (d1 < d2) {
        return -1;
    } else if (d1 > d2) {
        return 1;
    }

    //same date
    return 0;
}

int era_of_date(int year, int month, int date)
{
    int era = -1;
    for (; era < ERA_HEISEI; era++) {
        // 次の元号の開始日と比較する
        int compare_result = compare_date(
                year, month, date,
                ERA_BEGIN_YEAR[era + 1], ERA_BEGIN_MONTH[era + 1], ERA_BEGIN_DATE[era + 1]
                );

        if (compare_result < 0) {
            break;
        }
    }

    return era;
}

void print_date(int era, int year, int month, int date)
{
    //まずは元号を出力する
    bool pre_meiji = false;
    if (era == ERA_MEIJI) {
        printf("meiji");
    } else if (era == ERA_TAISHO) {
        printf("taisho");
    } else if (era == ERA_SHOWA) {
        printf("showa");
    } else if (era == ERA_HEISEI) {
        printf("heisei");
    } else {
        printf("pre-meiji");
        pre_meiji = true;
    }

    //明治以降なら日付も出力する
    if (!pre_meiji) { 
        printf(" %d %d %d", year - ERA_BEGIN_YEAR[era] + 1, month, date);
    }

    //最後に改行しておしまい
    printf("\n");
}

Measured memory_bytes: 1028
#include <stdio.h>
 
int main()
{
    int h,w,i,j,tmp;
    static char a[102][102];
 
    for(i=0;i<102;i++){
        for(j=0;j<102;j++){
            a[i][j]='0';
        }
    }
 
    scanf("%d",&h);
    scanf("%d",&w);
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            scanf(" %c",&a[i][j]);
        }
    }
 
    tmp=0;
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if('.'==a[i][j]){
                tmp++;
            }
        }
        if(tmp==w){
            a[i][w+1]='1';
        }
        tmp=0;
    }
 
    tmp=0;
    for(i=0;i<w;i++){
        for(j=0;j<h;j++){
            if('.'==a[j][i]){
                tmp++;
            }
        }
        if(tmp==h){
            a[h+1][i]='1';
        }
        tmp=0;
    }
 
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if((a[i][w+1]=='0')&&(a[h+1][j]=='0')){
                printf("%c",a[i][j]);
            }
        }
        if((a[i][w+1]=='0')&&(a[h+1][j]=='0'))
            printf("\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];

int main(){
    string s;
    int n=0;
    cin>>n>>s;
    rep(i,s.size()){
        for(int j=0;j<n;j++)
        s.at(i)++;
        if(s.at(i)>'Z')
            s.at(i)='A'+s.at(i)-'Z'-1;
        cout<<s.at(i);
    }
    cout<<endl;
    return 0;
}




Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace volume05
{
    class Program0516
    {
        static void Main(string[] args)
        {
            while (true)
            {

                var inputs = Console.ReadLine().Split(' ');
                var n = int.Parse(inputs[0]);
                var k = int.Parse(inputs[1]);

                if (n == 0 && k == 0) break;

                var a = new int[n];
                var s = new int[n + 1];

                for (var i = 0; i < n; i++)
                {
                    a[i] = int.Parse(Console.ReadLine());
                }

                // 累積和
                for (var i = 1; i < n + 1; i++)
                {
                    s[i] = s[i - 1] + a[i - 1];
                }

                var max = 0;
                for (var i = k; i < n + 1; i++)
                {
                    max = Math.Max(max, s[i] - s[i - k]);
                }

                Console.WriteLine(max);
            }
        }
    }
}



Measured memory_bytes: 18228
#!/usr/bin/env ruby

require 'pp'
attrs = Array.new
while line = $stdin.gets
  attrs << line.chomp.split
end

N = attrs[0][0].to_i
A = attrs[1].map{|a| a.to_i}
B = Array.new(N, 0)
A.each do |a|
  B[a-1] += 1
end
B.each do |b|
  puts b
end

Measured memory_bytes: 35848
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	char ch;
	bool erased;
};

bool number[10],alphabet[26];

int main(){

	Info info[101],tmp[101];
	for(int i = 0; i < 101; i++)info[i].erased = true;

	char buf[101];
	scanf("%s",buf);

	int length;
	for(length = 0; buf[length] != '\0'; length++){
		info[length].ch = buf[length];
		info[length].erased = false;
	}

	int tmp_len;
	bool NUM_FLG,ALPHABET_FLG;
	int  num_left,num_right,alphabet_left,alphabet_right;
	int index,num_compress = 0;

	while(true){

		for(int i = 0; i < 10; i++)number[i] = false;
		for(int i = 0; i < 26; i++)alphabet[i] = false;

		for(int i = 0; i < length; i++){
			if(info[i].ch >= '0' && info[i].ch <= '9'){
				number[info[i].ch-'0'] = true;
			}else{
				alphabet[info[i].ch-'a'] = true;
			}
		}

		NUM_FLG = false;
		ALPHABET_FLG = false;

		for(int i = 0; i <= 6; i++){
			if(number[i] == false)continue;

			tmp_len = 1;
			num_left = i;
			for(int k = i; k+1 <= 9 && number[k+1] == true; k++,tmp_len++,num_right = k);

			if(tmp_len >= 4){
				NUM_FLG = true;
				break;
			}
		}

		if(NUM_FLG){
			num_compress++;
			for(int i = num_left; i <= num_right; i++){
				for(int k = 0; k < length; k++){
					if(info[k].ch == '0'+i){
						info[k].erased = true;
						break;
					}
				}
			}
		}

		for(int i = 0; i <= 22; i++){
			if(alphabet[i] == false)continue;

			tmp_len = 1;
			alphabet_left = i;
			for(int k = i; k+1 <= 25 && alphabet[k+1] == true; k++,tmp_len++,alphabet_right = k);

			if(tmp_len >= 4){
				ALPHABET_FLG = true;
				break;
			}
		}

		if(ALPHABET_FLG){
			num_compress++;
			for(int i = alphabet_left; i <= alphabet_right; i++){
				for(int k = 0; k < length; k++){
					if(info[k].ch == 'a'+i){
						info[k].erased = true;
						break;
					}
				}
			}
		}

		if(NUM_FLG == false && ALPHABET_FLG == false)break;

		index = 0;
		for(int i = 0; i < length; i++){
			if(info[i].erased == false){
				tmp[index].ch = info[i].ch;
				index++;
			}
		}

		for(int i = 0; i < index; i++){
			info[i].ch = tmp[i].ch;
			info[i].erased = false;
		}
		length = index;
	}

	printf("%d\n",length+3*num_compress);

	return 0;
}

Measured memory_bytes: 3208
#include <stdio.h>
#include <stdlib.h>
int n,i,j,u,k,tmp;
int list[100][100]={};
int lengthlist[100];

void search(int y,int length){
	int ii;
	length++;
	lengthlist[y]=length;


	for(ii=0;ii<n;ii++){
		if(list[y][ii]==1){
			if(lengthlist[ii]<=length&&lengthlist[ii]>=0){
				continue;
			}
			search(ii,length);
		}
	}
}

int main(void) {


	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&u);
		scanf("%d",&k);
		for(j=0;j<k;j++){
			scanf("%d",&tmp);
			list[u-1][tmp-1]=1;
		}
	}
	for(i=0;i<n;i++){
	lengthlist[i]=-1;
	}
	search(0,-1);



	for(j=0;j<n;j++){
		printf("%d %d\n",j+1,lengthlist[j]);
	}

	return 0;
}

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

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

int main(){
    int N,even;
    int monster[110000] = {0};
    cin >> N;
    for(int i=0;i<N;++i) cin >> monster[i];
    
    for(int i=0;i<N-1;++i){
        monster[i+1] = gcd(monster[i],monster[i+1]);
    }

    cout << monster[N-1] << endl;

    return 0;

}

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<string.h>
#include<algorithm>
using namespace std;

int n;
int a[100011];
long long ans;

int main()
{
    int i,j,k;
    
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    
    ans=0;
    int up=0;
    for(i=1;i<=n;i++)
    {
        long long lowp=up+1;
        long long tmp=(a[i]-1ll)/lowp;
        //cout<<tmp<<' '<<lowp<<"   *&^%$"<<endl;
        ans+=tmp;
        if(tmp==0)
        {
            up=max(up,a[i]);
        }
        else
        {
            up=max(up,1);
        }
        
    }
    
    cout<<ans<<endl;
    

    return 0;
}


Measured memory_bytes: 640
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()
X = input()

def popcount(n):
	if n == 0:
		return 0
	else:
		cnt = 0
		while 0 < n:
			cnt += 1
			p = "{:b}".format(n).count("1")
			n %= p
		return cnt

n = X.count("1")

n1 = n-1
n2 = n+1

q_1 = [0]*N
q_2 = [0]*N
for i in range(N):
	if n1 != 0:
		q_1[i] = pow(2, i, n1)
	if n2 != 0:
		q_2[i] = pow(2, i, n2)

mod_sum_1 = 0
mod_sum_2 = 0

for i in range(N):
	if X[-i-1] == "1":
		mod_sum_1 += q_1[i]
		mod_sum_2 += q_2[i]

q_1 = q_1[::-1]
q_2 = q_2[::-1]


if n1 == 0:
	for i in range(N):
		if X[i] == "1":
			print(0)
		else:
			m = n2
			mod_sum = mod_sum_2 + q_2[i]
			print(popcount(mod_sum%m)+1)
else:
	for i in range(N):
		if X[i] == "1":
			m = n1
			mod_sum = mod_sum_1 - q_1[i]
		else:
			m = n2
			mod_sum = mod_sum_2 + q_2[i]

		print(popcount(mod_sum%m)+1)








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

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI >     VVI;
typedef long long int     LL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n        //index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n     //index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)    //Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int n,k;
int arr[105];
int state[100009];
int main() {
    scanf("%d %d",&n,&k);
    rep(i,0,n)
        scanf("%d",arr+i);
    rep(i,1,k+1)
    {
        rep(j,0,n)
        {
            if((i-arr[j]>=0) && (state[i-arr[j]] == 0))
            {
                state[i]=1;
                break;
            }
        }
    }
    if(state[k])
        printf("First");
    else
        printf("Second");
    return 0;
}

Measured memory_bytes: 640
from collections import defaultdict
from itertools import accumulate
n, k = map(int, input().split())
A = list(map(int, input().split()))
Acum = [0]
Acum.extend(accumulate(A))
cnt = defaultdict(int)
for i in range(n):
    for j in range(i+1, n+1):
        beauty = Acum[j]-Acum[i]
        cnt[beauty] += 1

x = 0
for t in reversed(range(41)):
    y = 1 << t
    cnt_k = 0
    for beauty, c in cnt.items():
        if (x+y) & beauty == (x+y):
            cnt_k += c
    if k <= cnt_k:
        x += y

print(x)


Measured memory_bytes: 90596
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

vector<LL> fact, finv, inv;

void init_nCk(int N) {
  fact.resize(N + 1);
  finv.resize(N + 1);
  inv.resize(N + 1);
  fact[0] = fact[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i <= N; i++) {
    fact[i] = fact[i - 1] * i % kMod;
    inv[i] = kMod - inv[kMod % i] * (kMod / i) % kMod;
    finv[i] = finv[i - 1] * inv[i] % kMod;
  }
}

LL nCk(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fact[n] * (finv[k] * finv[n - k] % kMod) % kMod;
}

int main() {
  LL X, Y; cin >> X >> Y;
  LL m = X + Y, n = X - Y;
  if (m % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  m /= 3;

  LL a = (m + n) / 2;
  LL b = (m - n) / 2;

  init_nCk(a + b);
  cout << nCk(a + b, a) << endl;
}


Measured memory_bytes: 18820
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,a,b;
    cin>>n>>a>>b;
    if (n*a>b){
        cout<<b;
    }
    if (n*a<b){
        cout<<n*a;
    }
    if (n*a==b){
        cout<<b;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int k = sc.nextInt();
        for (int i = 0; i < s.length; i++) {
            if(s[i] == 'a') continue;
            int x = (int)'z' + 1 - (int)s[i];
            if(k < x) continue;
            else {
                s[i] = 'a';
                k -= x;
            }
        }
        if(0 < k){
            int x = (int)'z' + 1 - (int)s[s.length-1];
            if(k < x){
                s[s.length-1] = (char)((int)s[s.length-1] + k);
            }else{
                k -= x; k %= 26;
                s[s.length-1] = (char)((int)'a' + k);
            }
        }
        for (int i = 0; i < s.length; i++) {
            System.out.print(s[i]);
        };
        System.out.println();
        sc.close();

    }

}


Measured memory_bytes: 35404
#include<set>
#include<map>
#include<ctime>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>    
using namespace std;
#define LL long long
LL read(){
    LL f=1,x=0;char s=getchar();   
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}  
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    return x*f;
}
#define INF 0x3f3f3f3f
#define MAXN 100
int main(){
	LL n=read(),k=read(),ans=k;
	for(int i=2;i<=n;i++)
		ans*=(k-1);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = Integer.parseInt(sc.next());
		int h = S / 3600;
		int m = (S%3600)/60;
		int s = (S%3600)%60;
		System.out.println(h+":"+m+":"+s);

	}

}

Measured memory_bytes: 26108
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))

s=abs(a-(t-h[0]*0.006))
x=1

for i in range(n):
  z=t-h[i]*0.006
  if s > abs(a-z):
    s=abs(a-z)
    x=i+1
   
print(x)

Measured memory_bytes: 9120
# -*- coding: utf-8 -*-

n=int(input())
t,a=map(int,input().split())
h=list(map(float,input().split()))

min_=999999
ans=0
for i in range(n):
    diff=abs(t-h[i]*0.006-a)
    if diff<min_:
        ans=i+1
        min_=diff
print(ans)


Measured memory_bytes: 3060
n, k = (int(i) for i in input().split())  
v = [int(i) for i in input().split()] 

r = min(n, k)

#kati(a,b) = 操作Aをa回やって得た宝石の価値 + Bをb回やって得た宝石の価値 - 持ってる宝石の小さい順にs個の価値

def kati(a, b):
  if a == 0 and b == 0:
    return 0
  else:
    ans = 0
    #左から取る
    l = v[:a]
    ans += sum(l)
    #右から取る
    r = v[::-1][:b]
    ans += sum(r)
    have = l + r
  #  print(have)
    #s:捨てれる個数
    s = k - (a + b)
    #持ってる宝石の中で負のやつ
    have = [i for i in have if i < 0]
    #ソート
    have.sort()
    #持ってる宝石の小さい方からsこの合計を引く

    if len(have) <= s:
      ans -= sum(have)
    else:
      ans -= sum(have[:s])
    return ans

# a + b <= r のもとで
# max(kati(a,b))を求める
tmp = []
for a in range(r+1):
  for b in range(r-a+1):
    x = kati(a, b)
 #   print(a,b,x)
    tmp.append(x)

print(max(tmp))
  

Measured memory_bytes: 41584
N = int(input())
ss = []
for i in range(N):
    ss.append(input())
M = int(input())
ts = []
for i in range(M):
    ts.append(input())
ans = 0
for s in ss:
    tmp = ss.count(s) - ts.count(s)
    if tmp > ans:
        ans = tmp
print(ans)

Measured memory_bytes: 3064
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

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

def main():
    n,m = LI()
    d = collections.defaultdict(set)
    for _ in range(m):
        a,b = LI()
        d[a].add(b)
        d[b].add(a)

    r = [1, list(d[1])[0]]
    v = collections.defaultdict(bool)
    for c in r:
        v[c] = True

    while True:
        t = r[-1]
        f = True
        for c in d[t]:
            if v[c]:
                continue
            r.append(c)
            v[c] = True
            f = False
            break
        if f:
            break
    r = r[::-1]

    while True:
        t = r[-1]
        f = True
        for c in d[t]:
            if v[c]:
                continue
            r.append(c)
            v[c] = True
            f = False
            break
        if f:
            break

    return '{}\n{}'.format(len(r), ' '.join(map(str, r)))


print(main())


Measured memory_bytes: 51012
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e5+10;
const int MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];
bool dp[MAX];
int main() 
{ 
	//ios_base::sync_with_stdio(false);
  //  cin.tie(NULL);	
//	#ifndef ONLINE_JUDGE
	//freopen("inp.txt" ,"r", stdin );
//	freopen("out.txt", "w", stdout);
//	#endif
	int n , k;
	cin>>n>>k;
	int arr[n+1];
	for(int i=1;i<=n;i++)
		cin>>arr[i];
	for(int stones=0;stones<=k;stones++){
		for(int i=1;i<=n;i++){
			if(stones-arr[i]>=0&&!dp[stones-arr[i]])dp[stones]=true;
		}
	}
	if(dp[k])
		cout<<"First";
	else
		cout<<"Second";
	
	
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 200005
#define MOD 1000000007
using namespace std;
using LL = long long;
LL pw(LL x,LL y) {
    LL res=1, tmp=x;
    while (y) {
        if (y&1) res = res*tmp%MOD;
        tmp = tmp*tmp%MOD;
        y /= 2;
    }
    return res;
}
LL fact[M];
LL comb(LL x,LL y) {
    return fact[x] * pw(fact[y], MOD-2) % MOD * pw(fact[x-y], MOD-2) % MOD;
}
int main()
{
    fact[0] = 1;
    REP(i,1,M-1) fact[i] = fact[i-1] * i % MOD;


    int n,a,b,c;
    while (~scanf("%d %d %d %d", &n,&a,&b,&c)) {
        LL ans = 0;

        REP(i,n,2*n-1) {
            int x = n-1;
            int y = i-1-x;
            LL suc = a * pw(a+b, MOD-2) % MOD;
            LL fail = b * pw(a+b, MOD-2) % MOD;
            LL prob = comb(x+y, x) * pw(suc, x+1) % MOD * pw(fail, y) % MOD;
            ans += prob*i;
            ans %= MOD;

            suc = b * pw(a+b, MOD-2) % MOD;
            fail = a * pw(a+b, MOD-2) % MOD;
            prob = comb(x+y, x) * pw(suc, x+1) % MOD * pw(fail, y) % MOD;
            ans += prob*i;
            ans %= MOD;
        }

        ans = ans * 100 % MOD * pw(100-c, MOD-2) % MOD;
        printf("%lld\n", ans);
    }
    return 0;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	ll n, a, b;
	cin >> n >> a >> b;

	vector<int> h;
	ll ma = 0;
	for(int i=0; i<n; i++){
		ll t;
		cin >> t;
		h.pb(t);
		ma = max(ma, t);
	}

	int l = 0;
	int r = ma/b+1;
	int m;
	while(r-l > 1){
		m = (l + r)/2;
		ll cnt = 0;
		for(int j=0; j<n; j++){
			ll h2 = h[j] - m*b;
			if(h2 > 0){
				cnt += (h2 + (a-b-1)) / (a - b);
			}
		}
		if(cnt > m){
			l = m;
		}else if(cnt <= m){
			r = m;
		}
	}
	cout << r << endl;

	return 0;
}


Measured memory_bytes: 892
from operator import itemgetter
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    sq = int(N**(1/2))
    
    def keta(x):
        k = 0
        while x > 0:
            x //= 10
            k += 1
        return k
        
    for i in range(sq)[::-1]:
        i += 1
        if N%i == 0:
            print(keta(N//i))
            exit()
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
		public static void main(String[] args) {
			// ??\???
			int a, b, c, temp;
			Scanner sc = new Scanner(System.in);
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
			
			// ??????
			if (a > b) { temp = a; a = b; b = temp;}
			if (b > c) { temp = b; b = c; c = temp;}
			if (a > b) { temp = a; a = b; b = temp;}
			// ??????
			
			System.out.println(a + " " + b + " " + c);
	}

}

Measured memory_bytes: 26112
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n,k,q;
cin>>n>>k>>q;
     vector<int> p(n,k-q);
  
  for (int i = 0; i < q; i++) {
 int a;
    cin >>a;
    a--;
    p[a]++;
}
  for (int i = 0; i < n; i++) {
 if(p[i]<=0){
   cout<<"No"<<endl;
 }
    else{
      cout<<"Yes"<<endl;
    }
}
 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	ini(Display);
	if(n>=10){out(Display);return 0;}
	else{out(Display+(100*(10-n)));return 0;}
}

Measured memory_bytes: 256
require 'matrix'

def get_integers
    gets.split(" ").map(&:to_i)
end

loop {
    n, m = get_integers
    break if n == 0
    count = (1..n).map{Vector[*get_integers]}.inject(&:+)
    puts (1..m).sort_by{|i| [-count[i-1], i]}.join(" ")
}   

Measured memory_bytes: 8608
S = input()
N = len(S)
MOD = 10**9 + 7

"""
桁DPについて、S以下の数字で～の場合は
dp[i][j][k] : i桁目まで見たときに、その数字がSのj桁までより厳密に小さいか（一致する場合は0）、そこまでの値の13で割った時の値がkとなる個数（？をうめる方法の数）
といつもはしていたが、今回はSの中の？を埋める問題なので、jの厳密に一致するかどうかがいらない
なので、dp[i][j]は、i桁目まで見たときに、そこまでを13で割った時に13余るように？を決める方法の数
"""
dp = [[0 for _ in range(13)] for _ in range(N+1)]

# 0文字目まで見たときに13で割って余りが0になるのは１通り
dp[0][0] = 1

for i in range(N):
    for j in range(13):
        if S[i] == "?":
            # ?には0~9のいずれかを入れる
            for num in range(10):
                dp[i+1][(10*j + num) % 13] += dp[i][j]
                dp[i+1][(10*j + num) % 13] %= MOD
        
        # i文字目が13でない場合は
        else:
            # i番目の数字を13で割った余り
            num = ord(S[i]) - ord("0")
            dp[i+1][(10*j + num) % 13] += dp[i][j]
            dp[i+1][(10*j + num) % 13] %= MOD


print(dp[-1][5])

Measured memory_bytes: 66012
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;

using namespace std;

int main()
{
	int n;
	int ans=0;
	
	cin>>n;
	while(1)
	{
		int s = sqrt(n);
		if(s*s==n)
		{
			break;
		}
		n--;
	}
	cout<<n<<endl;
	return 0;
}

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

int main()
{
	int N, M, a[50] = { 0 };

	cin >> N >> M;

	for (int i = 0; i < M; i++) {
		int A,B;
		cin >> A >> B;
		a[A-1]++;
		a[B-1]++;
	}

	for (int i = 0; i < N; i++) {
		cout << a[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
"""

Writer: SPD_9X2
https://atcoder.jp/contests/agc032/tasks/agc032_d

圧倒的挿入ソート
https://atcoder.jp/contests/abc006/tasks/abc006_4
これの、左右のコストが違うVer

最長部分増加列を計算すれば、A=Bの時の答えは分かる
その時の答えは, A * (N - 最長部分増加列の長さ)

残りのカードが昇順になるように抜き出し、適切な場所に戻す。
最長部分列として採用する or しないで dp?

dp[i][部分増加列の最後の数字] = i番目まで見た時のコストの最小値 かな？

増加列の最後に足せば、コストはかからない
足さないとき、最後の数字より大きければ、A払う
小さければ、B払う

O(N**2)で解けた？
"""

N,A,B = map(int,input().split())

p = list(map(int,input().split()))

dp = [float("inf")] * (N+1)
dp[0] = 0

for i in range(N):

    ndp = [float("inf")] * (N+1)

    for j in range(N+1):

        if p[i] >= j: #p[i]よりjがおおきいので、Aコスト & 更新ができる
            ndp[j] = min(ndp[j] , dp[j] + A)
            ndp[p[i]] = min(ndp[p[i]] , dp[j])

        else: #Bコストでの更新
            ndp[j] = min(ndp[j] , dp[j] + B)

    dp = ndp
print (min(dp))


Measured memory_bytes: 88284
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int A = read(), B = read(), T = read(), ans;
    ans = (T/A)*B;
    printf("%d\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 256
a, b, c, d = input()
op = [0] * 3

for i in range(2 ** 3):
    for j in range(3):
        if (i >> j) & 1 == 1:
            op[j] = '+'
        else:
            op[j] = '-'
    expression = a + op[0] + b + op[1] + c + op[2] + d
    if eval(expression) == 7:
        print(expression+'=7')
        break

Measured memory_bytes: 9052
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL x;

int main()
{
	in >> x;
	out << "ai1333";
	x /= 100;
	rep(i, x) out << 3;
	out << std::endl;
	return 0;
}


Measured memory_bytes: 3100
Imports System.Collections.Generic
Imports System.Console
Imports System.Math

Module Program
    Sub Main()
        Dim A As Long = NextLong()
        Dim B As Long = NextLong()
        Dim C As Long = NextLong()

        Dim S As Long = Min(A, Min(B, C))
        Dim L As Long = Max(A, Max(B, C))
        Dim M As Long = A + B + C - S - L

        For Each v As Long In New Long() {S, M, L}
            If v Mod 2 = 0 Then
                WriteLine(0)
                Exit Sub
            End If
        Next

        WriteLine(S * M)
    End Sub

    Function NextLong() As Long
        Return CLng(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 20560
//https://atcoder.jp/contests/abc148/tasks/abc148_c
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
ll lcm(ll num1,ll num2){
    return num1 / __gcd(num1,num2) * num2;
}
int main() {
    ll A,B; cin>>A>>B;
    ll ans=lcm(A,B);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 1e6+ 1000;
const int SIZE2 = 410;
const int SIZE3 = 430;
const int SIZE = SIZE2;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL A[SIZE],B[SIZE],C[SIZE];
LL counts[3];
LL maps[SIZE][SIZE],dp[SIZE][SIZE];
LL solve(){
	LL N;
	cin >> N >> M;
	REP(i,N){
		string s;
		cin >> s;
		REP(j,M) if(s[j]=='#') maps[i][j]=1;
	}
	REP(i,N) REP(j,M) dp[i][j]=INF;
	dp[0][0]=maps[0][0];
	REP(i,N) REP(j,M){
		MN(dp[i][j+1],dp[i][j]+(maps[i][j] !=maps[i][j+1]));
		MN(dp[i+1][j],dp[i][j]+(maps[i+1][j] !=maps[i][j]));
	}
	if(maps[N-1][M-1]==1) dp[N-1][M-1]++;
	return dp[N-1][M-1]/2;
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;

	REP(i,T){
		DEFAULT;

	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())
#define bitcnt(x) __builtin_popcount(x)

typedef long long ll;

ll N, S;

const ll INFL = 1e18;

bool check(ll b) {
    ll digsum = 0LL;
    ll n = N;
    while (n > 0) {
        digsum += n%b;
        n /= b;
    }
    return digsum == S;
}

void solve(void){
    cin >> N >> S;
    if (N == S) {
        cout << N+1 << endl;
        return;
    }
    ll ans = INFL;
    for (ll i = 2LL; i*i <= N; i++) {
        if (check(i)) {
            ans = min(ans, i);
        }
    }
    for (ll p = 1LL; p*p < N; p++) {
        if ((N-S)%p) continue;
        ll b = (N-S)/p+1LL;
        if (b <= 1LL) continue;
        if (check(b)) {
            ans = min(ans, b);
        }
    }
    cout << (ans==INFL?-1:ans) << endl;
}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


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

void solve()
{    
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    if (k>(h2*60+m2-h1*60-m1))
        cout << 0 << endl;
    else 
        cout << (h2*60+m2-h1*60-m1-k) << endl;

}

int main ()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
      
     int t;
   //  cin >> t;
     t=1;
     for (int tt=1;tt<=t;tt++)
     {
         solve();

     }

    return 0;
     
     
     
     
 }


Measured memory_bytes: 3608
/******************************************
*    AUTHOR:         julianferres         *
******************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
const ll INF = 1LL<<62;
#define MOD 1000000007
#define MAXN 200005

int main(){
    FIN;
    ll n,k;
    cin >> n >> k;
    vi dp(n,INF), a(n);
    dp[0] = 0;
    forn(i, n) cin >> a[i];

    forn(i,n){
        forr(j, 1, k + 1) {
            if (i + j < n)
                dp[i + j] = min(dp[i + j], dp[i] + abs(a[i + j] - a[i]));
        }
    }

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



Measured memory_bytes: 1792
def main():
    N, M = map(int, input().split())
    target = list()
    pattern = list()

    for n in range(N):
        l = input()
        target.append(l)

    for m in range(M):
        l = input()
        pattern.append(l)

    find = 0

    for i in range(N):
        for j in range(N):

            if ( i + (M - 1) <= N - 1 ) and (j + (M - 1) <= N - 1)  :
                count = 0

                for k in range(M):
                    for l in range(M):
                        if target[i+k][j+l] != pattern[k][l]:
                            count += 1
                if count == 0:
                    find += 1
                        
    if find:
        print("Yes")
    else:
        print("No")
main()

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  string s; cin >> s; ll cnt = 0;
  
  rep(i,4){
    if(s[i] == '+') cnt++;
    else cnt--;
  }
  
  cout << cnt << endl;
  
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size(), ans = 0;
    for (int i = 0; i < N / 2; i++) {
        if (S[i] != S[N - i - 1]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

void Euclidean(long long a,long long b,long long n){
	if(b!=0) Euclidean(b,a%b,n+1);
	else cout<<a<<" "<<n<<endl;
	return;
}

int main(void){

	int people[7];
	int n;
	int inp;

	while(1){
		for(int i=0;i<7;i++) people[i]=0;
		cin>>n;
		if(n==0) break;
		for(int i=0;i<n;i++){
			cin>>inp;
			if(inp<60) people[inp/10]++;
			else people[6]++;
		}
		for(int i=0;i<7;i++) cout<<people[i]<<endl;
	}

    return 0;
}

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

typedef long long ll;

#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define clr(a, b) memset(a, b, sizeof(a))
#define forn(i, n) for(int i=0; i<(int)(n); ++i)
#define forab(i, a, b) for(int i=(int)(a); i<=(int)(b); ++i)
#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef LOCAL
    clock_t tStart = clock();
#endif
    int h, w, n;
    cin >> h >> w >> n;
    int res = 0, pr = 0;
    while(res < n) {
        res += max(h, w);
        ++pr;
    }
    cout << pr <<"\n";
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * (clock() - tStart)/ CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n,k,s;cin>>n>>k>>s;
    vl a;
    if(s == 1000000000){
        rep(i,k)a.push_back(1000000000);
        rep(i,n-k)a.push_back(1);
    }
    else{
        rep(i,k)a.push_back(s);
        rep(i,n-k)a.push_back(s+1);
    }
    for(int i=0;i<n;i++){
        if(i)cout << " ";
        cout << a[i];
    }
    cout << endl;
}


Measured memory_bytes: 2292
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <set>

using namespace std;
typedef pair<int,int> pii;
const int MAXN = 2010;
int nowarn;

int n, a[MAXN], b[MAXN];

void input() {
	char str[MAXN];
	nowarn = scanf( "%s", str );
	n = (int)strlen(str);
	for( int i = 1; i <= n; ++i )
		a[i] = str[i-1] - '0';
	nowarn = scanf( "%s", str );
	for( int i = 1; i <= n; ++i )
		b[i] = str[i-1] - '0';
}

bool solve_b_all_zero() {
	for( int i = 1; i <= n; ++i )
		if( b[i] ) return false;
	int ans = 0;
	for( int i = 1; i <= n; ++i )
		if( a[i] ) ans = -1;
	printf( "%d\n", ans );
	return true;
}

bool have1[MAXN][MAXN] = {0};
int left1[MAXN], right1[MAXN];
int inc( int x ) {
	return x == n ? 1 : x+1;
}
int dec( int x ) {
	return x == 1 ? n : x-1;
}
int dist( int i, int j ) {
	return j-i < 0 ? j-i+n : j-i;
}
void prelude() {
	for( int i = 1; i <= n; ++i )
		if( b[i] ) have1[i][i] = 1;
	for( int len = 2; len <= n; ++len )
		for( int i = 1; i+len-1 <= n; ++i ) {
			int j = i+len-1;
			have1[i][j] = have1[i][i] || have1[i+1][j];
		}
	for( int i = 1; i <= n; ++i )
		for( int j = i-1; j >= 1; --j )
			have1[i][j] = have1[i][n] || have1[1][j];
	int nxt1 = 1;
	while( !b[nxt1] ) nxt1 = inc(nxt1);
	for( int i = 1; i <= n; ++i ) {
		right1[i] = dist(i, nxt1);
		// printf( "right[%d] = %d\n", i, right1[i] );
		if( i == nxt1 ) nxt1 = inc(nxt1);
		while( !b[nxt1] ) nxt1 = inc(nxt1);
	}
	nxt1 = n;
	while( !b[nxt1] ) nxt1 = dec(nxt1);
	for( int i = n; i >= 1; --i ) {
		left1[i] = dist(nxt1, i);
		// printf( "left[%d] = %d\n", i, left1[i] );
		if( i == nxt1 ) nxt1 = dec(nxt1);
		while( !b[nxt1] ) nxt1 = dec(nxt1);
	}
}

set<pii, greater<pii> > s;
int calc( int offset ) {
	int ans = abs(offset);
	for( int i = 1; i <= n; ++i ) {
		int j = i + offset;
		if( j > n ) j -= n;
		if( j < 1 ) j += n;
		if( a[i] == b[j] ) continue;
		++ans;
		if( offset < 0 ) swap(i, j);
		if( !have1[i][j] ) {
			int left = min( left1[i], left1[j] );
			int right = min( right1[i], right1[j] );
			s.insert( pii(left, right) );
		}
		if( offset < 0 ) swap(i, j);
	}
	int minv = 1e9, rmax = 0;
	while( !s.empty() ) {
		int lmax = s.begin()->first;
		minv = min( minv, 2*(lmax + rmax) );
		rmax = max( rmax, s.begin()->second );
		s.erase( s.begin() );
	}
	minv = min( minv, 2*rmax );
	// printf( "offset = %d, ans = %d, minv = %d\n", offset, ans, minv );
	return ans + minv;
}

int main() {
	input();
	if( solve_b_all_zero() ) return 0;
	prelude();
	int ans = 1e9;
	for( int i = -n+1; i <= n-1; ++i )
		ans = min( ans, calc(i) );
	printf( "%d\n", ans );
	return 0;
}


Measured memory_bytes: 4352
n = int(input())
A = list(map(int, input().split()))

s = sum(A)
x = []

A_ = sum([A[i] for i in range(1,n,2)])
x1 = s - 2*A_
x.append(x1)

for i in range(n-1):
  x_new = 2*A[i] - x[i]
  x.append(x_new)


for i in range(n):
  print(x[i], end = " ")

Measured memory_bytes: 14092
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
#define ll long long
int n;
char arr[100005];
int cnt[27];
ll answer = 1;
ll mod = 1e9 + 7;
int main(){
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf(" %c", &arr[i]);
		cnt[(int)arr[i] - 97]++;
	}
	for (int i = 0; i < 26; i++){
		answer *= (cnt[i] + 1);
		answer %= mod;
	}
	printf("%lld\n", answer - 1);
}

Measured memory_bytes: 384
use std::io;


fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let A:i64 = read_line().parse().unwrap();
    let B:i64 = read_line().parse().unwrap();
    let C:i64 = read_line().parse().unwrap();
    let X:i64 = read_line().parse().unwrap();

    let mut count = 0;
    for a in (0..A+1) {
        for b in (0..B+1) {
            for c in (0..C+1) {
                if (a*500)+(b*100)+(c*50) == X {
                    count+=1
                }
            }
        }
    }
    println!("{}",count);
}

Measured memory_bytes: 4352
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int main() {
	int n; string s;
	cin >> n >> s;
	map<pair<string, string>, int> mp;
	int subsets = (1 << n);
	for (int i = 0; i < subsets; ++i) {
		string r = "", b = "";
		for (int j = 0; j < n; ++j) {
			if (i & (1 << j)) {
				r += s[j];
			} else {
				b += s[j];
			}
		}
		reverse(b.begin(), b.end());
		++mp[{r, b}];
	}
	ll ans = 0;
	s = s.substr(n, n);
	for (int i = 0; i < subsets; ++i) {
		string r = "", b = "";
		for (int j = 0; j < n; ++j) {
			if (i & (1 << j)) {
				r += s[j];
			} else {
				b += s[j];
			}
		}
		reverse(b.begin(), b.end());
		ans += mp[{b, r}];
	}
	cout << ans << endl;
}

Measured memory_bytes: 87040
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  A,B,C,D,E,F=LI()
  ans_pair=[0,0]
  ans_noudo=0
  for a in range(31):
    for b in range(31):
      for c in range(3001):
        for d in range(3001):

          sato=c*C+d*D
          mizu=100*A*a+100*B*b
          satomizu=sato+mizu
          # if satomizu==2634 and sato==934:
          #   print(satomizu,sato)

          if satomizu==0:
            continue

          if F<satomizu:
            break

          noudo=(100*sato)/(satomizu)
          E_noudo=(100*E)/(100+E)
          if E_noudo<noudo:
            break

          if ans_noudo<=noudo:
            ans_noudo=noudo
            ans_pair=[satomizu,sato]
            # print(noudo,satomizu,sato,mizu,a,b,c,d)

  return str(ans_pair[0])+' '+str(ans_pair[1])

# main()
print(main())


Measured memory_bytes: 10776