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

//#define getchar getchar_unlocked
//#define putchar putchar_unlocked
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define ff first
#define ss second
#define err stderr
#define out stdout

typedef long long int ll;
typedef long double ld;
typedef short int sh;

inline void readI(int *i)
{
	register int t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=(t*znak);
}
inline void readUI(int *i)
{
	register int t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=t;
}
inline void readL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak*=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=(t*znak);
}
inline void readUL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=t;
}
inline void writeL(ll l)
{
	if (l==0)
	{
		putchar(48);
	}
	else
	{
		if (l<0)
		{
		   l*=-1;
		   putchar(45);
		}
		int _tab[21];
		int wsk=0;
		while (l>0)
		{
			++wsk;
			_tab[wsk]=(l%10)+48;
			l/=10;
		}
		for (int j=wsk; j>=1; --j)
		{
			putchar(_tab[j]);
		}
	}
}
inline void writeS(string s)
{
	int l=s.length();
	for (int i=0; i<l; ++i)
	{
		putchar(s[i]);
	}
}
inline void space()
{
	putchar(32);
}
inline void endl()
{
	putchar(10);
}

#define debug if(1)
#define debug2 if(1)
#define debug3 if(1)
#define debug4 if(1)
#define MAXN (int)(3e3)+5

int n;
ll dp[MAXN][MAXN][2];

int main()
{
	readUI(&n);
	for (int i=1; i<=n; ++i)
	{
		readUL(&dp[i][i][0]);
		dp[i][i][1]=-dp[i][i][0];
	}
	for (int dl=2; dl<=n; ++dl)
	{
		for (int i=1; i<=n-dl+1; ++i)
		{
			dp[i][i+dl-1][0]=max(dp[i][i+dl-2][1]+dp[i+dl-1][i+dl-1][0], dp[i+1][i+dl-1][1]+dp[i][i][0]);
			dp[i][i+dl-1][1]=min(dp[i][i+dl-2][0]+dp[i+dl-1][i+dl-1][1], dp[i+1][i+dl-1][0]+dp[i][i][1]);
		}
	}
	fprintf (out, "%lld\n", dp[1][n][0]);
	return 0;
}
/*
*/




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

typedef long long ll;
typedef long double ld;

#define n1		      "\n"
#define B                     begin()
#define E                     end()
#define F                     first
#define S                     second
#define pb                    push_back
#define pf                    push_front
#define popb                  pop_back()
#define popf                  pop_front()

const int BIG=1e5+55;
const int BIGG=1e9+7;
const ll BIGGE=1e12+55;
const double SML=(1e-7);

using namespace std;

    int t;

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL);
    cout.tie(NULL);
    cin >>t;
    if (t % 1000 != 0) {
        int x = t % 1000;
        cout <<1000 - x;
        return 0;
    }
    cout <<0;



    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    ll n;
    scanf("%lld",&n);

    ll nn = n;
    int keta = 0;
    int head = 0;
    int allnine = 1;

    if(n<10){
        cout << n << endl;
        return 0;
    }

    while(nn>0){
        if(allnine==2)allnine=0;
        if(nn%10!=9&&allnine==1)allnine=2;
        keta++;
        if(nn<10)head=nn;
        nn /= 10;
    }

    if(allnine==1){
        cout << keta*9 << endl;
        return 0;
    }

    if(allnine==2){
        cout << (keta-1)*9 + head << endl;
        return 0;
    }


    ll ans = (keta-1)*9 + head-1;
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
import sys,random

rand = random.randint

def prime(n):
	if n == 2:
		return True
	if n < 2 or n & 1 == 0:
		return False
	d = (n-1) >> 1
	while d & 1 == 0:
		d >>= 1
	
	for i in range(4):
		a = rand(1,n-1)
		t = d
		y = pow(a,t,n)
		while t != n-1 and y != 1 and y != n-1:
			y = pow(y,2,n)
			t <<= 1
		if y != n-1 and t & 1 == 0:
			return False
	return True

a = [prime(i) for i in range(1000000)]

for s in sys.stdin:
	i = int(s)
	print(a[:i+1].count(True))

Measured memory_bytes: 45276
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        s: chars,
    }

    let mut l = 0;
    let mut r = 0;

    let mut b_cnt = 0;
    let mut w_cnt = s.iter().filter(|&c| *c == '.').count();
    let mut cnt = b_cnt + w_cnt;

    for i in 0..n {
        if s[i] == '.' {
            w_cnt -= 1;
        } else {
            b_cnt += 1;
        }
        cnt = min(cnt, w_cnt + b_cnt);
    }

    println!("{}", cnt);
}


