akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/ruby
def vowel?(char)
  "aeiuo".split("").include? char
end

def makeCodes(airport, k)
  string = ''
  vowel = false

  airport.split("").each_with_index do |ch, index|
    # validation
    if k < 1
      break
    end

    if airport.length <= index
      break
    end

    # add code a char
    if index == 0
      string << ch

      k -= 1
      if vowel? ch
        vowel = true
      end
      next
    end

    if vowel == true
      string << ch

      k -= 1
    end

    # update vowel flag
    if vowel? ch
      vowel = true
    else
      vowel = false
    end

  end
  string
end


while (n = STDIN.gets.chomp.to_i) != 0
  airports = []
  n.times do
    airports << STDIN.gets.chomp
  end

  funiq = true
  (1..airports.map{|x| x.length}.max).each do |k|
    airportCodes = Hash.new
    funiq = true

    airports.each do |airport|
      codes = makeCodes(airport, k)
      if airportCodes.has_key? codes
        funiq = false
        break
      else
        airportCodes[codes] = 1
      end
    end

    if funiq == true
      puts k
      break
    end
  end

  if funiq == false
    puts -1
  end
end

Measured memory_bytes: 9652
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

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

typedef struct{
    int num;
    int *array;
    int d;
    int f;
}List;

int max;
List list[200];
int jud[200];
int time;

void visit(int);


int main(){
    int gb;

    scanf("%d",&max);

    for(int i=1;i<=max;i++){
        scanf("%d%d",&gb,&list[i].num);
        list[i].array=malloc(sizeof(int)*list[i].num);
        for(int j=0;j<list[i].num;j++){
            scanf("%d",&list[i].array[j]);
        }
    }

    for(int i=1;i<=max;i++){
        jud[i]=WHITE;
    }
    time=0;
    for(int i=1;i<=max;i++){
            if(jud[i]==WHITE)
                visit(i);
    }

    for(int i=1;i<=max;i++){
        printf("%d %d %d\n",i,list[i].d,list[i].f);
    }



    return 0;
}

void visit(int n){
    jud[n]=GRAY;
    list[n].d=++time;
    for(int i=0;i<list[n].num;i++){
        if(jud[list[n].array[i]]==WHITE)
            visit(list[n].array[i]);
    }
    jud[n]=BLACK;
    (list+n)->f=++time;
}



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

