akhauriyash/Code-Regression huggingface dataset:
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(int n)
    {
        for (int i = 1; i <= n; i++)
        {
            var w1 = i * 1.08d;
            var w2 = (int)w1;
            if (w2 == n) { Console.WriteLine(i); return; }
        }
        Console.WriteLine(":(");
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;



void solve(){
  ll n;
  cin >> n;
  int a[n];
  for(int i = 0;i < n;i++){
    a[i] = i+1;
  }
  ll p[n], q[n];
  for(int i = 0;i < n;i++){
    int t;
    cin >> t;
    p[i] = t;
  }
  for(int i = 0;i < n;i++){
    int t;
    cin >> t;
    q[i] = t;
  }
  ll c,b;
  ll i = 0;
  do{

    int pc = 0, qc = 0;
    for(int i = 0; i < n;i++){
      if(a[i] == p[i]) pc++; 
      if(a[i] == q[i]) qc++;
    }
    if(pc == n) c = i;
    if(qc == n) b = i;
  i++;
  }while(next_permutation(a,a+n));

  cout << abs(c-b) << endl;


}

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


Measured memory_bytes: 256
<?php
$time = array();
for ($i = 0; $i < 3; $i++) {
	for ($j = 0; $j < 8; $j++) {
		list($ind, $t) = explode(' ', trim(fgets(STDIN)));
		$time[$i][] = array('index' => $ind, 'time' => $t);
	}
	usort($time[$i], function($a, $b){
		return $a['time'] >= $b['time'] ? 1 : -1;
	});
	echo $time[$i][0]['index'] . " " . $time[$i][0]['time'] . "\n";
	echo $time[$i][1]['index'] . " " . $time[$i][1]['time'] . "\n";

}

$rest = array();
for ($i = 0; $i < 3; $i++) {
	unset($time[$i][0]);
	unset($time[$i][1]);
	$rest = array_merge($rest, $time[$i]);
}

usort($rest, function($a, $b){
	return $a['time'] >= $b['time'] ? 1 : -1;
});

echo $rest[0]['index'] . " " . $rest[0]['time'] . "\n";
echo $rest[1]['index'] . " " . $rest[1]['time'] . "\n";



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

using namespace std;

int main(){
    string S;
    cin >> S;
    map<char,int> mp;
    for(int i=0;i<S.size();i++){
        mp[S[i]]++;
    }

    for(int i=0;i<S.size();i++){
        if(mp[S[i]]!=2){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl; 
}

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

int main()
{
  int n, k;
  cin >> n >> k;
  
  int sum = 0;
  int tmp;
  for (int i = 0; i < n; i ++)
  {
    cin >> tmp;
    if (tmp >= k) sum ++;
  }
  
  cout << sum << endl;
  return 0;
}

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

int main(){
  int A, B ,K;
  cin >> A >> B >> K;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() 
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
	    cin>>a[i];
	}
	int dp[n];
	dp[0]=0;
	for(int i=1;i<n;i++)
	{
	    dp[i]=INT_MAX;
	}
	for(int i=0;i<n;i++)
	{
	    for(int j=1;j<=k;j++)
	    {
	        if(i+j<n)
	        {
	            //cout<<dp[i+j]<<" ";
	            dp[i+j]=min(dp[i+j],dp[i]+abs(a[i+j]-a[i]));
	            //cout<<dp[i+j]<<endl;
	        }
	    }
	}
	cout<<dp[n-1];
	/*for(int i=0;i<n;i++)
	{
	    cout<<a[i]<<" ";
	}*/
	return 0;
}









Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
int a,b;
cin>>a>>b;
int c[a]={0};
for(int i=0;i<a;i++)  cin>>c[i];
sort(c,c+a);
int sum=0;
for(int i=a-1;i>=a-b;i--){
	sum+=c[i];
}
cout<<sum;
}

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

int main() {
    string s;
    cin >> s;
    int a = stoi(s.substr(0, 2));
    int b = stoi(s.substr(2, 2));

    if (1 <= a && a <= 12 && 1 <= b && b <= 12) cout << "AMBIGUOUS" << endl;
    else if (1 <= a && a <= 12) cout << "MMYY" << endl;
    else if (1 <= b && b <= 12) cout << "YYMM" << endl;
    else cout << "NA" << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))
