akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
//        int a = int.Parse(ReadLine());
//        string b = ReadLine();
        string[] c = ReadLine().Split(' ');
//        int cl = c.Length;
//        int[] d = new int[c.Length];
        int a = int.Parse(c[0]);
        int b = int.Parse(c[1]);
        int d = int.Parse(c[2]);
        string ans = "No";
        if(a==b && a!=d){ ans = "Yes";}
        if(a==d && a!=b){ ans = "Yes";}
        if(d==b && a!=d){ ans = "Yes";}
        WriteLine(ans);
        
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> void read(T &x){
	int f=0; x=0; char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) f|=(ch=='-');
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	if(f) x=-x;
}

const int N=1000005;
int pa[N],q[N][2],n,m,a,b,r,cnt;
set<int> s[N],t[N];

int gp(int x){
	return pa[x]==x?x:pa[x]=gp(pa[x]);
}

void nw1(int a,int b){
	a=gp(a),b=gp(b);
//	cout<<"nw1 "<<a<<" "<<b<<endl;
	if(t[a].find(b)!=t[a].end()){
		q[++r][0]=a,q[r][1]=b;
	}
}
void nw2(int a,int b){
	a=gp(a),b=gp(b);
//	cout<<"nw2 "<<a<<" "<<b<<endl;
	if(s[a].find(b)!=s[a].end()){
		q[++r][0]=a,q[r][1]=b;
	}
}

int main(){
	read(n);
	rep(i,1,n) pa[i]=i;
	rep(i,1,n-1){
		read(a),read(b);
		s[a].insert(b);
		s[b].insert(a);
	}
	rep(i,1,n-1){
		read(a),read(b);
		t[a].insert(b);
		t[b].insert(a);
		nw2(a,b);
	}
	for(int l=1;l<=r;l++){
		int x=gp(q[l][0]),y=gp(q[l][1]);
		if(x==y) continue; else cnt++;
//		cout<<x<<" "<<y<<endl;
		s[x].erase(y),s[y].erase(x);
		t[x].erase(y),t[y].erase(x);
		if(s[x].size()+t[x].size()
		  <s[y].size()+t[y].size()) swap(x,y);
		pa[y]=x;
		for(auto u:s[y]){
			int v=gp(u);
			s[x].insert(v);
			s[v].erase(y);
			s[v].insert(x);
			nw1(x,v);
		}
		s[y].clear();
		for(auto u:t[y]){
			int v=gp(u);
			t[x].insert(v);
			t[v].erase(y);
			t[v].insert(x);
			nw2(x,v);
		}
		t[y].clear();
	}
	puts(cnt==n-1?"YES":"NO");
	return 0;
}

Measured memory_bytes: 117248
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,tota,totb,s[101],t[101],c,L,ok;
int main(void){
    while(1){
        cin>>a>>b;
        if(a==0&&b==0){
            return 0;
        }
        ok=0;
        for(int i=1;i<=100;i++){
            s[i]=0;
            t[i]=0;
        }
        tota=0,totb=0;
        for(int i=0;i<a;i++){
            cin>>c;
            tota+=c;
            s[c]=1;
        }
        for(int i=0;i<b;i++){
            cin>>c;
            totb+=c;
            t[c]=1;
        }
        if(abs(tota-totb)%2==1){
            cout<<-1<<endl;
            continue;
        }
        
        if(tota>=totb){
            L=(tota-totb)/2;
            for(int i=1;i+L<=100;i++){
                if(t[i]==1&&s[i+L]==1){
                    cout<<i+L<<" "<<i<<endl;
                    ok=1;
                    break;
                }
            }
        }
        
        else if(tota<totb){
            L=(totb-tota)/2;
            //cout<<L<<endl;
            for(int i=1;i+L<=100;i++){
                //cout<<s[i]<<i<<" "<<t[i+L]<<i+L<<endl;
                if(s[i]==1&&t[i+L]==1){
                    cout<<i<<" "<<i+L<<endl;
                    ok=1;
                    break;
                }
            }
        }
        if(ok==0){
            cout<<-1<<endl;
        }
    }
    
}



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

int main(){
  ll s,co,ans,co2;
  ll a[3];
  co=1000000007;
  co2=co*2;
  cin >> s;
  if(s>=2){
    a[0]=1;
    a[1]=1;
    a[2]=1;
    for(int i=1;i<=s;i++){
      a[0]=a[0]*10%co2;
      a[1]=a[1]*9%co;
      a[2]=a[2]*8%co2;
    }
    ans=a[0]+a[2]-2*a[1];
    ans=ans%co;
  }
  else{
    ans=0;
  }
  cout << ans;
}

