akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
// #define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 2e5 + 10;
ll A = 30;

string s;
char t[MAXN],d[MAXN];

ll check(ll p,ll n,ll q){
    FOR(i,1,q){
        if(t[i] == s[p]){
            if(d[i] == 'L') --p;
            else ++p;

            if(p<0 || p>=n) return p;
        }
    }

    return p;
}


void solve(){
    ll n,q;
    cin>>n>>q>>s;

    FOR(i,1,q){
        cin>>t[i]>>d[i];
    }

    ll ans = n;

    ll s = 0,e = n-1;

    while(s <= e){
        ll mid = (s+e)>>1;
        if(check(mid,n,q) < 0){
            s = mid+1;
        }else {
            e = mid-1;
        }
    }
    
    ans -= s;

    s = 0,e = n-1;

    while(s <= e){
        ll mid = (s+e)>>1;
        if(check(mid,n,q) >= n){
            e = mid-1;
        }else {
            s = mid+1;
        }
    }

    ans -= (n-1-e);
    cout<<ans<<endl;
}

signed main(){

 
    FastRead;    

    ll t;
    t = 1; 
    // cin>>t;
    while(t--) solve();
    
}

Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int q,ans1,tot=0,hs[N];
ll sum,s,sum1,sum2,si1,si2,t[N*4],si[N*4];
int opt[N],x[N],y[N];
void fix(int l,int r,int k,int x)
{
    if(l==r)
    {
        t[k]+=hs[l];
        si[k]++;
        return;
    }
    int m=l+r>>1;
    if(x<=m) fix(l,m,k<<1,x);
    else fix(m+1,r,k<<1|1,x);
    t[k]=t[k<<1]+t[k<<1|1];
    si[k]=si[k<<1]+si[k<<1|1];
}
ll query(int l,int r,int k)
{
    if(l==r)
    {
        ans1=hs[l];
        return si1*hs[l]-sum1+sum2-si2*hs[l];
    }
    int m=l+r>>1;
    if(si2+si[k<<1|1]<=s/2)
    {
        sum2+=t[k<<1|1];
        si2+=si[k<<1|1];
        return query(l,m,k<<1);
    }
    else
    {
        sum1+=t[k<<1];
        si1+=si[k<<1];
        return query(m+1,r,k<<1|1);
    }
}
int main()
{
    scanf("%d",&q);
    for(int i=1;i<=q;i++)
    {
        scanf("%d",&opt[i]);
        if(opt[i]==1)
            scanf("%d%d",&x[i],&y[i]),hs[++tot]=x[i];
    }
    sort(hs+1,hs+1+tot);
    for(int i=1;i<=q;i++)
    {
        if(opt[i]==1)
        {
            s++;
            fix(1,tot,1,lower_bound(hs+1,hs+1+tot,x[i])-hs);
            sum+=y[i];
        }
        else
        {
            sum1=sum2=si1=si2=0;
            ll ans2=query(1,tot,1)+sum;
            printf("%d %lld\n",ans1,ans2);
        }
    }
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long

const int N = 1e6 + 5;

int cnt[N];
				
int32_t main() {
	fast_cin();  
	int n; 
	cin >> n;
	string ans = "not coprime";
	int g = 0;
	bool ok = true;
	for (int i = 0; i < n; ++i) {
		int num; cin >> num;
		g = __gcd(g, num);;
		for (int j = 2; j * j <= num; ++j) {
			if (num % j == 0) {
				while (num % j == 0) {
					num /= j;
				}
				ok &= (cnt[j] == 0);
				++cnt[j];
			}
		}
		if (num > 1) {
			ok &= (cnt[num] == 0);
			++cnt[num];
		}
	}
	if (ok) ans = "pairwise coprime";
	else if (g == 1) ans = "setwise coprime";
	cout << ans << endl;
	return 0;
}

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

using namespace std;

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


	vector<int>arr(n);

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


	vector<int>cost(n,INT_MAX);
	cost[0]=0;
	for(int i=1;i<n;i++)
	{
		for(int j=1;j<=K;j++)
		{
			if(i-j<0)
				break;
			cost[i]=min(cost[i-j]+abs(arr[i]-arr[i-j]),cost[i]);
		}
	}
	cout<<cost[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
struct node{int k,p,l,r;};
node t[500010];
using namespace std;
void find(int now,int k,int ori){
  if(k<t[now].k){
    if(t[now].l) find(t[now].l,k,ori);
    else {
      t[ori].k=k;
      t[ori].p=now;
      t[now].l=ori;
      return;
    } 
  } else {
    if(t[now].r) find(t[now].r,k,ori);
    else {
      t[ori].k=k;
      t[ori].p=now;
      t[now].r=ori;      
      return;
    }
  }
}
string fi(int now,int k){
  if(t[now].k==k) return "yes";
  else if(k<t[now].k){
    if(t[now].l) return fi(t[now].l,k);
    else return "no";
  } else {
    if(t[now].r) return fi(t[now].r,k);
    else return "no";
  } 
}
void pr(int now){
  cout<<" "<<t[now].k;
  if(t[now].l) pr(t[now].l);
  if(t[now].r) pr(t[now].r);
}
void in(int now){
  if(t[now].l) in(t[now].l);
  cout<<" "<<t[now].k;
  if(t[now].r) in(t[now].r);
}
int main(){
  int tmp,n;
  string s;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    if(s=="insert"){
      cin>>tmp;
      if(i) find(0,tmp,i);
      else t[i].k=tmp;
    } else if(s=="print"){
      in(0);
      cout<<endl;
      pr(0);
      cout<<endl;
    } else {
      cin>>tmp;
      cout<<fi(0,tmp)<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 9432
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#define ll long long
#define str string
#define rtn return
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define db long double
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define pll pair <ll, ll>
#define vi vector<ll>
#define vpll vector<pll>
#define value_at find_by_order
#define index_of order_of_key
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define loop1(i, n) for (int i=1;i<=n;++i)
#define loop(i, begin, end) for (__typeof(end) i = (begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
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...);
}
#else
#define trace(...)
#endif

template<class T> void remin(T &a, T b) {a = min(a, b);}
template<class T> void remax(T &a, T b) {a = max(a, b);}
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 405

pll dp[N][N];
ll n, a[N];

pll solve(int i, int j) {
  if (i == j) {
    rtn {a[i], 0};
  }
  if (i == j - 1) {
    rtn {a[i] + a[j], a[i] + a[j]};
  }
  if (dp[i][j].F != -1) rtn dp[i][j];
  dp[i][j].S = INF;
  for (int k = i; k < j; k++) {
    ll fx = solve(i, k).F + solve(k + 1, j).F + solve(i, k).S + solve(k + 1, j).S;
    if (fx < dp[i][j].S) {
      dp[i][j].S = fx;
      dp[i][j].F = solve(i, k).F + solve(k + 1, j).F;
    }
  }
  rtn dp[i][j];
}

int main() {
  FAST_IO;
  cin >> n;
  rep(i, n+1) rep(j, n+1) {
    dp[i][j].F = dp[i][j].S = -1;
  }
  rep(i, n) cin >> a[i];
  cout << solve(0, n - 1).S;
  rtn 0;
}


Measured memory_bytes: 2816
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2;
	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }

void main() {
  auto N = readln.chomp.to!ulong;
  
  ulong[string] votes;
  ulong max = 0;
  foreach(i; 0..N) {
    auto word = readln.chomp;
    if (!(word in votes)) votes[word] = 0;
    if (max < ++votes[word]) max = votes[word];
  }

  auto sorted = votes
    .keys
    .filter!(x => votes[x] == max)
    .array
    .sort()
    .array;

  foreach(word; sorted) writeln(word);
}


Measured memory_bytes: 32892
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
    R int res,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}