Measured memory_bytes: 4352
# 解説を参考に作成

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(H, W, C, D, Ss):
    cost_map = [[-1] * (W + 4) for _ in range(H + 4)]
    Ss = ['#' * (W + 4)] * 2 + ['##' + S + '##' for S in Ss] + ['#' * (W + 4)] * 2
    C = [c + 1 for c in C]
    D = [d + 1 for d in D]
    cost = 0
    ans = -1
    dq = deque()
    dq.append(C)
    while dq:
        next_dq = deque()
        flg = False
        while dq:
            h, w = dq.popleft()
            if h == D[0] and w == D[1]:
                ans = cost
                flg = True
                break
            if cost_map[h][w] >= 0:
                continue
            cost_map[h][w] = cost
            for i in range(h - 2, h + 2 + 1):
                for j in range(w - 2, w + 2 + 1):
                    if Ss[i][j] == '#':
                        continue
                    if cost_map[i][j] >= 0:
                        continue
                    if abs(h - i) + abs(w - j) == 1:
                        dq.append([i, j])
                    else:
                        next_dq.append([i, j])
        if flg:
            break
        dq = next_dq
        cost += 1
    print(ans)


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    H, W = map(int, input().split())
    C = [int(i) for i in input().split()]
    D = [int(i) for i in input().split()]
    Ss = [input() for _ in range(H)]
    # Bs = [int(i) for i in input().split()]
    solve(H, W, C, D, Ss)


Measured memory_bytes: 139552
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    while(1){
        char num[1001];
        int a=0;
        scanf("%s",num);
        if(num[0]=='0') break;
        for(int i=0;num[i]!='\0';i++){
            a+=num[i]-'0';
        }
        printf("%d\n",a);
    }
    
}


Measured memory_bytes: 3216
#include<stdio.h>
int main()
{
	long long N,x,a[100005],i,count=0;   //count可能很大，暂定 
	scanf("%lld %lld",&N,&x);
	for(i=0;i<N;i++)
	{
		scanf("%lld",&a[i]);
	}
	if(a[i-1]>x)
	{
		count+=a[i-1]-x;
		a[i-1]=a[i-1]-(a[i-1]-x);       //变更值 
	 } 
	 if(a[0]>x)
	 {
	 	count+=a[0]-x;
	 	a[0]=a[0]-(a[0]-x);
	 }
	 
	 for(i=1;i<=N-1;i++)
	 {
	 	if((a[i]+a[i-1])>x)
	 	{
	 		count+=a[i]+a[i-1]-x;
	 		a[i]=a[i]-(a[i]+a[i-1]-x);
		 }
	 }
	 printf("%lld",count);
	
}

Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int i,n,k,R;
    scanf("%d",&R);
    if(R<1200){
        printf("ABC");
    }else if (R<2800){
        printf("ARC");
    }else{
        printf("AGC");
    }

    return 0;
}


Measured memory_bytes: 128
A11,A12,A13=list(map(lambda i:int(i),input().split()))
A21,A22,A23=list(map(lambda i:int(i),input().split()))
A31,A32,A33=list(map(lambda i:int(i),input().split()))

N=int(input())

bingo=False
b=[]
for i in range(N):
    b.append(int(input()))

if A11 in b and A12 in b and A13 in b:
    bingo =True
elif A21 in b and A22 in b and A23 in b:
    bingo =True
elif A31 in b and A32 in b and A33 in b:
    bingo =True
elif A11 in b and A21 in b and A31 in b:
    bingo =True
elif A12 in b and A22 in b and A32 in b:
    bingo =True
elif A13 in b and A23 in b and A33 in b:
    bingo =True
elif A11 in b and A22 in b and A33 in b:
    bingo =True
elif A13 in b and A22 in b and A31 in b:
    bingo =True

if bingo:
    print("Yes")
else:
    print("No")


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

