akhauriyash/Code-Regression huggingface dataset:
//aizu
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
using namespace std;

vector <int> v[101];

pair <int, int> af[101];

bitset <101> viz;

int cnt;

void DFS(int nod)
{
    cnt++;
    af[nod].first = cnt;
    viz[nod] = 1;

    for (size_t i = 0; i < v[nod].size(); ++i)
    {
        if (viz[v[nod][i]] == 0)
            DFS(v[nod][i]);
    }
    cnt++;
    af[nod].second = cnt;
}

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

    int n, u, k, ind;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> u >> k;
        for (int j = 1; j <= k; ++j)
        {
            cin >> ind;
            v[u].push_back(ind);
        }
        sort(v[u].begin(), v[u].end());
    }

    for (int i = 1; i <= n; ++i)
        if (viz[i] == 0)
            DFS(i);

    for (int i = 1; i <= n; ++i)
        cout << i << " " << af[i].first << " " << af[i].second << "\n";
    return 0;
}



Measured memory_bytes: 3156
import sys
import numpy as np
input = sys.stdin.buffer.readline
N = int(input())
A = np.array(list(map(int, input().split())))

B = np.array([0] * N)
for i in range(len(A), 0, -1):
    v = B[2 * i - 1::i].sum() % 2
    if A[i - 1] != v:
        B[i - 1] = 1
# print(f'{B=}')

M = B.sum()
print(M)
idx = np.where(B == 1)[0] + 1
print(*idx, sep=' ')


Measured memory_bytes: 37488
#include <iostream>
using namespace std;
 
int main(){
    int N,W;
    cin>>N>>W;
    int v[N],w[N];
    for(int i=0;i<N;i++){
        cin>>v[i]>>w[i];
    }
     
    int DP[N+1][W+1];
    for(int i=0;i<N+1;i++){
        DP[i][0]=0;
    }
    for(int i=0;i<W+1;i++){
        DP[0][i]=0;
    }
    for(int i=1;i<=N;i++){
        for(int j=1;j<=W;j++){
            if(j<w[i-1]){
                DP[i][j]=DP[i-1][j];
            }else{
                if(DP[i][j-w[i-1]]+v[i-1]>DP[i-1][j]){
                    DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
                }
                else{
                    DP[i][j]=DP[i-1][j];
                }
            }
        }
    }
     
    cout<<DP[N][W]<<endl;
    return 0;
         
}
 

Measured memory_bytes: 7020
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

typedef int itn;
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

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

    int n;
    cin >> n;
    vector<int> vi = vector<int>(n, 0);
    for (int i = 0; i < n; ++i) cin >> vi[i];
    int cur = vi[0];
    for (int i = 0; i < n; ++i)
    {
        if(cur == 2) {
            cout << i + 1 << endl;
            return 0;
        }
        cur = vi[cur-1];
    }
    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

#define BUFSIZE 512
#define N_MAX    10
#define NUM_TIME 16

int InputCardInfo(int n[NUM_TIME], int k[NUM_TIME], int a[NUM_TIME][100]){
  int i;
  int z=0;

  while(1){
	scanf("%d", &n[z]);
	scanf("%d", &k[z]);

	if(n[z]==0 && k[z]==0){
	  return z;
	}

	for(i=0; i<n[z]; i++){
	  scanf("%d", &a[z][i]);
	}

	z++;
  }

}

void LineUp(int n[NUM_TIME], int k[NUM_TIME], int a[NUM_TIME][100], int end){

  int b1=0;
  int b2=0;
  int b3=0;
  int b4=0;
  int i,j,l,m;
  char buffer[20];
  int figure[10000]={0};
  int flag=0;
  int no=0;
  int z;
  int w=0;


  for(z=0; z<end; z++){ //start
	no=0;

	/*printf("ok\n");
	printf("%d %d %d %d %d %d %d %d %d %d\n"
		   ,a[z][0],a[z][1],a[z][2],a[z][3],a[z][4]
		   ,a[z][5],a[z][6],a[z][7],a[z][8],a[z][9]);
		   printf("z:%d n:%d k:%d\n",z,n[z],k[z]);*/
	//printf("i:%d,j:%d,l:%d,m%d\n", i,j,l,m);


	for(i=0; i<n[z]; i++){
	  b1=a[z][i];
	  for(j=0; j<n[z]; j++){
		while(1){
		  if(j==i){
			j++;
			//if(j>=n[z])  break;
		  }else{
			b2=a[z][j];
			break;
		  }
		}
		if(b1>0 && b2>0 && k[z]==2){
		  sprintf(buffer,"%d%d", b1,b2);
		  figure[no] = atoi(buffer);
		  // printf("%d\n", figure[no]);

		  for(w=0; w<no; w++){
			if((figure[no]-figure[w]) == 0){
			  flag = 1;
			  break;
			}
		  }
		  if(flag>0){
			flag=0;
		  }else{
			no++;
		  }

		}
		if(k[z]>=3){
		  for(l=0; l<n[z]; l++){
			while(1){
			  if(l==i || l==j){
				l++;
				//if(l>=n[z]) break;
			  }else{
				b3=a[z][l];
				break;
			  }
			}
			if(b1>0 && b2>0 && b3>0 && k[z]==3){
			  sprintf(buffer,"%d%d%d",b1,b2,b3);
			  figure[no] = atoi(buffer);
			  //printf("z:%d, no:%d, b3:%d, a[l:%d]=%d n[z]=%d::",z,no,b3,l,a[z][l], n[z]);
			  //printf("%d\n", figure[no]);
			  for(w=0; w<no; w++){
				if((figure[no]-figure[w]) == 0){
				  flag = 1;
				  break;
				}
			  }
			  if(flag>0){
				flag=0;
			  }else{
				no++;
			  }
			}
			if(k[z]>=4){
			  for(m=0; m<n[z]; m++){
				while(1){
				  if(m==i || m==j || m==l){
					m++;
					//if(m>=n[z])  break;
				  }else{
					b4=a[z][m];
					break;
				  }
				}
				if(b1>0 && b2>0 && b3>0 && b4>0){
				  sprintf(buffer,"%d%d%d%d",b1,b2,b3,b4);
				  figure[no] = atoi(buffer);
				  //printf("%d\n", figure[no]);
				  for(w=0; w<no; w++){
					if((figure[no]-figure[w]) == 0){
					  flag = 1;
					  break;
					}
				  }
				  if(flag>0){
					flag=0;
				  }else{
					no++;
				  }
				}
			  }
			}
		  }
		}
	  }
	}//End Of for
	printf("%d\n", no);

  }//End


}

