akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}


int main() {
    int bingo[3][3];
    for(int i = 0; i < 3;++i){
        for(int j = 0;j < 3;++j){
            cin >> bingo[i][j];
        }
    }
    int z; cin >> z;
    int x;
    for(int i = 0;i < z;++i){
        cin >> x;
        for(int j = 0;j < 3;++j){
            for(int k = 0;k < 3;++k){
                if(bingo[j][k] == x){
                    bingo[j][k] = 0;
                }
            }
        }
    }
    int cnt = 0;
    
    for(int i = 0;i < 3;i++){
        cnt = 0;
        for(int j = 0;j < 3;j++){
            if(bingo[i][j] == 0) {
                cnt++;
            }
        }
        if(cnt == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    for(int i = 0;i < 3;i++){
        cnt = 0;
        for(int j = 0;j < 3;j++){
            if(bingo[j][i] == 0) {
                cnt++;
            }
        }
        if(cnt == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    //ななめ
    if(bingo[0][0] == 0 && bingo[1][1] == 0 && bingo[2][2] == 0){
        cout << "Yes" << endl;
        return 0;
    }
    
    if(bingo[0][2] == 0 && bingo[1][1] == 0 && bingo[2][0] == 0){
        cout << "Yes" << endl;
        return 0;
    }
    
    cout << "No" << endl;
}




Measured memory_bytes: 256
main = do
  li <- getLine
  let n = read li
  li <- getLine
  let as = map read $ words li
  let ans = compute n as
  print ans

compute :: Int -> [Int] -> Int
compute n as = let m = loop 0 1 as in if n > m then m else -1

loop :: Int -- 砕く数カウント
     -> Int -- 次に現れてほしい数
     -> [Int] -- レンガ
     -> Int
loop c _ [] = c
loop c x (a:as)
  | x == a = loop c (succ x) as
  | True   = loop (succ c) x as


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

typedef long long LL;
typedef unsigned long long ULL;

#define debug printf("fuck %d\n", __LINE__);

inline LL read() {
	LL res = 0, bo = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') bo = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		res = (res << 1) + (res << 3) + ch - '0';
		ch = getchar();
	}
	return bo * res;
}

template <typename T>
void read(T &x) {
	x = read();
}

template <typename T, typename... Argv>
void read(T &a, Argv &... argv) {
	read(a);
	read(argv...);
}

int T, A, B, C, D, k;

bool check(int mid) {
	int a = A - mid / (k + 1) * k - mid % (k + 1);
	int b = B - mid / (k + 1);
	return b <= 1LL * a * k;
}

int main() {
	T = read(), A, B, C, D, k;
	for (; T-- > 0;) {
		read(A, B, C, D);
		k = (A + B) / (std::min(A, B) + 1);
		int l = 0, r = A + B;
		while (l < r) {
			int mid = (l + r) >> 1;
			if (check(mid)) l = mid + 1;
			else r = mid;
		}
		int a = A - l / (k + 1) * k - l % (k + 1);
		int b = B - l / (k + 1);
		r = l + 1 + b - a * k;
		for (int i = C; i <= D; ++ i) {
			if (i <= l) {
				if (i % (k + 1) == 0) putchar('B');
				else putchar('A');
			} else {
				if ((i - r) % (k + 1) == 0) putchar('A');
				else putchar('B');
			}
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 384
import itertools
n = int(input())
a = list(map(int,input().split()))
b = [[0] * 3 for i in range(n)]
for i in range(n):
    b[i][0] = a[i] - 1
    b[i][1] = a[i]
    b[i][2] = a[i] + 1
c = list(itertools.product(*b))
cnt = 0
for i in range(len(c)):
    x = c[i][0]
    for j in range(1, n):
        x = x * c[i][j]
    if x % 2 == 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 17036
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi a;

int main(){
	cin>>n;
	a=vi(n);
	ll x=0,y=0,z=0;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++){
		int A;
		cin>>A;
		a[i]-=A;
		x-=a[i];
		if(a[i]<0) z-=a[i]/2;
		else y+=a[i];
	}
	if(x>=0&&y<=z) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {


    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        pw.println(c+" "+a+" "+b);
        pw.flush();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }

}

Measured memory_bytes: 22996
n = int(input())
h = list(map(int, input().split()))
current_max = 0
for i in range(n):  
  if current_max > h[i] + 1:
    print("No")
    break
  else: 
    current_max = max(current_max, h[i])
    if i == n-1:
      print("Yes")


Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int a,b;
	cin >> a >> b;
	rep(i,0,100000){
		if((i*8)/100 == a && (i*10)/100 == b){
			cout << i << '\n';		
			return 0;
		}
	}
	cout << -1 << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		long ans =0;;
		for (int i=1; i<=n; i++){
			ans += (n-1) / i;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 35732
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
 
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<int> a(n),b(n);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    for(i=0; i<n; i++) {
        scanf("%d", &b[i]);
    }

    ll ans=LINF;
    int m=(n+1)/2;
    int k;
    for(k=0; k<((ll)1<<n); k++) {
        int cnt=0;
        for(i=0; i<n; i++) {
            if(k & ((ll)1<<i)) cnt++;
        }
        if(cnt!=m) continue;

        vector<pair<int,int> > v0, v1;    // v0: 0,2,4,..番目に移動したものの値と元indexのペア
                                          // v1: 1,3,5,..番目に移動したものの値と元indexのペア
        vector<pair<int,int> > v(n);      // v : 移動先の配列の、値と元indexのペア

        for(i=0; i<n; i++) {
            if(k & ((ll)1<<i)) {
                v0.push_back(make_pair((i%2==0? a[i]: b[i]),i));
            }
            else {
                v1.push_back(make_pair((i%2==0? b[i]: a[i]),i));
            }
        }
        sort(v0.begin(),v0.end());
        sort(v1.begin(),v1.end());

        for(i=0; i<m; i++) {
            v[i*2]=v0[i];
        }
        for(i=0; i<n-m; i++) {
            v[i*2+1]=v1[i];
        }
        int bad=0;
        for(i=1; i<n; i++) {
            if(v[i-1].first>v[i].first)
                bad=1;
        }
        if(bad)
            continue;

        cnt=0;
        int j;
        for(i=0; i<n; i++) {
            for(j=i+1; j<n; j++) {
                if(v[i].second>v[j].second) cnt++;
            }
        }
        ans=MIN(ans,cnt);
    }
    if(ans==LINF) {
        printf("-1\n");
    }
    else {
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a+b == c || b+c == a || c+a == b) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main(){
   int p[5];
   for(int i=0;i<5;i++)cin >> p[i];
   for(int i=0;i<5;i++){
       if(p[i]==0){
           int s=i+1;
           printf("%d\n",s);
           return 0;
       }
   } 
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000009

struct UnionFind{
  vector<int> v,sav;
  UnionFind(int n) : v(n, -1) {}
  void init(){
    for(int i = 0;i < (int)sav.size();i++)v[sav[i]]=-1;
    sav.clear();
  }
  int find(int x) { return v[x] < 0 ? x : find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    sav.push_back(x); sav.push_back(y);
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
};

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

ll N,M;
vector<P> rel[2];
ll fac[3000010],finv[3000010];
ll calc[3000010];

ll comb(ll n,ll r){
  if(n<0||r<0||n<r)return 0;
  return (fac[n]*finv[r]%mod)*finv[n-r]%mod;
}

int main(){
  fac[0]=1;
  rep(i,3000000)fac[i+1]=fac[i]*(i+1)%mod;
  rep(i,3000001)finv[i]=mod_pow(fac[i],mod-2);
  calc[0]=1;
  for(ll i=3;i<=3000000;i+=3){
    calc[i]=calc[i-3]*comb(i,3)%mod;
    (calc[i]*=mod_pow(i/3,mod-2))%=mod;
  }

  cin>>N>>M;
  N*=3;
  rep(i,M){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    rel[c].push_back(P(a,b));
  }
  ll res=0;
  M=rel[1].size();
  UnionFind uf(N);
  rep(S,1<<M){
    uf.init();
    set<ll> vs;
    rep(i,rel[0].size()){
      uf.unite(rel[0][i].fi,rel[0][i].se);
      vs.insert(rel[0][i].fi); vs.insert(rel[0][i].se);
    }
    rep(i,M){
      if((S>>i)&1){
        uf.unite(rel[1][i].fi,rel[1][i].se);
        vs.insert(rel[1][i].fi); vs.insert(rel[1][i].se);
      }
    }
    ll crt=1;
    ll rest=N,cnt=0;
    map<ll,bool> used;
    for(ll v : vs){
      if(!used[uf.find(v)]){
        used[uf.find(v)]=true;
        ll sz=uf.size(v);
        if(sz>3)crt=0;
        else{
          rest-=sz;
          cnt+=3-sz;
        }
      }
    }
    (crt*=(comb(rest,cnt)*fac[cnt])%mod)%=mod;
    rest-=cnt;

    if(bcnt(S)%2==0) (res+=calc[rest]*crt%mod)%=mod;
    else (res+=(mod-(calc[rest]*crt%mod))%mod)%=mod;
  }
  cout<<res<<endl;
  return 0;
}



Measured memory_bytes: 84936
program main
	implicit none
    integer::N,i,ans
    integer, allocatable :: a(:)
    read(*,*) N
    allocate(a(N))
    read(*, *)(a(i), i = 1,N)
    ans=0
    do i=2,N-1
    	if(a(i-1)<a(i) .and. a(i)<a(i+1)) then
        	ans=ans+1
        else if(a(i-1)>a(i) .and. a(i)>a(i+1)) then
            ans=ans+1
        else 
        	ans=ans
        end if
    end do
    print*,ans
end program

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

using namespace std;

const int MAXN=333;
const int MAXM=333;

int N, M, D, Pcnt;
int Q;
int L, R;

struct Point{
	int x, y;
	long long Dis;
} P[MAXN*MAXM];

int dis(Point a, Point b){
	return abs(a.x-b.x)+abs(a.y-b.y);
}

int main(){
	ios_base::sync_with_stdio(false);
	
	cin >> N >> M >> D;
	
	for(int i=1;i<=N;++i)
		for(int j=1, k;j<=M;++j){
			cin >> k;
			P[k].x=i;P[k].y=j;
			P[k].Dis=0LL;
		}
	
	Pcnt=N*M;
	
	for(int i=1;i<=D;++i){
		P[i].Dis=0LL;
		for(int j=i+D;j<=Pcnt;j+=D){
			P[j].Dis=P[j-D].Dis+dis(P[j], P[j-D]);
		}
	}
	
	cin >> Q;
	while(Q--){
		cin >> L >> R;
		cout << P[R].Dis-P[L].Dis << endl;
	}
	
	return 0;
}


Measured memory_bytes: 2560
import java.util.*;

class Main{
	static int mod=1000000007;

	public static void main(String[] $){
		System.err.println();
		Scanner s=new Scanner(System.in);
		double r=0;
		int n=s.nextInt();
		for(int i=0;i<n;++i) {
			r+=1.0/s.nextInt();
		}
		System.out.println(1/r);
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef LL ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<pr, ut> ppr;
typedef priority_queue<pr,Vpr, greater<pr> > PQ;
const int SIZE=5+3*1e+4;
const ut INF=1<<30;
const ld eps=1e-6;
const LL mod=7+1e+9;

int main() {
	LL n, a, t;
	cin >> n;
	LL taka = 1, aoki = 1;
	REP(i, n){
		cin >> a >> t;
		if(a != t){
			LL dt = taka / a, da = aoki / t;
			if(dt < da){
				if(aoki % t != 0){
					aoki = (da + 1) * t;
					taka = (da + 1) * a;
				}
				else{
					aoki = da * t;
					taka = da * a;
				}
			}
			else if(dt > da){
				if(taka % a != 0){
					aoki = (dt + 1) * t;
					taka = (dt + 1) * a;
				}
				else{
					aoki = dt * t;
					taka = dt * a;
				}
			}
			else{
				if(aoki % t != 0 || taka % a != 0){
					aoki = (da + 1) * t;
					taka = (da + 1) * a;
				}
				else{
					aoki = da * t;
					taka = da * a;
				}
			}
		}
		else{
			if(taka > aoki)
				aoki = taka;
			else
				taka = aoki;
		}
		//cout << taka << " " << aoki << endl;
	}
	cout << aoki + taka << endl;
    return 0;	
}


Measured memory_bytes: 256
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int int32_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l=0,int r=INT_MAX)
{return uniform_int_distribution<int>(l,r)(rng);}

template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.x<<", "<<a.y<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}

template<typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
ostream&>::type operator<<(ostream& out, T(&a)[N])
{out<<"[ ";for(size_t i=0;i<N;++i)out<<a[i]<<", ";out <<"]"<<endl;return out;}

void debug_out(){cerr<<endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr<<(H)<<" ";debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr<<"#"<<#__VA_ARGS__<<":\n",debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,i,k;
	cin>>n>>k;
	vector<int> a(n);
	vector<double> b(n);
	for(i=0;i<n;i++){
		cin>>a[i];
		b[i]=(a[i]+1.0)/(2.0);
	}
	double ans=0,sm=0;
	for(i=0;i<k;i++){
		ans+=b[i];
	}
	sm=ans;
	for(i=k;i<n;i++){
		sm-=b[i-k];
		sm+=b[i];
		ans=max(ans,sm);
	}
	cout<<fixed<<setprecision(12)<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 2560
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	string s;
	cin>>s;

	int sum=0;

	for(auto it:s)
	{
		sum+=(it-'0');
	}

	if(sum%9!=0)
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}




}

Measured memory_bytes: 3792
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N =sc.nextInt();
    if(N%10==3){System.out.println("bon");}
    else if(((N%10==1)||(N%10==0))||((N%10==6)||(N%10==8))){System.out.println("pon");}
    else{System.out.println("hon");}
  }
}

Measured memory_bytes: 35728
#![allow(clippy::many_single_char_names)]
#[allow(unused_imports)]
use proconio::{
    input,
    marker::{Chars, Usize1},
};

fn main() {
    input!(h: usize, w: usize, n: usize, xy: [(Usize1, Usize1); n]);
    let mut a = vec![0; h];
    let mut b = vec![0; w];
    for &(x, y) in &xy {
        a[x] += 1;
        b[y] += 1;
    }
    let a_max = *a.iter().max().unwrap();
    let b_max = *b.iter().max().unwrap();
    let area =
        (0..h).filter(|&i| a[i] == a_max).count() * (0..w).filter(|&j| b[j] == b_max).count();
    let ans = if xy
        .iter()
        .filter(|&&(x, y)| a[x] == a_max && b[y] == b_max)
        .count()
        < area
    {
        a_max + b_max
    } else {
        a_max + b_max - 1
    };
    println!("{}", ans);
}


Measured memory_bytes: 12912
N = int(input())
A = [0] + list(map(int, (input().split()))) + [0]

no_skip  = 0

for rep, content in enumerate(A[1:]):
    no_skip += abs(content - A[rep])

for rep in range(1, N + 1):
    print(no_skip + abs(A[rep-1] - A[rep+1])
            - abs(A[rep-1] - A[rep]) - abs(A[rep] - A[rep+1]))

Measured memory_bytes: 13920
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int a, b;
    char ch;
    
    while(true){
        cin >> a >> ch >> b;
        if(ch == '?') break;
        
        if(ch == '+') a += b;
        else if(ch == '-') a -= b;
        else if(ch == '*') a*= b;
        else a /= b;
        
        cout << a << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3012
import java.util.Scanner;

public class Main {

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

			String str = sc.next();

			String[] strArray = str.split("");
			int num = 0;

			for(int i =0;i < strArray.length;i++) {

				if(strArray[i].equals("+")) {
					num++;
				}else {
					num--;
				}
			}

			System.out.println(num);



	}


}




Measured memory_bytes: 21460
#include<algorithm>
#include<string>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<string> vst;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};



int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    int maxi=0,sum=0;
    REP(i,n){
        cin >> l[i];
        maxi=max(maxi,l[i]);
        sum += l[i];
    }

    if(sum-maxi>maxi)cout << "Yes" << endl;
    if(sum-maxi<=maxi)cout << "No" << endl;
}

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

using namespace std;
int n,k;
int ar[100005];
int mem[100005];

int solve(int ind,int ki){
    if(ind==n-1){
        return 0;
    }
    if(ind>=n||ki>k){
        return 1e9;
    }
    if(mem[ind]!=-1){
        return mem[ind];
    }
    int ret=1e9;
    ret=min(ret,solve(ind+ki,1)+abs(ar[ind]-ar[ind+ki]));
    ret=min(ret,solve(ind,ki+1));
    return mem[ind]=ret;
}

int main() {
    //freopen("input.in", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(mem,-1,sizeof mem);
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>ar[i];
    }
    cout<<solve(0,1)<<endl;
    return 0;
}

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

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

    rep2(i,1,2000) {
        int a_ = int(i*0.08);
        int b_ = int(i*0.1);
        if(a_ == a && b_ == b) {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}

signed main() {
	int a, b;
	cin >> a >> b;
	if (max(a, b) - min(a, b) < 2) {
		cout << a + b << endl;
	}
	else {
		cout << max(a, b) * 2 - 1 << endl;
	}
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stack>
#include<set>
#include<vector>
#include<iostream>
#include<queue>
using namespace std;
int n,k,q,a[2010],h[2010],tr[2010];
bool cmp(const int &o,const int &p){
    return a[o] < a[p];
}
void inc(int o,int val){
    for(int i = o;i <= n; i += i &(-i)){
        tr[i] += val;
    }
}
int sum(int o){
    int ret = 0;
    for(int i = o;i;i -=i &(-i)){
        ret += tr[i];
    }
    return ret;
}
int main(){
    scanf("%d%d%d",&n,&k,&q);
    for(int i = 1;i <= n; ++i){
        scanf("%d",&a[i]);
        h[i]=i;
    }
    sort(h+1, h + n+1,cmp);
    set<int> e;
    e.insert(0);
    e.insert(n + 1);
    int ans = 2e9 + 1000;
    for(int i = 1; i <= n; ++i){
        inc(i,1);
    }
    //cout <<"???" << endl;
    for(int i = 1;i <= n; ++i){
        int cnt = 0;
        int j = i;
        for(;cnt < q && j<=n;++j){
            int r = *e.lower_bound(h[j]);
            int l = *(--e.lower_bound(h[j]));
            //cout << l <<" "<<r<<endl;
            int ret = sum(r - 1) - sum(l);
            if(ret >= k){
                cnt++;
                inc(h[j], -1);
            }
        }
//        cout << endl;
//        cout << i <<"  "<<j <<endl;
        e.insert(h[i]);
        if(cnt == q){
            ans = min(ans,a[h[j - 1]] - a[h[i]]);
        }
        for(int j=i;j<=n;++j){
            if(sum(h[j]) - sum(h[j] - 1) == 0){
                inc(h[j],1);
            }
        }
        inc(h[i],-1);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  
    int N,K,sum = 0;
    cin >> N >> K;
    
    int data[N];
    
    for(int i=0;i<N;i++) cin >> data[i]; 
    
    sort(data,data+N);
    
    for(int i=0;i<K;i++) sum += data[i];
    
    cout << sum << endl;
}

Measured memory_bytes: 3680
# a%b >= K iff xb+K <= a < (x+1)b
# bごとに数えるだけ

N,K = map(int,input().split())
ans = 0

for b in range(K+1,N+1):
  cnt = 0
  x_max = N//b
  # 0 <= x < x_max
  # 各xに対してb-K個ある
  cnt += x_max * (b-K)
  # x = x_max
  lower = x_max*b+K
  if lower <= N:
    upper = min((x_max+1)*b-1,N)
    cnt += upper - lower + 1
  ans += cnt

# N=0除外
if K == 0:
  ans -= N
  
print(ans)


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

int top = 0, S[1000];

void push(int x){
    top += 1;
    S[top] = x;
}

int pop(void){
    top--;
    return S[top + 1];
}

int main(void){
    int a, b;
    top = 0;
    char s[100];
    while(scanf("%s", s) != EOF){
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a + b);
        }else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        }else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        }else{
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
    return 0;
}


Measured memory_bytes: 2084
/*************************
author : coldbeer
2019-05-26 05:38:02 PM IST
*************************/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

vector<pair<string,pair<int,int>>> arr;

bool comp(pair<string,pair<int,int>> &a,pair<string,pair<int,int>> &b){
	if(a.first != b.first)
		return (a.first < b.first);
	else
		return (a.second.first > b.second.first);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	string s;
	int item;
	for(int i = 0;i < n;i++){
		cin >> s >> item;
		arr.push_back({s,{item,i + 1}});
	}
	sort(arr.begin(),arr.end(),comp);
	for(auto x : arr)
		cout << x.second.second << endl;
	return 0;
}


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


int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(m+2);
    a[0]=0;
    for(int i = 0; i < m; i++) {
        cin >> a[i+1];
    }
    a[m+1]=n;

    vector<ll> p(n+1);
    p[0]=1;
    p[1]=1;
    for(int i = 2; i <= n; i++) {
        p[i]=(p[i-1]+p[i-2])%1000000007;
    }

    if(m==0){
        cout << p[n] << endl;
        return 0;
    }

    ll tstep = p[a[1]-1];

    for(int i = 1; i < m; i++) {
        int x=a[i+1]-a[i]-2;
        if(x==-1){
            cout << 0 << endl;
            return 0;
        }
        ll y=p[x];
        tstep *= y;
        tstep %= 1000000007;
    }
    
    tstep *= p[n-a[m]-1];
    tstep %= 1000000007;

    cout << tstep << endl;
    return 0;
}

Measured memory_bytes: 4208
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <set>
#include <map>
using namespace std;
typedef long long int lli;
const lli mod = 1e9 +7;
const lli inf = 1e18;
typedef pair<lli, lli> pll;

int main(){
    int n;
    cin >> n;
    vector<lli> a(n+1);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    a[n] = a[0];
    lli lb=0, ub=2*a[0];
    while(lb < ub){
        lli mid = (lb +ub) /2;
        if(mid%2 == 1) mid--;
        lli tmp = mid;
        for(int i=0; i<n; i++){
            tmp = (a[i] -tmp/2) *2;
        }
       //cout << lb << " " << ub << " " << mid << " " << tmp << endl;
        if(tmp > mid){
            lb = mid+2;
        }else{
            ub = mid;
        }
    }
    lli tmp = lb;
    for(int i=0; i<n; i++){
        cout << tmp << " ";
        tmp = (a[i] -tmp/2) *2;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2048
#include<cstdio>
#include<algorithm>
using namespace std;
int n, m, X[15], Y[15], v[15];
long long S1[15], S2[15];
char p[15][15];
bool Pos() {
	int i, j;
	for (i = 1; i <= n; i++) {
		S1[i] = S2[i] = 0;
		v[i] = 0;
		long long t = 1;
		for (j = 1; j <= m; j++) {
			S1[i] = S1[i] * 26 + p[i][Y[j]] - 'a';
			S2[i] += (p[i][Y[j]] - 'a')*t;
			t *= 26;
		}
	}
	int ck = n % 2;
	for (i = 1; i <= n; i++) {
		if (v[i])continue;
		for (j = 1; j <= n; j++)if (i!=j && !v[j] && S1[i] == S2[j]) {
			v[i] = v[j] = 1;
			break;
		}
		if (j == n + 1) {
			if (S1[i] == S2[i] && ck) {
				ck--;
				continue;
			}
			return false;
		}
	}
	return true;
}
int main() {
	int i, j;
	scanf("%d%d", &n, &m);
	for (i = 1; i <= n; i++) {
		scanf("%s", p[i] + 1);
	}
	for (i = 0; i < (1 << m); i++) {
		int c = 0;
		for (j = 0; j < m; j++) {
			if ((i >> j) & 1)c++;
		}
		if (c != m / 2)continue;
		int pv = m, p1 = 1;
		for (j = 0; j < m; j++) {
			if ((i >> j) & 1)Y[pv--] = j + 1;
			else Y[p1++] = j + 1;
		}
		do {
			if (Pos()) {
				puts("YES");
				return 0;
			}
		} while (next_permutation(Y + 1, Y + pv + 1));
	}
	puts("NO");
}

Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	int n;
	cin >> n;
	int d[55];
	rep(i, n) cin >> d[i];
	int sum = 0;

	rep(i, n) {
		for(int j = i+1; j < n;j++){
			sum += d[i] * d[j];
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long int
#define phi 1.6180339
#define rep(i,n) for(auto i=0;i<(n);i++)
#define endl "\n"
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define op1 cin.tie(NULL)
#define op2 cout.tie(NULL)
#define op3 std::ios_base::sync_with_stdio(false)
#define MAXX 1000001
using namespace std;
int arr[MAXX];
void trozen()
{
    bool visited[101];
    memset(visited,false,sizeof(visited));
    int x,n;
    cin>>x>>n;
    rep(i,n)
    {
        int temp;
        cin>>temp;
        visited[temp]=true;
    }
    int diff=INT_MAX,ele=INT_MAX;
    for(int i=-200;i<=200;i++)
    {
        if(!visited[i]){
        if(abs(x-i)==diff)
            ele=min(ele,i);
        else if(abs(x-i)<diff)
        {
            diff=abs(x-i);
            ele=i;
        }
        }
    }
    cout<<ele<<endl;
}
int32_t main()
{
    op1;op2;op3;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    trozen();
    return 0;
}


Measured memory_bytes: 3644
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).trim().split('\n');
main();
     
// ここから
function main(){
  for(var i = 0, len = input.length; i < len; i++){
    var j = input[i].split(" ");
    var a = j[0] - 0;
    var b = j[1] - 0;
    var g = gcd(a, b);
    var lcm = a * b / g;
    console.log(g + " " + lcm);
  }
}

function gcd(a, b){
  var x = max(a, b);
  var y = min(a, b);
  var mod
  while(mod = x % y){
    x = y;
    y = mod;
  }
  return y;
}

function max(a, b) {
  var t = a - b;
  return a - (t & (t >> 31));
}

function min(a, b){
  var t = a - b;
  return b + (t & (t >> 31));
}

Measured memory_bytes: 7912
<?php
  $ary = array();
  while (true) {
    list($a, $op, $b) = explode(" ", trim(fgets(STDIN)));
    if ($op == "?") {
      break;
    }
    $ary_2 = array($a, $op, $b);
    array_push($ary, $ary_2);
  }
  $count = count($ary);
  foreach ($ary as $key => $val) {
    $a = $val[0];
    $b = $val[2];
    switch ($val[1]) {
      case "+";
        print floor($a + $b);
        break;
      case "-";
        print floor($a - $b);
        break;
      case "*";
        print floor($a * $b);
        break;
      case "/";
        print floor($a / $b);
        break;
    }
    if ($key+1 < $count) {
      print "\n";
    }
  }
?>

Measured memory_bytes: 6640
// Problem E

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

#define MAXN 300000
#define pb push_back
#define mp make_pair

using namespace std;

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

int N;
ll A[MAXN], B[MAXN];

int main() {
  cin >> N;
  for (int i=0; i<N; i++) cin >> A[i] >> B[i];
  sort(A, A+N);
  sort(B, B+N);
  
  ll maxmed, minmed;
  if (N % 2 == 0) {
    maxmed = B[N/2-1] + B[N/2];
    minmed = A[N/2-1] + A[N/2];
  }
  else {
    maxmed = B[N/2];
    minmed = A[N/2];
  }
  
  cout << maxmed - minmed + 1 << endl;
  
  return 0;
}


Measured memory_bytes: 6768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e5;
const long inf=1e16;
int main(){
	int N;cin>>N;
	long A[N];
	rep(i,0,N) cin>>A[i];
	long dp[N][2] = {};
    dp[0][0] = 0; dp[0][1] = A[0];
    dp[1][0] = 0; dp[1][1] = A[1];
	rep(i,2,N)rep(j,0,2){
		int s = i / 2 + j - 1;
        long res = -inf;
		rep(k,2,min(3, i) + 1){
            int t = s - (i-k) / 2;
			if(0 <= t && t < 2) res = max(res, dp[i-k][t]);
		}
        if(res == -inf) res = 0;
		dp[i][j] = res + A[i];
	}
    if(N % 2 == 0) cout<<max(dp[N-2][1], dp[N-1][1])<<endl;
    else cout<<max(dp[N-3][1], max(dp[N-2][1], dp[N-1][0]))<<endl;
}

Measured memory_bytes: 8312
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int a, b;
  cin >> a >> b;
  if (a + b == 15) {
    cout << "+" << endl;
  } else if (a * b == 15) {
    cout << "*" << endl;
  } else {
    cout << "x" << endl;
  }
  return 0;
}


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

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

  // パターン1
  if (S == "SUN") {
    cout << "7" << endl;
  }
  if (S == "MON") {
    cout << "6" << endl;
  }
    if (S == "TUE") {
    cout << "5" << endl;
  }
    if (S == "WED") {
    cout << "4" << endl;
  }
    if (S == "THU") {
    cout << "3" << endl;
  }
    if (S == "FRI") {
    cout << "2" << endl;
  }
    if (S == "SAT") {
    cout << "1" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans; 
}
void solve()
{
    int i,j,n;
    cin>>n;
    int a[n][3];
    for(i=0;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }
    int dp[n][3];
    for(i=0;i<3;i++)
    {
        dp[0][i]=a[0][i];
    }
    for(i=1;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            dp[i][j]=max(a[i][j]+dp[i-1][(j+1)%3],a[i][j]+dp[i-1][(j+2)%3]);
        }
    }
    cout<<max3(dp[n-1][0],dp[n-1][1],dp[n-1][2])<<nl;


}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    ll TC = 1;
    //cin>>TC;
    while(TC--){
        solve();
    }
}


Measured memory_bytes: 5964
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
count = [0] * n
for i in range(n):   
    count[i] = s.count(s[i])
    for j in range(m):
        if s[i] == t[j]:
            count[i] -= 1
if all(i < 0 for i in count):
    print(0)
else:
    print(max(count))

Measured memory_bytes: 3064
import Data.Bits
import Data.List
import Control.Monad
import qualified Data.Vector.Unboxed as V
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B
import Debug.Trace

main :: IO ()
main = do
  n <- readLn :: IO Int
  ds' <- map read.words <$> getLine :: IO [Int]
  let ds = sort ds'

  putStrLn $ show $ (ds !! ((n `div` 2))) - (ds !! ((n `div` 2) - 1))


Measured memory_bytes: 34428
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>

//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//// 任意長整数型
//using Bint = mp::cpp_int;
//// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
//
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int,int> P;

const int MOD = 1000000007;



int main(int argc, const char * argv[]) {
    ll A,B,C,K; cin >> A >> B >> C >> K;
    ll sum =0;
    
    if(K<=A+B){
        sum += min(A,K);
        cout << sum << endl;
        return 0;
    }
    
    sum += A + -1*(K-A-B);

    cout << sum << endl;

    return 0;
}



Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int k;
    cin >> k;

    char c = s[k - 1];
    for(int i = 0; i < n; ++i){
      if(s[i] != c){
        s[i] = '*';
      }
    }

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
l = [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]
k = int(input())
print(l[k-1])

Measured memory_bytes: 38384
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI Z(N), W(N);

	REP(i, N) {
		int x, y; cin >> x >> y;
		Z[i] = x + y;
		W[i] = x - y;
	}
	SORT(Z);
	SORT(W);
	cout << max(Z[N - 1] - Z[0], W[N - 1] - W[0]) << endl;
	return 0;
}



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

import static java.lang.Math.max;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int x = scanner.nextInt();

        for (int i = -k + 1; i <= k - 1 ; i++) {
            if(-1000000 < x+i && x+i < 1000000)
                System.out.print(x+i + " ");
        }
    }
}



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