cost = [0 for i in range(N)]
         
cost[1] = abs(h[1]-h[0])
         
for i in range(2,N):
    cost[i] = min(cost[i-1]+abs(h[i]-h[i-1]),cost[i-2]+abs(h[i]-h[i-2]))
print(cost[-1])

Measured memory_bytes: 13980
'''
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split(' '))))
num_sum = 0
remove_array = np.array([], int)
for i in range(N):
    c1 = np.count_nonzero(A == i + 1)
    c2 = np.count_nonzero(A == A[i])
    if c2 <= 1:
        remove_array = np.append(remove_array, 0) ←　appendがネックになってる？
    else:
        remove_array = np.append(remove_array, c2 - 1)
    num_sum += int(c1 * (c1 - 1) / 2)
print(*(num_sum - remove_array), sep='\n')
'''
import collections
N = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A) # リストやイテレータから値の出現回数をカウントできる（出力は辞書型）
total = 0
for key in cnt.keys():
    total += cnt[key] * (cnt[key] - 1) // 2
for i in range(N):
    tmp = total
    print(tmp - (cnt[A[i]] - 1))
#    tmp -= cnt[A[i]] * (cnt[A[i]] - 1) // 2
#    tmp += (cnt[A[i]] - 1) * (cnt[A[i]] - 2) // 2

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

using namespace std;

typedef long long ll;
const double eps=1e-6,pi=acos(-1);
const int N=1e5+5,M=1e9+7,SEGM=4*N,OO=0x3f3f3f3f;
int n,m,a[N],b[N],c[N];
int mem[N][5];

int solve(int i=0,int bk=0){
    if(i==n) return 0;
    int &ret=mem[i][bk];
    if(~ret) return ret;
    if(bk!=1)
        ret=max(ret,solve(i+1,1)+a[i]);
    if(bk!=2)
        ret=max(ret,solve(i+1,2)+b[i]);
    if(bk!=3)
        ret=max(ret,solve(i+1,3)+c[i]);
    return ret;
}

int main(){
    //freopen("myfile.txt","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;++i)
        scanf("%d%d%d",a+i,b+i,c+i);
    memset(mem,-1,sizeof mem);
    printf("%d",solve());
    return 0;
}


Measured memory_bytes: 13152
#define _USE_MATH_DEFINES
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define MOD 1000000007
typedef long long int LL;
typedef pair<int,int> P;

int dp[100010][13];
int inf[] = {0,10,7,4,1,11,8,5,2,12,9,6,3};

int main() {
	string s;
	cin >> s;
	if(s[0]!='?') {
		dp[0][s[0]-'0'] = 1;
	} else {
		for(int j = 0;j < 10;j++)
			dp[0][j] = 1;
	}
	for(int i = 1;i < s.size();i++) {
		char c = s[i];
		if(c!='?') {
			int t = c - '0';
			for(int j = 0;j < 13;j++) {
				dp[i][(inf[j]+t)%13] = dp[i-1][j];
			}
		} else {
			for(int t = 0;t < 10;t++) {
				for(int j = 0;j < 13;j++) {
					dp[i][(inf[j]+t)%13] += dp[i-1][j];
					dp[i][(inf[j]+t)%13] %= MOD;
				}
			}
		}
	}
	cout << dp[s.size()-1][5] << endl;
	return 0;
}