const int N=5e5+5;
int a[N],n,m,l,r,res,mid,mx;
bool ck(){
	for(R int l=2*mid-1,r=n+n;l<=r;++l,--r)if(a[l]+a[r]<m)return false;
	return true;
}
int main(){
//	freopen("testdata.in","r",stdin);
	n=read(),m=read();
	fp(i,1,n+n)a[i]=read();
	sort(a+1,a+1+n+n);
	l=1,r=n,res=n+1;
	while(l<=r)mid=(l+r)>>1,ck()?(r=mid-1,res=mid):l=mid+1;
	for(R int l=1,r=2*res-2;l<=r;++l,--r)cmax(mx,a[l]+a[r]);
	for(R int l=2*res-1,r=n+n;l<=r;++l,--r)cmax(mx,a[l]+a[r]-m);
	printf("%d\n",mx);
	return 0;
}

Measured memory_bytes: 2944
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{

    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        int N = int.Parse(inputs[0]);
        int M = int.Parse(inputs[1]);
        int C = int.Parse(inputs[2]);

        inputs = Console.ReadLine().Split(' ');
        var B = new int[inputs.Length];
        for (int i = 0; i < B.Length; i++)
        {
            B[i] = int.Parse(inputs[i]);
        }

        var A = new int[N, M];
        for (int i = 0; i < N; i++)
        {
            inputs = Console.ReadLine().Split(' ');
            for (int j = 0; j < inputs.Length; j++)
            {
                A[i, j] = int.Parse(inputs[j]);
            }
        }

        int count = 0;
        for (int i = 0; i < N; i++)
        {
            int sum = 0;
            for (int j = 0; j < M; j++)
            {
                sum += A[i, j] * B[j];
            }
            sum += C;
            if (sum > 0) count++;
        }

        Console.WriteLine(count);
    }

}



