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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve() {
  LL L,R; cin >> L >> R; R = min(R, L+2019); 
  int ans = 2018;
  LL remL = L % 2019;
  LL remR = R % 2019;
  if (remL >= remR) ans = 0;
  else {
      FOR(i, remL, remR) {
          FOR(j, i+1, remR+1) {
              ans = min(ans, (i*j) % 2019);
          }
      }
  } 

  std::cout << ans << endl;
}

int main(int argc, char const *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a_list = list(map(int,input().split()))
color_vari = set()
over3200 = 0
for x in a_list:
	if x >= 3200:
		over3200 += 1

	else:
		color_vari.add(x // 400)
if len(color_vari) == 0:
	print(1,over3200)
else:
	print(len(color_vari),len(color_vari)+over3200)


Measured memory_bytes: 2940
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=x && x<w && 0<=y && y<h)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef pair<int, int> P;
/** Problem2198 : Moonlight Farm **/
int main()
{
	int N, P, A, B, C, D, E, F, S, M;
	string L;
	map<double, vector<string>, greater<double> > list;
	
	while (cin>>N, N) {
		list.clear();
		rep(k, N) {
			cin>>L>>P>>A>>B>>C>>D>>E>>F>>S>>M;
			double time=0.0; int t=M;
			time += A+B+C;
			while (t>0) {
				time+=D+E;
				t--;
			}
			list[double(F*M*S-P)/time].push_back(L);
		}
		map<double, vector<string>, greater<double> >::iterator it=list.begin();
		for (;it!=list.end(); it++) {
			sort(it->second.begin(), it->second.end());
			vector<string>::iterator it2 = it->second.begin();
			for(;it2!=it->second.end(); it2++) {
				cout << *it2 << endl;
			}
		}
		cout << "#" << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = Integer.parseInt(sc.next());
        int ans=0;
        for(int i=0;i<n;i++){
            String h=sc.next();
            h+=h;
            if(h.indexOf(s)!=-1)
                ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 17180
#include <stdio.h>

int main()
{
	int p1, p2, p3;
	int j1, j2;
	int i;
	scanf("%d%d%d%d%d", &p1, &p2, &p3, &j1, &j2);
	int min = p1 + j1;
	if (min > p2 + j1)min = p2 + j1;
	if (min > p3 + j1)min = p3 + j1;
	if (min > p1 + j2)min = p1 + j2;
	if (min > p2 + j2)min = p2 + j2;
	if (min > p3 + j2)min = p3 + j2;
	printf("%d\n", min - 50);
	return 0;
}

Measured memory_bytes: 592
# ABC107C - Candles (ARC101C)
def main():
    N, K, *X = map(int, open(0).read().split())
    ans = float("inf")
    for l, r in zip(X, X[K - 1 :]):
        ans = min(ans, r - l + min(abs(l), abs(r)))
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14052
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
    return powmod(a, MOD-2);
}
ll f[1000010], invf[1000010];
void fac(int n){
    f[0]=1;
    for(ll i=1; i<=n; i++) f[i]=f[i-1]*i%MOD;
    invf[n]=inv(f[n]);
    for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
}
ll comb(int x, int y){
    if(!(0<=y && y<=x)) return 0;
    return f[x]*invf[y]%MOD*invf[x-y]%MOD;
}
int main()
{
    ll a, b, c, d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c, a*d, b*c, b*d})<<endl;
    return 0;
}

Measured memory_bytes: 3632
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict, deque
    import math
    import random
    import collections
    input = stdin.readline
    
    N = int(input())
    S = [input() for i in range(N)]

    c = collections.Counter(S)
    num = c.values()
    print(len(num))
    

Measured memory_bytes: 39076
#include<bits/stdc++.h>
using namespace std;
int main(){
	int k=0;
	cin>>k;
	int s=7;
	int cnt=1;
	bool flag=1;
	for( ;cnt<1000000;cnt++){
		if(s%k==0){
			cout<<cnt;
			flag=0;
			break;
		}
		s%=k;//?????????????
		s=s*10+7;
	}
	if(flag){
		cout<<-1;
	}
	
	return 0;
} 

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

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 MAX = 510000;
const int V = 100005;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1<<30
const int mod = 1e9+7;


int main(){
    ll a,b; cin >> a >> b;
    cout << (a+b+1)/2 << endl;
}


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

int main() {
  int A,B;
  cin >> A >> B;
  
  if(A>B && B!=1 || A==1 && 1<B){
  cout << "Alice" << endl;
  }
  else if(B>A && A!=1 || B==1 &&1<A){
  cout << "Bob" << endl;
  }
  else if(A==B){
  cout << "Draw" << endl;
  }
}


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

int main() {
  int l,n;
  long long p;
  long long c = 0;
  string S , sr , sl , r_sr , r_sl;

  cin >> S;
  n = S.size();
  l = (n+1-1)/2;
  sr = S.substr(0,l);
  sl = S.substr((n+3-1)/2,l);
  r_sr = sr;
  r_sl = sl;
  reverse(r_sr.begin(),r_sr.end());
  reverse(r_sl.begin(),r_sl.end());

  if (sr == sl) {
    if (sr == r_sr){
      if (sl == r_sl){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	string s;
  	cin>>s;
  	int p=0;
  	if(s[0]==s[1] && s[0]!=s[2])
    {
      	if(s[2]==s[3])
        {
          	p=1;
        }
    }
  	else if(s[0]==s[2] && s[0]!=s[1])
    {
      	if(s[1]==s[3])
        {
          	p=1;
        }
    }
  	else if(s[0]==s[3] && s[0]!=s[1])
    {
      	if(s[1]==s[2])
        {
          	p=1;
        }
    }
  	if(p==1)
    {
      	cout<<"Yes\n";
    }
  	else
    {
      	cout<<"No\n";
    }
  	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main{
	
	public static void main(String[] args){
	
	MyScanner sc = new MyScanner();
	out = new PrintWriter(new BufferedOutputStream(System.out));
	
	/**/

	
	int d = sc.nextInt();
	int t = sc.nextInt();
	int s = sc.nextInt();
	
	if(s * t >= d){
	System.out.println("Yes");	
	}else{
	System.out.println("No");
	}
	
	
	/**/
	 
	 out.close();	
	}
	
	
	
	public static PrintWriter out;
	
	public static class MyScanner{
		
		BufferedReader br;
		StringTokenizer st;
		
		public MyScanner(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
	
}


Measured memory_bytes: 32836
#include<stdio.h>

int main(void){
	int N,a100,a10,a;
	
	scanf("%d",&N);
	
	a=N%10;
	a10=N%100-a;
	a100=N-a10-a;
	
	
	if(a==7){
		printf("Yes\n");
	}
	else if((a10/10)==7){
		printf("Yes\n");
	}
	else if(a100/100==7){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 1612
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


char buf[4];

int main(){

	scanf("%s",buf);

	if(buf[0] == buf[2]){

		printf("Yes\n");

	}else{

		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string o,e;
  cin>>o>>e;
  int si=o.size(),si2=e.size();
  si+=si2;
  int count=0;
  rep(i,si){
    if(i%2==0){
      cout<<o[count];
    }
    else{
      cout<<e[count];
      count++;
    }
  }
  cout<<'\n';
  return(0);
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		for(int z=0;z<n;z++){
			int[][] map = new int[10][10];
			int[][] input = new int[10][10];
			int[][] ans = new int[10][10];
			for(int i=0;i<10;i++){
				for(int j=0;j<10;j++){
					input[i][j] = sc.nextInt();
					map[i][j] = input[i][j];
				}
			}
			
			for(int k=0;k<1024;k++){
				StringBuffer sb = new StringBuffer(Integer.toBinaryString(k)).reverse();
				char[] a = sb.toString().toCharArray();
				ans = new int[10][10];

				for(int i=0;i<a.length;i++){
					if(a[i]=='1'){
						if(i!=0) map[0][i-1] = 1-map[0][i-1];
						map[0][i] = 1-map[0][i];
						map[1][i] = 1-map[1][i];
						if(i!=9) map[0][i+1] = 1-map[0][i+1];
						ans[0][i] = 1;
					}
				}
				
				for(int i=0;i<9;i++){
					for(int j=0;j<10;j++){
						if(map[i][j]==1){
							map[i][j] = 0;
							if(j!=0) map[i+1][j-1] = 1-map[i+1][j-1];
							map[i+1][j] = 1-map[i+1][j];
							if(j!=9) map[i+1][j+1] = 1-map[i+1][j+1];
							if(i!=8) map[i+2][j] = 1-map[i+2][j];
							ans[i+1][j] = 1;
						}
					}
				}
				
				boolean flag = false;
				for(int i=0;i<10;i++){
					for(int j=0;j<10;j++){
						if(map[i][j]==1) flag = true;
						map[i][j] = input[i][j];
					}
				}
				if(flag==false)	break;
			}
			
			for(int i=0;i<10;i++){
				for(int j=0;j<10;j++){
					if(j!=0) System.out.print(" ");
					System.out.print(ans[i][j]);
				}
				System.out.println();
			}
		}
	}	
}

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

int main() {
  int n;
  int a_count = 0;
  int b_count = 0;
  int ab_count = 0;
  vector<int> a(n, 0);
  vector<int> b(n, 0);
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    if(s[0] == 'B'){
      b_count++;
      b[i] = 1;
    }
    if(s[s.size() -1] == 'A'){
      a_count++;
      a[i] = 1;
    }
    rep(j,s.size() -1){
      if(s[j] == 'A'&& s[j+1] == 'B')ab_count++;
    }
  }
  if(a == b && a_count > 0){
    cout << a_count + ab_count - 1 << endl;
    return 0;
  }
  cout << min(a_count, b_count) + ab_count << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
int main() {
	int n;
	cin >> n;
	vector<ll>H(n);
	rep(i, n) {
		cin >> H[i];
	}
	for (int i = n - 1; i >= 1; i--) {
		if (H[i - 1] > H[i]) {
			H[i-1]--;
			if (H[i - 1] > H[i]){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (int i=(a); i<(b);++i)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define vi deque<int>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<ll,ll> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<int>())
#define sz(a) (int)a.size()
#define endl '\n'
#define po(a,b) (ll)(pow(a,b)+0.5)
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define Fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
//#define double long double
const ll M=1e9+7;
const int MX=1e5+1;
     
int main()
{     
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    Fast
 int tt=1;
 //cin>>tt;
 while(tt--){
        int x;
        cin>>x;
        cout<<360/__gcd(360,x);
}}



Measured memory_bytes: 3568
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll freq[1000005];
ll vis[1000005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N; cin>>N;
    ll arr[N];
    ll Amx = 0;
    
    for(ll i=0;i<N;++i)
    {
        cin>>arr[i];
        freq[arr[i]]++;
        Amx = max(Amx,arr[i]);
    }
    
    for(ll i=1;i<=Amx;++i)
    {   
        if(freq[i] == 0)
            continue;
            
        ll j = 2*i;
        if(freq[i] > 1)
            vis[i] = 1;
        
        for(;j<=Amx;j+=i)
        {
            if(freq[j])
                vis[j] = 1;
        }
    }
    
    ll ans = 0;
    for(ll i=0;i<N;++i)
    {
        if(!vis[arr[i]])
            ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 20792
#include<iostream>
using namespace std;
int main(){
     int a,b,c,d;
      cin>>a>>b>>c>>d;
      while(a>0 && c>0){
        c=c-b;
        if(c<=0){
            cout<<"Yes";
            return 0;
        }
        a=a-d;
        if(a<=0){
            cout<<"No";
            return 0;
        }
     }
     return 0;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	long a = sc.nextLong();
      	long b = sc.nextLong();
      	long x = sc.nextLong();
      
      	long fb = (b / x) + 1;
 		long fa = 0;
      	if(a - 1 != -1){
          	a = a - 1;
        	fa = (a / x) + 1;
        }
      	System.out.println(fb - fa);
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define repr(i,n) for(int i=0, i##_len=(n); i<i##_len; --i)
#define REP(i,m,n) for(int i=int(m), i##_len=(n); i<i##_len; ++i)
#define pb push_back
typedef long long ll;
typedef double D;
using namespace std;

int main(){
  ll A,B,L;
  cin >> A >> B;
  ll a=A,b=B;
  while (max(a,b)%min(a,b)!=0) {
    L = max(a,b)%min(a,b);
    if(a>b) a=L;
    else b=L;
  }
  cout << A*B/min(a,b) << endl;
}


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

b = [] #差
for i in range(1,n):
    b.append(a[i]-a[i-1])
b.append(a[0]-a[n-1])

w = n*(n+1)//2 #一回の操作で取り除く石の数


if sum(a)%w != 0:
    print('NO')
else:
    res = 0
    c = sum(a)//w #操作回数
    for i in range(n):
        b[i]-=c
    
    for i in range(n):
        if (-b[i]) % n == 0 and b[i] <= 0:
            res += (-b[i])//n
        else:
            res = c+1
            break
            
    if res == c:
        print('YES')
    else:

        print('NO')

Measured memory_bytes: 14996
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	string s;
	cin >> s;
	string str = "CODEFESTIVAL2016";
	int counter = 0;
	for (int i = 0; i < 16; i++) {
		if (s.at(i) != str.at(i)) {
			counter++;
		}
	}
	cout << counter << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;
const int maxn = 100;
const int inf = 0x3f3f3f3f;
int save[maxn];
int ji[maxn], ou[maxn];
int myClock[maxn];
int res;
void dfs(int index, bool check){
    if(index > 12){
        return;
    }
    if(check){
        //cout<<"index  "<<index<<endl;
        int i;
        int sum = 1;
        int nowMin = inf;
        for(i=0;i<24;i++){
            //cout<<myClock[i]<<" ";
            if(myClock[i] == 1 && i!=0){
                nowMin = min(sum, nowMin);
                sum = 1;
            }else if(myClock[i] == 0){
                ++sum;
            }else if(myClock[i] > 1){
                nowMin = 0;
                sum = 1;
            }
        }
        //cout<<endl;
        nowMin = min(sum, nowMin);
        res = max(res, nowMin);
    }
    if(myClock[index] == 1){
        dfs(index+1, true);
        ++myClock[24-index];
        --myClock[index];
        dfs(index+1,true);
        ++myClock[index];
        --myClock[24 - index];
    }else if(myClock[index] == 2){
        ++myClock[24-index];
        --myClock[index];
        dfs(index+1,true);
        --myClock[24-index];
        ++myClock[index];
    }else if(myClock[index] >2){
        res = max(res, 0);
    }else{
        dfs(index+1,false);
    }
}
int main(){
    int n,i,j,k;
    while(~scanf("%d",&n)){
        memset(myClock, 0, sizeof(myClock));
        for(i=1;i<=n;i++){
            scanf("%d",&save[i]);
            ++myClock[save[i]];
        }
        myClock[0] += 1;
        res = 0;
        dfs(1,false);
        printf("%d\n",res);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
	int n, q, query, t, x;
	cin >> n >> q;
	vector<vector<int> > A(n);
	
	rep(i, q)
	{
		cin >> query >> t;
		
		if (query == 0)
		{
			cin >> x;
			
			A[t].push_back(x);
		}
		else if (query == 1)
		{
			if (A[t].size() > 0)
			{
				rep(j, A[t].size())
				{
					cout << A[t][j];
					if (j != A[t].size() - 1)
					{
						cout << " ";
					}
				}
			}
			cout << endl;
		}
		else
		{
			A[t].clear();
		}
	}
}


Measured memory_bytes: 5772
import os, sys, re, math

(A, B, K) = [int(n) for n in input().split()]

cd = []
for i in range(max(A, B), 0, -1):
    if A % i == 0 and B % i == 0:
        cd.append(i)
        if len(cd) == K:
            print (cd[-1])
            break


Measured memory_bytes: 3188
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


// 自作のソート関数
// 5で割った余りの大小で比較
bool less_second(const pair<int,long>& lhs, const pair<int,long>& rhs) {
    return lhs.second > rhs.second;
}


int main()
{
  long n;
  cin  >> n;
  std::vector<pair<int,long>> v(n);
  vector<long> r(n);
  for (int i = 0; i < n; ++i)
  {
     cin >>v[i].second; 
     v[i].first = i;
     r[i] = v[i].second;
  }
  sort(v.begin(), v.end(),less_second);


  int med = (v.size()+1)/2 - 1;
  // cout << "med"<<med <<endl;
  //  for (int i = 0; i < v.size(); ++i){
  //     cout << v[i].first << "-" << v[i].second << endl;
  //  }


  for (int i = 0; i < n; ++i){
    // cout <<"r:"<<r[i];
    if (v[med].second <= r[i] ){
      cout << v[med+1].second <<endl;
    }else{
      cout << v[med].second <<endl;
    }
    
  }
   

  return 0;
}


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

int main() {

    string S;
    cin>>S;
    if(S[0]=='R'){
        if(S[1]=='R'){
            if(S[2]=='R')cout<<3<<endl;
            else cout<<2<<endl;
        }
        else cout<<1<<endl;
    }
    else if(S[1]=='R'){
        if(S[2]=='R')cout<<2<<endl;
        else cout<<1<<endl;
    }
    else if(S[2]=='R')cout<<1<<endl;
    else cout<<0<<endl;

}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int f=0;
  cin >> N;
  string S;

  for (int i=0;i<N;i++){
    cin >> S;
    if(S=="Y"){
      cout << "Four" << endl;
      f=1;
      break;
    } 

  }
  if(f==0){
    cout << "Three"<< endl;
  }
}

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

class Program
    {


    static void Main(string[] args)
    {
        double[] a = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        double heyanokazu = a[0];
        double mitinokazu = a[1];

        List<double>[] idousaki = new List<double>[(int)heyanokazu+1];

        for (int i = 0; i < idousaki.Length; i++)
        {
            idousaki[i] = new List<double>();
        }

        for (int i = 0; i < mitinokazu; i++)
        {
            double[] b = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
            idousaki[(int)b[0]].Add((int)b[1]);
            idousaki[(int)b[1]].Add((int)b[0]);
        }

        var tansakuqueue = new Queue<double>();
        double[] mitisirube = new double[(int)heyanokazu+1];

        tansakuqueue.Enqueue(1);
        mitisirube[1] = 1;

        double j;
        while(tansakuqueue.Count > 0)
        {
            j = tansakuqueue.Dequeue();

            foreach (double k in idousaki[(int)j])
            {
                if (mitisirube[(int)k] == 0){

                    tansakuqueue.Enqueue(k);
                    mitisirube[(int)k] = j;

                }
            }

        }
        Console.WriteLine("Yes");
        for (int i = 2; i <= heyanokazu; i++)
        {
            Console.WriteLine(mitisirube[i]);
        }

    }
}

Measured memory_bytes: 54972
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<queue>
#include<tuple>
#include<vector>
#define lson (now<<1)
#define rson ((now<<1)|1)
#define mid ((nl+nr)>>1)
#define maxn 300005
using namespace std;
typedef long long ll;
int n,m,q;
int xx[maxn],yy[maxn];
int cnt1[maxn],cnt2[maxn];
vector<int>edge[maxn];
int vis[maxn];
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=q;i++)
	{
		scanf("%d%d",&xx[i],&yy[i]);
		cnt1[xx[i]]++;
		cnt2[yy[i]]++;
		edge[xx[i]].emplace_back(yy[i]);
	}
	int maxx1=0,maxx2=0;
	for(int i=1;i<=n;i++)
		maxx1=max(maxx1,cnt1[i]);
	for(int j=1;j<=m;j++)
		maxx2=max(maxx2,cnt2[j]);
		
	int cnt=0;
	for(int j=1;j<=m;j++)
	if(cnt2[j]==maxx2)
	cnt++,vis[j]=1;
	
	for(int i=1;i<=n;i++)
	if(cnt1[i]==maxx1)
	{
		int len=edge[i].size();
		int temp=0;
		for(int j=0;j<len;j++)
		{
			int nex=edge[i][j];
			if(vis[nex])
				temp++;
		}
		if(temp<cnt)
		{
			printf("%d\n",maxx1+maxx2);
			return 0;
		}
	}
	printf("%d\n",maxx1+maxx2-1);
	
}

Measured memory_bytes: 26064
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int main() {

	int N, A[112345];

	scanf("%d", &N);
	rep(i, N) scanf("%d", &A[i]);

	int sum = abs(A[0]);

	rep(i, N - 1) sum += abs(A[i] - A[i + 1]);
	sum += abs(A[N - 1]);

	rep(i, N) {
		if (!i) printf("%d\n", sum - abs(A[0]) + abs(A[1]) - abs(A[0] - A[1]));
		else if (i == N - 1) {
			printf("%d\n", sum - abs(A[i - 1] - A[i]) - abs(A[i]) + abs(A[i - 1]));
		}
		else {
			printf("%d\n", sum - abs(A[i - 1] - A[i]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1]));
		}
	}


	return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
using namespace std;
inline void keep_window_open(){char ch; cin >> ch;}

int main(){
    int a;
    string s;
    cin >>a >> s;
    if(a>=3200)cout << s<<endl;
    else cout << "red"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	public static void main(String[] args) {
		char[][] keys = { ".,!? ".toCharArray(),
		                "abc".toCharArray(),
		                "def".toCharArray(),
		                "ghi".toCharArray(),
		                "jkl".toCharArray(),
		                "mno".toCharArray(),
		                "pqrs".toCharArray(),
		                "tuv".toCharArray(),
		                "wxyz".toCharArray() };

		Scanner in = new Scanner(System.in);
		Pattern pt = Pattern.compile("([1-9]+)0");
		Matcher mc = pt.matcher("");
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			String nums = in.next();
			mc.reset(nums);
			while (mc.find()) {
				char[] charArray = mc.group().toCharArray();
				char num = charArray[0];
				char[] usekey = keys[Character.digit(num, 10) - 1];
				int size = (charArray.length - 2) % usekey.length;
				System.out.print(usekey[size]);
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 12000
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass

n = i()
a = [i for i in range(1,n+1)]
print(sum(a))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1 << 29;
const int MOD = 1000000007;

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n)
    {
        cin >> p.at(i);
    }

    int ans = 0;
    for (int i = 1; i < n - 1; i++)
    {
        int a = p.at(i - 1);
        int b = p.at(i);
        int c = p.at(i + 1);

        if ((a < b && b < c) || (c < b && b < a))
            ans++;
    }
    cout << ans << endl;
}


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

using namespace std;
const int N = 3030;
int dp[N][N];

string a, b;

int main() {
  cin >> a >> b;
  int n = a.length();
  int m = b.length();
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i - 1] == b[j - 1]) {
        dp[i][j] = 1 + dp[i - 1][j - 1];
      } else {
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      }
    }
  }
  int x = 0, y = 0;
  int best = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (dp[i][j] > best) {
        best = dp[i][j];
        x = i;
        y = j;
      }
    }
  }
  string ans;
  while ((x > 0) && (y > 0)) {
    cerr << ans << endl;
    if (a[x - 1] == b[y - 1]) {
      ans += a[x - 1];
      --x;
      --y;
    } else {
      if (dp[x - 1][y] > dp[x][y - 1]) {
        --x;
      } else {
        --y;
      }
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}


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

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

  for (int i = 1; i < 100000; i++)
  {
    int aa = i*0.08;
    int bb = i*0.1;
    if(aa==a && bb==b){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

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

int main(){
    char b;
    cin >> b;
    if(b=='A') cout << 'T' << endl;
    if(b=='T') cout << 'A' << endl;
    if(b=='G') cout << 'C' << endl;
    if(b=='C') cout << 'G' << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int ans = Integer.MAX_VALUE;
		for(long i = 1 ; i * i <= n ; i++) {
			if(n % i == 0) {
				int a = func(n/i);
				int b = func(i);
				int c = Math.max(a, b);
				ans = Math.min(ans, c);
			}
		}
		System.out.println(ans);
	}

	static int func(long x) {
		int ret = 0;
		while(x >= 1) {
			x /= 10;
			ret++;
		}
		return ret;
	}

}


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

using namespace std;

int main(){
    char a,b;
    cin >> a >> b;
    if(a > b){
        for(int i = 0;i < a -'0';i++)cout << b;
    }else{
        for(int i = 0;i < b -'0';i++)cout << a;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
 
 int main() {
 int da[25],sc[41],i,j,k,n,fr;
 char ch[100];
 while(cin >> n) {
	 if (n==0) break;
	 cin.ignore();
	 for (j=0;j<n;j++) {
     gets(ch); k=fr=sc[j]=0; 
     for (i=0;i<25;i++) da[i]=0;
     for (i=0;ch[i]!='\0';i++) if (ch[i]>='0' && ch[i]<='9') da[k]=da[k]*10+ch[i]-'0'; else k++;
	 k++; i=fr=1; sc[j]=0;
	 for (fr=1;fr<10;fr++) {
		 if (da[i]==10) {sc[j]+=10+da[i+1]+da[i+2]; i++;} else {
		 if (da[i]+da[i+1]==10) sc[j]+=10+da[i+2]; else sc[j]+=da[i]+da[i+1];
		 i+=2;} }
	 sc[j]=(sc[j]+da[i]+da[i+1]+da[i+2])*10000+(9999-da[0]);
	 }
     sort(sc,sc+n);
     for (i=n-1;i>=0;i--) cout << 9999-(sc[i] % 10000) << ' ' << sc[i]/10000 << endl;
 }
 return 0;
 }

Measured memory_bytes: 1184
N,K=map(int,input().split())
A=list(map(int,input().split()))
from copy import copy

for k in range(K):
    left={}
    right={}
    for i in range(N):
        l=max(0,i-A[i])
        r=min(N-1,i+A[i])
        if l in left:
            left[l]+=1
        else:
            left[l]=1
        if r in right:
            right[r]+=1
        else:
            right[r]=1

    br=[]
    b=0
    m=N
    for i in range(N):
        if i in left:
            b+=left[i]
        br.append(b)
        m=min(m,b)
        if i in right:
            b-=right[i]
    if m==N:
        break
    A=copy(br)
print(*br)

Measured memory_bytes: 191840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] ans = new int[N+1];
        for (int x = 1; x*x < N; x++) {
            for (int y = 1; y*y < N; y++) {
                for (int z = 1; z*z < N; z++) {
                    int val = x*x+y*y+z*z+x*y+x*z+y*z;
                    if(val<=N) ans[val]++;
                }
            }
        }
        for (int i = 1; i <= N; i++) {
            out.println(ans[i]);
        }
    }

    final int mod = 1000000007;
    int mul(int x, int y){
        return (int)((x * 1L * y) % mod);
    }
    int add(int x, int y) {
        x += y;
        return x >= mod ? (x - mod) : x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        return x >= mod ? (x - mod) : x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 35004
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;
typedef pair<int, int> p_i;

#define rep(i, n) for (ll i = 0LL; i < n; i++)
#define repext(i, a, b) for (ll i = a; i < b; i++)
#define reprev(i, n) for (ll i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (ll i = b - 1; i >= a; i--)

#define repv(v, values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0LL)
#define srt(vec) sort(vec_all(vec))
#define rev(vec) reverse(vec_all(vec))
#define revsrt(vec) \
    srt(vec);       \
    rev(vec)

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

template <typename T, typename S>
void dump_dic(map<T, S> dic)
{
    for (auto v : dic)
    {
        cout << v.first << ": " << v.second << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main()
{
    ll l, r;
    cin >> l >> r;
    if (l / 2019 < r / 2019) {
        cout << 0 << endl;
        return 0;
    }

    int min = 2019;
    repext(i, l, r + 1) {
        repext(j, i + 1, r + 1) {
            if (min > (i * j) % 2019) {
                min = (i * j) % 2019;
            }
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

template<class T>
struct SegmentTree {
private:
    int n;
    vector<T> node;
    T def;
    function<T(T,T)> lop;
    function<T(T,T)> out;
    
public:
    SegmentTree() {}
    SegmentTree(const vector<T> &v, T _def, function<T(T,T)> _lop, function<T(T,T)> _out) {
        int vl = (int)v.size();
        n = 1;
        while(n < vl) n *= 2;
        def = _def; lop = _lop; out = _out;
        node = vector<T>(2 * n - 1, def);
        for(int i = 0; i < vl; i++) node[i + n - 1] = v[i];
        for(int i = n - 2; i >= 0; i--) node[i] = out(node[i * 2 + 1], node[i * 2 + 2]);
    }
    
    void update(int idx, T val) {
        idx += (n - 1);
        node[idx] = lop(node[idx], val);
        while(idx > 0) {
            idx = (idx - 1) / 2;
            node[idx] = out(node[idx * 2 + 1], node[idx * 2 + 2]);
        }
    }
    
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if ((r <= a) || (b <= l)) return def;
        if ((a <= l) && (r <= b)) return node[k];
        return out(query(a, b, 2 * k + 1, l, (l + r) / 2), query(a, b, 2 * k + 2, (l + r) / 2, r));
    }
};

struct S {
    ll l, r, q;
    
    bool operator<(const S &b) const {
        if (r != b.r) return r < b.r;
        if (q != b.q) return q < b.q;
        return l < b.l;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, q;
    cin >> n >> q;
    vector<ll> c(n);
    rep(i, n) cin >> c[i];
    vector<ll> bef(n + 1, -1);
    vector<S> vs;
    rep(i, n) {
        if (bef[c[i]] != -1) {
            vs.push_back((S){bef[c[i]], i, -1});
        }
        bef[c[i]] = i;
    }
    rep(i, q) {
        ll l, r;
        cin >> l >> r;
        l--; r--;
        vs.push_back((S){l, r, i});
    }
    sort(all(vs));
    auto lop = [](ll a, ll b){ return a + b; };
    auto out = [](ll a, ll b){ return a + b; };
    SegmentTree<ll> st(vector<ll>(n, 0), 0, lop, out);
    vector<ll> ans(q);
    rep(i, sz(vs)) {
        if (vs[i].q == -1) {
            st.update(vs[i].l, 1);
        }
        else {
            ans[vs[i].q] = (vs[i].r - vs[i].l + 1) - st.query(vs[i].l, vs[i].r);
        }
    }
    rep(i, q) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 46456
n = gets.to_i
a = gets.split.map(&:to_i)

ans = 0
loop do
  cnt = 0
  b = a.map{|i|i+ans}
  n.times do |i|
    cnt += b[i]/(n+1)
    cnt += 1 if b[i]%(n+1) == n
  end
  if cnt > ans
    ans = cnt
  else
    puts ans
    exit
  end
end

Measured memory_bytes: 3836
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	int v,n,sum=0,cnt=0;
	double ave=0;
	while(~scanf("%d,%d",&v,&n)){
		if(v==0)break;
		sum+=v*n;
		ave+=n;
		cnt++;
	}
	n=(int)(0.5 + ave/cnt);
	printf("%d\n%d\n",sum,n);
	return 0;
}

Measured memory_bytes: 1184
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
map<char,ll>MP;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>s;
  bool hoge=true;
  for(auto a:s)MP[a]++;
  for(auto a:MP){
    if(a.S!=2)hoge=false;
  }
  if(hoge)
  cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int a[10];
int main() {
	int n; cin >> n;
	rep(k, n) {
		rep(i, 10)scanf("%d", &a[i]);
		rep(i, 1 << 10) {
			stack<int>s[2];
			rep(j, 10)if (s[(i >> j) & 1].empty() || a[j] > s[(i >> j) & 1].top())s[(i >> j) & 1].push(a[j]);
			if (s[0].size() + s[1].size() == 10) { puts("YES"); break; }
			if (i == (1 << 10) - 1)puts("NO");
		}
	}
	return 0;
}

Measured memory_bytes: 3112
import Text.Printf
main = loop
loop :: IO ()
loop = do
    ln <- getLine
    let [a,op,b] = words ln
    case op of
        "+" -> print ((read a) + (read b)) >> loop
        "-" -> print ((read a) - (read b)) >> loop
        "*" -> print ((read a) * (read b)) >> loop
        "/" -> print ((read a) `div` (read b)) >> loop
        "?" -> return ()

Measured memory_bytes: 4076
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

struct Edge {
	int to; // 辺の行き先
	ll cost; // その辺を通るコスト
	Edge(int t, ll c) : to(t), cost(c) { }
};

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int N; cin >> N;
	vector<vector<Edge> > G(N);
	// グラフを隣接リストでセットする
	REP(i, N - 1) {
		int a, b; cin >> a >> b; a--; b--;
		ll c; cin >> c;
		G[a].push_back(Edge(b, c));
		G[b].push_back(Edge(a, c));
	}
	int Q; cin >> Q;
	int K; cin >> K; K--;
	vector<int> x(Q), y(Q); REP(i, Q) cin >> x[i] >> y[i];
	REP(i, Q) {
		x[i]--;
		y[i]--;
	}

	// 最短距離を初期化
	vector<ll> d(N, (ll)1e18);
	d[K] = 0;
	// 距離が小さい順に取り出せるようgreater<P>を指定
    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0, K));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second; // 更新した頂点の中で距離が最小の頂点v
        if (d[v] < p.first) continue;
        for (auto e : G[v]) { // 頂点vから出る辺eを走査
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }

	REP(i, Q) cout << d[x[i]] + d[y[i]] << '\n';
    return 0;
}


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

int prime_judge(int x){
	int f = 1;
	for(int i=2; i<=sqrt(x) && f == 1; i++){
		if(x % i == 0){
			f = 0;
		}
	}
	if(f){
		return 1;
	}else{
		return 0;
	}
}

int main(){
	int N, cnt = 0;
	cin >> N;
	for(int i=6; i<=55555 && cnt != N; i=i+5){
		if(prime_judge(i)){
			cout << i << " " << endl;
			cnt++;
		}
	}
	return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_d
#include<bits/stdc++.h>
#define endl "\n"
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define F first
#define S second
typedef long long int ll;
const int INF = 1e9;

using namespace std;

vector<pair<ll,ll>> items;
vector<vector<ll>> dp;

ll makeKnapsack(ll n, ll W)
{
    if(W<=0) return 0;

    if(dp[n][W] != -1) return dp[n][W];

    ll &max_val = dp[n][W];

    if(n==0)
    {
        if(items[0].F <= W) max_val = items[0].S;
        else max_val =  0;

        return max_val;
    }

    if(items[n].F>W) max_val = makeKnapsack(n-1, W);
    else max_val = max(makeKnapsack(n-1, W), items[n].S + makeKnapsack(n-1, W-items[n].F));
    return max_val;
}

void solve()
{
    ll i, j, n, capacity, max_value=0;
    cin>>n>>capacity;
    dp.assign(n+1, vector<ll> (capacity+1, -1));
    
    pair<ll,ll> item;
    for(i=0; i<n; ++i)
    {
        cin>>item.F>>item.S;
        items.push_back(item);
    }

    cout<<makeKnapsack(n-1, capacity)<<endl;
}
 
int main()
{
    FASTIO
    solve();
    return 0;
}

Measured memory_bytes: 80372
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  map<string,int> point;
  int n;
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    if(point.find(s) != point.end()){
      point.at(s)++;
    }else{
      point.insert(make_pair(s,1));
    }
  }
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    if(point.find(s) != point.end()){
      point.at(s)--;
    }else{
      point.insert(make_pair(s,-1));
    }
  }
  auto itr = point.begin();
  int maxpoint = 0;
  while(itr != point.end()){
    maxpoint = max(itr->second,maxpoint);
    ++itr;
  }
  cout << maxpoint << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        double ans = 1;

        for (int i = 1; i < x; i++) {
        	loop1:
        	for (int j = 2; j < x; j++) {
        		if (Math.pow(i, j) > x) {
        			break loop1;
        		}
        		if (ans < Math.pow(i, j)) {
        			ans = Math.pow(i, j);
        		}
        	}
        }
        System.out.println((int)ans);

        sc.close();
    }    
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define all(v) (v).begin(), (v).end()
using namespace std;




void solve()
{
    ll n, k;
    cin >> n >> k;
    long  double x;
    std::vector<long double> v(n + 1);
    v[0] = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> x;
        v[i] = v[i - 1] + log10(x);
        // cout<<v[i]<<" ";
    }

    for(int i = 2; i + k - 1 <= n; i++)
    {
        // cout<<i<<" "<<i+k-1<<v[i + k - 1] - v[i - 1] <<" " <<v[i + k - 2] - v[i - 2]<<endl;
        if(v[i + k - 1] - v[i - 1] <= v[i + k - 2] - v[i - 2])
        {
            cout << "No\n";
        }
        else
            cout << "Yes\n";


    }
}


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


    int TESTS = 1;
    // cin >> TESTS;
    while(TESTS--)
    {
        solve();

    }
    return 0;
}

Measured memory_bytes: 6408