akhauriyash/Code-Regression huggingface dataset:
N, T = map(int, input().split())
l = []
for i in range(N):
  l.append(list(map(int, input().split())))
l.sort()

for i in range(N):
  if l[i][1] <= T:
    print(l[i][0])
    break
  if i+1 == N:
    print('TLE')

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    char box[256];
    int count = 0;
    int i,j;
    scanf("%s",box);

    
   for (i = 0; i < 4; i++){
       for (j = 0; j < 4; j++){
            if (box[i] == box[j]){
                count ++;
            }
       }
   }
   if (count == 8){
        printf("Yes");   
   }else{
       printf("No");
   }

    return 0;
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

class Main {

  public static void main(String[] args) {
    final FastScanner scanner = new FastScanner();
    final PrintWriter writer = new PrintWriter(System.out);
    boolean b = Long.parseLong(scanner.next()) * 500 >= Long.parseLong(scanner.next());
    writer.println(b ? "Yes" : "No");
    writer.flush();
  }

  // FastScanner --
  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    public FastScanner() {
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte())
        return buffer[ptr++];
      else
        return -1;
    }

    private boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr]))
        ptr++;
      return hasNextByte();
    }

    public String next() {
      if (!hasNext())
        throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext())
        throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
        throw new NumberFormatException();
      return (int) nl;
    }

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

Measured memory_bytes: 21204
#include <iostream>

using namespace std;

int main(){
   bool a[31]={false};
   int in;
   for(int i=1;i<29;i++){
      cin >> in;
      a[in] = true;
   }
   for(int i=1;i<31;i++){
      if(!a[i]) cout << i << endl;
   }
   return 0;
}

Measured memory_bytes: 1160
S = input()

n = len(S) - 1

ans = 0

for i in range(2**n):
    loc = [] # 右から何番目に＋を入れるかを格納
    for j in range(n):
        if (i>>j) & 1:
            loc.append(j+1)
    
    S2 = S

    for k in reversed(loc):
        S2 = S2[:k] + '+' + S2[k:]
    ans += eval(S2)

print(ans)


Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int xy[] = new int[2];
        StringBuilder sb;
        for(int j=1; j<=10000; j++){
            xy[0] = sc.nextInt();
            xy[1] = sc.nextInt();
            if(xy[0]==0 && xy[1]==0) break;
            Arrays.sort(xy);
            sb = new StringBuilder();
            sb.append(xy[0]).append(" ").append(xy[1]);
            System.out.println(sb.toString());
        }
        sc.close();
    }
}

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

int main()
{
    int n;
    int max_ = -1, id;
    int a, v;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> a >> v;
        if(max_ < v){
            max_ = v;
            id = a;
        } else if(max_ == v && id > a){
            id = a;
        }
    }
    
    cout << id << ' ' << max_ << endl;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int max(int a,int b){return (a>b ? a:b);}
int min(int a,int b){return (a<b ? a:b);}

int compare_int(const void *a, const void *b){return *(int*)a - *(int*)b;}
//これは昇べきの順のソート

//int compare_int(const void *a, const void *b){return *(int*)b - *(int*)a;}
//これは降べきの順のソート

//qsort(配列, 長さ, sizeof(int), compare_int);

double BS(int array[],int len,int target);


void merge(long long a1[],long long len_a1,long long a2[],long long len_a2,long long a[]){
    long long i = 0,j = 0;
    while(i<len_a1 || j<len_a2){
        if(j>=len_a2 || (i<len_a1 && a1[i]<a2[j])){
            a[i+j] = a1[i];
            i++;
        }else{
            a[i+j] = a2[j];
            j++;
        }
    }
}
void mergeSort(long long a[],long long len_a){
    if(len_a > 1){
        long long m = len_a/2;
        long long n = len_a - m;
        long long a1[m];
        long long a2[n];
        for(long long i = 0;i < m;i++) a1[i] = a[i];
        for(long long i = 0;i < n;i++) a2[i] = a[m+i];
        mergeSort(a1,m);
        mergeSort(a2,n);
        merge(a1,m,a2,n,a);
    }
}
 
//////////////////////////////////////////


int N,K;
char S[11];

int main(){
    scanf("%d",&N);
    scanf("%s",S);
    scanf("%d",&K);
    
    char mark = S[K-1];

    for(int i = 0;i < N;i++){
        if(S[i] != mark){
            S[i] = '*';
        }
        printf("%c",S[i]);
    }
    printf("\n");

    return 0;
}



///////////////////////////////////////////