int main (){
  int A,B;
  cin>>A>>B;
  bool answer = true;
  for(int i = 0; i<10 ; i++){
    int C = 0;
    C = (B*10) + i;
    if(C*2/25==A){
      cout<<C<<endl;
      answer = false;
      break;
    }
  }
  if(answer){
    cout<<"-1"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int L=a+b,R=c+d;
    if(L>R){
        cout<<"Left"<<endl;
    }else if(L<R){
        cout<<"Right"<<endl;
    }else{
        cout<<"Balanced"<<endl;
    }
}

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

int main()
{
    int ans, k, y, n, x;
    cin >> n >> k >> x >> y;
    
    if (n <= k) {
        ans = x * n;
    }
    else {
        ans = k * x + (n - k) * y;
    }

    cout << ans;
    return 0;
}


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

int main(){
  int a[]={1,3,5,7,8,10,12};
  int b[]={4,6,9,11};
  int c[]={2};
  set<int> st1;
  set<int> st2;
  rep(i,7){
    st1.insert(a[i]);
  }
  rep(i,4){
    st2.insert(b[i]);
  }
  int x,y;
  cin >> x >> y;
  if ((st2.count(x) && st2.count(y)) || (st1.count(x) && st1.count(y))){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;

  
}

Measured memory_bytes: 256
#include <iostream>
#include <set>

int main(void) {
    int narr;
    std::set<int> cset;
    scanf("%d", &narr);
    int now;
    for(int i = 0; i < narr; i++) {
        scanf("%d", &now);
        cset.insert(now);
    }

    if(narr == cset.size()) {
        puts("YES");
    }
    else {
        puts("NO");
    }
}


Measured memory_bytes: 9600
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	H,N = inputMap()
	AB = []
	for i in range(N):
		A,B = inputMap()
		AB.append((A,B))

	DP = [float('inf') for i in range(H+1)]
	DP[-1] = 0

	for i in range(H,-1,-1):
		for j,val in enumerate(AB):
			A,B = val
			tukatta_MP = DP[i]
			tugi = i - A
			if tugi < 0:
				tugi = 0

			tmp = tukatta_MP + B
			if tmp < DP[tugi]:
				DP[tugi] = tmp

	#print(DP)
	print(DP[0])



if __name__ == "__main__":
	main()


Measured memory_bytes: 42716
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin>>s;
  int l=0,r=0;
  rep(i,s.length()){
    if(s[i]=='A'){l=i;break;}
  }
  rep(i,s.length()){
    if(s[s.length()-1-i]=='Z'){
      r=s.length()-1-i;
      break;
    }
  }
  cout<<r+1-l<<endl;

  return 0;

}


Measured memory_bytes: 720
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, S[1000];

void push(int x){
	S[++top] = x;
}

int pop(){
	top--;
	return S[top+1];
}

int main()
{
	int a, b;
	top = 0;
	char s[100];
	while(scanf("%s", s) != EOF){
		if( s[0] == '+'){
			a = pop();
			b = pop();
			push(a + b);
		} else if( s[0] == '-'){
			b = pop();
			a = pop();
			push(a - b);
		} else if( s[0] == '*'){
			a = pop();
			b = pop();
			push(a * b);
		} else{
			push(atoi(s));
		}
	}

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

	return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

int main(){
    int n, x[100], y[100];
    
    cin >> n;
    
    for(int i=0; i<n; i++) cin >> x[i];
    for(int j=0; j<n; j++) cin >> y[j];
    
    double f[4];
    for(int i=0; i<4; i++) f[i] = 0.0;
    
    for(int i=1; i<=3; i++){
        for(int k=0; k<n; k++){
            f[i] +=pow(fabs(x[k] - y[k]), i);
        }
        f[i] = pow(f[i], 1.0/i);
    }
            
    for(int i=0; i<n; i++){
        f[0] = (f[0] < fabs(x[i] - y[i])?fabs(x[i]-y[i]):f[0]);
        
    }
        
    
    printf("%lf\n", f[1]);
    printf("%lf\n", f[2]);
    printf("%lf\n", f[3]);
    printf("%lf\n", f[0]);
    
    return 0;
    
}



Measured memory_bytes: 3344
using System;

namespace AtCoderABC130A
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;

            string[] s = Console.ReadLine().Split(' ');

            int X = int.Parse(s[0]);
            int A = int.Parse(s[1]);

            if (X < A)
                ans = 0;
            else
                ans = 10;

            Console.WriteLine(ans.ToString());
        }
    }
}


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

using namespace std;

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

    vector<int> b(m);
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }


    int ans = 0;
    for (int i = 0; i < n; i++) {
        int kans = c;
        for (int j = 0; j < m; j++) {
            int a;
            cin >> a;
            kans += a * b[j];
        }
        if (kans > 0) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s=list(map(str, input()))
s_=s.copy()
s.reverse()
a=s_[:int((len(s_)-1)/2)]
a_=a.copy()
a.reverse()
b=s_[int((len(s_)+3)/2)-1:]
b_=b.copy()
b.reverse()
if s_==s and a_==a and b_==b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))


n = int(input())
li = [0 for i in range(100)]
li[0]=2
li[1]=1

for i in range(n-1):
    li[i+2]=li[i+1]+li[i]

print(li[n])
#print(li)




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

if a <= b and b <= c:
    print(a , b, c)
elif a <= c and c <= b:
    print(a, c, b)
elif b <= c and c <= a:
    print(b, c, a)
elif b <= a and a <= c:
    print(b, a, c)
elif c <= a and a <= b:
    print(c, a, b)