Measured memory_bytes: 3632
n=int(input())
a=[0]*n
a=list(map(int,input().split()))
flag=0
for i in range(n):
  if (a[i]%2==0 and a[i]%3!=0 and a[i]%5!=0):
    flag=1
print("APPROVED" if (flag==0) else "DENIED")

Measured memory_bytes: 3060
#include <stdio.h>
#include <float.h>

typedef struct{
  int n;
  double t;
}PLAYER;

void swap(PLAYER *a, PLAYER *b){ PLAYER t; t = *a; *a = *b; *b = t;}

int main(){
  int i, j, k, min;
  PLAYER p[32];
  for(i = 0; i < 24; ++i) scanf("%d%lf", &p[i].n, &p[i].t);

  for(i = 0; i < 3; ++i){
    for(j = 0; j < 8; ++j){
      min = j + i * 8;
      for(k = j + 1; k < 8; ++k) 
	if(p[min].t > p[k + i * 8].t)  min = k + i * 8;
      if(min != j + i * 8) 
	swap(&p[min], &p[j + i * 8]);
    }
  }

  for(i = 0; i < 3; ++i) 
    for(j = 0; j < 2; ++j){
      printf("%d %.2f\n", p[j + i * 8].n, p[j + i * 8].t);
      p[j + i * 8].t = DBL_MAX;
    }
  for(i = 0; i < 24; ++i){
    min = i;
    for(j = i + 1; j < 24; ++j)
      if(p[min].t > p[j].t) min = j;
    if(min != i)
      swap(&p[min], &p[i]);
  }
  for(i = 0; i < 2; ++i) 
    printf("%d %.2f\n", p[i].n, p[i].t);
  return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<(a*b)/2<<endl;
    return 0;
    }


Measured memory_bytes: 256
from heapq import heappush, heappop
from collections import deque
import itertools
from itertools import permutations
import sys
import bisect
sys.setrecursionlimit(10**6)
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
YNeos='YNeos'
GYN=['Yes','trumpet']
mo=10**9+7
imp='IMPOSSIBLE'

n=I()
a=LI()[::-1]

for i in range(n-1):
    if a[i]<a[i+1]:
        a[i+1]-=1
    if a[i]<a[i+1]:
        print('No')
        exit()
print('Yes')

    
        


Measured memory_bytes: 63984
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int cum = 0;
  int x   = 100;
  for (int i = 0; i < n; i++) {
    int m1;
    cin >> m1;
    cum += m1;
    if (m1 % 10 != 0) {
      x = std::min(x, m1);
    }
  }
  if (cum % 10 == 0) {
    if (x % 10 == 0) {
      cum = 0;
    } else {
      cum -= x;
    }
  }
  cout << cum << endl;

  return 0;
}


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

using namespace std;

int main(){

    long long n,i,max=100000,r;
    long long t[max],x[max],y[max];

    cin >> n;

    for(i=1;i<=n;i++){
        cin >> t[i] >> x[i] >> y[i];
    }

    for(i=1;i<=n;i++){
        r=t[i]-x[i]-y[i];
        if((r%2 != 0) || (r<0)){
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";

    return 0;
}

Measured memory_bytes: 2560
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

int a[3] = {};
int b[3] = {};
int c[3][3] = {};

bool check() {
  REP(i, 3) {
    REP(j, 3) {
      if (c[i][j] != a[i] + b[j]) {
        return false;
      }
    }
  }
  return true;
}

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

  REP(i, 3) {
    REP(j, 3) {
      cin >> c[i][j];
    }
  }
  REP(a1, 101) {
    a[0] = a1;
    b[0] = c[0][0] - a[0];
    b[1] = c[0][1] - a[0];
    b[2] = c[0][2] - a[0];
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];

    if (check()) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.lang.*;
public class Main {
	
		
		public static void main(String[] args) throws IOException {
			java.util.Scanner scan = new java.util.Scanner(System.in);
		int x = scan.nextInt();
			
//			BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
//			String str = br.readLine();
//			int x = Integer.parseInt(str);
//			
		
		System.out.println(x*x*x);// TODO ?????????????????????????????????????????????
		
		}	
			
		
	
	}
	

Measured memory_bytes: 26140
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long int n;
	cin >> n;
	long long int a[n], ans[2][n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	for (int i = 1; i <= n - 2; i++) {
		if (a[i] <= 0) {
			ans[0][i] = a[n - 1];
			ans[1][i] = a[i];
			a[n - 1] -= a[i];
		}
		else {
			ans[0][i] = a[0];
			ans[1][i] = a[i];
			a[0] -= a[i];
		}
	}
	ans[0][n - 1] = a[n - 1];
	ans[1][n - 1] = a[0];
	cout << a[n - 1] - a[0] << '\n';
	for (int i = 1; i <= n - 1; i++)
		cout << ans[0][i] << ' ' << ans[1][i] << '\n';
	return 0;
}

Measured memory_bytes: 4224
n=int(input())
d=list(map(int, input().split()))
m=int(input())
t=list(map(int, input().split()))

d.sort()
t.sort()

count=0

for i in range(n):
    if d[i]==t[count]:
        count+=1
    elif d[i]<t[count]:
        pass
    else:
        print('NO')
        exit()
    
    if count==m:
        print('YES')
        exit()

Measured memory_bytes: 34476
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        new Main().q1();
    }
    
    
    public void q1() {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String ret = "";
        for (int i = 0; i < a.length(); i++) {
            ret += a.charAt(i);
            if(i < b.length()) {
                ret += b.charAt(i);
            }
            
        }
        System.out.println(ret);
        
        
    }
    
    
}



