akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;

using ll = long long;

#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 ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  vi a(n+1); rrep(i, n) std::cin >> a[i];
  vi b(n+1), ans;
  ddrep(i, n) {
    int sum = 0;
    for (int j = i; j <= n; j+=i) {
      sum += b[j];
    }
    if ((sum & 1) ^ a[i]) {
      b[i]++;
      ans.pb(i);
    }
  }
  reverse(rng(ans));
  std::cout << ans.size() << "\n";
  rep(i, ans.size()) {
    std::cout << ans[i] << (i+1<n ? " " : "\n");
  }
}


Measured memory_bytes: 3192
m,e,j,s;main(n){for(;scanf("%d",&n)*n;)for(;n--;puts(m>99|e>99|j>99|m+e>179|s>239?"A":s>209||s>149&&m>79|e>79?"B":"C"))scanf("%d%d%d",&m,&e,&j),s=m+e+j;}

Measured memory_bytes: 0
#include<stdio.h>
#include<math.h>
#include<string.h>

int main() {

	int i, j, n, cnt;
	char word[100][11];

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", word[i]);
	}

	for (i = 1; i < n; i++) {
		cnt = 0;
		j = 0;
		while (word[i - 1][j] != '\0') {
			j++;
		}
		if (word[i-1][j - 1] != word[i][0]) {
			printf("No\n");
			return 0;
		}
		for (j = 0; j < i; j++) {
			if (strcmp(word[j], word[i]) == 0) {
				printf("No\n");
				return 0;
			}
		}
	}

	printf("Yes\n");

	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> seq = new ArrayList<Integer>(5);
		for(int i=0;i<5;i++) {
			seq.add(sc.nextInt());
		}
		Collections.sort(seq, Collections.reverseOrder());
		System.out.print(seq.get(0));
		for(int i=1;i<5;i++) {
			System.out.print(" " + seq.get(i));
		}
		System.out.println();
	}

}

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

