akhauriyash/Code-Regression huggingface dataset:
from collections import deque

while True:

    W,H = map(int,input().split())

    if W == 0 and H == 0:
        break

    a = []

    for i in range(H):

        A = list(input())
        a.append(A)

    q = deque([])

    for i in range(H):
        for j in range(W):

            if a[i][j] in ["W","B"]:
                q.append([i,j])

    while len(q) > 0:

        now = q.pop()
        nx = now[0]
        ny = now[1]

        if a[nx][ny] in[ "W","X" ]:

            if nx - 1 >= 0 and a[nx-1][ny] == ".":
                a[nx-1][ny] = "X"
                q.append([nx-1,ny])

            if ny - 1 >= 0 and a[nx][ny-1] == ".":
                a[nx][ny-1] = "X"
                q.append([nx,ny-1])

            if nx + 1 < H and a[nx+1][ny] == ".":
                a[nx+1][ny] = "X"
                q.append([nx+1,ny])

            if ny + 1 < W and a[nx][ny+1] == ".":
                a[nx][ny+1] = "X"
                q.append([nx,ny+1])


        if a[nx][ny] in ["B","C"]:

            if nx - 1 >= 0 and a[nx-1][ny] == ".":
                a[nx-1][ny] = "C"
                q.append([nx-1,ny])

            if ny - 1 >= 0 and a[nx][ny-1] == ".":
                a[nx][ny-1] = "C"
                q.append([nx,ny-1])

            if nx + 1 < H and a[nx+1][ny] == ".":
                a[nx+1][ny] = "C"
                q.append([nx+1,ny])

            if ny + 1 < W and a[nx][ny+1] == ".":
                a[nx][ny+1] = "C"
                q.append([nx,ny+1])

        if a[nx][ny] in ["B","C","Z"]:

            if nx - 1 >= 0 and a[nx-1][ny] == "X":
                a[nx-1][ny] = "Z"
                q.append([nx-1,ny])

            if ny - 1 >= 0 and a[nx][ny-1] == "X":
                a[nx][ny-1] = "Z"
                q.append([nx,ny-1])

            if nx + 1 < H and a[nx+1][ny] == "X":
                a[nx+1][ny] = "Z"
                q.append([nx+1,ny])

            if ny + 1 < W and a[nx][ny+1] == "X":
                a[nx][ny+1] = "Z"
                q.append([nx,ny+1])


        if a[nx][ny] in ["W","X","Z"]:

            if nx - 1 >= 0 and a[nx-1][ny] == "C":
                a[nx-1][ny] = "Z"
                q.append([nx-1,ny])

            if ny - 1 >= 0 and a[nx][ny-1] == "C":
                a[nx][ny-1] = "Z"
                q.append([nx,ny-1])

            if nx + 1 < H and a[nx+1][ny] == "C":
                a[nx+1][ny] = "Z"
                q.append([nx+1,ny])

            if ny + 1 < W and a[nx][ny+1] == "C":
                a[nx][ny+1] = "Z"
                q.append([nx,ny+1])

    bn = 0
    wn = 0
    for i in range(H):

        #print (a[i])

        for j in range(W):

            if a[i][j] == "C":
                bn += 1
            elif a[i][j] == "X":
                wn += 1
    
    print (bn,wn)