using namespace std;
typedef long long ll;
int main() {
  ll N, H;
  cin >> N >> H;

  vector<pair<int, int> > vec;
  for (int i = 0; i < N; i++) {
    int a,b;
    cin >> a >> b;
    vec.push_back(make_pair(a, -1));
    vec.push_back(make_pair(b, 1));
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int cnt = 0;
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i].second == 1) {
      H -= vec[i].first;
      cnt++;
    } else {
      if (H % vec[i].first == 0) {
        cnt += H / vec[i].first;
      } else {
        cnt += H / vec[i].first;
        cnt++;
      }
      H = 0;
    }
    if (H <= 0) {
      break;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 2420
n, m = [int(i) for i in input().split()]
abc = []
for _ in range(m):
    a, b, c = [int(i) for i in input().split()]
    abc.append([a - 1, b - 1, c])

dist = [-10 ** 18] * n
dist[0] = 0

def update():
    global dist
    for a, b, c in abc:
        if dist[a] + c > dist[b]:
            dist[b] = dist[a] + c

for _ in range(n):
    update()
a = dist[-1]
for _ in range(n):
    update()
b = dist[-1]
if a != b:
    print("inf")
else:
    print(a)

Measured memory_bytes: 45544
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll>> pqls;
priority_queue <P,vector<P>,greater<P>> pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,d,e,f,g,h,w;
 
ll x[800005],y[800005],z[900005];
char s[500005];
ll dp[5000][5000];

int main(){
    cin>>s>>k;
	a = min((ll)strlen(s),k);
	for(i=0;i<a;i++){
		if(s[i]!='1'){
			p(s[i]);
			return 0;
		}
	}
	p(1);
	return 0;
}

Measured memory_bytes: 7424
from typing import Generic, List, TypeVar

T = TypeVar('T')

class Stack(Generic[T]):
	def __init__(self) -> None:
		self._container: List[T] = []
					
	@property
	def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	def push(self, item: T) -> None:
		self._container.append(item)

	def pop(self) -> T:
		return self._container.pop() # LIFO
	
	def __repr__(self) -> str:
		return repr(self._container)


if __name__ == "__main__":
	stack1 = Stack()
	stack2 = Stack()
	string = input()
	sum = 0
	for i in range(len(string)):
		if string[i] == "\\":
			stack1.push(i)
		elif string[i] == "_":
			pass
		elif string[i] == "/":
			if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	print(sum)
	b = []
	while not stack2.empty:
		b.append(str(stack2.pop()[1]))
	b.append(str(len(b)))
	b.reverse()
	print(' '.join(b))



Measured memory_bytes: 7980
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	string s;
	int cnt = 0;
	while (cin >> s) {
		bool f = true;
		for (int i = 0; i < s.length()/2; i++) {
			if (s[i] != s[s.length() - 1 - i]) {
				f = false;
				break;
			}
		}

		if (f)cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3072
#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()
{
    vector<int> c(4);
    int n;
    cin >> n;
    string s;
    rep(i, n) {
        cin >> s;
        if (s == "AC") {
            c[0] += 1;
        } else if (s == "WA") {
            c[1] += 1;
        } else if (s == "TLE") {
            c[2] += 1;
        } else {
            c[3] += 1;
        }
    }

    printf("AC x %d\n", c[0]);
    printf("WA x %d\n", c[1]);
    printf("TLE x %d\n", c[2]);    
    printf("RE x %d\n", c[3]);

    return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;

int uf[100005];
vector<int> w[100005];
int n,m;

int find(int x){
	if(uf[x]<0)return x;
	return uf[x]=find(uf[x]);
}

void join(int x, int y){
	x=find(x);y=find(y);
	if(x==y)return;
	n--;
	if(uf[x]>uf[y])swap(x,y);
	uf[x]+=uf[y];
	uf[y]=x;
}

int main(){
	memset(uf,-1,sizeof(uf));
	scanf("%d%d",&n,&m);
	fore(i,0,n){
		int k;
		scanf("%d",&k);
		while(k--){
			int x;
			scanf("%d",&x);x--;
			w[x].pb(i);
		}
	}
	fore(i,0,m)fore(j,0,SZ(w[i])-1)join(w[i][j],w[i][j+1]);
	puts(n==1?"YES":"NO");
	return 0;
}

Measured memory_bytes: 4992
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

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



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;


int main() {
	int h, w;
	cin >> h >> w;

	vector<string> s(h + 1);
	for (int i = 1; i <= h; i++) {
		string si;
		cin >> si;
		s[i] = "#" + si;
	}

	s[0] = string('#', w + 1);

	vector<vector<int>> dp(h + 1, vector<int>(w + 1, BIG_NUM));
	dp[1][1] = 0;
	if (s[1][1] == '#') {
		dp[1][1]++;
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			int d1 = dp[i - 1][j];
			if (s[i][j] == '#' && s[i - 1][j] == '.') {
				d1++;
			}
			int d2 = dp[i][j - 1];
			if (s[i][j] == '#' && s[i][j - 1] == '.') {
				d2++;
			}

			dp[i][j] = min(dp[i][j], min(d1, d2));

		}
	}
	cout << dp[h][w] << endl;
}

Measured memory_bytes: 3552
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let a = line[0];
    let b = line[1];
    let t = line[2];

    println!("{}", b * (t/a));
}


Measured memory_bytes: 4352
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            String str = in.next();
            String[] ary = str.split("");
            boolean check1 = ary[2].equals(ary[3]);
            boolean check2 = ary[4].equals(ary[5]);
            out.print(check1 && check2 ? "Yes" : "No");
        }
    }
}

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

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

    string s;
    cin >> s;
    int q;
    cin >> q;
    bool rev = false;
    string a, b;
    while (q--) {
        int k;
        cin >> k;
        if (k == 1) {
            rev = !rev;
        } else {
            int f;
            cin >> f;
            char c;
            cin >> c;
            if (!rev && f == 1 || rev && f == 2) {
                a += c;
            } else {
                b += c;
            }
        }
    }
    reverse(a.begin(), a.end());
    s = a + s + b;
    if (rev) {
        reverse(s.begin(), s.end());
    }
    cout << s << endl;
}