Measured memory_bytes: 13140
n = int(input())
robots = []
for i in range(n):
    x, l = [int(item) for item in input().split()]
    robots.append((x+l, x-l))
 
robots.sort()
#print(robots)

cnt = 0
node = -float("inf")
for end, start in robots:
    if start >= node:
        node = end
        cnt += 1
print(cnt)

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

const int N=1010;

int main()
{
    int a, b;
    cin >>a>>b;
    char a11, a12, a21, a22, x[N][N], y;
    int j=0;
    for (int k=1; k<=a; k++)
    {
        for (int l=1; l<=b; l++)
        {
            cin >> x[k][l];
        }
    }
    cin >>a11>>a12>>a21>>a22;
    for (int k=1; k<=a-1; k++)
    {
        for (int l=1; l<=b-1; l++)
        {
            if ((x[k][l]==a11 && x[k][l+1]==a12)&&(x[k+1][l]==a21 && x[k+1][l+1]==a22))
            j+=1;
        }
    }
    int q=j;
    int m, n, p;
    for (int k=1; k<=a; k++)
    {
        for (int l=1; l<=b; l++)
        {
            y=x[k][l];
            m=0;
            if ((x[k][l]==a11 && x[k][l+1]==a12)&&(x[k+1][l]==a21 && x[k+1][l+1]==a22))
            m+=1;
            if ((x[k-1][l]==a11 && x[k-1][l+1]==a12)&&(x[k][l]==a21 && x[k][l+1]==a22))
            m+=1;
            if ((x[k][l-1]==a11 && x[k][l]==a12)&&(x[k+1][l-1]==a21 && x[k+1][l]==a22))
            m+=1;
            if ((x[k-1][l-1]==a11 && x[k-1][l]==a12)&&(x[k][l-1]==a21 && x[k][l]==a22))
            m+=1;
            n=0;
            x[k][l]=a11;
            if ((x[k][l]==a11 && x[k][l+1]==a12)&&(x[k+1][l]==a21 && x[k+1][l+1]==a22))
            n+=1;
            if ((x[k-1][l]==a11 && x[k-1][l+1]==a12)&&(x[k][l]==a21 && x[k][l+1]==a22))
            n+=1;
            if ((x[k][l-1]==a11 && x[k][l]==a12)&&(x[k+1][l-1]==a21 && x[k+1][l]==a22))
            n+=1;
            if ((x[k-1][l-1]==a11 && x[k-1][l]==a12)&&(x[k][l-1]==a21 && x[k][l]==a22))
            n+=1;
            p=max(m, n);
            n=0;
            x[k][l]=a12;
            if ((x[k][l]==a11 && x[k][l+1]==a12)&&(x[k+1][l]==a21 && x[k+1][l+1]==a22))
            n+=1;
            if ((x[k-1][l]==a11 && x[k-1][l+1]==a12)&&(x[k][l]==a21 && x[k][l+1]==a22))
            n+=1;
            if ((x[k][l-1]==a11 && x[k][l]==a12)&&(x[k+1][l-1]==a21 && x[k+1][l]==a22))
            n+=1;
            if ((x[k-1][l-1]==a11 && x[k-1][l]==a12)&&(x[k][l-1]==a21 && x[k][l]==a22))
            n+=1;
            p=max(p, n);
            n=0;
            x[k][l]=a21;
            if ((x[k][l]==a11 && x[k][l+1]==a12)&&(x[k+1][l]==a21 && x[k+1][l+1]==a22))
            n+=1;
            if ((x[k-1][l]==a11 && x[k-1][l+1]==a12)&&(x[k][l]==a21 && x[k][l+1]==a22))
            n+=1;
            if ((x[k][l-1]==a11 && x[k][l]==a12)&&(x[k+1][l-1]==a21 && x[k+1][l]==a22))
            n+=1;
            if ((x[k-1][l-1]==a11 && x[k-1][l]==a12)&&(x[k][l-1]==a21 && x[k][l]==a22))
            n+=1;
            p=max(p, n);
            n=0;
            x[k][l]=a22;
            if ((x[k][l]==a11 && x[k][l+1]==a12)&&(x[k+1][l]==a21 && x[k+1][l+1]==a22))
            n+=1;
            if ((x[k-1][l]==a11 && x[k-1][l+1]==a12)&&(x[k][l]==a21 && x[k][l+1]==a22))
            n+=1;
            if ((x[k][l-1]==a11 && x[k][l]==a12)&&(x[k+1][l-1]==a21 && x[k+1][l]==a22))
            n+=1;
            if ((x[k-1][l-1]==a11 && x[k-1][l]==a12)&&(x[k][l-1]==a21 && x[k][l]==a22))
            n+=1;
            p=max(p, n);            
            j=max(j, q+p-m);
            x[k][l]=y;
        }
    }
    cout <<j<<"\n";
    return 0;
}

