akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 


ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}



int main()
{
     ll n,h;
     cin>>n>>h;
     vector<ll> k(n);
     ll mx=0LL;
     for(int i=0;i<n;i++)
     {
          ll x,y;
          cin>>x>>y;
          mx=max(mx,x);
         k.push_back(y);
     }
     sort(k.begin(),k.end());
     ll ct=0;
     while(h>0&&!k.empty())
     {
         ll t=k.back();
         if(t<=mx)break;
         else{
              h-=t;ct++;k.pop_back();
         }
     }
    // cout<<h<<"\n";
     if(h>0)ct+=1LL*(h+mx-1)/mx;
     cout<<ct;
}















 














 
 

















Measured memory_bytes: 1904
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eps 1e-15

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef tuple<int, int, int> ti3;

int main()
{
    vi v;
    int m = 10000000;
    rep(i, 3)
    {
        int x;
        scanf("%d", &x);
        v.pb(x);
    }

    rep(i, 6)
    {
        int cost = abs(v[1] - v[0]) + abs(v[2] - v[1]);
        m = cost < m ? cost : m;
        next_permutation(all(v));
    }

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


Measured memory_bytes: 256
a= int(input())
b= int(input())
c= int(input())
d= int(input())
e= int(input())

def time(x):
    if x%10 == 0:
        return x
    else:
        return x+(10-x%10)
ans = []
ans.append(time(a)+time(b)+time(c)+time(d)+e)
ans.append(time(a)+time(b)+time(c)+time(e)+d)
ans.append(time(a)+time(b)+time(e)+time(d)+c)
ans.append(time(a)+time(e)+time(c)+time(d)+b)
ans.append(time(e)+time(b)+time(c)+time(d)+a)
print(min(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <tuple>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; --i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int b[100001];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  REP(i, n - 1) {
    cin >> b[i];
  }

  ll ans = 0;
  REP(i, n) {
    if(i == n - 1) ans += b[n - 2];
    else if(i == 0) ans += b[0];
    else ans += min(b[i], b[i - 1]);
  }

  cout << ans << endl;
}


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

int p[1000001];
vector<int> plist;

int f(int a) {
    if(p[a] == 0) return a;
    vector<int> p;
    int sum = 0;
    for(int i=0; i<plist.size(); ++i) {
        if(a%plist[i] == 0) {
            p.push_back(plist[i]);
            while(a%plist[i] == 0) a /= plist[i];
            sum += plist[i];
        }
        if(a == 1) break;
    }

    sum -= p[p.size()-1];
    return p[p.size()-1] - sum;
}

int main() {
    memset(p, 0, sizeof(p));
    p[0] = p[1] = 1;
    for(int i=4; i<=1000000; i+=2) p[i] = 1;
    for(int i=3; i*i<=1000000; i+=2)
        if(p[i] == 0)
            for(int j=2; i*j<=1000000; j++)
                p[i*j] = 1;
    plist.clear();

    for(int i=0; i<=1000000; ++i) if(p[i] == 0) plist.push_back(i);

    int a,b;
    while(cin>>a>>b, a|b) {
        int fa = f(a),fb = f(b);
        if(fa > fb) {
            cout<<"a"<<endl;
        }else{
            cout<<"b"<<endl;
        }
    }
}

Measured memory_bytes: 0
n,m = map(int,input().split())
li = list(map(int,input().split()))
sum_vote = sum(li)
kijun = sum_vote / (4 * m)
sum_above = len([i for i in li if i >= kijun])
if sum_above >= m:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9140
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
int main(){
    int d,n;cin>>d>>n;
    if(n==100){
        if(d==1){
            cout<<10100<<endl;
        }else if(d==2){
            cout<<1010000<<endl;
        }else{
			cout<<101<<endl;
        }
        return 0;
    }
    if(d==0){
        cout<<n<<endl;
    }else if(d==1){
        cout<<n<<"00"<<endl;
    }else{
        cout<<n<<"0000"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a, b, k;cin>>a>>b>>k;
	long long ans1 = a - k >= 0 ? a - k : 0;
	long long ans2 = 0;
	if(k - a >  0){
		if( b - (k-a) >= 0){
			ans2 = b - (k-a);
		}
		else ans2 = 0;
	}
	else ans2 = b;
	cout<<ans1<<" "<<ans2;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner s = new Scanner(System.in);
      	char[] charArray = s.next().toCharArray();
      
      	StringBuilder sb_even = new StringBuilder();
      	StringBuilder sb_odd = new StringBuilder();
      	int even_cnt = 0;
      	int odd_cnt = 0;
      	for(int i = 0; i < charArray.length; i++) {
        	if (i % 2 != 0)  {
              if (charArray[i] == 'L' || charArray[i] == 'U' || charArray[i] == 'D') {
              	sb_even.append(charArray[i]);
              }
              even_cnt++;
            } else {
              if (charArray[i] == 'R' || charArray[i] == 'U' || charArray[i] == 'D') {
              	sb_odd.append(charArray[i]);
              }
              odd_cnt++;
            }
        }

      if (sb_even.length() == even_cnt && sb_odd.length() == odd_cnt) {
      	System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
}

Measured memory_bytes: 21844
#include<cstdio>
using namespace std;
#define ll long long
#define in inline
in ll read(){
   ll s=0;bool w=1;char ch=getchar();while(ch<'0' || ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0' && ch<='9')s=s*10+ch-'0',ch=getchar();return s*w;
}
void write(ll x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);putchar(x%10+'0');
}
int main(){
    int a=read(),b=read(),c=read(),d=read();
    puts((c+b-1)/b<=(a+d-1)/d?"Yes":"No");
    return 0;
}

Measured memory_bytes: 1532
/*|In The Name of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 10;

int n;
int m;
int vis[N];
int res = 0;
vector < int > adj[N];

bool canbeway(){
     int cnt = 0;
     for(int i = 1; i <= n; i++){
         cnt += vis[i];
     }
     return cnt == n;
}

void dfs(int u){
     vis[u] = 1;
     for(int i = 0; i < adj[u].size(); i++){
        int v = adj[u][i];
        if(!vis[v]){
            dfs(v);
        }
     }
     if(canbeway()){
        res ++;
     }
     vis[u] = 0;
}

int main(){
    scanf("%d%d" , &n , &m);
    for(int i = 1; i <= m; i++){
        int u , v;
        scanf("%d %d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1);
    printf("%d\n" , res);
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
typedef pair<int,int> P;

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

int A[1005];

bool check(int k)
{
    string s=to_string(k);
    REP(i,s.size()-1){
        if(s[i]+1!=s[i+1]) return false;
    }
    return true;
}

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

    int n; cin>>n;
    REP(i,n) cin>>A[i];
    int ans=-1;
    REP(i,n-1) for(int j=i+1;j<n;j++){
        int p=A[i]*A[j];
        if(check(p)) ans=max(ans,p);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3272
#include<bits/stdc++.h>
#pragma GCC optimize(3)
namespace ZDY{
    #define res register
    #define ri res int
    #define ll long long
    #define db double
    #define sht short
    #define il inline
    #define MB template <class T>
    #define Fur(i,x,y) for(ri i=x;i<=y;i++)
    #define fur(i,x,y) for(i=x;i<=y;i++)
    #define Fdr(i,x,y) for(ri i=x;i>=y;i--)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fl(i,x) for(ri i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define inf 2122219134
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdin)
    #define l2(n) (ceil(log2(n)))
    #define fast ios::sync_with_stdio(false)
    MB il T ABS(T x){return x>0?x:-x;}
    MB il T MAX(T x,T y){return x>y?x:y;}
    MB il T MIN(T x,T y){return x<y?x:y;}
    MB il T GCD(T x,T y){return y?GCD(y,x%y):x;}
}using namespace ZDY;using namespace std;
#define N 100010
int n,m,a1[N],a2[N];
struct city{
    int id,y;
    friend bool operator <(const city &a,const city &b){
        return a.y<b.y;
    }
};
vector<city> a[N];
int main(){
    cin>>n>>m;
    int p,y;
    Fur(i,1,m){
        scanf("%d%d",&p,&y);
        a[p].push_back((city){i,y});
    }
    Fur(i,1,n)if(!a[i].empty()){
        sort(a[i].begin(),a[i].end());
        Fur(j,0,a[i].size()-1)a1[a[i][j].id]=i,a2[a[i][j].id]=j+1;
    }
    Fur(i,1,m)printf("%06d%06d\n",a1[i],a2[i]);
}


Measured memory_bytes: 7808
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <iterator>
using namespace std;

#define SIZE 100010

int arr[SIZE];

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

    int num, t;
    while (cin >> num >> t)
    {
        for (int i = 0; i < num; i++)
        {
            cin >> arr[i];
        }

        long long int pfxSum = 0;
        int maxNum = -1;
        for (int i = 0; i < num; i++)
        {
            pfxSum += arr[i];
            maxNum = max(maxNum, arr[i]);

            if (t < pfxSum)
                cout << 1 << endl;
            else
                cout << (t - pfxSum) / maxNum + 2 << endl;
        }
    }

    return 0;
}


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


int main(){
    char a,b;
    string s;
    cin >> a >> b;
    if (a < b) cout << "<" << endl;
    else if (a == b) cout << "=" << endl;
    else cout << ">" << endl;

    return 0;
}

Measured memory_bytes: 256
import math
import copy
from queue import Queue
import heapq
import numpy as np

MOD = 5000000007

n = int(input())
#b = int(input())
#a, b, k = [int(i) for i in input().split()]
#table = [[int(i)  for i in input().split()] for j in range(m)]
#table = [list(input()) for n in range(r)] #table[h][w]
#p = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#p = [int(input()) for i in range(m)]
#s = input()

#list = list(s)
#dp = [MOD for _ in range(m)]
#dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
#dp = [[[0 for _ in range(11)] for _ in range(2)] for _ in range(11)]

#Combination = [[0 for _ in range(n+1)] for _ in range(n+1)]
#b = [[0 for _ in range(n+1)] for _ in range(n+1)]

i = int(math.floor(math.sqrt(n)))
a = 0
b = 0
while(i > 0):
    if(n % i == 0):
        a = int(math.floor(math.log(i,10)))+1
        b = int(math.floor(math.log(n // i,10)))+1
        break
    i = i - 1

if(a > b) :
    print(a)
else:
    print(b)

Measured memory_bytes: 12420
s = input()

ans = 0
n = len(s) - 1
for i in range(2 ** n):
    op = [''] * n
    for j in range(n):
        if ((i >> j) & 1):
            op[n - j - 1] = '+'
    formula = ''
    for p_n, p_o in zip(s,op+['']):
        formula += (p_n+p_o)
    ans += eval(formula)

print(ans)


Measured memory_bytes: 3060
S=input()
if S=="SUN":
  print(7)
elif S=="SAT":
  print(1)
elif S=="MON":
  print(6)
elif S=="TUE":
  print(5)
elif S=="WED":
  print(4)
elif S=="THU":
  print(3)
else:
  print(2)


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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

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

	int a, b;
	cin >> a >> b;

	for (int i = 1; i <= 100000; ++i) {
		if ((i * 8) / 100 == a && (i * 10) / 100 == b) {
			cout << i << '\n';
			return 0;
		}
	}
	cout << "-1\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define vll vector<ll>
#define vi vector<int>
#define vvll vector<vll>
#define wh(t) while(t--)
#define fi(n) for(ll i = 0; i < n; i++)
#define fj(n) for(ll j = 0; j < n; j++)
#define fu(i,s,e) for(ll i = s; i <=e; i++)
#define fd(i,s,e) for(ll i = s; i >=e; i--)
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define fr first
#define se second
#define sll stack<ll>
#define qll queue<ll>
using namespace std;
const ll M = 1e9+7;
//const ll M = 998244353;

ll pmp(ll x,ll n){ll a = 1;while(n > 0){if(n & 1) a = (a * x)%M;x = (x * x)%M;n = n>>1;}return a;}

void solve(){
	ll x;
	cin >>x;
	x = x/(__gcd(x,7LL));
	vll v(x);
	ll s = 1;
	ll ans = 1;
	s%=x;
	while(1){
		if(!v[s] && s== 0){
			break;
		}
		if(v[s]){
			ans = -1; break;
		}
		v[s]=1;
		s*=10;
		s%=x;
		s++;s%=x;
		ans++;
	}
	cout << ans << endl;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif
	ll t;
	t = 1;
	// cin >> t;
	wh(t){
		solve();
	}
	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
	return 0;
}

Measured memory_bytes: 11080
function main(arg) {
	arg = arg.trim().split('\n');
  	arg = arg.map(str => parseInt(str, 10));
  	var a = arg[0], b = arg[1];
	var num = [1, 2, 3];
	var out = num.filter(o => o !== a && o != b);
	console.log(out[0]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
n=int(input())
ans=0
count=0
s={}
t={}
for i in range(n):
  a=input()
  if a not in s:
    s[a]=1
  else:
    s[a]+=1
m=int(input())
for i in range(m):
  a=input()
  if a not in t:
    t[a]=1
  else:
    t[a]+=1
    
S=list(s.keys())
T=list(t.keys())
for i in range(len(S)):
  if S[i] in T:
    count=s[S[i]]-t[S[i]]
  else: count=s[S[i]]
  ans=max(ans,count)
  
print(ans)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
using P = pair<int, int>;
typedef long long ll;

vector<int> to[100000];

int main() {
    int N, M;
    cin >> N >> M;
    REP(i, M){
        int a, b;
        cin >> a >> b;
        --a;
        --b;    //最初をゼロにするために1個ずらしている

        to[a].push_back(b);
        to[b].push_back(a);
    }

    queue<int> q;
    vector <int> dist(N, INF);  //N個を全INFで初期化
    vector <int> pre(N, -1);    //N個を全-1で初期化
    dist[0] = 0;

    q.push(0);
    while (!q.empty()){
        int v = q.front();
        q.pop();    //先頭の削除

        for (int u: to[v]){
            if (dist[u] != INF) continue;
            dist[u] = dist[v] + 1;
            pre[u] = v;
            q.push(u);
        }
    }

    cout << "Yes" << endl;
    REP(i, N){
        if (i == 0) continue;
        int ans = pre[i];
        ++ans;
        cout << ans << endl;
    }
    return 0;    
}

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

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

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int ctoi(char c) {
  return c - '0';
}

template <class C>
void printContainer(C &container, const char *delim=",") {
  for(const auto &e : container) {
    std::cout << e << delim;
  }
  std::cout << "\n";
}

// Greatest common divisor
template<class T>
T gcd(T x, T y) {
  if(x < y) {
    std::swap(x, y);
  }
  T r = x % y;
  while(r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

// Least common multiple
template<class T>
T lcm(T x, T y) {
  return (x*y)/gcd(x,y);
}

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
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int N;
Vl B;
Vl csum;

ll fun(ll b) {
    int idx = lower_bound(B.begin(), B.end(), b) - B.begin();
    ll res = b * (idx * 2 - N) + csum[N] - csum[idx] * 2;
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    B.resize(N);
    csum.resize(N + 1);
    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        B[i] = a - (i + 1);
    }
    sort(B.begin(), B.end());
    for (int i = 0; i < N; i++) {
        csum[i + 1] = csum[i] + B[i];
    }

    ll t0, t1, t2, t3;
    t0 = -1e9, t3 = 1e9;
    while (t3 - t0 > 2) {
        t1 = (t0 * 2 + t3) / 3;
        t2 = (t0 + t3 * 2) / 3;

        ll f1 = fun(t1);
        ll f2 = fun(t2);

        if (f1 <= f2) {
            t3 = t2;
        }
        else {
            t0 = t1;
        }
    }

    cout << min(fun(t0), min(fun(t0 + 1), fun(t0 + 2))) << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 5100000;

long long fac[MAX], finv[MAX], inv[MAX];

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

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

int main(){
  int n; cin >> n;
  vector<double> x(n);
  rep(i, n) cin >> x[i];
  double ave = 0;;
  rep(i,n) ave += x[i];
  ave /= double(n);
  int num1 = int(ave);
  int num2 = num1+1;
  int ans = 1e9;
  int sum = 0;
  rep(i,n) sum += (x[i]-num1)*(x[i]-num1);
  chmin(ans, sum);
  
  sum = 0;
  rep(i,n) sum += (x[i]-num2)*(x[i]-num2);
  chmin(ans, sum);

  cout << ans << endl;

}


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define                          ll                          long long int
ll gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}

#define                          in(x)                       scanf("%lld",&x)
#define                          in2(x,y)                    scanf("%lld %lld",&x,&y)
#define                          in3(x,y,z)                  scanf("%lld %lld %lld",&x,&y,&z)
#define                          out(x)                      printf("%lld\n",x)
#define                          cy                          printf("YES\n")
#define                          cn                          printf("NO\n")
#define                          inf                         1e18
#define                          neg                         -1e18
#define                          mx                          2111111
#define                          fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define                          fi                          frist
#define                          si                          second
#define                          ce                          cout<<endl
#define                          pb                          push_back
#define                          vc(x)                       x.begin(),x.end()
#define                          pb                          push_back
#define                          pi                          pair<ll,ll>
#define                          debug                       printf("ok\n");
#define                          pg                          pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> >



int main(){
    fast
  ll test  ;
  ll n,m;
  in2(n,m);
  if(n==m)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}



Measured memory_bytes: 3788
#include<stdio.h>
#include<string.h>

typedef struct proces{
  char eee[10];
  int rrr;
  int time;
}def;

int head,n,ta;
def o[100000];

void aaa(def s){
  o[ta]=s;
  ta=(ta+1)%100000;
}

def deq(){
  def sd=o[head];
  head=(head+1)%100000;
  return sd;
}

int min(int k,int l){
  if(k>l) return l;
  else return k;
}

int main(){
  int tasu,i,q,b,sum=0;
  def type;
  scanf("%d %d",&b,&q);
  for(i=1;i<=b;i++){
    scanf("%s",o[i].eee);
    scanf("%d",&o[i].time);
    o[i].rrr=1;
  }
  head=1;
  ta=b+1;
  while(ta != head){
    type=deq();
    tasu=min(q,type.time);
    type.time=type.time-tasu;
    sum=sum+tasu;
    if(type.time>0){
      aaa(type);
    }
    else if(type.rrr==1){
      printf("%s %d\n",type.eee,sum);
      type.rrr=0;
    }
  }
  return 0;
}





Measured memory_bytes: 3640
#include<cstdio>
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdlib>

using namespace std;

vector<string> res;
int flag[50],flag2[50],flag3[50],len;
string str;
void Enc(int x){
		if(x==-1){
			for(int i=0;i<26;i++)if(flag[i]>=1 && flag3[i]==0)return;
			res.push_back(str);
		}
		else{
			if(str[x]<'z' && flag3[str[x]+1-'a']==0){
				str[x]++;
				flag2[str[x]-'a']=1;
				flag3[str[x]-'a']=1;
				Enc(x-1);
				flag3[str[x]-'a']=0;
				flag2[str[x]-'a']=0;
				str[x]--;
			}
			if(flag2[str[x]-'a']>=1)return;
			if(str[x]>'a'){
				flag[str[x]-'a']++;
				Enc(x-1);
				flag[str[x]-'a']--;
			}else Enc(x-1);
		}
}

int main(void){
	while(1){
		cin >> str;
		if(str=="#")break;
		res.clear();
		len=str.size();
		memset(flag,0,sizeof(flag));
		memset(flag2,0,sizeof(flag2));
		memset(flag3,0,sizeof(flag3));
		Enc(len-1);
		printf("%d\n",res.size());
		sort(res.begin(),res.end());
		if(res.size()<=10)for(int i=0;i<res.size();i++)cout << res[i] << endl;
		else{
			for(int i=0;i<5;i++)cout << res[i] << endl;
			for(int i=res.size()-5;i<res.size();i++)cout << res[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2376
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int min = 2147483647;
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int x = scanner.nextInt();
		int y = scanner.nextInt();
		int max = 0;
		if (x > y) {
			max = x;
		} else {
			max = y;
		}

		min = a * x + b * y;

		for (int i = 1; i <= max; i++) {
			if (i > x) {
				if (min > (2 * c * i) + (y - i) * b) {
					min = (2 * c * i) + (y - i) * b;
				}
			} else if (i > y) {
				if (min > (2 * c * i) + (x - i) * a) {
					min = (2 * c * i) + (x - i) * a;
				}
			} else if (min > (2 * c * i) + (x - i) * a + (y - i) * b) {
				min = (2 * c * i) + (x - i) * a + (y - i) * b;
			}

		}

		System.out.println(min);
	}
}


Measured memory_bytes: 21588
#include<iostream>
#include<algorithm>

using namespace std;

int a[5];

bool st(){
	int i=a[0];
	if((a[1]==i+1&&a[2]==i+2&&a[3]==i+3&&a[4]==i+4)||(i==1&&a[1]==10&&a[2]==11&&a[3]==12&&a[4]==13)){
		return 1;
	}
	return 0;
}

void f(int a,int b,int c){
	if(c)cout<<"four card\n";
	else if(a&&b)cout<<"full house\n";
	else if(b)cout<<"three card\n";
	else if(a==2)cout<<"two pair\n";
	else if(a)cout<<"one pair\n";
	else cout<<"null\n";
}

int main(){
	while(~scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])){
		sort(a,a+5);
		if(st())cout<<"straight\n";
		else{
			int num[14],pair=0,three=0,four=0;
			for(int i=1;i<14;i++)num[i]=0;
			for(int i=0;i<5;i++)num[a[i]]++;
			for(int i=1;i<14;i++){
				if(num[i]==2)pair++;
				else if(num[i]==3)three++;
				else if(num[i]==4)four++;
			}
			f(pair,three,four);
		}
	}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long


int main(void){
    int N,Ma,Mb;
    scanf("%d %d %d",&N,&Ma,&Mb);
    int A[50],B[50],C[50];
    rep(i,N){
        scanf("%d %d %d",&A[i],&B[i],&C[i]);
    }
    //Asum*Mb-Bsum*Ma=0
    vector< pair<int, int> > H1;
    vector< pair<int, int>  > H2;
    rep(i,1<<(N/2)){ //0...N/2-1 (N/2)
        int ABh=0,Ch=0;
        rep(j,N/2){
            ABh+=Mb*A[j]*( (i>>j)%2 );
            ABh-=Ma*B[j]*( (i>>j)%2 );
            Ch+=C[j]*( (i>>j)%2 );
        }
        H1.pb(mp(ABh,Ch ) );
    }
    rep(i,1<<(N-N/2) ){//N/2...N-1 (N-N/2)
        int ABh=0,Ch=0;
        rep(j,(N-N/2)){
            ABh+=Mb*A[j+N/2]*( (i>>j)%2 );
            ABh-=Ma*B[j+N/2]*( (i>>j)%2 );
            Ch+=C[j+N/2]*( (i>>j)%2 );
        }
        H2.pb(mp(ABh,Ch) );
    }
    sort(H1.begin(),H1.end());sort(H2.begin(),H2.end());
    int ans=1001001001;
    rep(i,H1.size()){
        int ite=lower_bound(H2.begin(),H2.end(),mp(-H1[i].first,-1) )-H2.begin();
        if(ite<H2.size()&&H1[i].second+H2[ite].second!=0&&H1[i].first+H2[ite].first==0){
            ans=min(ans,H1[i].second+H2[ite].second);
        }
        if(ite+1<H2.size()&&H1[i].second+H2[ite+1].second!=0&&H1[i].first+H2[ite+1].first==0){
            ans=min(ans,H1[i].second+H2[ite+1].second);
        }
    }
    if(ans==0||ans==1001001001)printf("%d\n",-1);
    else printf("%d\n",ans);
}


Measured memory_bytes: 22120
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int N,A,B;
  cin>>N>>A>>B;
  vector<int> first,second,last;
  for(int i=0;i<N;i++){
    int p;
    cin>>p;
    if(p<=A){
      first.push_back(p);
    }
    else if(p<=B){
      second.push_back(p);
    }
    else{
      last.push_back(p);
    }
  }
  cout<<min(first.size(),min(second.size(),last.size()));
}

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

using namespace std;

#define INPUT  "input.txt"
#define OUTPUT "output.txt"
#define ll long long
#define ld long double

void fileio()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	if (fopen(INPUT, "r")){
		freopen(INPUT, "r", stdin);
		freopen(OUTPUT, "w", stdout);
	}
}

int N;

int main() {
    fileio();

    cin >> N;
    if (N <= 999) cout << "ABC";
        else cout << "ABD";

    return 0;
}


Measured memory_bytes: 256
//
//  second.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000


int main()
{
    string N;
    int K;
    cin >> N >> K;
    
    ll ret=0;
    
    //int dig = log10(N); // 桁数-1
    int dig = (int)N.size()-1; // 桁数-1
    
    if(K==1){
        // ret += 9*dig + N/pow(10,dig);
        ret += 9 * dig + (N[0]-'0');
        cout << ret << endl;
        
    } else if(K==2){
        /* for(int i=0;i<dig;i++){
            ret += ( N / (int)pow(10,i) ) % 10;
        } */
        
        int nonzero=0;
        for (int i=1; i <= dig; i++) {
            if (nonzero) {
                ret += 9;
            } else if (N[i]-'0' != 0){
                ret += N[i]-'0';
                nonzero = 1;
            }
        }
        
        int head = N[0]-'0';
        ret += (head-1) * 9 * dig;
        
        int comb = dig*(dig-1)/2;
        ret += comb * 9 * 9;
        
        cout << ret << endl;
        
    } else{
        int comb = dig*(dig-1)*(dig-2)/3/2;
        int comb2 = dig*(dig-1)/2;
        int head = N[0]-'0';
        
        
        ret += comb * 9 * 9 * 9;
        ret += (head-1) * comb2 * 9 * 9;
        
        int fnz=INF,snz=INF; // firstnonzero,second
        for (int i=1; i<=dig; i++) {
            if(N[i]-'0' != 0){
                fnz = i;
                break;
            }
        }
        if(fnz < dig){
            for (int i=fnz+1; i<=dig; i++) {
                if(N[i]-'0' != 0){
                    snz = i;
                    break;
                }
            }
        }
        
        for (int i=1; i <= dig-1; i++) {
            for (int j=i+1; j <= dig; j++) {
                if(i == fnz && j == snz){
                    ret += (N[i]-'0' - 1) * 9;
                    ret += N[j]-'0';
                } else if(i == fnz && j > snz){
                    ret += (N[i]-'0') * 9;
                } else if(i > fnz){
                    ret += 9 * 9;
                }
            }
        }
        
        cout << ret << endl;
        
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;
const int INF = 1 << 30;
const lint SB = 0;
const lint MAX = 1e9;

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

    lint x1 = 0, y1 = 0;
    lint x2 = MAX, y2 = 1, x3 = (MAX - (S % MAX)) % MAX, y3 = (S+x3) / MAX;

    printf("%lld %lld %lld %lld %lld %lld\n", x1-SB, y1-SB, x2-SB, y2-SB, x3-SB, y3-SB);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
 vector<int> vi[maxii];
 vector<int>:: iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
bool check[maxii];

bool dfs(int node,int c)
{
    check[node]=true;
    arr2[node]=c;
    for(int child=0;child<vi[node].size();child++)
    {
        if(check[vi[node][child]]==false)
        {
            if(dfs(vi[node][child],c^1)==false)
            {
                return false;
            }
        }
        else if(arr2[node]==arr2[vi[node][child]])
        {
            return false;
        }
        //else if()
    }
    return true;
}

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int res1=(a+b)*c;
    res1/=2;
    cout<<res1;

}






Measured memory_bytes: 5952
long long t[21][2],a,d;int main(b){for(scanf("%d%d",&a,&b);d<21;d++)t[d][a&1]=!(b-d);for(;--a-1&&scanf("%d",&b);)for(d=0;d<21;t[d++][a&1]=((b>d?0:t[d-b][!(a&1)])+((b<(21-d))?t[b+d][!(a&1)]:0)));scanf("%d",&b),a=!printf("%lld\n",t[b][0]);}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))
even = [A[i] for i in range(N) if A[i] % 2 == 0]
for i in range(len(even)):
    if(even[i]% 3 != 0 and even[i]% 5 != 0):
        print("DENIED")
        exit()
print("APPROVED")


Measured memory_bytes: 38536
S = [input() for i in range(2)]
I = S[0].split()
N = int(I[0])
M = int(I[1])
A = list(map(int,S[1].split()))
# print(N)
# print(M)
# print(A)
D = N - sum(A)
if D < 0 :
    D = -1 
print(D)

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

vector<string> bubbleSort(vector<string> A, int N) {
    bool flg = true;
    while (flg) {
        flg = false;
        for (int i = N - 1; 1 <= i; i--) {
            int a1 = (int) A[i][1];
            int a2 = (int) A[i-1][1];
            if (a1 < a2) {
                swap(A[i], A[i-1]);
                flg = true;
            }
        }
    }
    return A;
}

vector<string> selectionSort(vector<string> A, int N) {
    for (int i = 0; i < N; i++) {
        int minj = i;
        for (int j = i; j < N; j++) {
            int a1 = (int) A[j][1];
            int a2 = (int) A[minj][1];
            if (a1 < a2) {
                minj = j;
            }
        }
        if(i != minj){
            swap(A[i], A[minj]);
        }
    }
    return A;
}

int main() {

    int n;
    cin >> n;

    vector<string> A(n);
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    vector<string> a1 = bubbleSort(A, n);

    for (int i = 0; i < n; i++) {
        cout << a1[i];
        if (i != n - 1) {
            cout << " ";
        }
    }
    cout << endl;
    cout << "Stable" << endl;

    vector<string> a2 = selectionSort(A, n);

    bool flg = true;

    for (int i = 0; i < n; i++) {
        if (a1[i] != a2[i]) {
            flg = false;
        }
        cout << a2[i];
        if (i != n - 1) {
            cout << " ";
        }
    }
    cout << endl;

    if (flg) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;

}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    ll a,b,c,d; cin >> a >> b >> c >> d;
    ll ans = max(a*c, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int i,N,ans;
cin >> N;
vector <int> p(N);
for(i=0;i<N;i++){
    cin >> p[i];
}
ans = 0;
for(i=0;i<N-1;i++){
if(p[i]==i+1){
    p[i+1]=p[i];
    ans +=1;
    }
}
if(p[N-1]==N){
    ans += 1;
}
cout << ans << endl;
}

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

using namespace std;

int main(){
	int a,b,count=0;
	cin >> a >> b;
	if(a==b){}
	else if(a==0 || b==0){if(a>0 || b<0){count++;}count+=abs(b-a);}
	else if(-1*a==b){count++;}
	else if(a<b && (a>0 || b<0)){count=b-a;}
	else if(b<a && (b>0 || a<0)){count=abs(a-b)+2;}
	else{count=abs(a+b)+1;}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define line cout<<endl;
#define space cout<<" ";
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int ll;

using namespace std;

const int N = 1e9+7;





int main()
{
    fast;
    ll n,q,x,y,z;
    cin>>n;
    int a[100007] =  {};
    ll sum = 0;
    for(int i=0;i<n;i++)
    {
        cin>>z;
        sum+=z;
        a[z]++;
    }
    cin>>q;
  //  cout<<sum; line;
    for(int i=0;i<q;i++)
    {
        cin>>x>>y;

        sum = sum - x*a[x];
       // cout<<"sum after subtraction: "<<sum; space;
        sum+=y*a[x];
       // cout<<"sum after addition: "<<sum; line;
        a[y]+=a[x];
        a[x] = 0;

        cout<<sum; line;
    }
}




Measured memory_bytes: 4000
#include<stdio.h>

char s[100001],t[100001];
long sn[100000][2],tn[100000][2];

int main(int argc, char const *argv[]){
	long q,i,a,b,c,d,an,bn,cn;
	scanf("%s",s);
	scanf("%s",t);
	scanf("%ld",&q);
	if(s[0]=='A') sn[0][0]=1;
	else sn[0][1]=1;
	if(t[0]=='A') tn[0][0]=1;
	else tn[0][1]=1;
	for(i=1;s[i]!='\0';i++){
		sn[i][0]=sn[i-1][0];
		sn[i][1]=sn[i-1][1];
		if(s[i]=='A') sn[i][0]++;
		else sn[i][1]++;
	}
	for(i=1;t[i]!='\0';i++){
		tn[i][0]=tn[i-1][0];
		tn[i][1]=tn[i-1][1];
		if(t[i]=='A') tn[i][0]++;
		else tn[i][1]++;
	}
	for(i=0;i<q;i++){
		scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
		a-=2;
		b--;
		c-=2;
		d--;
		an=sn[b][0]-((a<0)?0:sn[a][0])+300000;
		bn=sn[b][1]-((a<0)?0:sn[a][1]);
		cn=(an-bn)%3;
		an=tn[d][0]-((c<0)?0:tn[c][0])+300000;
		bn=tn[d][1]-((c<0)?0:tn[c][1]);
		if(cn==(an-bn)%3) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 3840
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= 9; j++) {
				if (n == i * j) {
					System.out.println("Yes");
					return;
				}
			}
			sc.close();
		}
		System.out.println("No");

	}
}