Measured memory_bytes: 1200
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <climits>
#define VALUE_TOPPING 100
#define swap(type, x, y) do{type temp = x; x = y; y = temp;}while(0);
using namespace std;

int sum_calorie(int x[], int cloth_cal, int cloth_val, int topping_val, int topping_num);
void quick_sort(int x[], int left, int right);

int main(void) {
    int topping_num, i;
    int cloth_val, topping_val;
    int cloth_cal;
    
    cin >> topping_num;
    cin >> cloth_val >> topping_val;
    cin >> cloth_cal;
    
    int topping_cal[topping_num + 1];
    topping_cal[0] = 0;
    
    for(i = 1; i < topping_num + 1; i++)
        cin >> topping_cal[i];
    
    quick_sort(topping_cal, 1, topping_num);
    
    cout << sum_calorie(topping_cal, cloth_cal, cloth_val, topping_val, topping_num) << endl;
    
    return(0);
}

int sum_calorie(int x[], int cloth_cal, int cloth_val, int topping_val, int topping_num) {
    int sum_x[VALUE_TOPPING + 1];
    register int i;
    int ans = INT_MIN, count = 0;
    
    sum_x[0] = 0;
    for(i = 1; i < topping_num + 1; i++) {
        sum_x[i] = sum_x[i - 1] + x[i];
        count++;
        int calorie = sum_x[i] +  cloth_cal;
        int value = cloth_val + (topping_val * count);
        int fin = (int)((double)calorie / value);
        if(fin > ans) ans = fin;
        else         ;   //return(ans);
    }

    return(ans);
}

void quick_sort(int x[], int left, int right) {
    int i, j;
    int pivot;
    
    i = left;
    j = right;
    pivot = x[(left + right) / 2];
    
    while(1) {
        while(x[i] > pivot) i++;
        while(x[j] < pivot) j--;
        
        if(i >= j) break;
        
        swap(int, x[i], x[j]);
        i++;
        j--;
    }
    if(i - 1 > left) quick_sort(x, left, i - 1);
    if(j + 1 < right) quick_sort(x, j + 1, right);
}

Measured memory_bytes: 1160
#pragma comment(linker, "/STACK:33554432")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cmath>
#include <cstring>
#include <bitset>

using namespace std;
void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
using ld = long double;


void precalc() {}

const int MAXN = 3e5 + 9;

map<int, int> pows;

int inp[11111];

ll bin_pow(ll base, ll power, ll mod){

    if (power == 0)
        return 1;

    if (power % 2 )
        return (base * bin_pow(base, power  - 1, mod)) % mod;

    auto val = bin_pow(base, power >> 1, mod);

    return (val * val) % mod;
}

ll back(ll elem, ll mod) {
    return bin_pow(elem, mod - 2, mod);
}


void solve() {

    int n;
    cin >> n;

    for (int i = 0; i < n; ++i) {
        ll a;
        cin >> a;

        ll x = a;
        inp[i] = x;

        for (ll i = 2; i * i <= a; ++i) {

            if (x % i) {
                continue;
            }
            int p = 0;
            while (x % i == 0) {
                x /= i;
                p++;
            }

            if (pows.count(i) == 0)
                pows[i] = 1;
            pows[i] = max(pows[i], p);
        }

        if (pows.count(x) == 0)
            pows[x] = 1;

        if (x > 1)
            pows[x] = max(pows[x], 1);

    }

    ll answr = 0;
    ll mod = 1e9 + 7;


    ll b_base = 1;

    for (auto e : pows){
        b_base *= bin_pow(e.first, e.second, mod);
        b_base %= mod;
    }

    for (int jj = 0; jj < n; ++ jj){

        ll x = inp[jj];
        ll a = x;

        ll bi = b_base;

        for (ll i = 2; i * i <= a; ++i) {

            if (x % i) {
                continue;
            }
            ll p = 1;
            while (x % i == 0) {
                x /= i;
                p *= i;
            }

            bi *= back(p, mod);
            bi %= mod;
        }

        if (x > 1) {
            bi *= back(x, mod);
            bi %= mod;
        }

        answr += bi;
        answr %= mod;
    }

    cout << answr;
}

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

    precalc();
    solve();
}

