akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;

int main() {
	int n;
	string s;
	cin >> n;
	cin >> s;
	string t(s,0,n/2);
	if (n%2!=0) {
		cout << "No" << endl;
	}
	else if (s==t+t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
}

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



using namespace std;

const double EPS = 1e-10;
const long long MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}



int main() {


   ios::sync_with_stdio(false);

    string S;

    cin >> S;

    int ans = 0;
    if (S.length() == 1) {
        cout << 1 << endl;
        return 0;
    }


      int flag = 0;
      for (int i = 0; i < S.length()-1; i++) {
          ans++;
          if (S[i] == S[i+1]) {
              if (flag) {
                  flag = 0;
              } else {
                  if (i == S.length()-2) ans--;
                  flag = 1;
                  i++;
              }
              continue;
          }
          flag = 0;
      }
      cout << ans + 1 << endl;


      return 0;
  }


Measured memory_bytes: 720
#include <iostream>
using namespace std;
int main(void){
#define MAX 10100
    int n; //生徒数
    int pm[MAX], pe[MAX], pj[MAX];
    //数学の点数、英語の点数、国語の点数

    while(true){
        cin >> n;
        if(n == 0) break;

        for(int i = 0; i < n; i++){
            cin >> pm[i] >> pe[i] >> pj[i];
        }
        
        int mean_me[MAX]; //数学と英語の平均点
        int c[MAX]; //配属されるクラス

        for(int i = 0; i < n; i++){
            if(pm[i] == 100 || pe[i] == 100 || pj[i] == 100) 
                c[i] = 1;

            else if((pm[i] + pe[i]) / 2 >= 90)
                c[i] = 1;

            else if((pm[i] + pe[i] + pj[i]) / 3 >= 80)
                c[i] = 1;

            else if((pm[i] + pe[i] + pj[i]) / 3 >= 70)
                c[i] = 2;

            else if((pm[i] + pe[i] + pj[i]) / 3 >= 50 && (pm[i] >= 80 || pe[i] >= 80))
                c[i] = 2;
            
            else 
                c[i] = 3;

            if(c[i] == 1) cout << "A" << endl;
            else if(c[i] == 2) cout << "B" << endl;
            else cout << "C" << endl;
        }
    }
}


Measured memory_bytes: 2988
#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 x,y;
  cin >> x >> y;
  string ans = "No";
  if((y-2*x)%2==0 && (y-2*x)/2 <= x && y-2*x >= 0) ans = "Yes";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

using ull = unsigned long long;

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

	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << 0 << endl;
		return 0;
	}

	ull s[3];
	s[0] = a;
	s[1] = b;
	s[2] = c;

	sort(begin(s), end(s));

	cout << s[0] * s[1] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define RREP(i,n) for(int i=int(n)-1; i>=0; i--)
#define FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;
#define INF 1000000000000
#define NOD 1000000007
#define PI 3.141592653589793238462643

int main() {
    str s;
    bool c=false;
    cin >> s;
    REP(i, 3) if(s[i] == s[i+1]) c = true;
    if(c) cout << "Bad" << endl;
    else cout << "Good" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

int main() {
	int K; cin >> K;
	int s[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	cout << s[K-1] << endl;

}

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

#define MOD 998244353

using namespace std;

int n, s;
long long a[3043];
long long dp[3043][3043];
long long ans;

int main(int argc, char const *argv[]) {
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }

  for (int i = n; i >= 1; --i) {
    dp[i][a[i]] += n - i + 1;
    dp[i][a[i]] %= MOD;
    for (int j = 0; j <= s; ++j) {
      dp[i][j] += dp[i + 1][j];
      dp[i][j] %= MOD;
    }
    for (int j = a[i]; j <= s; ++j) {
      dp[i][j] += dp[i + 1][j - a[i]];
      dp[i][j] %= MOD;
    }
  }

  for (int i = 1; i <= n; ++i) {
    ans += dp[i][s];
    ans %= MOD;
  }

  cout << ans % MOD << endl;

  return 0;
}


Measured memory_bytes: 71936
#include<bits/stdc++.h>
#define debug1 cout<<"?"<<endl;
#define debug2 cout<<"?"<<i<<endl
#define PII pair<int,int>
typedef long long ll;
const int maxn=2e5+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=1e9;
const double ep=1e-7;
using namespace std;
int main()
{
	int n,m,i,a[maxn]={0},ans=0,sum=0;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	for(i=1;i<=n;i++)
	{
		if(a[i]*4*m>=sum)ans++;
	}
	if(ans>=m)puts("Yes");
	else puts("No");
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string S; cin>>S;
  string ans="No";
  if(S[2]==S[3]&&S[4]==S[5]) ans="Yes";
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
import java.io.*;
 
class Main{ 
public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[ ] str_div = br.readLine().split(" ");

        int w = Integer.parseInt(str_div[0]);
        int h = Integer.parseInt(str_div[1]);
        int x = Integer.parseInt(str_div[2]);
        int y = Integer.parseInt(str_div[3]);
        int r = Integer.parseInt(str_div[4]);



        if((x - r >= 0) && (x + r <= w) && (y - r >= 0) && (y + r <= h))
        System.out.println("Yes");
        else
        System.out.println("No");
 }
}
   

Measured memory_bytes: 17084
def main():
    n = int(input())

    m = int(n ** 0.5)
    if n < 4:
        m += 1

    min_f = len(str(n))

    for i in reversed(range(1, m + 1)):
        if n % i == 0:
            b = n // i
            db = len(str(b))
            di = len(str(i))
            f = max(db, di)
            if f < min_f:
                min_f = f

    print(min_f)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
package main

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

// 文字列を1行取得
func StrStdin() (stringReturned string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringInput := scanner.Text()

	stringReturned = strings.TrimSpace(stringInput)
	return
}

// 整数値1つ取得
func IntStdin() (int, error) {
	stringInput := StrStdin()
	return strconv.Atoi(strings.TrimSpace(stringInput))
}

// 空白や空文字だけの値を除去したSplit()
func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
	stringSplited := strings.Split(stringTargeted, delim)

	for _, str := range stringSplited {
		if str != "" {
			stringReturned = append(stringReturned, str)
		}
	}

	return
}