int main(){
    bool apb[26] = {};
    string s;
    cin >> s;
    if(s.size() < 26){
        char add;
        for(char c:s){
            apb[(int)c-97] = true;
        }
        for(int i=0; i<26; i++){
            if(!apb[i]){
                add=char(i+97);
                break;
            }
        }
        s += add;
        cout << s;
    }
    else {
        string ret="", ts;
        char post=s[25], dlt, add;
        for(int i=24; i>=0; i--){
            if(s[i] < post){
                dlt = s[i];
                ts = s.substr(i, 26-i);
                ret = s.substr(0, i);
                break;
            }
            else post = s[i];
        }
        sort(ts.begin(), ts.end());
        char post2=ts[0];
        for(int i=1; i<ts.size(); i++){
            if(post2 == dlt){
                ret += ts[i];
                break;
            }
            else{
                post2 = ts[i];
            }
        }
        if(ret == "")cout << -1;
        else cout << ret;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B
{
    class Program
    {
        public static int[] a;
        public static int[] b;
        public static int[] c;
        public static string str;
        static void Main(string[] args)
        {
            a = new int[5];
            b = new int[5];
            c = new int[5];

            for (int i = 0; i < 5; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
                b[i] = ((a[i]+10) / 10) * 10;
                c[i] = a[i] % 10;
                if (c[i] == 0) { b[i] -= 10;c[i] = 10; }
            }
            Console.WriteLine(b.Sum()-10 + c.Min());
        }

    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
 
signed main()
{
	string S;
	cin>>S;
	int size=S.size();
	ll num=0,keta=1,sum=0;
	int mod[2019]={1,0};
	reverse(S.begin(),S.end());
	rep(i,size){
		num=(S.at(i)-'0')*keta;
      	sum+=num;
		mod[sum%2019]++;
		keta*=10;
		keta%=2019;
	}
  	int cnt=0;
	rep(i,2019){ if(mod[i]>1)cnt+=(mod[i]*(mod[i]-1))/2;}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for (int i=a;i<=b;i++)
#define Rep(i,a,b) for (int i=b;i>=a;i--)
using namespace std;
ll ans;
ll n,x,y;
int a[100100],b[100100],c[100100];
inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int main()
{
	n=read();
	For(i,1,n)a[i]=read();
	For(i,1,n)b[i]=read();
	For(i,1,n)c[i]=-read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	For(i,1,n)c[i]=-c[i];
	x=0;y=n;
	For(i,1,n)
	{
		while(a[x+1]<b[i]&&x<n)x++;
		while(c[y]<=b[i]&&y>0)y--;
		ans+=(x*y);
	}
	cout<<ans<<endl;
	return 0;
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;


int power(int a,int b){
    int r=1;
    while(b){
        if(b & 1){
            r=r*a;
            b--;
        }
        a=a*a;
        b>>=1;
    }
    return r;
}


int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>k;

	vi v;

	rf(i,32,1){
        int l=1;
        int r=10;
        while(l<r){
            int mid=(l+r)/2;
            int x=power(i,mid);
            if(x>k) r=mid-1;
            else{
                v.pb(x);
                l=mid+1;
            }
        }
	}

	auto z=max_element(v.bb,v.ee);

	cout<<*z<<endl;
}



Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=10000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	ll x,cost;
};
int main() {

	int c[101]={};
	int a1,a2,a3,a21,a22,a23,a31,a32,a33;
	int n;
	int b[11];
	cin>>a1>>a2>>a3;
	cin>>a21>>a22>>a23;
	cin>>a31>>a32>>a33;
	cin>>n;
	rep(i,n){
		cin>>b[i];
		c[b[i]]=1;
	}
	if(c[a1]==1)a1=0;
	if(c[a2]==1)a2=0;
	if(c[a3]==1)a3=0;
	if(c[a21]==1)a21=0;
	if(c[a22]==1)a22=0;
	if(c[a23]==1)a23=0;
	if(c[a31]==1)a31=0;
	if(c[a32]==1)a32=0;
	if(c[a33]==1)a33=0;
	if(a1==0&&a2==0&&a3==0)cout<<"Yes"<<endl;
	else if(a21==0&&a22==0&&a23==0)cout<<"Yes"<<endl;
	else if(a31==0&&a32==0&&a33==0)cout<<"Yes"<<endl;
	else if(a1==0&&a21==0&&a31==0)cout<<"Yes"<<endl;
	else if(a2==0&&a22==0&&a32==0)cout<<"Yes"<<endl;
	else if(a3==0&&a23==0&&a33==0)cout<<"Yes"<<endl;
	else if(a1==0&&a22==0&&a33==0)cout<<"Yes"<<endl;
	else if(a3==0&&a22==0&&a31==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  ll ans = 0;
  ll a = 1;
  while(n>0){
    ans += a;
    n /= 2;
    a *= 2;
  }
  cout << ans << endl;
  return 0;
}

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

int n, m, x, y, pr[100005];

int f(int p) {
	if(pr[p] == p) return p;
	return pr[p] = f(pr[p]);
}

int main() {
	cin >> n >> m;
	for(int i=1; i<=n; i++) pr[i] = i;
	while(m--) {
		scanf("%d%d%*d", &x, &y);
		x = f(x), y = f(y);
		if(x != y) {
			n--;
			pr[y] = x;
		}
	}
	cout << n;
	return 0;
}


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 2003;
const int MOD = 1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}
#define OF {cout << "OVERFLOW!!!\n"; return 0;}

int H,W;
char S[MAXN][MAXN];
int L[MAXN][MAXN];
int R[MAXN][MAXN];
int U[MAXN][MAXN];
int D[MAXN][MAXN];

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> H >> W;
    for (int i = 0; i < H; i++) cin >> S[i];

    for (int h = 0; h < H; h++) {
        int l = -1;
        for (int w = 0; w < W; w++) {
            if (S[h][w] == '#') {
                l = w;
            } else {
                L[h][w] = l;
            }
        }

        int r = W;
        for (int w = W-1; w >= 0; w--) {
            if (S[h][w] == '#') {
                r = w;
            } else {
                R[h][w] = r;
            }
        }
    }

    for (int w = 0; w < W; w++) {
        int u = -1;
        for (int h = 0; h < H; h++) {
            if (S[h][w] == '#') {
                u = h;
            } else {
                U[h][w] = u;
            }
        }

        int d = H;
        for (int h = H; h >= 0; h--) {
            if (S[h][w] == '#') {
                d = h;
            } else {
                D[h][w] = d;
            }
        }
    }

    int ans = 0;
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (S[h][w] == '.')  {
                ans = max(ans, R[h][w]-L[h][w]+D[h][w]-U[h][w]-3);
                //cout << h << " " << w << " " << ans << endl;
            }
        }
    }

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


Measured memory_bytes: 66816
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt(), X = reader.nextInt(), T = reader.nextInt();
		System.out.println((int) Math.ceil(((double) N) / X) * T);
		reader.close();
	}
	
}


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