int main(void){
  int n[NUM_TIME];
  int k[NUM_TIME];
  int a[NUM_TIME][100];
  int i,z,x;
  int end;

  for(z=0; z<NUM_TIME; z++){
	for(x=0; x<100; x++){
	  a[z][x]=-1;
	}
  }

  end = InputCardInfo(n,k,a);

  LineUp(n, k, a, end);

  return 0;

}

Measured memory_bytes: 664
#include <iostream>
#include <math.h>
#include <map>
#include <string>
#include <utility>
using namespace std;

int solve(const int n)
{
    map<pair<int, int>, int> MAP;

    for (size_t i = 1; i <= 9; i++)
    {
        for (size_t j = 1; j <= 9; j++)
        {
            MAP.insert(make_pair(make_pair(i, j), 0));
        }
    }

    int result = 0;
    for (size_t i = 1; i <= n; i++)
    {
        int digit = pow(10, (int)floor(log10(i)));

        int head = i / digit;
        int tail = i % 10;

        if (head == 0 || tail == 0){
            continue;
        }
        else {
            MAP[{head, tail}] += 1;
        }
    }

    for (size_t i = 1; i <= 9; i++)
    {
        for (size_t j = 1; j <= 9; j++)
        {
            const int m = MAP[{i,j}];
            const int r = MAP[{j,i}];
            result += m * r;
        }
    }
    return result;
}

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

    cout << solve(N) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<map>
#define ll long long int
#define ld long double
#define pb push_back
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 1000000007
#define MAX 100009
#define endl '\n'
#define mp make_pair
#define INF 1000000000
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define ps(x,y) fixed<<setprecision(y)<<x
#define pii pair<long long int,long int>
#define mii map<long long int,long long int>
#define w(t) 	int t; cin>>t; while(t--)

using namespace std;

//ll c[MAX];




int main() {
	ld x;
	cin>>x;
	if(x==101)	cout<<1;
	else{
		ll z=101,ans=1;
		while(z<x){
			z=z*1.01;
			ans++;
		}
		cout<<ans;
	}
}


Measured memory_bytes: 3716
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func GCD(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if a%b == 0 {
		return b
	}
	return GCD(b, a%b)
}