// デリミタで分割して文字列スライスを取得
func SplitStrStdin(delim string) (stringReturned []string) {
	// 文字列で1行取得
	stringInput := StrStdin()

	// 空白で分割
	// stringSplited := strings.Split(stringInput, delim)
	stringReturned = SplitWithoutEmpty(stringInput, delim)

	return
}

// デリミタで分割して整数値スライスを取得
func SplitIntStdin(delim string) (intSlices []int, err error) {
	// 文字列スライスを取得
	stringSplited := SplitStrStdin(" ")

	// 整数スライスに保存
	for i := range stringSplited {
		var iparam int
		iparam, err = strconv.Atoi(stringSplited[i])
		if err != nil {
			return
		}
		intSlices = append(intSlices, iparam)
	}
	return
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	if a == b {
		if a != c {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else {
		if a == c || b == c {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}

}


Measured memory_bytes: 640
using System;


    class Program
    {
        static void Main(string[] args)
        {
            float max = 0,min= 78798;
            while (true)
            {
                string gh = Console.ReadLine();
                if (gh == null) { break; }
                float a= float.Parse(gh);
            //    if (a == 0) { break; }
                if (a > max) { max = a; }
                if (a < min) { min = a; }
            }
            Console.WriteLine(max - min);
        
    }
}

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

int main(){
	int n, m;
	while(cin >> n >> m, n || m){
		int price[10010];
		int ans = 0;
		for(int i=1; i <= n; i++)
			cin >> price[i];

		sort(price+1, price+n+1, greater<int>());

		for(int i=1; i <= n; i++){
			if(i % m == 0) continue;
			ans += price[i];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1184
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)

	N := scanInt()
	m := make(map[int]int)

	for i := 0; i < N; i++ {
		d := scanInt()
		m[d]++
	}
	fmt.Println(len(m))
}


Measured memory_bytes: 1792
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, beg, end) for (int i = (beg); i < (end); i++)
 

 
int main()
{
    string n;
    cin >> n;
    int k =  n[n.length()-1] - '0';
    if(k == 2 || k == 4 || k==5||k==7||k==9)
        cout << "hon";
    else if(k == 0||k ==1||k==6||k==8)
        cout << "pon";
    else
    {
        cout << "bon";
    }
    

}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#define REP(i, N) for(int i = 0; i < (N); i++)
#define int long long
#define MAXN 600
using namespace std;
using bools = vector<bool>;
using vec = vector<int>;

int dp[MAXN + 1][MAXN / 2 + 1][MAXN / 2 + 1] = {};

signed main() {

  dp[0][0][0] = 1;
  
  int N; cin >> N;
  int A[MAXN];
  REP(i, 2 * N){
    cin >> A[i];
    if(A[i] != -1) A[i] = 2 * N - A[i];
  }
  
  int n = 0, m = 0;
  vec flag(2 * N, 0);
  REP(i, N){
    if(A[2 * i] != -1 && A[2 * i + 1] != -1){
      flag[A[2 * i]] = 2; flag[A[2 * i + 1]] = 2;
      n++;
    }else if(A[2 * i] != -1) flag[A[2 * i]] = 1;
    else if(A[2 * i + 1] != -1) flag[A[2 * i + 1]] = 1;
    else m++;
  }
  //REP(i, 2 * N) cout << A[i] << endl;
  //REP(i, 2 * N) cout << flag[i] << endl;
  
  int mod = 1000000007;
  
  int i0 = 0;
  REP(i, 2 * (N - n)){
    //if(flag[i] == 2) continue;
    while(flag[i0] == 2) i0++;
    if(flag[i0] == 1){
      REP(j, N + 1) REP(k, N + 1){
        if(k < N) dp[i + 1][j][k + 1] += dp[i][j][k];
        if(j > 0) dp[i + 1][j - 1][k] += dp[i][j][k];
      }
    }else{
      REP(j, N + 1) REP(k, N + 1){
        if(j < N) dp[i + 1][j + 1][k] += dp[i][j][k];
        if(j > 0) dp[i + 1][j - 1][k] += dp[i][j][k];
        if(k > 0) dp[i + 1][j][k - 1] += k * dp[i][j][k];
      }
    }
    REP(j, N + 1) REP(k, N + 1) dp[i + 1][j][k] %= mod;
    i0++;
  }
  
  int ans = dp[2 * (N - n)][0][0];
  REP(i, m) ans = (ans * (i + 1)) % mod;
  cout << ans << endl;
  
}


Measured memory_bytes: 424960
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort(all(v))
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
#define fcout cout << fixed << setprecision(15)
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill( (T*)array, (T*)(array+N), val );};
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};



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

  int h, w;
  int a[30][30];
  cin >> h >> w;
  rep(i, h) rep(j, w) cin >> a[i][j];
  int ans = 1000000, cnt;
  rep(i, h) rep(j, w) {
    cnt = 0;
    rep(k, h) rep(l, w) {
      cnt += min(abs(i - k), abs(j - l)) * a[k][l];
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3220
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    long long ans = 0;
    cin >> n;
    vector<int> ap(n), am(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &ap[i]);
        am[i] = i - ap[i];
        ap[i] = i + ap[i];
    }
    sort(am.begin(), am.end());
    for (int i = 0; i < n; i++) {
        auto itrl = lower_bound(am.begin(), am.end(), ap[i]),
             itru = upper_bound(am.begin(), am.end(), ap[i]);
        ans += (long long)(itru - itrl);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll N,D;
    cin>>N>>D;
    ll X[N][D];
    rep(0,i,N){
        rep(0,j,D){
            cin>>X[i][j];
        }
    }
    ll ans=0;
    rep(0,i,N){
        rep(i+1,j,N){
            ll sum=0;
            rep(0,k,D){
                sum+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
            }
            if((ll)sqrt(sum)==sqrt(sum))++ans;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>
#include <vector>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)

const int INF = 1e9;

using namespace std;

int main() {
    int n;
    int max = -INF, min = INF;
    long long sum = 0;
    cin >> n;
    REP(i, n){
        int x;
        cin >> x;
        if (x > max)
            max = x;
        if (x < min)
            min = x;
        sum += x;
    }
    if (n == 0) {
        min = 0;
        max = 0;
        sum = 0;
    }
    cout << min << " " << max << " " << sum << endl;

    return 0;
}

Measured memory_bytes: 1168
a, b, c, x, y = map(int, input().split())
if (a + b) > c * 2:
  if x > y:
    if a > c * 2:
      print(c * 2 * x)
    if a <= c * 2:
      print(a * (x - y) + c * 2 * y)
  if x < y:
    if b > c * 2:
      print(c * 2 * y)
    if b <= c * 2:
      print(b * (y - x) + c * 2 * x)
  if x == y:
    print(c * 2 * x)
elif (a + b) <= c * 2:
  print(a * x + b * y)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int a[400005];
int main(){
	int k,n;
	cin>>k>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int ans=a[0]+k-a[n-1];
	for(int i=0;i+1<n;i++) ans=max(ans,a[i+1]-a[i]);
	cout<<k-ans;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 10000
#define INF 10001000

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep2(i,a,n) for(int i = a; i < (n); i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll; 

int main()
{
    int n, k;
    int ans = 0;
    cin >> n >> k;
    int h[n];

    rep(i,n) { cin >> h[i];}
    rep(i,n) { if(h[i] >= k) { ans++; } } 
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
S = input()
k = S[::-1]
count = -1
realcount = 0
for i in k:
    count +=1
    if i!=S[count]:
        S.replace(S[count],i)
        realcount+=1
    if realcount == 0:
        real = 0
    else:
        real = realcount//2
print(real)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
	char  a[3];
	scanf("%c%c%c",& a[0], &a[1], &a[2]);
	if (a[0] != a[1] && a[0] != a[2] && a[1] != a[2])
		printf("Yes");
	else
		printf("No");	
return 0;
}

Measured memory_bytes: 128
//file_name:ABC101_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&y);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    int nn = n;
    int count  = 0;
    while(nn>0){
        count += nn%10;
        nn /= 10;
    }

    if(n%count==0)yn;

    //int ans = 0;

    //cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int a;
    int[] check;
    int i, sum;

    check = new int[10];
    for(;sc.hasNext();){
      for(i = 0;i < 10;i++)check[i] = 0;
      sum = 0;
      a = sc.nextInt();
      sum += a;
      for(i = 0;i < 10;i++)if(a == i + 1)check[a - 1]++;
      a = sc.nextInt();
      sum += a;
      for(i = 0;i < 10;i++)if(a == i + 1)check[a - 1]++;
      a = sc.nextInt();
      for(i = 0;i < 10;i++)if(a == i + 1)check[a - 1]++;
      a = 0;
      for(i = 0;i < 10;i++)if(i + 1 <= 20 - sum && check[i] == 0)a++;
      if(a > 3)out.println("YES");
      else out.println("NO");
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17196
#include <stdio.h>
int linearSearch(int ,int *);
int C=0,n;

int main(){
  int i,q;
  
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
 
  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
    linearSearch(T[i],&S[0]);
  }
 
  printf("%d\n",C);
  return 0;
}

int linearSearch(int x, int *a){
  int i=0;
  while(a[i]!=x){
    if(i>n)
      return 0;
    i++;
  }
  C++;
  return 0;
}


Measured memory_bytes: 2108
fn main() {
    proconio::input! {
        n: usize,
        d: i64,
        xy: [(i64,i64);n],
    }
    let mut c=0;
    for (x,y) in xy {
        if x*x+y*y<=d*d {
            c+=1;
        }
    }
    println!("{}",c);
}

Measured memory_bytes: 7772
#include <iostream>

using namespace std;

int main()
{
	int n;
	double dn;
	double rate = 1.08;
	double result;

	cin >> n;

	result = n / rate;
	int intResult0 = int(result) * 1.08;
	int intResult1 = int(result+1) * 1.08;

	if (intResult0 == n)
	{
		cout << int(result);
	}
	else if (intResult1 == n)
	{
		cout << int(result+1);
	}
	else
	{
		cout << ":(";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a,b,str,count=0,d,e,f,g,h;
	cin >> a >> b;
	for(int i=a;i<=b;i++)
	{
		d=i/10000;
		e=(i-d*10000)/1000;
		f=(i-d*10000-e*1000)/100;
		g=(i-d*10000-e*1000-f*100)/10;
		h=i-d*10000-e*1000-f*100-g*10;
		if(d==h && e==g)
		{
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define printarray(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout<<*it<<" "; cout<<endl;
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long

using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;

int fastexpo(int b, int exp){
    if(exp == 0) return 1;
    if(exp == 1) return b;
    int ans = (fastexpo(b,exp/2) % MOD);
    ans *= ans;
    ans %= MOD;
    if(exp % 2 == 1){
        ans *= b;
    }
    ans %= MOD;
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i = 0;i<n;i++){
    	cin>>a[i];
    }   
    sort(a, a + n);
    int ans = 0;
    for(int i = 0;i<n;i++){
    	for(int j = i+1;j<n;j++){
    		for(int k = j+1;k<n;k++){
    			if((a[i] + a[j] > a[k]) and (a[i] + a[k] > a[j]) and (a[k] + a[j] > a[i])){
    				ans++;
    			}
    		}
    	}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
V = list(map(int, input().split()))

first = Counter(V[::2]).most_common(2) + [(0, 0)]
latter = Counter(V[1::2]).most_common(2) + [(0, 0)]

if first[0][0] == latter[0][0]:
    X = N - first[0][1] - latter[1][1]
    Y = N - first[1][1] - latter[0][1]
    cnt = min(X, Y)
else:
    cnt = N - first[0][1] - latter[0][1]

print(cnt)
    

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
typedef pair<int, int> P;
typedef long long ll;

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}


int main() {
	int x;
	cin>>x;
	ll c=2;
	for(int i=0;i<x;i++)c=(c+1)*2;
	cout<<c<<endl;
	return 0;
}


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

int main() {
  long long n; cin >> n;
  long long sum = 0LL;
  for(long long i=1; i<=n; i++)
    if(i%3!=0 && i%5!=0)
      sum += i;
  
  cout << sum;
  return 0; 
  
  }

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int N;
  cin >> N;
  int sum = 0;
  vector<int> A(N); 
  REP(i, N){
    cin >> A[i];
    sum+=A[i];
  }
  
  if(sum%10==0){
    int MAX = 0;
    REP(i,N){
      if((sum-A.at(i))%10!=0){
        MAX = max(sum-A.at(i),MAX);
      }
    }
    cout << MAX << endl;
  }else{
    cout << sum << endl;
  }
}

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

const long long INFF = 1e18;

const int MAX_N = 11000;
using TYPE = long long; // ?????¢???????????\??????
vector<pair<int, TYPE> > G[MAX_N];

vector<TYPE> A_star(int start){
	vector<TYPE> dist(MAX_N, INFF);
	dist[start] = 0;//dist[i] :=???start->i?????§??????????????¢
	priority_queue<pair<TYPE, int>, vector<pair<TYPE, int> >, greater<pair<TYPE, int> > >  que;
	que.push(make_pair(1, start));
	while(!que.empty()){
		TYPE cost; int u;//????????§???????????£????????? ?????¨?????????
		cost = que.top().first, u = que.top().second;
		que.pop();
		// if(dist[u] < cost) continue;
		for (auto tmp : G[u]){
			int v = tmp.first; TYPE time = tmp.second;//??£??\???????????? ?????????????????§????????????
			if(dist[v] > dist[u] + time){//u->v
				dist[v] = dist[u] + time;
				TYPE h = 1; // ??´???????????§?????¨??????
				// printf("%f\n", h);
				que.push(make_pair(dist[v] + 100, v));
			}
		}
	}
	return dist;
}

int main(void) {
	int n; cin >> n;
	rep(q, n) {
		int u, k; cin >> u >> k;
		vector<int> v(k); vector<long long> c(k);
		rep(i, k) cin >> v[i] >> c[i];
		rep(i, k) G[u].push_back(make_pair(v[i], c[i]));
	}
	auto dist = A_star(0);
	rep(i, n) printf("%d %d\n", i, dist[i]);
	return 0;
}

Measured memory_bytes: 12204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  ll n;
  ll x,m;
  cin>>n>>x>>m;
  ll a[m+1];
  a[0]=x;
  rep(i,0,m){
    a[i+1]=a[i]*a[i]%m;
  }
  if(n<m){
    ll ans=0;
    rep(i,0,n){
      ans+=a[i];
    }
    cout<<ans<<endl;
  }
  else{
    int j=m-1;
    while(a[m]!=a[j]){
      j--;
    }
    ll ans=0;
    rep(i,0,j){
      ans+=a[i];
    }
    ll sum[m-j+1];
    sum[0]=0;
    rep(i,0,m-j){
      sum[i+1]=sum[i]+a[j+i];
    }
    ans+=(n-j)/(m-j)*sum[m-j]+sum[(n-j)%(m-j)];
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 4580
#include <bits/stdc++.h>
#define rep(i, a, n) for(ll i = a; i < n; i++)
#define repr(i, a, b) for(ll i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
const int mod = 1000000007;
const int INF = 1e15;
using ll = int;//__int128_t;

int gcd(int a, int b){
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return gcd(b, a % b);
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    rep(it, 0, t){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        bool f = true;
        if(b > a || b > d){
            cout << "No" << endl;
        }else{
            int x = gcd(b, d);
            int low = a - (a - c - 1) / x * x;
            if(low < b){
                cout << "No" << endl;
            }else{
                cout << "Yes" << endl;
            }
        }
    }
}

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

using namespace std;

int main(void){
    int h, n;
    cin >> h >> n;
    int sum = 0;
    for(int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        if(h <= sum + temp){
            cout << "Yes" << endl;
            return 0;
        }else{
            sum += temp;
        }
    }
    cout  << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int n;
int A[100];


void trace(){
  int i;
  for ( i = 0; i < n; i++ ){
    printf("%d", A[i]);
    if(i+1!=n){
      printf(" ");
    }
  }
  printf("\n");
}

int main(){
  int i;
  int j;
  int key;
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%d", &A[i]);
  }
  for (j = 1; j<n; j++){
    key = A[j];
    trace();
    i = j - 1;
    while (i >= 0 && A[i] > key){
      A[i+1] = A[i];
      i = i - 1;
    }
      A[i+1] = key;	  
  }			  
  trace();
  return 0;
}

Measured memory_bytes: 604
from bisect import bisect_right
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class mint:
    def __init__(self, x):
        self.__x = x % md

    def __repr__(self):
        return str(self.__x)

    def __neg__(self):
        return mint(-self.__x)

    def __add__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x + other)

    def __sub__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x - other)

    def __rsub__(self, other):
        return mint(other - self.__x)

    def __mul__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * other)

    __radd__ = __add__
    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * pow(other, md - 2, md))

    def __rtruediv__(self, other):
        return mint(other * pow(self.__x, md - 2, md))

    def __pow__(self, power, modulo=None):
        return mint(pow(self.__x, power, md))

md = 10**9+7

def main():
    n,x=MI()
    ss=LI()
    ss.sort()
    dp=[0]*(x+1)
    dp[x]=mint(1)
    for i in range(x,0,-1):
        pre=dp[i]
        if pre==0:continue
        mxj=bisect_right(ss,i)
        for j in range(mxj):
            dp[i%ss[j]]+=pre/mxj

    ev=sum(dp[i]*i for i in range(ss[0]))
    fac=mint(1)
    for i in range(1,n+1):fac*=i
    print(ev*fac)

main()

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  int k;
  cin >> s >> k;
  
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == 'a') continue;
    if(123 - s.at(i) <= k){
      k -= 123 - s.at(i);
      s.at(i) = 'a';
    }
  }
  
  k %= 26;
  s.at(s.size() - 1) += k;
  if(s.at(s.size() - 1) > 'z') s.at(s.size() - 1) -= 26;
  
  cout << s << '\n';
}

Measured memory_bytes: 592
#include <stdio.h>

int main(){
  int N;
  int A[100];
  int count = 0,flag = 1,num = 0;
  int i;
  
  scanf("%d",&N);

  for(i=0;i<N;i++)scanf("%d",&A[i]);

  while(flag==1){
    flag = 0;
    for(i=N-1;i>=1;i--){
      if(A[i]<A[i-1]){
	num=A[i];
	A[i]=A[i-1];
	A[i-1]=num;
	count++;
	flag=1;
      }
    }
  }

  for(i=0;i<N-1;i++)printf("%d ",A[i]);
  printf("%d\n",A[i]);

  printf("%d\n",count);
  
  return 0;
}



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

const double EPS = 1e-10;
bool EQ(double a, double b){return fabs(a-b) < EPS;}
typedef complex<double> Point;

typedef vector<Point> Polygon;

double cross(Point a, Point b){return imag(conj(a) * b);}

#define curr(P,i) P[i]
#define next(P,i) P[(i+1)%P.size()]
double area(Polygon P) {
  double a = 0;
  for(int i = 0; i < P.size(); ++i)
    a += cross(curr(P,i), next(P,i));
  return 0.5 * a;
}

int main() {
  int n,x,y;
  Polygon P;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>x>>y;
    P.push_back(Point(x,y));
  }
  printf("%.1f\n",area(P));
  return 0;
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0index
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1index
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからb - 1まで
#define mREP(i,a,b) for (int i = a; i > (b); --i)  //逆
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;  //最大値兼MOD
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }  //GCD

bool is_prime(long long n) {  //素数判定
  for(int64_t i = 2; i * i <= n; i++) {
    if(n % i == 0) return false;
  }
  return true;
}

int main(){
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    int multiple_ways = (2 * x == w) && (2 * y == h);
    long double area = ((long double)w) * h / 2;
    cout << area << " " << multiple_ways << endl;
  return 0;
}



Measured memory_bytes: 256
class UnionFindPathCompression():
    def __init__(self, n):
        self.parents = list(range(n))

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        self.parents[y] = x

    def roots(self):
        r=[i for i,x in enumerate(self.parents) if i==x]
        return len(r)

if __name__ == '__main__':
    N,M=list(map(int,input().split()))
    LIST=[list(map(int,input().split())) for i in range(M)]
    union_find=UnionFindPathCompression(N)
    for l in LIST:
        union_find.union(l[0]-1,l[1]-1)
    print(union_find.roots())



Measured memory_bytes: 115288
use std::env;
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let X = read::<i32>();
    let A = read::<i32>();
    let B = read::<i32>();

    if A >= B {
        println!("delicious");
    } else if X+A >= B {
        println!("safe");
    } else {
        println!("dangerous")
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

vvi to;
vi color;
const int INF = 1001001001;

bool dfs(int v, int c=0) {
    if (color[v] != -1) {
        return color[v] == c;
    }
    color[v] = c;
    bool res = true;
    for (int u : to[v]) {
        res = res && dfs(u, 1-c); 
    }
    return res;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int n;
    cin >> n;
    to.resize(n);
    vvi d(n, vi(n, INF));
    rep(i, n) {
        d[i][i] = 0;
        string s;
        cin >> s;
        rep(j, n) if (s[j] == '1') {
            d[i][j] = 1;
            to[i].pb(j);
        }
    }
    color.resize(n, -1);
    bool ok = dfs(0);
    if (!ok) {
        cout << -1 << endl;
        return 0;
    }
    rep(k, n) rep(i, n) rep(j, n) chmin(d[i][j], d[i][k] + d[k][j]);
    int mx = 0;
    rep(i, n) rep(j, n) chmax(mx, d[i][j]);
    cout << mx + 1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include<iomanip>
using namespace std;
using P = pair<int, int>;
using PP = pair<P, int>;
int MOD = 1000000007;

int H, W;
string S[30];


int main()
{
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> S[i];
	}
	int ans = 0;
	for (int i = 0; i < H * W; i++) {
		for (int j = 0; j < H * W; j++) {
			int s[2] = { (int)i / W, i % W };
			int g[2] = { (int)j / W, j % W };
			if (S[s[0]][s[1]] == '#') continue;
			if (S[g[0]][g[1]] == '#') continue;
			bool map[30][30] = {};
			queue<PP> queue;
			queue.push(PP(P(s[0],s[1]),0));
			while (!queue.empty()) {
				PP now = queue.front();
				queue.pop();
				int x = now.first.first;
				int y = now.first.second;
				int d = now.second;
				if (!map[x][y])	map[x][y] = true;
				else continue;
				if (x == g[0] && y == g[1]) {
					ans = max(ans, d);
					break;
				}
				if (x - 1 >= 0 && S[x - 1][y] != '#' && !map[x - 1][y])
					queue.push(PP(P(x - 1, y), d + 1));
				if (y - 1 >= 0 && S[x][y - 1] != '#' && !map[x][y - 1])
					queue.push(PP(P(x, y - 1), d + 1));
				if (x + 1 < H && S[x + 1][y] != '#' && !map[x + 1][y])
					queue.push(PP(P(x + 1, y), d + 1));
				if (y + 1 < W && S[x][y + 1] != '#' && !map[x][y + 1])
					queue.push(PP(P(x, y + 1), d + 1));
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<int,int> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a<=c&&c<=b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  map<string, int> cnt;
  int n;
  cin >> n;
  rep(i, n) {
    string s;
    cin >> s;
    cnt[s]++;
  }
  int m;
  cin >> m;
  rep(i, m) {
    string t;
    cin >> t;
    cnt[t]--;
  }

  int ans = 0;
  for (auto it = cnt.begin(); it != cnt.end(); it++) {
    ans = max(ans, it->second);
  }

  cout << ans << endl;
}


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

typedef long long LL;
typedef pair<int, int> II;

const int MAXN = (int)1e5 + 10;
const int INF = (int)1e9 + 7;
int n, m, f[MAXN], ft[MAXN];
char s[MAXN];

void update(int i, int v) {
    while (i <= n) {
        ft[i] = min(ft[i], v);
        i += i & -i;
    }
}

int query(int i) {
    int ans = INF;
    while (i > 0) {
        ans = min(ans, ft[i]);
        i -= i & -i;
    }
    return ans;
}

int main() {
    scanf("%d%d", &n, &m);
    scanf("%s", s);

    for (int i = 1; i <= n; ++i) {
        ft[i] = INF;
    }
    f[n] = 0;
    for (int i = n - 1; i >= 0; --i) {
        update(i + 1, f[i + 1]);
        if (s[i] == '1') {
            f[i] = INF;
        } else {
            f[i] = query(min(n, i + m)) + 1;
        }
    }

    if (f[0] >= INF) {
        puts("-1");
        return 0;
    }

    for (int i = 1, p = 0; i <= f[0]; ++i) {
        for (int q = p + 1; q <= p + m; ++q) {
            if (f[p] == f[q] + 1) {
                printf("%d ", q - p);
                p = q;
                break;
            }
        }
    }
    puts("");
    return 0;
}

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

#define ROOM 10
#define FLOOR 3
#define BUILDING 4
int array_num[BUILDING][FLOOR][ROOM] = {};//?????¨?±?????????????0??§?????????


int main(){

	int n,b,f,r,v;
	cin >> n;

	//??¨?±?????????°?????£??\
	for (int i = 0; i < n; i++){
		cin >> b >> f >> r >> v;

		array_num[b - 1][f - 1][r - 1] += v;	
	}

	//??????

	for (int i = 0; i < BUILDING; i++){
		for (int j = 0; j < FLOOR; j++){
			for (int k = 0; k < ROOM; k++){
			
				cout <<" "<< array_num[i][j][k];
			
			}
			cout << endl;

		}
		if (i<BUILDING-1)
		cout << "####################" << endl;	
	}




	return 0;
}

Measured memory_bytes: 1164
N = int(input())
A = [0]*N
for i in range(N):
    A[i] = int(input())
A.sort()
if N%2 == 1:
    print(max(sum(A[N//2+1:])*2-sum(A[:N//2-1])*2-sum(A[N//2-1:N//2+1]),sum(A[N//2+2:])*2-sum(A[:N//2])*2+A[N//2]+A[N//2+1]))
else:
    print(sum(A[N//2+1:])*2+A[N//2]-sum(A[:N//2-1])*2-A[N//2-1])


Measured memory_bytes: 7472
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
const ll MOD=1e9+7;

int main(int argc, char *argv[])
{
	vector<ll> cnt(60,0);

	int n;
	cin >> n;

	ll ret=0;
	for (int i=0;i<n;i++)
	{
		ll a;
		cin >> a;

		ll b=1;
		for (int j=0;j<60;j++)
		{
			if ((b&a)==0)
			{
				ret=(ret+cnt[j]*(b%MOD))%MOD;
			}
			else
			{
				ret=(ret+(i-cnt[j])*(b%MOD))%MOD;
				cnt[j]++;
			}
			b<<=1;
		}
	}
	cout << ret << endl;
}



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

int main(){
	int a,b; cin>>a>>b;
	if(b%a==0) cout << a+b << endl;
	else cout << b-a << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 1000000000
#define MOD 1000000007;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;

ll gcd(ll a, ll b)
{
	if (b == 0) return a;

	return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}


int main()
{
	int N;
	cin >> N;
	vll T(N, 0);
	rep(i, N) cin >> T[i];

	rep(i, N - 1)
	{
		T[i + 1] = lcm(T[i], T[i + 1]);
	}

	cout << T[N - 1] << endl;

	return 0;
}



Measured memory_bytes: 256
N = gets.to_i
K = gets.to_i
L = N.to_s.length

dp = Array.new(105){Array.new(4){Array.new(2, 0)}}
dp[0][0][0] = 1
L.times do |p|
  nd = N.to_s[p].to_i
  4.times do |q|
    2.times do |r|
      10.times do |d|
        np, nq, nr = p + 1, q, r
        if d != 0
          nq += 1
        end
        
        if nq > K
          next
        end
        
        if nr == 0
          if d > nd
            next
          elsif d < nd
            nr = 1
          end
        end
        dp[np][nq][nr] += dp[p][q][r]
      end
    end
  end
end

puts dp[L][K][0] + dp[L][K][1]

Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    
    priority_queue<long long int> A;
    long long int sum=0;
    for(int i=0; i<N; i++) {
        long long int a;
        cin >> a;
        sum += a;
        A.push(a);
    }
    

    int index=N-1;
    while(M) {
        // cout << A.top() << endl;
        sum -= A.top();
        sum += A.top()/2;
        A.push(A.top()/2);
        A.pop();
        
        M--;
    }
    
    cout << sum << endl;

    return 0;
    
}

Measured memory_bytes: 1400
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;

const int INF = 1<<29;
const double EPS = 1e-5;
typedef vector<int> vec;
typedef pair<int,int> P;
struct edge{int to,cost;};

const int MAX_J = 5001;

int X,Y,Z;
double dp[51][MAX_J];
int V[4];
int event[51], event_A[51];

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

        for(int i = 0; i < X; i++){
            scanf("%d",&V[i]);
        }
        fill(event, event+Y+1, 0);
        for(int i=0;i<Z;i++){
            int N,E,A;
            scanf("%d%d%d",&N,&E,&A);
            event[N] = E;
            event_A[N] = A;
        }
        for(int i=0;i<Y+1;i++){
            for(int j=0;j<MAX_J;j++){
                dp[i][j] = 0;
            }
        }

        dp[0][0] = 1;
        for(int i=0;i<Y;i++){
            for(int j=0;j<MAX_J;j++){
                for(int k=0;k<X;k++){
                    int ni = min(Y, i + V[k]), nj = j;
                    if(event[ni] == 2) nj += event_A[ni];
                    else if(event[ni] == 3) nj = max(0, j-event_A[ni]);
                    else if(event[ni] == 1) ni = min(Y, ni + event_A[ni]);
                    dp[ni][nj] += dp[i][j] / X;
                }
            }
        }
        double ans = 0;
        for(int j=1;j<MAX_J;j++){
            ans += j*dp[Y][j];
        }
        printf("%d\n", (int)(ans+EPS));
    }
    return 0;
}

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

const int mod = 1e9 + 7;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, k, i;
    cin >> a >> b >> c >> k;
    i=0;
    while (b <= a && i < k)
        b = 2*b, i += 1;
    while (c <= b && i < k)
        c = 2*c, i += 1;
    if (c > b && b > a) cout << "Yes";
    else cout << "No";
    return 0;
}


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

int main(){

  int N,M;
  cin >> N >> M;

  int start1;
  int start2;


  //偶数の時
  if(N%2==0){
    start1 = 1;
    start2 = N-1;
    bool flag = 0;
    for(int i=1;i<=M;i++){
      if(flag==0 && start2-start1<=N/2){
        start1++;
        flag = 1;
      }
      cout << start1 << " " << start2 << endl;
      start1++;
      start2--;
    }
  }else{
    start1 = 1;
    start2 = N-1;
    for(int i=1;i<=M;i++){
      cout << start1 << " " << start2 << endl;
      start1++;
      start2--;
    }
  }

}

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

int N,M;long long K;
long long X[100005],D[100005];

int P[61][100005];
int ans[100005];

int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++) scanf("%lld",&X[i]),D[i]=X[i]-X[i-1],P[0][i]=i;
	scanf("%d%lld",&M,&K);
	while(M--){
		int x;scanf("%d",&x);
		swap(P[0][x],P[0][x+1]);
	}
	for(int i=1;i<=60;i++)
	for(int j=1;j<=N;j++)
		P[i][j]=P[i-1][P[i-1][j]];
	for(int j=1;j<=N;j++) ans[j]=j;
	for(int i=60;~i;i--)if((K>>i)&1)
	for(int j=1;j<=N;j++)
		ans[j]=P[i][ans[j]];
	for(int i=1;i<=N;i++) printf("%lld\n",X[i]=X[i-1]+D[ans[i]]);
}

Measured memory_bytes: 29400
import sys
input = sys.stdin.readline
N,Q = map(int,input().split())
VW = [tuple(map(int,input().split())) for i in range(Q)]

ans = []
if N==1:
    for v,w in VW:
        ans.append(min(v,w))
else:
    for v,w in VW:
        while v != w:
            if v > w: v,w = w,v
            w = (w+N-2)//N
        ans.append(v)
print(*ans, sep='\n')

Measured memory_bytes: 24948