akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;
const int MAXN = 105;
char str[MAXN];
int n,k,f[MAXN][2];

inline ll calc(int l, int r)
{
	int cnt = 0, res = 0;
	for(int i = l; i<=r+1; i++)
	{
        if((i!=l&&str[i]!=str[i-1])||i==r+1)
        {
            res += cnt/2;
            cnt = 1;
		}
		else
		    cnt++;
	}
	return res;
}
 
int main()
{
    cin >> str+1;
    cin >> k;
    ll ans = 0;
    n = strlen(str+1);
    int tmp = 0;
    if(str[1]==str[n])
    {
        bool flag = true;
        for(int i = 2; i<=n; i++)
            if(str[i]!=str[i-1])
                flag = false;
        if(flag)
        {
            cout << 1ll*n*k/2 << endl;
            return 0;
		}
		else
		{
			cout << 1ll*(k-1)*min(calc(1,n-1),calc(2,n))+k-1+calc(1,n) << endl;
		    return 0;
		}
	}
	else
	{
        cout << 1ll*k*calc(1,n) << endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 1e6 + 5;
const int INF = 1e9 + 7;

ll n;

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    cout << n + (n * n) + (n * n * n);

    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
#define pi 3.141592653589
using namespace std;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
signed main(){
	ll n, m, k;
	cin >> n >> m >> k;
	ll memo = gcd(n, m);
	for (int i = memo; i >=1; i--) {
		if (memo%i == 0)k--;
		if (k == 0) {
			cout << i << endl;
			return 0;
		}
	}
	getchar(); getchar(); return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define df 0

int main(){
  int n,x;
  scanf("%d%d",&n,&x);
  int i,L,s=0,count=1;
 for(i=0;i<n;i++){
   scanf("%d",&L);
   s+=L;
   if(s<=x)count++;
 }

 printf("%d",count);
}

///  confirm df==0  ///


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,i,j,a;
	long long cnt[102][22]={0};
	scanf("%d",&n);
	scanf("%d",&a);
	cnt[2][a]=1;
	for(i=2;i<=n;i++){
		scanf("%d",&a);
		for(j=0;j<=20;j++){
			if(j+a<=20){
				cnt[i+1][j+a]+=cnt[i][j];
			}
			if(j-a>=0){
				cnt[i+1][j-a]+=cnt[i][j];
			}
		}
	}
	printf("%lld\n",cnt[n][a]);
	return 0;
}


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

signed main() {
    int n,m;
    cin >> n >> m;

    int sum = 0;
    vector<int> a(n);
    rep(i,n) {
        cin >> a[i];
        sum += a[i];
    }

    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    bool flag = true;
    for(int i = 0; i < m; i++){
        if(a[i] * 4 * m < sum) flag = false;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}
    



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int maxn=512345;
const int inf=0x3f3f3f3f;
int n,m,p[maxn],q[maxn],c[maxn],d[maxn];
vector<long long> id;
vector<pii> G[maxn];
priority_queue<pii,vector<pii>,greater<pii>> que;
inline int get(long long x) {
    return lower_bound(id.begin(),id.end(),x)-id.begin()+1;
}
inline void addedge(int u,int v,int w) {
    G[u].push_back(pii(v,w));
    G[v].push_back(pii(u,w));
}
int main()
{
    scanf("%d%d",&n,&m);
    for (int i=1;i<=m;++i) scanf("%d%d%d",&p[i],&q[i],&c[i]);
    for (int i=1;i<=n;++i) id.push_back(i);
    for (int i=1;i<=m;++i) {
        id.push_back(p[i]*1000000ll+c[i]);
        id.push_back(q[i]*1000000ll+c[i]);
    }
    sort(id.begin(),id.end());
    for (int i=1;i<=m;++i) {
        addedge(get(p[i]),get(p[i]*1000000ll+c[i]),1);
        addedge(get(q[i]),get(q[i]*1000000ll+c[i]),1);
        addedge(get(p[i]*1000000ll+c[i]),get(q[i]*1000000ll+c[i]),0);
    }
    memset(d,0x3f,sizeof d);
    d[get(1)]=0;
    que.push(pii(0,get(1)));
    while (!que.empty()) {
        int u=que.top().second;
        int o=que.top().first;
        que.pop();
        if (o>d[u]) continue;
        for (int i=0;i<(int)G[u].size();++i) {
            int v=G[u][i].first;
            int w=G[u][i].second;
            if (d[v]>d[u]+w) {
                d[v]=d[u]+w;
                que.push(pii(d[v],v));
            }
        }
    }
    if (d[n]==inf) d[n]=-2;
    printf("%d\n",d[n]/2);
    return 0;
}


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

int main()
{
	int n;
	const int length[] = { 60, 80, 100, 120, 140, 160, 100000000 };
	const int weight[] = { 2, 5, 10, 15, 20, 25, 100000000 };
	const int cost[] = { 600, 800, 1000, 1200, 1400, 1600, 0 };

	while( cin >> n && n ){
		int result = 0;
		for( int i = 0; i < n; ++i ){
			int x, y, h, w;
			cin >> x >> y >> h >> w;
			int l = x + y + h;
			int gl = 0, gw = 0;
			while( l > length[ gl ] ){
				++gl;
			}
			while( w > weight[ gw ] ){
				++gw;
			}
			result += cost[ max( gl, gw ) ];
		}
		cout << result << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int x,a,b,n;
int main(){
	cin>>x>>a>>b>>n;
	rep(i,n){
		string s; cin >> s;
		if(s[0] == 'n') { x = max(0,x+a); }
		else if(s[0] == 't') { x = max(0,x+b); }
		else x = 0;
	}
	cout << x << endl;
}


Measured memory_bytes: 3208
# coding: utf-8
while True:
    n = list(map(int,input().split()))
    if n[0] == 0:
        break
    for i in range(n[0]):
        if i == 0 or i == n[0]-1:
            print("#"*n[1])
        else:
            print("#"+"."*(n[1]-2)+"#")
    print()


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

int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  vector< pair<int, int> > ans;
  int m = 0;
  int amax = -10000000, amin = 10000000;
  int amaxn, aminn;
  bool allp = true, allm = true;
  REP(i,N) {
    cin >> A[i];
    if ( amax < A[i] ) {
      amax = A[i];
      amaxn = i;
    }
    if ( amin > A[i] ) {
      amin = A[i];
      aminn = i;
    }
    if ( A[i] >= 1 ) allm = false;
    if ( A[i] <= -1 ) allp = false;
  }
  if ( !allp && !allm ) {
    m = N;
    if ( abs(amax) > abs(amin) ) {
      REP(i,N) ans.push_back( { amaxn+1, i+1 } );
    } else {
      REP(i,N) ans.push_back( { aminn+1, i+1 } );
    }
  }
  m += N-1;
  if ( abs(amax) > abs(amin) ) {
    REP(i,N-1) ans.push_back( {i+1, i+2} );
  } else {
    for(int i=N; i>=2; i--) ans.push_back( {i, i-1} );
  }
  cout << m << endl;
  for ( auto a : ans )
    cout << a.first << " " << a.second << endl;
}



Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <map>
#include <queue>

int main(){
    int n, m;
    std::cin >> n >> m;

    std::priority_queue<int> pq;
    for (int i = 0; i < n; i++)
    {
        int a;
        std::cin >> a;
        pq.push(a);
    }
    for (int i = 0; i < m; i++)
    {
        int b = pq.top();
        pq.pop();
        pq.push(b / 2);
    }
    unsigned long long int ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans += pq.top();
        pq.pop();
    }
    
    std::cout << ans << std::endl;

    return 0;
}

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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N; cin >> N;
    int Q; cin >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << '\n';
}


Measured memory_bytes: 21728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


struct UnionFind{
    vector<int> par;

    UnionFind(int n) : par(n,-1) { }
    void init(int n) { par.assign(n,-1); }

    int root(int x){
        if(par[x]<0) return x;
        else return par[x]=root(par[x]);
    }

    bool issame(int x,int y){
        return root(x)==root(y);
    }

    bool merge(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(par[x]>par[y]) swap(x,y);
        par[x]+=par[y];
        par[y]=x;
        return true;
    }

    int size(int x){
        return -par[root(x)];
    }
};

int main(){
    int N;
    cin>>N;
    vector<pair<int,int>> x,y;
    rep(i,N){
        int a,b;
        cin>>a>>b;
        x.push_back({a,i});
        y.push_back({b,i});
    }

    sort(all(x));
    sort(all(y));
    // Kruskal 法で使用する枝
    using pint = pair<int,int>;
    using Edge = pair<ll, pint>;
    vector<Edge> edges;
    //枝入力
    rep(i,N-1){
        int u=x[i].second;
        int v=x[i+1].second;
        ll c=x[i+1].first-x[i].first;
        edges.push_back({c, pint(u, v)});
    }
    rep(i,N-1){
        int u=y[i].second;
        int v=y[i+1].second;
        ll c=y[i+1].first-y[i].first;
        edges.push_back({c, pint(u, v)});
    }

    // Kruskal 法
    sort(all(edges));
    // unionfindのスニペット読み込んで
    UnionFind uf(N);
    ll res = 0;
    for (auto e : edges) {
        int u = e.second.first, v = e.second.second;
        ll cost = e.first;
        if (uf.issame(u, v)) continue;
        uf.merge(u, v);
        res += cost;
    }
    cout << res << endl;

}


Measured memory_bytes: 7784
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {
    vector<string> v;
    v.push_back("Sunny");
    v.push_back("Cloudy");
    v.push_back("Rainy");

    string s, ans;
    cin >> s;
    REP(i, 3){
        if (v[i] == s) ans = v[(i + 1) % 3];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
function main(){
  for(var y=0;y<14;y++){
    for(var x=0;x<14;x++){
      eval("f"+ x + "" + y + " = 0;");
    }
  }
  
  for(var i=0,len=input.length - 1;i<len;i++){
    eval("d"+input[i][4]+"("+(input[i][0]-0+2)+","+(input[i][2]-0+2)+");");
  }

  var nd=0;//not dropped
  var md=0;//most dropped
  for(var y=2;y<12;y++){
    for(var x=2;x<12;x++){
      if(eval("f"+ x + "" + y) == 0)
        nd++;
      if(eval("f"+ x + "" + y) > md)
        md = eval("f"+ x + "" + y);
    }
  }

  console.log(nd);
  console.log(md);
}

function d1(x, y){
  eval("f"+ x + "" + y + "++;");
  eval("f"+ (x-0+1) + "" + y + "++;");
  eval("f"+ (x-1) + "" + y + "++;");
  eval("f"+ x + "" + (y-0+1) + "++;");
  eval("f"+ x + "" + (y-1) + "++;");
}

function d2(x, y){
  d1(x, y);
  eval("f"+ (x-0+1) + "" + (y-0+1) + "++;");
  eval("f"+ (x-0+1) + "" + (y-1) + "++;");
  eval("f"+ (x-1) + "" + (y-0+1) + "++;");
  eval("f"+ (x-1) + "" + (y-1) + "++;");
}

function d3(x, y){
  d2(x, y);
  eval("f"+ x + "" + (y-0+2) + "++;");
  eval("f"+ x + "" + (y-2) + "++;");
  eval("f"+ (x-0+2) + "" + y + "++;");
  eval("f"+ (x-2) + "" + y + "++;");
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 8172
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap, VecDeque};

fn main() {
    input! {
        n: usize,
    }
    let ans = if n == 1 {0} else {1};
    println!("{}", ans);
}


Measured memory_bytes: 2084
#include<bits/stdc++.h>
#define MAXN 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,k,a[MAXN];
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=k+1;i<=n;i++) if(a[i]>a[i-k]) puts("Yes"); else puts("No");
    return 0;
}

Measured memory_bytes: 4536
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
M = [A,B,C,D,E]

Min = min(A,B,C,D,E)
L = M.count(Min)
    
if N % Min == 0:
    Ans = N//Min + 4
else:
    Ans = N//Min + 5
print(Ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,b,a) for (ll i=b;i>=a;i--)
#define ff first
#define ss second
#define pi 3.14159265359
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll FCB=1e9+7;
ll dir[][2]={{0,-1},{0,1},{1,0},{-1,0}};


int main()
{
 hs;
 ll a,b;
 cin>>a>>b;
 cout<<a*b<<"\n";
 return 0;
}


Measured memory_bytes: 3656
# import sys
import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import copy
# import bisect
# import numpy as np
# from scipy.special import comb

# def my_input(): return sys.stdin.readline().rstrip()
# sys.setrecursionlimit(100000)
# INF = 1001001001001
# MOD = 1000000007


def main():

    A, B = map(int, input().split())
    a1 = A * 12.5
    a2 = (A + 1) * 12.5
    b1 = B * 10
    b2 = (B + 1) * 10

    ans = math.ceil(max(a1, b1))
    if ans < a2 and ans < b2:
        print(ans)
    else:
        print("-1")


if __name__ == '__main__':
    main()


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

typedef long long ll;

const ll MOD = 1e9 + 7;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    int N;
    cin >> N;
    vector<pair<int, int>> LR(N);
    rep(i, N) cin >> LR[i].first >> LR[i].second;
    sort(LR.begin(), LR.end());
    vector<int> L1(N + 1, 1), R1(N + 1, 1e9), L2(N + 1, 1), R2(N + 1, 1e9);
    rep(i, N) {
        L1[i + 1] = max(L1[i], LR[i].first);
        R1[i + 1] = min(R1[i], LR[i].second);
        L2[N - i - 1] = max(L2[N - i], LR[N - i - 1].first);
        R2[N - i - 1] = min(R2[N - i], LR[N - i - 1].second);
    }
    int ans = 0;
    rep(i, N - 1) {
        ans = max(ans, max(0, R1[i + 1] - L1[i + 1] + 1) + max(0, R2[i + 1] - L2[i + 1] + 1));
    }
    sort(LR.begin(), LR.end(), compare_by_b);
    rep(i, N) {
        L1[i + 1] = max(L1[i], LR[i].first);
        R1[i + 1] = min(R1[i], LR[i].second);
        L2[N - i - 1] = max(L2[N - i], LR[N - i - 1].first);
        R2[N - i - 1] = min(R2[N - i], LR[N - i - 1].second);
    }
    rep(i, N - 1) {
        ans = max(ans, max(0, R1[i + 1] - L1[i + 1] + 1) + max(0, R2[i + 1] - L2[i + 1] + 1));
    }
    rep(i, N) ans = max(ans, LR[i].second - LR[i].first + 1);
    int maxi = 0, maxd = -1;
    rep(i, N) {
        int d = LR[i].second - LR[i].first + 1;
        if (d > maxd) {
            maxd = d;
            maxi = i;
        }
    }
    int L = 1, R = 1e9;
    rep(i, N) {
        if (i == maxi) continue;
        L = max(L, LR[i].first);
        R = min(R, LR[i].second);
    }
    ans = max(ans, maxd + max(0, R - L + 1));
    cout << ans << endl;
    //rep(i, N + 1) cout << L1[i] << R1[i] << L2[i] << R2[i] << endl;
}
/*
xxxoooox
ooooxxxx
xxxxoooo
xooooxxx
*/

Measured memory_bytes: 2560
#include <iostream>
#include <string>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((a == b && a == c && b == c) || (a != b && a != c && b != c)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define rep2(i,k,n) for(int i=k;i>=n;i--)
using namespace std;
typedef long long ll;
typedef double db;
const int N=1e5+7;
int a[N],n;
int main(){
	scanf("%d",&n);
	rep(i,1,n)scanf("%d",&a[i]);
	int op=0,ne=0,kk=1,now=a[1];
	rep(i,2,n)if(a[i]!=a[i-1]){
		if(a[i]>now)ne=1;
		else ne=2;
		if(!op)op=ne;
		else if(op!=ne){
			kk++;
			op=0;
		}
		now=a[i];
	}
	printf("%d\n",kk);
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<P> judge(n);
    int ac = 0, wa = 0;
    rep(i,m){
        int p;
        cin >> p;
        p--;
        string s;
        cin >> s;

        if(s == "AC" && judge[p].first == 0){
            judge[p].first++;
            ac++;
            wa += judge[p].second;
        }else judge[p].second++;
    }
    cout << ac << " " << wa << endl;
    return 0;
}


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

int main(){
    int A,B;
    cin >> A >> B;
    
    if((A+B)%2 == 1){
        cout << "IMPOSSIBLE" << endl;
    }else{
        cout << (A+B)/2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define pop(v) (v).back(); (v).pop_back()
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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; }

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

    int n;
    cin>>n;
    co(48-n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i = (a); i < (b); ++i)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define pb push_back
#define fs first
#define sc second
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int INF = ~(1<<31);
const double pi = acos(-1);
const int EPS = 1e-9;

int n;
vector<double> P;
double mem[3000][3000];
double dp(int heads, int tails){
    if(heads+tails == n){
        if(heads > tails){
            return 1;
        }
        return 0;
    }
    if(mem[heads][tails] != -1) return mem[heads][tails];
    double sm = 0;
    sm += P[heads+tails]*dp(heads+1, tails);
    sm += (1-P[heads+tails])*dp(heads, tails+1);
    return mem[heads][tails] = sm;
}

int main(){
    cin >> n;
    P = vector<double>(n);
    rep(i,0,n) rep(x,0,n) mem[i][x] = -1;
    rep(i,0,n) cin >> P[i];
    cout << fixed << setprecision(12) << dp(0,0) << endl;
    return 0;
}



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

typedef long long ll;

int a, b;

int x[3];

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

    x[0] = a+b;
    x[1] = a-b;
    x[2] = a*b;

    sort(x, x+3);

    cout << x[2] << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a // g * b

# 解説によるO(N)解法


N = a_int()
ans = 0

'''
以下のような問題を高速化したい
for k in range(1, N + 1):
    for j in range(1, N + 1):
        ans += k * (k % j == 0)  # jがkの約数になっていれば加算する

式の形からk,jはひっくり返せる
jをgivenとしたとき, k * (k%j==0)となる数列の和を高速に列挙する。
→この数列はkがjの倍数のときだけ値をとる→nonzero数列だけに注目すると以下のように言い換えられる
「jの倍数であってN以下であるものの数列」の和を高速に知りたい

1j+2j+3j...yjを求めたいただし,yj<=N (⇔ y<=N//j)
j*((1+y)*y)//2と式変形可能

'''
for j in range(1, N + 1):
    y = N // j
    ans += j * (1 + y) * y // 2
print(ans)


Measured memory_bytes: 67852
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

int main() {
    ll n, k;
    cin >> n >> k;

    vl v(n);
    rep(i, n) {
        cin >> v[i];
    }

    ll ans = -INF;
    exrep(L, 0, n) {
        exrep(R, 0, n) {
            if(L+R > k) {
                continue;
            }
            if(L+R > n) {
                continue;
            }
            ll x = k - (L+R);
            vl w;
            rep(i, L) {
                w.pb(v[i]);
            }
            for(ll i = n-1; i >= n-R; i--) {
                w.pb(v[i]);
            }
            sort(all(w));
            ll now = 0;
            rep(i, w.size()) {
                if(i < x && w[i] < 0) {
                    continue;
                }
                now += w[i];
            }
            chmax(ans, now);
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  string s; cin >>s;
  cout <<s;
  if(s[s.size()-1]=='s') cout <<"es";
  else cout <<'s';
}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  //int T; cin >>T; while(T--)
  solve();
return 0;}


Measured memory_bytes: 3648
s = str(input())
def strop(s,c):
    
    count = 0
    while len(set(s)) != 1:
        t = ''
        for i in range(len(s)-1):
            if s[i] == c or s[i+1] == c:
                t += c
            else:
                t += s[i]
        s = t
        #print(s)
        count += 1
    return count
            
mn = 10**9
for i in range(len(set(s))):
    mn = min(mn,strop(s,list(set(s))[i]))
print(mn)
    

Measured memory_bytes: 9124
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
typedef long long ll;
#define MAX 2500
int main(){
  ll N,A,x[60],dp[60][60][MAX+10]={0};
  cin>>N>>A;
  for(int i=0;i<N;i++){
    cin>>x[i];
  }
  dp[0][0][0]=1;
  for(int i=0;i<60;i++){
    dp[i][0][0]=1;
  }

  for(int j=1;j<=N;j++){
    for(int k=1;k<=j;k++){
      for(int s=1;s<=MAX;s++){
        if(x[j-1]>s){
          dp[j][k][s]=dp[j-1][k][s];
        }else{
          dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]];
        }
      }
    }
  }
  ll ans=0;
  for(int i=1;i<=N;i++){
    ans+=dp[N][i][i*A];
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 70784
#include<stdio.h>

int main()
{
	int x, a, b;
	scanf("%d %d %d", &x, &a, &b);
	if (x > a) {
		a = x - a;
	}
	else {
		a = a - x;
	}
	if (x > b) {
		b = x - b;
	}
	else {
		b = b - x;
	}
	if (a > b) {
		printf("B");
	}
	else {
		printf("A");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int nil = -1;
int N;


struct Node {
    int id;
    int left, right, parent;
};

Node *nodes;

/*
 * 左子右兄弟表現
 */

int depth(int m) {
    int d = 0;
    while (true) {
        if (nodes[m].parent != nil) {
            d++;
            m = nodes[m].parent;
        } else break;
    }
    return d;
}

string type(int m) {
    if (nodes[m].parent == nil) {
        return  "root";
    } else if (nodes[m].left != nil) {
        return "internal node";
    } else {
        return "leaf";
    }

}

int main() {
    cin >> N;
    nodes = new Node [N];

    for (int k = 0; k < N; ++k) {
        nodes[k].left = nodes[k].right = nodes[k].parent = nil;
    }

    for (int i = 0; i < N; ++i) {
        int d;
        int nod ;
        cin >> nod >>  d;
        nodes[i].id = nod;
        int l;
        for (int j = 0; j < d; ++j) {
            int c;
            cin >> c;
            if (j == 0) nodes[nod].left = c;
            else nodes[l].right = c;

            l = c;
            nodes[c].parent = nod;
        }
    }

    for (int m = 0; m < N; ++m) {
        cout << "node " << m << ": parent = " << nodes[m].parent << ", depth = " << depth(m) << ", " << type(m);
        int i = nodes[m].left;
        if (nodes[m].left == nil) {
            cout << ", []" << endl;
            continue;
        }
        cout << ", [";
        while(true) {
            cout << i;
            if (nodes[i].right != nil) {
                cout << ", ";
                i = nodes[i].right;
            } else break;
        }
        cout << "]" << endl;
    }
    return 0;
}




Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int K,N;
  cin>>K>>N;
  int arr[N],i;
  for(i=0;i<N;i++)
    cin>>arr[i];
  if(N==2)
  {
    if(arr[1]-arr[0]<K/2)
      cout<<arr[1]-arr[0];
    else
      cout<<K-(arr[1]-arr[0]);
  }
  else
  {
  int maxx=INT_MIN;
  for(i=1;i<N;i++)
    maxx=max(maxx,arr[i]-arr[i-1]);
  maxx=max(maxx,K-(arr[N-1]-arr[0]));
    cout<<(K-maxx);
  } 
}


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

int solve(int x)
{
	int num = x;
	int count = 0;

	while (num / 10 != 0) {
		int maxx = 0;
		for (int i = 1; num / i != 0; i *= 10) {
			int temp1 = num / i;
			int temp2 = num%i;

			maxx = max(maxx, temp1*temp2);
		}
		num = maxx;
		count++;
	}

	return count;
}

int main()
{
	int n;
	cin >> n;

	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;

		cout << solve(x) << endl;
	}

	return 0;
}

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

using namespace std;
const int INF = 1000000000;

int main(){
	while(true){
		int e;
		cin >> e;
		if(e == 0){ break; }
		int answer = INF;
		for(int z = 0; z * z * z <= e; ++z){
			for(int y = 0; z * z * z + y * y <= e; ++y){
				int x = e - y * y - z * z * z;
				answer = min(answer, x + y + z);
			}
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>

using namespace std;
using int64 = long long;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i=0; i<n; i++) cin >> l[i];
    sort(l.begin(), l.end());

    int ans = 0;
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
          auto it = lower_bound(l.begin(), l.end(), l[i]+l[j]);
          int cnt = it - l.begin();
          cnt -= j+1; // 既に使ったやつ分引いておく
          ans += max(0, cnt);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 384
n=int(input())
R=[0]*n
for i in range(n):
  R[i]=int(input())
max_r=-10000000000
min_r=10000000000
benefit=[-60000000000]*2*n

for x in R:
    if max_r<x-min_r:
        max_r=x-min_r
    if min_r>x:
        min_r=x

print(max_r)


Measured memory_bytes: 16540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()	
{
	int n,a[105]={},b[105]={};
	vector<int>v;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		b[i]+=b[i-1];
	}
	for(int i=1;i<=n;i++)
	{
		v.push_back(a[i]+b[n]-b[i-1]);
	}
	sort(v.begin(),v.end());
	cout<<v[v.size()-1]<<endl;
	return 0;
}

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

int main()
{
  int n, k;
  cin >> n >> k;

  vector<long long> h(n, 0);
  for(int i=0;i <n; i++)
    cin >> h[i];

  vector<long long> dp(n, INT_MAX);
  dp[0] = 0;

  for(int i=1; i<n; i++)
  {
    for(int j=1; j<=k && (i-j>=0); j++)
    {
      dp[i] = min(dp[i] ,dp[i-j]+abs(h[i]-h[i-j]));
    }
  }

  cout<<dp[n-1]; 
  return  0;

}


Measured memory_bytes: 1792
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int H=in(),W=in(),K=in();
	int N=1<<(W-1);
	vector<vector<ll>> dp(H+1,vector<ll>(W,0));
	dp[0][0]=1;

	vector<int> Valid(N,1);
	REP(i,N){
		int v=i;
		int continuous=0;
		while(v){
			if(v&1){
				if(continuous){
					Valid[i]=0;
					break;
				}
				continuous=true;
			}
			else continuous=false;
			v>>=1;
		}
	}

	REP(i,H){
		REP(k,W){
			int offset[3]={-1,0,1};
			REP(l,3){
				int p = k+offset[l];
				if(p<0 || p>=W) continue;

				ll sum=0;
				REP(j,N){
					if(!Valid[j]) continue;
					if(l==0 && (j&(1<<p))) sum++;
					else if(l==2 && (j&(1<<k))) sum++;
					else if(l==1){
						if(k>0 && (j&(1<<(k-1)))) continue;
						if(k<W-1 && (j&(1<<k))) continue;
						sum++;
					}
				}
				dp[i+1][p] += (dp[i][k]*sum)%atcoder_mod;
				dp[i+1][p] %= atcoder_mod;
			}
		}
	}
	out(dp[H][K-1]);
	return 0;
}


Measured memory_bytes: 256
// best coder in the world do not mess with me!!
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a); i > (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod=1000000007;
void generate(int per[],int t)
{
	
	for(int i=t-1;i>0;i--)
	{
		int k=rand()%i;
		swap(per[k],per[i]);
	}
}
int main()
{

	int a,t;
	cin>>a>>t;
	int x,result=0;
	for(int i =0;i<t;i++)
	{
		cin>>x;
		result+=x;
	}
	if(result>=a)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

}


Measured memory_bytes: 256
// https://ynucpc.github.io/blog/2018/04/15/cp_vscode/
// http://www.atmarkit.co.jp/ait/articles/1509/08/news019.html

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rep3(i,n,m) for(ll i=(n);i<(ll)(m);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
// #define max(a, b) ((a) > (b) ? (a) : (b))
// #define min(a, b) ((a) < (b) ? (a) : (b)) 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int _stoi(string s, int tmp=10){
	istringstream stm(s);
	int res;
	stm >> res;
	return res;
}
double _stod(string s, int tmp=10){
	istringstream stm(s);
	double res;
	stm >> res;
	return res;
}
template<typename T>string to_string(const T& n){
	std::ostringstream stm;
	stm << n;
	return stm.str();
}

// 降順ソート: sort(A, A+N, greater<>());
// min: *min_element(A, A+N)
// argmin: min_element(A, A+N)-A

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


int main(){	
	// ll A; cin >> A;
	// cout << "hello" << _stoi("14") << max({1,3}) << endl;
	
	ll A, B;
	cin >> A >> B;
	B++;
	ll ans=0;
	for(ll i=40; i>=0; i--){
		ll mod = 1ll<<i+1;
		ll a = A%mod;
		ll b = B%mod;
		if (a>b)swap(a,b);
		//show(mod); show(a); show(b);
		chmax(a, (mod>>1));
		chmax(b, (mod>>1));
		
		ans |= (b-a)%2 << i;
	}
	A%=4; B%=4; B+=4;
	ll a=0;
	for (ll i=A; i<B; i++)a^=i;
	ans = ans>>1<<1;
	ans |= a&1;
	//show(a);

	cout << ans << endl;

}








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

using namespace std;

int main(void) {
	long long n, k, q; cin >> n >> k >> q;
	vector<int> X(n), A(q);
	for (int i = 0; i < q; i++) {
		cin >> A[i];
		A[i]--;
		X[A[i]]++;
	}

	for (int i = 0; i < n; i++) {
		if (k - q + X[i] > 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n;
li a[100100];
li b[100100];
li c[100100];

int main() {
    cin >> n;
    rin{
        cin >> a[i];
    }
    rin{
        cin >> b[i];
    }
    rin{
        cin >> c[i];
    }
    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);

    li res = 0;
    rin{
        li now = b[i];
        auto left = lower_bound(a, a + n, now);
        left--;
        li na = 0;
        if (left >= a) {
            na = left - a + 1;
        }
        auto right = upper_bound(c, c + n, now);
        li nc = (c + n) - right;
        res += na * nc;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
 
long long gcd(long long a, long long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

long long lcm(long long a, long long b) {
    long long g = gcd(a, b);
    return a / g * b;
}

int main() {
    long long n, t;
    long long ans = 1;
    cin >> n;
    imfor(i, n) {
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

signed main(){
    string a, b;
    cin >> a >> b;
    
    if(a.length() > b.length()){
        cout << "GREATER" << endl;
    }else if(a.length() < b.length()){
        cout << "LESS" << endl;
    }else{
        if(a > b){
            cout << "GREATER" << endl;
        }else if(a == b){
            cout << "EQUAL" << endl;
        }else{
            cout << "LESS" << endl;
        }
    }
}

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

int main(){
    string s;cin>>s;
    int c1=0,c2=0;
    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s[i]!='0'){
                c1++;
            }else{
                c2++;
            }
        }else{
            if(s[i]!='1'){
                c1++;
            }else{
                c2++;
            }
        }
    }
    cout<<min(c1,c2)<<endl;
}

Measured memory_bytes: 512
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    a = kwargs["a"]
    res = "a"

    if a.isupper():
        res = "A"

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["a"] = cin[0]

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 31128
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 2e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

map<ll,ll> cnt;
ll a[N],all;
bool vis[N];
int n;
vector<int> qu;

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n;
  for(int i = 1;i <= n;i++){
    cin>>a[i];
    if(!vis[a[i]]) qu.push_back(a[i]);
    vis[a[i]] = 1;
    cnt[a[i]]++;
  }
  for(int i = 0;i < qu.size();i++){
    ll num = cnt[qu[i]];
    all += (num*(num-1))/2;
  }
  for(int i = 1;i <= n;i++){
    ll t = cnt[a[i]]-1;
    cout<<all-t<<endl;
  }
  return 0;
}


Measured memory_bytes: 11768
#include<iostream>
#include<sstream>
#include<string>
#include<set>
using namespace std;
int main(){

  int Q;
  string str;
  
  cin >>Q;
  
  for(int i=0 ; i < Q ; i++){
    
    cin >>str;

    int cnt=0;
    
    while(1){

      stringstream ss1;
      set<string> s;
      
      ss1<<str;
      int str_num;
      ss1>>str_num;
      
      //cout <<str_num<<endl;
      
      if(str_num >= 0 && str_num <= 9){
	break;
      }else if(s.find(str) != s.end()){
	cnt = -1;
	break;
      }
      
      s.insert(str);
      
      int max=-1;
      
      for(int j=1 ; j < str.size() ; j++){

	int n1,n2;
	stringstream ss2,ss3;
	string sub1,sub2;
	
	sub1=str.substr(0,j);
	sub2=str.substr(j);
	ss2<<sub1;
	ss3<<sub2;
	ss2>>n1;
	ss3>>n2;
	if(max < n1*n2)max=n1*n2;
      }

      stringstream ss4;
      
      ss4<<max;
      ss4>>str;
      
      cnt++;
    }
    
    cout <<cnt<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1236
def read_boats(n, m):
    boats = [[] for i in range(max(n, m) + 1)]
    for i in range(m):
        a, b = map(int, input().split())
        boats[a].append(b)
    return boats

def trip(n, boats):
    for origin in boats[1]:
        if n in boats[origin]:
            return('POSSIBLE')
    return('IMPOSSIBLE')


if __name__ == '__main__':
    n, m = map(int, input().split())
    boats = read_boats(n, m)
    print(trip(n, boats))

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

int main() {
	int x;
	scanf("%d", &x);
	long long s;
	int ansa;
	int ansb;
	for(int i = -120; i <= 120; i++) {
		s = x + pow(i, 5);
		for(int j = -120; j <= 120; j++) {
			if(s == pow(j, 5)) {
				ansa = j;
				ansb = i;
			}
		}
	}
	printf("%d %d\n", ansa, ansb);
}

Measured memory_bytes: 4160
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
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; }

const double INF=1e9;

int main(){
  int n;
  cin>>n;
  vector<int>t(n),v(n);
  int T=0;
  rep(i,n){
    cin>>t[i];
    T+=t[i];
  }
  rep(i,n)cin>>v[i];

  //初期化
  vector<double>maxV(2*T+1,INF);
  int now=0;
  rep(i,n){
    rep(j,2*t[i]){
      chmin(maxV[now],(double)v[i]);
      chmin(maxV[now+1],(double)v[i]);
      now++;
    }
  }

  //各点の位置を決める
  maxV[0]=maxV[2*T]=0;

  rep(i,2*T){
    chmin(maxV[i+1],maxV[i]+0.5);
  }

  for(int i=2*T; i>0; --i){
    chmin(maxV[i-1],maxV[i]+0.5);
  }

  //台形の面積を計算
  double ans=0;
  rep(i,2*T){
    ans+=(maxV[i]+maxV[i+1])*0.5/2;
  }
  printf("%.6f\n",ans);
}

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

string s;

int main(){
    cin >> s;
    if(s[0] != s[1] && s[1] != s[2] && s[2] != s[0]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll mod=1e9;
const int inf=0x3f3f3f3f;

int a[200005];
int isp[1000005];
int boom[1000005];
vector<int>v;
int main()
{
	int n;cin>>n;
	for (int i = 0; i < n; i++)
	{
		cin>>a[i];boom[a[i]]++;
	}
	int ans=0;
	for (int i = 0; i <=1000000; i++)
	{
		if(boom[i]==1) v.push_back(i);
		else if(boom[i]>=2)
		{
			int t=1;
			while(i*t<=1000000)
			{
				isp[i*t]=1;
				t++;
			}
		}
	}
	for (int i = 0; i < v.size(); i++)
	{
		if(isp[v[i]]==0)
		{
			ans++;
			int t=1;
			while(v[i]*t<=1000000)
			{
				isp[v[i]*t]=1;
				t++;
			}
		}
	}
	if(boom[1]>1) ans=0;
	cout<<ans<<endl;
}


Measured memory_bytes: 12808
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<LL, LL> P;

const int mod = 20170408;
const int maxn = 2e7 + 5;

int add(int x, int y) {
    x += y;
    if(x >= mod) x -= mod;
    return x;
}

int mul(int x, int y) {
    LL z = 1LL * x * y;
    return z - z / mod * mod;
}

map<int,int> q;
vector<int> f;

int main() {
#ifdef CX_TEST
    freopen("E:\\program--GG\\test_in.txt", "r", stdin);
#endif
    int n,m,i,x;
    scanf("%d%d",&n,&m);
    for(i = 0;i < n; i++) {
        scanf("%d",&x);
        q[x]++;
    }
    for(auto e:q) f.push_back(e.second);
    sort(f.begin(),f.end());
    n = f.size();
    x = 0;
    for(i = 0;i < n - m; i++) x += f[i];
    printf("%d\n",x);
    return 0;;
}


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

const int nmax = 8;
const vector<bool> all_visited = {1, 1, 1, 1, 1, 1, 1, 1, 1};
vector<vector<bool>> graph(nmax, vector<bool>(nmax));
vector<bool> visited = {1, 1, 1, 1, 1, 1, 1, 1, 1};

int N, M;



int DFS(int v){

  int ans = 0;

  if(visited == all_visited){
    return 1;
  }

  rep(i, N){
      if (graph.at(v-1).at(i) == true && visited.at(i) == false){
        visited.at(i) = true;
        ans += DFS(i+1);
        visited.at(i) = false;
      }
  }

  return ans;

}

int main() {
  cin >> N >> M;

  rep(i, M){
    int a, b;
    cin >> a >> b;
    graph.at(a-1).at(b-1) = true;
    graph.at(b-1).at(a-1) = true;
  }

  rep(j, N){
    visited.at(j) = false;
  }

  visited.at(0) = true;
  cout << DFS(1) << endl;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int h[100100];

int main() {
    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        cin >> h[i];
    }
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        if (h[i] >= K) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 640