Measured memory_bytes: 5504
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
	private static final FastIn in = new FastIn();
	private static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Solution().solve();
		out.close();
	}

	private static final class Solution {
		public void solve() {
			int n = in.nextInt();
			int[] a = new int[n];
			for (int i = 0; i < n; ++i)
				a[i] = in.nextInt();
			ArrayList<Integer> primes = IntStream.of(new int[] { 2, 3, 5, 7, 11, 13 }).boxed()
					.collect(Collectors.toCollection(ArrayList::new));
			for (int i = 17; i < 1000000; i += 2) {
				boolean ok = true;
				for (int j = 0; primes.get(j) * primes.get(j) <= i; ++j)
					if (i % primes.get(j) == 0) {
						ok = false;
						break;
					}
				if (ok)
					primes.add(i);
			}
			HashMap<Integer, Integer> cnt = new HashMap<>();
			for (int i : a) {
				int t = i;
				for (int j = 0; primes.get(j) * primes.get(j) <= t; ++j) {
					if (t % primes.get(j) == 0)
						cnt.put(primes.get(j), cnt.getOrDefault(primes.get(j), 0) + 1);
					while (t % primes.get(j) == 0)
						t /= primes.get(j);
				}
				if (t != 1)
					cnt.put(t, cnt.getOrDefault(t, 0) + 1);
			}
			int large = 0;
			for (int key : cnt.keySet()) {
				large = Math.max(large, cnt.get(key));
			}
			if (large <= 1) {
				out.println("pairwise coprime");
			} else {
				out.println(large < n ? "setwise coprime" : "not coprime");
			}
		}
	}

	private static final class FastIn {
		private BufferedReader br;
		private StringTokenizer st;

		public FastIn() {
			br = new BufferedReader(new InputStreamReader(System.in), 1 << 20);
			st = null;
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


Measured memory_bytes: 85404
#include<bits/stdc++.h>
using namespace std;
int a,b,c,k;
int main()
{
	cin>>a>>b>>c;
	if(a==1)
	{
		cout<<"YES"<<endl;
		return 0; 
	}
	for(int i=1;i<=100;i++)
	{
		k=i*a;
		if(k%b==c)
		{
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a =in.nextInt();
        int b =in.nextInt();
        int c =in.nextInt();
        int[] aa=new int[3];
        aa[0]=a;
        aa[1]=b;
        aa[2]=c;
        Arrays.sort(aa);
        if(aa[0]==aa[1]&&aa[2]>aa[0]){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
}


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

int main()
{
    int h,w,i,j;
    while(true){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        char o = '#';
        for(i = 0; i <h; i++){
            for(j = 0; j < w; j++){
                cout << o;
                if(j == 0 ) o = '.';
                if(j == w-2 || i == 0 || i == h-1) o = '#';
            }
            cout << '\n';
        }
        cout << endl;
    }
}

Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

using namespace std;

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;

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

void dfs(VVI &table, int i, int j) {
    table[i][j] = 0;
    for (int loop = 0; loop < 8; loop++) {
        int new_i = i + dy[loop];
        int new_j = j + dx[loop];
        if (table[new_i][new_j] == 1) {
            dfs(table, new_i, new_j);
        }
    }
    return;
}

int main(void) {
    while(true) {
        int w;
        int h;
        cin >> w >> h;
        if (w == 0 && h == 0) {
            break;
        }
        VVI table(h + 2, VI(w + 2, 0));
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                cin >> table[i][j];
            }
        }
        int number = 0;
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                if (table[i][j] == 1) {
                    dfs(table, i, j);
                    number++;
                }
            }
        }
        cout << number << endl;
    }
    return 0;
}

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        long K = sc.nextLong();
        sc.close();

        if (K - A < 0) {
            System.out.println(K);
        } else if (K - (A + B) < 0) {
            System.out.println(A);
        } else {
            System.out.println(A - (K - (A + B)));
        }
    }
}


Measured memory_bytes: 35756
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