int main(){
  ll x,y,i,j,a,b;
  cin >> x;
  for(i=-200;i<=200;i++){
    for(j=-200;j<=200;j++){
      y=pow(i,5)-pow(j,5);
      if(x==y){
        a=i;
        b=j;
      }
    }
  }
  cout << a << " " << b;
}

Measured memory_bytes: 4076
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{

	double x,y;
};
int N;
int table[10];
Info info[10];

int calc(int num){

	if(num == 1){

		return 1;
	}else{

		return num*calc(num-1);
	}
}


int main(){

	scanf("%d",&N);

	for(int i = 0; i < N; i++){

		scanf("%lf %lf",&info[i].x,&info[i].y);
	}

	for(int i = 0; i < N; i++){

		table[i] = i;
	}

	double sum = 0;

	do{

		for(int i = 0; i < N-1; i++){

			sum += sqrt((info[table[i]].x-info[table[i+1]].x)*(info[table[i]].x-info[table[i+1]].x)+
					(info[table[i]].y-info[table[i+1]].y)*(info[table[i]].y-info[table[i+1]].y));
		}

	}while(next_permutation(table,table+N));

	int div = calc(N);

	printf("%.10lf\n",sum/(double)div);

	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
from fractions import gcd
from itertools import count
from functools import lru_cache
from collections import defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    S,T = input().split()
    print(T+S)

main()


Measured memory_bytes: 5300
#include <iostream>
#include <cmath>
#include <vector>

using Bool = bool;
using Int = long long int;
using Real = long double;
template <class T>
using Vector = std::vector<T>;

constexpr Real EPS = 1e-3;

// pol * (x - d)
Vector<Real> mul(Vector<Real> pol, Real d) {
    pol.insert(pol.begin(), 0);
    for (Int i = 0; i + 1 < pol.size(); ++i) {
        pol[i] -= pol[i + 1] * d;
    }
    return pol;
}

// pol / d
Vector<Real> divc(Vector<Real> pol, Real d) {
    for (auto& a : pol) a /= d;
    return pol;
}

Vector<Real> add(Vector<Real> pol1, Vector<Real> pol2) {
    for (Int i = 0; i < pol1.size(); ++i) {
        pol1[i] += pol2[i];
    }
    return pol1;
}

Real apply(const Vector<Real> pol, Real x) {
    Real ret = 0, acc = 1;
    for (auto a : pol) {
        ret += a * acc;
        acc *= x;
    }
    return ret;
}

Bool solve() {
    Int n;
    std::cin >> n;
    if (n == 0) return false;

    Vector<Real> v(n + 3);
    for (auto& a : v) std::cin >> a;

    for (Int i = 0; i <= n + 1; ++i) {
        // v[i]が偽と仮定
        Vector<Real> res(n + 1, 0);

        for (Int j = 0; j <= n + 1; ++j) {
            if (j == i) continue;

            Vector<Real> pol(1, v[j]);
            for (Int k = 0; k <= n + 1; ++k) {
                if (k == i || k == j) continue;
                pol = mul(pol, k);       // * (x - k)
                pol = divc(pol, j - k);  // / (j - k)
            }
            res = add(res, pol);
        }

        Real err = apply(res, Real(n + 2)) - v[n + 2];
        if (std::abs(err) < EPS) {
            std::cout << i << std::endl;
            return true;
        }
    }

    std::cout << n + 2 << std::endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}



Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

int main(){
    string s;
    cin >> s;
    ll ans = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '?') s[i] = 'D';
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rg register
#define maxn 1200000
#define inf 0x7f7f7f7f
#define mod (ll)(1e9+7)
#pragma GCC optimize(3)
#pragma -fcrossjumping
#pragma -fdefer-pop
#pragma -fmerge-constans
#pragma -fthread-jumps
#pragma -floop-optimize
#pragma -fif-conversion
#pragma -fif-conversion2
#pragma -fdelayed-branch
#pragma -fguess-branch-probability
#pragma -fcprop-registers
#pragma -fforce-mem
#pragma -foptimize-sibling-calls
#pragma -fstrength-reduce
#pragma -fgcse
#pragma -fcse-follow-jumps
#pragma -frerun-cse-after-loop
#pragma -fdelete-null-pointer-checks
#pragma -fextensive-optimizations
#pragma -fregmove
#pragma -fschedule-insns
#pragma -fsched-interblock
#pragma -fcaller-saves
#pragma -fpeephole2
#pragma -freorder-blocks
#pragma -fstrict-aliasing
#pragma -funit-at-a-time
#pragma -falign-functions
#pragma -fcrossjumping
#pragma -finline-functions
#pragma -fweb
inline ll read()
{
    ll x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-') f=-1;
        c=getchar();
    }
    while(c<='9'&&c>='0')
    {
        x=(x<<1)+(x<<3)+(c^48);
        c=getchar();
    }
    return x*f;
}
inline ll print(ll x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>=10)
    {
        print(x/10);
    }
    putchar(x%10+'0');
}
int n;
int h;
int a[maxn];
int tot;
int main()
{
	n=read();
	h=read();
	for(rg int i=1;i<=n;++i) a[i]=read();
	for(rg int i=1;i<=n;++i)
	{ 
		if(a[i]>=h) ++tot;
	}
	cout<<tot;
}