Measured memory_bytes: 21716
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void reverse(long[] a) {
		int i = 0, j = a.length-1;
		long temp;
		while (i < j) {
			temp = a[i];
			a[i] = a[j];
			a[j] = temp;
			i++; j--;
		}
	}
	
	void run() {
		int n = sc.nextInt();
		long[] h = new long[n];
		for (int i = 0; i < n; i++)
			h[i] = sc.nextLong();
		Arrays.sort(h);
		reverse(h);
		
		int count = -1;
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (i % 4 == 0) count++;
			ans += h[i] - min(h[i], count);
		}
		
		out.println(ans+1);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 20840
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
    int a,b,c;
    int sum;
    cin>>sum;
    a = sum%10; //得到个位数
    sum = sum/10;
    b = sum%10; //得到十位数
    c = sum/10; //得到百位数
    if(c==a)
    {
    	cout<<"Yes"<<endl;
    }
    else
    {
    	cout<<"No"<<endl;
	}
	return 0;
}

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

typedef long long i64;

using namespace std;

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

   int ans = -1;
   int m = -1;

   for(int i=1;i<s.size();i++){
       int count = 0;
       set<char> sub_s;
       for(int j=0;j<i;j++){
           char c = s[j];
           sub_s.insert(c);
       }
       for(auto c = sub_s.begin(); c != sub_s.end();c++){
           for(int k=i;k<s.size();k++){
               if(*c == s[k]){
                   count++;
                   break;
               }
           }
       }
       if(m < count){
           m = count;
           ans = count;
       }
   }

   cout<<ans<<endl;
}

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

#define ARC(i, a, b) for(int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)

template<typename T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<typename T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<typename T> T anti(const T &a, const T &b){ return a == -1 || b == -1 ? -1 : ant(a, b); }
template<typename T> T onti(const T &a, const T &b){ return a == -1 ? b : b == -1 ? a : ont(a, b); }
template<typename T> T rng(const T &a, const T &b){ return a > b ? a - b : b - a; }
template<typename T> T &anth(T &a, const T &b){ return a = ant(a, b); }
template<typename T> T &onth(T &a, const T &b){ return a = ont(a, b); }

template<typename T> T make_v(T val){ return val; }
template<typename... Ts> auto make_v(size_t n, Ts... ts){ return std::vector<decltype(make_v(ts...))>(n, make_v(ts...)); }

using ull = unsigned long long;