signed main(){
	int a,b;
	cin>>a>>b;
	cout<<6-a-b<<endl;


	return 0;
}



Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++)
#define all(vecto) vecto.begin(),vecto.end()
typedef long long ll;

bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; 

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
            return false;
    }
    return true;
}

int main(){
    int x;
    cin >> x;
    while(IsPrime(x)==false){
        x++;
    }
    cout << x << endl;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        int[] input = new int[5];
        for (int i = 0; i < 5; i++)
        {
            input[i] = int.Parse(ReadLine());
        }

        int minIndex = 0;
        int min = 10;
        for (int i = 0; i < 5; i++)
        {
            int amari = input[i] % 10;
            if (amari != 0 && amari < min)
            {
                min = amari;
                minIndex = i;
            }
        }

        int result = 0;
        for (int i = 0; i < 5; i++)
        {
            if (i == minIndex)
            {
                result += input[i];
            }
            else if (input[i] % 10 == 0)
            {
                result += input[i];
            }
            else
            {
                result += input[i] / 10 * 10 + 10;
            }
        }
        WriteLine(result);
        ReadKey();
    }
}

Measured memory_bytes: 13140
from collections import defaultdict
from functools import lru_cache

N = input().strip()
K = int(input().strip())
lenN = len(N)

#memo = defaultdict(lambda :defaultdict(lambda :defaultdict(int)))
@lru_cache(maxsize=None)
def f(keta, flag, k):
    if keta == lenN-1:
        if k == K:
            return 1
        else:
            return 0
    #if keta in memo and flag in memo[keta] and k in memo[keta][flag]:
    #    return memo[keta][flag][k]
    nketa = keta + 1
    maxi = int(N[nketa]) if flag else 9
    res = 0
    for i in range(maxi+1):
        nflag = flag and (int(N[nketa]) == i)
        nk = k if i == 0 else k + 1
        if nk > K:
            continue
        res += f(nketa, nflag, nk)
    #memo[keta][flag][k] = res
    return res

print(f(-1, True, 0))


Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long

using namespace std;

int g[110][110];

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-48,ch=getchar();
  return q*x;
}

int main(){
  RG int h=gi(),w=gi(),n=gi(),x=1,y=0,a;
  for (RG int i=1;i<=n;++i){
    a=gi();
    for (RG int j=1;j<=a;++j){
      if (x&1) ++y; else --y;
      if (y>w) ++x,y=w;
      if (y==0) ++x,y=1;
      g[x][y]=i;
    }
  }
  for (RG int i=1;i<=h;++i){
    for (RG int j=1;j<=w;++j) printf("%d ",g[i][j]);
    puts("");
  }
  return 0;
}


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

#define mod 1000000007

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long int
#define vi vector<int>
#define vli vector<long int>
#define vlli vector<long long int >
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)

#define fr(i, a, b) for(i=a; i<=b; i++)
#define frr(i,a,b) for(i=a;i<b;i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define fbb(i,a,b) for(i=a;i>b;i--)

#define pr_vec(i,a,b,v) for(i=a;i<b;i++) cout<<v[i]<<" ";
#define in_arr(i,n,v) for(i=0;i<n;i++) cin>>v[i];
int gcd(int a,int b){
    if(a<b) swap(a,b);
    if(b==0) return a;
   
    else return gcd(a%b,b);
 }
 bool f1(ll x,ll y){
    return x>y;
 }
 
int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    */
   int a,b;
    cin>>a>>b;
    int ans;
    if(a>=6&&a<=12) ans=b/2;
    else if(a>=13)  ans=b;
    else if(a<=5&&a>=0) ans=0;
    cout<<ans<<endl;

    return 0;
 }

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(S: str):
    return 700 + 100 * Counter(S)['o']


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    result = solve(S)
    if isinstance(result, Iterable):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}

int main() {
    int n;
    cin >> n;
    vector<int> cnt(n);
    rep(i, n - 1) {
        int a;
        cin >> a;
        a--;
        cnt[a]++;
    }
    rep(i, n) cout << cnt[i] << endl;
}