elif c <= b and b <= a:
    print(c, b, a)


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

int main() {
	string s1, s2, s3; cin >> s1 >> s2 >> s3;
	printf("%c%c%c\n", s1[0]-'a'+'A', s2[0]-'a'+'A', s3[0]-'a'+'A');
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  string S;
  cin>>N>>S;
  int ans=0;
  for(int i=0;i+2<N;i++){
    if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C')ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n, T = map(int, input().split())
t = list(map(int, input().split()))

ans = 0
dep = 0
for i in range(n-1):
    if t[i+1] - t[i] > T:
        ans += t[i] - dep + T
        dep = t[i+1]
    else:
        pass
ans += t[-1] - dep + T
print(ans)

Measured memory_bytes: 25196
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int p[100];
    for(int i=0; i<n; i++){
        cin >> p[i];
    }
    int count=0;
    for(int i=0; i<n; i++){
        if(p[i] != i+1) count++;
    }
    if(count==0 || count==2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys

a, b, c, k = map(int, input().split())
score = 0
num_card = k

if a >= k:
  print(k)
  sys.exit()

# A
score += a
num_card -= a
  
# B
if num_card <= b:
  print(score)
  sys.exit()
else:
  num_card -= b

# C
if num_card >= c:
  score = score - c
else:
  score = score - num_card 
  
print(score)

Measured memory_bytes: 61812
// Power
// 所要時間 分
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

const int mod = 1e9 + 7;

ll mod_pow(ll x, ll n){
    ll ret = 1;
    while(n > 0){
        if(n & 1){
            ret *= x;
            ret %= mod;
        }
        x *= x;
        x %= mod;
        n >>= 1;
    }
    return ret;
}

int main() {

    ll m, n;
    cin >> m >> n;

    cout << mod_pow(m, n) << endl;

    return 0;
}


Measured memory_bytes: 3092
<?php
declare(strict_types=1);

//引数を取得
list($s) = fscanf(STDIN, '%s');

//天気を設定
$weatherArray = ['Sunny', 'Cloudy', 'Rainy'];

//現在の天気から明日の天気のインデックスを取得
$weatherIndex = array_search($s, $weatherArray) + 1;

//天気のインデックスがなければ0に設定
if (!array_key_exists($weatherIndex, $weatherArray)) {
	$weatherIndex = 0;
}

//明日の天気を出力
echo $weatherArray[$weatherIndex];


Measured memory_bytes: 4728
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N = 101000;
int n,d[N];
vector<int> e[N],V;
void dfs(int x,int dad){
	V.push_back(x);
	for(int v:e[x]) if(v!=dad&&e[v].size()>1){
		dfs(v,x);return;
	}
}
int main(){
	read(n);
	if(n==2){
		cout<<1<<' '<<2<<'\n';
		return 0;
	}
	for(int i=1;i<n;i++){
		int x,y;read(x);read(y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	int sum=0;
	for(int i=1;i<=n;i++)
		if(e[i].size()>1&&++sum)
			for(int v:e[i]) d[v]++;
	for(int i=1;i<=n;i++){
		if(e[i].size()>1&&d[i]<=1){
			for(int v:e[i]) if(e[v].size()==1){dfs(v,0);break;}
			break;
		}
	}
	if(sum+1!=V.size()){puts("-1");return 0;}
	for(int v:e[V.back()]) if(e[v].size()==1&&v!=V[0]){V.push_back(v);break;}
	for(int i=0;i<V.size();i++)
		if(e[V[i]].size()>e[V[V.size()-i-1]].size()){
			reverse(V.begin(),V.end());
			break;
		}
		else if(e[V[i]].size()<e[V[V.size()-i-1]].size()) break;
	int vis[N]={};
	for(int x:V) vis[x]=1;
	vector<int> ans;
	int now=0;
	for(int x:V){
		int k=++now;
		for(int v:e[x])
			if(!vis[v]){
				ans.push_back(++now);
			}
		ans.push_back(k);
	}
	for(int i=0;i<n;i++)
		cout<<ans[i]<<' ';
	cout<<'\n';
	return 0;
}


Measured memory_bytes: 11128
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    map<ll, ll> mp;
    REP(i, 1, n) {
        a[i] += a[i - 1];
    }

    rep(i, n) {
        mp[a[i] % m]++;
    }

    ll res = 0;
    for (auto x : mp) {
        ll t = x.second;
        if (x.first == 0) res += t;
        if (t >= 2) {
            res += t * (t - 1) / 2;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    vector<int> v(3);
    for(int i=0; i<3; ++i)
        cin >> v[i];

    sort(v.begin(), v.end());
    int ans = v[0] + v[1];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll dp[100010];

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

   ll ans = 0;
   dp[0] = 0;
   dp[1] = A[0]/2;
   A[0] %= 2;
   repr(i,1,N){
       dp[i+1] = dp[i] + min(A[i],A[i-1]);
       A[i] -= min(A[i],A[i-1]);
       dp[i+1] += A[i]/2;
       A[i] %= 2;
   }
   ans = dp[N];
   cout << ans << endl;
   
}

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

std::string S;
int ans;

int main()
{
	in >> S;
	for (auto i : S)
	{
		if (i == '+') ++ans;
		else --ans;
	}
	out << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    int arr[2*n+3];
    for(int i=1;i<=2*n;++i)
        cin>>arr[i];
    sort(arr+1,arr+2*n+1);
    int ans=0;
    for(int i=1;i+1<=2*n;i+=2){
        ans+=min(arr[i],arr[i+1]);
    }
    cout<<ans<<"\n";


    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    Int N;
    Int max_dig = 0;
    vector<vector<Int>> G;
    vector<int> label;
    vector<pair<int, int>> edge;
    map<pair<int, int>, int> ie;

    void dfs(int v, int p = -1) {
        set<int> st;
        int cnt = 0;
        for (auto e : G[v]) {
            if (ie.count(make_pair(v, e))) {
                if (label[ie[make_pair(v, e)]] != -1) {
                    st.insert(label[ie[make_pair(v, e)]]);
                }
            }
        }

        for (auto e : G[v]) {
            if (ie.count(make_pair(v, e))) {
                if (label[ie[make_pair(v, e)]] == -1) {
                    while (st.count(cnt)) cnt++;
                    label[ie[make_pair(v, e)]] = cnt;
                    st.insert(cnt);
                }
            }
        }

        for (auto e : G[v]) {
            if (e != p) {
                dfs(e, v);
            }
        }
    }


    void solve() {
        cin >> N;
        G.resize(N);
        label.resize(N - 1, -1);

        for (int i = 0; i + 1 < N; ++i) {
            int a, b;
            cin >> a >> b;
            a--, b--;
            G[a].push_back(b);
            G[b].push_back(a);
            edge.emplace_back(a, b);
            ie[make_pair(a, b)] = i;
            ie[make_pair(b, a)] = i;
        }
        for (int i = 0; i < G.size(); ++i) {
            chmax(max_dig, G[i].size());
        }


        dfs(0);
        cout << max_dig << endl;
        for (int i = 0; i < label.size(); ++i) {
            cout << label[i] + 1 << endl;
        }


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 24312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	string S;
	cin >> S;
	int ans = 7;
	if(S == "MON") ans = 6;
	if(S == "TUE") ans = 5;
	if(S == "WED") ans = 4;
	if(S == "THU") ans = 3;
	if(S == "FRI") ans = 2;
	if(S == "SAT") ans = 1;
	cout << ans << "\n";
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"

#define aim_cpo do{ios::sync_with_stdio(false);\
cin.tie(nullptr);cout.precision(10);cout<<fixed;}while(0)

#define LOCAL_INPUT do{FILE *stream1;\
stream1=freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt","r",stdin);\
if(stream1==nullptr)return 0;}while(0)

#define LOCAL_OUTPUT do{FILE *stream2;\
stream2 = freopen("out.txt", "w", stdout);\
if (stream2 == nullptr) return 0;}while(0)

#ifdef LOCAL_DEFINE
#define show(x) cerr << #x << " = " << x << endl
#else
#define show(x)
#endif

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

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

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

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = (ll)1e9 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  ┏┓┏┓　┓　┏┓
//  ┏┛┃┃　┃　┗┫
//  ┗┛┗┛　┻　┗┛
//
//   謹┃賀┃新┃年┃
//   ━┛━┛━┛━┛
//WWWWWWWWWWWWWWWWWWWWWW

int n, m, h, w, k;
char a[1001][1001];
ll dp[1001][1001];

int main() {
    aim_cpo; // インタラクティブのときは消すように.
#ifdef LOCAL_DEFINE
    LOCAL_INPUT; // インタラクティブのときは消すように.
//    LOCAL_OUTPUT; // ファイルに出力したいときのみ
    show(MOD);
#endif
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }
    dp[0][0] = 1L;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] == '#') continue;
            if (i + 1 < h) dp[i + 1][j] = add(dp[i + 1][j], dp[i][j]);
            if (j + 1 < w) dp[i][j + 1] = add(dp[i][j + 1], dp[i][j]);
        }
    }
    cout << dp[h - 1][w - 1] << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
#endif
    return 0;
}

Measured memory_bytes: 9088
#include <complex>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef int coor;

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<coor> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return +2;       // a--b--c on line
  return 0;
}