Measured memory_bytes: 2164
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		/*
		 * Scannerで値取得。
		 */
		Scanner row = new Scanner(System.in);

		//値取得
		String rows = row.next();

		row.close();
		
		//表示する値を格納する
		int show = 0;
		
		//入力に対応する日数を格納する
		switch(rows){
			case "SUN":
				show = 7;
				break;
			case "MON":
				show =6;
				break;
			case "TUE":
				show =5;
				break;
			case "WED":
				show =4;
				break;
			case "THU":
				show =3;
				break;
			case "FRI":
				show =2;
				break;
			case "SAT":
				show =1;
				break;
				
		}
		
		//表示
		System.out.println(show);

	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

ll _gcd(ll A, ll B) {
	return (B == 0) ? A : gcd(A % B, B);
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}


int len(int x) {
	return (int)log10(x) + 1;
}

int same_vec(vector<int> a, vector<int> b) {
	int res = 1, num = a.size();
	for (int i = 0; i < num; i++) {
		if (a[i] != b[i]) {
			res = 0;
			break;
		}
	}
	return res;
}


ll fibs[100] = { 0 };
ll fib(int n) {
	if (fibs[n] == 0) {
		return fibs[n] = fib(n - 1) + fib(n - 2);
	}
	return fibs[n];
}



int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int N;
	cin >> N;
	vector<int> d(N);
	rep(i, N) cin >> d[i];

	int sum = 0;
	int ans = 0;
	rep(i, N - 1) {
		sum += d[i];
		ans += sum * d[i + 1];
	}

	cout << ans << endl;


ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




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

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

    int A, B;
    cin >> A;
    cin >> B;
    for (int i = 1; i <= 3; i++) {
        if (i != A && i != B) cout << i << endl;
    }

    return 0;
}


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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair



