akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long int
#define all(v) v.begin(),v.end()
#define ov(v) for(int i=0;i<(v).size();i++)cout<<v[i]<<" ";cout<<endl;
#define N 1001
using namespace std;
void solve()
{
	int n,m,t;
	cin>>n>>m>>t;
	vector<int>row(n,0),col(m,0);
	vector<pair<int,int> >cor(t);
	multiset<int>se;
	set<int>rc[n];
	int ans = 0;
	for(int i = 0;i<t;i++)
	{
		int u,v;
		cin>>u>>v;
		u--;v--;
		cor[i] ={u,v};
		row[u]++;
		rc[u].insert(v);
		col[v]++;
	}
	for(int i = 0;i<t;i++)
	{
		int x = cor[i].first;
		int y = cor[i].second;
		ans = max(ans,row[x] + col[y]-1);			
	}
	for(int i = 0;i<m;i++)
		se.insert(col[i]);

	for(int i = 0;i<n;i++)
	{
		for(auto j:rc[i])
		{
			auto it = se.find(col[j]);
			se.erase(it);
		}
		if(!se.empty())
		{
			int mx = *se.rbegin();
			ans = max(ans,mx+row[i]);
		}
		for(auto j:rc[i])
		{
			se.insert(col[j]);
		}
	}
	cout<<ans<<endl;
	
}
signed main() 
{
	// int t;
	// cin>>t;
	// while(t--)
	solve();
	return 0; 
}

Measured memory_bytes: 54716
#include<bits/stdc++.h>
using namespace std;
const int MAX=2e5+100;
int N,A[MAX],B[MAX];
int main ()
{
    cin >> N;
    for(int i=1;i<=N;i++)
        cin>>A[i];
    for(int i=1;i<=N;i++)
        B[i]=1;

    for(int i=N;i>=1;i--)
    {
        //if(!A[i])continue;
        int s=0;
        for(int j=i+i;j<=N;j+=i){
            if(B[j])s++;
        }
        //cout<<"for "<<i<<" : "<<s<<endl;
        if(A[i])
        {
            if(s%2)
            {
                B[i]=0;
            }
            else{
                B[i]=1;
            }
        }
        else{
                if(s%2==0){
                    B[i]=0;
                }
                else{
                        B[i]=1;
                }
        }
    }
    int m=0;
    for(int i=1;i<=N;i++)m+=(B[i]==1);
    cout<<m<<endl;
    for(int i=1;i<=N;i++)
        if(B[i])cout<<i<<" ";
    return 0;
}


Measured memory_bytes: 2432
import collections
from scipy.misc import comb

N = int(input())
s = []
for _ in range(N):
    s.append(list(input()))

for i in range(len(s)):
    s[i] = tuple(sorted(s[i]))
    
c = collections.Counter(s)

cnt = 0
for c_ in c.values():
    cnt += comb(c_, 2, exact=True)
    
print(cnt)

Measured memory_bytes: 40800
N, C = gets.split.map(&:to_i)

xs, vs = [], []
N.times do |i|
    xs[i], vs[i] = gets.split.map(&:to_i)
end

max_cw = Array.new(N, 0)
max_ccw = Array.new(N, 0)
ret_max_cw = Array.new(N, 0)
ret_max_ccw = Array.new(N, 0)

sum = vs[0] - xs[0]
max_cw[0] = [sum, 0].max
sum2 = vs[0] - 2 * xs[0]
ret_max_cw[0] = [sum2, 0].max
(N - 1).times do |i|
    sum += vs[i+1] - (xs[i+1] - xs[i])
    sum2 += vs[i+1] - (xs[i+1] - xs[i]) * 2
    max_cw[i+1] = [max_cw[i], sum].max
    ret_max_cw[i+1] = [ret_max_cw[i], sum2].max
end

sum = vs[-1] - (C - xs[-1])
max_ccw[-1] = [sum, 0].max
sum2 = vs[-1] - (C - xs[-1]) * 2
ret_max_ccw[-1] = [sum2, 0].max
(N - 1).times do |i|
    sum += vs[N - 2 - i] - (xs[N - 1 - i] - xs[N - 2 - i])
    sum2 += vs[N - 2 - i] - (xs[N - 1 - i] - xs[N - 2 - i]) * 2
    max_ccw[N - 2 - i] = [max_ccw[N - 1 - i], sum].max
    ret_max_ccw[N - 2 - i] = [ret_max_ccw[N - 1 - i], sum2].max
end


#p max_cw
#p max_ccw 
#p ret_max_cw
#p ret_max_ccw