typedef vector<P> G;

vector<P> convex_hull(vector<P> &ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  vector<P> ch(2*n);
  for (int i = 0; i < n; ch[k++] = ps[i++]) // lower-hull
    while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]) // upper-hull
    while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  ch.resize(k-1);
  return ch;
}

int main(){
	G poly;
	P p;
	int n;
	double x,y;
	for(scanf("%d",&n);n--;poly.push_back(p))scanf("%lf%lf",&x,&y),p=P(x,y);
	poly=convex_hull(poly);
	x=99999,y=99999;
	int idx=0;
	for(n=0;n<poly.size();n++){
		if(y>(int)imag(poly[n]))x=99999,y=(int)imag(poly[n]);
		if(y==(int)imag(poly[n])&&x>(int)real(poly[n]))x=(int)real(poly[n]),idx=n;
	}
	rotate(poly.begin(),poly.begin()+idx,poly.end());
	printf("%d\n",poly.size());
	for(n=0;n<poly.size();n++)printf("%d %d\n",(int)real(poly[n]),(int)imag(poly[n]));
}

Measured memory_bytes: 3256
#include<iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int dp(int x,int y,int a[][200]){
  if(x==0){
    if(y==0) return a[y][x];
    if(y==1) return dp(x,y-1,a) + a[y][x];
  }
  if(y==0){
    return dp(x-1,y,a) + a[y][x];
  }else{
    return max(dp(x-1,y,a),dp(x,y-1,a)) + a[y][x];
  }
}
int main(){
  int N;
  int a[2][200];
  cin >> N;
  for(int i=0;i<2;++i){
    for(int j=0;j<N;++j){
      cin >> a[i][j];
    }
  }
  cout << dp(N-1,1,a) << endl;
}

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