double BS(int array[],int len,int target){ //(配列,長さ,見つける値)
    int low,mid,high;

    low = 0;
    high = len-1;

    int mark;

    while(low <= high){
        mid = (low + high) / 2;
        if(array[mid] == target){
            mark = 0;
            break;
        }else if(array[mid] < target){
            low = mid + 1;
            mark = 1;
        }else{
            high = mid - 1;
            mark = -1;
        }
    }
    if(mark == 0){
        return mid; //配列の何番目か（０から）
    }else if(mark == 1){
        return (double)mid + 0.5;//なかったらどこのあいだか
    }else{
        return (double)mid - 0.5;
    }
}


Measured memory_bytes: 128
a = []
for i in range(3):
    s = list(map(int,input().split()))
    a.append(s)
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(n):
    for j in range(3):
        for k in range(3):
            if a[j][k] == b[i]:
                a[j][k] = -1
cnt = 0
tate = 0
for i in range(3):
    cnt = 0
    for j in range(3):
        if a[j][i] == -1:
            cnt +=1
    if cnt ==3:
        tate = 1
        break
cnt = 0
yoko = 0
for i in range(3):
    cnt = 0
    for j in range(3):
        if a[i][j] == -1:
            cnt+=1
    if cnt == 3:
        yoko = 1
        break
cnt = 0
naname1 = 0
for i in range(3):
    if a[i][i] == -1:
        cnt+=1
if cnt == 3:
    naname1 = 1
cnt = 0
naname2 = 0
for i in range(3):
    if a[i][2-i] == -1:
        cnt +=1
if cnt == 3:
    naname2 = 1
if tate == 1 or yoko == 1 or naname1 == 1 or naname2 == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