int main() {
  long N, i, result;
  result = 0;

  cin >> N;
  for (i = 1; i <= N; i++) {
    if (i % 3 != 0 && i % 5 != 0) {
      result += i;
    }
  }
  cout << result << endl;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  if (A >= 13) {
    cout << B << endl;
  } else if (A >= 6) {
    cout << B / 2 << endl;
  } else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7

class Combination:
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)
 
    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod
 
    def make_factorial_list(self, n):
 
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv
 
    def make_modinv_list(self, n):
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

a.sort()
ans=0
if n==1 or k==1:
    print(0)
    exit()
# c=cmb(n-1,k-1,mod)
comb = Combination(10**5)
# for i in range(n):
#     print(a[i]-low)
#     suuji[a[i]-low][0]+=i
#     suuji[a[i]-low][1]+=c-i

for i in range(len(a)):
    if i>=k-1:
        ans+=a[i]*comb(i,k-1)
        ans%=mod
    if n-i-1>=k-1:
        ans-=a[i]*comb(n-i-1,k-1)
        ans%=mod
    ans%=mod
# print(suuji)
print(ans)

Measured memory_bytes: 67872
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

int lightx[2001][2001]={},lighty[2001][2001]={};
int main(){
    ll h,w;
    cin >> h >> w;
    vector<string> str(h);
    for(ll i=0;i<h;i++) cin >> str[i];
    for(ll y=1;y<=h;y++){
        for(ll x=1;x<=w;x++){
            if(str[y-1][x-1]!='#'){
                if(lightx[y][x-1]==0){
                    for(ll i=0;x+i<=w;i++){
                        if(str[y-1][x+i-1]!='#')    lightx[y][x]++;
                        else break;
                    }
                }
                else    lightx[y][x] = lightx[y][x-1];
            }
        }
    }
    for(ll x=1;x<=w;x++){
        for(ll y=1;y<=h;y++){
            if(str[y-1][x-1]!='#'){
                if(lighty[y-1][x]==0){
                    for(ll i=0;y+i<=h;i++){
                        if(str[y+i-1][x-1]!='#')    lighty[y][x]++;
                        else break;
                    }
                }
                else    lighty[y][x] = lighty[y-1][x];
            }
        }
    }
    int ans = 0;
    for(ll y=1;y<=h;y++){
        for(ll x=1;x<=w;x++){
            ans = max(ans,lightx[y][x]+lighty[y][x]);
        }
    }
    cout << ans-1 << endl;
}