long double a,b,h,m;

cin>>a>>b>>h>>m;

h=h*30+m*0.5;
m=m*6;
if(h==360)h=0;
if(m==360)m=0;

long double naikaku;
naikaku=min(abs(h-m),360-abs(h-m));
long double radian = naikaku * M_PI / 180.0;



//cout<<naikaku<<endl;
long double ans=sqrt(b * b + a * a - 2 * b * a * cosl( radian ));
printf("%.100Lf\n", ans);
}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

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

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

  if(N % 2 != 0){
    std::cout << "No" << std::endl;
    return 0;
  }

  for(int n = 0;n < N/2;n++){
    if(S[n] != S[n + N/2]){
      std::cout << "No" << std::endl;
      return 0;
    }
  }

  std::cout << "Yes" << std::endl;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};

vl divisor(ll k){
    vl c;
    for(ll i=1; i*i<=k; i++){
        if(k % i == 0){
            c.push_back(i);
            if((k / i) != i){
                c.push_back(k/i);
            }
        }
    }
    //sort(c.begin(), c.end());
    return c;
}

int main() {
    ll n; cin >> n;
    vl div = divisor(n);
    ll ans = linf;
    for(auto i : div){
        ll t = n/i;
        ans = min(ans, i+t);
        //cout << i << t << endl;
    }
    cout << ans-2 << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int k, x;
    cin >> k >> x;
    k *= 500;
    if (k >= x) {
        cout << "Yes\n";
    }
    else cout << "No\n";
}