Measured memory_bytes: 6068
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp33 {
    class Program {
        static void Main(string[] args) {
            string n = Console.ReadLine();

            char[] ans = new char[3];


            for (int i = 0; i < 3; i++) {
                if (n[i] == '1') {
                    ans[i] = '9';
                } else if (n[i] == '9') {
                    ans[i] = '1';
                } else {
                    ans[i] = n[i];
                }

            }

            Console.WriteLine(string.Join("", ans));
        }
    }
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, K;
    cin >> N >> K;
    vector<pll> sushi(N);
    REP(i, N){
    	cin >> sushi[i].second >> sushi[i].first;
    	sushi[i].second--;
    }

    ll sum = 0, type = 0;
    sort(sushi.begin(), sushi.end());
    vector<ll> cnt(N, 0);
    priority_queue<ll, vector<ll>, greater<ll> > pq;

    REP(i, K){
    	sum += sushi[N-1-i].first;
    	if(cnt[sushi[N-1-i].second] == 0) type++;
    	else pq.push(sushi[N-1-i].first);
    	cnt[sushi[N-1-i].second]++;
    }
    ll res = sum + type*type;
    for(int i=N-K-1;i>=0;i--){
    	if(pq.empty()) break;
    	if(cnt[sushi[i].second] == 0){
    		type++;
    		cnt[sushi[i].second]++;
    		ll tmp = pq.top();
    		pq.pop();
    		sum += sushi[i].first;
    		sum -= tmp;
    		res = max(res, sum + type*type);
    	}
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll k,x;
  cin >> k >> x;
  vector<int> ans;
  ll l=MAX,r=-MAX;
  REP(i,-1000000,1000001) {
    if(i+k<1000000&&i<=x&&x<i+k) {
      l=min(l,i);
      r=max(r,i+k-1);
    }
  }
  bool f=0;
  REP(i,l,r+1) {
    if(f) cout << " ";
    f=1;
    cout << i;
  }
  ln;
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
s = input()
j = 0
for i in range(len(s)):
    #print("i=",i)
    if s[i-(2*j)] == "B":
        #print(i-(2*j))
        #print(s)
        if s[0] == "B":
            s = 'x'+s[1:]
            #print(s)
            #print(s[0])
        else:
            #print(i-(2*j))
            s = s[:i-1-(2*j)]+s[i-(2*j)+1:]
            j += 1
            
            #print("s=",s)
            #print(s[:i-1-(2*j)-1])
ans = s.replace('x','')
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n>>m;
	b=m/2;
	a=m-b;
	for(i=0;i<a;i++){
		cout<<i+1<<" "<<2*a-i<<endl;
	}
	for(i=0;i<b;i++){
		cout<<2*a+i+1<<" "<<2*a+2*b+1-i<<endl;
	}
}

Measured memory_bytes: 3636
#include <iostream>
#include<bits/stdc++.h>
#define rep(k,i,n) for(int i=k;i<n;++i)
using namespace std;
int main(void){
    // Your code here!
    int K,X;
    cin>>K>>X;
    rep(X-K+1,i,X+K){
        cout<<i<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
ll mod                = 1e9 + 7;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

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

long long COM(int n, int k){ // 二項係数:nCk計算
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
	int n,k;
	COMinit();
	ll ans=0LL;
	cin >>n>>k;
	V a(n);
	cin >> a;
	sort(all(a));
	for (int i = k-1; i< n;i++){
		ans += a[i] * COM(i , k - 1);
	//	clog << a[i] << " " << COM(i , k - 1) << endl;
		ans %= mod;
	}
//	clog << ans << endl;
	for (int i = n - k; i >= 0;i--){
		ans -= a[i] * COM(n-i-1, k - 1);
		ans %= mod;
	//	clog << a[i] << " " << COM(n-i-1, k - 1) << endl;
	}
	ans += mod;
	ans %= mod;
	cout << ans << endl;
}

Measured memory_bytes: 15828
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    ll x;
    cin >> x;
    ll ans = 0;
    ans += (x/11) *2;
    x%=11;
    if(x == 0) ;
    else if(x <= 6) ans++;
    else ans+= 2;
    cout << ans << endl;
    return 0;
}

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

int main() {
	int a,b,m,n;

	std::vector<int> v(2);

	for (int& x : v) {
		std::cin >> x;
	}

	std::sort(v.begin(), v.end());

	m = v[1];

	v[1]--;

	std::sort(v.begin(), v.end());

	m += v[1];

	




	std::cout << m << std::endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python

from sys import stdin, stderr

dow = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']

def main():
   d = stdin.readline().strip()
   res =  6- dow.index(d)
   if res == 0:
      res = 7
   print(res)

   return 0

if __name__ == '__main__': main()


Measured memory_bytes: 2568
#include <stdio.h>

int main(void)
{
	char on[100];
	char en[100];
	int i;
	
	scanf("%s %s", on, en);
	
	for (i = 0; on[i] != '\0' && en[i] != '\0'; i++){
		printf("%c", on[i]);
		printf("%c", en[i]);
	}
	
	if (on[i] != '\0'){
		printf("%c", on[i]);
	}
	
	printf("\n");
	return (0);
}

Measured memory_bytes: 128
use std::collections::HashMap;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}


fn main() {
    let n = read::<usize>();
    let input = read_vec::<i32>();
    let mut hm: HashMap<i32, usize> = HashMap::new();

    for i in input.iter() {
        *hm.entry(*i).or_insert(0) += 1;
    }

    if hm.iter().map(|(k,v)| v).max().unwrap() > &1 {
        println!("NO");
    } else {
        println!("YES");
    }
}

Measured memory_bytes: 16916
S = input()
ans1 = 0
ans2 = 0
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "0": ans1 += 1
    else: ans2 += 1
  else: 
    if S[i] == "0": ans2 += 1
    else: ans1 += 1
print(min(ans1,ans2))      

Measured memory_bytes: 39536
#include<stdio.h>
#define M 1000000000
int main(){
  int Y[]={-1,0,1,0};
  int X[]={0,1,0,-1};
  int dp[4][40][40],w,h,i,j,k,l,mi,mj,mk,min,d[40][40],m,ny,nx,c[4];
  while(scanf("%d %d",&w,&h),w||h){
    int f[4][40][40]={0};
    for(i=0;i<4;i++){
      for(j=0;j<40;j++){
	for(k=0;k<40;k++)dp[i][j][k]=M;
      }
    }
    for(i=1;i<=h;i++){
      for(j=1;j<=w;j++)scanf("%d",&d[i][j]);
    }
    for(i=0;i<4;i++)scanf("%d",&c[i]);
    dp[1][1][1]=0;
    for(l=0;l<4*w*h;l++){
      min=2000000000;
      for(i=0;i<4;i++){
	for(j=1;j<=h;j++){
	  for(k=1;k<=w;k++){
	    if(f[i][j][k])continue;
	    if(min>dp[i][j][k])min=dp[mi=i][mj=j][mk=k];
	  }
	}
      }
      f[mi][mj][mk]=1;
      if(d[mj][mk]-4){
	m=(mi+d[mj][mk]+4)%4;
	ny=mj+Y[m];
	nx=mk+X[m];
	if(dp[m][ny][nx]>dp[mi][mj][mk])dp[m][ny][nx]=dp[mi][mj][mk];
      }
      for(i=0;i<4;i++){
	ny=mj+Y[(mi+i)%4];
	nx=mk+X[(mi+i)%4];
	if(dp[(mi+i)%4][ny][nx]>dp[mi][mj][mk]+c[i])
	   dp[(mi+i)%4][ny][nx]=dp[mi][mj][mk]+c[i];
      }
    }
    min=M;
    for(i=0;i<4;i++){
      if(min>dp[i][h][w])min=dp[i][h][w];
    }
    printf("%d\n",min);
  }
  return 0;
}

Measured memory_bytes: 664
<?php
list($N, $K) = explode(' ', fgets(STDIN));
$ans = 0;
$mod = 1000000007;

for ($i = (int)$K; $i <= $N + 1; $i++) {
    /*
    $min = (0 + $i - 1) * $i / 2;
    $max = ($N + $N - $i + 1) * $i / 2;
    */
    $ans += ($N - $i + 1) * $i + 1;
}
echo $ans % $mod;



Measured memory_bytes: 16068
#include<iostream>
#include<string>
using namespace std;
string pre,s;
int now;
int func(){
	if(s[now]=='0'){
		now++;
		return 0;
	}else if(s[now]=='1'){
		now++;
		return 1;

	}else if(s[now]=='2'){
		now++;
		return 2;
	}else if(s[now]=='-'){
		now++;
		return 2-func();
	}else if(s[now]=='('){
		now++;
		int a=func();
		if(s[now]=='+'){
			now++;
			int b=func();
			now++;
			return max(a,b);
		}else if(s[now]=='*'){
			now++;
			int b=func();
			now++;
			return (a*b+1)/2;
		}
	}
}
int main(){
	while(cin>>pre,pre!="."){
		int ans=0;
		for(int x=0;x<=2;x++)
		for(int y=0;y<=2;y++)
		for(int z=0;z<=2;z++){
			s=pre;
			now=0;
			for(int i=0;i<(int)s.size();i++){
				if(s[i]=='P')
					s[i]='0'+x;
				else if(s[i]=='Q')
					s[i]='0'+y;
				else if(s[i]=='R')
					s[i]='0'+z;
			}
			if(func()==2)
				ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    ll a,b,c; cin>>a>>b>>c;

    if(a*b*c%2==0) cout<<0<<endl;
    else{
        cout<<min(abs((a/2-(a-a/2))*b*c),min(abs(a*(b/2-(b-b/2))*c),abs(a*b*(c/2-(c-c/2)))))<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define umap unordered_map
#define uset unordered_set
#define frw(i, a, b) for(int i = a; i < b; i++)
#define bck(i, a, b) for(int i = a; i > b; i--)
#define fi first
#define se second
#define pub push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>
#define vpii vector<pii>

const int N = 1e5 + 5;

int n;
vector<vll> a, dp;

ll rec(int n, int prev){
	if(n == 0)	return 0;
	ll &aux = dp[n][prev];
	if(aux != -1)	return aux;
	aux = 0;
	frw(i, 1, 4)	if(prev != i)	aux = max(aux, a[n][i] + rec(n - 1, i));
	return aux;
}

int main(){
	ios::sync_with_stdio(0);
	cin >> n;
	dp.assign(n + 1, vll (4, -1));
	a.assign(n + 1, vll (4, 0));
	frw(i, 1, n + 1)	frw(j, 1, 4)	cin >> a[i][j];
	cout << rec(n, 0);
}

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

int main() {
  int H, W, K;
  std::cin >> H >> W >> K;
  std::vector<std::string> s(H);
  for (auto i = 0; i < H; ++i) { std::cin >> s[i]; }

  std::vector<std::vector<int>> assignment(H, std::vector<int>(W, 0));

  int number_cnt = 0;
  for (auto i = 0; i < H; ++i) {
    for (auto j = 0; j < W; ++j) {
      if (s[i][j] == '#') {
        ++number_cnt;
        assignment[i][j] = number_cnt;
      }
    }
  }

  for (auto i = 0; i < H; ++i) {
    for (auto j = 1; j < W; ++j) {
      if (assignment[i][j] == 0 && assignment[i][j - 1] > 0) {
        assignment[i][j] = assignment[i][j - 1];
      }
    }
  }

  for (auto i = 0; i < H; ++i) {
    for (auto j = W - 2; j >= 0; --j) {
      if (assignment[i][j] == 0 && assignment[i][j + 1] > 0) {
        assignment[i][j] = assignment[i][j + 1];
      }
    }
  }

  for (auto i = 1; i < H; ++i) {
    for (auto j = 0; j < W; ++j) {
      if (assignment[i][j] == 0 && assignment[i - 1][j] > 0) {
        assignment[i][j] = assignment[i - 1][j];
      }
    }
  }

  for (auto i = H - 2; i >= 0; --i) {
    for (auto j = 0; j < W; ++j) {
      if (assignment[i][j] == 0 && assignment[i + 1][j] > 0) {
        assignment[i][j] = assignment[i + 1][j];
      }
    }
  }

  for (auto i = 0; i < H; ++i) {
    for (auto j = 0; j < W ;++j) {
      std::cout << assignment[i][j] << " ";
    }
    std::cout << std::endl;
  }

  return 0;
}


Measured memory_bytes: 1280
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		x: usize,
		t: usize,
	}

	if x > t {
		println!("{}", x - t);
	}
	else {
		println!("0");
	}
}



Measured memory_bytes: 2132
#include <stdio.h>
int main(void){
	int n,s;
	char a[5],b[5];
	while(1){
		scanf("%d",&n);
		if(!n){
			break;
		}
		int i;
		s=0;
		for(i=0;i<n/2;i++){
			scanf("%s %s",a,b);
			if(a[1]==b[1])s++;
		}
if(n%2) scanf("%s",a);
		printf("%d\n",s);
	}
	return 0;
}

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

int main() {
    int N;
    cin>>N;
    vector<long> Lucas(87);
    Lucas[0]=2;
    Lucas[1]=1;
    for(int i=2;i<87;i++)
    {Lucas[i]=Lucas[i-1]+Lucas[i-2];}
    cout<<Lucas[N]<<endl;
    
    
    
}


Measured memory_bytes: 256
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)*}
    };
}

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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