int main(){
	ull n;
	scanf("%llu", &n);
	ull ans = 0;
	RC(i, 5){
		ull a;
		scanf("%llu", &a);
		anth(ans, (n - 1) / a + 5);
	}
	printf("%llu\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+2;
int a[N],b[N],c[N];
bool cmp(int i,int j){
	return i>j;
}
int main(){
	int x,y,na,nb,nc;
	cin>>x>>y>>na>>nb>>nc;
	for (int i=1;i<=na;i++)cin>>a[i];
	for (int i=1;i<=nb;i++)cin>>b[i];
	for (int i=1;i<=nc;i++)cin>>c[i];
	sort(a+1,a+1+na,cmp);
	sort(b+1,b+1+nb,cmp);
	sort(c+1,c+1+nc,cmp);
	int p=x,q=y;
	for (int i=1;i<=nc;i++){
		if (p==0 and q==0)break;
		if (p==0){
			if (c[i]>b[q])b[q]=c[i],q--;
			else break;
			continue;
		}
		if (q==0){
			if (c[i]>a[p])a[p]=c[i],p--;
			else break;
			continue;
		}
		if (c[i]<a[p] and c[i]<b[q])break;
		int sub1=c[i]-a[p];
		int sub2=c[i]-b[q];
		if (sub1>sub2){
			a[p]=c[i];
			p--;
		}else{
			b[q]=c[i];
			q--;
		}
	}
	long long sum=0;
	for (int i=1;i<=x;i++)sum+=a[i];
	for (int i=1;i<=y;i++)sum+=b[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1408
N=int(input())
Aseq=input()
Alist=Aseq.split()
A=[]
for i in range(N):
    A.append(int(Alist[i]))
a=[]
for i in range(N):
    ai=0
    while A[i]%2==0:
        ai+=1
        A[i]=A[i]/2
    a.append(ai)
b=min(a)
print(b)

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

using namespace std;

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

// 45106 - 111


void oneCase() {
   string s, t;
   cin >> s >> t;
   if (s.size() < t.size()) {
       cout << "UNRESTORABLE" << "\n";
       return;
   }
   vector<string> ans;
   for (int i = 0; i <= s.size() - t.size(); ++i) {
       string f(i, '?');
       string e(s.size() - t.size() - i, '?');
       auto cnd = f + t + e;
       int ok = 1;
       for (int j = 0; j < s.size(); ++j) {
           if (s[j] == '?' && cnd[j] == '?') {
               cnd[j] = 'a';
               continue;
           }
           if (s[j] != '?' && cnd[j] != '?' && s[j] != cnd[j]) {
               ok = 0;
               break;
           }
           if (s[j] != '?' && cnd[j] == '?' ) {
               cnd[j] = s[j];
           }
       }
       if (ok) {
           ans.pb(cnd);
       }
   }
   if (!ans.empty()) {
       sort(ans.begin(), ans.end());
       cout << ans.front() << "\n";
       return;
   }


   cout << "UNRESTORABLE" << "\n";
}


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

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
    int x; cin>>x;
    int a[1001]={};
    a[1]=1;
    FOR(b,2,40){
        int bp=b*b;
        while(bp<=1000){
            a[bp]=1;
            bp*=b;
        }
    }
    while(!a[x]) x--;
    co(x);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool f[10][10];
int a[10][10],n,b;
int main()
{
    for(int i=1;i<=3;++i)
        for(int j=1;j<=3;++j)
            scanf("%d",&a[i][j]);
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        scanf("%d",&b);
        for(int i=1;i<=3;++i)
            for(int j=1;j<=3;++j)
                if(a[i][j]==b) f[i][j]=1;
    }
    for(int i=1;i<=3;++i){
        bool ff=0;
        for(int j=1;j<=3;++j){
            if(f[i][j]==0) ff=1;
        }
        if(ff==1) continue;
        printf("Yes");
        return 0;
    }
    for(int j=1;j<=3;++j){
        bool ff=0;
        for(int i=1;i<=3;++i){
            if(f[i][j]==0) ff=1;
        }
        if(ff==1) continue;
        printf("Yes");
        return 0;
    }
    if(f[1][1]==1 && f[2][2]==1 && f[3][3]==1){
        printf("Yes");
        return 0;
    }
    if(f[3][1]==1 && f[2][2]==1 && f[3][1]==1){
        printf("Yes");
        return 0;
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)


















int main(){
    string s;
    cin >> s;
    vector<ll> cnt(2019);
    ll n = s.size();
    ll ans = 0, r = 0, k = 1;
    for(ll i = n - 1; i >= 0; i--){
        r += (s[i] - '0') * k;
        r %= 2019;
        k *= 10;
        k %= 2019;
        ans += cnt[r]++ + (r == 0);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3756
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] h = sc.nextIntArray(n);
    Arrays.sort(h);
    int min = Integer.MAX_VALUE;
    for (int i = 0; i + k - 1 < n; i++) {
      min = Math.min(min, h[i + k - 1] - h[i]);
    }
    System.out.println(min);
  }
}

Measured memory_bytes: 37304
#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define pf1(n)     printf("%lld\n",n);
#define mem(a,b)   memset(a,b,sizeof(a))
#define en         cout<<endl;
#define pb         push_back
#define gcd(n,m)   __gcd(n,m)
#define lcm(n,m)   ((n)/__gcd(n,m))*(m)
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(a,b)     for(ll i=a;i<b;i++)
#define all(x)     (x).begin(),(x).end()
#define allr(x)    (x).rbegin(),(x).rend()
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long
#define PI         2*acos(0.0)
int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,c,res,c1,x,y,w,z,c2;
    ci>>n;
    for(ll i=1000;;i+=1000)
    {
      if(i>=n)
      {
        co<<i-n;
        br
      }
    }
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
int main(){
    int A,B;
    cin >> A >> B;
    if((A+B)>=10){cout << "error" << endl;}else{cout << A+B << endl;}
 return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

s=input()
K=int(input())

d=defaultdict(list)
for i, si in enumerate(s):
    d[si].append(i)

sub=set()
for i in range(26):
    for j in d[chr(ord('a')+i)]:
        for k in range(min(K,len(s[j:]))):
            sub.add(s[j:j+k+1])
#            print(s[j:j+k+1])
#    print(len(sub), k)    
    if len(sub)>=K:
        sub=sorted(list(sub))
        print(sub[K-1])
        break


Measured memory_bytes: 3564
n,m = map(int,input().split())
ab = []
for _ in range(n):
  ab.append(list(map(int,input().split())))
ab.sort()
ans = 0
for i in range(n):
  a,b = ab[i]
  if m > b:
    m -= b
    ans += a * b
  else:
    ans += a * m
    break
  #print(m,ans)
print(ans)

Measured memory_bytes: 27760
import math as m
def solve(s):



    
    hours = m.floor(s/3600)
    mod_hour = s%3600
    minutes = m.floor(mod_hour/60)
    seconds = mod_hour%60
    answer_format = "{0}:{1}:{2}".format(hours,minutes,seconds)
    print(answer_format)


def answer():
    s = int(input())
    solve(s)

if __name__ == '__main__':
    answer()


Measured memory_bytes: 5660
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

int main(){
    string s; cin >> s;
    ll cnt = 0;
    REP(i, s.size()) if(s[i] == 'o') cnt++;
    ll rem = 15-s.size();
    cout << (cnt+rem >= 8 ? "YES" : "NO") << endl;
    return 0;
}


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


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int prev = 0;
    rep(i, n) {
        if(a[i] == prev && i > 0) {
            cout << "NO" << endl;
            return 0;
        }
        prev = a[i];
    }
    cout << "YES" << endl;
   return 0;
}


Measured memory_bytes: 1024
//#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

int main(){
  int N;
  scanf("%d", &N);
  long long ans = 0;
  for (int i=1; i<=N; i++){
    if (i%3!=0 && i%5!=0){
      ans += i;
    }
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int r,g;
	cin >> r >> g;
	int x = 2*g - r;
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
Q, H, S, D = map(int, input().split())
N = int(input())

X = min(4 * Q, 2 * Q + H, 2 * H, S)

if X * 2 < D:
    ans = N * X
else:
    if N % 2 == 0:
        ans = N // 2 * D
    else:
        ans = N // 2 * D + X
print(ans)


Measured memory_bytes: 2940
n = int(input())
s = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
ans = []
for i in range(n-1):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
      ans = [s[i]]
  else:
    count = 1
    if max_count == 1:
      ans.append(s[i])
if max_count == 1:
  ans.append(s[n-1])
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i]) 

Measured memory_bytes: 21548
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1);
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
#define ll long long
#define inf int(1e9+7)
#define pb push_back
#define mp make_pair
string s;
int main()
{
	cin>>s;
	int n=s.length();
	set<char>have(s.begin(),s.end());
	if(n==26)
		if(s=="zyxwvutsrqponmlkjihgfedcba")
			puts("-1");
		else
		{
			while(1)
			{
				have.erase(s[n-1]);
				s.erase(n-1);
				n--;
				for(char c=s[n-1]+1;c<='z';c++)
					if(!have.count(c))
					{
						s[n-1]=c;
						cout<<s;
						return 0;
					}
			}
		}
	else
	{
		set<char>have(s.begin(),s.end());
		char c;
		for(c='a';have.count(c);c++)
			;
		s+=c;
		cout<<s;
	}
	return 0;
}

Measured memory_bytes: 256
'use strict'
const main = arg => {
	const input = arg.trim().split("\n");
	let x = Number(input[0].split(' ')[0])
	if(x % 11 > 6) {
		console.log(Math.floor(x / 11) * 2 + 2)
	} else if(x % 11 > 0) {
		console.log(Math.floor(x / 11) * 2 + 1)
	} else {
		console.log(Math.floor(x / 11) * 2)
	}
}   
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;
#define all(a)a.begin(),a.end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<int>;
using P = pair<int,int>;

int main()
{
    string s;
    cin >>s;
    set<char> k;
    int n=s.size();
    rep(i,n)k.insert(s[i]);
    if(k.size()==n)puts("yes");
    else puts("no");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define L "\n"
#define S " "
#define ll long long
#define pb push_back
#define mp make_pair
#define vi std::vector<int>
#define si std::set<int>
#define vl std::vector<long long>
#define qi std::queue<int>
#define de(a) cout << #a << "  ------>  " << a << "\n"
#define SIZE 100002
#define INF INT_MAX
#define FOR(i, n) for (i = 1; i <= n; i++)
#define FASTIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;
int dp[SIZE], N, h[SIZE], K;
bool flag[SIZE];

int findcost(int i)
{
    int cost, mincost = INT_MAX;
    if (i == N)
        return 0;
    for (int j = 1; j <= K && ( i + j <= N ) ; j++)
    {
        if (flag[i + j])
            cost = abs(h[i] - h[i + j]) + dp[i + j];
        else
            cost = abs(h[i] - h[i + j]) + findcost(i + j);
        mincost = min(mincost, cost);
    }
    flag[i] = 1;
    return dp[i] = mincost;
}

void solve()
{
    int i;
    cin >> N >> K;
    FOR(i, N)
    cin >> h[i];
    int cost = findcost(1);
    cout << cost << L;
}
int main()
{
    FASTIO;
    // #ifndef ONLINE_JUDGE
    //     freopen("in.txt", "r", stdin);
    // #endif
    int t;
    // cin >> t;
    // while (t--)
    solve();
    return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define inf 100000000
#define _GLIBCXX_DEBUG
typedef vector<int> VI;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<int,int> PII;
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; }
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

int main(){
    VI S;
    int a,n;
    cin >>n;
    rep(i,n){
        cin>>a;
        S.pb(a);
    }
    int p,count=0;
    VI T;
    cin >>p;
    rep(i,p){
        cin>>a;
        int *ptr;
        if (*lower_bound(S.begin(),S.end(),a)==a){
            count+=1;
        }
        
    }
    cout<<count<<endl;
}


Measured memory_bytes: 3436
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int k = sc.nextInt();
	String s = sc.next();
    String x = "";

    if (s.length() <= k) {
      x = s;
    } else {
      x = s.substring(0,k);
      x = x + "...";
    }

    System.out.println(x);
  }
}


Measured memory_bytes: 26976
import sys
def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    P = list(map(lambda x:int(x)-1, input().split()))
    
    uf = UnionFindTree(N)
    for _ in range(M):
        x,y = map(int, input().split())
        uf.union(x-1,y-1)

    ind = [-1] * N
    for i in range(N):
        ind[P[i]] = i

    ans = 0
    for i in range(N):
        if P[i] == i: ans += 1
        elif uf.same(i, ind[i]): ans += 1
    print(ans)

class UnionFindTree:
    def __init__(self, n):
        self.parent = [-1] * n

    def find(self, x):
        p = self.parent
        while p[x] >= 0: x, p[x] = p[x], p[p[x]]
        return x

    def union(self, x, y):
        x, y, p = self.find(x), self.find(y), self.parent
        if x == y: return
        if p[x] > p[y]: x, y = y, x
        p[x], p[y] = p[x] + p[y], x

    def same(self, x, y): return self.find(x) == self.find(y)
    def size(self, x): return -self.parent[self.find(x)]


if __name__ == '__main__':
    main()

Measured memory_bytes: 13876
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

int main(){
  int n,k;
  cin >> n >> k;
  int cnt = 0;
  rep(i,n){
    int h; cin >> h;
    if(h >= k)cnt++;
  }
  
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<ll>
#define pi pair<ll,ll>
#define vp vector<pi>
#define mp map<ll,ll>
#define pb push_back
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll n,e;
vector<bool> visited;
vector<int> ans;

void dfs(int v,vector<ll> adj[]) {
    visited[v] = true;
    for (int u : adj[v]) {
        if (!visited[u])
            dfs(u, adj);
    }
    ans.push_back(v);
}

void topological_sort(vector<ll> adj[]) {
    visited.assign(n, false);
    ans.clear();
    for (int i = 1; i <=n; ++i) {
        if (!visited[i])
            dfs(i,adj);
    }
    reverse(ans.begin(), ans.end());
}
 
int32_t main(){
    fast;
    cin>>n>>e;
    ll x,y;
    vector<ll> adj[n+1];
    for(ll i=0;i<e;i++)
    {
        cin>>x>>y;
        adj[x].pb(y);
    }
    
    topological_sort(adj);
    vector<ll> dp(n+1,0);
    for(ll i=0;i<n;i++)
    {
        //cout<<ans[i]<<" "; 
        for(auto j:adj[ans[i]])
        dp[j]=max(dp[j],1+dp[ans[i]]);
     //cout<<ans[i]<<" ";
        
    }
    
    cout<<*max_element(dp.begin(),dp.end());
    return 0;
    
}

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


const int L = 1e5+1;
int a[L], b[L], c[L], d[L];
int setu[L], num[L], res[L];


int findSet(int x) {
    if (x == setu[x]) return x;
    else return setu[x] = findSet(setu[x]);
}


void unionSet(int x, int y) {
    int fx = findSet(x);
    int fy = findSet(y);
    if (fx != fy) {
        num[fy] += num[fx];
        setu[fx] = fy;
    }
}


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

    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) {
        setu[i] = i;
        num[i] = 1;
    }
    for (int i = 1; i <= m; i++) {
        cin >> a[i] >> b[i];
        unionSet(a[i], b[i]);
    }
    for (int i = 1; i <= k; i++) cin >> c[i] >> d[i];
    for (int i = 1; i <= n; i++) res[i] = num[findSet(i)] - 1;
    for (int i = 1; i <= m; i++) {
        if (findSet(a[i]) == findSet(b[i])) {
            res[a[i]]--;
            res[b[i]]--;
        }
    }
    for (int i = 1; i <= k; i++) {
        if (findSet(c[i]) == findSet(d[i])) {
            res[c[i]]--;
            res[d[i]]--;
        }
    }
    for (int i = 1; i <= n; i++) cout << res[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

int color[10010];
int N;
int ans;

int solve(int x, int cc){
  if(color[x] == cc) return N;
  int cnt = 1;
  int back, forward;
  
  for(back = x-1 ; back >= 0 ; back--){
    if(cc == color[back]) cnt++;
    else break;
  }
  for(forward = x+1 ; forward < N ; forward++){
    if(cc == color[forward]) cnt++;
    else break;
  }
  
  int res = N-cnt;
  
  if(cnt < 4) return N;
  else if(back < 0 || N <= forward) return res;
  else if(color[back] != color[forward]) return res;
  
    while(1){
      int tmp = 0;
      cc = color[back];
      for( ; back >= 0 ; back--){
	if(cc == color[back]) tmp++;
	else break;
      }
      for( ; forward < N ; forward++){
	if(cc == color[forward]) tmp++;
	else break;
      }
      if(tmp < 4) return res;
      else if(back < 0 || N <= forward) return res-tmp;
      else if(color[back] != color[forward]) return res-tmp;
    
      res -= tmp;
    }
    return res;
}


int main(){
  while(cin >> N, N){
    for(int i = 0 ; i < N ; i++) cin >> color[i];
    int ans = 10010;
    for(int i = 0 ; i < N ; i++){
      for(int c  = 1 ; c <= 3 ; c++){
	ans = min(ans, solve(i, c));   
      }
    }
    cout << ans << endl;
  }
  return 0;
}


    

Measured memory_bytes: 1200
import sys
sys.setrecursionlimit(10 ** 5)


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def cal(r, k, K, V):
    l = k - r
    if l == 0:
        A = V[:r]
    elif r == 0:
        A = V[-l:]
    else:
        A = V[:r] + V[-l:]
    A.sort()
    for i, a in enumerate(A):
        if i < min(k, K-k) and a < 0:
            A[i] = 0
        else:
            break
    return sum(A)


def main():
    N, K = LI()
    V = LI()
    ans = 0
    for k in range(1, min(N, K)+1):
        for l in range(k+1):
            ans = max(ans, cal(l, k, K, V))
    print(ans)
    return


main()


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int intInput1 = scan.nextInt();
		int intInput2 = scan.nextInt();
		int intInput3 = scan.nextInt();
		int intSub = 0;
		if(intInput1 > intInput2){
			intSub = intInput1;
			intInput1 = intInput2;
			intInput2 = intSub;
			if(intInput2 > intInput3){
				intSub = intInput2;
				intInput2 = intInput3;
				intInput3 = intSub;
			}
		}else if(intInput2 > intInput3){
			intSub = intInput2;
			intInput2 = intInput3;
			intInput3 = intSub;
		}
		if(intInput1 > intInput2){
			intSub = intInput1;
			intInput1 = intInput2;
			intInput2 = intSub;
			if(intInput2 > intInput3){
				intSub = intInput2;
				intInput2 = intInput3;
				intInput3 =intInput2;
			}
		}
		System.out.println(intInput1 + " " + intInput2 + " " + intInput3);
	}
}

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

