akhauriyash/Code-Regression huggingface dataset:
/*
 *  Author :: Kattu37
 */

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortallr(x) sort(allr(x))
#define PI 3.1415926535897932384626
#define mod 1000000007

typedef pair<int, int>  pii;
typedef pair<ll, ll>  pll;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pll>   vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;

void solve()
{
	int a;
	cin >> a;

	cout << a + a*a + a*a*a << "\n";
}

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

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

	return 0;
}


Measured memory_bytes: 3688
n = int(input())
s_list = [input() for i in range(n)]
m = int(input())
t_list = [input() for i in range(m)]                                                                                       

s_set = set(s_list)
t_set = set(t_list)

result = 0

for s in s_set:
  val = s_list.count(s) - t_list.count(s)
  if val > result:
    result = val

print(result)

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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)

int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll divisibles(ll a, ll b, ll m){if(a%m==0)return (b/m)-(a/m)+1;else return (b/m)-(a/m);}// in [a,b]

vi vis(100001,0);
vi adj[100001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vl vec(100001,-1);
    vec[0]=1;
    vec[1]=1;
    for(int i=0; i<m; ++i)
    {
    	int x;cin>>x;
    	vec[x]=0;
    }
    for(int i=2; i<=n; ++i)
    {
    	if(vec[i]==-1)
    		vec[i]=(vec[i-1]+vec[i-2])%MOD;

    }
    cout<<vec[n]<<"\n";

}

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

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

    int res = 0, cnt_g = 0, cnt_p = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'g') {
            if (cnt_p < cnt_g) {
                res++;
                cnt_p++;
            } else {
                cnt_g++;
            }
        } else {
            if (cnt_p < cnt_g) {
                cnt_p++;
            } else {
                res--;
                cnt_g++;
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

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

    vector<int> cnt(N, 1);
    vector<bool> exist(N, false);
    exist[0] = true;
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        if (exist[x]) exist[y] = true;
        cnt[x]--; cnt[y]++;
        if (cnt[x] == 0) exist[x] = false;
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (exist[i]) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3720
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
vector<pair<int,int> > v[100005];
long long dist[100005];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int l,r,d;
		cin>>l>>r>>d;
		l--;
		r--;
		v[l].push_back(make_pair(r,d));
		v[r].push_back(make_pair(l,-d));
	}
	for(int i=0;i<n;i++) dist[i]=1e7;
	for(int i=0;i<n;i++)
	{
		if(dist[i]==1e7)
		{
			queue<int> q;
			q.push(i);
			dist[i]=0;
			while(!q.empty())
			{
				int a=q.front();
				q.pop();
				for(int j=0;j<v[a].size();j++)
				{
					pair<int,int> p=v[a][j];
					int to=p.first,c=p.second;
					if(dist[to]==1e7)
					{
						dist[to]=dist[a]+c;
						q.push(to);
					}
					else if(dist[to]!=dist[a]+c)
					{
						cout<<"No"<<endl;
						return 0;
					}
				}
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
	return 0;
}

Measured memory_bytes: 9728
# PyPy3 (2.4.0)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------
from collections import defaultdict, deque
class DAG:
    def __init__(self, adjList, inDegreeArray):
        self.A = adjList
        self.In = inDegreeArray
        self.n = len(inDegreeArray)
        self.depth = [-1]*(self.n)
        self.nodes = []

    def sort(self):
        dq = deque()
        # 入次数が 0 の頂点を deque に入れる
        for i in range(self.n):
            if self.In[i] == 0:
                dq.append(i)
                self.depth[i] = 0
        while dq:
            v1 = dq.popleft()
            self.nodes.append(v1)
            for v2 in self.A[v1]:
                self.In[v2] -= 1
                self.depth[v2] = max(self.depth[v2], self.depth[v1] + 1)
                if In[v2] == 0:
                    dq.append(v2)
    
    def get_node_array(self):
        if len(self.nodes) == self.n:
            return self.nodes
        else:
            return []
    
    def get_depth(self):
        if len(self.depth) == self.n:
            return self.depth
        else:
            return []

# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]

# 試合と頂点の対応表
M = [[-1 for _ in range(N)] for _ in range(N)]
cnt = 0
for i in range(N):
    for j in range(i+1,N):
        M[i][j] = cnt
        M[j][i] = cnt
        cnt += 1

# 試合 j が 試合 i の翌日以降にしか行えない -> G[i][j]

G = [[] for _ in range((N*(N-1)//2))]
# 頂点(試合) の入次数
In = [0]*(N*(N-1)//2)
# 入力からグラフ, 配列を生成
for i in range(N):
    for j in range(N-2):
        gagem_id = M[i][ A[i][j] - 1 ]
        next_game_id = M[i][ A[i][j+1] - 1 ]
        G[gagem_id].append(next_game_id)
        In[next_game_id] += 1

dag = DAG(G, In)
dag.sort()
node = dag.get_node_array()
depth = dag.get_depth()

if len(node) == 0:
    print(-1)
else:
    print(max(depth) + 1)

Measured memory_bytes: 142300
//#include <bits/stdc++.h>                          //include all library  
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <string.h>
#include <functional> // greater<int> はfunctionalヘッダ
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)          //REP(i, 10){...} //i=0～i=9までのループ
#define REPR(i, n) for(int i = n;i >= 0;i--)        //REPR(i, 10){...} //i=10～i=0までのループ
#define FOR(i, m, n) for(int i = m;i < n;i++)       //FOR(i, 3, 10){...} //i=3～i=9までのループ
#define FORR(i, m, n) for(int i = m;i >= n;i--)     //FORR(i, 10, 3){...} //i=10～i=3までのループ
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define PI 3.141592653589
#define npos -1


int main(){
  string str;
  cin >> str;
  size_t size = str.size();
  string str2="";
  REP(i,size)
  {
    if(i*2>size-1) break;
    str2 +=str[i*2];
  }
  cout << str2;
}

Measured memory_bytes: 512
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	string s;
	cin >> s;
	int ans = 10000000;
	for (char i = 'a';i <= 'z';++i) {
		string nya = s;
		for (int q = 0;q >= 0;++q) {
			if (nya.length() == 0) break;
			int failed = 0;
			for (int j = 0;j < nya.length();++j) {
				if (nya[j] != i) failed = true;
			}
			if (failed == false) {
				ans = min(ans, q);
				break;
			}
			string geko;
			for (int j = 0;j < nya.length() - 1;++j) {
				if (nya[j] == i || nya[j + 1] == i) {
					geko.push_back((char)i);
				}
				else {
					geko.push_back(nya[j]);
				}
			}
			nya = geko;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import numpy as np

s=input().split(' ')
A,B,N=int(s[0]),int(s[1]),int(s[2])

def f(x):
    a=np.floor(A*x/B)-A*np.floor(x/B)
    return a.astype(int)

if N<B-1:
    print(f(N))
else:
    print(f(B-1))


Measured memory_bytes: 27136
x, y = gets.split.map(&:to_i)
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

[a,b,c].each do |ar|
  if ar.include?(x) && ar.include?(y)
    puts 'Yes'
    exit 0
  end
end

puts 'No'

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include<math.h>
#include<vector>
#include <queue>
#include <deque> 
#define ll long long
#define M 1000000007 
#define MM 998244353
using namespace std;
 
int main()
{
	long long int sum = 0;
    string s, t;

    cin >> s >> t;

    for (int i = 0; i < s.size(); i++)
    {
    	if (s[i] != t[i])
    	{
    		sum++;
    	}
    }

    cout << sum;

    return 0;
}

Measured memory_bytes: 3852
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
const int INF = 1001001001;

int main()
{
    rep(i,5){
        int a; cin >> a;
        if(a==0) cout << ++i << endl;
    }
}

/*
Ctrl+@
g++ a.cpp
./a.out
*/

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1e9+7;
const ll inf = (LLONG_MAX>>2);
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,k,q,t;
  cin >> n >> k >> q;
  vector<ll> a(n+1,k-q);
  for(ll i = 0; i < q; ++i){
    cin >> t;
    ++a[t];
  }
  for(ll i = 1; i <= n; ++i){
    if(a[i] > 0) cout <<"Yes\n";
    else cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main(void){
    
    int n;
    cin>>n;
    
    for(int i=1;i<=n;i++){
    
      if(!(i%3)) cout<<" "<<i;
      else{
        
        int x=i;
        
        for(;x;){
        
          if(x%10==3){
            cout<<" "<<i; 
            break;
          }
          x/=10;
        
        }
        
        
      }
    
    }
    cout<<endl;
    
    return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int N;
	int ans = 0;
	cin >> N;
	vector<int> v;
	for (int i = 0;i<N;i++){
		int l;
		cin >> l;
		v.pb(l);
	}
	for (int i = 0;i<N;i++){
		for (int j = i+ 1;j < N;j++){
			if (i != j){
				ans += (v[i] * v[j]);
			}
		}
	}
	cout << ans <<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,k;
  cin>>a>>b>>c>>d>>k;
  if((c*60+d-(a*60+b))%k==0){
    cout<<(((c*60+d-(a*60+b))/k)-1)*k<<endl;
  }else{
    cout<<c*60+d-(a*60+b)-k<<endl;
  }
  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c,x,y;
	int sum1,sum2;
	cin>>a>>b>>c>>x>>y;
	if(x<y)
	{
		sum1=2*x*c+(y-x)*b;
		sum2=2*c*x+2*(y-x)*c;
	}
	else
	{
		sum1=2*y*c+(x-y)*a;
		sum2=2*c*y+2*(x-y)*c;
	}
	 
	int m = a*x+y*b;
	cout<<min(sum1,min(sum2,m));
 } 

Measured memory_bytes: 888
<?php
// 0 => P                     P1         B0         T01
// 1 => B [P] P [P] B         P3 2倍して+1 B2 2倍して+2 T05 2倍して+3
// 2 => B [BPPPB] P [BPPPB] B P7 2倍して+1 B6 2倍して+2 T13 2倍して+3

fscanf(STDIN, "%d %d", $N, $X);

$L = [1 => 1];
for ($i = 2; $i <= 50; $i++) {
    $L[$i] = $L[$i-1] * 2 + 3;
}
// 1 =>  1
// 2 =>  5
// 3 => 13
// var_dump($L);

printf("%d", solve($N, $X));

function solve($N, $X) {
    global $ret, $L;

    if ($X === 1) {
        if ($N === 0) {
            $ret++;
        }
        return $ret;
    } elseif($X === $L[$N] + 2) {
        $ret += ceil($L[$N] / 2) + 1;
    } elseif($X === $L[$N] * 2 + 3) {
        $ret += ceil($L[$N] / 2) * 2 + 1;
    } elseif($X > 1 && $X < $L[$N] + 2) {
        solve($N - 1, $X - 1);
    } elseif($X > $L[$N] + 2 && $X < $L[$N] * 2 + 3) {
        $ret += ceil($L[$N] / 2) + 1;
        solve($N - 1, $X - 2 - $L[$N]);
    } else {
        exit("ERR {$N} {$X}\n");
    }

    return $ret;
}

Measured memory_bytes: 4604
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimze("02")
using namespace std;
using ll = long long;
const ll maxn=3e5+5;
ll n,m,a[maxn],b[maxn],k,ans,p;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>n>>m>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i>0)a[i]+=a[i-1];
	}
	p=n-1;
	if(a[p]<=k)ans=n;
	for(ll i=0;i<m;i++){
		cin>>b[i];
		if(i>0)b[i]+=b[i-1];
		if(b[i]>k)continue;
		if(p>=0){
			while(a[p]+b[i]>k){
				p--;
				if(p<0)break;
			}
		}
		if(p>=0){
			ans=max(ans,i+p+2);
		}
		else ans=max(ans,i+1);
	}
	cout<<ans;
}


Measured memory_bytes: 6820
void main()
{
    long n = rdElem;
    long[] a = rdRow;

    bool ok = true;
    foreach (x; a)
    {
        if (!(x & 1))
        {
            if (x % 3 != 0 && x % 5 != 0) ok = false;
        }
    }

    writeln(ok ? "APPROVED" : "DENIED");
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

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

int judge_num(int n){
  int i;
  
  for(i=2; i<n; i++){
    if(i*i>n) return 1;
    if(n%i==0){
      return 0;
    }
    
  }
  return 1;
}

  


Measured memory_bytes: 2128
a = list(map(int, input().split()))
if a[0] * a[1] == a[2] * a[3]:
  print(a[0]*a[1])
elif a[0] * a[1] > a[2] * a[3]:
  print(a[0]*a[1])
else:
  print(a[2]*a[3])

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int N,i,k[10001],flg,a;
	scanf("%d",&N);
	while(!(N==0)){
		flg=0;
		a=0;
		for(i=1;i<=N;i++){
			scanf("%d",&k[i]);
			if(k[i]>=2){
				flg=1;
				a++;
			}
			else if(k[i]>=1){
				a++;
			}
		}
		if(flg==1){
			a=a+1;
			printf("%d\n",a);
		}
		else{
			printf("NA\n");
		}
		scanf("%d",&N);
	}
	return 0;
}

				

Measured memory_bytes: 1076
#include<stdio.h>

void call(int);

int main(){
  int n;
  scanf("%d",&n);

  call(n);
    return 0;
}
void call(int n){
  int i;
  int x;
  for(i = 1; i <= n; i++){
    x = i;
    if(x % 3 == 0){
      printf(" %d",i);
    } else if(x % 10 == 3){
      printf(" %d",i);
    } else{
      while(x != 0){
	if(x % 10 == 3){
	  printf(" %d",i);
	  break;
	}
	x /= 10;
      }
    }
  }
  printf("\n");
}


Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <utility>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;

#define LL   long long
#define ld   long double
#define pii  pair<int,int>
#define pLL  pair<LL,LL>
#define vint vector<int>
#define vLL  vector<LL>
#define vpii vector<pii>

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define F first
#define S second
#define MP make_pair
#define PB push_back

#define Si(x) scanf("%d",&(x));
#define Sii(x,y) scanf("%d %d",&(x),&(y));
#define Siii(x,y,z) scanf("%d %d %d",&(x),&(y),&(z));
#define Siiii(x,y,z,w) scanf("%d %d %d %d",&(x),&(y),&(z),&(w));
#define Siiiii(x,y,z,w,a) scanf("%d %d %d %d %d",&(x),&(y),&(z),&(w),&(a));
#define Siiiiii(x,y,z,w,a,b) scanf("%d %d %d %d %d %d",&(x),&(y),&(z),&(w),&(a),&(b));
#define SL(x) scanf("%lld",&(x));
#define SLL(x,y) scanf("%lld %lld",&(x),&(y));
#define SLLL(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z));
#define SLLLL(x,y,z,w) scanf("%lld %lld %lld %lld",&(x),&(y),&(z),&(w));
#define SLLLLL(x,y,z,w,a) scanf("%lld %lld %lld %lld %lld",&(x),&(y),&(z),&(w),&(a));
#define SLLLLLL(x,y,z,w,a,b) scanf("%lld %lld %lld %lld %lld %lld",&(x),&(y),&(z),&(w),&(a),&(b));

#define Pi(x) printf("%d\n",(x));
#define Pii(x,y) printf("%d %d\n",(x),(y));
#define Piii(x,y,z) printf("%d %d %d\n",(x),(y),(z));
#define Piiii(x,y,z,w) printf("%d %d %d %d\n",(x),(y),(z),(w));
#define Piiiii(a,b,c,d,e) printf("%d %d %d %d %d\n",(a),(b),(c),(d),(e));
#define Piiiiii(a,b,c,d,e,f) printf("%d %d %d %d %d %d\n",(a),(b),(c),(d),(e),(f));
#define PL(x) printf("%lld\n",(x)*1LL);
#define PLL(x,y) printf("%lld %lld\n",(x)*1LL,(y)*1LL);
#define PLLL(x,y,z) printf("%lld %lld %lld\n",(x)*1LL,(y)*1LL,(z)*1LL);
#define PLLLL(x,y,z,w) printf("%lld %lld %lld %lld\n",(x)*1LL,(y)*1LL,(z)*1LL,(w)*1LL);
#define PLLLLL(a,b,c,d,e) printf("%lld %lld %lld %lld %lld\n",(a),(b),(c),(d),(e));
#define PLLLLLL(a,b,c,d,e,f) printf("%lld %lld %lld %lld %lld %lld\n",(a),(b),(c),(d),(e),(f));

#define Pi1(x) printf("%d",  (x));
#define PL1(x) printf("%lld",(x));
#define Pspace putchar(' ');
#define Pendl  puts("");

#define MEM0(x) memset( (x), 0, sizeof( (x) ) )
#define MEM1(x) memset( (x),-1, sizeof( (x) ) )
#define REP1(i,n)  for (int i = 1; (n) >= i ; ++i)
#define REP0(i,n)  for (int i = 0; (n) >  i ; ++i)

int myRnd() {
    return abs(  ((rand()<<15) | rand()) );
}

int myRnd(int L,int R) {
    return abs(( (rand()<<15)|rand() ) ) % (R-L+1) + L;
}

void Parr(int *arr,int L,int R) {
    for (int i=L;R>=i;i++) {
        printf("%d%c",arr[i]," \n"[i==R]);
    }
}

void Pvec(vint v) {
    for (int i=0;SZ(v)>i;i++) {
        printf("%d%c",v[i]," \n"[i==SZ(v)-1]);
    }
}

const int N = 2e5 + 6;

int a[N];

int main () {
    srand(time(NULL));
    int n,k;
    Sii(n,k);
    REP1(i,n)
    {
        int x;
        Si(x);
        a[x]++;
    }
    sort(a,a+N);
    int tot=0;
    int cnt=0;
    for (int i=N-1;;i--) {
        cnt++;
        tot += a[i];
        if (cnt == k) break;
    }
    cout << n-tot << endl;
}



Measured memory_bytes: 1532
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<1000){
            System.out.println("ABC");
        }else{
            System.out.println("ABD");
        }
        sc.close();
    }
}

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

using namespace std;

const int mxn = 1e5;

char s[mxn + 11];
int f[mxn + 11];

int main(){

   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    int N, Q;
    scanf("%d %d", &N, &Q);
    scanf("%s", s + 1);
    f[1] = 0;
    for (int i = 2; i <= N; i++){
        f[i] = f[i - 1];
        if (s[i - 1] == 'A' && s[i] == 'C')
            f[i]++;
    }
    while (Q--){
        int l, r;
        scanf("%d %d", &l, &r);
        printf("%d\n", f[r] - f[l]);
    }
    return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
int main(){
int ans,j,n,a[11],i,f1=100000,f2,s1=100000,s2,b1=0,b2,l1=0,l2;
while(1){
scanf("%d\n",&n);
if(n==0){
break;
}
for(i=0;i<n;i++){
for(j=0;j<9;j++){
scanf("%d",&a[j]);
}
ans=(a[1]+a[3]+a[5]+a[7])*60+a[2]+a[4]+a[6]+a[8];
if(ans<f1){
s1=f1,s2=f2;
f1=ans,f2=a[0];
}
else if(ans<s1){
s1=ans,s2=a[0];
}
if(ans>l1){
b1=l1,b2=l2;
l1=ans,l2=a[0];
}
else if(ans>b1){
b1=ans,b2=a[0];
}
}
printf("%d\n%d\n%d\n",f2,s2,b2);
f1=100000,s1=100000,b1=0,l1=0;
}
return 0;
}


Measured memory_bytes: 2044
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = Integer.parseInt(scan.next());
		int H = Integer.parseInt(scan.next());
		int W = Integer.parseInt(scan.next());
		System.out.println((N - H + 1) * (N - W + 1));
	}
}


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


int main() {
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  while(1){
   
    if(n/k == 0 && n%k == 0) break;
    cnt++;
    n/=k;
  }
cout << cnt << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <cassert>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <numeric>
#define ALL(c) (c).begin(), (c).end()

using namespace std;
using ll = long long;
using pli = pair<ll, int>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdi = pair<double, int>;
using pdd = pair<double, double>;

int main() {
	int N;
	cin >> N;
	vector<int> b(N + 1);
	for (int i = 1; i <= N; i++)
	{
		cin >> b[i];
	}
	for (int i = 1; i <= N; i++)
	{
		if (b[i] > i) {
			cout << -1 << endl;
			return 0;
		}
	}
	vector<int> ans(N + 1);
	for (int i = N; i >= 1; i--)
	{
		for (int j = i; j >= 1; j--)
		{
			if (b[j] == j) {
				ans[i] = j;
				b.erase(b.begin() + j);
				break;
			}
		}
	}

	for (int i = 1; i <= N; i++)
	{
		cout << ans[i] << endl;
	}
	return 0;
}



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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x, y;
    x = (c+b-1)/b;
    y = (a+d-1)/d;
    if(x <= y){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3540
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007


signed main(){
    char S[100];
    scanf("%s",S);
    int N=strlen(S);
    int ans=0;
    for(int i=0;i<N;i++){//始点
        for(int j=i;j<N;j++){//終点
            for(int k=i;k<=j;k++){
                if(S[k]!='A'&&S[k]!='C'&&S[k]!='G'&&S[k]!='T')break;
                if(k==j)ans=max(ans,j-i+1);
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author toshif
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyReader in = new MyReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        long mi = 1000_000_000_000_000_000L;

        public void solve(int testNumber, MyReader in, PrintWriter out) {
            int H = in.nextInt();
            int W = in.nextInt();

            calc(H, W);
            calc(W, H);

            out.println(mi);
        }

        void calc(int h, int w) {
            for (int i = 1; i < h; i++) {
                int h1 = i;
                int h2 = h - i;

                long S1 = 1L * h1 * w;

                // split h2
                {
                    int h21 = h2 / 2;
                    int h22 = h2 - h21;

                    if (h21 != 0 && h22 != 0) {
                        long S2 = 1L * h21 * w;
                        long S3 = 1L * h22 * w;

                        long diff = Math.max(S1, Math.max(S2, S3));
                        diff -= Math.min(S1, Math.min(S2, S3));
                        mi = Math.min(mi, diff);
                    }
                }

                // split w
                {
                    int w1 = w / 2;
                    int w2 = w - w1;

                    if (w1 != 0 && w2 != 0) {
                        long S2 = 1L * h2 * w1;
                        long S3 = 1L * h2 * w2;

                        long diff = Math.max(S1, Math.max(S2, S3));
                        diff -= Math.min(S1, Math.min(S2, S3));
                        mi = Math.min(mi, diff);
                    }
                }
            }
        }

    }

    static class MyReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public MyReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 23380
n,a,b = map(int, input().split())
if (b-a)%2 == 0:
    print((abs(a-b))//2)
    exit()
ans = 0
if a>b:
    tmp = a
    a = b
    b = tmp
ans = min((a+(b-a)//2),(n-b+1+(b-a)//2))
print(ans)

Measured memory_bytes: 3060
import java.lang.Math.*
import java.util.*

private fun readln() = readLine()!!.trim()
private fun readlnInt() = readln().toInt()
private fun readlnStrings() = readln().split(' ')
private fun readlnInts() = readlnStrings().map { it.toInt() }
private fun readlnLongs() = readlnStrings().map { it.toLong() }


fun solve() {
    val N = readlnInt()
    val A = readlnInts()
    val B = readlnInts().toMutableList()
    val pq = PriorityQueue<Int>(N) {a:Int, b:Int -> B[b] - B[a]}
    (0 until N).filter { B[it] > A[it] }.toCollection(pq)
    var ttl = 0L
    while (pq.isNotEmpty()){
        val i = pq.poll()!!
        val iP = (i+1)%N
        val iN = (i-1+N)%N
        val step = B[iP] + B[iN]
        if (B[i] - A[i] < step){
            println(-1)
            return
        } else {
            val p = (B[i] - A[i]) / step
            B[i] -= p * step
            ttl += p
            if (B[i] > A[i]){
                pq.add(i)
            }
        }
    }
    if ((0 until N).all{B[it] == A[it]}){
        println(ttl)
    } else {
        println(-1)
    }
}


fun main(args: Array<String>) {
//    val queryNum = readlnInt()
//    for (queryIdx in 1..queryNum) {
//        println("Case #$queryIdx:")
    solve()
//    }
}

Measured memory_bytes: 124104
isIn :: String -> String -> Bool
isIn (x:y:[z]) = (/=[]) . dropWhile (/=z) . dropCut (/=y) . dropCut (/=x)

dropCut cond xs
    | null remains = []
    | otherwise    = tail remains
  where
    remains = dropWhile cond xs

main = do
    let candidates = (\a b c -> [a, b, c]) <$> ['0'..'9'] <*> ['0'..'9'] <*> ['0'..'9']
    _ <- getLine
    s <- getLine

    print $ length $ filter (`isIn` s) candidates


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

#define inf 2000000009
#define ff first 
#define ss second 
#define ll long long

void pt(int i){
	cout<<((i==1)? "Yes":"No")<<endl; return; 
} 

int main(){
	int t; cin>>t; 
	while(t--){
		ll a,b,c,d; 
		cin>>a>>b>>c>>d; 
		if(b>a || d<b){
			pt(0); continue; 
		}
		else if(c>=b-1){
			pt(1); continue; 
		}
		a%=b; 
		d%=b; 
		ll g=__gcd(d,b); 
		if(c<b-g+a%g){
			pt(0); 
		}
		else {
			pt(1); 
		}

	}

}

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

typedef struct node{
	struct node*oya,*ko[2];
	int val,p;
}node;

void rot(node*v,int d){
	node*nnn=v->ko[d];
	 
	v->ko[d]=nnn->ko[d^1];
	if(v->ko[d])v->ko[d]->oya=v;
	 
	v->oya->ko[v->oya->ko[1]==v]=nnn;
	nnn->oya=v->oya;
	 
	nnn->ko[d^1]=v;
	v->oya=nnn;  
}
void ins(node*v,node*oya,int dir,int val,int p){
	if(!v){
		v=calloc(1,sizeof(node));
		v->oya=oya;
		v->val=val;
		v->p=p;
		oya->ko[dir]=v;
	}else{
		int d=v->val<val;
		ins(v->ko[d],v,d,val,p);
		if(v->ko[d]->p > v->p)rot(v,d);
	}
}
node*find(node*v,int val){
	if(!v)return 0;
	if(v->val==val)return v;
	return find(v->ko[v->val<val],val);
}
void del(node*v){
	while(v){
		if(v->ko[0]){
			if(v->ko[1])rot(v,v->ko[1]->p > v->ko[0]->p);
			else rot(v,0);
		}else{
			if(v->ko[1])rot(v,1);
			else v=v->oya->ko[v->oya->ko[1]==v]=0;
		}
	}
}

void f(node*v,int mode){
	if(!v)return;
	if(!mode)printf(" %d",v->val);
	f(v->ko[0],mode);
	if(mode)printf(" %d",v->val);
	f(v->ko[1],mode);
}

node root;
int main(){
	int n;
	scanf("%d",&n);
	 
	while(n--){
		int t,p;
		char s[10];
		scanf("%s",s);
		if(s[0]=='p'){
			f(root.ko[0],1);puts("");
			f(root.ko[0],0);puts("");
		}else if(s[0]=='i'){
			scanf("%d%d",&t,&p);
			ins(root.ko[0],&root,0,t,p);
		}else if(s[0]=='f'){
			scanf("%d",&t);
			puts(find(root.ko[0],t)?"yes":"no");
		}else{
			scanf("%d",&t);
			del(find(root.ko[0],t));
		}
	}
}


Measured memory_bytes: 11180
#include<bits/stdc++.h>
using namespace std;
int gcd(long long a,long long b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		if(b>a) swap(a,b);
		long long t=gcd(a,b);
		cout<<t<<' '<<a/t*b<<endl;
	}
	return 0;
}




Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	ll N,L;
	cin >> N >> L;
	vector<ll> a(N);
	deque<ll> ans;
	for (int i = 0; i < N; i++)cin >> a[i];

	ll core;
	for (int i = 0; i < N - 1; i++) {
		if (a[i] + a[i + 1] >= L) {
			ans.push_front(i + 1);
			core = i + 1;
			break;
		}
		if (i == N - 2) {
			cout << "Impossible" << endl;
			return 0;
		}
	}

	for (int i = core - 1; i > 0; i--) {
		ans.push_front(i);
	}
	for (int i = core + 1; i < N; i++) {
		ans.push_front(i);
	}

	cout << "Possible" << endl;
	for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

struct ls{
    int y;
    string n;
};

int main()
{
    int N, Q, y;
    string n;
    vector<ls> v;
    string ans = "kogakubu10gokan";
    cin >> N >> Q;
    for (int i = 0; i < N; i++) {
        cin >> y >> n;
        v.push_back(ls({y, n}));
    }
    for (int i = 0; i < v.size(); i++) {
        if (Q >= v[i].y) {
            ans = v[i].n;
        }
        else{
            break;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1216
#include <iostream>


using namespace std;


int main()
{
   int i,h,m,s;
   cin >> i;
   h = i / 3600;
   m = i /60 - h * 60;
   s=i - h*3600 -m*60;
   cout << h << ":"<< m << ":" << s << endl; 
   
   return 0;
}


Measured memory_bytes: 3132
package main

import (
        "fmt"
)

var ans int

func solution(n, m, q int, matrix [][]int) int {
        ans = 0
        dfs(n, m, q, matrix, []int{1, 1})
        return ans
}

func dfs(n, m, q int, matrix [][]int, A []int) {
        if len(A) == n+1 {
                now := 0
                for i := 0; i < q; i++ {
                        if A[matrix[i][1]]-A[matrix[i][0]] == matrix[i][2] {
                                now += matrix[i][3]
                        }
                }
                ans = max(ans, now)
                return
        }
        A = append(A, A[len(A)-1])
        for A[len(A)-1] <= m {
                dfs(n, m, q, matrix, A)
                A[len(A)-1]++
        }
}

func max(x, y int) int {
        if x > y {
                return x
        }
        return y
}

func main() {
        var n, m, q int
        fmt.Scan(&n, &m, &q)
        matrix := make([][]int, q)
        for i := range matrix {
                var a, b, c, d int
                fmt.Scan(&a, &b, &c, &d)
                matrix[i] = []int{a, b, c, d}
        }
        fmt.Println(solution(n, m, q, matrix))
}

Measured memory_bytes: 2496
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 2000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
	int n;
	cin >> n;
	map<int, int> wow;
	int ans = 0;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		if (wow[tmp] == 0) ans++;
		wow[tmp] = 1;
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
const int N = 305, mod = (int)1e9 + 7;

int n, m;
ll dp[N][N][N];

void add(ll &to, ll val) {
    to += val % mod;
    if(to >= mod) to -= mod;
}

int main() {
    cin >> n >> m;
    dp[0][1][1] = 1;
    ll res = 0;
    for(int i = 1; i <= m; i++) {
        for(int j = 1; j <= n; j++) {
            ll sum = 0;
            for(int k = 1; k < j; k++) {
                add(dp[i][j][k], dp[i-1][j][k] * (j - k) % mod);
                add(dp[i][j][k], dp[i-1][j-1][k] * (n - j + 1) % mod);
                add(sum, dp[i-1][j][k] * k % mod);
            }
            add(dp[i][j][j], sum + dp[i-1][j][j] * j % mod);
        }
    }
    cout << dp[m][n][n] << endl;

}

Measured memory_bytes: 218624
#include<stdio.h>
int main() {
    long n,k;
    long a[200000];
    scanf("%ld %ld",&n,&k);
    for (int i=0;i<n;i++) {
        scanf("%ld",&a[i]);
    }
    for (int i=k;i<n;i++) {
        if (a[i]>a[i-k]) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int n;
vector<VI> a;
VL memo;
ll solve(int bit) {
    if (bit == (1 << n) - 1)return 1LL;
    if (memo[bit] != -1)return memo[bit];

    int k = 0;
    FOR(i, 0, n)if(bit & (1 << i))++k;

    ll ret = 0;
    FOR(i, 0, n) {
        if (bit & (1 << i))continue;
        if (a[k][i] == 0)continue;
        (ret += solve(bit | (1 << i))) %= mod;
    }

    return memo[bit] = ret;
}

int main() {
    init();

    cin >> n;
    a.resize(n, VI(n)); cin >> a;
    memo.resize(1 << n, -1);
    cout << solve(0) << "\n";
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
 
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define FOR(i, to) for (int i = 0; i < (to); ++i)
 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
#define MOD 1000000007
#define INF 1000000000LL * 100000000LL
#define Nmax 202020
int N;
string s,sx;
string ret[222];
string ask(int k) {
  cout << "? ";
  for(int i=k;i<k+N;++i) {
    cout << i << " ";
  }
  cout << endl;
  string s;
  cin >> s;
  return s;
}

string ask(vi v, int x) {
  v.pb(x);
  cout << "? ";
  for(auto i : v) {
    cout << i << " ";
  }
  cout << endl;
  string s;
  cin >> s;
  return s;
}

int main() {
  cin.sync_with_stdio(false);
  cin >> N;
  s = ask(1);
  if(s == "Red") sx = "Blue";
  else sx = "Red";
  int st = 2;
  int dr = 2 * N - N + 1;
  int ok;
  while(st <= dr) {
    int mij = (st + dr) / 2;
    string a = ask(mij);
    if(a == sx) {
      ok = mij;
      dr = mij - 1;
    } else {
      st = mij + 1;
    }
  }
  ret[ok-1] = s;
  ret[ok+N-1] = sx;
  vi v;
  for(int i=ok;i<ok + N - 1; ++i) {
    v.pb(i);
  }
  for(int i=1;i<=2*N;++i) {
    if(sz(ret[i])) continue;
    if(i >= ok && i < ok + N - 1) continue;
    ret[i] = ask(v, i);
  }
  map<int,int> h;
  v.clear();
  int R = (N-1)/2;
  int B = (N-1)/2;
  for(int i=1;i<=2*N;++i) {
    if(R && ret[i] == "Red") {
      --R;
      v.pb(i);
      h[i]++;
    } else if(B && ret[i] == "Blue") {
      --B;
      v.pb(i);
      h[i]++;
    }
  }
  for(int i=1;i<=2*N;++i) {
    if(sz(ret[i])) continue;
    if(h[i]) continue;
    ret[i] = ask(v, i);
  }
  cout << "! ";
  for(int i=1;i<=2*N;++i) {
    cout << ret[i][0];
  }
  cout << endl;
  
}
 


Measured memory_bytes: 724
import sys
inputs = input().rstrip()
lst = list(inputs)
flg = True

for i in range(len(lst)):
    if ((i+1) % 2) == 1:
        if (lst[i] == "L"):
            flg = False
            break
    else:
        if (lst[i] == "R"):
            flg = False
            break

if (flg):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  int a,b;
  cin>>a>>b;
  bool f=false;
  if(a%3==0||b%3==0||(a+b)%3==0)f=true;
  cout<<(f?"Possible":"Impossible")<<endl;
  return 0;
}


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


int point2[1000000];

int search(int a[], int n, int key) {
	int left = 0;
	int right = n;
	int mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (a[mid] == key) return a[mid];
		else if (a[mid] < key) left = mid + 1;
		else right = mid;
	}
	return a[left-1];
}

int main() {
	while (true) {
		int n, m;
		cin >> n >> m;
		if (n == 0 && m == 0) return 0;
		int point[n+1];
		for (int i = 0; i < n; i++) cin >> point[i];
		point[n] = 0;
		int k = 0;
		for (int i = 0; i < n + 1; i++) {
			for (int j = i; j < n + 1; j++) {
				point2[k] = point[i] + point[j];
				k++;	
			}
		}
		int np = k;
		sort(point2, point2 + np);

		int ans = 0;
		for (int i = 0; i < np; i++) {
			if (point2[i] > m) break;
			int s = search(point2, np, m - point2[i]);
			int t = s + point2[i];
			if (t > ans) ans = t;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 4916
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ld long double
#define pi pair<int,int>
#define pd pair<ld,ld>
#define ft first
#define sd second
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define FOR(i,a,b) for(int i=(a); i<=(b);i++)
#define F(i,a,b) FOR(i,(a),(b)-1)
#define REV(i,a,b) for(int i=(a); i>=(b);i--)
#define VI vector<int>
#define VPI vector<pi>
#define VPD vector<pd>
#define PI 3.14159265
#define all(x) (x).begin(), (x).end()
#define sz(a) (int)((a).size())
#define int long long

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
mt19937 r(chrono::steady_clock::now().time_since_epoch().count());
int rand_range(int a, int b)
{
    assert(a<=b);
    return a+r()%(b-a+1);
}
const long long K = 1000;
const long long KK = K*K;
const long long MIL = KK*K;
const long long INF = MIL*MIL;
const long long MOD = MIL+7;
const long long N = 1e6 + 10, M=10;

void solve(){
    int r;
    cin >> r;
    cout << r * r << "\n";
}

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

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    cout<<setprecision(9)<<fixed;
    cerr<<setprecision(6)<<fixed;
    int test = 1, f;
    //cin>>test;
    F(_test, 0, test){
        //cout<<"Case #"<<_test + 1<<": ";
        solve();
//		if(_test == 1)
//            return 0;
    }
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args)throws IOException{
        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader reader =new BufferedReader(isr);
    	
        /*???????????¬??°w???????????????*/
        String buf = reader.readLine();
        int w = Integer.parseInt(buf);
        
        /*?¨??£??????¬??°n???????????????*/
        buf = reader.readLine();
        int n = Integer.parseInt(buf);
        
        int i;
        int[] num = new int[w];
        
        for (i = 0;i < w;i++) {
            num[i] = i + 1;
        }
        
        for (i = 0;i < n;i++) {
            /*i??????????¨??£????????????????*/
            buf = reader.readLine();
            StringTokenizer st = new StringTokenizer(buf,",");
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int x = num[a - 1];
            num[a - 1] = num[b - 1];
            num[b - 1] = x;
        }
        
        for (i = 0;i < w;i++) System.out.println(num[i]);
    }
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	b--;
	d--;

	int ans = 0;
	for(int i = 0; i <= 300; i++)
		if(a <= i && i <= b && c <= i && i <= d)
			ans++;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256