//
// # Examples
//
// # integers
// input! { n: i32, m: i32, ... }
//
// # array
// input! { n: i32, v: [i32; n], }
//
// # matrix
// input! { n: i32, m: i32, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: i32,
//     w: i32,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: i32, b: i32, c: i32,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input! { n: usize, a: usize }
    if n <= a {
        println!("Yes");
    } else {
        let r = n % 500;
        if r <= a { println!("Yes"); } else { println!("No"); }
    }
}

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

using namespace std;

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

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

int main() {
  int m;
  scanf("%d", &m);
  deque<int> Q;
  Q.push_back(1);
  vector<int> d(m);
  d[1] = 1;
  while (!Q.empty()) {
    int x = Q.front();
    Q.pop_front();
    if (x == 0) break;
    int y = x * 10 % m;
    if (!d[y] || d[y] > d[x]) {
      d[y] = d[x];
      Q.push_front(y);
    }
    y = (x + 1) % m;
    if (!d[y] || d[y] > d[x] + 1) {
      d[y] = d[x] + 1;
      Q.push_back(y);
    }
  }
  printf("%d\n", d[0]);
  return 0;
}


Measured memory_bytes: 896
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int H, W, M;
  cin >> H >> W >> M;
  vector<pair<int,int>> rs(H), cs(W);
  F0R(i, H) {
    rs[i] = { 0,i };
  }
  F0R(i, W) {
    cs[i] = { 0,i };
  }
  vector<vector<int>> bs(H);
  F0R(i, M) {
    int h, w;
    cin >> h >> w;
    h--; w--;
    rs[h].first++;
    cs[w].first++;
    bs[h].push_back(w);
  }
  F0R(i, H) {
    sort(rng(bs[i]));
  }
  auto lcmp = [](const pair<int, int>& l, const pair<int, int>& r) {
    return l.first < r.first;
  };
  sort(rrng(rs), lcmp);
  sort(rrng(cs), lcmp);
  int rb = rs[0].first, cb = cs[0].first;

  // 同じスコアのr,cの組み合わせで、交差する場所に爆弾がないエントリを探す
  bool found = false;
  for (int r = 0; r < H && rs[r].first == rb; r++) {
    //debug(rs[r].second);
    for (int c = 0; c < W && cs[c].first == cb; c++) {
      //debug(cs[c].second);
      auto it = lower_bound(rng(bs[rs[r].second]), cs[c].second);
      if (it == bs[rs[r].second].end() || *it != cs[c].second) {
        //Print(bs[rs[r].second]);
        found = true;
        //cout << "found" << newl;
        break;
      }
    }
  }
  int result = rb + cb;
  if (!found) result--;
  cout << result;
}
#endif