int main(){
  int n;
  cin >>n;
  int ghyaku = n/500;
  int amari = n%500;
  int g = amari/5;
  cout << 1000*ghyaku + 5*g << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        ArrayList<Character> s = new ArrayList<>();
        for(int i = 0; i < n; i++){
            char c = scan.next().charAt(0);
            if(!s.contains(c)) s.add(c);
        }
        System.out.println(s.size() == 3 ? "Three" : "Four");
        scan.close();
    }

    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 35724
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  map<string,int>ma;
  int maxx=0;
  cin >> n;
  vector<string>s(n);
  rep(i,n) cin >> s.at(i);
  cin >> m;
  vector<string>t(m);
  rep(i,m) cin >> t.at(i);
  rep(i,n){
    ma[s.at(i)]++;
  }
  rep(i,m){
    ma[t.at(i)]--;
  }
  for(auto p:ma){
    if(p.second >=1){
      maxx = max(maxx , p.second);
    }
  }
  cout << maxx << endl;
}

Measured memory_bytes: 256
n, a, b = map(int, input().split())
mod = 10**9+7

_sum = pow(2, n, mod)-1
x = 1
y = 1

for i in range(1, b+1):
  x = x*(n-i+1)%mod
  y = y*i%mod
  if i==a or i==b:
    _sum -= x*pow(y, mod-2, mod)