Measured memory_bytes: 768
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			char[] s = in.nextString().toCharArray();
			char[] t = in.nextString().toCharArray();
			int[] sumSA = new int[s.length+1];
			int[] sumSB = new int[s.length+1];
			int[] sumTA = new int[t.length+1];
			int[] sumTB = new int[t.length+1];

			for (int i = 0; i < s.length; i++) {
				if (s[i] == 'A') {
					sumSA[i+1] = sumSA[i] + 1;
					sumSB[i+1] = sumSB[i];
				} else {
					sumSB[i+1] = sumSB[i] + 1;
					sumSA[i+1] = sumSA[i];
				}
			}

			for (int i = 0; i < t.length; i++) {
				if (t[i] == 'A') {
					sumTA[i+1] = sumTA[i] + 1;
					sumTB[i+1] = sumTB[i];
				} else {
					sumTB[i+1] = sumTB[i] + 1;
					sumTA[i+1] = sumTA[i];
				}
			}


			int q = in.nextInt();
			for (int i = 0; i < q; i++) {
				int a = in.nextInt();
				int b = in.nextInt();
				int c = in.nextInt();
				int d = in.nextInt();

				long csa = sumSA[b] - sumSA[a-1];
				long csb = sumSB[b] - sumSB[a-1];

				long cta = sumTA[d] - sumTA[c-1];
				long ctb = sumTB[d] - sumTB[c-1];

				if ((csb + csa*2)%3 == (ctb + cta*2)%3) {
					out.println("YES");
				} else {
					out.println("NO");
				}
			}
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 53840
# C
import itertools

n = int(input())
# M:0 A:1 R:2 C:3 H:4
march = ['M', 'A', 'R', 'C', 'H']
l = [0] * 5
ans = 0
for i in range(n):
    s = str(input())
    for index, c in enumerate(march):
        if s[0] == c:
            l[index] += 1
for (a,b,c) in itertools.combinations(range(5), 3):
    ans += l[a] * l[b] * l[c]

print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 2010
#define MOD 1000000007
using namespace std;
typedef long long ll;
int fa[MAXN];
ll val[MAXN];
struct node{
	int u,v;
	ll val;
	bool operator < (const node& a) const {
		return val<a.val;
	}
}l[MAXN];
bool used[MAXN];
int dep[MAXN];
vector<int> a[MAXN];
vector<ll> w[MAXN];
ll x;
ll get_max(int u,int v){
	if(dep[u]<dep[v])
		swap(u,v);
	ll res=0;
	while(dep[u]!=dep[v]){
		res=max(res,val[u]);
		u=fa[u];
	}
	while(u!=v){
		res=max(res,val[u]);
		res=max(res,val[v]);
		u=fa[u];
		v=fa[v];	
	}
	return res;
}
void dfs(int x,int fax=0){
	for(int i=0;i<int(a[x].size());i++){
		int u=a[x][i];
		if(u==fax)
			continue;
		dep[u]=dep[x]+1;
		fa[u]=x;
		dfs(u,x);
		val[u]=w[x][i];	
	}
}
int get_fa(int x){
	if(fa[x]==0)
		return x;
	fa[x]=get_fa(fa[x]);
	return fa[x];	
}
void merge(int id){
	if(get_fa(l[id].u)!=get_fa(l[id].v)){
		int u=get_fa(l[id].u);
		int v=get_fa(l[id].v);
		a[l[id].u].push_back(l[id].v);
		a[l[id].v].push_back(l[id].u);
		w[l[id].u].push_back(l[id].val);
		w[l[id].v].push_back(l[id].val);
		x-=l[id].val;
		used[id]=1;
		fa[u]=v;
	}
}
int n,m;
ll bits[MAXN],diff[MAXN];
int main(){
	SF("%d%d",&n,&m);
	SF("%lld",&x);
	bits[0]=1;
	for(int i=1;i<=m;i++)
		bits[i]=(bits[i-1]<<1)%MOD;
	for(int i=1;i<=m;i++)
		SF("%d%d%lld",&l[i].u,&l[i].v,&l[i].val);	
	sort(l+1,l+1+m);
	for(int i=1;i<=m;i++)
		merge(i);
	dfs(1);
	int cnt=0;
	for(int i=1;i<=m;i++)
		if(used[i]==0)
			diff[++cnt]=l[i].val-get_max(l[i].u,l[i].v);
	sort(diff+1,diff+1+cnt);
	ll ans=0;
	if(x==0)
		ans=(bits[m]-2ll*(bits[m-n+1]))%MOD;
	for(int i=1;i<=cnt;i++)
		if(diff[i]==x)
			(ans+=bits[cnt-i]*2ll)%=MOD;
	PF("%lld",(ans+MOD)%MOD);
}