Measured memory_bytes: 35584
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
using namespace std;
typedef unsigned long long ul;
typedef long long ll;
typedef pair<int, int> PAIR;
 
int main() {
	ll N, L;
	cin >> N >> L;
	ll min_diff = 100000000000000;
	ll min_flavor = 0;
	REP(j, N) {
		ll sum = 0;
		ll bitten_sum = 0;
		REP(i, N) {
			ll flavor = L + i;
			sum += flavor;
			if (i != j) {
				bitten_sum += flavor;
			}
		}
		ll diff = abs(sum - bitten_sum);
		if (min_diff > diff) {
			min_diff = diff;
			min_flavor = bitten_sum;
		}
	}
	cout << min_flavor;
	return 0;
}

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

int main()
{
    string s;
    int ans = 0;

    while(cin>>s){
        for(int i=0; i<s.size(); i++){

            int z = 0;

            while(s[i] >= '0' && s[i] <= '9'){
                z *= 10;
                z += s[i] -'0';
                i++;
            }
            ans += z;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1184
h,w = map(int, input().split())

ans = h*w

for x,y in [[h,w],[w,h]]:
    for margin_x in [0,1]:
        for second_cut in ['x','y']:
            area = [0] * 3
            area[0] = (x//3 + margin_x) * y
            x2 = x - (x//3 + margin_x)
            if(second_cut == 'x'):
                area[1] = (x2//2) * y
                area[2] = (x2 - x2//2) * y
            else:
                area[1] = x2 * (y//2)
                area[2] = x2 * (y - y//2)
            ans = min(ans, max(area)-min(area))

            if(ans == 0):
                print(ans)
                exit()

print(ans)


Measured memory_bytes: 38384