Measured memory_bytes: 3568
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split( )))

cnt = {i:0 for i in range(-1,n+1)}

cnt[-1] = 3
ans = 1
mod = 10**9+7
for i in range(n):
    ans *= min(cnt[a[i]-1],cnt[a[i]-1]-cnt[a[i]])
    ans %= mod
    cnt[a[i]]+=1
    if cnt[a[i]-1]<cnt[a[i]]:
        print(0)
        exit()

print(ans)


Measured memory_bytes: 62152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    s[5] = ' ';
    s[13] = ' ';

    cout << s << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
total = sum(a)
count = a[0]
ans = abs(total - 2*count)
for i in range(1,n-1):
    count += a[i]
    if ans > abs(total - 2*count):
        ans = abs(total - 2*count)
print(ans)

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	
	int sum = 0;
	for (int i = 0; i < a && k > 0; i++) {
		sum += 1;
		k--;
	}
	
	for (int i = 0; i < b && k > 0; i++) {
		sum += 0;
		k--;
	}
	
	for (int i = 0; i < c && k > 0; i++) {
		sum -= 1;
		k--;
	}
	
	cout << sum;
}

Measured memory_bytes: 3632
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let S: String = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    };

    let ans = if S[..(N / 2)] == S[(N / 2)..] { "Yes" } else { "No" };

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#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<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int f(vi a){
	int n=a.size();
	int dp[4]={0,-inf,-inf,-inf};
	for(int i=1;i<n;i++){
		int DP[4]={-inf,-inf,-inf,-inf};
		DP[0]=max({dp[0],dp[1],dp[2],dp[3]});
		if(a[i-1]==1) dp[1]=-inf;
		DP[1]=max({dp[0]+a[i-1],dp[1]+a[i-1]-1,dp[2]+1});
		if(a[i]>1) DP[2]=max({dp[0],dp[1],dp[2]})+a[i]-1;
		DP[3]=max({dp[0],dp[1],dp[2]})+a[i];
		for(int j=0;j<4;j++) dp[j]=DP[j];
	}
	return max({dp[0],dp[1],dp[2],dp[3]});
}

int n;
string s;