int main() {
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    ll d = abs(A - B);
    ll u = V - W;
    if (u <= 0) PRINT("NO");
    else if (T > d / u) PRINT("YES");
    else if (d % u == 0 && T == d / u) PRINT("YES");
    else PRINT("NO");
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
double to_deg(double r) { return r * 180.0 / (atan(1.0) * 4.0); }

int main() {
    double a, b;
    ll x;
    cin >> a >> b >> x;
    //体積
    // a * a * b
    double water = (double)x / a;
    double all = a * b;
    cout.precision(17);
    if(water >= all / 2.0) {
        //水は半分以上残ってる
        // cout << water << endl;
        double split = a * b - water;
        double theta = atan2(split / a * 2, a);
        cout << fixed << to_deg(theta) << endl;
        return 0;
    } else {
        // cout << "small" << endl;
        double theta = atan2(water / b * 2, b);
        cout << fixed << 90 - to_deg(theta) << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  long a,b,c;scanf("%ld%ld%ld",&a,&b,&c);
  if(a%2==0||b%2==0||c%2==0){
    puts("0");
  }else {
    long long ans=a*b;
    if(ans>b*c)ans=b*c;
    if(ans>c*a)ans=c*a;
    printf("%lld\n",ans);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int n, k;
  string s;
  cin >> n >> k >> s;

  char diff = 'A' - 'a';
  s.at(k - 1) -= diff;
  cout << s << endl;
}


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;



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

	int k;cin>>k;
	string s; cin>>s;

	for(int i=0; i<min(k,(int)s.length()); i++){

			cout<<s[i];

	}
	if(k < (int)s.length()){
		writeln("...");
	}else {
		writeln("");
	}







}


Measured memory_bytes: 3620
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

S = input()
counter = collections.Counter(S)

ans = 101
for key, value in counter.items():
    T = copy.deepcopy(S) 
    T1 = ''
    count = 0
    if len(set(T)) > 1:
        while True:
            T1 = ''
            for i in range(len(T)-1):
                if T[i] == key or T[i+1] == key:
                    T1 += key
                else:
                    T1 += "?"
            count += 1
            T = copy.deepcopy(T1)
            if len(set(T1)) == 1: break
    ans = min(ans, count)
print(ans)



    

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

deque<int> dq[2];

void solve(){
	int n, k;
	scanf("%d%d", &n, &k);
	REP(i, 0, n) {
		int a;
		scanf("%d", &a);
		if (a < 0) {
			dq[0].push_front(-a);
		} else {
			dq[1].pb(a);
		}
	}
	ll ans = INF;
	REP(j, 0, 2) {
		if (SZ(dq[j ^ 1]) >= k) {
			ans = min(ans, (ll)dq[j ^ 1][k - 1]);
		}
		REP(i, 0, k - 1) {
			if (i < SZ(dq[j]) && k - 2 - i < SZ(dq[j ^ 1])) {
				//printf("%d %d\n", dq[j][i], dq[j ^ 1][k - 1 - i]);
				ans = min(ans, 2ll * dq[j][i] + dq[j ^ 1][k - 2 - i]);
			}
		}
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

int main() {
  int n;
  int a = 0;    // R->Wの数
  int b = 0;    // W->Rの数
  int n_change; // 交換する回数
  std::string s;
  
  std::cin >> n >> s;


  for (int i = 0; i < n; i++)
    if (s[i] == 'R') a++; // 赤の数でaを初期化(交換回数は赤の数)

  // 境界を一番左においた時の交換回数
  n_change = std::max(a, b);

  // はじめの完成形はすべて白. 境界を左から右に移動させ左から赤色していく
  for (int i = 0; i < n; i++) {
    if (s[i] == 'W') b++; // b(W->R)が一つ増える
    else a--;             // a(R->W)がひとつ減る

    // 最小の交換回数を更新
    if (n_change > std::max(a, b)) n_change = std::max(a, b);
  }

  std::cout << n_change << std::endl;
 
  return 0;
}

Measured memory_bytes: 3748
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let line = read_as_vec::<usize>();
    let (n, x, t) = (line[0], line[1], line[2]);

    println!("{}", (n + x - 1) / x * t);
}


Measured memory_bytes: 2140
# デバッグ用
DEBUG = False
# DEBUG = True

# 宣言
result = 0
ELEM_MAX = 100000 
seat_list = []

# 入力部
if DEBUG:
    N = '3'
    a = '1 2'

else:
    N = input()
    N = int(N)
    for i in range(N):
        seat = input()
        seat = seat.split(' ')
        seat = list(map(int, seat))
        seat_list.append(seat)

# 処理部
for seat in seat_list:
    result += seat[1] - seat[0] + 1

# 出力部
print(result)

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

int main() {
	int x;
	cin >> x;
	int tmp = (x - 400) / 200;
	pv(8 - tmp);
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;cin >> n >> m;
    if(n==1&&m==1){
        cout << 1 << endl;
    }
    else if(n==1){
        cout << m-2 << endl;
    }
    else if(m==1){
        cout << n-2 << endl;
    }
    else{
        cout << n*m-2*(n-2)-2*(m-2)-4 << endl;
    }
}

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

int main(){
  int N;
  cin >> N;
  int A[N];
  int B[N];
  rep(i, N){
    cin >> A[i];
    A[i]--;
  }
  // Aの要素とインデックスをひっくり返す
  // そのときインデックスは1始まりに直す
  rep(i, N){
    B[A[i]] = i + 1;
  }
  rep(i, N){
    cout << B[i] << " ";
  }
  cout << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll N;
  IN(N);

  ll N_sqrt = sqrt(N);
  N_sqrt++;

  ll ans = N-1;
  FOR(n,1,N_sqrt+1){
    ll m = N/n;
    if(n*m==N) ans = min(ans, n-1+m-1);
  }

  OUT(ans);

  return 0;
}

Measured memory_bytes: 256
X, N = list(map(int, input().split()))
P = list(map(int, input().split()))

P = set(P)

diff = float('INF')
ans = None
for i in range(-100, 300):
    if i in P:
        continue
    d = abs(X - i)
    if d < diff:
        diff = d
        ans = i

print(ans)

Measured memory_bytes: 9176
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double ld;

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

ld kyori(ld p,ld q){
    return sqrt((p*p) + (q*q));
}

int main() {
    ld N,D;
    cin >> N >> D;
    vector<ld> X(N),Y(N);
    rep(i,N){
        cin >> X[i] >> Y[i];
    }

    ld ans = 0;
    rep(i,N){
        ld result = kyori(X[i],Y[i]);
        // cout << result << endl;
        if(D >= result){
            // cout << X[i] << " : " << Y[i] << endl; 
            ans++;
        }
    }

    cout << ans << endl;

}




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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, x, y);
  out(x + y / 2);
}


Measured memory_bytes: 3636
using System;

class ABC_132_D
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);

        PascalsTriangle pascal = new PascalsTriangle(2010);

        for (int i = 1; i < K+1; i++)
        {
            long a = pascal.ncr(N - K + 1, i) % 1000000007;
            long b = pascal.ncr(K-1, i-1) % 1000000007;
            long ans = a * b % 1000000007;

            Console.WriteLine(ans);
        }
    }

    class PascalsTriangle
    {
        int m = 1000000007;
        int[,] table;

        public PascalsTriangle(int depth)
        {
            Calc(depth);
        }

        public PascalsTriangle(int depth, int mod)
        {
            m = mod;
            Calc(depth);
        }

        private void Calc(int depth)
        {
            table = new int[depth, depth];
            table[0,0] = 1;

            for (int d = 1; d < depth; d++)
            {
                for (int i = 0; i < d+1; i++)
                {
                    int left = (i==0) ? 0 : table[d-1,i-1];
                    int right = (i==d) ? 0 : table[d-1,i];
                    table[d, i] = (left + right) % m;
                }
            }
        }

        public int ncr(int n, int r)
        {
            return table[n, r];
        }
    }
}