Measured memory_bytes: 24300
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
if n < 1200:
    print('ABC')
elif n < 2800:
    print('ARC')
else:
    print('AGC')
    

Measured memory_bytes: 77028
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
typedef long long ll;
 
int main(){
  const double pi=3.141592653589793238;
  double a,b,h,m; cin >> a >> b >> h >> m;
  h=h*pi/6.+m*pi/360;
  m=m*pi/30.;

  double ans=0;
  ans+=(a*sin(h)-b*sin(m))*(a*sin(h)-b*sin(m));
  ans+=(a*cos(h)-b*cos(m))*(a*cos(h)-b*cos(m));
  ans=sqrt(ans);

  cout << std::fixed << std::setprecision(15) << ans << endl;

  return 0;
}


Measured memory_bytes: 4164
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

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



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,i,a[100];
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=1;i<n;i++){
        printf("%d ",a[n-i]);
    }
    printf("%d\n",a[0]);
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
	return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
	mem(isprime,true);
	for(ll p=2;p*p<=n;p++)
	{
		if(isprime[p]==true)
		{
			for(ll i=p*p;i<=n;i+=p)
				isprime[i]=false;
		}
	}
}
void solve()
{
	ll n,m;
	cin>>n>>m;	
	ll c=__gcd(m,n);
	cout<<(m*n)/c;
}
int main()
{
	IOS
	ll t;
	t=1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author CompuWare
 */

#include <bits/stdc++.h>

using namespace std;

class CForbiddenList {
public:
    void solve(istream &in, ostream &out) {
        int x, n, k;
        in >> x >> n;
        bool A[107] = {false};
        int l = x, j = x + 1;
        for (int i = 0; i < n; i++) {
            in >> k;
            A[k] = true;
            while (l >= 0 && A[l])
                l--;
            while (A[j])
                j++;
        }
        if (abs(l - x) == abs(j - x))
            out << min(l, j);
        else if (abs(l - x) > abs(j - x))
            out << j;
        else
            out << l;
    }
};


int main() {
    CForbiddenList solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main() {
    int N, L;
    int applepie = 0;
    cin >> N >> L;

    for (int i=L; i<L+N; ++i)
        applepie += i;

    if (L+N-1 < 0){
        applepie -= N+L-1;
    }
    else if (0 < L){
        applepie -= L;
    }

    cout << applepie << endl;
}

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

int main() {

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    //1 a+b<cなら min(x, y) だけ買う。|x-y|だけcで買うのかbで買うのか

    int ans = 0;

    int diff = abs(x-y);
    
    //a + b < 2*c なら別々に買った方が安い。
    if ((a+b) <= 2*c) {
       ans = a*x + b*y; 
    }
    //それ以外
    //表記は値段 * 個数に固定 
    else {
    
      if (x > y) { 

         ans += c*(y*2);
         
         if (a <= 2*c) {
            ans += a*diff;
         } else {
            ans += c*(diff*2);
         } 
      } else {
     
         ans += c*(x*2);
         
         if (b <= 2*c) {
            ans += b*diff;
         } else {
            ans +=  c * (diff*2);
         }     
      }
    }

    cout << ans << endl;
    return 0;	
}


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

const int maxn = 2e5 + 5;
int h[maxn];
ll dp[maxn];
int n;
ll c;

ll cost(int i, int j) {
  return dp[j] + ll(h[i] - h[j])*(h[i] - h[j]) + c;
}

void solve() {
  vector<pair<int,int>> v;
  dp[n] = 0;
  v.emplace_back(n - 1, n);
  for (int i = n - 1; i >= 1; i--) {
    int opt = (lower_bound(v.rbegin(), v.rend(), make_pair(i, 0)))->second;
    dp[i] = cost(i, opt);
    while (!v.empty() && v.back().first < i && cost(v.back().first, i) <= cost(v.back().first, v.back().second)) {
      v.pop_back();
    }
    int l = 1, r = min(i - 1, v.back().first);
    int j = v.back().second;
    while (l <= r) {
      int mid = (l + r)/2;
      if (cost(mid, i) <= cost(mid, j)) l = mid + 1;
      else r = mid - 1;
    }
    if (l - 1 >= 1) {
      v.emplace_back(l - 1, i);
    }
  }
}

int main() {
  cin >> n >> c;
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
  }
  solve();
  cout << dp[1] << '\n';
  return 0;
}

Measured memory_bytes: 4724
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
struct edge{int from, to;};

int main(){
    int x,y,z;
    cin>>x>>y>>z;
    int count=0;
    x-=z;
    while(x>=y+z){
        count++;
        x-=y+z;
    }
    cout << count<<endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    if not 1 in a:
        print(-1)
        return
    c = 1
    for i in range(N):
        if a[i] == c:
            c += 1
    print(N-c+1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 25984
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	std::string S;
	in >> S;

	std::vector<LL>Rs, Ls;
	rep(i, S.length())
	{
		if (S[i] == 'R') Rs.push_back(i);
		else Ls.push_back(i);
	}

	std::vector<LL>ans(S.length());
	rep(i, S.length())
	{
		if (S[i] == 'R')
		{
			auto it = std::lower_bound(Ls.begin(), Ls.end(), i);
			if ((*it - i) % 2 == 0) ++ans[*it];
			else ++ans[*it - 1];
		}
		else
		{
			auto it = std::lower_bound(Rs.begin(), Rs.end(), i) - 1;
			if ((i - *it) % 2 == 0) ++ans[*it];
			else ++ans[*it + 1];
		}
	}

	rep(i, S.length()) out << ans[i] << (i + 1 < S.length() ? " " : "\n");
}


Measured memory_bytes: 2420
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

primes = primes(100)

N = int(input())

# e[i]: N!の素因数分解でのiの指数
e = [0] * (N+1)
for i in range(2,N+1):
    cur = i
    for p in primes:
        while cur % p == 0:
            e[p] += 1
            cur //= p

# eの要素で(M - 1)以上のものの個数
cnt = lambda M: len(tuple(filter(lambda x: x >= M - 1, e)))

ans = cnt(75) # 75
ans += cnt(25) * (cnt(3) - 1) # 25 * 3 = 75
ans += cnt(15) * (cnt(5) - 1) # 15 * 5 = 75
# 「// 2」は2つのcnt(5)は区別しないから
ans += cnt(5) * (cnt(5) - 1) * (cnt(3) - 2) // 2 # 5 * 5 * 3 = 75

print(ans)

Measured memory_bytes: 3064
n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
b = [0]*(n+1)
cnt = 0
temp = 1
rep = 0
while 1:
    cnt += 1
    if b[temp] == 0:
        b[temp] = cnt
    else:
        rep = cnt-b[temp]
        # print(rep,cnt-1,b[temp])
        # print(b)
        break
    temp = a[temp]
# print((k-b[temp]+1) % rep)
if (k-b[temp]+1) >= 0:
    for i in range((k-b[temp]+1) % rep):
        temp = a[temp]
    print(temp)
    exit()
else:
    temp = 1
    for i in range(k):
        temp = a[temp]
    print(temp)

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

int main()
{
  int n;
  cin >> n;
  int t[n];
  for(int i = 0; i < n; ++i) cin >> t[i];
  int m;
  cin >> m;

  for(int i = 0; i < m; ++i){
    int sum = 0;
    int p, x;
    cin >> p >> x;
    for(int j = 0; j < n; ++j){
      if(j == p -1) sum += x;
      else sum += t[j];
    }
    cout << sum << endl;
  }
}

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

int memo[200010][30];
int n;

int mm[200010];

int dfs(int idx){

  if(mm[idx] != -1){
    return mm[idx];
  }


  int mi = 17191727;

  for(int i = 0;i < 26;i++){
    if(memo[idx][i] != -1){
      mi = min(dfs(memo[idx][i]), mi);
    }else{
      return mm[idx] = 1;
    }
  }

  return mm[idx] = mi+1;
}


int kotae_size;
char kotae[300010] = {};

void ansSearch(int idx, int num){
  if(num+1 == kotae_size){
    for(int i = 0;i < 26;i++){
      if(memo[idx][i] == -1){
        kotae[num] = 'a' + i;
        kotae[num+1] = '\0';
        cout << kotae << endl;
        return;
      }
    }
  }

  for(int i = 0;i < 26;i++){
    if(mm[memo[idx][i]] == kotae_size-num-1){
      kotae[num] = 'a' + i;
      ansSearch(memo[idx][i], num+1);
      return;
    }
  }
}

int main(){
  memset(mm,-1,sizeof(mm));
  string s;
  cin >> s;

  n = s.size();

  for(int i = 0;i < 26;i++) memo[n][i] = -1;

  for(int i = n-1;i >= 0;i--){
    for(int j = 0;j < 26;j++){
      if(s[i]-'a' == j){
        memo[i][j] = i+1;
      }else{
        memo[i][j] = memo[i+1][j];
      }
    }
  }

  dfs(0);
  kotae_size = mm[0];
  ansSearch(0, 0);

  return 0;
}


Measured memory_bytes: 25220
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = None
        self.right = None

class BST:
    def __init__(self):
        self.root = None
    def insert(self, key):
        x = self.root
        y = None
        z = Node(key)
        while x != None:
            y = x
            x = x.left if z.key < x.key else x.right
        if y == None: self.root = z
        else:
            if z.key < y.key: y.left = z
            else: y.right = z
    def print_tree(self):
        def inorder(node):
            if node:
                inorder(node.left)
                print('',node.key, end='')
                inorder(node.right)
        def preorder(node):
            if node:
                print('',node.key, end='')
                preorder(node.left)
                preorder(node.right)
        inorder(self.root)
        print()
        preorder(self.root)
        print()

tree = BST()
input()
for e in sys.stdin:
    if e[0] == 'i': tree.insert(int(e[7:]))
    else:
        tree.print_tree()


Measured memory_bytes: 53992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(void){
    int h,w,k,ans=0;
    cin >> h >> w >> k;
    char mp[h][w];
    rep(i,h)rep(j,w) cin >> mp[i][j];
    rep(i,1<<h){
        bitset<6> s(i);
        rep(j,1<<w){
            int cnt = 0;
            bitset<6> t(j);
            rep(k,h)rep(l,w){
                if(s.test(k)||t.test(l)) continue;
                else if(mp[k][l]=='#') cnt++;
            }
            if(cnt==k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
ARGF.each_line do |line|
  n, x = line.split.map(&:to_i)

  break if n == 0 && x == 0
  
  count = 0
  (1..n).each do |i|
    (i+1..n).each do |j|
      (j+1..n).each do |k|
        if i + j + k == x
          count += 1
        end
      end
    end
  end

  puts count
end

Measured memory_bytes: 6096
#include <stdio.h>

int main(void)
{
	int num;
	double weight;
	double height;
	double bmi;
	
	while (scanf("%d,%lf,%lf", &num, &weight, &height) != EOF){
		bmi = weight / (height * height);
		if (bmi >= 25.000000){
			printf("%d\n", num);
		}
	}
	
	return (0);
}

Measured memory_bytes: 1056
function Main(input) {
  const inputs = input.split("\n");
        s = inputs[0].split("").sort().join("");
        t = inputs[1].split("").sort().reverse().join("");

  if(s<t){
    console.log("Yes");
  } else {
    console.log("No");
  }
}

function debug(){
	var input = document.getElementById("input").value;
	Main(input);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
from itertools import count

k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    m = 0
    for i in count(0):
        m += pow(10, i, k) * 7
        m %= k
        if m == 0:
            print(i+1)
            break


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

long double dp[301][301][301];


int main(){
    int N; cin >> N;
//    dp[0][0][0]=0.0;
    for(int k=0; k<=N; k++){
        for(int j=0; j<=N-k; j++){
            for(int i=0; i<=N-k-j; i++){
                if(i==0 && j==0 && k==0) continue;
                dp[i][j][k] += (long double) N/(i+j+k);
                if(i>=1){
                    dp[i][j][k] +=(long double) i/(i+j+k) * dp[i-1][j][k];
                }
                if(j>=1){
                    dp[i][j][k] +=(long double) j/(i+j+k) * dp[i+1][j-1][k];
                }
                if(k>=1){
                    dp[i][j][k] +=(long double) k/(i+j+k) * dp[i][j+1][k-1];
                }
            }
        }
    }
    int num[4]={0,0,0,0};
    for(int i=0; i<N; i++){
        int a; cin >> a;
        num[a]++;
    }
    cout <<  fixed << setprecision(12) << dp[num[1]][num[2]][num[3]] << endl;
}

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

long long q,rs,n,a;
int main()
{
	cin>>n;
	for(int i=1; i<=n; ++i)
	{
		cin>>a;
		
		if(a%2==1)
		{
			rs+=a/2;
			if(q)
			{
			 	q=0;
				rs++;
			}else
			{
				
				q=1;
			}
		}else
		{
			if(a>=2){
			rs+=a/2;
			
			}else
			q=0;
		}
	}
	cout<<rs;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int n; cin >> n;
    VL p(n);
    ll ans = 0;
    FOR(i, 0, n) {
        ll a, b; cin >> a >> b;
        p[i] = a + b;
        ans -= b;
    }
    rSORT(p, greater<ll>());

    for (int i = 0; i < n; i += 2)ans += p[i];
    cout << ans << "\n";
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main()
{
    int N, x;
    cin >> N >> x;
    int a[N];
    REP(i, N) cin >> a[i];
    sort(a, a + N);
    int ans = 0;
    REP(i, N){
        if(x - a[i] < 0){
            break;
        }else{
            if (i == N - 1 && x != a[i]){
                break;
            }
        ans += 1;
        x -= a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
//find_by_order(k) - k is the kth element of the set
//order_of_key(k) - Number of elements striclty samller than k
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ll ans=10000000000;
    for(int i=0;i<n;i++)
    {
        ll sum1=0,sum2=0;
        for(int j=0;j<=i;j++)
        {
            sum1+=arr[j];
        }
        for(int j=i+1;j<n;j++)
        {
            sum2+=arr[j];
        }
        ans=min(ans,abs(sum1-sum2));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
int n;
cin >> n;
if(n < 1200) cout << "ABC" << endl;
else cout << "ARC" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << fixed << setprecision(10) << sqrt(pow(x1-x2,2) + pow(y1-y2,2)) << endl;
    return 0;
}


Measured memory_bytes: 3296
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {

        string inpt = Reader.ReadLine();

        int ans = int.MaxValue;
        foreach(char c in inpt) {
            ans = Math.Min(ans, GetAns(inpt, c));
        }
        Console.WriteLine(ans);
    }

    private Dictionary<string, int> dic = new Dictionary<string, int>();
    private int GetAns(string tmp, char target) {
        if(tmp.Length <= 1 || tmp.Count(a=>a==tmp[0]) == tmp.Length) {
            return 0;
        }
        StringBuilder sub = new StringBuilder();
        for (int i = 0; i < tmp.Length - 1; i++) {
            if(tmp[i]==target||tmp[i+1]==target) {
                sub.Append(target);
            } else {
                sub.Append(tmp[i]);
            }
        }
        int ans = GetAns(sub.ToString(), target) + 1;
        return ans;
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


whbrjpjyhsrywlqjxdbrbaomnw


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 17248
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,x;
				set<int> s;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>x;
        s.insert(x);
    }
    if(s.size()==n) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;

#define forn(i, n) for(int i=0; i<n; i++)
#define mp makepair
#define pb push_back

int main(){
    int n;
    int arr[100000+7];
    scanf("%d",&n);
    forn(i,n)scanf("%d", arr+i);
    ll dp[100000+7];
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    for(int i = 2; i < n; i++) {
        dp[i] = min(dp[i-1] + abs(arr[i] - arr[i-1]), dp[i-2] + abs(arr[i] - arr[i-2]));
    }
    cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1408
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())

	ans := 0
	min := 99999999999999999.0
	for i := 1; i <= n; i++ {
		sc.Scan()
		h, _ := strconv.Atoi(sc.Text())

		if d := abs(float64(a) - (float64(t) - 0.006*float64(h))); d < min {
			min = d
			ans = i
		}
	}
	fmt.Println(ans)
}

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


Measured memory_bytes: 640
#include<iostream>
#include<stack>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int N;
	cin >> N;
	string s = "";
	if (N == 0) {
		cout << "0" << endl;
	}
	else {
		while (N != 0) {
			if (N % 2 != 0) {
				N--;
				s = "1" + s;
			}
			else {
				s = "0" + s;
			}
			N /= -2;
		}
	}

	cout << s << endl;

}


Measured memory_bytes: 256