akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<" "<<x<<endl;

using namespace std;
ll power(ll x, ll y) 
{ 
    ll res = 1;     // Initialize result 
   
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = res*x; 
   		  res%=mod;
        // y must be even now 
        y = y>>1; // y = y/2 
        x = x*x;  // Change x to x^2
        x%=mod; 
    } 
    return res%mod; 
}	
void run(){
	string a,b;
	cin>>a>>b;
	ll x=a.length();
	ll y=b.length();
	ll mino=y;
	for(ll i=0;i<=x-y;i++){
		ll c=0;
		ll f=i;
		for(ll j=f;j<f+y;j++){
			
			if(a[j]!=b[j-f])c++;
		}
		mino=min(mino,c);
	}
	cout<<mino<<endl;
	
	
}

int main() {
	int t=1;
	//cin>>t;
	for(ll i=0;i<t;i++){
	run();
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3600
n,k=map(int, input().split())
ab=[]
for i in range(n):
    a,b=map(int, input().split())
    ab.append((a,b))
ab.sort()
p=0
for i in range(n):
    if k <= p+ab[i][1]:
        print(ab[i][0])
        break
    else:
        p+=ab[i][1]

Measured memory_bytes: 22708
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    long long n; cin>>n;
    long long a[n]; rep(i,n) cin>>a[i];
    long long b[n]; rep(i,n) cin>>b[i];
    long long plus=0,minus=0,ans=n;
    priority_queue<long long,vector<long long>> pq;
    rep(i,n){
        if(a[i]-b[i]>0){
            plus+=a[i]-b[i];
            pq.push(a[i]-b[i]);
        }
        else if(a[i]-b[i]<0){
            minus+=b[i]-a[i];
        }else{
            ans--;
        }
    }
    if(plus-minus<0){
        cout<<-1<<endl;
        return 0;
    }
    while(pq.size()&&minus>0){
        auto x=pq.top(); pq.pop();
        minus-=x;
    }
    ans-=pq.size();
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> t(N), d(N);
  for (int i = 0; i < N; i++) {
    cin >> t[i] >> d[i];
    t[i]--;
  }

  vector<pair<ll, int>> A(N);
  for (int i = 0; i < N; i++) {
    A[i] = make_pair(d[i], t[i]);
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  ll x = 0, y = 0;
  vector<bool> used(N);
  priority_queue<ll, vector<ll>, greater<ll>> que;
  for (int i = 0; i < K; i++) {
    y += A[i].first;
    if (!used[A[i].second]) {
      x++;
      used[A[i].second] = true;
    } else {
      que.push(A[i].first);
    }
  }
  ll ans = y + x * x;
  for (int i = K; i < N && !que.empty(); i++) {
    if (used[A[i].second]) continue;
    y -= que.top();
    que.pop();
    y += A[i].first;
    x++;
    used[A[i].second] = true;
    ans = max(ans, y + x * x);
  }
  cout << ans << endl;
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;

  const ll MOD = 1e9 + 7;
  ll ans = 1;
  REP(i, N) {
    ans *= (i + 1);
    ans %= MOD;
  }

  cout << ans % MOD << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
int main(void){
    char c;
    do{
        c=getchar();
        if(isalpha(c)){
            if(isupper(c)) printf("%c",tolower(c));
            else printf("%c",toupper(c));
        }
        else printf("%c",c);
    }while(c!='\n');

    return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <map>

using namespace std;

int main(int argc, const char * argv[]) {

    string s;
    cin >> s;
    
    if(s[s.length() - 1] == '0' || s[s.length() - 1] == '1' || s[s.length() - 1] == '6' || s[s.length() - 1] == '8')
    {
        cout << "pon" << endl;
    } else if(s[s.length() - 1] == '2' || s[s.length() - 1] == '4' || s[s.length() - 1] == '5' || s[s.length() - 1] == '7'|| s[s.length() - 1] == '9')
    {
        cout << "hon" << endl;
    } else if (s[s.length() - 1] == '3')
    {
        cout << "bon" << endl;
    }
    
    return 0;
    
    
    
}


Measured memory_bytes: 3624
package main

import (
	"fmt"
	"math"
)

var (
	n int
	h []int
	dp []int
)

func solve(idx int) int {
	if dp[idx] != -1 {
		return dp[idx]
	}

	if idx == 0 {
		dp[idx] = 0
	} else if idx == 1 {
		dp[idx] = int(math.Abs(float64(h[idx] - h[idx-1])))
	} else {
		var (
			c1, c2 int
		)
		c1 = solve(idx - 1) + int(math.Abs(float64(h[idx] - h[idx-1])))
		c2 = solve(idx - 2) + int(math.Abs(float64(h[idx] - h[idx-2])))

		dp[idx] = int(math.Min(float64(c1), float64(c2)))
	}

	return dp[idx]
}

func main() {
	fmt.Scan(&n)
	h = make([]int, n)
	dp = make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}

	for i := 0; i < n; i++ {
		dp[i] = -1
	}

	//fmt.Println(h)

	var ans int = solve(n-1)
	fmt.Println(ans)
}

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

int main()
{
    int n;
    cin >> n;
    ll ans = 1;
    bool ng = false;
    rep(i, n)
    {
        ll a;
        cin >> a;
        if (a == 0)
        {
            cout << 0 << endl;
            return 0;
        }
        if (ng || a > 1000000000000000000 / ans)
        {
            ng = true;
        }
        else
        {
            ans *= a;
        }
    }
    if (ng)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
import collections

N,K=map(int,input().split())
A=list(map(int,input().split()))
L=collections.Counter(A)
values,counts=zip(*L.most_common())
counts=list(counts)

Colors=len(counts)
Change=0
while Colors>K:
    Change+=counts[-1]
    counts.pop()
    Colors-=1

print(Change)

Measured memory_bytes: 53680
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 998244353;

void add(int& x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}

void subtract(int& x, int y) {
  x = x + MOD - y;
  if (x >= MOD) x -= MOD;
}

int64 power_mod(int64 a, int n) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
  }
  return ret;
}

const int N = 2e5 + 10;
int c[N];

void add(int x) {
  for (; x < N; x += x & -x) {
    c[x]++;
  }
}

int query(int x) {
  int ret = 0;
  for (; x; x -= x & -x) {
    ret += c[x];
  }
  return ret;
}

int main() {
  int n;
  scanf("%d", &n);
  vector<ii> a(n);
  vector<int> X, Y;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &a[i].first, &a[i].second);
    X.push_back(a[i].first);
    Y.push_back(a[i].second);
  }
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());
  for (int i = 0; i < n; ++i) {
    a[i].first = lower_bound(X.begin(), X.end(), a[i].first) - X.begin();
    a[i].second = lower_bound(Y.begin(), Y.end(), a[i].second) - Y.begin();
  }
  int all = power_mod(2, n);
  subtract(all, 1);
  vector<int> ret(n);
  for (int i = 0; i < n; ++i) {
    ret[i] = power_mod(2, a[i].first);
    add(ret[i], power_mod(2, n - 1 - a[i].first));
    add(ret[i], power_mod(2, a[i].second));
    add(ret[i], power_mod(2, n - 1 - a[i].second));
  }
  sort(a.begin(), a.end());
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; ++i) {
    int cnt = query(a[i].second + 1);
    add(a[i].second + 1);
    subtract(ret[i], power_mod(2, cnt));
    subtract(ret[i], power_mod(2, i - cnt));
  }
  sort(a.begin(), a.end(), greater<ii>());
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; ++i) {
    int cnt = query(a[i].second + 1);
    add(a[i].second + 1);
    subtract(ret[i], power_mod(2, cnt));
    subtract(ret[i], power_mod(2, i - cnt));
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ret[i] = (all + MOD - ret[i]) % MOD;
    add(ans, ret[i]);
  }
  printf("%d\n", ans);
  return 0;
}


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

