akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int mod = 1e9 + 7;
  int N, M;
  cin >> N >> M;

  vector<int> aa(M);
  for (int k = 0; k < M; k++) { cin >> aa[k]; }
  
  vector<int> ans(N + 1);
  ans[0] = 1;

  for (int k = 1, l = 0; k <= N; k++) {
    if (l < M && aa[l] == k) { l++; continue; }
    if (k > 0) { ans[k] += ans[k - 1]; }
    if (k > 1) { ans[k] += ans[k - 2]; }
    ans[k] %= mod;
  }
  
  cout << ans[N] << endl;
}

Measured memory_bytes: 1024
program q_3
  implicit none
  integer(8) :: n,i,ans

  read(*,*) n
  do i =1,n
     call cal(i,ans)
     write(*,*) ans
  enddo

contains

  subroutine cal(n,ans)
    implicit none
    integer(8) :: n,i,ans,maxy,maxz,x,y,z

    if(n<=5)then
       ans=0
    elseif(n==6)then
       ans=1
    else
       ans=0
       do x = 1,int(sqrt(dble(n-2))-1)
          maxy=int(dble(-(x+1)+sqrt(dble((x+1)**2-4*(x**2+x+1-n))))/2.0d0)
          do y = 1,int(maxy)
             maxz=int(dble(-(x+y)+sqrt(dble((x+y)**2-4*(x**2+x*y+y**2-n))))/2.0d0)
             do z = 1,int(maxz)
                if ((x+y+z)**2 == n+(x*y + y*z + z*x)) then
                   ans = ans + 1
                end if
             end do
          end do
       end do
    end if
  end subroutine cal

end program q_3