func maxInt(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	aArray := make([]int, n)
	for i := range aArray {
		aArray[i] = nextInt()
	}

	leftCumGcd, rightCumGcd := make([]int, n), make([]int, n)
	leftCumGcd[0] = aArray[0]
	for i := 1; i < n; i++ {
		leftCumGcd[i] = GCD(leftCumGcd[i-1], aArray[i])
	}
	rightCumGcd[n-1] = aArray[n-1]
	for i := n - 2; i >= 0; i-- {
		rightCumGcd[i] = GCD(rightCumGcd[i+1], aArray[i])
	}

	ans := 1
	for i := 0; i < n; i++ {
		switch {
		case i == 0:
			ans = maxInt(ans, rightCumGcd[i+1])
		case i == n-1:
			ans = maxInt(ans, leftCumGcd[i-1])
		default:
			ans = maxInt(ans, GCD(leftCumGcd[i-1], rightCumGcd[i+1]))
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector<long long> vll;
typedef vector<pair<int,int> > vii;
#define ll long long
#define pb push_back
#define mp  make_pair
#define ff first
#define ss second
#define pq priority_queue
#define sf1(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z)
int inf = (1e9) + 7;



ll fat(ll n)
{
	if(n < 2)
		return 1;
	return (n *fat(n-1)) % inf;
}

int main(){

	int n,m;
	sf2(n,m);

	if(abs(n-m) > 1){
		printf("0\n");
		return 0;
	}

	int fator;
	if((n + m) % 2)
		fator = 1;
	else
		fator = 2;
	printf("%lld\n",(fat(n)*fat(m)*fator) % inf );

}	

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
int inf=1000001000;
ll INF=1e18+5;
ll mod=INF;

void Add(int &a, int b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
}
 
void Mul(int &a, int b) {
  a = 1LL * a * b % MOD;
}
 
int Pow(int b, int e) {
  if (e < 0) e += MOD - 1;
  int ret = 1;
  while (e) {
    if (e & 1) ret = 1LL * ret * b % MOD;
    b = 1LL * b * b % MOD;
    e >>= 1;
  }
  return ret;
}
 
namespace Math {
  const int NMAX = (int)1e7;
  int pow2[1 + NMAX];
  int fact[1 + NMAX], tcaf[1 + NMAX];
  void Precalc() {
    fact[0] = pow2[0] = 1;
    for (int i = 1; i <= NMAX; ++i) {
      pow2[i] = pow2[i - 1];
      Add(pow2[i], pow2[i]);
 
      fact[i] = fact[i - 1];
      Mul(fact[i], i);
    }
    tcaf[NMAX] = Pow(fact[NMAX], -1);
    for (int i = NMAX - 1; i >= 0; --i) {
      tcaf[i] = tcaf[i + 1];
      Mul(tcaf[i], i + 1);
      assert(1LL * fact[i] * tcaf[i] % MOD == 1);
    }
  }
  int Choose(int n, int k) {
    if (k > n || n < 0) return 0;
    return 1LL * fact[n] * tcaf[n - k] % MOD * tcaf[k] % MOD;
  }
};

int main() {
  Math::Precalc();
  ll k;
  cin >> k;
  string s;
  cin >> s;
  int r=s.size()-1;
  ll ans=0;
  rep(i,k+1){
    ll f=Pow(25,i),g=Pow(26,k-i);
    (ans+=f*g%MOD*Math::Choose(i+r,r)%MOD)%=MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 122464
solve :: Int -> Int -> Int -> Int
solve a b n = floor $ point * fromIntegral a
  where x | n < b-1 = n
          | otherwise = b - 1
        y = (fromIntegral x) / (fromIntegral b)
        point = y - (fromIntegral . floor $ y)

main :: IO ()
main = do
  [a, b, n] <- map (read :: String -> Int) .words <$> getLine
  print $ solve a b n


Measured memory_bytes: 3932
<?php
while(true){
    $s = trim(fgets(STDIN));
    if($s == "-") break;
    $n = trim(fgets(STDIN));
    for($i = 0; $i < $n; $i++){
        $h = trim(fgets(STDIN));
        $s = substr($s,$h,strlen($s)-$h).substr($s,0,$h);
    }
    echo $s."\n";
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

    sort(all(p));
    ll ans = 0;
    rep(i,N-1) ans += p[i];
    cout << ans + p[p.size()-1]/2 << endl;
}


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

n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(n):
    a[i] -= 1

used = [-1]*n

now = 0
tmp = 0
while True:
    used[now] = tmp
    now = a[now]
    tmp += 1
    if tmp == k:
        print(now+1)
        exit()    
    if used[now] != -1:
        break

k -= tmp
tank = []
p = now
while True:
    tank.append(p)
    p = a[p]
    if p == now:
        break

print(tank[k%len(tank)]+1)



Measured memory_bytes: 100652
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

vector<int> i2g;          // i2g[i] := アイテム i の所属するグループの番号(find)
vector<vector<int>> g2i;  // g2i[g] := グループ g に所属するアイテムたち

void union_init(int n) {
  i2g.resize(n);
  g2i.resize(n);
  for (int i = 0; i < n; ++i) {
    // 最初はアイテム i はグループ i に所属
    i2g[i] = i;
    g2i[i].assign(1, i);
  }
}

int find(int i){
  return i2g[i];
}

// アイテム ia の所属するグループとアイテム ib の所属するグループを 1 つにする
int merge(int ia, int ib) {
  if(i2g[ia]==i2g[ib])return 0;
  // ia の所属するグループが ib の所属するグループより小さくならないようにする
	LL t=g2i[i2g[ia]].size(),tt=g2i[i2g[ib]].size();
	LL st=t+tt;

  if (g2i[i2g[ia]].size() < g2i[i2g[ib]].size()) {
    swap(ia, ib);
  }
  int ga = i2g[ia], gb = i2g[ib];
  // グループ gb に所属する全てのアイテムをグループ ga に移す
  for (int j : g2i[gb]) i2g[j] = ga;
  g2i[ga].insert(g2i[ga].end(), g2i[gb].begin(), g2i[gb].end());
  g2i[gb].clear();
return st*(st-1)/2-t*(t-1)/2-tt*(tt-1)/2;
}

// アイテム ia とアイテム ib は同じグループに所属しているか？
bool is_same_group(int ia, int ib) {
  return i2g[ia] == i2g[ib];
}


int main(){
	int n,m;
	cin>>n>>m;
	union_init(n+1);
	vector<LL> a(m),b(m),ans(m,0);
	FOR(i,0,m){
		cin>>a[i]>>b[i];
	}
	FORD(i,m,0){
		if(i==m-1){
			ans[i]=1LL*n*(n-1)/2;
		}else{
			ans[i]=ans[i+1]-merge(a[i+1],b[i+1]);
		}
	}
	FOR(i,0,m){
		cout<<ans[i]<<endl;
	}

    return 0;
}


Measured memory_bytes: 12992
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        Integer arrdata[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1,
                4,
                1, 51 };
        String arr_temp[] = mylist.get(0).split(" ");

        int k = Integer.valueOf(arr_temp[0]);

        System.out.println(arrdata[k - 1]);

    }

}


Measured memory_bytes: 23252
inf = 10**18
mod = 10**9+7

n,t = map(int,input().split())
a = list(map(int,input().split()))
ma = inf
benefit = 0
ans = 1
for i in range(n):
    if a[i] < ma:
        ma = a[i]
    else:
        b = a[i]-ma
        if b == benefit:
            ans += 1

        if b > benefit:
            benefit = b
            ans = 1
print(ans)


Measured memory_bytes: 62832
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

const int MAXN = (int)2e5;
ll m, per[15], cst[15], sol;
vector <ll> r;

void nadi_periode(){
	for(int i = 1 ; i <= 9 ; ++i){
		int sad = i;
		int br = 0;
		int c = 0;
		bool p = 0;
		while(!p || sad != i){
			sad = sad + i;
			if(sad >= 10){
				c++;
			}
			sad = (sad / 10) + (sad % 10);
			br++;
			p = 1;
		}
		per[i] = br;
		cst[i] = c;
	}
}

int di_u_periodu(int d, int x){
	int sad = d;
	for(int i = 0 ; i < x ; ++i){
		sad = sad + d;
		if(sad >= 10){
			sol++;
		}
		sad = (sad / 10) + (sad % 10);
	}
	return sad;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
nadi_periode();
cin >> m;
for(int i = 0 ; i < m ; ++i){
	ll d, c;
	cin >> d >> c;
	c--;
	sol += c;
	if(!d){
		r.push_back(0);
	}
	else{
		ll kolko = (c / per[d]) * cst[d];
		sol += kolko;
		r.push_back(di_u_periodu(d, c % per[d]));
	}
	//cout << r.back() << ' ';
}
while((int)r.size() > 1){
	int x = r.back();
	int y = r[(int)r.size() - 2];
	r.pop_back();
	r.pop_back();
	if(x + y >= 10){
		r.push_back(1);
	}
	r.push_back((x + y) % 10);
	sol++;
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pll, int> plp;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//--------------------------------//
 
string s, t;
 
int main() {
	cin >> s >> t;
	
	int N = s.size(), M = t.size();
	
	string ans = "~";
	
	REP(i, N) {
		if (i + M > N) break;
		
		bool ng = false;
		REP(j, M) {
			if (s[i + j] == '?') continue;
			if (s[i + j] != t[j]) ng = true;
		}
		
		if (!ng) {
			string now = s;
			REP(j, i) if (now[j] == '?') now[j] = 'a';
			REP(j, M) now[i + j] = t[j];
			FOR(j, i + M, N) if (now[j] == '?') now[j] = 'a';
			chmin(ans, now);
		}
		
	}
	
	if (ans == "~") ans = "UNRESTORABLE";
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

int a,b,c;

int count=0;

int i;

scanf("%d %d %d",&a,&b,&c);

for(i=a;i<=b;i++){ 

if(c%i==0)

count++;

}

printf("%d\n",count);

return 0 ; 

}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  string s; cin >> s;
  vector<int> ans(25,0);
  for(int i = 0; i < 26; i++){
    char now = 'a' + i;
    for(int j = 0; j < s.size(); j++){
      if(now == s[j]) ans[i]++;
    }
  }
  for(int i = 0; i < 26; i++){
    if(ans[i] == 0){
      char c = 'a' + i;
      cout << c << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
 
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }
 
typedef long long LL;
const int N = (int) 105, mod = (int) (1 << 23) * 17 * 7 + 1;
typedef pair<int, bitset<N>> num;
int compute_g(num);
struct cmp {
	bool operator() (num a, num b) const {
		if (a.first != b.first) return a.first < b.first;
		for (int j = 0; j < (int) a.first; ++j)
			if (a.second[j] != b.second[j]) {
				return a.second[j] < b.second[j];
			}
		return 0;
	}
};
map<num, int, cmp> fdp, gdp;
void sadd(int &x, int y) {
	x += y;
	while (x >= mod) x -= mod;
}
int compute_f(num x) {
	if (x.first == 1) return 1 + x.second[0];
	if (fdp.find(x) != fdp.end()) return fdp[x];
	int &res = fdp[x];
	int g = 1;
	int n = x.first;
	for (int j = 0; j < n; ++j) g = g * (1 + x.second[j]) % mod;
	for (int j = 1; j < n; ++j) {
		num xl, xr;
		xl.first = j;
		xr.first = n - j;
		for (int i = 0; i < j; ++i) xl.second[i] = x.second[i];
		for (int i = j; i < n; ++i) xr.second[i - j] = x.second[i];
		sadd(res, compute_f(xr) * (LL) compute_g(xl) % mod);
	}
	sadd(res, compute_g(x));
	return res;
}
int compute_g(num x) {
	if (x.first == 1) return 1 + x.second[0];
	if (gdp.find(x) != gdp.end()) return gdp[x];
	int &res = gdp[x];
	int n = x.first;
	for (int k = 2; k <= n; ++k) if (n % k == 0) {
		num nxt;
		nxt.first = n / k;
		for (int j = 0; j < n / k; ++j) {
			nxt.second[j] = 1;
			for (int i = j; i < n; i += nxt.first)
				nxt.second[j] = nxt.second[j] & x.second[i];
		}	
		sadd(res, compute_f(nxt));
	}
	return res;
}
int main() {
	string s;
	cin >> s;
	num fs;
	fs.first = (int) s.size();
	for (int j = 0; j < (int) s.size(); ++j) 
		fs.second[j] = s[j] - '0';
	cout << compute_f(fs) << '\n';;
}

Measured memory_bytes: 8448
def f(n, l, price):
    if l == 0.25:
        return int(n / 0.25 * price[l])
    t = int(n / l)
    return min(f(n - l * t, l / 2, price) + t * price[l], f(n, l / 2, price))


Q, H, S, D = map(int, input().split())
N = int(input())

price = {0.25: Q, 0.5: H, 1.0: S, 2.0: D}
print(f(N, 2.0, price))


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

const int MOD = 1000000007;
long  long int te,lastone;
string s;

long long int exp (long long int base, long long int pow){
    if (pow == 0) return 1;
    else  if  (pow == 1) return base;
    else{
        te = exp(base,pow/2)%MOD;
        if (pow%2) return (((te*te)%MOD)* base);
        else return (te*te)%MOD;
    }
}

long long int dp (int x){
    long long  int ans =  0;
    if (x == s.size()){
        return 0;
    }else if (x == lastone){
        return exp(3,s.size()-x-1)+2;
    }
    if  (s[x] ==  '1'){
        ans += exp(3,s.size()-x-1);
        ans += dp(x+1)*2;
        ans %=  MOD;
        //printf ("%d yes %d\n",x,ans);
    }else{
        ans += dp(x+1);
        ans %= MOD;
        //printf ("%d no %d\n",x,ans);
    }
    return ans;
}

int main(){
    cin >> s;
    for  (int i = s.size()-1; i >= 0; i--){
        if (s[i] == '1'){
            lastone = i;
            break;
        }
    }
    //printf   ("%lld\n",exp(3,5));
    printf  ("%lld",dp(0));
}


Measured memory_bytes: 3584
h, w = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(h)]

# 0~9の数値を頂点として、Bellman-fordで最短経路を求める
INF = 10**10
dist = [[c[i][j] for j in range(10)] for i in range(10)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])

ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] != -1:
            ans += dist[a[i][j]][1]

print(ans)

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

ll dp[2510][51][51];

int main(){
    int n, a; cin >> n >> a;
    vector<int> x(n+1);
    for(int i = 1; i <= n; i++) cin >> x[i];
    int cnt = 0;
    for(int i = 1; i <= n; i++){ //i枚目を選
        cnt += x[i];
        dp[x[i]][i][1]++;
        for(int k = 1; k <= 2500; k++){
            for(int j = 0; j <= i-1; j++){
            dp[k][i][j] += dp[k][i-1][j]; //i番目選ばなかった
            if(k > cnt) break;
            if(k - x[i] >= 0){
                dp[k][i][j+1] += dp[k-x[i]][i-1][j];
            }
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= 50; i++){
        //cout << dp[i*a][n] << endl;
        ans = ans + dp[i*a][n][i];
    }
    cout << ans << endl;
}

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

int main() {
    string s;
    cin >> s;
    int a=0,b=0,c=0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i]=='a') a++;
        if(s[i]=='b') b++;
        if(s[i]=='c') c++;
    }

    if(s.size()==1){
        cout << "YES" << endl;
        return 0;
    }
    if(s.size()==2){
        if(s[0]==s[1]) cout << "NO" << endl;
        else cout << "YES" << endl;
        return 0;
    }

    int x=max(max(a,b),c),y=min(min(a,b),c);
    if(x-y<2) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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

int main()
{
    int $=1;
    //cin>>$;
    while($--)
    {
        ll n,ans=0;
        cin>>n;
        vector<ll> a(n);
        for(int i=0;i<n;i++) cin>>a[i];
        for(int i=0;i<n;i++)
        {
            for(int j=i+1;j<n;j++)
            {
                for(int k=j+1;k<n;k++)
                {
                    if((a[i]!=a[j])&&(a[j]!=a[k])&&(a[i]!=a[k]))
                    {
                        if((a[i]+a[j]>a[k])&&(a[j]+a[k]>a[i])&&(a[i]+a[k]>a[j])){ans++;}
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
}


/*
8888888888888888888888888888
    Md. Masud Mazumder
    University of Chittagong
    Department of CSE
8888888888888888888888888888
*/


Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<62;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

const int M=26;

int n;
string s;

int main(){
	cin>>s;
	n=s.size();
	vvi dp(n+1,vi(M+1,inf));
	map<int,int> m;
	int res=inf,S=0;
	dp[0][M]=0;
	m[0]=0;
	for(int i=0;i<n;i++){
		int c=s[i]-'a';
		S^=1<<c;
		dp[i+1][M]=dp[i][c];
		for(int j=0;j<M;j++){
			int T=S^(1<<j);
			if(m.find(T)!=m.end()){
				int I=m[T];
				for(int k=0;k<=M;k++) dp[i+1][j]=min(dp[i+1][j],dp[I][k]+(k!=M||I==0?1:0));
			}
		}
		m[S]=i+1;
	}
	for(int i=0;i<=M;i++) res=min(res,dp[n][i]);
	cout<<res<<endl;
}

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

void solve()
{
	ll n;
	cin>>n;
	ll a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	sort(a,a+n,greater<ll>());
	ll ans = a[0];
	ll j = 0;
	for (int i = 0; i < n-2; ++i)
	{
		if(i%2==0)
			j++;
		ans += a[j];
	}
	cout<<ans<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 5180
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	int a,b,n,x;
	
	cin>>n>>a>>b;
	
	x=a*n;
	if(x>b)
	{
		cout<<b<<endl;
		return 0; 
	}
	else
	{
		cout<<x<<endl;
		return 0;
	}
}

Measured memory_bytes: 256
/* author   : mpily :-()
title : Competing.cpp
time :Tue Aug 27 13:18:01 2019

*/
#include<bits/stdc++.h>
using namespace std;
int main(){
	int A,B;
	cin>>A>>B;
	cout<<max((A+B),max((A-B),(A*B)));	
	return 0;
}


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

#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VVVVI vector<vector<vector<vector<int>>>>
#define VL vector<LL>
#define VVL vector<vector<LL>>
#define VVVL vector<vector<vector<LL>>>
#define VVVVL vector<vector<vector<vector<LL>>>>
#define VB vector<bool>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

template<class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> void print(T x) { std::cout << x << std::endl; }
inline bool inside(int y, int x, int H, int W) { return 0 <= y and y < H and 0 <= x and x < W; }

const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy = { 0, 1, 0, -1 }, dx = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）

using namespace std;


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

    while (true) {
        string s, t;
        cin >> s;
        if (s == "") { break; }
        cin >> t;

        VVI dp(s.size() + 1, VI(t.size() + 1, 0));

        FOR(i, 0, s.size()) {
            FOR(j, 0, t.size()) {
                if (s[i] == t[j]) {
                    dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
                }
                else {
                    dp[i + 1][j + 1] = 0;
                }
            }
        }

        int ans = 0;
        FOR(i, 0, dp.size()) {
            FOR(j, 0, dp[0].size()) {
                ans = max(ans, dp[i][j]);
            }
        }
        print(ans);
    }

    return 0;
}


Measured memory_bytes: 65740
a, b, c, k = map(int, input().split())

# for _ in range(k):
#         tmpA = a
#         tmpB = b
#         tmpC = c
#         a = tmpB + tmpC
#         b = tmpA + tmpC
#         c = tmpB + tmpA
#         if a - b >= 10**18:
#             print("Unfair")
#             exit()
# 
# print(a - b)
if a-b >= 10**18 or b-a >= 10**18:
    print("Unfair")
    exit()

if k%2 == 0:
    print(a-b)
else:
    print(b-a)

Measured memory_bytes: 38256
n=int(input())
a=list(map(int,input().split()))
ans=0
count=1
x=10000
for i in range(1,n):
    if a[i-1]==a[i]:
        count+=1
    else:
        ans+=count//2
        count=1
    if i==n-1:
        ans+=count//2
print(ans)

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

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            long n = int.Parse(Console.ReadLine());

            var inputLongArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            var heap = new int[n];

            for (int i = 0; i < (n-1); i++)
            {
                heap[inputLongArray[i] - 1]++;
            }
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(heap[i]);
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 43844
s = input()
t = input()
maxs = 0
if len(s) == len(t):
    c = 0
    for k in range(len(t)):
        if s[k] == t[k]: c += 1
    print(len(t) - c)
    quit()
for i in range(len(s)-len(t)):
    c = 0
    for k in range(len(t)):
        if s[i+k] == t[k]: c += 1
    maxs = max(c,maxs)
print(len(t) - maxs)

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

int main() {
	string str, com, p;
	int q, a, b;

	cin >> str >> q;
	for (int t = 0; t < q; t++) {
		cin >> com >> a >> b;

		if (com == "print") {
			cout << str.substr(a, b - a + 1) << endl;
		}
		else if (com == "reverse") {
			string tmp = str.substr(a, b - a + 1);
			for (int i = 0; i < tmp.size(); i++) {
				str[i + a] = tmp[tmp.size() - i - 1];
			}
		}
		else if (com == "replace") {
			cin >> p;
			str = str.replace(a, b - a + 1, p);
		}
	}
	return 0;
}


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

int_fast64_t ans(int_fast64_t N, int_fast64_t X){
    if(X <= 0)return 0;
    if(N <= 0)return 1;
    if(X >= (1LL << (N + 1)) - 1){
        return (1LL << N) + ans(N - 1, X + 1 - (1LL << (N + 1)));
    }
    return ans(N - 1, X - 1);
}

int main(){
    int_fast64_t N, X;
    cin >> N >> X;
    cout << ans(N, X) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] grid = new char[h][w];
		for(int i = 0; i < h; i++){
		    String s = sc.next();
		    grid[i] = s.toCharArray();
		}
		
		// 計算
		int result = 0;
		int[][] dist = new int[h][w];
		if(grid[0][0] == '#') dist[0][0] = 1;
		for(int i = 0; i < h; i++){
		    for(int j = 0; j < w; j++){
		        if(j > 0){
		            int d = dist[i][j-1];
		            if(grid[i][j] == '#' && grid[i][j-1] == '.') d++;
		            dist[i][j] = d;
		        }
		        if(i > 0){
		            int d = dist[i-1][j];
		            if(grid[i][j] == '#' && grid[i-1][j] == '.') d++;
		            if(j == 0){
		                dist[i][j] = d;
		            }else{
		                dist[i][j] = min(dist[i][j], d);
		            }
		        }
		    }
		}
		
		result = dist[h-1][w-1];
		
		// 出力
		System.out.println(result);
	}
	
}


Measured memory_bytes: 25428
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define pii pair<int,int>
#define prec(n) fixed<<setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int n;cin>>n;
    vi v(n);cin>>v;
    sort(all(v));
    int indxL=n/2-1;
    int indxR=n/2;
    cout<<v[indxR]-v[indxL];
}


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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")




int main() {


    string s,t; cin >> s >> t;
    ll n = s.length();
    map<char,char> mpS,mpT;
    rep(i,26){
        mpS[(char)('a'+i)] = '.';
        mpT[(char)('a'+i)] = '.';
    }
    rep(i,n){
        if(mpS[s[i]] != '.' && mpS[s[i]] != t[i]){
            cout << "No";
            return 0;
        }
        if(mpT[t[i]] != '.' && mpT[t[i]] != s[i]){
            cout << "No";
            return 0;
        }
        if(mpS[s[i]] == '.') mpS[s[i]] = t[i];
        if(mpT[t[i]] == '.') mpT[t[i]] = s[i];

    }


    cout << "Yes";
    return 0;
}


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

int main() {
  char X,Y;
  cin >> X >> Y;
  
  if(X<Y){
    cout << "<" << endl;
  }
  else if(Y<X){
    cout << ">" << endl;
  }
  else if(X==Y){
    cout << "=" << endl;
  }
}


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

queue<int> x,y;
int black = 0;

void count(int,int,vector<vector<char>>&);
//void display(vector<vector<char>>,int,int);
int main() {
    int h,w,i,j,ans=0;

    cin >> h >> w;
    vector<vector<char>> a(h);
    for(i=0;i<h;i++){
        a[i].resize(w);
        for(j=0;j<w;j++){
            cin >> a[i][j];
            if(a[i][j] == '#'){
                y.push(i);
                x.push(j);
                black++;
            }
        }
    }

    while(true){
        if(black >= h*w) break;
        int b = x.size();
        ans++;
        for(i=0;i<b;i++){
            int c = y.front();
            int d = x.front();
            y.pop();
            x.pop();
            if(c > 0 && a[c-1][d] == '.') count(c-1,d,a);
            if(c < h-1 && a[c+1][d] == '.') count(c+1,d,a);
            if(d > 0 && a[c][d-1] == '.') count(c,d-1,a);
            if(d < w-1 && a[c][d+1] == '.') count(c,d+1,a);
        }
        //display(a,h,w);
    }
    cout << ans << endl;
    return 0;
}

void count(int a,int b,vector<vector<char>>& f){
    f[a][b] = '#';
    x.push(b);
    y.push(a);
    black++;
}
/*
void display(vector<vector<char>> a,int h,int w){
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
    cout << endl;
}
 */

Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	string s; cin >> s;
	bool is = true;
	string t = s;
	reverse(all(t));
	if (s != t)is = false;
	t = t.substr(0, (s.size() - 1) / 2);
	string a = t;
	reverse(all(a));
	if (a != t)is = false;
	t = s;
	t = t.substr((s.size() + 3) / 2 - 1, s.size());
	a = t;
	reverse(all(a));
	if (a != t)is = false;
	cout << (is ? "Yes" : "No") << "\n";


	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
int main()
{
    int i, n;
    double x1, x2, x3, y1, y2, y3;
    double a, b, c, d, e, f;
    double X1, Y1, r;
     
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%lf %lf %lf %lf %lf %lf",&x1, &y1, &x2, &y2, &x3, &y3);
        a = 2 * (x2 - x1);
        b = 2 * (y2 - y1);
        c = x1*x1 - x2*x2 + y1*y1 - y2*y2;
        d = 2 * (x3 - x1);
        e = 2 * (y3 - y1);
        f = x1*x1 - x3*x3 + y1*y1 - y3*y3;
         
        X1 = (b*f - e*c) / (a*e - d*b);
        Y1 = (c*d - f*a) / (a*e - d*b);
        r  = sqrt((X1-x1)*(X1-x1) + (Y1-y1)*(Y1-y1));
         
        // X1 *= 1000;
        // Y1 *= 1000;
        // r  *= 1000;
         
        // X1 = (int)(X1 > 0.0 ? X1+0.5 : X1-0.5);
        // Y1 = (int)(Y1 > 0.0 ? Y1+0.5 : Y1-0.5);
        // r  = (int)(r  > 0.0 ? r +0.5 : r -0.5);
         
        // X1 = (double)X1/1000;
        // Y1 = (double)Y1/1000;
        // r  = (double)r /1000;
         
        printf("%.3f %.3f %.3f\n", X1, Y1, r);
         
         
    }
     
    return 0;
}

Measured memory_bytes: 1092
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
def ddprint(x):
  if DBG:
    print(x)

s = input()
h = defaultdict(int)
for i in range(4):
    h[s[i]] += 1
k = list(h.keys())
ddprint(k)
if len(k)==2 and h[k[0]]==2 and h[k[1]]==2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int x,y;
int graph[51][51];
vector<int>colors[3];
int visit[51];
int dp[3][51];
int busquedad(int h){
    if(h==3){
        return 0;
    }
    int resp=INT_MAX;
    for(int i=0;i<y;i++){
        if(visit[i]==true) continue;
        int cont=0;
        if(dp[h][i]!=-1){
            visit[i]=true;
            resp=min(resp,dp[h][i]+busquedad(h+1));
            visit[i]=false;
            continue;
        }
        for(int d=0;d<colors[h].size();d++){
            cont+=graph[colors[h][d]][i];
        }
        visit[i]=true;
        dp[h][i]=cont;
        resp=min(resp,cont+busquedad(h+1));
        visit[i]=false;
    }
    return resp;

}
int main(){
    memset(dp,-1,sizeof(dp));
    cin>>x>>y;
    for(int i=0;i<y;i++){
        for(int d=0;d<y;d++){
            cin>>graph[i][d];
        }
    }
    for(int i=1;i<=x;i++){
        for(int d=1;d<=x;d++){
            int t;
            cin>>t;
            colors[(i+d)%3].push_back(t-1);
        }
    }


    cout<<busquedad(0)<<endl;

    return 0;
}


Measured memory_bytes: 1520
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;


struct UnionFind {
  vector<ll> data,data2;
  UnionFind(vll w) : data(w.size(), -1),data2(w.size()) {
    repeat(i,w.size()){
      data2[i]=-w[i];
    }
  }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
      data2[x] += data2[y];
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
  ll weight(int x) {
    return -data2[root(x)];
  }
};

typedef ll Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge():src(0),dst(0),weight(0) {};
    Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight < f.weight :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<vector<pair<int,Edge> > > Graph;

int N,M;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N>>M;
  vll X(N);
  Edges E(M);
  Graph G(N);
  //cerr<<"!!!!!!!"<<endl;
  repeat(i,N){
    cin>>X[i];
  }
  repeat(i,M){
    cin>>E[i].src>>E[i].dst>>E[i].weight;
    E[i].src--;
    E[i].dst--;
  }
  //cerr<<"?????????"<<endl;
  sort(E.begin(),E.end());
  repeat(i,M){
    //debug(i);
    G[E[i].src].push_back({i,E[i]});
    G[E[i].dst].push_back({i,{E[i].dst,E[i].src,E[i].weight}});
  }
  vint flg(M,0);
  UnionFind uf(X);
  repeat(i,M){
    uf.unionSet(E[i].src,E[i].dst);
    flg[i] = E[i].weight<=uf.weight(E[i].src);
  }
  ll ans=0;
  for(int i=M-1;i>=0;i--){
    if(flg[i]==0)ans++;
    if(flg[i]==1){
      queue<int> Q;
      Q.push(E[i].src);
      vector<bool> used(N,false);
      while(!Q.empty()){
        int v=Q.front();
        Q.pop();
        if(used[v])continue;
        used[v]=true;
        for(auto e:G[v])if(e.second.weight<=E[i].weight){
          flg[e.first]=2;
          Q.push(e.second.dst);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14464
#include <stdio.h>
#include <string.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

int main(void)
{
	int a,b,c,i;
	char d[60];
	scanf("%d %d",&a,&b);
	scanf("%s",d);
	d[b-1] = d[b-1]+32;
	printf("%s",d);
	return 0;
}

Measured memory_bytes: 128
// https://atcoder.jp/contests/abc166/tasks/abc166_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    unordered_set<int> st;
    REP(i, K) {
        int d;
        cin >> d;
        REP(j, d) {
            int t;
            cin >> t;
            st.insert(t);
        }
    }
    cout << N - st.size() << endl;

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	string S, T;
	cin >> S >> T;
	cout << T << S << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200050
#define M 200
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define clr(a) a.clear()
#define ll long long
#define SIZE N
#define MOD mod
using namespace std;
int mod = 1e9 + 7;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    int x; cin>>x;
    x-=400;
    x/=200;
    cout<<8-x;
  	return 0;
}



Measured memory_bytes: 3612
//WAPER
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#define inf 1e9
#define eps 1e-6
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline ll read()
{
	char ch=getchar();
	ll s=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int a=read()+read()+read();
	if(a<22)printf("win\n");
	else printf("bust\n");
	return 0;
}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

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

    while(k > 0){
        if(a == 0 && b == 0) break;
        if(a > 0){
            ll tmp = min(a,k);
            a -= tmp;
            k -= tmp;
        } else if(b > 0){
            ll tmp = min(b,k);
            b -= tmp;
            k -= tmp;
        }
    }

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int e, a, b, c, d, time = 0;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	if(a < 0){
		time = time + d + ((a * -1) * c) + b * e;
		}
	else{
	time = time + (b - a) * e;
	}
	printf("%d\n", time);
	return 0;
}


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

int N;
int s[105];
int sm,mx;

int main() {
	cin>>N;
	
	for(int i=0; i<N; i++){
		cin>>s[i];
		sm+=s[i];
	}
	
	if(sm%10!=0){
		cout<<sm<<endl;
		return 0;
	}
	
	for(int i=0; i<N; i++){
		if(sm-s[i]>mx&&(sm-s[i])%10!=0) mx=sm-s[i];
	}
	
	cout<<mx<<endl;
	
	return 0;
}

Measured memory_bytes: 256