ans = [max_cw.max, max_ccw.max].max
(N - 1).times do |i|
    cal = [
        ret_max_cw[i] + max_ccw[i+1],
        ret_max_ccw[i+1] + max_cw[i]
    ].max
    ans = cal if ans < cal
end

puts ans

Measured memory_bytes: 6852
N = int(input())
C = list(input())

l = 0
r = N - 1
count = 0
while l < r:
    if C[l] == 'R' and C[r] == 'W':
        l += 1
        r -= 1
    elif C[l] == 'R' and C[r] == 'R':
        l += 1
    elif C[r] == 'W' and C[r] == 'W':
        r -= 1
    elif C[l] == 'W' and C[r] == 'R':
        l += 1
        r -= 1
        count += 1

print(count)



Measured memory_bytes: 10680
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int dst[100010];
unordered_set<int>v[100010];
vector<pair<int,int> > g[100010];
int main(){
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int p,q,c;
        scanf("%d %d %d",&p,&q,&c);
        p--;
        q--;
        g[p].PB(MP(q,c));
        g[q].PB(MP(p,c));
    }
    
    for(int i=1;i<n;i++){
        dst[i] = inf;
    }
    priority_queue<pair<int,pair<int,int> >,vector<pair<int,pair<int,int> > >,greater<pair<int,pair<int,int> > >  > pq;
    pq.push(MP(0,MP(0,0)));
    while(!pq.empty()){
        auto x = pq.top();
        pq.pop();
        if(dst[n-1]<x.first)break;
        if(dst[x.second.first]<x.first)continue;
        for(auto &y:g[x.second.first]){
            int tmp=0;
            if(y.second!=x.second.second)tmp=1;
            if(dst[y.first]==x.first+tmp){
                if(v[y.first].count(y.second)==0){
                    pq.push(MP(x.first+tmp,MP(y.first,y.second)));
                    v[y.first].insert(y.second);
                }
            }else if(dst[y.first]>x.first+tmp){
                dst[y.first]=x.first+tmp;
                v[y.first].clear();
                pq.push(MP(x.first+tmp,MP(y.first,y.second)));
                v[y.first].insert(y.second);
            }
        }
    }
    if(dst[n-1]!=inf)printf("%d\n",dst[n-1]);
    else printf("-1\n");
    return 0;
}

Measured memory_bytes: 29360
n,m = list(map(int,input().split()))
wars = []
last_bs = 0
cnt = 0

for i in range(m):
    a,b = list(map(int,input().split()))
    wars.append([a,b])

wars.sort(key=lambda x:x[1])

for war in wars:
    if war[0] > last_bs:
        last_bs = war[1]-1
        cnt += 1

print(cnt)

Measured memory_bytes: 21776
from collections import deque
import sys
q = int(sys.stdin.readline())
dq = deque()
for _ in range(q):
    s = sys.stdin.readline()
    if s[0] == '0':
        c, d, x = map(int, s.split())
        if d:
            dq.append(x)
        else:
            dq.appendleft(x)
    else:
        c, d = map(int, s.split())
        if c == 1:
            sys.stdout.write("{}\n".format(dq[d]))
        else:
            if d:
                dq.pop()
            else:
                dq.popleft()


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

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var item = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
            var N = item[0];
            var A = item[1];
            var B = item[2];

            var answer = (N / (A + B)) * A;
            answer += Math.Min((N % (A + B)), A);

            Console.WriteLine(answer);
        }
    }
}


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

#define pb push_back
#define S second
#define F first
#define sz size()
#define eps 0.000001
#define oo 2000000007
#define endl '\n'
#define bg begin()
#define nd end()
#define up upper_bound
#define lw lower_bound
#define debug(x) #x << " = " << x << "; "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

int MOD = 1e9+7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s;
	cin >> n;
	cin >> s;
	int dp[n + 2][n + 2], pfs[n+2][n+2];
	memset(dp, 0, sizeof(dp));
	memset(pfs, 0, sizeof(pfs));
	dp[1][1] = 1; pfs[1][1] = 1; 
	for(int i = 2; i <= n; i++){
		for(int j = 1; j <= i; j++){
			if(s[i - 2] == '<'){
				dp[i][j] = pfs[i - 1][j - 1]%MOD;
			}else{
				dp[i][j] = ((pfs[i - 1][i - 1]%MOD - pfs[i - 1][j - 1]%MOD)+MOD)%MOD;
			}
			pfs[i][j] = (pfs[i][j - 1]%MOD + dp[i][j]%MOD)%MOD;
		}
	}
	int ans = pfs[n][n];
	cout << ans << endl;
}

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

using namespace std;

int dp[3][100003];