vector<vector<int> > v;
int ans = 0, k;
int dfs(int now){
	if(v[now].empty()) return 0;
	int ret = 0;
	for(auto to: v[now]){
		int num = dfs(to);
		if(now && num >= k - 1) ans++, num = -1;
		ret = max(ret, num + 1);
	}
	return ret;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, a;
    cin >> n >> k;
    v.resize(n);
    for(int i=0;i<n;i++){
    	cin >> a;
    	a--;
    	if(i) v[a].pb(i);
    	else if(a) ans++;
    }
    dfs(0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10368
/*
 * @Author: Luisvacson
 * @LastEditors: Luisvacson
 * @Descriptions: None
 * @Date: 2020-03-28 20:00:38
 * @LastEditTime: 2020-03-28 20:02:28
 * @FilePath: \VSCode\C++\Practice\AC abc160 A.cpp
 */
#include<bits/stdc++.h>
using namespace std;

char ch[6];
signed main(){
    scanf("%s",&ch);
    puts(ch[2]==ch[3]&&ch[4]==ch[5]?"Yes":"No");
    return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

int d, t, s;

int main() {

	FAST;

	cin >> d >> t >> s;
	cout << ((t * s >= d) ? "Yes\n" : "No\n");
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(500*500)

def cal_bw(now, value, record, g):
  search_li = g[now]
  record[now] = value
  for s in search_li:
    if record[s] == value:
      return False
    if record[s] != -1:
      continue
    record = cal_bw(s, (value+1)>>1 == 0, record, g)
    if not record:
      return False
  return record

def run():
  N, M = map(int, input().split())
  g = {}
  for m in range(M):
    a, b = map(int, input().split())
    g.setdefault(a, []).append(b)
    g.setdefault(b, []).append(a)
  record = [-1]*(N+1)
  record = cal_bw(1, 0, record, g)
  #print(record)
  if record:
    print(record.count(0)*record.count(1) - M)
  else:
    print(N*(N-1)//2 - M)
    
if __name__ == '__main__':
    run()

Measured memory_bytes: 33924
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int main(void)
{
    int n; cin >> n;
    do {
        int e[n], p[n], q[n];
        ll tmp[4010] = {};
        int Flag[4010] = {};
        int flag = 0;
        rep(i, n) cin >> e[i] >> p[i] >> q[i];
        for (int i = 0; i < n; i++) {
            tmp[e[i]] += p[i] * q[i];
        }
        for (int i = 0; i < n; i++) {
            if (tmp[e[i]] >= 1000000 && Flag[e[i]] == 0) {
                cout << e[i] << endl;
                flag = 1;
                Flag[e[i]]++;
            }
        }
        if (flag == 0) cout << "NA" << endl;
        cin >> n;
    } while(n != 0);

    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
#include <deque>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}



int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/


/*
 * 最大公約数計算
 */
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int X,t;
	cin >> X >> t;
	int ans = X - t;
	if (ans < 0)
	{
		ans = 0;
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
ll gcd(ll a,ll b){
	return a%b==0?b:gcd(b,a%b);
}
ll lcm(ll a,ll b){
	ll g=gcd(a,b);
	return a/g*b;
}
ll t[100];
int main(void)
{
	int n,i;
	ll ans=1;
	scanf("%d",&n);
	FOR(i,0,n){
		scanf("%lld",&t[i]);
		ans=lcm(ans,t[i]);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		TreeSet<Integer>ts=new TreeSet<>();
		int n=sc.nextInt();
		for(int i=0;i<n;i++) ts.add(sc.nextInt());
		if(ts.size()==n)System.out.println("YES");
		else System.out.println("NO");
	}
}

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

signed main() {
  string n;
  int total = 0;
  cin >> n;
  for (int i = 0; i < n.size(); i++) total += n[i] - '0';
  if (total % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int ans = 0; // 音を聞いた回数をカウント
  while (1) {
    if (A <= B && ans < C) { // 所持金がA円以上かつ音を聞いた回数がC回未満なら
      ans++;
      B -= A;
    }
    else {
      break;
    }
  }
  cout << ans << endl;  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K

int main(){
    ll n;
    cin >> n;

    vi x(n);
    vi a(n);
    REP(i,n){
        cin >> x[i];
        a[i] = x[i];
        //cout << x[i] << a[i] << endl;
    }

    sort(all(a));

    REP(i,n){
        //cout << x[i] << a[i] << ":";
        if(x[i]>a[(n/2)-1]){
            cout << a[(n/2)-1]<< endl;
        }else{
            cout << a[(n/2)]<<endl;
        }
    }

}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N,K;
int root;
vector<int> g[100100];
int p[100100];
P seg[100100];
int ans[100100];
int depth[100100];
P merge(P a,P b){
	P res;
	res.fi = max(a.fi,b.fi);
	res.sec = min(a.sec,b.sec);
	return res;
}
P lap(P a){
	a.fi--;
	a.sec++;
	return a;
}
bool incl(P a,int x){
	if(a.fi<=x&&x<=a.sec)return true;
	else return false;
}
void pre_dfs(int v,int par,int d){
	depth[v]=d;
	for(int i=0;i<g[v].size();i++){
		if(g[v][i]==par)continue;
		pre_dfs(g[v][i],v,d+1);
	}
}
void dfs(int v,int par){
	seg[v] = P(-INF,INF);
	if(p[v]!=-1)seg[v].fi=seg[v].sec=p[v];
	for(int i=0;i<g[v].size();i++){
		if(g[v][i]==par)continue;
		dfs(g[v][i],v);
		seg[v] = merge(seg[v],lap(seg[g[v][i]]));
	}
}
void restore(int v,int par){
	if(p[v]!=-1)ans[v]=p[v];
	if(par!=-1){
		if(incl(seg[v],ans[par]+1))ans[v]=ans[par]+1;
		else ans[v]=ans[par]-1;
	}
	for(int i=0;i<g[v].size();i++){
		if(g[v][i]==par)continue;
		restore(g[v][i],v);
	}
}
int main(){
	cin >> N;
	for(int i=0;i<N-1;i++){
		int a,b;
		cin >> a >> b;
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	memset(p,-1,sizeof(p));
	cin >> K;
	for(int i=0;i<K;i++){
		int v;
		cin >> v;
		v--;
		cin >> p[v];
		root = v;
	}
	pre_dfs(root,-1,0);
	int parity = (p[root]+depth[root])%2;
	for(int i=0;i<N;i++){
		if(p[i]==-1)continue;
		if((p[i]+depth[i])%2!=parity){
			cout << "No" << endl;
			return 0;
		}
	}
	dfs(root,-1);
	for(int i=0;i<N;i++){
		if(seg[i].sec<seg[i].fi){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	restore(root,-1);
	for(int i=0;i<N;i++)cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 16128
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

using namespace std;

int main(void){
    long double a,b;
    long long c;
    cin>>a>>b;
    a*=b;
    c=(long long)a;
    cout<<c<<endl;
    return 0;
}


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

int main(){
	int A[9];
	int chk[9];
	for(int i=0;i<9;i++){
		cin >> A[i];
		chk[i] = 0;
	}
	int N;
	cin >> N;
	int b[N];
	for(int i=0;i<N;i++){
		cin >> b[i];
		for(int j=0;j<9;j++){
			if(A[j] == b[i]) chk[j]++;
		}
	}
	string ans = "No";
	if(chk[0] > 0 && chk[1] > 0 && chk[2] > 0)ans = "Yes";
	if(chk[3] > 0 && chk[4] > 0 && chk[5] > 0)ans = "Yes";
	if(chk[6] > 0 && chk[7] > 0 && chk[8] > 0)ans = "Yes";
	if(chk[0] > 0 && chk[3] > 0 && chk[6] > 0)ans = "Yes";
	if(chk[1] > 0 && chk[4] > 0 && chk[7] > 0)ans = "Yes";
	if(chk[2] > 0 && chk[5] > 0 && chk[8] > 0)ans = "Yes";
	if(chk[0] > 0 && chk[4] > 0 && chk[8] > 0)ans = "Yes";
	if(chk[2] > 0 && chk[4] > 0 && chk[6] > 0)ans = "Yes";
	cout << ans << endl;
}

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

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

  int n = s.size();
  bool can = true;
  string t = s;
  reverse(t.begin(), t.end());

  if(t != s) can = false;
  string sl = s.substr(0,(n - 1)/2);
  string sr = s.substr((n + 1)/2, (n - 1)/2);
  string tl = t.substr(0,(n - 1)/2);
  string tr = t.substr((n + 1)/2, (n - 1)/2);

  rep(i,(n - 1)/2){
  	if(sl[i] != tr[i]) can = false;
  	if(sr[i] != tl[i]) can = false;
  }
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll N,X;
	scan(N>>X);
	ll Y=max(N-X,X);
	X=N-Y;
	ll ans=N;
	while(1){
		if(Y%X==0){
			ans+=Y/X*X*2-X;
			prin(ans);
			return 0;
		}
		else{
			ans+=Y/X*X*2;
			ll nextY=X,nextX=Y%X;
			Y=nextY,X=nextX;
		}
		//prin(ans);
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define FOR(i,n) for(int i = 0;i<n;i++)
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;

int N;
int c[200020];
int dp[200020];
int sum[200020];

vint g[200020];
 
signed main() {
    IOS();
    cin>>N;
    rep(i,0,N){
        cin>>c[i];
        if(i){
            if(c[i]==c[i-1]){
                i--;
                N--;
            }
        }
    }
    
    rep(i,0,N){
        g[c[i]].pb(i);
    }
    
    dp[0]=1;
    rep(i,0,N){
        (dp[i+1]+=dp[i]+sum[c[i]])%=MOD;
        (sum[c[i]]+=dp[i])%=MOD;
    }
    cout<<dp[N]<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 15872
package main

import ."fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	m,x:=0,0
	Scan(&m)
	for i := 1; i < 2e6; i++ {
		if x = (x*10 + 7) % m; x == 0 {
			Print(i)
			return
		}
	}
	Print(-1)
}


Measured memory_bytes: 1792
<?php
fscanf(STDIN, "%d %d %d", $n, $k, $q);

$entrys = array();
$entry = $k - $q;

for ($i = 0; $i < $n; $i++) {
  $entrys[] = $entry;
}

for ($i = 0; $i < $q; $i++) {
  fscanf(STDIN,"%d",$a);
  $entrys[$a - 1] += 1;
}

$result = '';
foreach ($entrys as $entry) {
  if ($entry > 0) {
    $result .= 'Yes';
    $result .= "\n";
  } else {
    $result .= 'No';
    $result .= "\n";
  }
}

echo $result;

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

using namespace std;

int main() {
  int N, A, B;
  cin >> N;
  if (N == 1) {
    cout << "Hello World" << endl;
  }
  else {
    cin >> A >> B;
    cout << A + B << endl;
  }
  return 0;
}



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


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

int main() 
{
    int n, ans = 0;
    cin >> n;
    vector<vector<int>> x(n, vector<int>());
    vector<vector<int>> y(n, vector<int>());

    for(int i = 0; i < n; i++) {
        int t;  cin >> t;
        x.at(i).resize(t);  y.at(i).resize(t);

        for(int j = 0; j < t; j++) {
            cin >> x.at(i).at(j);
            x.at(i).at(j)--;
            cin >> y.at(i).at(j);
        }
    }

    for(long long bit = 0; bit < (1 << n); bit++) {
        vector<bool>    t_or_f(n, false);
        int true_num = 0;   bool judge = true;

        for(int i = 0; i < n; i++)
            if((1 << i) & bit) {
                t_or_f.at(i) = true;
                true_num++;
            }

        for(int i = 0; i < n; i++) {
            if(t_or_f.at(i)) {
                for(int j = 0; j < x.at(i).size(); j++)
                    if(t_or_f.at(x.at(i).at(j)) != y.at(i).at(j))
                        judge = false;
            }
        }
           
        if(judge && (ans < true_num))
            ans = true_num;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int inf = 2e17;
const int mod = 1e9 + 7;

signed main() {
    int N, M;
    cin >> N >> M;
    vector<bool> check(N + 100, false);
    vector<int> worng(N + 100, 0);
    int AC = 0, WA = 0;
    for (int i = 0; i < M; i++) {
        int p; string S;
        cin >> p >> S;
        if (!check[p]) {
            if (S == "AC") {
                ++AC;
                check[p] = true;
            } else {
                worng[p]++;
            }
        }
    }
    for (int i = 0; i < check.size(); i++) {
        if (check[i]) WA += worng[i];
    }
    cout << AC << " " << WA << endl;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	priority_queue<int, vector<int>, greater<int>> pq;
  	rep(i, n) {
      int p;
      cin >> p;
      pq.push(p);
    }
  	int ans = 0;
  	rep(j, k) {
      ans += pq.top();
      pq.pop();
    }
  
  	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    long a[5],i,p;
    for(i=0;i<5;i++)
    {
        cin>>a[i];
        if(a[i]==0)
            p=i+1;
    }
    cout<<p<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
 typedef struct{
   int id;
  int key;
  int leftKey;
  int rightKey;
  int parentKey;
}heap;

void insert(int, int);
void print(int, int);
heap Heap[251];
int A[251];

main(){
  int H, i;
  scanf("%d ", &H);
  for(i = 1; i <= H; i++){
    scanf(" %d", &A[i]);
  }
  for(i = 1; i <= H; i++){
    insert(i, H);
  }
  for(i = 1; i <= H; i++){
    print(i, H);
  }
  return 0;
}

void insert(int id, int H){
  Heap[id].id = id;
  Heap[id].key = A[id];
  if(id/2 > 0)    Heap[id].parentKey = A[id/2];
  if(id*2 <= H)   Heap[id].leftKey = A[id*2];
  if(id*2+1 <= H) Heap[id].rightKey = A[id*2+1]; 
}

void print(int id, int H){
   printf("node %d: key = %d, ", id, Heap[id].key);
   if(id/2 > 0)    printf("parent key = %d, ", Heap[id].parentKey);
   if(id*2 <= H)   printf("left key = %d, ", Heap[id].leftKey);
   if(id*2+1 <= H) printf("right key = %d, " , Heap[id].rightKey);
   printf("\n");
 }

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

#define MAX 1000

int top,S[1000];

void initialize();
int isEmpty();
int isFull();
void push(int x);
int pop();

int main(){
  int x,i,j;
  top=0;
  char s[1000];

  while( scanf("%s", s) != EOF ){

    if ( s[0] == '+' ){
        i=pop();
        j=pop();
        push(i+j);
    } else if ( s[0] == '-' ){
      j=pop();
      i=pop();
      push(i-j);
    } else if ( s[0] == '*' ){
      i=pop();
      j=pop();
      push(i*j);
    } else {
      x = atoi(s);
      push(x);
    }
  }
      printf("%d\n",pop());

  return 0;
}

void initialize(){
  top = 0;
}

int isEmpty(){
  if(top==0){
   return top;
 } return 0;
}

 int isFull(){
   if(top >= MAX - 1){
   return top;
 }return 0;
}

void push(int x){
   if( isFull()){
     printf("errer");
   }
   top++;
   S[top] = x;
}

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



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

typedef long long int ll;
typedef long double ld;
const ll mx=1e9+7;
#define pb push_back

#define all(n) n.begin(),n.end()

void solve()
{
int n;
cin>>n;
int cnt=0,yes=0;
while(n--)
{
	int x,y;
	cin>>x>>y;
	if(x==y)cnt++;
	else
cnt=0;
	
	if(cnt==3)yes=1;
}

(yes)? cout<<"Yes":cout<<"No";
	
}

int main()
{
	
solve();
		
	
	
}

Measured memory_bytes: 3656
#include"bits/stdc++.h"
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20)
#define ll long long
#define endl '\n'
//       Author
//        ::
//    (  NOBODY  )
//   No Copyright .....You can copy and paste it without my permission...................................
// !!!!!!!!!!!!!!!
#define pb push_back
#define N 300009
int a[N],b[N],c[N];
string s,t;
int dp[3009][3009];
int main()
{
    FAST_IO;
    cin>>s>>t;
    int n=s.size();
    int m=t.size();
    for(int i=0;i<=n;i++)
    {
      for(int j=0;j<=m;j++)
      {
         if(i==0||j==0)dp[i][j]=0;
         else if(s[i-1]==t[j-1])
         {
            dp[i][j]=dp[i-1][j-1]+1;
         }
         else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
      }
    }
    int i=n,j=m;
    string ss="";
   while(i&&j)
   {
      if(s[i-1]==t[j-1])
      {
        ss+=s[i-1];
        i--;
        j--;
      }
      else if(dp[i-1][j]>dp[i][j-1])i--;
      else j--;
   }
   reverse(ss.begin(),ss.end());
   cout<<ss;
    return 0;
}


Measured memory_bytes: 37120
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int max=-1; int kouho =0;
    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        if(max == b && kouho > a){
            kouho = a;
        }
        if(max < b){
            max = b;
            kouho = a;
        }
    }
    cout << kouho << " " << max << endl;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll a,b,x;
	cin>>a>>b>>x;
	ll ans;
	if(a) ans=b/x-(a-1)/x;
	else ans=b/x+1;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string n;
    string ans = "";
    cin >> n;
    for(int i = 0; i < n.size(); i++)
    {
        if(n[i] == '1')
        {
            ans += '9';
        }
        else
        {
            ans += '1';
        }
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    res = 0
    for i in range(N):
        a,b = MI()
        if a==b:
            res+=1
            if res==3:
                print("Yes")
                exit()
        else:
            res=0
    print("No")
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9584
def main():
    import sys
    from bisect import bisect
    from operator import itemgetter
    M=10**9
    b=sys.stdin.buffer
    n,d,a=map(int,b.readline().split())
    m=map(int,b.read().split())
    c=[0]*(n+1)
    z=sorted(zip(m,m),key=itemgetter(0))
    s=0
    for i,(x,h)in enumerate(z):
        c[i]+=c[i-1]
        h-=c[i]
        t=-h//a
        if t>0:t=0
        c[i]-=t*a
        c[bisect(z,(x+d+d,M))]+=t*a
        s-=t
    print(s)
main()

Measured memory_bytes: 55640
n, m = map(int, input().split())
# non 0 student 1 check 2
n_lis = [list(map(int, input().split())) for i in range(n)]
m_lis = [list(map(int, input().split())) for i in range(m)]
import sys

for i in n_lis:
    min_num = sys.maxsize
    ans_index = 0
    for index, j in enumerate(m_lis):
        num = abs(i[0] - j[0]) + abs(i[1] - j[1])
        if min_num > num:
            min_num = num
            ans_index = index + 1
    print(ans_index)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>

using namespace std;
int cnt=0;
void insertionSort(int A[],int n,int g){
    for(int i=g;i<n;i++){
        int v=A[i];
        int j=i-g;
        while(j>=0 && A[j]>v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
}
void shellSort(int A[],int n){
    cnt = 0;
    int m = 0;
    int G[100];
    int aG=0;
    for(int i=0;i<100;i++){
        aG=3*aG+1;
        G[i]=aG;
        if(G[i]>n){
            m=i;
            break;
        }
    }
    cout << m << endl;
    for(int i = m-1;i>=0;i--){
        if(G[i]>n)continue;
        insertionSort(A, n, G[i]);//G[i]);
        cout << G[i];
        if (i!=0){
            cout << " ";
        }
    }
    cout << endl;
}


int main(){
    int n;
    cin >> n;
    int array[1000000];
    bool flag=true;
    int count=0;
    for(int i=0;i<n;i++){
        cin >> array[i];
    }
    shellSort(array,n);
    cout <<cnt<<endl;
    for(int i=0;i<n;i++){
        cout << array[i] << endl;
/*        if(i!=n-1){
            cout << " ";
        }*/
    }
//    cout << endl;
//    cout << count << endl;
    return 0;
}


Measured memory_bytes: 6988
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int divi(int n)
{

    int cnt=0;
    for(int i=1; i<=sqrt(n); i++)
    {
        if(n%i==0)
        {
            int b=n/i;
            cnt++;
            if(b!=i)
                cnt++;

        }
    }
    return cnt;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,ans=0;
    cin>>n;
    for(int i=1; i<=n; i+=2)
    {
        if(divi(i)==8){
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3600
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	int n,k;
	cin >> n >> k;

	int start = 1;
	while(n--)
	{
		start = min(2*start , start+k);
	}
	cout << start;
	return 0;
}

Measured memory_bytes: 256
open System

let N = stdin.ReadLine() |> int
let A = stdin.ReadLine().Split(' ') |> Array.map int

let rec canDiv2 = fun v -> if v % 2 = 1 then 0 else 1 + canDiv2(v / 2)

A
|> Array.map canDiv2
|> Array.min
|> printfn "%d"


Measured memory_bytes: 12112
def main():
    n = int(input())
    n2 = n % 10
    if n2 in (2,4,5,7,9):
        print('hon')
    elif n2 in (0,1,6,8):
        print('pon')
    else:
        print('bon')

if __name__ == '__main__':
    main()


Measured memory_bytes: 9044
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

vector<int> rollingHash(const vector<int> &s, const vector<int> &key) {
    using u64 = unsigned long long;
    u64 m = mod;
    int n = s.size();
    vector<int> ret;
    u64 t = 1;
    u64 sh = 0, kh = 0;
    rep(i, n) {
        t *= m;
        sh = sh * m + s[i];
        kh = kh * m + key[i];
    }
    rep(i, n) {
        if(kh == sh) ret.push_back(i);
        sh = sh * m + s[i] - s[i] * t;
    }
    return ret;
}

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

    int n;
    cin >> n;
    vector<int> a(n), b(n), aa(n), bb(n);
    rep(i, n) {
        cin >> a[i];
        aa[i] ^= a[i];
        aa[(i + 1) % n] ^= a[i];
    }
    rep(i, n) {
        cin >> b[i];
        bb[i] ^= b[i];
        bb[(i + 1) % n] ^= b[i];
    }
    vector<int> k = rollingHash(aa, bb);
    rep(i, k.size()) cout << k[i] << " " << (a[k[i]] ^ b[0]) << endl;
}

Measured memory_bytes: 7540
def begginer(k, x):
    print(x + 100 * (10 - min(10, k)))

if __name__ == "__main__":
    import sys
    in_str = []
    for line in sys.stdin:
        in_str.append(line)
    k, x = [int(_) for _ in in_str[0].split(' ')]
    begginer(k, x)

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var imp = Console.ReadLine().Split(' ');
            int A = int.Parse(imp[0]);
            int B = int.Parse(imp[1]);
            if (B < A)
            {
                Console.Write(A - 1);
            }
            else
            {
                Console.Write(A);
            }

            System.Threading.Thread.Sleep(1000);
        }
    }
}


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

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var n = ReadLineIntSpilit();

            var score = 0;

            //10未満
            if(n[0] < 10) {
                score = (100 * (10 - n[0])) + n[1];
            }
            else {
                score = n[1];
            }

            Console.WriteLine(score);
            ReadLine();
        }

        /// <summary>
        /// コンビネーション
        /// </summary>
        /// <param name="n"></param>
        /// <param name="m"></param>
        /// <returns></returns>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin >> a >> b;
	cout << 6 - a - b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }


//n!
ll fact_mod(ll n) {
    ll ret=1; 
    for(ll i=2;i<=n;i++) ret=ret*(i%mod)%mod;
    return ret;
}
 
// 繰り返し二乗法 
ll pow_mod(ll x, ll n){
    if(n==0) return 1;
    ll ret=pow_mod((x*x) % mod, n/2);
    if(n&1) ret=(ret*x)%mod;
    return ret;
}
 
//nCr O(r) nがでかくても安心
ll combination_mod(ll n, ll r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    ll a=1;
    //a=n!/(n-r)!=n~n-r+1までの総積->O(r)
    for(ll i=0;i<r;i++) a=a*((n-i)%mod)%mod;
    //b=inv(r!)
    ll b=pow_mod(fact_mod(r), mod-2);
    return (a%mod)*(b%mod)%mod;
}
 
ll inv_mod(ll n){
    // フェルマーの小定理
    return pow_mod(n,mod-2);
}



//cut here


const int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    COMinit();
    
    vector<ll> dp(1010,0);dp[0]=1;
    ll n,a,b,c,d;cin>>n>>a>>b>>c>>d;

    //O(n^3)だけど実際はそんなにまわらないから許してや
    for(ll i=a;i<=b;i++){
        auto dp_new=dp;
        
        //i人グループをj個作る
        for(ll j=c;j<=d;j++){
            ll wake=fac[i*j];
            wake=(wake*inv_mod(  pow_mod(fac[i],j)  )  )%mod;
            wake=(wake*inv_mod(   fac[j]    ))%mod;
            if(i*j>n) break;
            rep(k,n){
                if(k+i*j>n) break;
                if(dp[k]==0) continue;
                ll kake=(wake*COM(n-k,i*j))%mod;
                dp_new[k+i*j]=(dp_new[k+i*j]+(dp[k]*kake)%mod)%mod;
            }
        }
        swap(dp,dp_new);
        // cout<<dp[n]<<endl;
        // rep(i,n+1)cout<<dp[i]<<' ';cout<<endl;
    }
    cout<<dp[n]%mod<<endl;
    return 0;
}


Measured memory_bytes: 12416
import itertools

N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

L = [i for i in range(1, N+1)]
a = 0
b = 0

#順列作成
L_list = list(itertools.permutations(L))

for i in range(len(L_list)):
  if list(L_list[i]) == P:
    a = i+1
  if list(L_list[i]) == Q:
    b = i+1

print(abs(a-b))

Measured memory_bytes: 8052
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef int int_;
#define int long long
#define maxn 200010
const int inf=1e9+7;
inline int read(){
	int ret=0,ff=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') ff=-ff;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		ret=ret*10+ch-'0';
		ch=getchar();
	}
	return ret*ff;
}

int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
int ksm(int a,int b,int p){
	int ret=1;
	while(b){
		if(b&1) ret=ret*a%p;
		a=a*a%p;
		b>>=1;
	}
	return ret%p;
}
int a[maxn],num[maxn];
int_ main(){
	memset(num,0,sizeof(num));
	int n=read();
	int ans=0;
	for(int i=1;i<=n;++i){
		a[i]=read();
		ans+=a[i];
		++num[a[i]];
	}
	
	int q=read();
	while(q--){
	//	printf("ans=%d\n",ans);
		int x=read(),y=read();
		ans+=(y-x)*num[x];
		num[y]+=num[x];
		num[x]=0;
		printf("%lld\n",ans);
	}
	return 0;
} 

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

ll Ffunc(ll C) {

    ll index = 0;
    while (C>0) {
        C /= 10;
        index++;
    }

    return index;
}

int main() {
    ll N;
    cin >> N;
    ll D = 10000000000;
    ll E;
    for (ll i = 1; i*i<=N; i++) {
        if (N%i != 0) continue;
        E = i;
    }

    cout << Ffunc(N/E) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
const int mod=1000000007;

int dp[12345][123];
string k;
int a[12345];
int l,d;
long long ans;
long long dfs(int pos,int site,bool flag){
    //cout<<"POS:"<<pos<<"   SITE:"<<site<<"   FLAG:"<<flag<<endl;
if(pos==l+1) return dp[pos][site]=(site==0);//site等于0，dp等于1
if(!flag&&dp[pos][site]!=-1) return dp[pos][site];
int len;
if(flag) len=a[pos];
else len=9;
long long sum=0;
for(int i=0;i<=len;++i){
    sum+=dfs(pos+1,(site+i)%d,flag&&i==len);
    sum%=mod;
}
if(!flag) dp[pos][site]=sum;
return sum;
}
int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>k>>d;
    l=k.size();
    for(int i=1;i<=l;i++){
        a[i]=k[i-1]-'0';
    }

    ans=(dfs(1,0,true)-1+mod)%mod;

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


Measured memory_bytes: 7040
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
char a[1010][1010];
int main()
{
	int n;cin>>n;
	if(n==2){
		puts("-1");
		return 0;
	}
	if(n==7){
		puts("aab.a..");
		puts("ccb.a..");
		puts("aaca...");
		puts("..cab..");
		puts("...cbaa");
		puts("..ac.bb");
		puts("..abbaa");
		return 0;
	} 
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	a[i][j] = '.';
	int c = 0,m = n;
	if(n%2==1){
		if(n==3){
			a[c+1][c+1] = 'a';a[c+1][c+2] = 'a';
			a[c+2][c+3] = 'a';
			a[c+3][c+3] = 'a';
			c += 3;
			m -= 3;	
		}
		else{
			a[c+1][c+1] = 'a';a[c+1][c+2] = 'a';a[c+1][c+4] = 'a';a[c+1][c+5] = 'b';
			a[c+2][c+2] = 'b';a[c+2][c+3] = 'b';a[c+2][c+4] = 'a';a[c+2][c+5] = 'b';
			a[c+3][c+1] = 'a';a[c+3][c+2] = 'a';a[c+3][c+3] = 'c';a[c+3][c+4] = 'c';a[c+3][c+5] = 'a';
			a[c+4][c+1] = 'b';a[c+4][c+3] = 'a';a[c+4][c+5] = 'a';
			a[c+5][c+1] = 'b';a[c+5][c+3] = 'a';a[c+5][c+4] = 'b';a[c+5][c+5] = 'b';
			c += 5;
			m -= 5;
		}
	}
	if(m%4==2){
		a[c+1][c+1] = 'a';a[c+1][c+2] = 'a';a[c+1][c+3] = 'c';a[c+1][c+4] = 'a';
		a[c+2][c+1] = 'b';a[c+2][c+2] = 'b';a[c+2][c+3] = 'c';a[c+2][c+4] = 'a';
		a[c+3][c+1] = 'c';a[c+3][c+2] = 'c';a[c+3][c+3] = 'a';a[c+3][c+4] = 'b';
		a[c+4][c+3] = 'a';a[c+4][c+4] = 'b';a[c+4][c+5] = 'a';a[c+4][c+6] = 'a';
		a[c+5][c+3] = 'b';a[c+5][c+4] = 'c';a[c+5][c+5] = 'b';a[c+5][c+6] = 'b';
		a[c+6][c+3] = 'b';a[c+6][c+4] = 'c';a[c+6][c+5] = 'a';a[c+6][c+6] = 'a';
		c += 6;
		m -= 6;
	}
	while(m){
		a[c+1][c+1] = 'a';a[c+1][c+2] = 'b';a[c+1][c+3] = 'a';a[c+1][c+4] = 'a';
		a[c+2][c+1] = 'a';a[c+2][c+2] = 'b';a[c+2][c+3] = 'c';a[c+2][c+4] = 'c';
		a[c+3][c+1] = 'c';a[c+3][c+2] = 'c';a[c+3][c+3] = 'b';a[c+3][c+4] = 'a';
		a[c+4][c+1] = 'a';a[c+4][c+2] = 'a';a[c+4][c+3] = 'b';a[c+4][c+4] = 'a';
		c += 4;
		m -= 4;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)
			putchar(a[i][j]);
		puts("");
	}
}


Measured memory_bytes: 2176