Measured memory_bytes: 2784
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double 
#define fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
int main() {
	int n;
	cin>>n;
	int f=0;
	fo(i,0,3){
	    if(n%10==7){
	        f=1;
	        break;
	    }
	    n=n/10;
	    
	}
	if(f==1)cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;


int main(){
    int A,P;
    cin >> A >> P;
    P+=A*3;
    cout<<P/2<<endl;
    return 0;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

int main(){
	string s;cin>>s;
	cout<<*s.begin();
	cout<<(ll)s.size()-2;
	cout<<*(--s.end())<<endl;
	
}


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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int a,b;
    scanf("%d %d",&a,&b);
    if (a>b) printf("a > b\n");
    else if (a<b) printf("a < b\n");
    else printf("a == b\n");
    return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<cstdio>
#include<cstring>

int Hash[244140625];
char s[13];  
 
int getChar(char ch){
	if(ch=='A') return 1;
	else if(ch=='C') return 2;
	else if(ch=='G') return 3;
	else return 4;
}
 
int getKey(){
	int sum=0,p=1;
	
	for(int i=0;i<strlen(s);i++){
		sum+=p*(getChar(s[i]));
		p*=5;
	}
	return sum;
}
 
int main(){
	int n;
	char com[7];
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s %s",com,s);
		if(com[0]=='i'){
			Hash[getKey()]=1;
		}
		else{
			if(Hash[getKey()]==1)
			puts("yes");
			else
			puts("no");
		}
	}
}

Measured memory_bytes: 20076
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int A,B;
  cin >> A >> B;
  
  cout << A*B << endl;

  
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
#define MAX 510000

void solve(long long N, std::vector<std::string> s){
  sort(all(s));
  ll ans=0;
  map<string,ll> x;
  for (int i = 0; i < N; i++) {
    x[s[i]]++;
  }
  for (auto i = x.begin(); i != x.end(); i++) {
    ll a = i -> second -1;
    ans += a*(a+1)/2;
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> s(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> s[i];
        sort(all(s[i]));
    }
    solve(N, std::move(s));
}


Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
 
//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out
 
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
#define M 201
 
#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
 
#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)
 
#define all(v) v.begin(), v.end()
#define print(v) for (auto i: v) cerr << i << " ";
 
int main() {
    fast
    ll n,m;
    cin>>n>>m;
    ll arr[n];
    ll check[n];
    REP(i,0,n)check[i]=1;
    //ll count=n;
    REP(i,0,n)cin>>arr[i];
    ll road[m][2];
    REP(i,0,m)cin>>road[i][0]>>road[i][1];
    REP(i,0,m){
        if(arr[road[i][0]-1]<arr[road[i][1]-1]){
            check[road[i][0]-1]=0;
        }
        else if(arr[road[i][0]-1]>arr[road[i][1]-1])check[road[i][1]-1]=0;
        else check[road[i][0]-1]=check[road[i][1]-1]=0;
    }
    ll count=0;
    REP(i,0,n)if(check[i]==1)count++;
    cout<<count<<endl;
    return 0;
}



Measured memory_bytes: 6764
#include <iostream>
#include <cstdio>

using namespace std;
const int MAXN = 53;
typedef long long ll;

inline int R()
{
	int rt = 0;
	bool isn = false;
	char ch = getchar();
	for ( ; ch < '0' || ch > '9'; ch = getchar() )
		isn = ch == '-' ? true : isn;
	for ( ; ch >= '0' && ch <= '9'; ch = getchar() )
		rt = rt * 10 + ch - '0';
	return isn ? -rt : rt;
}

ll dp[MAXN][MAXN][MAXN * MAXN];

int main()
{
	//freopen ( "test.in", "r", stdin );
	int n = R(), a = R(), lm = 0;
	dp[0][0][0] = 1;
	for ( int i = 1; i <= n; ++i )
	{
		int na = R();
		lm += na;
		for ( int j = 0; j <= i; ++j )
			for ( int k = 0; k <= lm; ++k )
				dp[i][j][k] = dp[i - 1][j][k];
		for ( int j = 1; j <= i; ++j )
			for ( int k = na; k <= lm; ++k )
				dp[i][j][k] += dp[i - 1][j - 1][k - na];
	}
	ll ans = 0;
	for ( int i = 1; i <= n; ++i )
		ans += dp[n][i][a * i];
	printf ( "%lld\n", ans );
	return 0;
}

Measured memory_bytes: 57600
#include<bits/stdc++.h>
using namespace std;
const int N=510;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,m;
char s[N][N],ans1[N][N],ans2[N][N];
int main() {
    cin>>n>>m;
    for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if((i==1&&j<m)||((j&1)&&i<n&&!(i==1&&j==m))) ans1[i][j]='#';
            else ans1[i][j]='.';
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if((i==n&&j>1)||(!(j&1)&&i>1)) ans2[i][j]='#';
            else ans2[i][j]='.';
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(s[i][j]=='#') ans1[i][j]=ans2[i][j]='#';
    for(int i=1;i<=n;i++,puts(""))
        for(int j=1;j<=m;j++) putchar(ans1[i][j]);
    puts("");
    for(int i=1;i<=n;i++,puts(""))
        for(int j=1;j<=m;j++) putchar(ans2[i][j]);
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 1536
def main():
    n, k, c = map(int, input().split())
    s = input()

    def f(r):
        interval = 0
        count = k
        for i in r:
            if count == 0:
                break
            if interval > 0:
                interval -= 1
                continue
            if s[i] == 'o':
                yield i
                count -= 1 
                interval = c

    for i, j in zip(f(range(0, n)), reversed(list(f(range(n-1, -1, -1))))):
        if i == j:
            yield i+1


print(*main(), sep="\n")

Measured memory_bytes: 19556
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#define Z(z)m[a+b]=1;m[b+a]=1;reverse(z.begin(),z.end());
using namespace std;main(){string s,a,b;for(cin>>s;cin>>s;){
map<string,int>m;
for(int i=0;++i<s.length();){a=s.substr(0,i),b=s.substr(i);Z(a)Z(b)Z(a)Z(b)}
cout<<m.size()<<endl;
}}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int c = 0;
  int a;
  rep(i, N)
  {
    cin >> a;
    while (a % 2 == 0)
    {
      a /= 2;
      c++;
    }
  }

  cout << c << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

long a[21][21];

ll func( ll b )
{
    ll  ans = 0;

    long tmp = b%4;
    if(tmp==2 || tmp==3) {
        ans += 1;
    }
    if(tmp==1 || tmp==3) {
        ans += (b-1);
    }

    return ans;
}

int main(int argc, char* argv[])
{
    ll a, b;
    scanf("%lld%lld", &a, &b);
    b++;

    ll c = func(a) ^ func(b);

    //printf("%lld\n", a);
    //printf("%lld\n", b);
    printf("%lld\n", c);

    return 0;
}



Measured memory_bytes: 128
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        String result = "ABC" + n;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
#define RI register int
typedef long long LL;
LL bin[42],n;
int a[205],js,len,k;
int main()
{
	bin[0]=1;for(RI i=1;i<=40;++i) bin[i]=bin[i-1]<<1LL;
	scanf("%lld",&n);++n;
	for(RI i=40;i>=0;--i) if(n&bin[i]) {k=i;break;}
	for(RI i=k-1;i>=0;--i) {
		++js;
		for(RI j=len;j>=len/2+1;--j) a[j+2]=a[j];
		a[len/2+2]=js;
		for(RI j=len/2;j>=1;--j) a[j+1]=a[j];
		a[1]=js,len+=2;
		if(n&bin[i]) {
			++js;
			for(RI j=len;j>=1;--j) a[j+1]=a[j];
			a[1]=a[len+2]=js,len+=2;
		}
	}
	printf("%d\n",len);
	for(RI i=1;i<=len;++i) printf("%d ",a[i]);
	puts("");
    return 0;
}

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> vec(H);

    string s;
    
    for (int i=0; i<(W+2); i++) s += '#';

    cout << s << endl;

    for (int i=0; i<H; i++){
        cin >> vec.at(i);
        vec.at(i) = '#' + vec.at(i) +'#';
        cout << vec.at(i) << endl;
    }

    cout << s << endl;

}

Measured memory_bytes: 508
"ABC054C"
"https://atcoder.jp/contests/abc054/tasks/abc054_c"

# 入力
N, M = gets.split.map(&:to_i)
a, b = [], []
M.times do |i|
  a[i], b[i] = gets.split.map(&:to_i)
end

# 隣接行列作成
# 初期化
adj = []
(N+1).times do |i|
  adj[i] = []
  adj[i].fill(false, 0..N)
end
M.times do |i|
  # 無向グラフなので転置した位置の値もtrueにする
  adj[a[i]][b[i]] =  adj[b[i]][a[i]] = true
end
# puts "#{adj}"

# {2,..,N}までの順列の列挙
perm = []
# {2,..,N}の配列を作成
arr = []
2.upto N do |i|
  arr.push(i)
end
# arrの全順列を作成
perm = arr.permutation.to_a

# 各順列について繰り返し
ans = 0
perm.each do |p|
  cnt = 0
  v = 1 # 頂点1
  # 順列に含まれる数字それぞれについて繰り返し
  p.each do |u|
    # puts "#{v} #{u}"
    if adj[v][u] or adj[u][v] #vとuが隣接しているか？
      cnt += 1
      v = u
      if cnt == N-1
        ans += 1
      end
    end
  end
end

puts ans

Measured memory_bytes: 2172
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();

		for (int x = 1; x <= i; x++) {
			if ((x % 3 == 0 || String.valueOf(x).indexOf("3") != -1)) {
				System.out.print(" " + x);
			}
		}
		System.out.println();
		sc.close();

	}

}