int main () {
	int n;
	cin>>n;
	int a,b,c;
	cin>>a>>b>>c;
	dp[0][0]=a;
	dp[1][0]=b;
	dp[2][0]=c;
	for(int i=1;i<n;i++){
		cin>>a>>b>>c;
		dp[0][i]=a+max(dp[1][i-1],dp[2][i-1]);
		dp[1][i]=b+max(dp[0][i-1],dp[2][i-1]);
		dp[2][i]=c+max(dp[0][i-1],dp[1][i-1]);
	}
	cout<<max(max(dp[0][n-1],dp[1][n-1]),dp[2][n-1]);



return 0;
}



Measured memory_bytes: 1408
num, bricks, count, smash = int(input()), [int(x) for x in input().split(" ")], 1, 0
for x in bricks:
    if count == x: count += 1
    else: smash += 1
print(smash if smash != len(bricks) else 0 if len(bricks) == 1 else -1)

Measured memory_bytes: 26268
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	string s, t;
	cin >> s;
	int n = s.length();
	rep(i, n) {
		if (i % 2 == 0)t += s[i];
	}
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <P,P> PP;
typedef pair <int,PP> PPP;

static const double eps = 1e-8;

static const int moveTo[][2] = {{1,0},{0,-1},{-1,0},{0,1}};
static const int moveToRev[][2] = {{-1,0},{0,1},{1,0},{0,-1}};

int stage[50][50];
int costTable[50][50][50][50];

int bfs(int tx,int ty,int kx,int ky,int w,int h){
	priority_queue<PPP,vector<PPP>,greater<PPP> > que;
	que.push(PPP(0,PP(P(tx,ty),P(kx,ky))));	
	memset(costTable,0x3,sizeof(costTable));

	int res = INF;
	costTable[tx][ty][kx][ky] = 0;
	while(!que.empty()){
		int cost = que.top().first;
		if(res <= cost || cost >= 100){
			return res;
		}

		int tx = que.top().second.first.first;
		int ty = que.top().second.first.second;
		int kx = que.top().second.second.first;
		int ky = que.top().second.second.second;

		if(tx==kx && ty == ky) res = min(res,cost);

		que.pop();

		for(int i=0;i<4;i++){
			int tdx = tx + moveTo[i][0];
			int tdy = ty + moveTo[i][1];

			if((tdx < 0 || tdx >= w || tdy < 0 || tdy >=h) || stage[tdy][tdx]) {
				tdx = tx;
				tdy = ty;
			}

			int kdx = kx + moveToRev[i][0];
			int kdy = ky + moveToRev[i][1];

			if((kdx < 0 || kdx >= w || kdy < 0 || kdy >=h) || stage[kdy][kdx]) {
				kdx = kx;
				kdy = ky;
			}
			if(costTable[tdx][tdy][kdx][kdy] <= cost + 1) continue;
			costTable[tdx][tdy][kdx][kdy] = cost + 1;
			que.push(PPP(cost+1,PP(P(tdx,tdy),P(kdx,kdy))));
		}
	}

	return res;
}

int main(){

	int w,h;
	while(~scanf("%d %d",&w,&h)){
		if(w == h && h==0) break;
		int tx,ty;
		scanf("%d %d",&tx,&ty);
		int kx,ky;
		scanf("%d %d",&kx,&ky);
		for(int y=0;y<h;y++){
			for(int x=0;x<w;x++){
				scanf("%d",&stage[y][x]);
			}
		}

		int res = bfs(tx-1,ty-1,kx-1,ky-1,w,h);
		if(res >= 100) printf("NA\n");
		else printf("%d\n",res);
	}
}

Measured memory_bytes: 28244
while n = gets.to_i
  break if n == 0

  arr = gets.split(' ').map(&:to_i)
  puts arr.join(' ')

  1.upto(arr.size - 1) do |i|
    if arr[i-1] < arr[i]
      puts arr.join(' ')
      next
    end

    i.downto(1) do |j|
      if arr[j-1] > arr[j]
        arr[j-1], arr[j] = arr[j], arr[j-1]
      else
        break
      end
    end

    puts arr.join(' ')
  end
end