Measured memory_bytes: 26080
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
int n,m,cnt=0,aa[330000],ans=0,ab[220000];
pair<int,int> pp[220000];
string s,sa[220000];
char ca[220000];
queue<int> que;
signed main(){
    cin>>n;
    cout<<10-n/200<<endl;
}

Measured memory_bytes: 10604
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;
struct Edge
{
	int a;
	int b;
	int c;
	int f;
};
template<int S>
struct Flow
{
vector<Edge> es;
vector<int> edges[S];
void add(int a, int b, int cap){
	//cout << "add " << a << ", " << b << ", " << cap << endl;
	es.push_back(Edge());
	Edge& e=es.back();
	e.a=a;
	e.b=b;
	e.c=cap;
	e.f=0;
	edges[a].push_back(es.size()-1);
	edges[b].push_back(es.size()-1);
}
void init(){
	es.clear();
	for(int i=0;i<S;i++){
		edges[i].clear();
	}
}
int fill(int s, int t, int sz=S){
	int ret=0;
	int pre[S];
	int Q[S];
	while(1){
		memset(pre,-1,sizeof(int)*sz);
		int qs=0;
		Q[0]=s;
		pre[s]=-2;
		int qe=1;
		while(qs<qe&&pre[t]==-1){
			int p=Q[qs++];
			for(int i=0;i<edges[p].size();i++){
				int j=edges[p][i];
				int nex;
				if(es[j].a==p){
					if(es[j].f==es[j].c){
						continue;
					}
					nex=es[j].b;
				}
				else{
					if(es[j].f==0){
						continue;
					}
					nex=es[j].a;
				}
				if(pre[nex]==-1){
					Q[qe++]=nex;
					pre[nex]=j;
				}
			}
		}
		if(pre[t]==-1){
			return ret;
		}
		{
			int p=t;
			int f=INT_MAX;
			while(p!=s){
				int j=pre[p];
				if(es[j].b==p){
					f=min(f,es[j].c - es[j].f);
					p=es[j].a;
				}
				else{
					f=min(f,es[j].f);
					p=es[j].b;
				}
			}
			p=t;
			while(p!=s){
				int j=pre[p];
				if(es[j].b==p){
					es[j].f+=f;
					p=es[j].a;
				}
				else{
					es[j].f-=f;
					p=es[j].b;
				}
			}
			ret+=f;
		}
	}
	// ここには来ない
	return -1;
}
};
Flow<2*100*100> f;
const int inf=200*100;
int main() {
	char table[102][102];
	int H,W;
	scanf("%d%d",&H,&W);
	for(int i=0;i<H;i++){
		scanf("%s",table[i]);
	}
	for(int i=0;i<H;i++){
		int k=-1;
		for(int j=0;j<W;j++){
			if(table[i][j]=='.')continue;
			if(k!=-1){
				f.add(W*i+j,W*i+k,inf);
				f.add(W*i+k,W*i+j,inf);
			}
			k=j;
		}
	}
	for(int j=0;j<W;j++){
		int k=-1;
		for(int i=0;i<H;i++){
			if(table[i][j]=='.')continue;
			if(k!=-1){
				f.add(W*H+W*i+j,W*H+W*k+j,inf);
				f.add(W*H+W*k+j,W*H+W*i+j,inf);
			}
			k=i;
		}
	}
	int s,t;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(table[i][j]=='.')continue;
			if(table[i][j]=='o'){
				f.add(W*i+j,W*H+W*i+j,1);
				f.add(W*H+W*i+j,W*i+j,1);
			}
			else if(table[i][j]=='S'){
				s=W*i+j;
				f.add(W*i+j,W*H+W*i+j,inf);
				f.add(W*H+W*i+j,W*i+j,inf);
			}
			else{
				t=W*i+j;
				f.add(W*i+j,W*H+W*i+j,inf);
				f.add(W*H+W*i+j,W*i+j,inf);
			}
		}
	}
	int v=f.fill(s,t);
	if(v>=inf){
		puts("-1");
	}
	else{
		printf("%d\n",v);
	}

	return 0;

}