Measured memory_bytes: 29320
// in the name if Allah
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll INF = 1<<30 ;
const ll N= 1e6 ;
#define f first
#define s second
ll n , a[N],m , mod= 1000000007 , dp[N] , d[N] , sum[N] ;
ll poww(ll a , ll  b){
if(b==0)return 1 ;
ll x = poww(a,b/2)%mod;
x %= mod ;
if(b&1)return (((x*x)%mod)*a)%mod ;
else return (x*x)%mod ;
}
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m ;
for(int i = 0 ; i < m ; i ++){ll x ; cin >> x ; a[x]=1 ;}
for(int i = 1 ; i <= n ; i ++){
    if(a[i]==1 && a[i-1]==1)return cout << 0 , 0 ;
}
if(a[0]==0)dp[0]=1;
if(a[1]==0)dp[1]=1;
for(int i = 2 ; i <= n ; i ++){
    if(a[i-1]==0){dp[i] += (dp[i-1])%mod ; dp[i] %= mod ;}
    if(a[i-2]==0){dp[i] += (dp[i-2])%mod ; dp[i] %= mod ;}
}
cout << dp[n]%mod ;
    return 0;
}


Measured memory_bytes: 6400
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define INF 1<<10

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = {  0, 1, 0, -1 };

int main()
{

//	cut here before submit 
//	freopen ("testcase.PSH", "r", stdin );
	int n;
	while (scanf ("%d", &n ), n ){
		if (n == 1 ){
			cout << 1 << ' ' << 1 << endl;
		}else{
			vector<int> cx (n, 0 ), cy(n, 0 );
			int m, d;
			int minx = INF, miny = INF, maxx = 0, maxy = 0;
			cx[0] = 0, cy[0] = 0;
			for (int i = 1; i < n; i++ ){
				scanf ("%d %d", &m, &d );
				cx[i] = cx[m] + dx[d];
				cy[i] = cy[m] + dy[d];
			} // end for
			rep (i, n ){
				minx = min (minx, cx[i] ); miny = min (miny, cy[i] );
				maxx = max (maxx, cx[i] ); maxy = max (maxy, cy[i] );
			} // end rep
			int h = maxy - miny + 1;
			int w = maxx - minx + 1;
			printf ("%d %d\n", w, h );
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1188
#include <vector>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <fstream>
using namespace std;

const int INF = 1e7;

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

	set<int> t;
	int a, b, c;
	cin >> a >> b >> c;
	t.insert(a);
	t.insert(b);
	t.insert(c);
	cout << (int) t.size() << endl;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<utility>
#include<queue>
#include<cstdio>
#include<functional>

using namespace std;

int main()
{
	int i;
	priority_queue<int,vector<int>,greater<int> > pq;
	for(int j = 0;j<3;j++)
	{
		scanf("%d",&i);
		pq.push(i);
	}
	
	printf("%d ",pq.top());
	pq.pop();
	printf("%d ",pq.top());
	pq.pop();
	printf("%d",pq.top());
	pq.pop();
	putchar('\n');
	
	return 0;
	
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    map<string,int> mp ;
    int n ;
    cin >> n ;
    int cnt = 0 ;
    for(int i = 0; i < n; i++){
        string x ;
        cin >> x ;
        mp[x]++ ;
        cnt = max(cnt, mp[x]) ;
    }
    for(auto p : mp){
        if ( p.second == cnt )
            cout << p.first << endl;
    }
    return 0 ;
}


Measured memory_bytes: 25216
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

X,Y=nm()
b_2=Y-2*X
a_2=4*X-Y

if(0<=b_2 and b_2%2==0 and 0<=a_2 and a_2%2==0):
    print('Yes')
    sys.exit(0)

print('No')



Measured memory_bytes: 10420
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int main() {

  int N;
  cin>>N;

  if(N >= 1200) cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;

  return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
int main(void){
	char a[5];
	scanf("%s",a);
	int i,n=0;
	for(i=0;i<4;i++){
		if(a[i]=='+'){
			n++;
		}else{
			n--;
		}
	}
	printf("%d",n);
	return 0;
}

Measured memory_bytes: 128
n = input()
lenn = len(n)
ans = 0
for i in range(2**(lenn-1)):
    now = int(n[0])
    count = 0
    for j in range(lenn-1):
        if (i >> j) & 1 == 1:
            count += now
            now = int(n[j+1])
        elif (i >> j) & 1 == 0:
            now = now*10 + int(n[j+1])
    ans += count + now
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int wscore[11],kscore[11],a;
	for(int i=0;i<10;i++){
		cin>>wscore[i];
	}
	for(int i=0;i<10;i++){
		cin>>kscore[i];
	}
	sort(wscore,wscore+10);
	sort(kscore,kscore+10);
	cout<<wscore[9]+wscore[8]+wscore[7]<<" "<<kscore[9]+kscore[8]+kscore[7]<<endl;
   return 0;
}

Measured memory_bytes: 3120
url = "https://atcoder.jp/contests/abc084/tasks/abc084_b"

import re


def main():
    n, m = list(map(int, input().split()))
    s = list(input())

    if s[n] != '-':
        print('No')
        exit()
    else:
        s.pop(n)
    s = ''.join(s)
    pat = '^[0-9]+$'
    rep = re.compile(pat)
    result = rep.match(s)
    if result is not None:
        if result.group() == s:
            print('Yes')
            exit()
    print('No')



if __name__ == '__main__':
    main()




Measured memory_bytes: 3188
#include <stdio.h>

int main()
{
    int N;
    long long A;

    long long sum;
    long long min;
    int i;
    int zero_count;
    int minus_count;

    scanf("%d", &N);

    zero_count = 0;
    minus_count = 0;
    sum = 0;
    min = 1000000000; /* 10^9 */
    for(i = 0; i < N; i++) {
        scanf("%lld", &A);
        if(A == 0) {
            zero_count += 1;
        } else if(A < 0) {
            minus_count += 1;
            A *= -1;
            sum += A;
            if(A < min) {
                min = A;
            }
        } else {
            sum += A;
            if(A < min) {
                min = A;
            }
        }
    }

    // 負の数が奇数 -> 一番絶対値が小さい数字を負の数にした場合の合計
    // 負の数が偶数 もしくは、 0が1個でもあれば -> 全て正の数にできる
    if(zero_count >= 1 || (minus_count%2) == 0) {
        printf("%lld\n", sum);
    } else {
        printf("%lld\n", sum - (min*2));
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()


int main() {
	string s;
	cin >> s;
	rep(i, 3) {
		if (s[i] == '1') cout << 9;
		else cout << 1;
	}
	cout << endl;
}


Measured memory_bytes: 256
import numpy as np

n, d = map(int, input().split())

x_list = np.array([list(map(int, input().split())) for _ in range(n)])

count = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        tmp_kyori = np.linalg.norm(x_list[i] - x_list[j])

        hoge = tmp_kyori % 1

        if hoge == 0:
            count += 1

print(count)


Measured memory_bytes: 12444
package main

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

func main() {
	n := nextInt()
	x := nextInts(5)
	m := min(x...)
	fmt.Println((n+m-1)/m + 4)
}

var dy = []int{1, 0, -1, 0, 0}
var dx = []int{0, 1, 0, -1, 0}
var inf = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}

var nextReader func() []byte

func init() {
	nextReader = newScanner()
	log.SetFlags(log.Lshortfile)
}

func newScanner() func() []byte {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() []byte {
		r.Scan()
		return r.Bytes()
	}
}
func nextBytes() []byte {
	return nextReader()
}

func nextString() string {
	return string(nextReader())
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(string(nextReader()), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(string(nextReader()))
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(string(nextReader()), 64)
	return f
}


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

bool valid(vector<int> &seg, vector<int> &cor) {
	int n = (int) seg.size();
	auto ss = seg;
	auto sc = cor;
	sort(ss.begin(), ss.end());
	sort(sc.begin(), sc.end());
	if (ss != sc) {
		return false;
	}
	map<int, int> pos;
	rep(i, n) {
		pos[cor[i]] = i;
	}
	vector<int> l, r;
	rep(i, n) {
		if (i < pos[seg[i]]) {
			l.push_back(seg[i]);
		} else if (i > pos[seg[i]]) {
			r.push_back(seg[i]);
		} else {
			assert(false);
		}
	}
	rep(i, (int) l.size() - 1) {
		if (l[i] > l[i + 1]) {
			return false;
		}
	}
	rep(i, (int) r.size() - 1) {
		if (r[i] > r[i + 1]) {
			return false;
		}
	}
	return true;
}

int main() {
	int n;
	scanf("%d", &n);
	vector<int> p(n);
	vector<bool> same(n);
	rep(i, n) {
		scanf("%d", &p[i]);
		p[i] --;
		same[i] = (p[i] == i);
	}
	vector<int> seg;
	vector<vector<int>> segs;
	vector<int> cor;
	vector<vector<int>> cors;
	rep(i, n) {
		if (!same[i]) {
			if (i == 0) {
				if (!same[i + 1]) {
					puts("No");
					return 0;
				} else {
					seg.push_back(p[i]);
					cor.push_back(i);
				}
			} else if (same[i - 1]) {
				if (i > 1 && same[i - 2]) {
					if (seg.size() > 0) {
						segs.push_back(seg);
						cors.push_back(cor);
						seg.clear();
						cor.clear();
					}
				}
				seg.push_back(p[i]);
				cor.push_back(i);
			} else if (i == n - 1) {
				if (!same[i - 1]) {
					puts("No");
					return 0;
				}
			} else if (same[i + 1]) {
				segs.push_back(seg);
				cors.push_back(cor);
				seg.clear();
				cor.clear();
				seg.push_back(p[i]);
				cor.push_back(i);
			} else {
				puts("No");
				return 0;
			}
		}
	}
	if (seg.size() > 0) segs.push_back(seg);
	if (cor.size() > 0) cors.push_back(cor);
	rep(i, segs.size()) {
		if ((int) segs[i].size() == 1) {
			puts("No");
			return 0;
		}
		if (!valid(segs[i], cors[i])) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
        return 0;
}


Measured memory_bytes: 13548
n=int(input())
txy=[list(map(int,input().split())) for i in range(n)]
x,y=0,0
t=0
for i in range(n):
  if abs((x+y) - (txy[i][1]+txy[i][2]))%2 == abs(t-txy[i][0])%2 and abs(t-txy[i][0]) >= abs((x+y)-(txy[i][1]+txy[i][2])):
    x,y=txy[i][1],txy[i][2]
  else:
    print("No")
    exit()
  t=txy[i][0]
print("Yes")

Measured memory_bytes: 27236
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;




int main(){
   IOS
   int n;
   
   ll  k; cin>>n>>k;

   vi a(n);
   for(int & x : a)cin>>x, x--;

   vector<bool> vis(n, false);

   int cur = a[0];

   vi path;

   path.pb(0);

   while(vis[cur] != true){
       path.pb(cur);
       vis[cur] = true;
       cur = a[cur];       
   }
  

   //cur is the cycle start

   int tot = path.size();
   int cyc_size = 0, f = -1;

   for(int i = 0; i < tot; i++){
       if(path[i] == cur){
           cyc_size = tot - i;
           f = i;
           break;
       }
   }

   if(k < f){
       cout<<path[k] + 1<<"\n";
   }else{
       k -= f;
       k %= cyc_size;
       //cout<<k<<"\n";
       cout<<path[k + f] + 1<<"\n";
   }
}


Measured memory_bytes: 5100
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  bool muri = true;
  for(int i=0;i<S.size();++i) {
    if(i+2>=S.size()) break;
    if(S[i]!=S[i+2]) muri = false;
  }
  if(muri) cout<<"Second"<<endl;
  else {
    if(S[0]==S[S.size()-1]) {
      if(S.size()%2!=0) cout<<"Second"<<endl;
      else cout<<"First"<<endl;
    }
    else {
      if(S.size()%2==0) cout<<"Second"<<endl;
      else cout<<"First"<<endl;
    }
  }
}


Measured memory_bytes: 3732
#include <stdio.h>

int main()
{
        int a[21],n,i,x=0;

        scanf("%d",&n);

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


        for(i=1;i<n-1;i++){
                if(a[i]<a[i-1] && a[i]>a[i+1])x++;
                else if(a[i]>a[i-1] && a[i]<a[i+1])x++;
        }


        printf("%d\n",x);

        return 0;
}



Measured memory_bytes: 128
#include <stdio.h>

int fibonacci(int);

int main(){

  int n;

  scanf("%d", &n);

  printf("%d\n", fibonacci(n));

  return 0;
}

int fibonacci(int n){

  int i, F[n+1];


  F[0] = 1;
  F[1] = 1;
  for(i = 2;i<=n;i++)
    F[i] = F[i-2] +F[i-1];

  return F[n];
}

Measured memory_bytes: 596
N=int(input())
CSF=[list(map(int,input().split())) for i in range(N-1)]

for s in range(N):
    time=0
    for e in range(s,N-1):
        C,S,F=CSF[e]
        if time>S:
            a=(time-S)%F
            if a:
                time+=F-a
            time+=C
        else:
            time=S+C
    print(time)


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

int hit(int str[],int str2[]){
  int i, j = 0;

  for(i = 0;i < 4;i++){
    if(str[i] == str2[i]){
      j++;
    }
  }

  return j;
}

int blow(int str3[],int str4[]){
  int i, j, k = 0;

  for(i = 0;i < 4;i++){
    for(j = 0;j < 4;j++){
      if(str3[i] == str4[j]){
	if(i == j){
	  ;
	}else{
	  k++;
	}
      }
    }      
  }
  return k;
}

int main(){
  int str[5], str2[5];

  while(scanf("%d", &str[0]) != EOF){ 
	scanf("%d %d %d", &str[1], &str[2], &str[3]);
    cin >> str2[0] >> str2[1] >> str2[2] >> str2[3];

  int hit_var = hit(str, str2);
  int blow_var = blow(str, str2);

  cout << hit_var << " " << blow_var << endl;

  }

  return 0;
}

Measured memory_bytes: 1244
n,*a=`dd`.split.map &:to_i;r=[0]*n;m=1e9;x,y=a.each_with_index.sort_by{|e,i|[-e,i]}.transpose;n.times{|i|r[m=[m,y[i]].min]+=-~i*(x[i]-x[i+1].to_i)};p *r

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

def main():
     n = int(input())
     boss = list(map(int, input().split()))
     ans = [0 for i in range(n)]

     for i in range(len(boss)):
          ans[boss[i]-1] += 1
     
     for i in range(len(ans)):
          print(ans[i])

if __name__ == "__main__":
    main()


Measured memory_bytes: 32368
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<utility>
#include<queue>
#include<map>

using namespace std;

int main(){
    int ans = 0;
    int n, q;
    cin >> n;

    vector<int> s(n);
    for(int i=0;i<n;i++) cin >> s[i];  

    int num;
    cin >> q;
    for(int i=0;i<q;i++) {
        cin >> num;
        for(int j=0;j<n;j++){
            if(num == s[j]) {
                ans++;
                break;
            }
        }
    }  
    cout << ans << endl;
}


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

//const int N = 150010;
//
//vector < int > g[N];
//bool vis[N];
//vector < int > curr;
//
//void dfs(int u)
//{
//    vis[u] = true;
//    curr.push_back(u);
//    for(auto v : g[u])
//    {
//        if(!vis[v])
//            dfs(v);
//    }
//}

//int main()
//{
//    int n, m;
//    cin >> n >> m;
//    memset(vis, false, sizeof vis);
//    for(int i = 0; i < m; ++i)
//    {
//        int u, v;
//        scanf("%d %d", &u, &v);
//        g[u].push_back(v);
//        g[v].push_back(u);
//    }
//    for(int i = 1; i <= n; ++i)
//    {
//        if(!vis[i] && g[i].size() > 0)
//        {
//            curr.clear();
//            dfs(i);
//            long long sz = 0, len = curr.size();
//            for(auto v : curr)
//            {
//                sz += (long long)g[v].size();
//            }
//            if(sz != ((len - 1) * len))
//            {
//                cout << "NO";
//                return 0;
//            }
//        }
//    }
//    cout << "YES";
//    return 0;
//}

int main()
{
    int w, a, b;
    while(cin >> w >> a >> b)
    {
        if(b >= a + w)
        {
            cout << b - a - w << endl;
        }
        else if(a >= b + w)
        {
            cout << a - b - w << endl;
        }
        else
        {
            cout << 0 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int N, Y;

int main() {
    cin >> N >> Y;

    bool valid = false;
    for (int i = 0; i <= N; ++i) {
        for (int j = 0; i + j <= N; ++j) {
            int k = N - i - j;
            if (10000 * i + 5000 * j + 1000 * k == Y) {
                cout << i << " " << j << " " << k << endl;
                valid = true;
                break;
            }
        }
        if(valid) break;
    }

    if (!valid) cout << "-1 -1 -1" << endl;
}

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

int n,m,d;
int main(){
	scanf("%d%d%d",&n,&m,&d);
	if(d&1){
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++)if(i+j&1)printf("G");else printf("Y");
			printf("\n");
		}
	}else{
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				int u=(i+j)/d,v=(i-j)/d;
				if(i<j)v=(i-j+1)/d-1;
				u&=1,v&=1;
//				printf("%d %d  ",u,v);
				if(u)if(v)printf("Y");else printf("G");
				else if(v)printf("B");else printf("R");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int x[11][11];

bool check(int n){
    for(int i=1;i<128;i+=1){
        if( i*i==n )
            return true;
    }
    return false;
}

int main(){
    int n,d,ans=0;
    cin>>n>>d;
    
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>x[i][j];
        }
    }

    for(int i=0;i<n-1;i++){
        for(int k=i+1;k<n;k++){
            int tmp=0;
            for(int j=0;j<d;j++){
                tmp += (x[k][j]-x[i][j])*(x[k][j]-x[i][j]);
            }
            if( check(tmp) ){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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


# 整数の入力
n = int(input())

# スペース区切りの整数の入力
a_list = list(map(int, input().split()))

# print(a_list)

result = 0
before_a = 0
for a in a_list:
  # print("---")
  # print(before_a, a)
  diff = before_a - a
  # print(diff)
  if diff < 0:
    pass
    # print("マイナス")
  else:
    result += diff
    a = a + diff

  before_a = a

print(result)


Measured memory_bytes: 32236
X, Y = map(int, input().split())

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)

def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m

def Fac(n, k1, k2):
    t = 1
    kmax = max(k1, k2)
    kmin = min(k1, k2)
    for i in range(1, kmin+1):
        t = t * (kmax+i) * modinv(i, 10**9+7) 
        t = t % (10**9 + 7)
    if n > kmax+kmin:
        for j in range(kmax+kmin+1, n+1):
            t *= j
            t = t % (10**9 + 7)
    return t

s = min(X, Y) - abs(Y - X)

if min(X, Y) - abs(Y - X) < 0:
    print(0)

else:
    if s % 3 != 0:
        ans = 0
    else:
        a = s//3 * 2
        b = abs(Y - X)
        ans = Fac(a+b, a//2, a//2 + b)
        
    print(ans)

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    // info[i] := 文字 ('a' + i) がどの位置にあるか
    // これを各文字について、二分木で持っておく
    vector<set<int>> info(26);
    for(int i = 0; i < n; ++i){
        int id = s[i] - 'a';
        info[id].insert(i);
    }
    
    int q;
    cin >> q;
    for(int i = 0; i < q; ++i){
        int query;
        cin >> query;
        if(query == 1){
            int pos;
            char c;
            cin >> pos >> c;
            --pos;
            if(s[pos] == c)   continue;
            
            info[(s[pos] - 'a')].erase(pos);
            int id = c - 'a';
            info[id].insert(pos);
            s[pos] = c;
        }
        
        else{   //  query == 2
            int left, right;
            cin >> left >> right;
            --left;
            
            int res = 0;
            for(int j = 0; j < 26; ++j){
                auto it = info[j].lower_bound(left);
                if(it == info[j].end())     continue;   // 虚無を指す場合は continue
                
                int pos = *it;
                if(pos < right)     ++res;
            }
            cout << res << "\n";
        }
    }
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string res[] = {"AC x ", "WA x ", "TLE x ", "RE x "};
    int cnt[4] = {};
    int N; cin >> N;
    rep(i, N){
        string S; cin >> S;
        if(S == "AC") cnt[0]++;
        else if(S == "WA") cnt[1]++;
        else if(S == "TLE") cnt[2]++;
        else cnt[3]++;
    }
    rep(i, 4) cout << res[i] << cnt[i] << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#define PI 3.141592653589
using namespace std;
int main(){
   int n;
   cin >>n;
   int a[100];
   for ( int i = 0; i < n; i++ ){
       cin>>a[i];
   }
   for ( int i = 0; i < n; i++ ){
       if (i!=0){cout << " ";}
       cout << a[n-i-1];
   }
   cout << endl;
   return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <sstream>
#include <climits>
#include <fstream>
#include <cmath>

using namespace std;

/// ********* debug template by Bidhan Roy *********

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const unordered_set< T > &v ) {
    os << "[";
    typename unordered_set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const unordered_map< F, S > &v ) {
    os << "[";
    typename unordered_map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    } 
    return os << "]";
}

#define debug(x) cerr << #x << " = " << x << endl;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<bool> VB;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<LL> VLL;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<VB> VVB;
typedef vector<VI> VVI;
typedef vector<VC> VVC;
typedef vector<VLL> VVLL;
typedef vector<VD> VVD;
typedef vector<VS> VVS;

// TEMPLATE DEFINITIONS END

int H, W, N;

void read_input(){
    cin >> H >> W >> N;
}

void solve(){
    cout << N / max(H, W) + ((N % max(H, W)) ? 1 : 0);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    read_input();
    solve();
    return 0;
}


Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
struct food
{
	int id, p, q, r;
	int sum;
	void calc()
	{
		sum = p * 4 + q * 9 + r * 4;
	}
	food(int i, int a, int b, int c)
	{
		p = a;
		q = b;
		r = c;
		id = i;
		calc();
	}
};

int main()
{
	int n;
	while (cin >> n&&n)
	{
		vector<food> v;
		for (int i = 0; i < n; i++)
		{
			int I, P, Q, R;
			cin >> I >> P >> Q >> R;
			v.push_back(food(I, P, Q, R));
		}
		int P, Q, R, C;
		cin >> P >> Q >> R >> C;
		bool flag = true;
		for (int i = 0; i < n; i++)
		{
			if (v[i].p <= P&&v[i].q <= Q&&v[i].r <= R&&v[i].sum <= C)
			{
				cout << v[i].id << endl;
				flag = false;
			}
		}
		if (flag)cout << "NA" << endl;
	}
}

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

int main(){
	char a,b,c,d;
	cin >> a >> b >> c >> d;
	if (a==b && c ==d && b!=c || a==c && b ==d && b!=c|| a==d && b ==c && b!=a)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 int main(void){
    int i;
    char c[1300];
    //scanf("%s",c);
    while(1){
        scanf("%c",&c[i]);
        if(c[i]>=97)printf("%c",toupper(c[i]));
        else printf("%c",tolower(c[i]));
        if(c[i]=='\n')break;
    }
    return 0;
 }

Measured memory_bytes: 524
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;



struct edge { int to, cap, rev; };
vector<edge> G[300];
bool used[300];

void add_edge(int from, int to, int cap) {
	G[from].push_back((edge){to, cap, int(G[to].size())});
	G[to].push_back((edge){from, 0, int(G[from].size()-1)});
}

int dfs(int v, int t, int f) {
	if(v == t) return f;
	used[v] = 1;
	for(int i = 0 ; i < G[v].size(); i++){
		edge &e = G[v][i];
		if(used[e.to] or e.cap <= 0) continue;
		int d = dfs(e.to, t, min(f, e.cap));
		if(d > 0){
			e.cap -= d;
			G[e.to][e.rev].cap += d;
			return d;
		}
	}
	return 0;
}

int ford_fulkerson(int s, int t) {
	int flow = 0, f;
	while(1){
		REP(i,300) used[i]=false;
		f = dfs(s, t, INF);
		if(f == 0) return flow;
		flow += f;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<P> a(n);
	vector<P> b(n);
	REP(i,n) cin>>a[i].first>>a[i].second;
	REP(i,n) cin>>b[i].first>>b[i].second;
	REP(i,n) add_edge(0,1+i,1);
	REP(i,n) add_edge(2*n-i,2*n+1,1);
	REP(i,n) {
		REP(j,n) {
			if(a[i].first<b[j].first&&a[i].second<b[j].second) {
				add_edge(1+i,2*n-j,1);
			}
		}
	}
	cout<<ford_fulkerson(0,2*n+1)<<endl;
}


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

int gcd(int x, int y) {
    if (x == 0) return y;
    if (y == 0) return x;
    return gcd(y, x%y);
}

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

    vector<int> a(n+1);
    a[0] = 0;
    for (int i=1; i < n+1; i++) cin >> a[i];

    vector<int> l(n+2), r(n+2), m(n+1);
    l[0] = 0; r[n+1] = 0; m[0] = 0;
    for (int i=1; i < n+1; i++) l[i] = gcd(l[i-1], a[i-1]);
    for (int i=n; i > 0; i--) r[i] = gcd(r[i+1], a[i]);
    for (int i=1; i < n+1; i++) m[i] = gcd(l[i], r[i+1]);
    cout << *max_element(m.begin(), m.end()) << endl;
}



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

int main()
{
    int N, M;
    cin >> N >> M;
    int A[M];
    long long sum = 0;
    for (int i = 0; i < M; i++)
    {
        cin >> A[i];
        sum += A[i];
    }
    if (N - sum >= 0)
    {
        cout << N - sum << endl;
    }
    else
    {
        cout << "-1" << endl;
    }
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
#define mkp(a, b) make_pair(a, b) 
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;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
	ll n, k;
	cin >> n >> k;
	vll a(n);
	rep(i, 0, n){
		ll aa;
		cin >> aa;
		aa--;
		a.at(i) = aa;
	}
	ll ans = 0;
	while(k > 0){
		if(k & 1) ans = a.at(ans);
		vll na(n);
		rep(i, 0, n) na.at(i) = a.at(a.at(i));
		a.swap(na);
		k >>= 1;
	}
	cout << ans + 1 << endl;
}

Measured memory_bytes: 6728
#include<iostream>
#include<map>
using namespace std;
int N,M;
bool flg;
map<string,bool> used;
int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    string str;
    cin>>str;
    used[str]=true;
  }
  cin>>M;
  for(int i=0;i<M;i++){
    string str;
    cin>>str;
    if(used[str]){
      flg^=true;
      if(flg)cout<<"Opened by ";
      else cout<<"Closed by ";
    }else{
      cout<<"Unknown ";
    }
    cout<<str<<endl;
  }
  return 0;
}

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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

int cnt = 0;

void solve()
{
	int n; cin >> n;
	vector<ll> a(n);
	forn(i, n) cin >> a[i];
	ll count = accumulate(all(a), 0LL);
	ll div = count / 2LL;
	ll sum = 0, res = 1e18 + 7;
	for (int i = 0; i < n; ++i)
	{
		sum += a[i];
		res = min(res, abs(count - 2LL * sum));
	}
	cout << res << endl;
}

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


Measured memory_bytes: 4748