Measured memory_bytes: 8664
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
struct edge{ int to, cost; };
const int INF = 1001001001;
const int MAX_V = 200005;
int V,E;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s){
    // greater<P>を指定することでfirstが小さい順に取り出せるようにする
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        int v = p.second;
        for(int i=0; i<G[v].size(); i++){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V >> E;
    int r; cin >> r;
    rep(i,E){
        int from,to,cost;
        cin >> from >> to >> cost;
        edge e1, e2;
        e1.to = to; e1.cost = cost;
        e2.to = from; e2.cost = cost;
        G[from].push_back(e1);
        // G[to].push_back(e2);
    }

    dijkstra(r);

    rep(i, V){
        if(d[i] == INF){
            cout << "INF" << endl;
        }else{
            cout << d[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 15288
S = input()

uS = S[:2]
lS = S[2:]

uNum = int(uS)
lNum = int(lS)

if uNum > 0 and lNum > 0:
    if uNum <= 12 and lNum <= 12:
        print("AMBIGUOUS")
    elif uNum > 12 and lNum <= 12:
        print("YYMM")
    elif uNum <= 12 and lNum > 12:
        print("MMYY")
    else:
        print("NA")
elif uNum == 0 and lNum > 0:
    if lNum <= 12:
        print("YYMM")
    else:
        print("NA")
elif uNum > 0 and lNum == 0:
    if uNum <= 12:
        print("MMYY")
    else:
        print("NA")
else:
    print("NA")



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

int main() {
  int n;
  scanf("%d", &n);
  vector<vector<pair<int, int>>> a(n);
  for (int i = 0; i < n; ++i) {
    int k;
    scanf("%d", &k);
    a[i].resize(k);
    for (int j = 0; j < k; ++j) {
      scanf("%d %d", &a[i][j].first, &a[i][j].second);
      --a[i][j].first;
    }
  }
  int ans = 0;
  for (int mask = 0; mask < (1 << n); ++mask) {
    bool ok = true;
    for (int i = 0; i < n; ++i) {
      if ((mask >> i) & 1) {
        for (int j = 0; j < int(a[i].size()); ++j) {
          ok &= (((mask >> a[i][j].first) & 1) == a[i][j].second);
        }
      }
    }
    if (ok) ans = max(ans, __builtin_popcount(mask));
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input!(n: usize, a: [u64; 1usize << n]);
    let ans: Vec<_> = (1..1usize << n)
        .map(|bs| {
            let mut max = [0; 2];
            let mut cs = bs;
            loop {
                let x = a[cs];
                if max[0] < x {
                    max[1] = max[0];
                    max[0] = x;
                } else if max[1] < x {
                    max[1] = x;
                }
                if cs == 0 {
                    break;
                } else {
                    cs = (cs - 1) & bs;
                }
            }
            max[0] + max[1]
        })
        .collect();
    let mut max = 0;
    for x in ans {
        if max < x {
            max = x;
        }
        println!("{}", max);
    }
}


Measured memory_bytes: 9996
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// ========== debug ==========
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// ===========================

int main() {
  int D;
  ins(D);

  vi c(26);
  vector<vi> s(D, vi(26));
  rep(i, 26) cin >> c[i];

  rep(i, D) {
    rep(j, 26)
      cin >> s[i][j];
  }

  vi t(D);
  ll ans = 0;
  rep(d, D) {
    cin >> t[d]; --t[d];
  }
  vi last(26, 0);
  rep(d, D) {
    ans += s[d][t[d]];
    last[t[d]] = d + 1;
    rep(i, 26) {
      ans -= c[i] * (d + 1 - last[i]);
    }
  }

  int in(M);
  rep(i, M) {
    int d, q;
    cin >> d >> q;
    --d; --q;
    t[d] = q;
    vi last(26, 0);
    ll ans = 0;
    rep(d, D) {
      ans += s[d][t[d]];
      last[t[d]] = d + 1;
      rep(i, 26) {
        ans -= c[i] * (d + 1 - last[i]);
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3588
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

X,Y=map(int,input().split())

#ListA=list(map(int,input().split()))


ans="No"
for i in range(0,X+1):
    if((i*2 + (X-i)*4)==Y):
        ans="Yes"
        break

print(ans)

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

int main(){
  int n,A,B;
    cin>>n>>A>>B;
  int ans=0;
  for(int i=0,t;i<n;i++){
    cin>>t;
    if(t<A||B<=t)ans++;
  }
  cout <<ans<<endl;
  return 0;
}


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

bool my_compare(pair<pair<string, int>,int> a, pair<pair<string, int>,int> b) {
	//first優先比較
	if (a.first.first != b.first.first) {
		return a.first.first < b.first.first; // 昇順
		//return a.first.first > b.first,first; // 降順
	}

	// それ以外はsecondで比較
	if (a.first.second != b.first.second) {
		//return a.first.second < b.first.second;//昇順
		return a.first.second > b.first.second;//降順
	}
	else {
		// どちらも同じ
		return true;
	}
}

int main(void){
	int n; cin >> n;
	int res = 0;
	vector<int> a(n), b(n), c(n-1);
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	rep(i, n - 1)cin >> c[i];
	int tmp = 10000;
	rep(i, n) {
		res += b[a[i]-1];
		if (tmp + 1 == a[i])res += c[a[i]-2];
		//cout << res << " ";
		tmp = a[i];
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();

        int b = sc.nextInt();

        int c = sc.nextInt();

        if (a < (b + c)) {
            System.out.println((b + c) - a);
        } else {
            System.out.println(0);
        }
    }
}



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

using namespace std;

char s[110];

int main()
{
    scanf("%s",s);
    int n=strlen(s),ans=0;
    for (int i=0;i<n;i++)
    {
        if (i>=n-1-i) break;
        if (s[i]!=s[n-1-i]) ans++;
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int a, b, c, k;

	cin >> a >> b >> c;
	cin >> k;

	int* p = &a;
	if (*p < b)p = &b;
	if (*p < c)p = &c;

	for (int i = 0; i < k; ++i)
	{
		*p = 2 * *p;
	}

	cout << a + b + c << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, k, a, b; cin >> k >> a >> b;
	if (a + 1 >= b) {
		cout << k + 1 << endl;
	}
	else {
		cout << (k + 1 - a) / 2 * (b - a) + (k + 1 - a) % 2 + a << endl;
	}
	cin >> n;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int ans=0,s,c=1000;
    for(int i=0;i<n;i++){
        cin>>s;
        ans+=s;
        if(s%10!=0&&c>s)c=s;
    }
    if(ans%10!=0)cout<<ans<<endl;
    else if(c!=1000)cout<<ans-c<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define YELLOW 'Y'
#define THREE "Three"
#define FOUR "Four"


string solve(long n, char *s) {

  for (int j = 0; j < n; j++) {
    if (s[j] == YELLOW)
      return FOUR;
  }
  return THREE;
}
  

int main()
{
  
  long n;
  char *s;
  cin >> n;
  s = new char[n];

  for (int i = 0; i < n; i++)
    cin >> s[i];

  cout << solve(n, s) << endl;
  
  return 0;
}

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

int main(){
  int N,Y;
  cin >> N >> Y;
  int x,y;
  int res10000 = -1, res5000 = -1, res1000 = -1;
  for(x=0;x<=N;x++){
    for(y=0;y<=N-x;y++){
      int total = 10000*x + 5000*y + 1000*(N-x-y);
      if(total == Y){
	res10000 = x;
	res5000 = y;
	res1000 = N - x -y;
      }
    }
  }

    cout << res10000 << " " << res5000 << " " << res1000 <<endl;
}  


Measured memory_bytes: 256
let a, b = Scanf.scanf " %d %d" @@ fun a b -> a, b
let f n =
  let s = string_of_int n in
  let cs = Array.to_list @@ Array.init (String.length s) @@ fun i -> s.[i] in
  cs = List.rev cs
let ans = ref 0
let _ = for i = a to b do if f i then incr ans done; Printf.printf "%d\n" !ans

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
#include<set>
int main(void){
    set<string> item;
    int n;
    cin >> n;
    //bool exist = false;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        string str;
        cin >> str;
        set<string>::iterator iti = item.find(str); 
        if(iti == item.end()){
            item.insert(str);
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 19228
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  int ans = (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]);
  puts(ans ? "Yes" : "No");
  return 0;
}


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

LL a, b, c, k;

int main()
{
    scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
    printf("%lld\n", (k % 2 == 0LL ? 1LL : -1LL ) * (a - b));
    return 0;
}


Measured memory_bytes: 768
#include <stdio.h>

int main(){
	int tall[10],temp,i,j;
	
	for(i=0;i<10;i++){
		scanf("%d",&tall[i]);
	}
	
	for(i=0;i<9;i++){
		for(j=9;j>i;j--){
			if(tall[j-1]>tall[j]){
				temp=tall[j];
				tall[j]=tall[j-1];
				tall[j-1]=temp;
			}
		}
	}
	
	printf("%d\n%d\n%d\n",tall[9],tall[8],tall[7]);
	
	return 0;
}

Measured memory_bytes: 0
l = sorted(list(map(int, input().split())))
aq = (l[2] - l[0]) // 2
ar = (l[2] - l[0]) % 2
bq = (l[2] - l[1]) // 2
br = (l[2] - l[1]) % 2
cnt = aq + bq

if ar == 1 and br == 1:
    print(cnt + 1)
elif ar == 1 or br == 1:
    print(cnt+2)
else:
    print(cnt)

Measured memory_bytes: 38256
#include <iostream>

using namespace std;

int main()
{
    while (1)
    {
        int a, b, c, n, w[1000], x[1000], y[1000], z[1000], st[301];
        cin>>a>>b>>c;
        if (a==0 && b==0 && c==0) break;
        cin>>n;
        for (int i=0; i<n; i++) cin>>w[i]>>x[i]>>y[i]>>z[i];
        for (int i=0; i<301; i++) st[i]=2;
        for (int i=0; i<n; i++)
        {
            if (z[i])
            {
                st[w[i]]=1;
                st[x[i]]=1;
                st[y[i]]=1;
            }
        }
        bool f=true;
        while (f)
        {
            f=false;
            for (int i=0; i<n; i++)
            {
                if (!z[i])
                {
                    if (st[w[i]]==1 && st[x[i]]==1 && st[y[i]]==2) { st[y[i]]=0; f=true; }
                    if (st[w[i]]==1 && st[x[i]]==2 && st[y[i]]==1) { st[x[i]]=0; f=true; }
                    if (st[w[i]]==2 && st[x[i]]==1 && st[y[i]]==1) { st[w[i]]=0; f=true; }
                }
            }
        }
        for (int i=1; i<=a+b+c; i++) cout<<st[i]<<'\n';
    }
    return 0;
}



Measured memory_bytes: 2976
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		String A = "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";
		String[] s = A.split(", ");

		Scanner scanner = new Scanner(System.in);
		int K = scanner.nextInt();
		System.out.println(s[K-1]);
	}

}


Measured memory_bytes: 20820
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    cout << ((B-A)%2 == 1 ? "Borys" : "Alice") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;

int main(){
        int n;
        scanf("%d", &n);
        int mn=1e9, tmp;
        for(int i=0; i<n; i++){
                scanf("%d", &tmp);
                mn = std::min(mn, tmp&(-tmp));
        }

        int cnt = -1;
        while(mn){
                cnt++;
                mn >>= 1;
        }

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

Measured memory_bytes: 256
def abc170d_not_divisible():
    n = int(input())
    cnt = 0
    a = sorted(list(map(int, input().split())))
    flgs = [True] * (a[-1]+1)
    if n == 1:
        print(1)
        return
    for i in range(n):
        if i != n - 1 and a[i] == a[i + 1]:
            flgs[a[i]] = False
            continue
        for j in range(a[i] * 2, a[-1] + 1, a[i]):
            flgs[j] = False
        if flgs[a[i]]:
            cnt += 1
    print(cnt)


abc170d_not_divisible()

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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

long long x;
long long y;
int main()
{
    #ifdef FILEs
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    cin >> x >> y;
    if(min(x, y) == 1){
        cout << "1\n";
        return 0;
    }
    cout << (((y + 1) / 2) * ((x + 1) / 2)) + ((y / 2) * (x / 2)) << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, n; cin >> k >> n;
    vector<int> a(n); rep (i, n) cin >> a[i];
    int r = a[0] + k - a.back(); rep (i, n - 1) chmax(r, a[i + 1] - a[i]);
    cout << k - r << "\n";
    return 0;
}

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

int main()
{
  int c11, c12, c13, c21, c22, c23, c31, c32, c33, r2, r3, d2, d3;
  cin >> c11 >> c12 >> c13 >> c21 >> c22 >> c23 >> c31 >> c32 >> c33;
  r2 = c12 - c11;
  r3 = c13 - c11;
  d2 = c21 - c11;
  d3 = c31 - c11;
  if (c22 == c11+r2+d2 && c23 == c11+r3+d2 && c32 == c11+r2+d3 && c33 == c11+r3+d3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

template<int_fast64_t m=MOD>
struct Mcomb{
  using i64=int_fast64_t;
  vector<i64>f;  //$B3,>h(B
  vector<i64>finv; //$B3,>h$N5U85(B
  vector<i64>inv;  //$B5U85(B

  Mcomb(i64 max){
    f.resize(max+1,0);
    finv.resize(max+1,0);
    inv.resize(max+1,0);
    f[0]=f[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(i64 i=2;i<=max;i++){
      f[i]=f[i-1]*i%m;
      inv[i]=m-inv[m%i]*(m/i)%m;
      finv[i]=finv[i-1]*inv[i]%m;
    }
  }

  //nCr=n!/r!(n-r)!
  i64 slove(i64 n,i64 r){
    if(n<r)return 0;
    if(n<0||r<0)return 0;
    return (f[n]*(finv[r]*finv[n-r]%m)%m)%m;
  }
};

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

  int s;
  cin>>s;
  Mcomb<MOD>c(2000);

  ll ans=0;
  for(int i=1;i<=1000;i++){
    int d=s-3*i;
    if(d<0)continue;
    ans=(ans+c.slove(d+i-1,d))%MOD;
  }

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


Measured memory_bytes: 3608
N = int(input())
S = []
L = {}
maxL = 0
maxS = []
for i in range(N):
    s = input()
    if s in L:
        L[s] += 1
    else:
        L[s] = 1
        
    if maxL < L[s]:
        maxL = L[s]
        maxS = [s]
    elif maxL == L[s]:
        maxS.append(s)

maxS.sort()
for ans in maxS:
    print(ans)

Measured memory_bytes: 33416
from sys import stdin
import numpy as np
def main():
    #入力
    readline=stdin.readline
    n,max_c=map(int,readline().split())
    d=[list(map(int,readline().split())) for _ in range(max_c)]
    d=np.array(d,dtype=np.int64)
    c=[list(map(lambda x:int(x)-1,readline().split())) for _ in range(n)]

    #前処理
    color_table=np.zeros((3,max_c),dtype=np.int64)
    for i in range(n):
        for j in range(n):
            color_table[(i+j+2)%3,:]+=d[c[i][j],:]

    #全探索
    ans=float("inf")
    for i in range(max_c):
        for j in range(max_c):
            for k in range(max_c):
                if i==j or j==k or k==i:
                    continue
                ans=min(ans,color_table[0][i]+color_table[1][j]+color_table[2][k])

    print(ans)

if __name__=="__main__":
    main()

Measured memory_bytes: 15056
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> memo(N, 0);
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    memo.at(A - 1)++;
  }
  sort(memo.begin(), memo.end());
  reverse(memo.begin(), memo.end());
  int B = 0;
  for (int i = 0; i < K; i++) {
    B += memo.at(i);
  }
  cout << N - B << endl;
}

Measured memory_bytes: 4060
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto c){if (a > c) {a = c; return true;} return false;};
auto cmx = [](auto& a, auto c){if (a < c) {a = c; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v) {
  for (auto & x : v) is >> x;
  return is;
}

template <typename T>
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
  auto n = v.size();
  os << "{";
  for (size_t i = 0; i < n; i++)
    {os << (i > 0 ? "," : "") << v.at(i);}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, k; std::cin >> n >> k;
  std::vector< int > a(n); std::cin >> a;
  std::vector< int > b(n, 0), c(n, 0);
  rep(i, 0, n) {
    auto crr = a.at(i);
    if (crr > 0) b.at(i) = crr;
    else         c.at(i) = -crr;
  }
  lint sum = std::accumulate(all(b), 0LL);
  auto ret = 0LL;
  auto plus  = std::accumulate(b.begin(), b.begin() + k, 0LL);
  auto minus = std::accumulate(c.begin(), c.begin() + k, 0LL);
  rep(r, k, n + 1) {
    auto l = r - k;
    cmx(ret, sum - plus);
    cmx(ret, sum - minus);
    if (r == n) break;
    plus  += b.at(r);
    plus  -= b.at(l);
    minus += c.at(r);
    minus -= c.at(l);
  }
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
typedef long long ll;
int main(void){
    int a,b,c,d,tmp;
    cin >> a >> b >> c >> d;
    cout << max(0,min(b,d)-max(a,c)) << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    ll n ;
    cin >> n ;
    vll c(n-1), s(n-1), f(n-1) ;
    REP(i,n-1){
        cin >> c[i] >> s[i] >> f[i] ;
    }
    vll sum(n-1) ;
    REP(i,n){
        ll j = i ;
        ll t = 0 ;
        while(j!=n-1){
            ll tmp = max((ll)0,(ll)ceil((double)(t-s[j])/(double)f[j])) ;
            t = s[j] + f[j]*tmp ;
            t += c[j] ;
            j++ ;
        }
        cout << t << endl;
    }



    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



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

int main(){
	int N;
	cin >> N;
	int l[N];
	for (int i = 0; i < N; i++){
		l[i] = 0;
	}
	for(int i = 1; i < N; i++){
		int aa;
		cin >> aa;
		l[aa - 1] = l[aa - 1] + 1;
	}
	
	for(int i = 0; i < N; i++){
		cout << l[i] << endl;
	}
	
	return 0;
} 

Measured memory_bytes: 4376
#ifdef Rahul
#include "RAHUL.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

#include <atcoder/convolution>
using Mint = atcoder::modint998244353;

int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  int n, m; cin >> n >> m;
  vector<Mint> a(n), b(m);
  for (auto &x : a) {
    int y; cin >> y;
    x = y;
  }
  for (auto &x : b) {
    int y; cin >> y;
    x = y;
  }
  auto c = atcoder::convolution(a, b);
  for (auto &x : c) cout << x.val() << ' ';
}


Measured memory_bytes: 19048
<?php
  
  //3をかけたところで２で割れるポテンシャルはかわらない。
  //なら、nこのそれぞれの数値が２で何回われるかみて、
  //それを足し合わせた値が操作数の最大値
  
fscanf(STDIN,"%d",$n);
$s_li=array();
$t_li=array();
for($i=0;$i<$n;$i++){
  $s_li[] = trim(fgets(STDIN));
}
fscanf(STDIN,"%d",$m);

for($i=0;$i<$m;$i++){
  $t_li[] = trim(fgets(STDIN));
}

$re=array();
foreach($s_li as $s){
 $re[$s]++;
}
foreach($t_li as $t){
 $re[$t]--;
}



sort($re);
//print_r($re);
 
if(end($re)>0){
 echo end($re)."\n";
}else{
  echo "0\n";
}

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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

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

	int x;
	cin >> x;
	cout << 10 - (x / 200) << endl;
	return 0;
}



Measured memory_bytes: 3644
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my ($n, $m) = split / /, <STDIN>);
my (@a, @b);
for my $i (0..$n-1) {
  chomp (($a[$i], $b[$i]) = split / /, <STDIN>);
}
my %h;
$h{$_}++ for @a;
$h{$_}++ for @b;
for $_ (values %h) {
  if ($_%2>0) {
    say "NO";
    exit;
  }
}
say "YES";

Measured memory_bytes: 27520
#include <iostream>
#include <string>

using namespace std;

int main(){

  string a, b, c;

  cin >> a >> b >> c;


  if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){

    cout << "YES" << endl;
  }

  else{
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <cstdio>
# include <cmath>
# include <cstring>
# include <string>
# include <cstdlib>
# include <algorithm>
# include <stack>
# include <queue>
# include <vector>
# define maxx (103)
# define Pi (3.14159265358979)
# define inf (2147483647)
using namespace std;
int a[55];
int n,k,ans;
int read() {
	int x=0,f=1;
	char ch;
	while(ch<'0'||ch>'9')  {
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		x=x*10+ch-'0';
		ch=getchar();
	}
	return f*x;
}
bool cmp(int a,int b){
	return a>b;
}
int main() {

	n=read();
	k=read();
	
	int i;
	for(i = 1;i <= n;i++){
		a[i]=read();
	}
	
	sort(a+1,a+1+n,cmp);
	
	for(i = 1;i <= k;i++){
		ans+=a[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdin = new Scanner(System.in);	
		int a=stdin.nextInt();
		int b=stdin.nextInt();
		int c=stdin.nextInt();
		if(a==b) {
			System.out.println(c);
		} else if(b==c) {
			System.out.println(a);
		} else if(a==c) {
			System.out.println(b);
		}



	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector <int> vec(3);
  for (int i = 0 ; i< 3;i++){
  cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int D;
  D = vec.at(2)*10+vec.at(1)+vec.at(0);
  cout << D;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include<regex>
#include<vector>
#include<algorithm>
using namespace std;

struct person
{
    int id;
    int num;
};

int main()
{   
    vector<person> people;
    int peopleNumber;
    cin >> peopleNumber;
    
    for(int i = 1; i <= peopleNumber; i++)
    {
        int h;
        cin >> h;
        people.push_back({i,h});
    }
    
    sort(people.begin(), people.end(), 
     [](const person& x, const person& y) { return x.num < y.num;});
    
    for(auto person : people)
    {
        cout << person.id << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sc.close();

		String[] sArray = s.split("");
		String[] tArray = t.split("");

		int ans = 0;
		for(int i = 0;i<sArray.length;i++) {
			if(!(sArray[i].equals(tArray[i]))) {
				ans ++;
			}
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 67124
# coding: utf-8
import re
import math
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
#import numpy as np
mod=int(10**9+7)
inf=int(10**20)
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def comb(n,r):return math.factorial(n)//math.factorial(n-r)//math.factorial(r)
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
 

 
#main
h,n=map(int,input().split())
A=list(map(int,input().split()))
sum_=sum(A)
if sum_<h:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 79552
n = int(input())
ans = 0
if n < 105:
    print(0)
else:
    for i in range(1,n+1,2):
        count = 0
        for l in range(1, i+1, 2):
            if i % l == 0:
                count += 1
        if count == 8:
            ans += 1
    print(ans)

Measured memory_bytes: 63612
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b, c = rm()
print('Yes' if a+b >= c else 'No')















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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string a,b;
  cin >> a >> b;
  
  ll sumA = 0;
  REP(i, a.size()){
    sumA *= 10;
    sumA += (a[i] - '0');
  }

  REP(i, b.size()){
    sumA *= 10;
    sumA += (b[i] - '0');
  }


  string ans = "No";
  for(ll i = 1; i*i <= sumA; i++){
    if(i*i == sumA)
      ans = "Yes";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256