Measured memory_bytes: 2804
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#define int long long
int L,ans;std::string str;
bool ok(int x){
    if(x==0||x==str.size()-1)return 1;
    int l=x-1,r=x+1;
    if(l>=0)while(l&&str[l]=='W')l--;
    while(r<str.size()&&str[r]=='W')r++;
    if((l<0||str[l]=='B')&&(r<str.size()&&str[r]=='B'))return 0;
    return 1;
}
int calc(int x){
    if(str[x]!='.'||!ok(x))return 0;
    int l=x-1,r=x+1;
    if(l>=0)while(l&&str[l]=='B')l--;
    while(r<str.size()&&str[r]=='B')r++;
    if((l<0||(l>=0&&str[l]!='W'))&&(r==str.size()||str[r]!='W'))return 0;
    if((l>=0&&str[l]!='W')||l<0)return r-x-1;
    if(r==str.size()||str[r]!='W')return x-l-1;
    return std::max(x-l-1,r-x-1);
}
signed main(){
    scanf("%lld",&L),std::cin>>str;
    for(int i=0;i<L;i++)ans=std::max(ans,calc(i));
    printf("%lld\n",ans);
}


Measured memory_bytes: 3336
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
Int powmod(Int x, unsigned long long y, Int M)
{
    if (y == 0) return 1;
    if (y % 2 == 0) return powmod(x*x%M, y/2, M);
    return x*powmod(x*x%M, y/2, M)%M;
}
using Matrix = array<Int, 9>;
Matrix mul(Matrix A, Matrix B, Int M) {
    Matrix ans = {};
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                (ans[i*3+j] += A[i*3+k] * B[k*3+j]) %= M;
            }
        }
    }
    return ans;
}
Matrix powmat(Matrix A, Int x, Int M) {
    if (x == 0) return { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
    if (x % 2 == 0) return powmat(mul(A, A, M), x/2, M);
    return mul(A, powmat(mul(A, A, M), x/2, M), M);
}
Int f(Int A, Int B, Int R, Int N, Int M)
{
    Matrix mat = { R, 1, 0, 0, 1, B, 0, 0, 1 };
    Matrix X = { 0, 0, 0, A, 0, 0, 1, 0, 0 };
    Int t = mul(powmat(mat, N, M), X, M)[0];
    return t;
}
int main()
{
    Int L, A, B, M; cin >> L >> A >> B >> M;
    array<Int, 19> counts = {};
    Int idx = 0;
    for (int i = 1; i < counts.size(); i++) {
        Int k = (Int)pow(10, i) - 1 - A;
        if (k < idx*B) continue;
        k /= B;
        k = min(L-1, k);
        counts[i] = k - idx + 1;
        idx += counts[i];
    }
    Int ans = 0;
    for (int i = 1; i < counts.size(); i++) {
        unsigned long long s = 0, t = 0;
        for (int j = 1; j < i; j++) s += counts[j];
        for (int j = i+1; j < counts.size(); j++) t += j * counts[j];
        ans = (ans + f((A%M+B%M*(s%M))%M, B%M, powmod(10, i, M), counts[i], M) * powmod(10, t, M)) % M;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 
  int64_t x;
  cin>>x;


  int64_t max_wk=0;
  for(int i=2;i*i<=x;i++){
    int64_t wk=i;
    while(wk*i<=x){
      wk*=i;
    }
    max_wk=max(wk,max_wk);
  }

  if(x==1)
    cout<<1<<endl;
  else
    cout<<max_wk<<endl;

	return 0;
}

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

using namespace std;

typedef long long int ll;

const int N = 1e6 + 5;

vector < int > lp (N), primes;

int cnt[N];

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

  for (int i = 2; i < N; i++) {
    if (lp[i] == 0) {
      lp[i] = i;
      primes.push_back (i);
    }
    for (int j = 0; j < (int)primes.size() && (ll)i * primes[j] < N && primes[j] <= lp[i]; j++) lp[primes[j] * i] = primes[j];
  }

  int n;
  cin >> n;
  vector < int > a (n);
  for (auto &i : a) cin >> i;

  bool ok = true;
  for (auto i : a) {
    while (i > 1) {
      cnt[lp[i]]++;
      if (cnt[lp[i]] > 1) {
        ok = false;
        break;
      }
      int b = lp[i];
      while (i % b == 0) i /= b;
    }
  }

  if (ok) {
    cout << "pairwise coprime" << '\n';
    return 0;
  }

  int g = a[0];
  for (int i = 1; i < n; i++) g = __gcd (g, a[i]);

  if (g == 1) {
    cout << "setwise coprime" << '\n';
    return 0;
  }

  cout << "not coprime" << '\n';
}


Measured memory_bytes: 15144
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long

int N, cnt=0;
string A, B, C;
set<char> MP;

void solve(){
    for(int i = 0; i < N; i++){
        char buff_a = A[i];
        char buff_b = B[i];
        char buff_c = C[i];

        if(buff_a == buff_b && buff_b == buff_c) continue;
        else if(buff_a == buff_b || buff_b == buff_c || buff_c == buff_a) cnt += 1;
        else cnt += 2;
    }
    cout << cnt << endl;
}

int main(){
    cin >> N >> A >> B >> C;

    solve();
}


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

int main(){
    int N = 100000;
    vector<bool> is2017(N+1, true);
    is2017[0] = false;
    is2017[1] = false;
    for(int i=2; i<=N; i++){
        if(!is2017[i]) continue;
        for(int j=2; i*j<=N; j++){
            is2017[i*j] = false;
        }
    }

    for(int i=N; i>=0; i--){
        if(!(is2017[i] && is2017[(i+2)/2])) is2017[i] = false;
    }
    is2017[2] = false;

    vector<int> cnt(N+1,0);
    for(int i=1; i<=N; i++){
        if(is2017[i]) cnt[i]++;
        cnt[i]+=cnt[i-1];
    }

    int Q; cin >> Q;
    while(Q > 0){
        int l, r;  cin >> l >> r;
        cout << cnt[r] - cnt[l-1] << endl;
        Q--;
    }
}


Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	N := nextInt()
	fmt.Fprintln(out, 1.0-float64(N/2)/float64(N))
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// Genericsがないので筋肉で...
// interfaceでの取扱がようわからんし
func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// mapからkeysとvaluesを返す感じのやつ
// なんかしらんけどmap[interface{}]interface{}しか受け付けない。なんのためのinterface{}やねん
// なので呼ぶときのmapはmap[int]stringとかじゃダメ
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
	return
}