const int MAXN = 3e5 + 21;

long long ans;
long long n, m;
long long a[MAXN];

bool cmp(long long i, long long j) {
 	return i > j; 
}

int main() {
  	cin >> n;
  	m = n * 3;
  	for (int i = 1; i <= m; i++)
    	cin >> a[i];  
  	sort(a + 1, a + m + 1, cmp);
  
	for (int i = 2; i <= 2 * n; i += 2)
   		ans += a[i];
  	cout << ans << '\n';
 	return 0; 
}

Measured memory_bytes: 2560
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int a,b,c,d;
	std::cin >> a >> b >> c >> d;
	print(a!=c);

	return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	if(a+b+c>=22)printf("bust\n");
	else printf("win\n");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  ll x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  std::vector<ll> red(a),green(b),none(c);
  for(auto&& e: red) 
  {
    cin>>e;
  }
  for(auto&& e: green) 
  {
    cin>>e;
  }
  for(auto&& e: none) 
  {
    cin>>e;
  }
  sort(red.begin(), red.end(),greater<ll>());
  sort(green.begin(), green.end(),greater<ll>());
  sort(none.begin(), none.end(),greater<ll>());
  priority_queue<ll,vector<ll>,greater<ll>> ans;
  for (int i = 0; i < x; ++i)
  {
    ans.push(red[i]);
  }
  for (int i = 0; i < y; ++i)
  {
    ans.push(green[i]);
  }
  for (int i = 0; i < none.size(); ++i)
  {
    if(ans.top()<none[i])
    {
      ans.pop();
      ans.push(none[i]);
    }
    else break;
  }
  ll sum=0;
  while(!ans.empty())
  {
    sum+=ans.top();
    ans.pop();
  }
  cout<<sum;
}