Measured memory_bytes: 4052
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int h = scan.nextInt();

        Integer[] a = new Integer[n];
        Integer[] b = new Integer[n];
        for(int i=0; i<n; i++){
            a[i] = scan.nextInt();
            b[i] = scan.nextInt();
        }

        Arrays.sort(a, Collections.reverseOrder());
        Arrays.sort(b, Collections.reverseOrder());

        int sum = 0;
        int cnt = 0;
        for(int i=0; i<n; i++){
            if(b[i] < a[0]){
                break;
            }
            sum += b[i];
            cnt++;
            if(sum >= h) break;
        }
        while(sum < h){
            sum += a[0];
            cnt++;
        }
        

        System.out.println(cnt);

        scan.close();
        
    }
}

Measured memory_bytes: 92852
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n;cin>>n;
  vl a(n),b(n),c(n);
  rep(i,n)cin>>a[i]>>b[i]>>c[i];
  ll dp[100010][3];
  dp[0][0]=0;
  dp[0][1]=0;
  dp[0][2]=0;
  for(ll i=1;i<=n;i++){
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i-1];
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i-1];
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i-1];
  }
  cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<endl;
}

Measured memory_bytes: 4992
N,M = map(int,input().split())



cnt = 0
i = 0
j = M
while i+1 < j and cnt < M:
    print(i+1, j)
    i += 1
    j -= 1
    cnt += 1

i = M
j = 2*M+1
while i+1 < j and cnt < M:
    print(i+1, j)
    i += 1
    j -= 1
    cnt += 1

Measured memory_bytes: 9280
S = input()

cnt = 0

#S[0]=0
for i in range(len(S)):
    if i%2 == 0 and S[i] == '1':
        cnt += 1
    elif i%2 == 1 and S[i] == '0':
        cnt += 1

cnt2 = 0
 #S[0]=1
for i in range(len(S)):
    if i%2 == 0 and S[i] == '0':
        cnt2 += 1
    elif i%2 == 1 and S[i] == '1':
        cnt2 += 1

print(min(cnt,cnt2))

Measured memory_bytes: 3188
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    long ans = S.length;
    ans -= 2;
    while (S[0 .. ans / 2] != S[ans / 2 .. ans])
        ans -= 2;
    writeln(ans);
}


Measured memory_bytes: 256
from bisect import bisect_left

N = int(raw_input())
L = map(int, raw_input().split())

L.sort()
result = 0
for i in xrange(N-2):
    a = L[i]
    for j in xrange(i+1, N-1):
        b = L[j]
        k = bisect_left(L, a + b, j + 1)
        result += k - (j + 1)
print result


