akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long

#define N 100


signed main(){
	int n;
	cin>>n;
	vector<pair<int,int>> v;
	lp(i,n){
		int a,b;
		cin>>a>>b;
		v.push_back({a,b});
	}
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	sort(v.begin(),v.end());
	vector<pair<int,int>> x;
	lp(i,n){
		lp(j,n){
			if(i==j) break;
			int tr=1;
			if((v[j].first-v[i].first)<0) tr=-1;
			x.push_back({tr*(v[j].first-v[i].first),tr*(v[j].second-v[i].second)});
		}
	}
	sort(x.begin(),x.end());
	int cnt=1;
	int ans=-1;
	lp(i,x.size()){
		if(i==0) continue;
		if(x[i]!=x[i-1]){
			if(x[i-1].first==0&&x[i-1].second==0) 1;
			else ans=max(cnt,ans);
			cnt=0;
		}
		cnt++;
	}
	if(x[x.size()-1].first==0||x[x.size()-1].second==0) 1;
	else ans=max(cnt,ans);
	cout<<n-ans<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma optimize("unroll-loops");
#pragma optimize("Ofast");
//#include "pch.h"    
using namespace std;
unordered_map<int, bool> here;
 
using ll = long long;
const int nax = 1e5 + 10;
vector<int> edges[nax];

int main() {
    
    ll x;
    cin >> x;
    
    ll bal = 100;
    ll answer = 0;
    while(1) {
        if(bal >= x) {
            break;
        }
        bal *= (1.01);
        ++answer;
    }
    
    cout << answer << "\n";
}


Measured memory_bytes: 5948
#import sys
#import numpy as np
#import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect

n,A,B,C=map(int,input().split())
l=[int(input()) for _ in range(n)]
inf=10**9
def rec(i,a,b,c):
    if i==n:
        if not a or not b or not c:
            return inf
        return abs(A-a)+abs(B-b)+abs(C-c)
    res=rec(i+1,a,b,c)
    res=min(res,rec(i+1,a+l[i],b,c)+(10 if a else 0))
    res=min(res,rec(i+1,a,b+l[i],c)+(10 if b else 0))
    res=min(res,rec(i+1,a,b,c+l[i])+(10 if c else 0))

    return res
print(rec(0,0,0,0))

Measured memory_bytes: 43868
#ABC-79-B
from functools import lru_cache

n = int(input())

@lru_cache(maxsize=None)
def lucas(n):
    if n == 1:
        return 2
    elif n == 2:
        return 1
    else:
        return lucas(n-2)+lucas(n-1)
    

print(lucas(n+1))
    

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

using namespace std;
long long n,a,b;
vector<int>v;
bool chk(long long      i){
    long long dif=a-b;
    long long cntnd=0;
    for(int j=0;j<n;j++){
        long long cr=v[j];
        cr-=b*i;
        cntnd+=(cr>0)?(cr/dif+!!(cr%dif)):0ll;
    }
    return cntnd<=i;
}
int main()
{
    ///{}
    ios_base::sync_with_stdio(0);
    cin.tie(0);  cout.tie(0);
    cin>>n>>a>>b;
    v.resize(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    long long l=0,r=1e9+5;
    long long ans=INT_MAX;
    while(l<=r){
        long long mid=(r-l)/2ll+l;
        if(chk(mid)){
            ans=min(ans,mid);
            r=mid-1ll;
        }else
            l=mid+1ll;
    }
    cout<<ans<<'\n';
    return 0;
}
/**
10
0 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 1 1 1 1
1 1 1 1 0 1 1 1 1 1
1 1 1 1 1 0 1 1 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 1 1 0
*/


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
int main(){
    ll a,b,n;cin>>a>>b>>n;
    if(n>=b)out((a*(b-1))/b);
    else out((a*n)/b);
}

Measured memory_bytes: 3632
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

#n = int(input())
#n,m = [int(i) for i in readline().split()]
#lr = [[int(i)-1 for i in readline().split()] for _ in range(q)]

s = input()
t = input()

ans = 0
for i,j in zip(s,t):
    if i==j: ans += 1
print(ans)










Measured memory_bytes: 2940
g1 = ['2']
g2 = ['4','6','9','1']
g3 = ['1','3','5','7','8','10','12']
x, y = input().split()
if x in g1 and y in g1:
    print("Yes")
elif x in g2 and y in g2:
    print("Yes")
elif x in g3 and y in g3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// Scan Standard Input
var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	_ = nextLine()
	A := convert(strings.Split(nextLine(), " "))

	q, _ := strconv.Atoi(nextLine())
	m := convert(strings.Split(nextLine(), " "))

	for i := 0; i < q; i++ {
		if exhaustiveSearch(m[i], A) {
			fmt.Println("yes")
		} else {
			fmt.Println("no")
		}
	}
}

func exhaustiveSearch(x int, A []int) bool {
	return solve(x, 0, A)
}

func solve(target int, index int, A []int) bool {
	if target == 0 {
		return true
	} else if target < 0 || index >= len(A) {
		return false
	} else {
		return solve(target-A[index], index+1, A) ||
			solve(target, index+1, A)
	}
}

func convert(src []string) []int {
	r := make([]int, len(src))
	for i, v := range src {
		r[i], _ = strconv.Atoi(v)
	}
	return r
}



Measured memory_bytes: 1128
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int cnt = 0;
  for(int i = 0; i <= a; i++) {
    for(int j = 0; j <= b; j++) {
      for(int k = 0; k <= c; k++) {
        if(500*i + 100*j + 50*k == x) cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
use std::io::{Read};
use std::io::{stdout, BufWriter, Write};
use std::collections::HashMap;

// E - Rem of Sum is Num
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut sw = buf.split_whitespace();
    macro_rules! get {
        ($t:ty) => {
            sw.next().unwrap().parse().unwrap()
        };
        ($($t:ty),*) => {
            ($(get!($t)),*)
        };
        ($t:ty; $n:expr) => {
            (0..$n).map(|_|
                get!($t)
            ).collect::<Vec<_>>()
        };
        ($($t:ty),*; $n:expr) => {
            (0..$n).map(|_|
                get!($($t:ty),*)
            ).collect::<Vec<_>>()
        };
    }
    let _stdout = stdout();
    let mut out = BufWriter::new(_stdout.lock());
    /* END TEMPLATE */

    let (n, k): (usize, usize) = get!(usize, usize);
    let v: Vec<usize> = get!(usize;n);
    let mut cs: Vec<usize> = vec![0; n+1];
    let mut kv: HashMap<usize, usize> = HashMap::new();
    (0..n).for_each(|i| {
        cs[i+1] = cs[i]+v[i]-1;
        if cs[i+1] >= k {
            cs[i+1] %= k;
        }
    });
    let mut ans: usize = 0;
    (0..=n).for_each(|i| {
        if i >= k {
            let j = cs[i-k];
            *kv.entry(j).or_insert(0) -= 1;
            ans += *kv.entry(j).or_insert(0);
        }
        if i <= n {
            *kv.entry(cs[i]).or_insert(0) += 1;
        }
    });
    /*
    cs.iter().enumerate().for_each(|(i, _cs)| {
        writeln!(out, "[Debug] CS {}: {}", i, _cs).unwrap();
    });
     */
    (n.saturating_sub(k-1)..n).for_each(|i|{
        let j = cs[i];
        *kv.entry(j).or_insert(0) -= 1;
        ans += *kv.entry(j).or_insert(0);
    });
    writeln!(out, "{}", ans).unwrap();
}

Measured memory_bytes: 13920
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n,r;
  cin >> n >> r;

  if(n >= 10) cout << r << endl;
  else cout << r + 100 * (10 - n) << endl;

  return 0;
}

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

vector<long long> a(51), p(51);

long long patty(long long l, long long x) {
    if (x == 0) return 0;
    if (l == 0) return 1;
    if (x >= 2 * a[l - 1] + 2) return p[l];
    else if (x >= a[l-1] + 2) {
        return p[l - 1] + 1 + patty(l - 1, x - (a[l - 1] + 2));
    }
    else return patty(l-1,x-1);
        
}

int main() {
    long long n, x; cin >> n >> x;
    a[0] = p[0] = 1;
    for (long long i = 0; i < 50; i++) {
        a[i + 1] = 2 * a[i] + 3;
        p[i + 1] = 2 * p[i] + 1;
    }
    cout << patty(n, x) << endl;

    return 0;
}


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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if ((a == 5 && b == 7 && c == 5) || (a == 7 && b == 5 && c == 5)
		|| (a == 5 && b == 5 && c == 7)) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using st = string;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }

int main() {
    int n, x, t;
    cin >> n >> x >> t;
    int times = (n + x - 1) / x;
    times *= t;
    cout << times << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    while (cin >> n) {
        int cnt = 0;
        for (int a=0; a<10; ++a)
            for (int b=0; b<10; ++b)
                for (int c=0; c<10; ++c)
                    for (int d=0; d<10; ++d)
                        if (a + b + c + d == n)
                            cnt ++;
        cout << cnt << "\n";
    }

    return 0;
}

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

ll dp[10001][10];
ll amt[8];

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

    ll n;
    cin >> n;

    ll m;
    cin >> m;

    ll a[m];

    rep(i,m)
    {
    	cin >> a[i];
    	if(a[i]==1)
    	{
    		amt[2] = max(amt[2],(ll)1);
    	}
    	else if(a[i]==2)
    	{
			amt[5] = max(amt[5],(ll)2);
    	}
    	else if(a[i]==3)
    	{
			amt[5] = max(amt[5],(ll)3);
    	}
    	else if(a[i]==4)
    	{
			amt[4] = max(amt[4],(ll)4);
    	}
    	else if(a[i]==5)
    	{
			amt[5] = max(amt[5],(ll)5);
    	}
    	else if(a[i]==6)
    	{
			amt[6] = max(amt[6],(ll)6);
    	}
    	else if(a[i]==7)
    	{
			amt[3] = max(amt[3],(ll)7);
    	}
    	else if(a[i]==8)
    	{
			amt[7] = max(amt[7],(ll)8);
    	}
    	else if(a[i]==9)
    	{
			amt[6] = max(amt[6],(ll)9);
    	}
    }

    fr(i,1,n)
    {
    	fr(j,0,9)
    	{
    		dp[i][j] = -1;
    	}
    }

    fr(i,1,n)
    {
    	fr(j,2,7)
    	{
    		if(amt[j]==0)
    			continue;
    		if(j>i)
    			continue;
    		ll arr[10];
    		bool hu = 1;

    		ll sum1 = 0;
    		fr(k,0,9)
    		{
    			arr[k] = dp[i-j][k];
    			if(arr[k]==-1)
    				hu = 0;
    			sum1 = sum1 + arr[k];	
    		}

    		if(!hu)
    			continue;

    		arr[amt[j]]++;
    		sum1++;
    		if(dp[i][0] == -1)
    		{
    			fr(k,0,9)
    				dp[i][k] = arr[k];
    		}
    		else
    		{
    			ll sum2 = 0;
    			bool yes = 0;
    			frr(k,9,0)
    			{
    				sum2 = sum2 + dp[i][k];
    			}

    			if(sum1>sum2)
    				yes = 1;
    			else if(sum1==sum2)
    			{
    				frr(k,9,0)
	    			{
	    				if(arr[k]>dp[i][k])
	    				{
	    					yes = 1;
	    					break;
	    				}
	    				else if(arr[k]<dp[i][k])
	    					break;
	    			}
    			}
    			

    			if(yes)
    			{
    				fr(k,0,9)
    					dp[i][k] = arr[k];
    			}
    		}
    	}

    	// fr(j,0,9)
    	// {
    	// 	cout << dp[i][j] << " ";
    	// }
    	// cout << endl;
    }

    frr(k,9,0)
    {
    	rep(j,dp[n][k])
    	{
    		cout << k;
    	}
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define in inline
#define re register
using namespace std;
in int read() {
	re int t=0;
	re char v=getchar();
	while(v<'0'||v>'9')v=getchar();
	while(v>='0'&&v<='9') {
		t=(t<<3)+(t<<1)+(v^48);
		v=getchar();
	}
	return t;
}
int n,m,ans,a[200002],head[200002],cnt;
struct edge{
	int to,next;
}e[400002];
inline void add(re int x,re int y){
	e[++cnt]=(edge){y,head[x]};
	head[x]=cnt;
}
signed main(){
	n=read();m=read();
	for(re int i=1;i<=n;++i)a[i]=read();
	for(re int i=1,x,y;i<=m;++i){
		x=read();y=read();
		add(x,y);
		add(y,x);
	}
	for(re int i=1;i<=n;++i){
		bool ia=1;
		for(re int j=head[i];j;j=e[j].next)if(a[i]<=a[e[j].to]){
			ia=0;
			break;
		}
		if(ia)++ans;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 6148
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#pragma warning(disable : 4996)
 
using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
//最大公約数
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
//最小公倍数
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
 
int main(){
	int a, b, c;
	
	cin >> a >> b >> c;
	
	if (a == b && b == c){
		if (a%2 == 0) cout << -1 << endl;
		else cout << 0 << endl;
	}
	else {
		int ans = 0;
		int t1 = a, t2 = b, t3 = c;
		
		while(t1%2 == 0 && t2%2 == 0 && t3%2 == 0){
			ans++;
			a = t2/2 + t3/2;
			b = t1/2 + t3/2;
			c = t1/2 + t2/2;
			
			t1 = a;
			t2 = b;
			t3 = c;
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
/**
 *  author: MOOONI
 *  hackers are welcome!
**/
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define db double
#define ld long double
#define str string
#define pi pair
#define tup tuple
#define vec vector
#define temp template
#define tn typename

#define ff first
#define ss second
#define SZ(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rsz resize
#define ins insert
#define fr front 
#define bc back
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mk make_pair

#define FOR(i, a, b) for (ll i = (a); i <= (b); i++) 
#define ROF(i, a, b) for (ll i = (a); i >= (b); i--)
#define trav(a, x) for (auto &a : x)
#define popcount __builtin_popcount
#define ctz __builtin_ctz
#define clz __builtin_clz
#define gcd __gcd

// DEBUG
#define ts to_string
temp<tn A, tn B> str ts(pi<A, B> p);
temp<tn A, tn B, tn C> str ts(tup<A, B, C> p);
str ts(const str& s) { return '"' + s + '"'; }
str ts(const char* s) { return ts((str) s); }
str ts(bool b) { return (b ? "true" : "false"); }
str ts(vec<bool> v) { bool f = true; str res = "{";
FOR(i, 0, static_cast<ll>(v.size()) - 1) 
{ if (!f) res += ", "; res += ts(v[i]);
f = false; } res += "}"; return res; }
temp<size_t N> str ts(bitset<N> v) { str res = "";
trav(a, v) { res += (char) ('0' + a); } return res; }
temp<tn A> str ts(A v) { bool f = true; str res = "{";
trav(x, v) { if (!f) res += ", "; res += ts(x);
f = false; } res += "}"; return res; }
temp<tn A, tn B> str ts(pi<A, B> p) { 
  return "(" + ts(p.ff) + ", " + ts(p.ss) + ")"; }
temp<tn A, tn B, tn C> str ts(tup<A, B, C> t) {
  return "(" + ts(get<0>(t)) + ", " + ts(get<1>(t)) + ", " + ts(get<2>(t)) + ")"; }
void DBG() { cerr << endl; }
temp<tn H, tn... T> void DBG(H h, T... t) { cerr << " " << ts(h); DBG(t...); }
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", DBG(__VA_ARGS__);

// INPUT AND OUTPUT
temp<tn T> void re(T& x) { cin >> x; };
temp<tn H, tn... T> void re(H& h, T&... t) { re(h); re(t...); }
temp<tn T> void pr(T x) { cout << x; };
temp<tn H, tn... T> void pr(H h, T... t) { pr(h); pr(t...); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  str s;
  re(s);
  pr((s == "ABC" ? "ARC" : "ABC"), '\n');
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ll mod=998244353;
const ld PI = 2 * acos(0.0);
ll m(ll a){ return (a+mod)%mod;}
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string

str.find(qtr) : returns the first occurenece of qtr in str */
const int N=2e5+1;
v  fact(N,0),powers(N,1);
int ncr(int n,int r)
{
    return (fact[n]*power((fact[n-r]*fact[r])%mod,mod-2,mod))%mod;
}
int F(int l,int m)
{

    return (m*powers[l-1])%mod;
}
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n,m,k;cin>>n>>m>>k; 
    fact[0]=1;
    for(int i=1;i<N;i++)
    fact[i]=(fact[i-1]*i)%mod;
    for(int i=1;i<N;i++)
        powers[i]=(powers[i-1]*(m-1))%mod;
    int ans=0;
    for(int x=0;x<=k;x++)
    {
        int ans1=(ncr(n-1,x)*F(n-x,m))%mod;
        ans+=ans1;
        if(ans > mod)
            ans%=mod;
    }  
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6236
using System;
using System.Numerics;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = int.Parse(Console.ReadLine());
            int Mod = (int)Math.Pow(10, 9) + 7;
            long sum10 = 1;
            for (int i = 0; i < n; i++)
            {
                sum10 *= 10;
                sum10 %= Mod;
            }
            long sum9 = 1;
            for (int i = 0; i < n; i++)
            {
                sum9 *= 9;
                sum9 %= Mod;
            }
            long sum8 = 1;
            for (int i = 0; i < n; i++)
            {
                sum8 *= 8;
                sum8 %= Mod;
            }
            long m = sum10 + sum8 - (sum9 * 2)%Mod;
            if (m < 0) m += Mod;
            Console.WriteLine(m % Mod);
        }
        //static void Main(string[] args)
        //{
        //    int n = int.Parse(Console.ReadLine());
        //    int Mod = (int)Math.Pow(10, 9) + 7;
        //    BigInteger ans = 0;
        //    ans += BigInteger.ModPow(10, n, Mod);
        //    ans -= (BigInteger.ModPow(9, n, Mod)*2)%Mod;
        //    ans += BigInteger.ModPow(8, n, Mod);
        //    if (ans < 0) ans += Mod;
        //    Console.WriteLine(ans % Mod);

        //}
    }
}


Measured memory_bytes: 27788
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    int a,b;
    cin>>a>>b;
    if(b!=100)
        cout<<int(pow(100,a)*b)<<endl;
    else
        cout<<int(pow(100,a)*(b+1))<<endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import math
def main():
    N, D = map(int, input().split())
    ans = 0
    count = 0
    for i in range(N):
        X, Y = map(int, input().split())
        ans = math.sqrt(X**2 + Y**2)
        if ans <= D:
            count+=1

    print(count)

if __name__  == '__main__':
    main()

Measured memory_bytes: 9204
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <utility>

#include <cassert>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define FOR(i,a,b) for(ll i=(a); i < (b); i++)
#define RFOR(i,a,b) for(ll i=(b)-1; i >= (a); i--)
#define rep(i,n) FOR(i,0,(n))
#define rrep(i,n) RFOR(i,0,(n))

const ll mod = 998244353;

ll modpow(ll x, ll p) {
	ll res = 1;
	while(p) {
		if(p&1) {
			res = (res * x) % mod;
		}
		x = (x * x) % mod;
		p = p >> 1;
	}
	return res;
}

int main() {
	int N;
	cin >> N;
	vector<int> D(N);
	rep(i,N) cin >> D[i];

	if(D[0] != 0) {
		cout << 0 << endl;
		return 0;
	}
	sort(all(D));
	ll res = 1;
	ll pcnt = 1;
	for(ll i = 1; i < N; ) {
		ll p = i;
		if(D[p]-D[p-1] != 1) {
			res = 0;
			break;
		}
		ll cnt = 0;
		while(i < N && D[p] == D[i]) {
			i++;
			cnt++;
		}
		res = (res * modpow(pcnt, cnt)) % mod;
		pcnt = cnt;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args)
    {
        Scanner inputs = new Scanner(System.in);
        String n = inputs.next();
        int sum = 0;
        for(char ch: n.toCharArray())
            sum += Character.getNumericValue(ch);

        if(sum%9 == 0)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 40636
#include <iostream>
using namespace std;
int main(void){
    int N,count = 0;
    float a;
    cin >> N;
    for(int i = 1;i <= N;i++){
        if(i % 2 != 0){count++;}
    }
    a = float(count) / N;
    printf("%.10f\n",a);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define M_PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

bool num[10];
int ans = 100000000;

void makeNumber(int no, int N)
{
	if (no >= N) ans = min(ans, no);
	else {
		rep(i, 10) {
			if (num[i]) makeNumber(no * 10 + i, N);
		}
	}
}

int main()
{
	int N, K, D;

	rep(i, 10) num[i] = true;

	cin >> N >> K;
	rep(i, K) {
		cin >> D;
		num[D] = false;
	}

	repc(i, 1, 9) {
		if (num[i]) makeNumber(i, N);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]

def count_bombs(i, j):
    search_target = []
    if i != 0:
        search_target += field[i-1][max(0,j-1):min(W,j+2)]
    if i != H-1:
        search_target += field[min(H-1,i+1)][max(0,j-1):min(W,j+2)]
    search_target += field[i][max(0,j-1):min(W,j+2)]
    bombs = str(sum(1 if x == '#' else 0 for x in search_target))
    return bombs


for i in range(H):
    for j in range(W):
        if field[i][j] == '.':
            field[i][j] = count_bombs(i, j)

for i in range(H):
    print("".join(field[i]), end='')


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int l = sc.NextInt();
        string[] s = new string[n];
        for (int i = 0; i < n; i++)
        {
            s[i] = sc.Next();
        }

        s = s.OrderBy(_s => _s).ToArray();
        string answer = string.Join("", s);

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13612
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,s=0,x;
    cin>>n>>m;//cout<<n<<m;
    for(i=1;i<=m;i++)
    {
        cin>>x;
        s+=x;
    }
    //cout<<s;
    if(n-s>=0)cout<<n-s;
    else cout<<"-1";
}

Measured memory_bytes: 3636
#include<cstdio>

#define LL long long
#define MAXN 100000
#define MOD 1000000007
LL fac[2*MAXN+5];
LL inv[2*MAXN+5];

LL Pow(LL x,LL p){
    LL ret=1;
    while(p){
        if(p&1)
            ret=ret*x%MOD;
        x=(x*x)%MOD;
        p>>=1;
    }
    return ret;
}

void Prep(int N){
    fac[0]=1;
    for(int i=1;i<=N;i++)
        fac[i]=fac[i-1]*i%MOD;
    //inv[fac[i]]=Pow(fac[i],MOD-2)=Pow(1,MOD-2)...Pow(i,MOD-2)
    //inv[fac[i-1]]=Pow(fac[i-1],MOD-2)=Pow(1,MOD-2)...Pow(i-1,MOD-2)=Pow(fac[i],MOD-2)/Pow(i,MOD-2)=inv[i]*i
    inv[0]=1;
    inv[N]=Pow(fac[N],MOD-2);
    for(int i=N-1;i>=1;i--)
        inv[i]=inv[i+1]*(i+1)%MOD;
}

LL C(int m,int n){
    return fac[m]*inv[n]%MOD*inv[m-n]%MOD;
}

int main(){
    int H,W,A,B;
    scanf("%d%d%d%d",&H,&W,&A,&B);
    Prep(H+W);
    LL Ans=0;
    for(int i=B+1;i<=W;i++){
        LL tmp1=C(H-A+i-2,i-1);
        //C(m+n-x-y-2,m-x-1)
        //(H-A,i) -> (H,W)
        LL tmp2=C(A+W-i-1,W-i);
        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;
    }
    printf("%lld",Ans);
}

Measured memory_bytes: 3328
import collections
import itertools
import functools


@functools.lru_cache(maxsize=100000000)
def sigma(s):
    return sum(k * v for k, v in s)


def main():
    n, a = map(int, input().split())
    x = list(map(int, input().split()))

    d = collections.defaultdict(int)
    d[0] = 1

    for c in x:
        current = list(d.items())
        for diff, count in current:
            delta = diff + c - a
            d[delta] = d[delta] + count

    print(d[0] - 1)


if __name__ == '__main__':
    main()


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

int main(){
  int N,ans=0;
  int L[220];
  
  cin>>N;
  for(int i=0;i<2*N;i++){
    cin>>L[i];
  }

  sort(L,L+2*N);

  for(int i=0;i<N;i++){
    ans+=L[2*i];
  }
			  
  cout<<ans<<endl;  

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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<typename T, int N, T F(const T& a, const T& b)>
struct SegTree
{
public:
    SegTree()
    {
        dat = vector<T>(N * 2 - 1, 0);
    }

    void update(int i, T x)
    {
        i += N - 1;
        dat[i] = x;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = F(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = N)
    {
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return dat[k];
        else
        {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(vl, vr);
        }
    }

    vector<T> dat;
};

/*------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
------------------------------------------------------------------------------*/











//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    string S;
    cin >> N >> S;
    int i = 0;
    int l = 0;
    while (true)
    {
        if (i >= S.size())
        {
            if (l > 0)
            {
                rep(j, 0, l) S += ')';
            }
            break;
        }

        if (S[i] == '(')
        {
            ++l;
        }
        else
        {
            if (l > 0)
            {
                --l;
            }
            else
            {
                S = '(' + S;
                ++i;
            }
        }
        ++i;
    }
    cout << S << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

 
int main() {
    int H,W,K;
    cin>>H>>W>>K;
    vector<string> fi(H);
    rep(i,H) cin>>fi[i];

    int res=1<<29;
    for(int bit=0;bit<(1<<(H-1));bit++){
        bool gok=true;
        int N=0;
        vector<int> ord(H,0);
        rep(i,H-1){
            if(!(bit&(1<<i))) ord[i+1]=ord[i];
            else ord[i+1]=ord[i]+1,N++;
        }
        int add=0;
        vector<int> nums(N+1,0);
        rep(w,W){
            vector<int> one(N+1,0);
            bool ok=true;
            rep(h,H){
                one[ord[h]]+=fi[h][w]-'0';
                nums[ord[h]]+=fi[h][w]-'0';
                if(one[ord[h]]>K) gok=false;
                if(nums[ord[h]]>K) ok=false;
            }
            if(!ok) add++,nums=one;
        }
        if(gok) res=min(res,N+add);
    }


    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
    int a,b;
    char op;
    while(1){
        cin >> a >> op >> b;
        if(op == '?') break;
        int result;
        switch(op){
            case '+':
             result = a + b;
             break;
            case '-':
             result = a - b;
             break;
            case '*':
             result = a * b;
             break;         
            case '/':
             result = a / b;
             break;
        }
        printf("%d\n",result);
    }
}


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

//最大公約数(Euclid互除法:O(log n)
long long gcf(long long x, long long y) {
	while (x > 0 && y > 0) {
		if (x > y) {
			x %= y;
		}
		else {
			y %= x;
		}
	}
	return max(x, y);
}

//最小公倍数
long long lcm(long long x, long long y) {
	long long gcf_xy = gcf(x, y);
	long long zz = y / gcf_xy;
	return x * zz;
}


int main()
{
	//std::ifstream in("subtask01-09.txt");
	//std::cin.rdbuf(in.rdbuf());

	long long N, M;
	string S, T;
	cin >> N >> M;
	cin >> S;
	cin >> T;

	long long L = lcm(N, M);
	long long mlt = N * M;
	long long gcf = mlt / L; //最大公約数

	long long is = L / N;
	long long it = L / M;

	bool ok = true;
	for (int i = 0; i < gcf; i++) {
		if (S[i*it] != T[i*is]) {
			ok = false;
			break;
		}
	}
	if (ok) {
		cout << L << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int n;
    cin>>n;
    double a[101];
    rep(i,n)cin>>a[i];
    double aa[101]={1};
    double aaa=1;
    rep(i,n){
        aaa*=a[i];
        rep(j,n){
            if(i!=j){
                aa[i]*=a[j];
            }
        }

    }
    double ans=0;
    rep(i,n){
        ans+=aaa/a[i];
    }
  	ans=aaa/ans;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n % 2 == 0){
			System.out.println(n / 2);
		}else{
			System.out.println(n / 2 + 1);
		}
	}
	
	}

Measured memory_bytes: 21844
//agc006_a.cpp
//Sat Nov  3 10:11:02 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n;
	cin >> n;
	string s,t;
	cin >> s >> t;

	int overlap = 0;
	for (int i=0;i<s.size();i++){
		if (s.substr(i,s.size()-i) == t.substr(0,s.size()-i)){
			overlap = s.size()-i;
			break;
		}
	}

	cout << s.size()+t.size()-overlap << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;
typedef long long int Int;
Int N,K;
map<Int,Int> A;
vector<Int> S;

int Calc() {
    sort(S.begin(),S.end(),greater<Int>());

    Int sum = 0;
    for(Int i = 0;i < K && i < S.size();i++) {
        sum += S[i];
    }

    return N-sum;
}

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

    for(Int i = 0;i < N;i++) {
        Int temp;
        cin>>temp;

        A[temp]++;
    }

    for(map<Int,Int>::iterator it = A.begin();it != A.end();it++)
    {
        S.push_back(it->second);
    }

    cout<<Calc()<<endl;

    return 0;
}


Measured memory_bytes: 14960
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
vector<pair<char,int> >A;
vector<pair<char,int> >B;
vector<pair<char,int> >C;
vector<pair<char,int> >res;
void out(){
	int tmp=0;
	for(int i=0;i<res.size();i++){
		if(i+1==res.size()||res[i].first!=res[i+1].first){
			printf("%c %d ",res[i].first,tmp+res[i].second);
			tmp=0;
		}else{
			tmp+=res[i].second;
		}
	}
	printf("$\n");
}
char in[2];
int main(){
	while(1){
		scanf("%s",in);if(in[0]=='$')break;
		int p;scanf("%d",&p);
		A.push_back(make_pair(in[0],p));
	}
	while(1){
		scanf("%s",in);if(in[0]=='$')break;
		int p;scanf("%d",&p);
		B.push_back(make_pair(in[0],p));
	}
	while(1){
		scanf("%s",in);if(in[0]=='$')break;
		int p;scanf("%d",&p);
		C.push_back(make_pair(in[0],p));
	}
	for(int i=0;i+B.size()<=A.size();i++){
		bool ok=true;
		for(int j=0;j<B.size();j++){
			if(A[i+j].first!=B[j].first)ok=false;
			if(j+1<B.size()&&A[i+j].second!=B[j].second)ok=false;
			if(A[i+j].second<B[j].second)ok=false;
		}
		if(ok){
			for(int j=0;j<i;j++)res.push_back(A[j]);
			for(int j=0;j<C.size();j++)res.push_back(C[j]);
			if(A[i+B.size()-1].second!=B[B.size()-1].second)res.push_back(make_pair(A[i+B.size()-1].first,A[i+B.size()-1].second-B[B.size()-1].second));
			for(int j=i+B.size();j<A.size();j++)res.push_back(A[j]);
			out();
			return 0;
		}
		ok=true;
		for(int j=0;j<B.size();j++){
			if(A[i+j].first!=B[j].first)ok=false;
			if(j&&j+1<B.size()&&A[i+j].second!=B[j].second)ok=false;
			if(A[i+j].second<B[j].second)ok=false;
		}
		if(ok){
			for(int j=0;j<i;j++)res.push_back(A[j]);
			if(A[i].second!=B[0].second)res.push_back(make_pair(A[i].first,A[i].second-B[0].second));
			for(int j=0;j<C.size();j++)res.push_back(C[j]);
			if(A[i+B.size()-1].second!=B[B.size()-1].second)res.push_back(make_pair(A[i+B.size()-1].first,A[i+B.size()-1].second-B[B.size()-1].second));
			for(int j=i+B.size();j<A.size();j++)res.push_back(A[j]);
			out();
			return 0;
		}
	}
	for(int i=0;i<A.size();i++)printf("%c %d ",A[i].first,A[i].second);
	printf("$\n");
}

Measured memory_bytes: 1096
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, L, q;
	cin >> N;
	VI X(N);
	REP(i, N)cin >> X[i];
	cin >> L >> q;


	int day[30][100010];
	//jから2のi乗日で進める個数

	REP(i, 30)REP(j, 100010)day[i][j] = INF * 10;


	int k = 0, s = 0, g = 0;

	while (k < N - 1) {
		if (g != N - 1) {
			while (X[g + 1] - X[s] <= L) {
				g++;
				if (g == N - 1)break;
			}
		}
		day[0][k] = g - s;
		k++;
		s++;
	}
	
	FOR(i, 1, 30) {
		REP(j, N - 1) {
			if (j + day[i-1][j] >= N -1)continue;
			day[i][j] = day[i - 1][j] + day[i - 1][j + day[i - 1][j]];
		}
	}
	
	while (q--) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (b < a)swap(a,b);
		int ans = 0;
		int now = a;
		
		do {
			bool F = true;

			for (int i = 25; i >= 0; i--) {
				if (day[i][now] + now <= b) {
					F = false;
					
					now += day[i][now];
					ans += (1LL << i);
					if (now == b) {
						F = true;
						break;
					}
				}
			}

			if (F) {
				if (now != b)ans++;
				cout << ans << endl;
				break;
			}
			else continue;

		} while (1);
	}
	return 0;
}



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

using namespace std;

const int N = 1e5 + 5 , M = 18;

struct edge {
    int to , color , cost;
};

struct q1 {
    int query_id , factor;
};

struct q2 {
    int query_id , color , factor;
};

struct q3 {
    int query_id , color , new_cost , factor;
};

vector<edge> adj[N];
vector<q1> t1[N]; // cum sum
vector<q2> t2[N]; // sum of edges of color
vector<q3> t3[N]; // count of edges of color * new_cost
int par[N] , lvl[N] , in[N];

void dfs(int node , int p = 0 , int l = 1) {
    par[node] = p;
    lvl[node] = l;
    for (auto &c : adj[node]) {
        if (c.to == p) continue;
        dfs (c.to , node , l + 1);
    }
}

int memo[N][M];
int solve (int u , int k) {
    if (!k) return par[u];
    int &ret = memo[u][k];
    if (~ret) return ret;
    return ret = solve(solve(u , k - 1) , k - 1);
}

int LCA(int u , int v) {
    if (lvl[u] < lvl[v])
        swap(u , v);

    for (int i = M ;i >= 0 ;i--)
        if (lvl[solve(u , i)] >= lvl[v])
            u = solve(u , i);

    if (u == v)
        return u;

    for (int i = M ;i >= 0 ;i--)
        if (solve(u , i) != solve(v , i))
            u = solve(u , i) , v = solve(v , i);

    return par[u];
}

int ans[N] , sum_with_color[N] , count_with_color[N];
void go(int node , int pre_sum = 0 , int par = -1) {
    for (auto &c : t2[node])
        ans[c.query_id] += sum_with_color[c.color] * c.factor;

    for (auto &c : t1[node])
        ans[c.query_id] += pre_sum * c.factor;

    for (auto &c : t3[node])
        ans[c.query_id] += count_with_color[c.color] * c.new_cost * c.factor;

    for (auto &c : adj[node]) {
        if (c.to == par) continue;
        sum_with_color[c.color] += c.cost;
        count_with_color[c.color]++;
        go(c.to , pre_sum + c.cost , node);
        sum_with_color[c.color] -= c.cost;
        count_with_color[c.color]--;
    }
}

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

    int n , q;
    cin >> n >> q;

    for (int i = 0 ;i < n - 1 ;i++) {
        int u , v , color , cost;
        cin >> u >> v >> color >> cost;
        adj[u].push_back({v , color , cost});
        adj[v].push_back({u , color , cost});
    }

    dfs(1); // root
    memset(memo , -1 , sizeof memo);

    for (int i = 0 ;i < q ;i++) {
        int u , v , color , new_cost;
        cin >> color >> new_cost >> u >> v;
        int lca = LCA(u , v);

        t1[u].push_back({i , 1});
        t1[v].push_back({i , 1});
        t1[lca].push_back({i , -2});

        t2[u].push_back({i , color , -1});
        t2[v].push_back({i , color , -1});
        t2[lca].push_back({i , color , 2});

        t3[u].push_back({i , color , new_cost , 1});
        t3[v].push_back({i , color , new_cost , 1});
        t3[lca].push_back({i , color , new_cost , -2});
    }

    go(1);

    for (int i = 0 ;i < q ;i++)
        cout << ans[i] << '\n';
}

Measured memory_bytes: 43300
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  string S;
  cin >> S;
  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (S == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
from itertools import permutations

def main():
    def distance(x1, y1, x2, y2):
        return((abs(x1-x2)**2 + abs(y1-y2)**2) ** (1/2))
        
    n = int(input())
    l = list(range(n))
    perm = list(permutations(l, n))
    perm_l = len(perm)
    a = [0] * n
    b = [0] * n
    for i in range(n):
        a[i], b[i] = map(int, input().split())
    ans = 0
    for p in perm:
        for i in range(n-1):
            ans += distance(a[p[i]], b[p[i]], a[p[i+1]], b[p[i+1]])
    print(ans/perm_l)

if __name__ == '__main__':
    main()

Measured memory_bytes: 13952
#define scanf_s scanf
#include<stdio.h>
int main(void) {
	int a, b, i, mo[4] = { 6000,4000,3000,2000 };
	for (i = 0; i < 4; i++) {
		scanf_s("%d %d", &a, &b);
		printf("%d\n", mo[a - 1] * b);
	}	
	return(0);
}

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

void call(int n) {
	for (int i = 1; i <= n; i++) {
		int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		}
		else {
			while (x) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}
	}
	cout << endl;
}
int main() {
	int n;
	cin >> n;
	call(n);
}
	


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#include <queue>
#define NUM 1000
using namespace std;
int main(){
    int n, q, query, x, t;
    queue<int> s[NUM];
    scanf("%d %d", &n, &q);
    for(int i = 0; i < q; i++){
        scanf("%d %d", &query, &t);
        switch(query){
            case(0):
                scanf("%d", &x);
                s[t].push(x);
                break;
            case(1):
                if(!s[t].empty()) printf("%d\n", s[t].front());
                break;
            case(2):
                if(!s[t].empty()) s[t].pop();
                break;
        }
    }
}


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

from sys import stdin

n,h,w = [int(x) for x in stdin.readline().split()]
data = [[int(x) for x in stdin.readline().split()] for i in range(n)]

count = 0
for h0, w0 in data:
    if h0 >= h and w0 >= w:
        count += 1

print(count)


Measured memory_bytes: 3188
import java.util.*;

public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		int k = 0;
		for (int i = Math.min(A, B); i > 0; i--) {
			if (A%i == 0 && B%i == 0) {
				k++;
				if (k == C) {
					System.out.println(i);
				}
			}
		}
    }
  
}


Measured memory_bytes: 23764