Measured memory_bytes: 35620
import math

N = int(input())
R = [int(input().strip()) for _ in range(N)]

maxv = -math.inf
minv = R[0]
for i in range(1, N):

    tmp_maxv = R[i] - minv # 差額をセットする
    # 現在の最大差額と差額の大きい方を最大差額にする
    if maxv < tmp_maxv:
        maxv = tmp_maxv

    # 現在値が最小なら、最小値を更新する
    if R[i] < minv:
        minv = R[i]

print(maxv)


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

int main() {
    vector<char> n(4);  //4桁
    for (int i = 0; i < 4;i++){
        cin >> n.at(i);
    }
    if (n.at(0)==n.at(1)&&n.at(1)==n.at(2)) {
        cout << "Yes";
    }
    else if (n.at(1) == n.at(2) && n.at(2) == n.at(3)){
        cout << "Yes";
    }
    else {
        cout << "No";
    }
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  ll n,m; cin>>n;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //string s; cin >> s;
  ll result = 0;
  bool judge = true;
  unordered_map<string,ll> p;
  string buf;
  for(i=0;i<n;i++){
    cin >> buf;
    if(p.find(buf)==p.end()){
      p.insert(MP(buf,1));
    }
    else{
      p[buf]++;
    }
  }
  
  cin>>m;
  for(i=0;i<m;i++){
    cin >> buf;
    if(p.find(buf)==p.end()){
      p.insert(MP(buf,-1));
    }
    else{
      p[buf]--;
    }
  }

  for(auto itr=p.begin();itr!=p.end();itr++){
    chmax(result,itr->second);
  }
  
  cout<<result<<endl;

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(i=0;i<n;i++){

  }
  */

  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9+7

"""
各辺を独立して組み合わせて良い。
どのxの辺もすべてのyの辺をかけて合計することから、
分配法則を適用して
ans = (xの取りうる辺の総和)x(yの取りうる辺の総和)
となる
したがって、各辺の総和を効率的に求められれば良い
一旦xに着目し、各点の組合せでできる辺の総和を求める。
ここで、x_iとx_i+1の区間は他の辺の部分としてカウントされる回数は
(i+1)*(n-i-1) 0-indexed
したがって、差数列に回数を畳みこんで辺の総和が求まる
yも同様に総和を求め、積を取れば良い
"""

x_diff = [x[i]-x[i-1] for i in range(1, n)]
y_diff = [y[i]-y[i-1] for i in range(1, m)]

x_sum = 0
for i, dx in enumerate(x_diff):
    x_sum = (x_sum + (dx * (i+1) * (n-i-1))%mod)%mod
y_sum = 0
for i, dy in enumerate(y_diff):
    y_sum = (y_sum + (dy * (i+1) * (m-i-1))%mod)%mod

print((x_sum*y_sum)%mod)




Measured memory_bytes: 25452
import itertools
h, w=map(int, raw_input().split())
n=input()
a=list(itertools.chain(*[[c+1]*a for c, a in enumerate(map(int, raw_input().split()))]))
for i in xrange(h):
	for j in xrange(w):
		print a[i*w+j if i%2==0 else (i+1)*w-j-1],
	print

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

int main() {
	int n;cin>>n;
	string s;cin>>s;
	for(int i=0;i<s.size();i++){
		s[i]=(s[i]+n-'A')%26+'A';
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
ll a[(int)1e5 + 5];
int  main(){
    int n, deg = 0;
    ll k;
    scanf("%d%lld",&n,&k);
    for(int i =1;i<=n;i++){
        scanf("%lld",&a[i]);
        ll x = a[i];
        int ct = 0;
        while((x & 1) == 0) x>>=1, ct++;
        if(deg == 0) deg =ct;
        else if(deg != ct) return !printf("0");
        a[i] >>= 1;
    }
    ll lcm = a[1];
    for(int i = 2;i <= n;i++){
        ll x = __gcd(lcm, a[i]);
        lcm = lcm / x * a[i];
        if(lcm > k) return !printf("0");
    }
    ll ans = k / lcm;
    printf("%lld",ans/2 + (ans%2));


}


Measured memory_bytes: 1024
/*

宣告——
汝身在我之下，托付吾之命运于汝之剑，
遵从圣杯之名，若汝遵从此意志此理，回应吧。
在此起誓，吾是成就世间一切行善之人，吾是肃清世间一切罪恶之人，
被狂乱之槛所囚的囚徒。吾是此锁链的操纵者，
汝为身缠三大言灵之七天，从抑止之轮显现吧，天秤之守护者！

*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cassert>
using namespace std;
inline int read(){
	int re=0,flag=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(isdigit(ch)) re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
int tot,n,a[200010],aa[200010];
int main(){
	tot=read();n=read();int i,pos1=0,pos2=0,cnt=1;
	for(i=1;i<=n;i++){
		a[i]=read();
		if(a[i]&1){
			if(pos2){puts("Impossible");return 0;}
			if(pos1) pos2=i;
			else pos1=i;
		}
	}
	if(!pos1){
		for(i=1;i<=n;i++) aa[i]=a[i];
	}
	else{
		for(i=1;i<=n;i++){
			if(i==pos1) aa[1]=a[i];
			else if(i==pos2) aa[n]=a[i];
			else aa[++cnt]=a[i];
		}
	}
	if(n==1){
		cout<<a[1]<<'\n';
		if(a[1]==1) puts("1\n1");
		else printf("2\n%d %d\n",a[1]-1,1);
		return 0;
	}
	for(i=1;i<=n;i++) printf("%d ",aa[i]);
	puts("");
	aa[1]++;aa[n]--;if(aa[n]==0) n--;
	printf("%d\n",n);
	for(i=1;i<=n;i++) printf("%d ",aa[i]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
const ll MOD = 1000000007;
const int MAXM = 10000;
 
int n, m, r, q;
vector<pair<int, int> > logs[MAXM + 1];
 
 
int solve(int sta, int end, int stu){
    sort(logs[stu].begin(), logs[stu].end());
    int cnt = 0, left = 0, res = 0;
    for(pair<int, int> p: logs[stu]){
        if(p.second == 1){
            // login
            if(cnt == 0){
                left = p.first;
            }
            cnt++;
        }else{
            // logout
            cnt--;
            if(cnt == 0){
                res += max(min(end, p.first) - max(sta, left), 0);
            }
        }
    }
    return res;
}
 
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    while(1){
        cin >> n >> m;
        if(n == 0 && m == 0) break;
        cin >> r;
        for(int i=0;i<r;i++){
            int tt, tn, tm, ts;
            // time, PC, student, login or logout
            cin >> tt >> tn >> tm >> ts;
            logs[tm].push_back(make_pair(tt, ts));
        }
        cin >> q;
        for(int i=0;i<q;i++){
            int sta, end, stu; cin >> sta >> end >> stu;
            cout << solve(sta, end, stu) << endl;
        }
        for(int i=1;i<m;i++){
            logs[i].clear();
        }
    }
}


Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>

int main() {
    string S;
    long long K;
    cin >> S >> K;
    string SS = S + S;
    vector<int> X(210,0);
    long long  flag = -1;
    long long x = 1;
    long long point = 0;
    for(int i=1;i<SS.size();i++){
        if(SS[i-1] == SS[i]){
            x += 1;
            if(i == S.size()){
                flag = point;
            }
            
        }
        
        else{
            X[point] = x;
            point += 1;
            x = 1;
        }  
        if(i == SS.size()-1){
            X[point] = x;
        }
    }
    long long ans = 0;
    if(flag > 0){
        ans += X[0]/2;
        for (int i=1; i<X.size()-1;i++){
            if(X[i+1]==0){
                ans += X[i]/2;
                break;
            }
            else if(i<flag){
                ans += (X[i] / 2) * K;
            }
                
            else if(i == flag){
                ans += (X[i]/2) * (K-1);
            }
            else{
                continue;
            }
        }
    }
    else if (flag == 0){
        ans = S.size() * K /2;
    }
    else{
       for (int i=0; i<X.size();i++){
           if(X[i]==0){
                break;
            }
            else{
                ans += (X[i] / 2) * K;
            }
       }
       ans /= 2;
    }
    
    cout << ans << endl;
} 



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int long long
 
// loop
#define FOR(i, a, b) for (int i = (a); i < (b); i++) 	// a ~ b-1	(ascending)
#define REP(i, n) FOR(i, 0, n)							// 0 ~ n-1
#define NREP(i, n) FOR(i, 1, n + 1)						// 1 ~ n
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)	// a ~ b	(descending)
#define RREP(i, n) RFOR(i, n, 0)						// n ~ 0
#define RNREP(i, n) RFOR(i, n, 1)						// n ~ 1
 
// container operation
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ASORT(c) std::sort((c).begin(), (c).end())
#define DSORT(c) std::sort((c).begin(), (c).end(), std::greater<typeof((c).front())>())
#define SIZE(x) ((int)(x).size())
 
// debug
#define check(x) std::cout << #x << " = " << x << '\n'
 
// print
#define cout(x) std::cout << x << '\n'
 
// typedef
typedef std::vector<int> VI;
typedef std::vector<VI> VII;
typedef std::vector<std::string> VS;

std::string yes = "Yes\n";
std::string no = "No\n";

void solve();

signed main() {
  solve();
  return 0;
}

void solve() {
  int a, b, c;
  std::cin >> a >> b >> c;
  int max = std::max(a, std::max(b, c));
  if (a == max) {
    cout(b*c/2);
  } else if (b == max) {
    cout(c*a/2);
  } else {
    cout(a*b/2);
  }
}

Measured memory_bytes: 256