Measured memory_bytes: 2688
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    string s; cin >> s;

    rep(i, s.size()){
        int temp = s[i];
        temp = 65 + (temp - 65 + n) % 26;
        s[i] = (char)temp;
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define INF 100100100
int main(void){
	int n,m;
	int l,r,d;
	signed x[100100]={0};
	int list[500100]={0};
	int node[500100];
	int stack[500100]={0};
	int slast=0;
	signed cost[500100];
	int i;
	int llast=0;
	scanf("%d%d",&n,&m);
	llast=n+1;
	for(i=0;i<m;i++){
		scanf("%d%d%d",&l,&r,&d);
		list[llast]=list[l];
		list[l]=llast;
		node[llast]=r;
		cost[llast]=d;
		llast++;
		list[llast]=list[r];
		list[r]=llast;
		node[llast]=l;
		cost[llast]=-d;
		llast++;
	}
	for(i=0;i<=n;i++){
		x[i]=INF;
	}
	int flg=0,look,p;
	i=1;
	while(i<=n){
		x[i]=1;
		stack[0]=i;
		slast=1;
		while(slast){
			slast--;
			look=stack[slast];
			p=list[look];
			while(p){
				if(x[node[p]]==INF){
					x[node[p]]=x[look]+cost[p];
					stack[slast]=node[p];
					slast++;
				}else{
					if(x[node[p]]!=x[look]+cost[p]) flg=1;
				}
				p=list[p];
			}
		}
		while(i<=n&&x[i]!=INF) i++;
	}
	if(flg){
		puts("No");
	}else{
		puts("Yes");
	}
	return 0;
}



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

using namespace std;
#define ll long long
#define endl '\n'
int main()
{
  map<string,string>m;
  m["Sunny"]="Cloudy";
  m["Cloudy"]="Rainy";
  m["Rainy"]="Sunny";
  string s;
  cin>>s;
  cout<<m[s]<<endl;
  
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int ctoi(const char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return -1;
	}
}
int keta(int a) {
	return to_string(a).size();
}
vector<string>a;
signed main(){
	string s;
	int k;
	cin>>s>>k;
	rep(i,s.size()){
		Rep(j,5){
			if(i+j<s.size()+1){
				a.push_back(s.substr(i,j));
			}
		}
	}
	sort(a.begin(),a.end());
	unique(a.begin(),a.end());
	cout<<a[k-1]<<endl;
}




Measured memory_bytes: 1660
#include <cstdio>
int N;
int F[100][14];
int P[100][15];
int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 10; j++) scanf("%d", &F[i][j]);
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 11; j++) scanf("%d", &P[i][j]);
    }
    int res = -(1<<30);
    for (int b = 1; b < (1 << 10); b++) {
        int cc = 0;
        for (int i = 0; i < N; i++) {
            int c = 0;
            for (int j = 0; j < 10; j ++) {
                if ((b>>j & 1) and F[i][j]) c++;
            }
            cc += P[i][c];
        }
        if (res < cc ) res = cc;
    }
    printf("%d\n", res);
}



Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	string s, t; cin >> s >> t;
	int ans = 0;
	for (int i = 0; i <= (int)s.length() - 1; i++) if (s[i] != t[i]) ans++;
	cout << ans;

	return 0;
}

Measured memory_bytes: 3884
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

using namespace std;

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

int main(void) {
  int n, m;
  cin >> n >> m;
  vector<int> hs(n);
  rep(i, n) cin >> hs[i];

  
  vector<vector<int> > tbl(n);

  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    tbl.at(a).push_back(b);
    tbl.at(b).push_back(a);
  }

  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (tbl.at(i).size() == 0) {
      cnt++;
    }
    else {
      bool good = true;
      for (int j = 0; j < tbl.at(i).size(); j++) {
        if (hs.at(i) <= hs.at(tbl.at(i).at(j))) {
          good = false;
        }
      }
      if (good) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 8804
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;


namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;

        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }

            var res = line[index];
            index++;
            return res;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public ulong NextUlong()
        {
            return ulong.Parse(Next());
        }

        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }

        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }

        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }

        public decimal[] DecimalArray()
        {
            var array = Array();
            var result = new decimal[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = decimal.Parse(array[i]);
            }

            return result;
        }
    }

    class Program
    {
        private int N;
        private decimal[] P;
        void Scan()
        {
            var sc = new Scanner();
            N = sc.NextInt();
            P = sc.DecimalArray();
        }

        public void Solve()
        {
            Scan();
            var dp = new decimal[N + 1, N + 1];
            dp[0, 0] = 1;
            for (int i = 1; i <= N; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    decimal res = 0;
                    if (j > 0)
                    {
                        res += dp[i - 1, j - 1] * P[i - 1];
                    }

                    res += dp[i - 1, j] * (1 - P[i - 1]);
                    dp[i, j] = res;
                }
            }

            decimal ans = 0;
            for (int i = N / 2 + 1; i <= N; i++)
            {
                ans += dp[N, i];
            }
            Console.WriteLine(ans);
        }




        static void Main() => new Program().Solve();
    }


}