Measured memory_bytes: 640
N, M = map(int,input().split())
E  = []
for i in range(N):
  E.append(list(map(int,input().split())))
#print(E)
E.sort(key=lambda x:x[0])
#print(E)
ans = 0
i = 0
while M > 0:
  A, B = E[i]
  ans += A * min(B,M)
  M = max(M-B,0)
  i+=1
print(ans)

Measured memory_bytes: 29020
a, b, c, d = gets.chomp.split(' ').map{|i| i.to_i }
a -= 1
cd = c.lcm(d)
abcc = (b / c).floor - (a / c).floor
abdc = (b / d).floor - (a / d).floor
abcdc = (b / cd).floor - (a / cd).floor
puts b - a - abcc - abdc + abcdc


Measured memory_bytes: 1788
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
s=0
temp=""
for i in A:
  s+=B[i-1]
  if temp==i-1:
    s+=C[temp-1]
  temp=i
print(s)

Measured memory_bytes: 3060
# Your code here!
x,y=gets.split
x=x.to_i
y=y.to_i



ans=1
i=x
loop{
   
    
   i*=2
   if i<y
       ans+=1
    elsif i-y==0
    
    ans+=1
    else
        break
    end
    
}
    
    
p ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    vector<int>n(3);
    int saidai=0;
    rep(i,3) cin >> n[i];
    int cnt=0;
    int hantei=0;
   
    rep(i,3){
        if(n[i]%2 == 1) hantei++;
    }
    
        if(hantei == 1){
            rep(i,3){
                if(n[i]%2 == 0)n[i]++;
            }
            cnt++;
        }
        else if(hantei == 2){
            rep(i,3){
                if(n[i]%2 == 1)n[i]++;
            }
            cnt++;
        }
    rep(i,3){
        saidai = max(saidai,n[i]);
    }
   
    rep(i,3){
        while(n[i] != saidai){
            n[i] += 2;
            cnt ++;
        }
    }
    cout << cnt << endl;
}
      

Measured memory_bytes: 256