Measured memory_bytes: 512
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v) { cout << v << endl; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(ll __x = __start; __x < __end; __x++)

int main() {
  int h, w; in(h),in(w);
  vector<string> S(h);
  loop(i,0,h) in(S[i]);
  int L[h][w], R[h][w], U[h][w], D[h][w];
  loop(y,0,h) {
    loop(x,0,w) {
      if (x == 0) L[y][x] = S[y][x] == '.';
      else if (S[y][x] == '#') L[y][x] = 0;
      else L[y][x] = L[y][x-1] + 1;
    }
    for (int x=w-1; x>=0; x--) {
      if (x == w-1) R[y][x] = S[y][x] == '.';
      else if (S[y][x] == '#') R[y][x] = 0;
      else R[y][x] = R[y][x+1] + 1;
    }
  }
  
  loop(x,0,w) {
    loop(y,0,h) {
      if (y==0) U[y][x] = S[y][x] == '.';
      else if (S[y][x] == '#') U[y][x] = 0;
      else U[y][x] = U[y-1][x] + 1;
    }
    for (int y=h-1; y>=0; y--) {
      if (y==h-1) D[y][x] = S[y][x] == '.';
      else if (S[y][x] == '#') D[y][x] = 0;
      else D[y][x] = D[y+1][x] + 1;
    }
  }
  
  int max_ = 0;
  loop(y,0,h) loop(x,0,w) {
    max_ = max(max_, L[y][x] + R[y][x] + U[y][x] + D[y][x] - 3);
  }
  cout << max_ << endl;
  return 0;
}


Measured memory_bytes: 73736
def shuffle_cards(cards, num_of_cards)
  str =  cards[num_of_cards..-1] + cards[0..(num_of_cards-1)]
  return str
end

loop do
  cards = gets.chomp
  break if cards == "-" 
  num_of_shuffling = gets.chomp.to_i
  shuffle_num_of_cards = []
  num_of_shuffling.times { shuffle_num_of_cards.push(gets.chomp.to_i) }

  shuffle_num_of_cards.each do |i|
    cards = shuffle_cards(cards, i)
  end
  puts cards
end

Measured memory_bytes: 8716
import numpy as np
n,w = [int(x) for x in input().split()]
wv = np.array([[int(y) for y in input().split()] for z in range(n)],dtype=int)
sum_wv = np.sum(wv,axis=0)
sum_v = sum_wv[1]
sum_w = sum_wv[0]
dp = np.full(sum_v+1,sum_w,dtype="int")
dp[0] = 0
for wei,val in wv:
    dp[val:] = np.minimum(dp[val:],dp[:-val]+wei)
for p in range(sum_v,1,-1):
    if(dp[p] <= w):
        print(p)
        break


Measured memory_bytes: 14780
#include<bits/stdc++.h>
using namespace std;
#define int   long long
#define N 666666
#define inf 999999999999999999
int arr[N];
signed main(){
	int f=0;
	int n;cin>>n;
	int s=100;
	for(int i=1;i<=n;i++){
		s=(1.01)*s;
		if(s>=n){
			cout<<i;return 0;
		}
	}
	
 	return 0;
}
/**/

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



int main(){
        int n, k,max,temp,num,total;
        while(true) {  //ベクターに格納
                cin >> n>>k;
                if(n==k!=0) break;
                vector<double> v;
                total=0;
                v.push_back(total);
                for(int i=0;i<n;i++){
                  cin>>num; //入力をnumに代入
                  total+=num;
                  v.push_back(total); //ベクターvにプッシュ
                }

                max=0;
                temp=0;
                for(int i=0; i+k<=n; i++) {
                        temp=v[i+k]-v[i];
                        if(temp>max) max=temp; //tempが最も大きい数値ならmaxを更新
                        temp=0; //tempの初帰化
                }
                cout<<max<<endl;
        }
}


Measured memory_bytes: 3860
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _overload4(_1,_2,_3,_4,name,...) name
#define _overload3(_1,_2,_3,name,...) name
#define _overload2(_1,_2,name,...) name
#define _re(n) _rep(i,n)
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(ll i=a;i<b;++i)
#define _repc(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) _overload4(__VA_ARGS__,_repc,_repi,_rep,_re)(__VA_ARGS__)
#define _rre(n) _rrep(i,n)
#define _rrep(i,n) _rrepi(i,0,n)
#define _rrepi(i,a,b) for(ll i=b-1;i>=a;i--)
#define _rrepc(i,a,b,c) for(ll i=a+(b-a-1)/c*c;i>=a;i-=c)
#define rrep(...) _overload4(__VA_ARGS__,_rrepc,_rrepi,_rrep,_rre)(__VA_ARGS__)
#define sum(...) accumulate(range(__VA_ARGS__),0)
#define _range(i) (i).begin(),(i).end()
#define _rangek(i,k) (i).begin(),(i).begin()+k
#define range(...) _overload2(__VA_ARGS__,_rangek,_range)(__VA_ARGS__)
#define LINF (ll)1000000000000000000
#define MOD (ll)1000000007
#define INF (int)1000000007
#define Yes(i) out(i?"Yes":"No")
#define YES(i) out(i?"YES":"NO")
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,size) vector<type> name(size);
#define VEC(type,name,size) vector<type> name(size);in(name)
struct aaa{aaa(){cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}aaaaaaa;
template<typename T>
inline constexpr T gcd (T a,T b) {if(a==b)return a;else return gcd(b,(a-1)%b+1);}
inline void in() {}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec);
template<typename T,size_t size>
istream& operator >> (istream& is, array<T,size>& vec);
template<typename T,typename L>
istream& operator >> (istream& is, pair<T,L>& p);
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec);
template<typename T,typename L>
ostream& operator << (ostream& os, pair<T,L>& p);
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;}
template<typename T,typename L>
istream& operator >> (istream& is, pair<T,L>& p){is >> p.first;is >> p.second;return is;}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){os << vec[0];rep(i,1,vec.size()){os << ' ' << vec[i];}return os;}
template<typename T,typename L>
ostream& operator << (ostream& os, pair<T,L>& p){os << p.first << " " << p.second;return os;}
template <class Head, class... Tail>
inline void in(Head&& head,Tail&&... tail){cin>>head;in(move(tail)...);}
template <class T>
inline void out(T t){cout<<t<<'\n';}
inline void out(){cout<<'\n';}
template <class Head, class... Tail>
inline void out(Head head,Tail... tail){cout<<head<<' ';out(move(tail)...);}