Measured memory_bytes: 152544
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	string s, t; cin>>s>>t; int ans =0;

	for(int i=0 , n= s.size() ;i<n; ++i)
	{
		if(s[i] != t[i]) ans++;
	}
	cout<<ans<<endl;

}






Measured memory_bytes: 3788
#include<stdio.h>

int main(){
	int i,j,t,data[10];
	
	for(i=0;i<10;i++)
	{
		scanf("%d",&data[i]);
	}
	
	for(i=0;i<9;i++)
	{
		for(j=0;j<9-i;j++)
		{
			if(data[j]<data[j+1])
			{
				t=data[j];
				data[j]=data[j+1];
				data[j+1]=t;
			}
		}
	}
	for(i=0;i<3;i++)
	{
		printf("%d\n",data[i]);
	}

    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	ll c=1;
	ll ans=0;
	while(1){
		if(c>=b){
			cout<<ans<<endl;
			return 0;
		}
		c+=(a-1);
		ans++;
	}
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int plan1 = A * N;
        int plan2 = B;
        
        if(plan1 > plan2){
            System.out.println(plan2);
        } else {
            System.out.println(plan1);
        }
        
        sc.close();
        
    }
}


Measured memory_bytes: 20948
package main

import (
	"bufio"
	"fmt"
	"os"
)

type testimony struct {
	x int
	y int
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	var a, x, y int
	ts := make([][]testimony, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &a)
		testimonies := make([]testimony, a)
		for j := 0; j < a; j++ {
			fmt.Fscan(r, &x)
			fmt.Fscan(r, &y)
			testimonies[j] = testimony{x, y}
		}
		ts[i] = testimonies
	}

	ans := 0
	// bitで網羅してみる
	for i := 0; i < (1 << uint(n)); i++ {
		flg := true
		for j := 0; j < n; j++ {
			// 証言者が正直者かどうか
			honest := i>>uint(j)&1 == 1
			if !honest {
				// 不親切な人ならば証言のチェックはしない
				continue
			}
			for _, t := range ts[j] {
				if i>>uint(t.x-1)&1 != t.y {
					// 正直者の言う通りでなければまちがい
					flg = false
					break
				}
			}

			if !flg {
				break
			}
		}
		if flg {
			count := 0
			for j := 0; j < n; j++ {
				count += i >> uint(j) & 1
			}

			ans = max(ans, count)
		}
	}

	fmt.Println(ans)
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

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

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}

int main(){
    // 前処理
    COMinit();
    ll n;
    int a,b;
    cin >> n >> a >> b;
    ll ans;
    ans = RepeatSquaring(2,n,1000000007);
    ll comA=1,comB=1;
    for(int i=0;i<a;i++){
        comA = ((comA * (n-i))%MOD)*inv[i+1]%MOD;
    }
    for(int i=0;i<b;i++){
        comB = ((comB * (n-i))%MOD)*inv[i+1]%MOD;
    }
    // 2^n - nCa - nCb - 1
    cout << (((ans - comA + MOD)%MOD - comB +MOD)%MOD - 1 + MOD)%MOD  << endl;
    return 0;
}