Measured memory_bytes: 5748
while(True):

    val1=input().split(" ")
    val2=[int(n) for n in val1]
    
    if val2 ==[0,0]:
        break
    else:
        for i in range(val2[0]):
            for j in range(val2[1]):
                if i%2 == 0:
                    if j%2 ==0:
                        print("#",end="")
                    else:
                        print(".",end="")
                if i%2 ==1:
                    if j%2 ==0:
                        print(".",end="")
                    else:
                        print("#",end="")
            print()
        print()


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

string code[9];
ll N[9];
string encode="0123456789abcdef";

ll convert_string(string s){
    ll res=0;
    for (int i=0;i<s.size();++i){
        for (int j=0;j<16;++j) if (s[i]==encode[j]){
            res*=16; res+=j;
        }
    }
    return res;
}

string convert_integer(ll n){
    string res="";
    if (n==0) return "0";
    while(0<n){
        res+=encode[n%16];
        n/=16;
    }
    reverse(res.begin(),res.end());
    return res;
}

void solve(){
    for (int i=0;i<9;++i) N[i]=convert_string(code[i]);
    ll ans=0; int sum=0,carry=0,flag;
    for (int i=0;i<32;++i){
        for (int j=0;j<8;++j)
            if (N[j]&1LL<<i) ++sum;
        if ((sum&1)&&(N[8]&1LL<<i)) flag=0;
        else if (!(sum&1)&&!(N[8]&1LL<<i)) flag=0;
        else flag=1,ans|=1LL<<i;
        sum=carry;
        for (int j=0;j<8;++j)
            if (((N[j]&1LL<<i)>>i)^flag) ++carry;
        carry>>=1;
        sum=carry;
    }
    cout << convert_integer(ans) << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int S; cin >> S;
    for (;S--;){
        for (int i=0;i<9;++i) cin >> code[i];
        solve();
    }
}


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

int main(){
    int n, k, counter;
    cin >> n >> k;
    for(int i=0;i < n;i++){
        int x;
        cin >> x;
        if(x < k - x){
            counter += x * 2;
        }else{
            counter += (k - x) * 2;
        }
    }
    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define  M 1000000000000000000LL
using namespace std;
int main()
{
	long long q,h,s,d,n;
	cin >> q >> h >> s >> d >> n;
	cout <<  (n / 2) * min(q*8,min(h*4,min(s*2,d))) + (n%2) * min(q*4,min(h*2,s)) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
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");
}

    }



Measured memory_bytes: 2588
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

//Citation Format
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int[] a = new int[n];
			for(int i=0;i<n;i++)a[i]=sc.nextInt();
			int s = a[0];
			int t = a[0];
			Queue<String> l = new LinkedList<String>();
			for(int i=1;i<n;i++){
				if(t+1==a[i])t++;
				else {
					if(s<t)l.add(s+"-"+t);
					else l.add(s+"");
					s = a[i];
					t = a[i];
				}
			}
			if(s<t)l.add(s+"-"+t);
			else l.add(s+"");
			boolean f = true;
			while(!l.isEmpty()){
				if(!f)System.out.print(" ");
				f = false;
				System.out.print(l.poll());
			}
			System.out.println();
		}
	}
}

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

using vi = vector<int>;
using vll = vector<long long>;

constexpr long long mod = 1000000007;

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

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

    int n, m;
    cin >> n >> m;

    vector<pair<long long, long long>> p(n + m);

    rep(i, n) {
        long long t;
        cin >> t;
        p[i] = make_pair(t, 1);
    }
    rep(i, m) {
        long long t1, t2;
        cin >> t1 >> t2;
        p[i + n] = make_pair(t2, t1);
    }

    sort(p.begin(), p.end(), greater<pair<long long, long long>>());

    long long num = 0;
    long long sum = 0;
    for (int i = 0; i < p.size(); i++) {
        if (num + p[i].second <= n) {
            sum += p[i].first * p[i].second;
            num += p[i].second;
        } else {
            sum += p[i].first * (n - num);
            break;
        }
    }

    cout << sum << endl;
}

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

int main(){
    int n;
    cin >> n;
    map<string, int> mp;
    string buff;

    int c = 0;
    for(int i = 0; i < n; i++){
        cin >> buff;
        if(mp.find(buff) == mp.end()) {
            mp[buff] = 1;
            c++;
        }
    }

    cout << c << endl;
    return 0;
}

Measured memory_bytes: 19100
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll a,b;
    cin >>a >> b;
    string s = to_string(a) + to_string(b);
    ll ss = stol(s);
    rp(i,20000){
      if(i*i == ss) {
        cout << "Yes" << endl; return 0;
      }
    }
    cout << "No" << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
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...));
}
const int MOD = 1000000007;


