akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll cl[1000000][2];
int main(void){
	ll i,len,lv,cnt,p,pp,x;
	char s[1000001];
	cin>>s;
	len=strlen(s);
	for(i=0;i<len;i++) cl[i][1]=0;
	cnt=1; p=0; pp=0;
	if(s[0]=='J') cl[0][0]=0;
	else if(s[0]=='O') cl[0][0]=1;
	else cl[0][0]=2;
	for(i=0;i<len;i++){
		if(s[pp]!=s[i]){
			p++; pp=i;
			if(s[pp]=='J') cl[p][0]=0;
			else if(s[pp]=='O') cl[p][0]=1;
			else cl[p][0]=2;
		}
		cl[p][1]++;
	}
/*	for(i=0;i<=p;i++) cout<<cl[i][1]<<' ';
	cout<<endl;*/
	lv=0;
	for(i=1;i<len-1;i++){
		if(cl[i][0]==1){
			x=cl[i][1];
			if(cl[i-1][0]==0&&cl[i+1][0]==2){
				if(cl[i-1][1]>=x&&cl[i+1][1]>=x) lv=max(lv,x);
			}
		}
	}
	cout<<lv<<endl;
	return 0;
}


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


int main(){

    long int a, b, c, d;
    vector<int> p;
    cin >> a >> b >> c >> d;

    long int result = a*c;

    if(result < a*d) {
        result = a*d;
    }

    if(result < b*c) {
        result = b*c;
    }

    if (result < b*d) {
        result = b*d;
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3604
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
    int N, M;
    string A[50], B[50];
    cin >> N >> M;
    REP(i , N) cin >> A[i];
    REP(i, M) cin >> B[i];
    if(N == M) {
        for(int i = 0; i < N; i++) {
            if(A[i] != B[i]) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    } else {
        for(int i = 0; i < N - M; i++) {
            for(int j = 0; j < N - M; j++) {
                bool is_inc = true;
                if(A[i][j] == B[0][0]) {
                    for(int k = 0; k < M; k++) {
                        for(int l = 0; l < M; l++) {
                            if(A[i + k][j + l] != B[k][l]){
                                is_inc = false;
                                break;
                            }
                        }
                        if(!is_inc) break;
                    }
                    if(is_inc) {
                        cout << "Yes" << endl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
Var
Gray,Brown,Green,Cyan,Blue,Yellow,Orange,Red:boolean;
n,d,total,i:longint;
a:array[0..105] of longint;
Begin
gray:=false; brown:=false; green:=false; cyan:=false; blue:=false; yellow:=false; orange:=false; red:=false; d:=0; total:=0;
Readln(n);
For i:=1 to n do
Begin
Read(a[i]);
If (a[i]>=1) and (a[i]<=399) then 
if not gray then begin gray:=true; inc(total); end;
If (a[i]>=400) and (a[i]<=799) then
if not brown then begin brown:=true; inc(total); end;
If (a[i]>=800) and (a[i]<=1199) then 
if not green then begin green:=true; inc(total); end;
If (a[i]>=1200) and (a[i]<=1599) then 
if not cyan then begin cyan:=true; inc(total); end;
If (a[i]>=1600) and (a[i]<=1999) then 
if not blue then begin blue:=true; inc(total); end;
If (a[i]>=2000) and (a[i]<=2399) then 
if not yellow then begin yellow:=true; inc(total); end;
If (a[i]>=2400) and (a[i]<=2799) then 
if not orange then begin orange:=true; inc(total); end;
If (a[i]>=2800) and (a[i]<=3199) then 
if not red then begin red:=true; inc(total); end;
If a[i]>=3200 then inc(d);
End;
if total=0 then write('1',' ')
else Write(total,' ');
Total:=Total+d;
Write(total);
End.

Measured memory_bytes: 128
#include <algorithm>　　　 //STL 通用算法
#include <bitset>　　　　　//STL 位集容器
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>　　　　 //复数类
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>　　　　　 //STL 双端队列容器
#include <exception>　　　 //异常处理类
#include <fstream>
#include <functional>　　　//STL 定义运算函数（代替运算符）
#include <limits>
#include <list>　　　　　　//STL 线性列表容器
#include <map>　　　　　　 //STL 映射容器
#include <iomanip>
#include <ios>　　　　　　 //基本输入／输出支持
#include <iosfwd>　　　　　//输入／输出系统使用的前置声明
#include <iostream>
#include <istream>　　　　 //基本输入流
#include <ostream>　　　　 //基本输出流
#include <queue>　　　　　 //STL 队列容器
#include <set>　　　　　　 //STL 集合容器
#include <sstream>　　　　 //基于字符串的流
#include <stack>　　　　　 //STL 堆栈容器　　　　
#include <stdexcept>　　　 //标准异常类
#include <streambuf>　　　 //底层输入／输出支持
#include <string>　　　　　//字符串类
#include <utility>　　　　 
#include <vector>　　　　　
#include <cwchar>
#include <cwctype>
using namespace std;
const int maxn=1e5+3;
int cnt=0, id=0, Next[maxn],in[maxn],out[maxn];
int fa[maxn][20], len[maxn];  
struct node  
{  
    int v, next;  
}edge[maxn<<1]; 
void add_edge(int u, int v)  
{  
    edge[cnt] = {v, Next[u]};  
    Next[u] = cnt++;  
    edge[cnt] = {u, Next[v]};  
    Next[v] = cnt++;  
}  
   
void dfs(int cur, int pre, int d)  
{  
    fa[cur][0] = pre;  
    len[cur] = d;  
    for(int i=1; i<20; ++i)  
        fa[cur][i] = fa[fa[cur][i-1]][i-1];  
    in[cur] = ++id;  
    for(int i=Next[cur]; i!=-1; i=edge[i].next)  
    {  
        int v = edge[i].v;  
        if(v == pre) continue;  
        dfs(v, cur, d+1);  
    }  
    out[cur] = id;  
}  
int main()  
{  
    int n, a, b;  
    scanf("%d",&n);  
    memset(Next, -1, sizeof(Next));  
    for(int i=1; i<n; ++i)  
    {  
        scanf("%d%d",&a,&b);  
        add_edge(a, b);  
    }  
    dfs(1, 0, 0);  
    int tmp=(len[n]-1)/2, now=n;  
    for(int i=0; i<20; ++i)  
        if(tmp>>i&1) now = fa[now][i];  
    int bl = n-(out[now]-in[now]+1)-len[n]/2-1;  
    int wh = out[now]-in[now]+1-tmp-1;  
    if(len[n]&1)  
    {  
        if(bl <= wh) puts("Snuke");  
        else puts("Fennec");  
    }  
    else  
    {  
        if(wh <= bl) puts("Fennec");  
        else puts("Snuke");  
    }  
return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <stdio.h>
using namespace std;
#define LL long long
const LL maxn = (1<<18)+22;
 
int a[maxn];
 
struct node
{
	int a,b;
}Max[maxn];
 
void f(int x,node &b)
{
	if(b.a==x||b.b==x) return;
	if(a[b.a]<a[x]) swap(b.a,b.b),b.a=x;
	else if(a[b.b]<a[x]) b.b=x;
}
 
 
int main()
{
	int n;
	scanf("%d",&n);
	int N=1<<n;
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
		Max[i].a=i;
		Max[i].b=N;
	}
	for(int i=1;i<N;i++){
		for(int j=0;j<n;j++){
			if(i&(1<<j)){
				int k=i^(1<<j);
				f(Max[k].a,Max[i]);
				f(Max[k].b,Max[i]);
			}
		}
	}
	int ans=0;
	for(int i=1;i<N;i++){
		ans=max(ans,a[Max[i].a]+a[Max[i].b]);
		printf("%d\n",ans);
	}
 
 
	return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

struct Node{
  int key;
  Node *next, *prev;
};

Node *nil;

Node* listSearch(int key){
  Node *cur = nil->next;
  while (cur != nil && cur->key != key){
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  Node *cur = nil->next;
  int isf = 0;
  while(1){
    if(cur == nil) break;
    if(isf++ > 0) printf(" ");
    printf("%d",cur->key );
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t){
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deleteKey(int key){
  deleteNode(listSearch(key));
}

void insert(int key){
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for(i = 0; i< n; i++){
    scanf("%s%d", com, &key);
    if(com[0] == 'i') {insert(key); np++; size++;}
    else if (com[0] == 'd'){
      if(strlen(com) > 6){
        if(com[6] == 'F') deleteFirst();
        else if (com[6] == 'L') deleteLast();
      }else{
        deleteKey(key); nd++;
      }
      size--;
    }
  }
  printList();
  return 0;
}



Measured memory_bytes: 34364
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] x = new int[n];
        long count = 1000000000000000000l;
        for (int i=0;i<n;i++){
            x[i] = scanner.nextInt();
        }
        for (int i=0;i<100;i++){
            int instance = 0;
            for (int j=0;j<n;j++){
                instance += (x[j]-i)*(x[j]-i);
            }
            if (count>instance){
                count = instance;
            }
        }
        System.out.println(count);

    }

}

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

int main() {
    using namespace std;
    int n, d;
    cin >> n >> d;

    vector<vector<int>> xs(n, vector<int>(d));

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

    int cnt = 0;
    for(int i = 0; i < n; i++) {
        for(int j = i + 1; j < n; j++) {
            int sum = 0;
            for(int k = 0; k < d; k++) {
                auto diff = xs[i][k]-xs[j][k];
                sum += diff*diff;
            }
            double dist = sqrt(sum);
            if (dist == floor(dist)) cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

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

const int maxn = 2000009;
void solve(){
    
   int a,b;
   cin >> a >> b;

   int x = (a)*(a-1)/2;
   int y = (b)*(b-1)/2;

   cout << x+y << endl;
    

} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        
        solve();
        //cout << endl;
    }
    return 0;
} 

 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double l = sc.nextDouble();
        sc.close();
        double ans = 0;
        ans = (l*l*l)/27;
        System.out.println(String.format("%.12f",ans));
    }
}

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

typedef long long int Long;
typedef long double Double;
const int MAXN = 3501;

Long n;
int test(Long a, Long b, Long c) {
	// printf("%lld %lld\n",4*a*b*c,  n*(a*c + b*c + a*b));
	return 4LL*a*b*c == n*(a*c + b*c + a*b);
}

int main() {
	scanf("%lld", &n);
	for(int i = 1; i < MAXN; ++i)
		for(int j = 1; j < MAXN; ++j) {
			Long denom = i*4LL*j - n*i - n*j, nom = n*i*j;
			if(denom && nom % denom == 0) {
				if( test(i, j, nom / denom) && nom / denom >= 0 ) {
					return 0 * printf("%d %d %lld\n", i, j, nom / denom);
				}
			}
		}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string s;
    cin>>s;
    ll n=s.size();
    rep(i,n){
        if(i%2==0){
            if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
                continue;
            } else{
                cout<<"No"<<endl;
                return 0;
            }
        } else{
            if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
                continue;
            } else{
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

h,w = li()
field = [["." for _ in range(w+2)]]
for _ in range(h):
    field.append(["."] + lc() + ["."])
field.append(["." for _ in range(w+2)])

dxs = [0, 1, 1, 1, 0, -1, -1, -1]
dys = [-1, -1, 0, 1, 1, 1, 0, -1]

for hi in range(1,h+1):
    for wj in range(1,w+1):
        if field[hi][wj] == "#":
            continue
        ans = 0
        for dy,dx in zip(dys,dxs):
            if field[hi+dy][wj+dx] == "#":
                ans += 1
        
        field[hi][wj] = str(ans)
        
for hi in range(1,h+1):
    print("".join(field[hi][1:-1]))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  x -= 1;
  y -= 1;
  vector<int> ans(n - 1);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int dist = min(j - i, abs(i - x) + abs(j - y) + 1);
      dist -= 1;
      ans[dist]++;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

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

if N == 1:
    print(1)
    exit()

if A[0] > A[1]:
    status = 'dec'

elif A[1] > A[0]:
    status = 'inc'

else:
    status = 'equal'


cnt = 0

for i in range(2,N):
    if status == 'dec' and A[i] > A[i-1]:
        cnt += 1
        status = 'none'
    
    elif status == 'inc' and A[i] < A[i-1]:
        cnt += 1
        status = 'none'
    
    elif status == 'equal' and A[i] > A[i-1]:
        status = 'inc'
    
    elif status == 'equal' and A[i] < A[i-1]:
        status = 'dec'
    
    elif status == 'none' and A[i] < A[i-1]:
        status = 'dec'
    
    elif status == 'none' and A[i] > A[i-1]:
        status = 'inc'
    
    elif status == 'none' and A[i] == A[i-1]:
        status = 'equal'

print(cnt+1)
    
    

Measured memory_bytes: 14480
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 50;

long long X[N],Y[N],X2[N],Y2[N];

int main() {
	int n,k2;cin>>n>>k2;
	rep(i,n) {cin>>X[i]>>Y[i];X2[i]=X[i];Y2[i]=Y[i];}
	long long ans=INFL;
	sort(X,X+n);sort(Y,Y+n);
	for(int i=0;i<n-1;i++) {
		for(int j=i+1;j<n;j++) {
			for(int k=0;k<n-1;k++) {
				for(int l=k+1;l<n;l++) {
					int c=0;
					rep(m,n) if(X2[m]>=X[i]&&X2[m]<=X[j]&&Y2[m]>=Y[k]&&Y2[m]<=Y[l]) c++;
					if(c>=k2) ans=min(ans,(X[j]-X[i])*(Y[l]-Y[k]));
				}
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nab = readln.split.to!(int[]);
    auto N = nab[0];
    auto A = nab[1];
    auto B = nab[2];

    auto max_c = min(A, B);
    auto t = A + B - N;
    auto min_c = t < 0 ? 0 : t;
    writefln("%d %d", max_c, min_c);
}

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

int main(){
	int n, a, m;
	while( cin >> n , n ){
		map<int,int> p;
		m = 0;
		
		for(int i=0 ; i<n; i++ ){
			cin >> a;
			m = max( m , a );
			p[a] = 1;
		}
		bool flag = false;
		bool flag2 = false;
		for(int i=1 ; i<=m+1 ; i++ ){
			if( flag == false ){
				if( p.count( i ) ){
					cout << i ;
					flag = true;
					flag2 = true;
				}else{}
			}else{
				if( p.count( i ) ){
					if( flag2 ){
						cout << "-";
						flag2 = false;
					}
				}else{
					flag = false;
					if( !flag2 )
						cout << (i-1);
					flag2 = false;
					if( i < m ){
						cout << " ";
					}
				}
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int ub(vi& a, ll h, int x) {
    int aa = -1, b, c = a.size();
    while(c-aa != 1) {
        b = (aa+c)>>1;
        if(a[b]*ll(x) <= h) {
            aa = b;
        } else {
            c = b;
        }
    }
    return c;
}
int mb(vi &a, ll h, int x) {
    int aa = -1, b, c = a.size();
    while(c-aa != 1) {
        b = (aa+c)>>1;
        if(a[b]*ll(x) > h) {
            aa = b;
        } else {
            c = b;
        }
    }
    return aa;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    auto hm = [&](ll h) {
        ll cnt = 0;
        rep(i, n) {
            if(a[i] > 0) {
                int num = ub(a, h, a[i]);
                if(num > i) {
                    num--;
                }
                cnt += num;
            } else if(a[i] < 0) {
                int num = mb(a, h, a[i]);
                if(num < i) {
                    num++;
                }
                cnt += n-1-num;
            } else {
                if(h >= 0) cnt += n-1;
            }
        }
        assert(~cnt&1);
        cnt >>= 1;
        return cnt;
    };

    ll aa = INT64_MIN/2+1, b, c = INT64_MAX/2-1;
    while(c-aa > 1) {
        b = (c+aa)>>1;
        if(hm(b) >= k) {
            c = b;
        } else {
            aa = b;
        }
    }

    cout << c << endl;
}

Measured memory_bytes: 3940
W = int(input())
N = int(input())

C = [[-1 for j in range(W)] for i in range(N)]

for i in range(N):
    a, b = map(lambda x:int(x) - 1, input().split(','))
    C[i][a] = b
    C[i][b] = a

A = [-1] * W
for n in range(W):
    j = n
    for i in range(N):
        if C[i][j] >= 0:
            j = C[i][j]
    A[j] = n + 1

for v in A:
    print(v)


Measured memory_bytes: 5596
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char str1[1001],str2[1001];
int c[1001][1001];

void LCSLength(int m,int n){
  int i,j;
  for(i=1;i<=m;i++)c[i][0] = 0;
  for(j=0;j<=n;j++)c[0][j] = 0;
  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(str1[i-1] == str2[j-1])
	c[i][j] = c[i-1][j-1] + 1;
      else if(c[i-1][j] >= c[i][j-1])
	c[i][j] = c[i-1][j];
      else
	c[i][j] = c[i][j-1];
    }
  }
  printf("%d\n",c[m][n]);
}

int main(){
  int q,i,lcs[150],m,n;
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%s",str1);
    scanf("%s",str2);
    //printf("unko1\n");
    m = (int)strlen(str1);
    //printf("unko2\n");
    n = (int)strlen(str2);
    //printf("unko3\n");
    LCSLength(m,n);
  }

  return 0;
}



Measured memory_bytes: 5772
from sys import stdin
H, N = [int(_) for _ in stdin.readline().rstrip().split()]
A = []
B = []

def chmin(a, b):
    if a > b:
        return b
    return a

for i in range(N):
    a, b = [int(_) for _ in stdin.readline().rstrip().split()]
    A.append(a)
    B.append(b)
dp = [float('inf')] * (H + 1)
dp[0] = 0
for i in range(N):
    for j in range(H+1):
        dp[min(j+A[i], H)] = chmin(dp[min(j+A[i], H)], dp[j]+B[i])
print(dp[H])

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

int n;
int mat[110][110];
int sum[110][110];

int main(){

  //input
  cin >> n;
  for(int j = 0; j < n; j++){
    for(int i = 0; i < n; i++){
      cin >> mat[j][i];
    }
  }

  //sum
  for(int j = 0; j < n; j++){
    for(int i = 0; i < n; i++){
      if(i == 0) sum[j][i] = mat[j][i];
      sum[j][i] = sum[j][i-1] + mat[j][i];
    }
  }
  for(int j = 1; j < n; j++){
    for(int i = 0; i < n; i++){
      sum[j][i] += sum[j-1][i];
    }
  }
 
  //max
  int max = mat[0][0];
  for(int i = 0; i < n; i++){
    for(int j = i; j < n; j++){
      for(int k = 0; k < n; k++){
	for(int l = k; l < n; l++){
	  if(i == 0){
	    if(max < sum[j][l] - sum[j][k-1] )
	      max = sum[j][l] - sum[j][k-1];
	  }else if( k == 0 ){
	    if(max < sum[j][l] - sum[i-1][l])
	      max = sum[j][l] - sum[i-1][l];
	  }else{
	    if(max < sum[j][l] - sum[j][k-1] - sum[i-1][l] + sum[i-1][k-1]){
	      max = sum[j][l] - sum[j][k-1] - sum[i-1][l] + sum[i-1][k-1];
	    }
	  }
	}
      }
    }
  }
  cout << max << endl;

  return 0;
}

Measured memory_bytes: 1252
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    priority_queue<ll> que;
    ll ans = 0;
    rep(i, 0, n)
    {
        ll tmp;
        cin >> tmp;
        que.push(tmp);
    }
    rep(i, 0, m)
    {
        ll tmp = que.top();
        que.pop();
        que.push(tmp / 2);
    }
    rep(i, 0, n)
    {
        ll tmp = que.top();
        que.pop();
        ans += tmp;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4284
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int a,b;
    cin>>a>>b;
    if (a%2==0 || b%2==0)
        cout<<"No\n";
    else
        cout<<"Yes\n";
}

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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i=0 ; i<N ; i++)
    cin >> V.at(i);
  int answer=0;
  for (int i=0 ; i<N ;i++){
    for (int j=0 ; j<N ;j++){
    if (i>=j)
    continue;
    answer+=V.at(i)*V.at(j);
  }
  }
 cout << answer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  int amari;
  cin >> a >> b;
  amari = a%500;
  if(amari==0) cout << "Yes"<<endl;
  else if(amari<=b) cout << "Yes"<<endl;
  else cout << "No"<<endl;
}

Measured memory_bytes: 256
// AOJ Volume 0 Problem 0031

#include <stdio.h>

int main(void)
{
	int weight;
	int i;
	int w;
	int flag;
	
    while (scanf("%d", &weight) != EOF){
		w = 1;
		flag = 0;
		for (i = 0; i <= 9; i++){
			if ((weight & (1 << i)) != 0){
				if (flag != 0){
					printf(" ");
				}
				else {
					flag = 1;
				}
				printf("%d", w);
			}
			w *= 2;
		}
		printf("\n");
    }
	
    return (0);
}

Measured memory_bytes: 0
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M=list(map(int,input().split()))
Network = UnionFind(N)
for i in range(M):
    a,b=list(map(int,input().split()))
    Network.union(a-1, b-1)
print(Network.group_count()-1)

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

int main() {
  double A,B,C,D;
  cin >> A >> B >> C >> D;
  for(int i=0; i<1000; i++){
    C-=B;
    if(C<=0){
      cout << "Yes" << endl;
      return 0;
    }
    
    A-=D;
    if(A<=0){
      cout << "No" << endl;
      return 0;
    }
  }
  
    
  
}

//cout << fixed << setprecision(10) << (long double)2*sum/(long double)N << endl;


Measured memory_bytes: 3716
A = int(input())
B = int(input())
C = int(input())
X = int(input())

def main():
    a = [500 * k for k in range(A + 1)] # e.g. if A = 1, returns [0, 500]
    b = [100 * j for j in range(B + 1)]
    c = [ 50 * i for i in range(C + 1)]
    results = [am + bm + cm for am in a
                            for bm in b
                            for cm in c]
    result = results.count(X)
    print(result)

if __name__ == "__main__":
    main()

Measured memory_bytes: 8344
#include <iostream>
using namespace std; //头文件和命名空间
inline bool IsAddable(int iNum, int iLBound, int iUBound){ //判断是否满足要求的函数，iNum-判断的数字；iLBound-各位和下界；iUBound-各位和的上界
    int iSum = 0; //各位和
    while (iNum){ //求各位和
        iSum += iNum % 10; //加上最后一位
        iNum /= 10; //消去最后一位
    }
    return (iLBound <= iSum && iSum <= iUBound); //判断
}
int main(){
    ios::sync_with_stdio(false); //输入输出加速
    int iEnd, iLB, iUB; //区间结尾以及各位数字之和的上下界
    cin >> iEnd >> iLB >> iUB; //读入限制条件
    register int i; //循环变量
    register long long iSum = 0; //累加器
    for (i = 1; i <= iEnd; ++i){ //枚举
        if (IsAddable(i, iLB, iUB)) //判断是否相加
            iSum += i; //若满足则累加
    }
    cout << iSum << endl; //输出和，勿忘换行
    return 0; //结束
}

Measured memory_bytes: 256
// D.

#include <sstream>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

using namespace std;

typedef long long LL;

LL solve(LL n, LL k, vector<LL> a) {
	LL dp[64][2] = {};
	for (LL i = 0, b = 1; i < 60; ++i, b <<= 1) {
		LL sum[2] = {};
		for (LL c : a) {
			sum[0] += c & b;
			sum[1] += b ^ (c & b);
		}
		dp[i + 1][0] = dp[i][0] + sum[0];
		if (k & b) {
			dp[i + 1][0] = max({ dp[i + 1][0], dp[i][0] + sum[1], dp[i][1] + sum[0] });
		}
		dp[i + 1][1] = dp[i][1] + max(sum[0], sum[1]);
	}
	return dp[60][0];
}

int main(int argc, char *argv[]) {
	LL n, k;
	cin >> n >> k;
	vector<LL> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	LL ans = solve(n, k, a);
	cout << ans << endl;
	return 0;
}


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

using namespace std;

using int64 = long long;

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  if (n >= 3200) cout << s << endl;
  else cout << "red" << endl;
}

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

int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector L(N, 0);
  for (int &l : L) cin >> l;

  int ans = INT_MAX;
  int M = pow(4, N);
  for (int bit = 0; bit < M; bit++) {
    int a = 0, b = 0, c = 0, d = 0;
    for (int i = 0, dig = 1; i < N; i++, dig *= 4) {
      int tmp = bit / dig % 4;
      if (tmp == 1) a += L.at(i);
      if (tmp == 2) b += L.at(i);
      if (tmp == 3) c += L.at(i);
      if (!tmp) d++;
    }
    if (!a || !b || !c) continue;
    int cost = abs(A - a) + abs(B - b) + abs(C - c) + (N - d - 3) * 10;
    ans = min(ans, cost);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 4056
/*
Task:
Author: John_05
State: Unknown
Lang: C++
Solution:
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int INF=2e9+10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair

int read() {
	int xx=0,ww=1;
	char ch=getchar();
	while(ch>'9'||ch<'0') {
		if(ch=='-') ww=-ww;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		xx=10*xx+ch-48;
		ch=getchar();
	}
	return xx*ww;
}

int main() {
	int a,b,k;
	a=read();
	b=read();
	k=read();
	int c=__gcd(a,b),cnt=0;
	for(int i=1; i<=c; i++) {
		if(c%i==0) {
			cnt++;
			if(cnt==k) {
				printf("%d\n",c/i);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

const int CASES = 2;

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

void solve() {
    ll N, A, B; cin >> N >> A >> B;
    mint a = 2;
    mint ans = modpow(a, N) - 1;
    mint tmp = 1;
    for (int i = 0; i < A; ++i){
        tmp *= (N-i);
        tmp /= (i+1);
    }
    mint tmp2 = 1;
    for (int i = 0; i < B; ++i){
        tmp2 *= (N-i);
        tmp2 /= (i+1);
    }
    ans -= tmp + tmp2;
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int X;
bool memo[100001] ={};
bool visited[100001] ={};
bool solve(int n){
	if(n == 0) return true;
	if(n < 0) return false;
	if(visited[n]) return memo[n];
	visited[n] = true;
	for(int i=100; i<=105; i++) memo[n] |= solve(n-i);
	return memo[n];
}
signed main(){
	cin >> X;
	cout << solve(X) << endl;
}

Measured memory_bytes: 512
import sys

input = sys.stdin.readline
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())
roads = [a1, b1, a2, b2, a3, b3]
roads.sort()
check = [1, 2, 2, 3, 3, 4]
flag = 0
for i in range(6):
    if roads[i] != check[i]:
        flag = 1
        break
if flag == 0:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3064
import sys
input=sys.stdin.readline
n,m,p=[int(j) for j in input().split()]

def bellman_ford(v, s, e):
    INF = 10**18
    # コストをINFで初期化
    d = [INF] * v
    # 開始頂点は0
    d[s] = 0
    # 負の閉路が無ければ更新はV-1回までで終わる
    for _ in range(v):
        f = False
        for a, b, c in e:
            # aまでのコスト+辺abのコストがbまでのコストより小さければ更新
            cost = d[a] + c
            if cost < d[b]:
                d[b] = cost
                f = True
        # 更新が無ければbreak
        if not f:
            break
    else:
        # V回目まで更新があったら負の閉路がある
        print(-1)
        exit()
    print(max(-d[-1],0))

def dfs(edge,s):
    use={s}
    q=[s]
    while q:
        v=q.pop()
        for w in edge[v]:
            if w in use:continue
            use.add(w)
            q.append(w)
    return use


l=[[] for i in range(n)]
ll=[[] for i in range(n)]
e=[]
for i in range(m):
    a,b,c=[int(j) for j in input().split()]
    l[a-1].append(b-1)
    ll[b-1].append(a-1)
    e.append((a-1,b-1,p-c))
use=dfs(l,0)&dfs(ll,n-1)
e=[(a,b,c) for a,b,c in e if (a in use and b in use)]


bellman_ford(n, 0, e)


Measured memory_bytes: 5356
#include <stdio.h>
#include <math.h>

int main(void) {
	double x1, y1, x2, y2;
	double dx, dy;
	scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
	
	dx = x2 - x1; dy = y2- y1;
	printf("%f\n", sqrt(dx*dx + dy*dy));
	return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl;
#define all(x) (x).begin(),(x).end()

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

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    rep1(i, k)r = r * n-- / i;
    return r;
}

int main()
{
    int a,h;
    cin >> h >> a;
    cout << (h + a - 1) / a;
    return 0;
}


Measured memory_bytes: 764
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; ll k;
    cin>>n>>k;
    int a[200020];
    for(int i=0; i<n; i++){
        cin>>a[i]; a[i]--;
    }
    bool used[200020]={};
    vector<int> v;
    int x=0;
    int p;
    while(1){
        if(used[x]){
            for(int i=0; i<v.size(); i++){
                if(v[i]==x){
                    p=i; break;
                }
            }
            break;
        }
        used[x]=1;
        v.push_back(x);
        x=a[x];
    }
    int l=v.size()-p;
    if(k<p){
        cout<<v[k]+1<<endl;
    }else{
        cout<<v[p+(k-p)%l]+1<<endl;
    }
	return 0;
}


Measured memory_bytes: 5224
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <set>

using namespace std;

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<pair<int, int>> trains(m);
    for (int i = 0; i < m; ++i) {
        int l, r;
        cin >> l >> r;
        trains[i] = {l, r};
    }
    vector<pair<int, int>> questions(q);
    for (int i = 0; i < q; ++i) {
        int l, r;
        cin >> l >> r;
        questions[i] = {l, r};
    }
    vector<vector<int>> graph(n + 1, vector<int>(n + 1, 0));
    for(auto e : trains)
    {
        graph[e.first][e.second]++;
    }
    vector<vector<int>> dp = graph;
    for (int i = 1; i < n + 1; ++i) {
        for (int j = 1; j < n + 1; ++j) {
            dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + graph[i][j];
        }
    }
    /*for (int i = 0; i < n + 1; ++i) {
        for (int j = 0; j < n + 1; ++j) {
            cout << graph[i][j] << " ";
        }
        cout << endl;
    }
    cout << endl;
    for (int i = 0; i < n + 1; ++i) {
        for (int j = 0; j < n + 1; ++j) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }*/
    for (int i = 0; i < q; ++i) {
        int l, r;
        l = questions[i].first;
        r = questions[i].second;
        int count = dp[r][r] - (dp[l - 1][r] + dp[r][l - 1] - dp[l - 1][l - 1]);
        cout << count << endl;
    }
    return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n, a[200005] = {}, b[200005] = {}, z = 890328;
    string s;
    cin >> n >> s;
    fr(n) {
        if (s[i] == '.') a[i] = 1;
        else b[i] = 1;
    }
    fr1(n) b[i] += b[i - 1];
    for (int i = n - 1; i >= 0; i--) a[i] += a[i + 1];
    fr1(n) {
        z = min(z, a[i] + b[i - 1]);
    }
    z = min(z, a[0]);
    cout << z;
}


Measured memory_bytes: 2256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int par[100010];

void init(int N){
    for(int i=0;i<=N;i++){
        par[i] = i;
    }
}

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

void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return ;
    par[x] = y;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M; cin >> N >> M;
    int ans = 0;
    vector<int> A(N);
    init(N);
    rep(i, M){
        int x, y, z; cin >> x >> y >> z;
        unite(x, y);
    }
    for(int i=1;i<=N;i++){
        if(par[i] == i) ans++;
    }
    cout << ans;
    cout << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <time.h>
#pragma warning(disable:4996) 

typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int n, K;
    scanf("%d%d", &n, &K);
    int K2 = (K % 2 == 0 ? K / 2 : 0);

    ll ans = (ll)(n / K) * (n / K) * (n / K);
    if (K2) {
        ll ans0 = (ll)((n + K2) / K) * ((n + K2) / K) * ((n + K2) / K);
        ans += ans0;
    }
    printf("%lld\n", ans);
    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 1712
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        return n >= 30 ? Yes : No;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        if (n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


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

int main()
{
	int n, m;

	int syu[1000 + 10] = { 0 };
	int sin;
	pair<int, int>runk[1000+10];
	int i,j;

	cin >> n>> m;

	for (i = 0; i < n; i++)
	{
		cin >> syu[i];
		runk[i].first = i;
		runk[i].second = 0;
	}
	for (i = 0; i < m; i++)
	{
		cin >> sin;
		for (j = 0; j < n; j++)
		{
			if (syu[j] <= sin)
			{
				runk[j].second++;
				break;
			}
		}
	}
	for (i = 0; i < n - 1; i++)
	{
		for (j = i + 1; j < n; j++)
		{
			if (runk[i].second < runk[j].second)
			{
				runk[1001] = runk[i];
				runk[i] = runk[j];
				runk[j] = runk[1001];
			}
		}
	}
	cout << runk[0].first + 1 << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    vector<ll> v(5);
    rep(i, 0, 5) cin >> v[i];
    ll k;
    cin >> k;
    if (v[4] - v[0] > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
}

Measured memory_bytes: 256
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))

ans = 0
for a in A:
    while a % 2 == 0:
        a //= 2
        ans += 1
print(ans)


Measured memory_bytes: 3956
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const long long INF = 1LL << 60;
typedef pair<int, int> P;
/*
int main() {
    int N;
    cin >> N;
    printf("%10lf", (N-N/2)/(double)N);


}*/
int N;
int main() {
    cin >> N;
    vector<pair<int, int> > A(N);
    for (int i = 0; i < N; i++) {
      int a;
      cin >> a;
      A[i] = make_pair(a, i + 1);
    }
    sort(A.begin(), A.end());
    for (int i = 0; i < N; i++) {
      cout << A[i].second << " ";
    }    
    cout << "\n";
}


   

Measured memory_bytes: 1536