Measured memory_bytes: 12160
#include <iostream>
using namespace std;
int main(){
  int n,m[101],p[101][100],k,l[100],i,j,b,a,cnt[101],max,who,flag;
  while(1){
    max=0;
    cin >> n;
    if(n==0) break;
    for(i=1;i<=n;i++){
      cin >> m[i];
      for(j=0;j<m[i];j++){
    cin >> p[i][j];
      }
    }
    cin >> k;
    for(i=0;i<k;i++){
      cin >> l[i];
    }
    for(i=1;i<=n;i++){
      for(j=0;j<m[i];j++){
    for(b=1;b<m[i];b++){
      if(p[i][b]<p[i][b-1]) swap(p[i][b],p[i][b-1]);
    }
      }
    }
    for(i=0;i<=k;i++){
      for(j=1;j<k;j++){
    if(l[j]<l[j-1])  swap(l[j],l[j-1]);
      }
    }
    for(i=1;i<=n;i++){
      cnt[i]=0;
      for(j=0;j<m[i];j++){
    for(a=0;a<k;a++){
      if(l[a]==p[i][j]){
        cnt[i]++;
      }
    }
      }
      if(cnt[i]>max) max=cnt[i];
    }
    who=0;
    flag=0;
    for(i=1;i<=n;i++){
    if(flag==0&&cnt[i]==max){
      who=i;
      flag=1;
    }
    else if(flag==1&&cnt[i]==max){
      flag=2;
      break;
    }
      if(flag==2) break;
    }
    if(max<k) cout << -1 << endl;
    else if(flag==1) cout << who << endl;
    else if(flag==2) cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;


signed main(){
  int H,W;cin>>H>>W;
  vector<string> ans;
  string S;
  REP(i,0,H){
    cin>>S;
    ans.pb(S);
    ans.pb(S);
  }
  each(s,ans){
    print(s);
  }


}


Measured memory_bytes: 256
#include <stdio.h>

int ztc(int a)
{
  if(a>=0) return a;
  else return -a;
}
int gcd(int a, int b)
{
  if(b == 0) return ztc(a);
  return gcd(b, a%b);
}

int main()
{
  int a,b;
  scanf("%d%d", &a, &b);
  printf("%d\n", gcd(a,b));
  
  return 0;
}





Measured memory_bytes: 2128
//                                    ∴In the name of God∴
//                     ✫✗⚡😳😳😄😄😝😝😁😁😎😎😛😛😄😄😮😮⚡✗✫
//                                       H.Pouya  ◠?◠
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<vector>
#include<math.h>
#include<bitset>
#include<iostream>
#include<algorithm>
using namespace std;
typedef short int ss;
typedef long double dd;
typedef long long int ll;
#define give_up return 0;
#define mix(x,y) x*pow(10,y)+10
const int maxn=mix(1,6);
int main()
{
    int r,d,x,i=10;
    cin>>r>>d>>x;
    while(i--)
    {
        x=r*x-d;
        cout<<x<<endl;
    }
    give_up
}
//  🙄


Measured memory_bytes: 256
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MOD 998244353
#define MAX 100100
#define NIL -1
//#define INFTY 1000000000000000000

LL n;
vector<vector<LL>> p(MAX);
vector<LL> dist(MAX, NIL);
vector<LL> dist_black(MAX);
vector<LL> dist_white(MAX);

void dfs(LL x, LL d){
    for(LL i=0; i<p[x].size(); i++){
        if(dist[p[x][i]]==NIL){
            dist[p[x][i]]=d;
            dfs(p[x][i], d+1);
        }
    }
}

int main(){
    cin >> n;
    LL a;
    LL b;
    for(LL i=0; i<n-1; i++){
        cin >> a >> b;
        a--;
        b--;
        p[a].push_back(b);
        p[b].push_back(a);
    }

    dist[0]=0;
    dfs(0, 1);
    for(LL i=0; i<n; i++){
        dist_black[i]=dist[i];
        dist[i]=NIL;
    }
    dist[n-1]=0;
    dfs(n-1, 1);
    for(LL i=0; i<n; i++){
        dist_white[i]=dist[i];
    }
    LL ans=0;
    for(LL i=0; i<n; i++){
        if(dist_black[i]<=dist_white[i]){
            ans++;
        }else{
            ans--;
        }
    }
    if(ans>0){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }

    return 0;
}


Measured memory_bytes: 17140
n=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print("0")
else:
    pro=1
    flag=0
    for i in range(n):
        pro*=A[i]
        if pro>10**18:
            flag=1
            print("-1")
            break
    if flag==0:
        print(pro)


Measured memory_bytes: 21632