pair<ll, ll> divide(ll h, ll w){
    if (h % 2 == 0 || w % 2 == 0) return {h*w/2, h*w/2};
    if (h > w) swap(h,w);
    return {h*((w+1)/2), h*((w-1)/2)};
    
}

int main(){
    
    long long H, W;
    cin >> H >> W;

    ll ans = INF;
    // Wは固定で高さを全探索
    for (ll h = 1; h < H; h++){
        vector<ll> area(3);
        area[0] = h*W;
        pair<ll, ll> p = divide(H-h, W);
        area[1] = p.first;
        area[2] = p.second;
        sort(area.begin(), area.end());
        ans = min(ans, area[2]-area[0]);
    }

    // Hは固定で幅を全探索
    for (ll w = 1; w < W; w++){
        vector<ll> area(3);
        area[0] = H*w;
        pair<ll,ll> p = divide(H,W-w);
        area[1] = p.first;
        area[2] = p.second;
        sort(area.begin(), area.end());
        ans = min(ans, area[2]-area[0]);
    }

    cout << ans << endl;

}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

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


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   bool a = 1;
   for (auto e : v ) {
      os << (a ? "" : " "); 
      os << e;
      a = 0;
   }
   os << "]";
   return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
   os << "(" << p.first << " " << p.second << ")";
   return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
   os << "{";
   bool a = 1;
   for (auto e : st) {
      os << (a ? "" : " ");
      os << e;
      a = 0;
   }
   os << "}";
   return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
   os << "{";
   bool a = 1;
   for (auto e : mp) {
      os << (a ? "" : " ");
      os << e.first << ":" << e.second;
      a = 0;
   }
   os << "}";
   return os;
}

// std::tuple Debug
template<int N,class Tuple>
void out(ostream &os,const Tuple &t){}
template<int N,class Tuple,class H,class ...Ts>
void out(ostream &os,const Tuple &t){
   if(N)os<<" ";
   os<<get<N>(t);
   out<N+1,Tuple,Ts...>(os,t);
}
template<class ...Ts>
ostream& operator<<(ostream &os, const tuple<Ts...> &t){
   os<<"(";
   out<0,tuple<Ts...>,Ts...>(os,t);
   os<<")";
   return os;
}

// Debug
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl

struct edge { int to, cost; };

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

void dfs(const auto& G, auto& vis, int v) {
   if (vis[v]) return;
   vis[v] = true;
   for (int i = 0; i < G[v].size(); ++i) {
      int u = G[v][i];
      dfs(G, vis, u);
   }
}