print(_sum%mod)



Measured memory_bytes: 3060
#
# File    : A.rb
# Author  : Kazune Takahashi
# Created : 2/9/2019, 8:50:44 PM
# Powered by Visual Studio Code
#

n, k = gets.chomp.split(" ").map{|i| i.to_i}
ary = []
for i in 1..n
  if ary.empty? || i - ary[-1] > 1
    ary << i
  end
end
if ary.size >= k
  puts "YES"
else
  puts "NO"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    }    
  int main(){
    lint n,m;
    string s,t;
    cin>>n>>m>>s>>t;
    bool isp=true;
    lint x=lcm(n,m);
    lint f=0,g=0;
        while(1){
            if(f>s.size()-1)break;
             if(g>t.size()-1)break;
            if(s[f]!=t[g])isp=false;
            //cout<<s[f]<<s[g]<<endl;
            f+=x/m;
            g+=x/n;
            
        }
    if(isp)cout<<x;
    else cout<<-1;
  }
  
     
  

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,N) for (int i =0; i < (N); ++1)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
//ll gcd(ll x, ll y,){return y ? gcd(y,x % y) : x; }

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


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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        bool debugFlg = false;
        if (debugFlg)
        {
            var exStdIn = new System.IO.StreamReader("stdin.txt");
            System.Console.SetIn(exStdIn);
        }
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    void calc()
    {
        int[] s = cin.ArrayInt(2);
        int A = s[0]; // Aまで入れられる
        int B = s[1]; // B入ってる
        int l = A - B; //残り
        int t = A + B;
int k = A * B;




        int ans = Math.Max(l , Math.Max(k , t));
        Console.WriteLine($"{ans}");
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13268
S = list(input())
r_count = 0
l_count = 0
ans = [0] * len(S)

ini_idx = 0
flag = 'R'
for idx, s in enumerate(S):
  if flag=='R' and s=='R':
    r_count += 1
  elif flag=='R' and s=='L':
    flag = 'L'
    l_count += 1
  elif flag=='L' and s=='L':
    l_count += 1
  if (flag=='L' and s=='R') or idx==(len(S)-1):
    flag = 'R'
    # ans process
    if (r_count+l_count)%2==0: # even
      ans_cont = (r_count+l_count)//2
      ans[ini_idx+r_count-1], ans[ini_idx+r_count] = ans_cont, ans_cont
    else: # odd
      small = (r_count+l_count)//2
      large = small+1
      if r_count > l_count:
        if (r_count-1)%2==0:
#          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = r_count, l_count
          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = large, small
        else:
#          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = l_count, r_count
          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = small, large
      else:
        if (l_count-1)%2==0:
#          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = r_count, l_count
          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = small, large
        else:
#          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = l_count, r_count
          ans[ini_idx+r_count-1], ans[ini_idx+r_count] = large, small
          
    ini_idx += (r_count+l_count)
    r_count, l_count = 1, 0

print(' '.join(list(map(str,ans))))

Measured memory_bytes: 11180
s = list(map(int, input().split('/')))

if s[0] < 2019:
    print('Heisei')
elif s[0] > 2019:
    print('TBD')
elif s[1] < 4:
    print('Heisei')
elif s[1] > 4:
    print('TBD')
elif s[2] <= 30:
    print('Heisei')
else:
    print('TBD')

Measured memory_bytes: 3060
#include <cstdio>
#include <cmath>
using namespace std;
int a,b,i=1;
int main(){
	scanf("%d%d",&a,&b);
	while(1){
		if(i>10000){
			printf("-1\n");
			return 0;
		}
		if(floor(i*0.08)==a&&floor(i*0.1)==b){
			printf("%d\n",i);
			return 0;
		}
		++i;
	}
}


Measured memory_bytes: 128
N, M = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
    A.append(input())
for _ in range(M):
    B.append(input())

# print(A)
# print(B)

# i = 行、j = 列
for i in range(N - M + 1):
    for j in range(N - M + 1):
        # print(i, j)
        A_part = []
        for k in range(i, i + M):
            A_part.append(A[k][j:j + M])
        # print(A_part)
        if A_part == B:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 8992