int main(){
    INT(n);
    VEC(int,a,n);
    int max=*max_element(range(a));
    vec(int,cost,max+1);
    rrep(i,1,max+1)if(max%i)cost[i]=cost[i+1]+1;
    int ans=0;
    rep(n)ans+=cost[a[i]];
    out(ans);
}
















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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

bool is_prime(ll a) {
    if (a <= 1) {
        return false;
    }
    bool res = true;
    for (ll x = 2; x * x <= a; x++) {
        if (a % x == 0) {
            res = false;
            break;
        }
    }
    return res;
}

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

    ll X;
    cin >> X;
    while (1) {
        if (is_prime(X)) {
            cout << X << endl;
            break;
        }
        ++X;
    }

    return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, K;
    cin >> N >> K;

    ll ans = 0;
    for (int i = 1; i <= N; ++i)
    {
        if ((2 * i) % K == 0)
        {
            int res = i % K;
            ll count = N / K;
            if (N - K * (N / K) >= K - res) count++;
            ans += count * count;
        }
    }

    cout << ans << endl;
}


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

signed main(){
	int n, m;
	cin >> n >> m;

	vector<string> a(n), b(m);
	
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < m; i++) cin >> b[i];
	
	for(int i = 0; i <= n - m; i++){
		for(int j = 0; j <= n - m; j++){
			bool ok = true;
			for(int k = 0; k < m; k++){
				for(int l = 0; l < m; l++){
					if(a[i + k][j + l] != b[k][l]) ok = false;
				}
			}
			if(ok == true){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

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

#define maxn 500010
#define fo(i,a,b) for(register int (i)=(a);(i)<=(b);++(i))
#define rd read()
#define inf 1e10
#define ll long long
int ans,a[maxn],b[maxn];
int read() {
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
	return x*f;
}
int main() {
	int n=rd;
	fo(i,1,n)
	{
	a[i]=rd;b[i]=a[i];
	}
	sort(a+1,a+n+1);
	fo(i,1,n)
	{
		if(b[i]==a[n])cout<<a[n-1]<<endl;
		else cout<<a[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
using namespace std;
int main() {
	string s, t; cin >> s >> t;
	int cnt = 0;
	for (int i = 0; i < 3; ++i) if (s[i] == t[i]) ++cnt;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include <set>
using namespace std;
set<int>b;
int n,a;
int s[1001],t[1001];
long long k[18];
int main(void){
	register int i,j,a,l;
	scanf("%d",&n);
	k[0]=1;
	for (i=1;i<18;++i)
		k[i]=k[i-1]*10;
	k[0]=0;
	for (i=0;i<n;++i)
		scanf("%d",&s[i]);
	for (i=0;i<n;++i){
		b.clear();
		for(j=0;j+i<n;++j)
			if(s[j]!=0||(s[j]==0&&i==0)){
				a=0;
				for (l=0;l<=i;++l)
					a=a*10+s[j+l];
				b.insert(a);
			}
		for (j=k[i];j<k[i+1];++j){
			if(!b.count(j)){
				printf("%d\n",j);
				return 0;
			}
		}
	}
	return 0;
} 

Measured memory_bytes: 3256
def input_mat(r, c):
    mat = []
    for _ in range(r):
        row = [int(s) for s in input().split()]
        assert len(row) == c
        mat.append(row)
    return mat

def mat_prod(A, B, n, m, l):
    mat = []
    for i in range(n):
        row = []
        for j in range(l):
            v = sum((A[i][x] * B[x][j] for x in range(m)))
            row.append(v)
        mat.append(row)
    return mat

def print_mat(mat):
    for r in mat:
        print(" ".join(map(str, r)))

if __name__ == '__main__':
    n, m, l = [int(s) for s in input().split()]
    A = input_mat(n, m)
    B = input_mat(m, l)
    #T = [[2,3],[1,4]]
    #E = [[1,0],[0,1]]
    #print_mat((mat_prod(T, E, 2, 2, 2)))
    C = mat_prod(A, B, n, m, l)
    print_mat(C)



Measured memory_bytes: 6828
n=int(input())
A=list(map(int,input().split()))
D={}
for a in A:
    if a in D:
        D[a]+=1
    else:
        D[a]=1
ans=0
for d in D:
    ans+=D[d]*(D[d]-1)//2
for a in A:
    print(ans-D[a]+1)

Measured memory_bytes: 26268
#include<iostream>
#include<string>
using namespace std;
int main(){
	int w, h, n;
	cin>>w>>h>>n;
	int x, y, a;
	int xs=0, ys=0;
	for (int i=0;i<n;i++){
		cin>>x>>y>>a;
		if (a==1 && x>xs) xs=x;
		if (a==2 && x<w) w=x;
		if (a==3 && y>ys) ys=y;
		if (a==4 && y<h) h=y;
	}
 
	if (w-xs>0 && h-ys>0) {
		cout<<(w-xs)*(h-ys)<<endl;
	}
	else {
		cout <<0<<endl;
	}
	return 0;
}

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

int main(){   
   int n,a,b,sum=0,bsum=0;
   string s;
   cin >> n >> a >> b;
   cin >> s;
   for(int i=0;i<n;i++){
       if(s.at(i)=='a'){
           if(a+b>sum){
               cout << "Yes" <<endl;
               sum++;
           }else{
                cout << "No" << endl;
           }
           
       }
       if(s.at(i)=='b'){
           if(a+b>sum){
               if(b>bsum){
               cout << "Yes" <<endl;
               sum++;
               bsum++;
               }else{
               cout << "No" << endl;
                }
           }else{
                cout << "No" << endl;
            }
           
       }
       if(s.at(i)=='c'){
           cout << "No" << endl;
       }
   }
}

Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
#define N 1000009
#define K 104206969
#define LL long long
#define INF 0x7fffffff
#define mymin(x,y) (x>=y?y:x)
#define mymax(x,y) (x>=y?x:y)
char input[N];
int fw[N];
int main() {
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	LL a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	if(w >= v && a != b)
		cout << "NO";
	else if (llabs(a - b) <= t * llabs(v - w))
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


Measured memory_bytes: 3132
import sys
input = sys.stdin.buffer.readline

N, M, K = map(int, input().split())
A = list(map(int, (input().split())))
B = list(map(int, (input().split())))
t = sum(B)
# 尺取法
j = M   # bはmから減らしていく
ans = 0
for i in range(N+1):    # aは0からnまで増やしていく
    if i: t += A[i-1]   # i個までの累計になるように足す 0個は0
    while (j>0 and t>K):    # t<=k または j==0 で抜ける
        j -= 1
        t -= B[j]
    if t>K: break   # bが0番まで行っても　t>k の場合はだめ
    ans = max(ans, i+j)
print(ans)


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

int main() {
  int s,s1,s2,s3;
  cin >> s;
  s3=s%10;
  s2=s%100-s%10;
  s1=(s-s%100)/1;
  cout << s1/100+s2/10+s3/1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;
const int INF = 1e18;

struct edge
{
    int to;
    int cost;
};
using Graph = vector<vector<edge>>;

#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
Graph G;

void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

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

    int n;
    cin >> n;
    Graph G(n);
    for (int i = 0; i < n; i++)
    {
        int u, k;

        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++)
        {
            int v;
            cin >> v;
            v--;
            G[u].push_back((edge){v, 1});
        }
    }

    queue<int> que;
    int dist[110];
    int seen[110];
    for (int i = 0; i < 110; i++)
    {
        dist[i] = INF;
        seen[i] = WHITE;
    }

    que.push(0);
    seen[0] = GRAY;
    dist[0] = 0;
    while (!que.empty())
    {
        int now = que.front();
        que.pop();
        seen[now] = BLACK;
        for (auto ne : G[now])
        {
            int v = ne.to;
            int vcost = ne.cost;
            if (seen[v] == BLACK)
                continue;
            dist[v] = dist[now] + 1;
            que.push(v);
            seen[v] = BLACK;
        }
    }

    for (int i = 0; i < n; i++)
    {
        cout << i + 1 << " " << ((dist[i] == INF) ? -1 : dist[i]) << endl;
    }
}

signed main()
{
    solve();
    return 0;
}



Measured memory_bytes: 3232
fn main() {
    proconio::input! {
        mut a: i32,
        mut b: i32,
        mut c: i32,
        mut d: i32,
    }
    loop {
        if c <= b {
            println!("Yes");
            return;
        }
        if a <= d {
            println!("No");
            return;
        }
        c -= b;
        a -= d;
    }
}


Measured memory_bytes: 2096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << c << ' ' << a << ' ' << b << endl;
  return 0;
}

Measured memory_bytes: 256