int main(){
	cin>>n>>s;
	s+="0000";
	int t=0,res=0;
	vi a;
	for(int i=0;i<=n;i++){
		if(s[i]=='1') t++;
		else if(t){
			a.push_back(t);
			t=0;
			if(s[i+1]=='0'){
				res+=f(a);
				a.clear();
			}
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 900
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
def check(x):
  if x==0:
    return 0
  else:
    t=0
    for i in range(N):
      t+=math.ceil(A[i]/x)-1
    if t<=K:
      return 10
    else:
      return 0
low=1
high=max(A)
sig=(low+high)//2
tf=0
if K==0:
  tf=1
  ans=high
while tf==0:
  if check(sig)==10:
    if check(sig-1)==0:
      ans=sig
      break
    else:
      high=sig-1
      sig=(low+high)//2
  else:
    low=sig+1
    sig=(high+low)//2
print(ans)

Measured memory_bytes: 103988
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val w = sc.nextLong
  val h = sc.nextLong
  val x = sc.nextLong
  val y = sc.nextLong

  val s = w * h / 2.0d

  val multi = if((2L * x, 2L * y) == ( w, h)) 1 else 0

  println(s"$s $multi")
}


Measured memory_bytes: 25664
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    cout << (s[0] == s[2] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll choose2(ll n) {
  return n*(n-1)/2;
}

int main () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vi cnt(n);
  rep(i,n) cnt[a[i]]++;
  ll tot = 0;
  rep(i,n) {
    tot += choose2(cnt[i]);
  }
  rep(i,n) {
    ll ans = tot;
    ans -= choose2(cnt[a[i]]);
    ans += choose2(cnt[a[i]]-1);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

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

bool solve(string s) {
  // 条件1
  if(s[0] != 'A') return false;

  // 条件2
  int cnt_c = 0;
  for(int i=2; i < s.length()-1; i++) {
    if(s[i] == 'C') cnt_c++;
  }
  if(cnt_c != 1) return false;

  // 条件3
  int cnt_lower = 0;
  rep(i, s.length()) {
    if('a' <= s[i] && s[i] <= 'z') cnt_lower++;
  }
  if(cnt_lower != s.length() - 2) return false;

  return true;
}

int main() {
  string s; cin >> s;

  if(solve(s)) cout << "AC" << endl;
  else cout << "WA" << endl;

  return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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 ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int n,m;
vvi g;

int main(){
	cin>>n>>m;
	g.resize(n);
	map<int,int>c;
	set<int>d;
	vi a(m),b(m);
	rep(i,m){
		cin>>a[i]>>b[i];
		c[a[i]]++;c[b[i]]++;
		d.insert(a[i]);
		d.insert(b[i]);
	}
	for(auto x:d){
        if(c[x]%2==1){
		cout<<"NO"<<endl;return 0;}
	}
	cout<<"YES"<<endl;
}

Measured memory_bytes: 11520
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e-8;

int d[10],v[10];
int x[9],y[9];

int gcd(int x, int y){
    return y ? gcd(y, x%y): x;
}

int lca(int x, int y){
    long long int mul = (long long int)x*y;
    return mul/gcd(x,y);
}

int main(){
    while(1){
        int n;
        scanf("%d",&n);
        if(!n)break;

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

        for(int i=0;i<n-1;i++){
            x[i] = d[i+1]*v[0];
            y[i] = d[0]*v[i+1];
            int g = gcd(x[i],y[i]);
            x[i] /= g;
            y[i] /= g;
            //cout << x[i] << " " << y[i] << endl;
        }

        if(n>2){
            int l = 1;
            for(int i=0;i<n-1;i++){
                l = lca(l, x[i]);
            }
            cout << l << endl;
            for(int i=0;i<n-1;i++){
                cout << l / x[i] * y[i] << endl;
            }
        }else{
            cout << x[0] << endl;
            cout << y[0] << endl;
        }

    }

    return 0;
}

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

int main()
{
    string S;
    cin >> S;

    for (char c = 'a'; c <= 'z'; c++)
    {
        bool found = false;
        for (char s : S)
        {
            if (c == s)
            {
                found = true;
            }
        }

        if (found == false)
        {
            cout << c << endl;
            return 0;
        }
    }

    cout << "None" << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {  
  return b != 0 ? gcd(b, a % b) : a;
}//MAX
int lcm(int a, int b) { 
   return a * b / gcd(a, b);
   }
//MIN

 main() {
string s;
cin >> s;
if(s.size()<4){
    cout << "No"<<endl;
}
else{
if(s.at(0)=='Y'&&s.at(1)=='A'&&s.at(2)=='K'&&s.at(3)=='I')cout <<"Yes"<<endl;
else cout <<"No"<<endl;
}
 }


Measured memory_bytes: 256
"use strict";
// inputに入力データ全体が入る
const main = (input) => {
  //分割代入,1行目がq,2行目がb,3行目がcに代入される
  const [str] = input.trim().split("\n");
  const [strA, strB] = str.split(" ");
  // ここに処理を書く
  const a = Number(strA);
  const b = Number(strB);

  if (a % 2 === 0 || b % 2 === 0) {
    console.log("Even");
  } else {
    console.log("Odd");
  }
};

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29356
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin>>N;
    pair<pair<string,int>,int> pr[N];
    for(int i=0;i<N;i++){
        string S;
        int P=0;
        cin>>S>>P;
        pr[i]=make_pair(make_pair(S,-P),i+1);
    }
    sort(pr,pr+N);

    for(int i=0;i<N;i++){
        cout<<pr[i].second<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>                                                 
                                                                  
int main(void){                                                   
   long int A,B,K;                                                
   scanf("%ld %ld %ld",&A,&B,&K);                                 
                                                                  
   if(A >= K){                                                    
      A = A-K;                                                    
   } else if(A + B >= K){                                         
      K = K -A;                                                   
      A = 0;                                                      
      B = B - K;                                                  
                                                                  
   } else {                                                       
   A = 0;                                                         
   B = 0;                                                         
   }                                                              
   printf("%ld %ld",A,B);                                         
   return 0;                                                      
}  

Measured memory_bytes: 1732
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1
#define pb push_back

using namespace std;

class Point
{
public:
  int x;
  int y;
  Point(int ax, int ay) {
    x = ax, y = ay;
  }
};

vector<Point> l_rotate(vector<Point> line) {
  vector<Point> res;
  for (int i = 0; i < line.size(); i++) {
    res.pb(Point(-line[i].y, line[i].x));
  }
  return res;
}

vector<Point> r_rotate(vector<Point> line) {
  vector<Point> res;
  for (int i = 0; i < line.size(); i++) {
    res.pb(Point(line[i].y, -line[i].x));
  }
  return res;
}

vector<Point> ll_rotate(vector<Point> line) {
  vector<Point> res;
  res = l_rotate(line);
  res = l_rotate(res);
  return res;
}

int main () {
  int n, m, x0, y0, x, y;
  bool flag;
  while (cin >> n, n) {
    vector<Point> line0;
    cin >> m >> x0 >> y0;
    line0.pb(Point(0, 0));
    while (--m) {
      cin >> x >> y;
      line0.pb(Point(x-x0, y-y0));
    }
    if (line0[1].x > 0) line0 = l_rotate(line0);
    else if (line0[1].x < 0) line0 = r_rotate(line0);
    else if (line0[1].y < 0) line0 = ll_rotate(line0);
    for (int i = 1; i <= n; i++) {
      flag = true;
      cin >> m >> x0 >> y0;
      vector<Point> line1, line2;
      line1.pb(Point(0, 0));
      while(--m) {
        cin >> x >> y;
        line1.pb(Point(x-x0, y-y0));
      }
      x0 = line1[line1.size()-1].x, y0 = line1[line1.size()-1].y;
      for (int j = line1.size()-1; j >= 0; j--) {
        line2.pb(Point(line1[j].x-x0, line1[j].y-y0));
      }
      if (line1[1].x > 0) line1 = l_rotate(line1);
      else if (line1[1].x < 0) line1 = r_rotate(line1);
      else if (line1[1].y < 0) line1 = ll_rotate(line1);
      if (line2[1].x > 0) line2 = l_rotate(line2);
      else if (line2[1].x < 0) line2 = r_rotate(line2);
      else if (line2[1].y < 0) line2 = ll_rotate(line2);
      if (line0.size() == line1.size()) {
        for (int j = 0; j < line1.size(); j++) {
          if (line0[j].x != line1[j].x || line0[j].y != line1[j].y) {
            flag = false;
            break;
          }
        }
        if (!flag) {
          flag = true;
          for (int j = 0; j < line2.size(); j++) {
            if (line0[j].x != line2[j].x || line0[j].y != line2[j].y) {
              flag = false;
              break;
            }
          }
        }
        if (flag) cout << i << el;
      }
    }
    cout << "+++++" << el;
  }
}

Measured memory_bytes: 1204