Measured memory_bytes: 640
import java.util.*;
class Main{
	Scanner sc=new Scanner(System.in);
	int[][][] gundam=new int[4][3][10];
	void Main(){
		int N=sc.nextInt();
		int b,f,r,v;
		for(int i=0;i<N;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			gundam[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<4;i++){
			output(i);
			if(i!=3)System.out.println("####################");
		}
	}
	void output(int b){
		for(int i=0;i<3;i++){
			for(int j=0;j<10;j++){
				System.out.print(" "+gundam[b][i][j]);
			}
			System.out.println();
		}
	}
		public static void main(String[]args){
			new Main().Main();
	}
}

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


int dp__[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp__[n] = 1;
  if(dp__[n] != -1) return dp__[n];
  return dp__[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n, k;
  cin >> n >> k;
  vector<char> s(n);
  rep(i, n) cin >> s[i];
  if(s[k-1] == 'A') s[k-1] = 'a';
  if(s[k-1] == 'B') s[k-1] = 'b';
  if(s[k-1] == 'C') s[k-1] = 'c';
  
  rep(i, n) cout << s[i];
}


/*





















*/


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

int main()
{
	string s;
	cin>>s;
  int siz=s.size();
  
  for(int i=0;i<siz-1;i++)
  {
    if(s[i]==s[i+1])
    {
      cout<<i+1<<" "<<i+2;
      return 0;
    }
    
  }
  for(int i=0;i<siz-2;i++)
  {
    if(s[i]==s[i+2])
    {
      cout<<i+1<<" "<<i+3;
      return 0;
    }
  }
 cout<<"-1 -1";
  
  
  
  
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
using ll = long long;
using P = tuple<ll,ll,int>;

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    map<ll,ll> mp;
    ll sum = 0;
    rep(i,n){
        ll A; cin >> A;
        a[i] = A;
        sum += A;
        mp[A]++;
    }
    int q; cin >> q;
    rep(i,q){
        ll b,c; cin >> b >> c;
        ll num = mp[b];
        sum += num*(c-b);
        mp[c] += mp[b];
        mp[b] = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 10120
# 2019-11-13 01:34:25(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    a, b = [int(x) for x in sys.stdin.readline().split()]
    if a == b:
        ans = a + b
    elif a > b:
        ans = a + (a - 1)
    elif b > a:
        ans = b + (b - 1)
    
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int a,b,c,k,sum=0;
    cin>>a>>b>>c>>k;
     if(k>a)
    {
        k-=a;
        sum+=a;
        if(k>b)
        {
            k-=b;
            sum-=k;
        }
    }
    else
        sum+=k;
    cout<<sum;
    return 0;
}





Measured memory_bytes: 3612
#include<map>
#include<cstdio>

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

using namespace std;

int main(){
	for(int n,S,W,Q;scanf("%d%d%d%d",&n,&S,&W,&Q),n;){
		static int a[100000];
		int g=S;
		rep(i,n){
			a[i]=(g/7)%10;
			if(g%2==0) g=(g/2);
			else       g=(g/2)^W;
		}

		int ans=0;
		if(Q==2 || Q==5){ // 10 の逆元がないので例外的に扱う
			// dp[i+1][j] := ( a[i] を右端とする部分文字列で, 十進整数として見たときに mod Q == j となるものの個数 )
			static int dp[100001][5];
			rep(i,n+1) rep(j,Q) dp[i][j]=0;
			rep(i,n){
				if(a[i]!=0) dp[i+1][a[i]%Q]++;
				rep(j,Q) dp[i+1][(j*10+a[i])%Q]+=dp[i][j];
				ans+=dp[i+1][0];
			}
		}
		else{
			map<int,int> f;
			int sum=0,ten=1;
			for(int i=n-1;i>=0;i--){
				sum=(a[i]*ten+sum)%Q;
				if(a[i]!=0) f[sum]++;
				ten=ten*10%Q;
			}
			sum=0; ten=1;
			int tar=0;
			for(int i=n-1;i>=0;i--){
				ans+=f[tar];
				sum=(a[i]*ten+sum)%Q;
				if(a[i]!=0) f[sum]--;
				tar=(a[i]*ten+tar)%Q;
				ten=ten*10%Q;
			}
		}
		printf("%d\n",ans);
	}

	return 0;
}

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int MOD = 998244353;
const int N = (1e6)+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n;
        cin>>n;
        pii p[n];
        int chk = 0;
        for(int ii=0;ii<n;ii++)
        {
            string s;
            cin>>s;
            stack<char> st;
            for(int i=0;i<s.length();i++)
            {
                if(!st.size())st.push(s[i]);
                else
                {
                    if(s[i] == ')' && st.top() == '(')st.pop();
                    else st.push(s[i]);
                }
            }
            int op=0,cl=0;
            while(st.size())
            {
                if(st.top() == '(')op++;
                else cl++;
                st.pop();
            }
            p[ii] = {cl,op};
            chk += op;
            chk -= cl;
        }
        //for(int i=0;i<n;i++)cout<<p[i].ff<<" "<<p[i].ss<<endl;
        if(chk)return cout<<"No",0;
        chk = 1;
        vector<pii> a,b,c;
        for(int i=0;i<n;i++)
        {
            if(p[i].ff && p[i].ss)b.pb(p[i]);
            else
            {
                if(p[i].ff)c.pb(p[i]);
                else if(p[i].ss)a.pb(p[i]);
            }
        }
        if(!b.size())return cout<<"Yes",0;
        vector<pii> plus,minus;
        for(auto p:a)plus.pb({0,p.ss});
        for(auto p:c)minus.pb({0,p.ff});
        for(auto p:b)
        {
            if(p.ss-p.ff>=0)plus.pb({-p.ff,p.ss-p.ff});
            else minus.pb({-p.ss,p.ff-p.ss});
        }
        sort(all(plus));reverse(all(plus));
        sort(all(minus));reverse(all(minus));
        int curr = 0;
        for(auto p: plus)
        {
            int now = curr+p.ff;
            if(now < 0)chk = 0;
            curr += p.ss;
        }
        curr = 0;
        for(auto p: minus)
        {
            int now = curr+p.ff;
            if(now < 0)chk = 0;
            curr += p.ss;
        }
        cout<<(chk?"Yes":"No")<<endl;
    }
    return 0;
}


Measured memory_bytes: 49088
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int deg[100];
int main() {
  int n, m;
  cin >> n >> m;
  while (m--) {
    int x, y;
    cin >> x >> y;
    --x; --y;
    deg[x]++;
    deg[y]++;
  }
  for (int i = 0; i < n; ++i) {
    cout << deg[i] << endl;
  }
  return 0;
}


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

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF=1e9;
const long long mod=2019;
#define ll long long

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vector<ll>a(n);
    priority_queue<ll>q;
    rep(i,n)cin>>a[i],q.push(a[i]);
    while(m){
        ll t=q.top();
        t/=2;
        q.pop();
        q.push(t);
        m--;
    }
    ll sum=0;
    while(q.size()){
        sum+=q.top();
        q.pop();
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 2168
N = int(input())
B = list(map(int,input().split()))
A = 0
if N == 2:
  print(2*B[0])
else:
  for i in range(N-2):
    A = A + min(B[i],B[i+1])
  A = A + B[N-2] + B[0]
  print(A)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,d,c=0;
cin>>n>>k;
int b[n+1]={0};
for(int i=1;i<=k;i++)
{
cin>>d;
int a[d];
for(int i=0;i<d;i++)
{
cin>>a[i];
b[a[i]]++;
}
}
for(int i=1;i<=n;i++)
{
if(b[i]==0)
{
c++;
}
}
cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 3636
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	mod int = 1e9 + 7
)

func main() {
	H := getInt()
	A := getInt()
	
	cnt := 0
	for ; ; {
		cnt++
		H -= A
		if H <= 0 {
			break
		}
	}
	
	fmt.Println(cnt)
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


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

using namespace std;

int main(){
    string S;
    cin >> S;
    
    for(int i = 0; i < S.size(); ++i){
        if(i % 2 == 0){
            if(S[i] == 'L'){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if(S[i] == 'R'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  ll N,A,B;cin >> N >> A >> B;
  if(A+B-1 > N || A*B < N){
    cout << -1 << endl;
    return 0;
  }
  vector<ll> v(N);
  int s = B;
  rep(i,N){
    ll x = i%A;
    ll y = i/A;
    v[i] = B-y + B*x;
    if(x==0)--s;
  }

  for(int i = 0; i<s ; ++i){
    if(v[N-1-i] == s+1)++s;
    v[N-1-i] = i+1;
  }

  map<ll,int> mp;
  rep(i,N) mp[v[i]] = 0;
  s = 0;
  for(auto & m : mp) m.second = ++s;
  rep(i,N)  cout << mp[v[i]] SPF;
  cout << endl;
  return 0;
}


Measured memory_bytes: 23296
N = int(input())
lis = ["".join(sorted(input())) for _ in range(N)]
lis.sort()

count = 0
while len(lis) != 0:
  p = lis.pop()
  i = 1
  while len(lis) > 0:
    if lis[-1] == p:
      count += i
      lis.pop()
      i += 1
    else:
      break
print(count)

Measured memory_bytes: 10640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long H = scanner.nextLong();
        long num = 0;
        long total = 0;
        while(H > 0) {
            H /= 2;
            total += (long)Math.pow((double)2, (double)num);
            num++;
        }

        System.out.println(total);

    }
}


Measured memory_bytes: 23764
#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 ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;
// ------------------------------

int main() {
    string S;
    cin >> S;
    if (S[0] == 'R' && S[1] == 'R' && S[2] == 'R') {
        cout << 3 << endl;
        return 0;
    }
    if (S[0] == 'R' && S[1] == 'R') {
        cout << 2 << endl;
        return 0;
    }
    if (S[2] == 'R' && S[1] == 'R') {
        cout << 2 << endl;
        return 0;
    }
    if (S[0] == 'R' || S[1] == 'R' || S[2] == 'R') {
        cout << 1 << endl;
        return 0;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
using namespace std;
main()
{
	long n,m;cin>>n>>m;
	long cnt=0;
	cnt+=min(n,m/2);
	n-=cnt;
	m-=cnt*2;
	if(n==0)
	{
		cnt+=m/4;
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
s=input()
k=int(input())
ds=0
dt=0
cnt=0
cnt2=0
flag=0
st=s+s
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    cnt2+=1
    cnt+=1
    if cnt==1:
      ds+=1
    if cnt==2:
      cnt=0
  else:
    cnt=0
cnt=0
if cnt2==len(s)-1:
  flag=1
for i in range(len(st)-1):
  if st[i]==st[i+1]:
    cnt+=1
    #print("ifi",i,cnt)
    if cnt==1:
      #print("i",i)
      dt+=1
    if cnt==2:
      cnt=0
  else:
    cnt=0
d=dt-ds
ans=ds+d*(k-1)
#print("ds",ds)
#print("dt",dt,st)
if flag==0:
  print(ans)
else:
  if k==1:
    print(ds)
  if k==2:
    print(dt)
  if k>=3 and k%2==0:
    print(dt*(k//2))
  if k>=3 and k%2==1:
    print(dt*(k//2)+ds)

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



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

    map<int, int> cnt;
    for (int i = 0; i < n; i++){
        cnt[a[i]]++;
    }

    int ans = 0;
    for (auto i = cnt.begin(); i != cnt.end(); i++){
        if (i -> second < i -> first) ans += i -> second;
        else ans += i -> second - i -> first;
    }

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

Measured memory_bytes: 5120
// date: 14/06/20 17:35:26 // 
#include <bits/stdc++.h>
using namespace std;

#define iterall(x) x.begin(), x.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <double> vd;
typedef vector <ll> vll;
typedef vector <vector <int>> vvi;
typedef vector <vector <long long>> vvll;
typedef vector <vd> vvd;
typedef vector <long long> vll;
typedef pair <int, int> pii;
typedef pair<ll , ll> pll;
typedef vector <pair <int, int>> vpii;
typedef vector <pll> vpll;

const int INF = 1e9+5;
const double EPS = 1e-9;

int main()
{
    int x, y; 
    cin >> x >> y;
    cout << ((y-2*x)/2 >= 0 && (4*x - y)/2 >= 0 && (y-2*x)%2 == 0 && (4*x - y)%2 == 0 ? "Yes": "No") << endl;
}

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int main() {
	int a, b;
  cin >>a>>b;
  cout <<a*b<<endl;
	return 0;
}

Measured memory_bytes: 3616
#include<iostream>

int main(){
    int N;
    std::cin >> N;
    for (int i = 0; i < N; ++i){
        int k, p;
        std::cin >> k >> p;
        if(k%p!=0)std::cout << k % p << std::endl;
        else std::cout << p << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1164
def solve():
    T = list(map(int, input().split()))
    l = [t%2 for t in T]
    count = 0
    if sum(l) == 1:
        odd = T.pop(l.index(1))
        count += abs(T[0] - T[1]) // 2
        if max(T[0],T[1]) <= odd:
            count += odd - max(T[0],T[1])
        else:
            count += (max(T[0],T[1]) - odd)//2 + 2
    elif sum(l) == 2:
        even = T.pop(l.index(0))
        count += abs(T[0] - T[1]) // 2
        if max(T[0],T[1]) <= even:
            count += even - max(T[0],T[1])
        else:
            count += (max(T[0],T[1]) - even)//2 + 2
    else:
        m = T.pop(T.index(max(T)))
        count += abs(T[0] - T[1]) // 2
        count += abs(m - max(T[0],T[1]))
        
    return count
        

if __name__ == '__main__':
    print(solve())

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int a,b,n;
    cin >> a >> b;
    if(b==100)n=a*1000+b;
    else if(b>9)n=a*100+b;
    else n=a*10+b;
    if(int(sqrt(n))*int(sqrt(n))==n)cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, m, x int
	fmt.Scanf("%d %d %d", &n, &m, &x)
	c := make([]int, n)
	a := make([][]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &c[i])
		a[i] = make([]int, m, m)
		for j := 0; j < m; j++ {
			fmt.Scanf("%d", &a[i][j])
		}
	}

	min := math.MaxInt64
	for i := 0; i < 1<<uint(n); i++ {
		tempM := make([]int, m)
		cost := 0
		for j := 0; j < n; j++ {
			if (i>>uint(j))&1 == 1 {
				for k := 0; k < m; k++ {
					tempM[k] += a[j][k]
				}
				cost += c[j]
			}
		}
		OK := true
		for j := 0; j < m; j++ {
			if tempM[j] < x {
				OK = false
			}
		}
		if OK {
			if min > cost {
				min = cost
			}
		}
	}
	if min == math.MaxInt64 {
		fmt.Println("-1")
	} else {
		fmt.Println(min)
	}
}


Measured memory_bytes: 2224
#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<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);


    int n;
    vector<ll>a(n);

    cin>>n;
    rep(i,n)cin>>a.at(i);
    int t=fabs(a.at(0)-a.at(1));

    rep(i,n){
        for(int j=i+1;j<n;j++){
            if(t<=fabs(a.at(i)-a.at(j)))t=fabs(a.at(i)-a.at(j));

        }
    }
    cout<<t<<endl;



   

    

    
  
}

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

void Main() {
    stack<ll> st;
    ll c;
    string s;
    while (cin >> s) {
        c = 0;
        if (s == "+") {
            c += st.top();
            st.pop();
            c += st.top();
            st.pop();
        } else if (s == "-") {
            c -= st.top();
            st.pop();
            c += st.top();
            st.pop();
        } else if (s == "*") {
            c = st.top();
            st.pop();
            c *= st.top();
            st.pop();
        } else {
            c = stoi(s);
            // cout << c << "\n";
        }
        st.push(c);
    }
    cout << st.top() << "\n";
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> V(N);
  for(int i = 0; i < N; i++){
    cin >> V.at(i);
  }
  vector<int> C(N);
  for(int i = 0; i < N; i++){
    cin >> C.at(i);
  }
  
  int sum = 0;
  for(int i = 0; i < N; i++){
    if(V.at(i) > C.at(i)){
      sum += V.at(i)-C.at(i);
    }
  }
  
  cout << sum << endl;
}

      

Measured memory_bytes: 256
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if a == b:
    print('YES')
    exit()
if b - a > 0:
    if (v - w) * t >= b - a:
        print('YES')
        exit()
    else:
        print('NO')
        exit()
else:
    if (v - w) * t >= a - b:
        print('YES')
        exit()
    else:
        print('NO')
        exit()

print('NO')

Measured memory_bytes: 9204
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

struct unionFind{
    int* par;                       //親
    int* rank;                      //木の深さ
    int* scale;                     //木のサイズ
    unionFind(int n);
    ~unionFind();
    int find(int x);                //木の根を求める
    void unite(int x,int y);        //xとyの属する集合を併合
    bool same(int x,int y);         //xとyが同じ集合に属するか否か
    int size(int x);                //xの属する集合のサイズ
};

unionFind::unionFind(int n){
    par=new int[n];
    rank=new int[n];
    scale=new int[n];
    for(int i=0;i<n;i++){
        par[i]=i;
        rank[i]=0;
        scale[i]=1;
    }
}

unionFind::~unionFind(){
    delete[] par,rank,scale;
}

int unionFind::find(int x){
    if(par[x]==x) return x;
    return par[x]=find(par[x]);
}

void unionFind::unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(rank[x]<rank[y]){
        par[x]=y;
        scale[y]+=scale[x];
    }else{
        par[y]=x;
        scale[x]+=scale[y];
        if(rank[x]==rank[y]) rank[x]++;
    }
}

bool unionFind::same(int x,int y){
    return find(x)==find(y);
}

int unionFind::size(int x){
    x=find(x);
    return scale[x];
}

ll N,M;
ll A[100000], B[100000];
ll ans[100001];

int main(){
    cin>>N>>M;
    rep(i,M) cin>>A[i]>>B[i];

    ans[M]=N*(N-1)/2;
    unionFind uf(N+1);
    for(int i=M-1;i>=0;i--){
        ans[i]=ans[i+1];
        if(uf.same(A[i],B[i])) continue;
        ll s1=uf.size(A[i]);
        ll s2=uf.size(B[i]);
        uf.unite(A[i],B[i]);
        ll s=uf.size(A[i]);
        ans[i]-=(s*(s-1)-s1*(s1-1)-s2*(s2-1))/2;
    }

    repn(i,M) cout<<ans[i]<<endl;
}

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

int main(void){
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    mp[1] = 2;
    mp[2] = 5;
    mp[3] = 5;
    mp[4] = 4;
    mp[5] = 5;
    mp[6] = 6;
    mp[7] = 3;
    mp[8] = 7;
    mp[9] = 6;


    vector<int> a(m);
    for(int i = 0; i < m; i++){
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());

    int dp[n+1];
    for(int i = 0; i <= n; i++){
        dp[i] = -1;
    }
    dp[0] = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < m; j++){
            if(i - mp[a[j]] >= 0){
                dp[i] = max(dp[i], dp[i - mp[a[j]]] + 1);
            }
        }
    }
    // cout << dp[n] << endl;

    string ans = "";
    int idx = 0;
    int mch = n;

    while(mch){
        if(mch - mp[a[idx]] >= 0 && dp[mch - mp[a[idx]]] == dp[mch] - 1){
            mch -= mp[a[idx]];
            // 文字列の追加はこの書き方。
            ans += '0' + a[idx];
        }
        else{
            idx++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();

		String[] n = line.split(" ");
		int a = Integer.parseInt(n[0]);
		int b = Integer.parseInt(n[1]);
		
		if (a > b) {
			System.out.println("a > b");
		} else if (a < b) {
			System.out.println("a < b");
		} else {
			System.out.println("a == b");
		}

	}

}



Measured memory_bytes: 26280
#include <iostream>
#include <string>
 
using namespace std;
 
int main (void) {
    int N, K, Q;
    cin >> N >> K >> Q;
 
    int P[N];
    for (int i=0; i<N; i++) 
        P[i] = K;

    for (int i=0; i<Q; i++) {
        int a;
        cin >> a;
        P[a-1]++;
    }
    
    for (int i=0;i<N;i++) {
        if (P[i]-Q >0){
            cout << "Yes" << endl;
        }else {
            cout << "No" << endl;
        }
    }
 
    return 0;
}


Measured memory_bytes: 1024
import sys
import bisect
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
s = na()
q = ni()
t = na()
ans = 0
for x in t:
    d = bisect.bisect_right(s, x) - bisect.bisect_left(s, x)
    if d != 0:
        ans += 1
print(ans)



Measured memory_bytes: 16196
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    fast
   int x; cin>>x;
   if(x==1) cout<<'0'<<endl;
   else if(x==0) cout<<'1'<<endl;


}


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

#define M 100005
#define MOD 1000000007
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<ulli,ulli> PLL;

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

    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    string s;
    cin>>s;

    if(s=="ABC")
    	cout<<"ARC\n";
    else
    	cout<<"ABC\n";

}


Measured memory_bytes: 3648
#include<stdio.h>
int main(void)
{
  int map[3];
  for(int i=0;i<3;i++)
  {
      scanf("%d",&map[i]);  
  }
  int cnt=0;
  for(int i=0;i<3;i++)
  {
      for(int j=i+1;j<3;j++)
      {
        if(map[i]==map[j])
          cnt++;
      }
  }
  if(cnt==1) printf("Yes");
      else printf("No");
  return 0;
}


Measured memory_bytes: 128