int main()
{
   int n, m; cin >> n >> m;
   vector<vector<int>> G(n);
   for (int i = 0; i < m; ++i) {
      int x, y, z; cin >> x >> y >> z;
      --x; --y;
      G[x].push_back(y);
      G[y].push_back(x);
   }

   vector<bool> vis(n, false);
   int ans = 0;
   for (int i = 0; i < n; ++i) {
      if (vis[i]) continue;
      dfs(G, vis, i);
      ++ans;
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 10368
#include<stdio.h>

int main(){
    int m[10];
    int i,j,max=0,n;
    for(i=0;i<10;i++)
        scanf("%d",&m[i]);
    for(j=0;j<3;j++){
        for(i=0;i<10;i++){
            if(m[i]>=max){
               max=m[i];
               n=i;
            }
        }
        printf("%d\n",max);
        max=0;
        m[n]=0;
        
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;//998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

template<int Modulus> 
struct ModInt {
    long long x;
    ModInt(long long x = 0) :x(x % Modulus) {}
    constexpr ModInt &operator+=(const ModInt a) {if ((x += a.x) >= Modulus) x -= Modulus; return *this;}
    constexpr ModInt &operator-=(const ModInt a) {if ((x += Modulus - a.x) >= Modulus) x -= Modulus; return *this;}
    constexpr ModInt &operator*=(const ModInt a) {(x *= a.x) %= Modulus; return *this;}
    constexpr ModInt &operator/=(const ModInt a) {return *this *= a.inverse();}

    constexpr ModInt operator+(const ModInt a) const {return ModInt(*this) += a;}
    constexpr ModInt operator-(const ModInt a) const {return ModInt(*this) -= a;}
    constexpr ModInt operator*(const ModInt a) const {return ModInt(*this) *= a;}
    constexpr ModInt operator/(const ModInt a) const {return ModInt(*this) /= a;}
    
    friend constexpr ostream& operator<<(ostream& os,const ModInt<Modulus>& a) {return os << a.x;}
    friend constexpr istream& operator>>(istream& is,ModInt<Modulus>& a) {return is >> a.x;}
    
    ModInt inverse() const {// x ^ (-1) 
        long long a = x,b = Modulus,p = 1,q = 0;
        while (b) {long long d = a/b; a -= d*b; swap(a,b); p -= d*q; swap(p,q);}
        return ModInt(p);
    }
    ModInt pow(long long N) {// x ^ N 
        ModInt a = 1;
        while (N) {
            if (N&1) a *= *this;
            *this *= *this;
            N >>= 1;
        }
        return a;
    }
};

using mint = ModInt<1000000007>;
struct Combination {
    int N;
    //using mint = ModInt<1000000007>;
    //using mint = ModInt<998244353>;
    vector<mint> fact,ifact,invs;
    Combination(int N): N(N),fact(N + 1),ifact(N + 1) {
        fact[0] = fact[1] = 1;
        ifact[0] = ifact[1] = 1;
        for (int i = 2;i < N + 1;++i) {fact[i] = fact[i - 1] * i;}
        ifact[N] = fact[N].inverse();
        for (int i = N;i >= 1;--i) {ifact[i - 1] = ifact[i] * i;}
    }
    void invs_build() {
        invs.resize(N + 1);
        invs[1] = 1;
        for (int i = 2;i < N + 1;++i) invs[i] = fact[i] * ifact[i - 1];
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n - k];
    }
};

int main() {
    string S;
    int K;
    cin >> K >> S;
    int M = S.size();
    int N = M + K;
    
    Combination comb(N);
    mint ans = 0;

    for (int i = M;i <= N;++i) {
        ans += comb(i - 1,M - 1) * mint(26).pow(N - i) * mint(25).pow(i - M);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35580
#include <bits/stdc++.h>
#include <queue>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) (1e9 + 7);
//const ll MOD = 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    string s;
    cin >> s;
    int n = s.length() + 1;

    ll a[500010], b[500010];
    a[0] = b[n - 1] = 0;

    rep(i, n - 1) {
        if (s[i] == '<') a[i + 1] = a[i] + 1;
        else a[i + 1] = 0;
    }

    for (int i = n - 1; i >= 1; i--) {
        if (s[i - 1] == '>') b[i - 1] = b[i] + 1;
        else b[i - 1] = 0;
    }
    ll sum = 0;
    rep(i, n) sum += max(a[i], b[i]);
    cout << sum << endl;

    return 0;
}



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

class D
{
	static void Main()
	{
		Console.ReadLine();
		var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

		int r = 0, t = 1;
		foreach (var v in a)
		{
			if (v == t)
			{
				r++;
				t++;
			}
		}
		Console.WriteLine(r == 0 ? -1 : a.Length - r);
	}
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<vector<pair<int, bool> > > a;
  vector<int> A(n);
  rep(i, 0, n) {
    cin >> A[i];
    vector<pair<int, bool> > xy(A[i]);
    rep(j, 0, A[i])
      cin >> xy[j].first >> xy[j].second;
    a.push_back(xy);
  }
  
  int ans = 0;
  for(int bit = 0; bit < (1 << n); bit++) {
    int cnt = 0;
    rep(i, 0, n) {
      int hoge = 0;
      if(bit & (1 << i)) {
        rep(j, 0, A[i])
          if((bit >> (a[i][j].first-1) & 1) == a[i][j].second) hoge++;
        if(hoge == A[i]) cnt++;
      }
      else cnt++;
    }
    if(cnt == n) {
      int ret = 0;
      rep(k, 0, n)
        if(bit & (1 << k)) ret++;
      ans = max(ans, ret);
    }
  }
  cout << ans << "\n";
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

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

int main(int, char**) {
	ll n; cin >> n;
	int odd = 0;
	if (n%2==1) odd = 1;

	int maxin = n - 1;
	vector<int> check(n, 0);
	check[0] = odd;
	int ret = 0;
	for (int i=0; i<n; i++) {
		int a; cin >> a;
		if ((a + odd)%2 != 1) break;
		else if (a > maxin) break;
		else {
			check[a]++;
			if (check[a] > 2) break;
		}
		if (i==n-1) ret = mypow(2, n/2);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
from collections import Counter


def solve(N: int, S: "List[str]"):
    cnt = Counter()
    for s in S:
        cnt[s] += 1
    
    lst = []
    mx = max(cnt.values())
    for key, val in cnt.items():
        if val == mx:
            lst += [key]

    for word in sorted(lst):
        print(word)
    
    return


# 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)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()


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

/* 
   requirement
   Val : default / copy constructor
   Upd, Map : Val operator() (Val, Val)
*/
template<class Val, class Upd, class Map>
struct SegTreeLazy {
    int n;
    vector<Val> data, lazy;
    vector<bool> isLazy;
    Upd upd;
    Map mp;
    const Val Id; // identity element for Map
    explicit SegTreeLazy(int n_, const Val& id_ = Val())
        : upd(Upd()), mp(Map()), Id(id_) { init(n_);}
    void init(int n_) { // 0 init
        for(n = 1; n < n_; n <<= 1);
        data.assign(2 * n - 1, Id);
        lazy.assign(2 * n - 1, Val());
        isLazy.assign(2 * n - 1, false);
    }
    // lazy propagation (type 1)
    inline void setLazy(int cn, Val x) { 
        isLazy[cn] = true;
        lazy[cn] = upd(lazy[cn], x);
        data[cn] = upd(lazy[cn], x);
    }
    inline void push(int cn) {
        if(isLazy[cn] == false) return;
        setLazy(cn * 2 + 1, lazy[cn]);
        setLazy(cn * 2 + 2, lazy[cn]);
        lazy[cn] = Val();
        isLazy[cn] = false;
    }
    // operation : upd [ql, qr) by x
    // current node : cn [cl, cr)
    void updrange(int ql, int qr, const Val& x) {
        updrange(ql, qr, x, 0, 0, n);
        return;
    }
    void updrange(int ql, int qr, const Val& x, int cn, int cl, int cr) {
        if(qr <= cl || cr <= ql) return;
        if(ql <= cl && cr <= qr) {
            setLazy(cn, x);
            return;
        }
        push(cn);
        updrange(ql, qr, x, cn * 2 + 1, cl, (cl + cr) / 2);
        updrange(ql, qr, x, cn * 2 + 2, (cl + cr) / 2, cr);
        data[cn] = mp(data[cn * 2 + 1], data[cn * 2 + 2]);
    }
    Val query(int ql, int qr) {
        return query(ql, qr, 0, 0, n);
    }
    Val query(int ql, int qr, int cn, int cl, int cr) {
        if(qr <= cl || cr <= ql) return Id;
        if(ql <= cl && cr <= qr) return data[cn];
        push(cn);
        Val a = query(ql, qr, cn * 2 + 1, cl, (cl + cr) / 2);
        Val b = query(ql, qr, cn * 2 + 2, (cl + cr) / 2, cr);
        return mp(a, b);
    }
};

template<class T> // no requirement 
struct updater {
    T operator ()(const T& a, const T& b) { return b;}
};

template<class T>
struct mpmin { // requirement : operator <
    T operator ()(const T& a, const T& b) { return a < b ? a : b;}
};

using SegTree = SegTreeLazy<int, updater<int>, mpmin<int>>;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    SegTree seg(n, 2147483647);
    while(q--) {
        int k;
        cin >> k;
        if(k) {
            int l, r;
            cin >> l >> r;
            ++r;
            cout << seg.query(l, r) << '\n';
        }
        else {
            int l, r, x;
            cin >> l >> r >> x;
            ++r;
            seg.updrange(l, r, x);
        }
    }
    return 0;
}

Measured memory_bytes: 5108
#include <map>
#include <iostream>

using namespace std;

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

    map<long long, int, greater<long long>, allocator<pair<long long, int>>> stick;
    for (int i = 0; i < N; i++) {
        long long a;
        cin >> a;
        stick[a]++;
    }

    long long side[] = {0, 0};
    for (int i = 0; i < 2; i++) {
        for (pair<long long, int> sticklength_count_pair: stick) {
            if (sticklength_count_pair.second >= 2) {
                side[i] = sticklength_count_pair.first;
                stick[sticklength_count_pair.first] -= 2;
                break;
            }
        }
        if (side[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << side[0] * side[1] << endl;
    return 0;
}

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

using namespace std;

#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define MP make_pair
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;


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

#define int long long
int a[100000+5];
int b[100000+5];
int c[100000+5];

int dp[100000+5][3];
signed main()
{
    IOS
    int n;
    cin >> n;
    REP(i, n)
        cin >> a[i] >> b[i] >> c[i];
    
    dp[0][0] = a[0];
    dp[0][1]=c[0];
    dp[0][2]=b[0];

    FOR(i,1,n,1)
    {
        dp[i][0] = max(dp[i-1][1]+a[i], dp[i-1][2]+a[i]);
        dp[i][2] = max(dp[i-1][1]+b[i], dp[i-1][0]+b[i]);
        dp[i][1] = max(dp[i-1][0]+c[i], dp[i-1][2]+c[i]);
    }

    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]);
}

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

N = int(input())
adj = [["0"]*N for _ in range(N)]

for _ in range(N):
    inp = list(map(int, input().split()))
    for i in inp[2:]:
        adj[inp[0]-1][i-1] = "1"

for a in adj:
    print(" ".join(a))

Measured memory_bytes: 7748
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int A1, A2, A3, sum, tmp;
  scanf("%d %d %d", &A1, &A2, &A3);
  if(A1 > A2){
    tmp = A1; A1 = A2; A2 = tmp;
  }
  if(A2 > A3){
      tmp = A2; A2 = A3; A3 = tmp;
  }
  if(A1 > A2){
    tmp = A1; A1 = A2; A2 = tmp;
  }
  sum = abs(A1-A2) + abs(A2-A3);
  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 128
n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")
cnt = 0
for i in range(n):
    i_ = s[i]
    for j in range(i+1, n):
        if s[j] == i_: continue
        k = 2 * j - i
        j_ = s[j]
        if k >= n or s[k] == i_ or s[k] == j_: continue
        cnt += 1
print(ans - cnt)

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

#define fi first
#define se second
#define sz(v) (int)((v).size())
#define pb push_back

typedef long long ll;

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

	ll A; string B;
	cin >> A >> B;
	ll C = (long long)(100*(B[0]-'0') + 10*(B[2]-'0') + (B[3]-'0'));
	cout << (A*C)/100 << "\n";
}


Measured memory_bytes: 3624
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int N = sc.nextInt();
		int A[][] = new int[N][2];
		int maxA = 0;
		for(int i = 0; i < N; i++) {
			A[i][0] = sc.nextInt();
			A[i][1] = sc.nextInt();
			maxA = Math.max(maxA, A[i][0]);
		}
		
		int dp[][] = new int[N + 1][H + maxA + 1];
		for(int i = 0; i < N + 1; i++) {
			Arrays.fill(dp[i], Integer.MAX_VALUE / 2);
		}
		dp[0][0] = 0;
		
		/*for(int i = 0; i < N; i++) {
			for(int j = 0; j < H + maxA; j++) {
				for(int k = 0; k < H / A[i][0] + 1; k++) {
					if(j >= k * A[i][0]) {
						dp[i + 1][j] = Math.min(Math.min(dp[i][j], dp[i + 1][j]), dp[i][j - k * A[i][0]] + (A[i][1] * k));
					}
				}
			}
		}*/
		
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < H + maxA; j++) {
				if(j >= A[i][0]) {
					dp[i + 1][j] = Math.min(dp[i][j], dp[i + 1][j - A[i][0]] + A[i][1]);
				} else {
					dp[i + 1][j] = dp[i][j];
				}
			}
		}
		int ans = Integer.MAX_VALUE;
		for(int i = H; i < H + maxA; i++) {
			ans = Math.min(dp[N][i], ans);
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 82352
Scanf.scanf "%d" (fun n ->
    let n3 = n / 3 in
    let n5 = n / 5 in
    let n15 = n / 15 in
    Printf.printf "%d\n" @@
    n * (n + 1) / 2 - 3 * n3 * (n3 + 1) / 2
                    - 5 * n5 * (n5 + 1) / 2
                    + 15 * n15 * (n15 + 1) / 2
)

Measured memory_bytes: 3844
#include <iostream>

using namespace std;

int main()
{
    string S,T,U;
    int A,B;
    cin>>S>>T;
    cin>>A>>B;
    cin>>U;
    if(U==S)
        A--;
    else if(U==T)
        B--;
    cout<<A<<" "<<B;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<limits>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i = 0;i < (n); ++i)

int main() {
	int a, b;
	cin >> a >> b;
	if (a > 9 || b > 9)cout << "-1" << endl;
	else cout << a * b << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>

using namespace std;

int main(){

  int in;
  while(cin >> in){

    while(in >= 40){
      in -= 39;
    }

    cout << "3C";
    if(in < 10) cout << "0";
    printf("%d\n",in);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    int n;
    cin >> n;
    vector<queue<int>> a(n);
    rep(i, n) {
        rep(ii, n - 1) {
            int tmp;
            cin >> tmp;
            tmp--;
            a[i].push(tmp);
        }
    }
    set<pair<int, int>> p;
    set<int> used;
    int days = 0;
    rep(i, n) {
        int y = a[i].front(), x = a[y].front();
        if (x != i) continue;
        if ((used.count(x) > 0) || (used.count(y) > 0)) continue;
        a[x].pop(); a[y].pop();
        used.insert(x); used.insert(y);
        p.emplace(min(x, y), max(x, y));
    }
    while(!p.empty()) {
        used.clear();
        for (auto it = p.begin(); it != p.end(); ) {
            if ((used.count(it->first) > 0) || (used.count(it->second) > 0)) {
                it++;
                continue;
            }
            used.insert(it->first);
            used.insert(it->second);
            p.erase(it++);
        }
        set<int> add;
        for (auto t : used) {
            if (a[t].empty()) continue;
            int x = a[t].front();
            if (a[x].empty()) continue;
            int y = a[x].front();
            if (y != t) continue;
            if ((add.count(x)) || (add.count(y))) continue;
            p.emplace(min(x, y), max(x, y));
            a[x].pop(); a[y].pop();
            add.insert(x); add.insert(y);
        }
        days++;
    }
    rep(i, n) {
        if (!a[i].empty()) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << days << endl;
    return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <vector>

#define REP(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define PI 3.141592653589

using namespace std;

ll count_zero(ll n){
    ll ctr = 0, div = 10;
    while(1){
        ctr += n / div;
        if(n / div == 0){
            break;
        }
        div *= 5;
    }
    return ctr;
}

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

    if(N % 2 == 1) cout << "0";
    else cout << count_zero(N);
    
    return 0;
}

Measured memory_bytes: 256
import sys


# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    solve()


def solve():
    N = int(input())

    s_dict = dict()
    for _ in range(N):
        s = input()
        if s in s_dict:
            s_dict[s] += 1
        else:
            s_dict[s] = 1

    max_v = 0
    new_list = list()
    for key, value in s_dict.items():
        if max_v < value:
            max_v = value
            new_list = list()
            new_list.append(key)
        elif max_v == value:
            new_list.append(key)

    new_list.sort()
    for s in new_list:
        print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 32092
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace abc131_e
{
    class Program
    {
        static void Main(string[] args)
        {
            var items = Console.ReadLine().Split(' ');
            // 頂点数
            var n = int.Parse(items[0]);
            // 長さ2のペア
            var k = int.Parse(items[1]);

            // すべての頂点を1に連結した時のkは(n-1)*(n-2)/2。この時のkが最大
            var kk = (n - 1) * (n - 2) / 2;

            // グラフ内の距離は、頂点間の最短距離のことである。
            // a-b-cがV字の場合はa-b、b-cが距離1でa-cが距離2。
            // a-b-cが三角形の場合は、a-b、b-c、c-aのいずれも距離1。
            // つまり、V字に辺を張って三角形にしていけば、距離2の頂点をひとつづつ減らすことができる
            // すべての頂点がつながっているグラフは、距離1のみ→kの最小値はこれ(mの最大値でもある)

            var lines = new List<line>();
            if (kk >= k)
            {
                // 1ループ目で、すべての頂点を1に連結する
                for (int v = 2; v <= n; v++)
                {
                    lines.Add(new line(1, v));
                }
                // 2ループ目以降で、1以外の頂点同士を連結してkを減らしていく
                for (int u = 2; u <= n; u++)
                {
                    if (kk <= k)
                    {
                        break;
                    }
                    for (int v = u + 1; v <= n; v++)
                    {
                        lines.Add(new line(u, v));
                        kk--;
                        if (kk <= k)
                        {
                            break;
                        }
                    }
                }
            }

            var m = lines.Count <= 0 ? -1 : lines.Count;
            Console.WriteLine($"{m}");
            for (int i = 0; i < m; i++)
            {
                Console.WriteLine($"{lines[i].u} {lines[i].v}");
            }
        }
    }
    struct line : IComparable<line>
    {
        public int u;
        public int v;
        public line(int u, int v)
        {
            this.u = Math.Min(u, v);
            this.v = Math.Max(u, v);
        }
        public int CompareTo(line other)
        {
            var c = u.CompareTo(other.u);
            if (c == 0)
            {
                c = v.CompareTo(other.v);
            }
            return c;
        }
    }
}



Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

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

typedef long long ll;
typedef vector<int> VI;



int partition(int (&A)[100010], int p, int r){
    int x = A[r]; // A中の最後の要素
    int i = p-1;
    for(int j=p; j<r; ++j){
        if(A[j]<=x){ // A[j]よりxが大きい=A[j]はA[r]より小さい
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n; cin >> n;
    int A[100010]={0};

    REP(i, n) cin >> A[i];
    int q = partition(A, 0, n-1);

    for(int i=0; i<n; ++i){
        if(i) cout << " ";
        if(i==q){
            cout << "[" << A[i] << "]";
        }else{
            cout << A[i];
        }
    }
    cout << endl;
	return 0;
}


Measured memory_bytes: 3536
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=300000+10;

int n,a[N];
ll pre[N],suf[N];
priority_queue<int,vector<int>,greater<int>> Qp;
priority_queue<int> Qs;

int main() {
	n=read();
	for (int i=1;i<=3*n;++i) a[i]=read();
	for (int i=1;i<=n;++i) Qp.push(a[i]),pre[i]=pre[i-1]+a[i];
	for (int i=n+1;i<=2*n;++i) {
		if (a[i]>Qp.top()) pre[i]=pre[i-1]-Qp.top()+a[i],Qp.pop(),Qp.push(a[i]);
		else pre[i]=pre[i-1];
	}
	for (int i=3*n;i>2*n;--i) Qs.push(a[i]),suf[i]=suf[i+1]+a[i];
	for (int i=2*n;i>n;--i) {
		if (a[i]<Qs.top()) suf[i]=suf[i+1]-Qs.top()+a[i],Qs.pop(),Qs.push(a[i]);
		else suf[i]=suf[i+1];
	}
	ll ans=-1e18;
	for (int i=n;i<=2*n;++i) ans=max(ans,pre[i]-suf[i+1]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 8292