akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(n):
        res = defaultdict(lambda : 0)
        i = 2
        m = n
        while i*i <= n:
            while m%i == 0:
                res[i] += 1
                m //= i
            i += 1
        res[m] += 1
        return res

    n,p = LI()
    f = f(p)
    ans = 1
    for i,j in f.items():
        ans *= pow(i,j//n)
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


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

const int maxn=2e5+7;
int a[maxn],s[maxn],n,k;
map<int,int> m;
long long ans;

int main()
{
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;++i) {
		scanf("%d",&a[i]);
		s[i]=(s[i-1]+a[i])%k;
	}
	for(int i=1;i<=n;++i) s[i]=((s[i]-i)%k+k)%k;
	for(int i=0;i<=n;++i) {
		if(i-k>=0) m[s[i-k]]--;
		ans+=m[s[i]];
		m[s[i]]++;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 11136
#include <cstdio>

int map[8][8];
int bs[8][3][2]={{{0,1},{1,0},{1,1}},
		 {{0,1},{0,2},{0,3}},
		 {{1,0},{2,0},{3,0}},
		 {{0,1},{-1,1},{-1,2}},
		 {{1,0},{1,1},{2,1}},
		 {{0,1},{1,1},{1,2}},
		 {{1,0},{0,1},{-1,1}}};

int f(int x,int y){
  if(x>=0 && x<8 && y>=0 && y<8)
    return map[x][y];
  else
    return 0;
}

int readtable(){
  for(int y=0; y<8; y++){
    for(int x=0; x<8; x++){
      char c=getchar();
      if(c==EOF) return 0;
      map[x][y]=c-'0';
    }
    getchar();
  }
  getchar();
  return 1;
}

int main(){
  while(readtable()){
    for(int y=0; y<8; y++){
      for(int x=0; x<8; x++){
	if(map[x][y]==1){
	  for(int i=0; i<7; i++){
	    if(f(x+bs[i][0][0],y+bs[i][0][1])&&f(x+bs[i][1][0],y+bs[i][1][1])&&f(x+bs[i][2][0],y+bs[i][2][1])){
	      printf("%c\n",'A'+i);
	      goto outer;
	    }
	  }
	}
      }
    }
  outer: ;
  }
}

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

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
int main()
{
   string s;
   cin>>s;
   if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}


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

int main(){
  string n;
  cin >> n;
  
  int count = 0;
  for(long unsigned int i = 0;i < n.size();i ++){
    char ka = n.at(i);
    int kari = ka - '0';
    count += kari;
  }
  
  if((count + 9) % 9 == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

typedef long long ll;
template<typename T>
class BIT{
  public:
    int N;
    vector<T> data;
    BIT(T _N):N(_N){
        data.assign(N+1, 0);
    };
    
    // a is 1-indexed
    void add(int a, T w){
        for(int x = a; x <= N; x += x & -x)data[x] += w;
    }
    // 1-indexed sum of prefix [0, a]
    T sum(int a){
        T res = 0;
        for(int x = a; x > 0; x -= x & -x)res += data[x];
        return res;
    }
    // 1-indexed sum of range [l, r]
    T sum(int l, int r){return sum(r) - sum(l-1);}

    // 0-indexed add
    void add0(int a, T w){add(a + 1, w);}
    // 0-indexed sum
    T sum0(int a){return sum(a + 1);}
    // 0-indexed sum of range
    T sum0(int l, int r){return sum0(r) - sum0(l-1);}
    // show the value
    void debug(){print(data);}
};


int main() {
    int N;
    cin >> N;
    vector<ll> a(N),b(N);
    vector<pair<ll, int>> ap;
    rep(i,N){
        cin>>a[i];
        ap.push_back(make_pair(a[i], i));
    }
    sort(ap.begin(), ap.end());
    rep(i,N)b[ap[i].second] = i;
    BIT<long long> c(N);
    ll ans = 0;
    rep(i,N){
        ans += i - c.sum0(b[i]);
        c.add0(b[i], 1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 10580
#include<cstdio>
using namespace std;
int main(){
 int w,h;

 while(1){
  scanf("%d %d",&h,&w);
  if(w==0 && h==0){
   return 0;
  }
  for(int i=0;i<h;i++){

   for(int j=0;j<w;j++){
    if(i==0 || i==(h-1) || j==0 || j==(w-1)){
     printf("#");
    }else{
     printf(".");
    }

   }
   printf("\n");
  }
  printf("\n");
 }
}


Measured memory_bytes: 2680
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> vis,dp;
void initialise(int n)
{
	vis.assign(n,0);
	dp.assign(n,0);
}
int dfs(int i,vector<int> v[])
{
	int max=0;
	vis[i]=1;
	for(int j=0;j<(int)v[i].size();j++)
	{
		if(!vis[v[i][j]])
		{
			if(max<dfs(v[i][j],v))
			{
				max=dp[v[i][j]];
			}
		}
		else
		if(max<dp[v[i][j]])
		{
			max=dp[v[i][j]];
		}
	}
	dp[i]=max+1;
	return dp[i];
}
int main()
{
	int n,m;
	cin>>n>>m;
	int x,y;
	vector<int> v[n];
	initialise(n);
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		x--,y--;
		v[x].push_back(y);
	}
	for(int i=0;i<n;i++)
	{
		if(!vis[i])
		{
			dfs(i,v);
		}
	}
	int i=*max_element(dp.begin(),dp.end());
	cout<<i-1;
}


Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    int N = read();
    vector<int> D(N);
    for (auto& d:D) {
        d = read();
    }
    sort(D.begin(), D.end());
    printf("%d\n", D[N/2]-D[N/2-1]);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 640
#include <iostream> 
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
using namespace std;

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    if(a * a * b / 2 >= x) {
        double h = (double)(x * 2) / (a * b);
        double rad = atan(b / h);
        cout << setprecision(12) << rad * 180 / M_PI << endl;
    } else {
        double emp = a * a * b - x;
        double h = (emp * 2) / (a * a);
        double rad = atan(a / h);
        cout << setprecision(12) << 90 - (rad * 180 / M_PI) << endl;
    }
}

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

using namespace std;

int main()
{
	int w, h, x, y;
	
	cin >> w >> h >> x >> y;
	double w2 = static_cast<double>(w) / 2;
	double h2 = static_cast<double>(h);

	cout << fixed << setprecision(6) << w2 * h2 << ' ';
	if (w % 2 == 0 && h % 2 == 0 && x == w / 2 && y == h / 2)
		cout << 1 << endl;
	else
		cout << 0 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,dp[400010][4],last[400010][4];
vector<int> G[400010];
struct node{
	int i,t;
};
queue<node> Q;
bool vis[400010][4];
signed main(){
	scanf("%lld %lld",&n,&m);
	for(int i=1;i<=m;i++){
		int st,ed;
		scanf("%lld %lld",&st,&ed);
		G[st].push_back(ed);
	}
	int st,ed;
	scanf("%lld %lld",&st,&ed);
	Q.push(node{st,0});
	vis[st][0]=true;
	while(!Q.empty()){
		node now=Q.front();
		Q.pop();
		if(now.i==st)last[now.i][now.t]=dp[now.i][now.t];
		if(now.i==ed&&now.t==0){
			//cout<<dp[now.i][now.t]<<endl;
			printf("%lld",dp[now.i][now.t]/3);
			return 0;
		}
		for(int i=0;i<G[now.i].size();i++){
			int nex=G[now.i][i];
			int tt=(now.t+1)%3;
			if(vis[nex][tt])continue;
			vis[nex][tt]=true;
			Q.push(node{nex,tt});
			dp[nex][tt]=dp[now.i][now.t]+1;
			last[nex][tt]=last[now.i][now.t];
		}
	}
	printf("-1");
	return 0;
}

Measured memory_bytes: 20608
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    s = list(input())
    t = list(input())

    sl = len(s)
    tl = len(t)

    dp = [[0 for _ in range(tl + 1)] for __ in range(sl + 1)]

    for i in range(sl):
        for j in range(tl):
            if s[i] == t[j]:
                dp[i + 1][j + 1] = dp[i][j] + 1
            else:
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])

    ans = ""
    x = sl
    y = tl
    while x > 0 and y > 0:
        if s[x - 1] == t[y - 1]:
            ans = s[x - 1] + ans
            x -= 1
            y -= 1
        elif dp[x][y] == dp[x][y - 1]:
            y -= 1
        elif dp[x][y] == dp[x - 1][y]:
            x -= 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 158208
d = {"AC":0,"WA":0,"TLE":0,"RE":0}
for _ in range(int(input())):
  s = input()
  d[s] += 1

print("AC x",d['AC'])
print("WA x",d['WA'])
print("TLE x",d['TLE'])
print("RE x",d['RE'])

  

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

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

    string ans = "No";

    if (equal(s.begin(), s.end(), t.begin())) {
        if ((int)s.size() - (int)t.size() == -1) ans = "Yes";
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 3596
def solve():
  N = int(input())
  H = [int(i) for i in input().split()]
  dp = [0 for i in range(N)]
  dp[0] = 0
  for i in range(1, N):
    b1 = (dp[i - 1] + abs(H[i - 1] - H[i])) if (i - 1) >= 0 else float('inf')
    b2 = (dp[i - 2] + abs(H[i - 2] - H[i])) if (i - 2) >= 0 else float('inf')
    dp[i] = min(b1, b2)
  return dp[N - 1]

print(solve())


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

int main(){
	string s;	cin>>s;
	int cntA=0,cntB=0;

	for(int i=0;i<s.length();i++){
		if(s[i]=='A')cntA++;
		else cntB++;
	}

	if(cntA==3||cntB==3)cout<<"No"<<endl;
	else cout<<"Yes"<<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);
    String s =sc.nextLine();
    int n=s.length();
    for(int i=n-2;i>0;i-=2) {
     if(s.substring(0,i/2).equals(s.substring(i/2,i))){
    System.out.println(i);
    break;
     }
}
  }
	}

Measured memory_bytes: 25684
n, m = map(int, input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors

l = make_divisors(m)
for c in l:
    if m//c >= n:
        print(c)
        exit()


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

template <typename T>
struct Dice {
	vector<T> val;
	Dice(){ val.resize(6); }
	Dice(vector<T> &v) { val = v; }
	bool operator == (const Dice &t) const {
		return val == t.val;
	}
	bool operator != (const Dice &t) const {
		return val != t.val;
	}
	bool operator < (const Dice &t) const {
		return val < t.val;
	}
	inline T at(int i){
		return val[i];
	}
	inline void rotate_right(){
		T tmp = val[1];
		val[1] = val[2];
		val[2] = val[4];
		val[4] = val[3];
		val[3] = tmp;
	}
	inline void roll_front(){
		T tmp = val[0];
		val[0] = val[1];
		val[1] = val[5];
		val[5] = val[4];
		val[4] = tmp;
	}
	inline void roll_right(){
		T tmp = val[0];
		val[0] = val[3];
		val[3] = val[5];
		val[5] = val[2];
		val[2] = tmp;
	}
	vector<Dice> all_pattern(){
		vector<Dice> res;
		Dice d = *this;
		for (int i = 0; i < 6; i++){
			for (int j = 0; j < 4; j++){
				res.push_back(d);
				d.rotate_right();
			}
			if (i == 0) d.roll_front();
			else if (i < 5) d.roll_right();
			else d.roll_front();
		}
		return res;
	}
};

const int dx[] = {1, 0, 0, 0, 0, -1};
const int dy[] = {0, -1, 0, 0, 1, 0};
const int dz[] = {0, 0, 1, -1, 0, 0};
inline bool ok(int x, int y, int z)
{
	return x >= 0 && y >= 0 && z >= 0 &&
	       x <= 1 && y <= 1 && z <= 1;
}


char must[2][2][2][6];
vector<Dice<char> > ds;
vector<vector<Dice<char> > > D;
bool used[8];

bool check(int n)
{
	if (n == 8) return true;
	
	for (int now = 0; now < 8; now++){
		int x = !!(n & 4);
		int y = !!(n & 2);
		int z = n & 1;
		
		if (used[now]) continue;
		used[now] = true;
		for (int i = D[now].size() - 1; i >= 0; i--){	
			Dice<char> &dice = D[now][i];
			bool f = true;
			for (int j = 0; j < 6; j++){
				if (must[x][y][z][j] && must[x][y][z][j] != dice.at(j)){
					f = false;
					break;
				}
			}
			if (!f) continue;
			for (int dir = 0; dir < 6; dir++){
				int nx = x + dx[dir];
				int ny = y + dy[dir];
				int nz = z + dz[dir];
				if (!ok(nx, ny, nz)) continue;
				int to = (nx << 2) + (ny << 1) + nz;
				if (to < n) continue;
				//printf("%d\n", to);
				must[nx][ny][nz][5 - dir] = dice.at(dir) ^ 32;
			}
			if (check(n + 1)) return true;
		}
		used[now] = false;
	}
	
	return false;
}

void solve()
{
	memset(used, false, sizeof(used));
	if (check(0)){
		puts("YES");
		return;
	}
	puts("NO");
}

int main()
{	
	while (true){
		ds.clear();
		D.clear();
		for (int i = 0; i < 8; i++){
			vector<char> v(6);
			for (int j = 0; j < 6; j++){
				scanf(" %c", &v[j]);
				if (v[j] == '0') return 0;
			}
			ds.push_back(Dice<char>(v));
			D.push_back(ds[i].all_pattern());
		}
		solve();
	}
}

Measured memory_bytes: 1188
import fractions

a,b,c,d = map(int, input().split())

# cで割り切れる、またはdで割り切れるものから、両方で割り切れるものを引く

# cで割り切れる; i
i = b//c - (a-1)//c

# dで割り切れる; j
j = b//d - (a-1)//d

#両方で割り切れる; k
lcm = c*d // (fractions.gcd(c,d))
k = b//lcm - (a-1)//lcm

print(int((b-a+1)-i-j+k))

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

typedef long long ll;
# define  pii pair<ll,ll> 
# define pb push_back
# define f first 
# define s second 

vector<ll> Adj[100001];
ll visited[100001];


ll flag=0;

void dfs(ll u,ll pa,ll visited[])
{
    visited[u]=1;
    
    for(auto it: Adj[u])
    {   //if(flag==1) break;
        //if(it==pa) continue;
        
        if(visited[it]==1)  {flag=1;break;}
        if(!visited[it])
        {
            
        dfs(it,u,visited);
           
        
        }
        
    }
    
    if(flag!=1) 
        visited[u]=2;
    
    
}

ll cn_flag=0;

void dfs2(ll u,ll pa,ll ch_visited[])
{   
    ch_visited[u]=1;
    //cout<<"u "<<u<<endl;
    
    for(auto it: Adj[u])
    {   //cout<<it<<" "<<"visited[it] "<<visited[it]<<endl;
        if(visited[it]!=1) continue;
       // cout<<"it "<<it<<endl;

       // if(it==pa) continue;
        
        if(ch_visited[it]==1)  {cn_flag=1;break;}
        if(!ch_visited[it])
        dfs2(it,u,ch_visited);
    }
    
    ch_visited[u]=2;
    
}

int main() {
    
    ll n,m;
    cin>>n>>m;
    
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        Adj[x].pb(y);
    }
    
    
    
    memset(visited,0,sizeof(visited));
    
    for(ll i=1;i<=n;i++)
    {
        if(flag!=1)
        {
            if(!visited[i])
                dfs(i,-1,visited);
        }
    }
    vector<ll> cycle_nodes;
    
    for(ll i=1;i<=n;i++)
    {  // cout<<i<<" "<<visited[i]<<" ";
        if(visited[i]==1)
        {
            cycle_nodes.pb(i);
            //cout<<i<<" ";
        }
       // cout<<endl;
    }
    
    
    ll check_visited[100001];
//cout<<"jj "<<cycle_nodes.size()<<endl;
ll sz=cycle_nodes.size();
    
    for(ll i=0;i<sz;i++)
    {   //cout<<"uuuu"<<endl;
        
        memset(check_visited,0,sizeof(check_visited));
        //cout<<cycle_nodes[i]<<" kk "<<endl;
        visited[cycle_nodes[i]]=3;
        
        cn_flag=0;
        
        for(int i=0;i<sz;i++)
        {
            if(!check_visited[cycle_nodes[i]])
        dfs2(cycle_nodes[i],-1,check_visited);
        }
        
        if(cn_flag==0)  visited[cycle_nodes[i]]=1;
     }
    
    // if(sz>0)
    // {for(ll i=0;i<n;i++)
    // {   
    //     memset(check_visited,0,sizeof(check_visited));
    //   // cout<<"yy "<<cycle_nodes[sz-1]<<endl;
    //     visited[cycle_nodes[sz-1]]=3;
        
    //     cn_flag=0;
        
    //     if(visited[cycle_nodes[i]]==1)
    //     {  // cout<<"cycle_nodes[i] "<<cycle_nodes[i]<<endl;
    //         dfs2(cycle_nodes[i],-1,check_visited);
    //       // cout<<"my "<<cn_flag<<endl;
    //         if(cn_flag==0)  visited[cycle_nodes[sz-1]]=1;
            
    //         break;
    //     }
    // }
        
    //}
    
    vector<ll> final;
    
    for(ll i=0;i<cycle_nodes.size();i++)
    {
        if(visited[cycle_nodes[i]]==1) final.pb(cycle_nodes[i]);
    }
    if(flag!=0)
    {
    cout<<final.size()<<endl;
    for(ll i=0;i<final.size();i++)
    {
        cout<<final[i]<<endl;
    }
    }
    else
    {
        cout<<"-1"<<endl;
    }
    
	return 0;
}


Measured memory_bytes: 4224
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a, op, b string
	fmt.Scanf("%s %s %s", &a, &op, &b)
	ai, _ := strconv.Atoi(a)
	bi, _ := strconv.Atoi(b)

	switch op {
	case "+":
		fmt.Println(ai + bi)
	case "-":
		fmt.Println(ai - bi)
	}
}

Measured memory_bytes: 512
#include <algorithm>
#include <complex>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

bool judge(int n)
{
    return n % 10 == (n / 10000) && (n / 10) % 10 == (n / 1000) % 10;
}

int main()
{
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for (int i = a; i <= b; i++) {
        if (judge(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d%d", $N, $M);
$A = array_map("intval", explode(" ", fgets(STDIN)));
$sum = 0;
$zero = 0;
foreach($A as $i => $a){
  $sum+=$a;
  $sum%=$M;
  $B[] = $sum;
  if($sum == 0){
    $zero++;
  }
  @$map[$sum]++;
}
foreach($map as $k => $c){
  $zero+=($c*($c-1))/2;
}
echo $zero;


Measured memory_bytes: 18932
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define P pair<int,int>
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
using namespace std;

signed main(){
    int n;
    cin >> n;
    REP(i,n){
        int t;
        cin >> t;
        if(t%2==1){
            cout << "first";
            return 0;
        }
    }
    cout << "second" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int count[][] = new int[2][4];
		while(scan.hasNext()){
			double lr[] = new double[2];
			lr[0] = scan.nextDouble();
			lr[1] = scan.nextDouble();
			for(int i = 0 ; i < 2 ; i++){
				if(lr[i] >= 1.1){
					count[i][0]+=1;
				}else if(lr[i] >= 0.6){
					count[i][1]+=1;
				}else if(lr[i] >= 0.2){
					count[i][2]+=1;
				}else{
					count[i][3]+=1;
				}
			}
		}
		for(int i = 0 ; i < 4 ; i++){
			System.out.println(count[0][i] +" "+ count[1][i]);
		}
	}
}

Measured memory_bytes: 28252
#!/usr/bin/env python3

def solve(n,v,c):
  l = [v[i] -c[i] for i in range(n)]
  l = filter(lambda x: x >=0,l)
  return sum(l)



def main():
  N = int(input())
  V = list(map(int,input().split()))
  C = list(map(int,input().split()))
  print(solve(N,V,C))
  return

if __name__ == '__main__':
  main()


Measured memory_bytes: 9164
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main(){

    int n_int, k_int;
    cin >> n_int >> k_int;

    long double n = (long double) n_int;
    long double k = (long double) k_int;

    int i;
    long double ans = 0.0;
    for (int i = 1; i <= n; i++){

        if(i >= k){
            ans += 1.0 / n;
        }else{
            long double coin = 1;
            while((long double)i * pow(2.0, coin) <= k-1.0){
                coin++;
            }
            ans += 1.0/n * 1.0/pow(2, coin);
        }

    }

    printf("%.12Lf", ans);
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
int k,a,b;
int main()
{
    scanf("%d%d%d",&k,&a,&b);
    rep(i,1,1000) {
        int u = k * i;
        if(a <= u && u <= b){
            puts("OK");
            return 0;
        }
    }
    puts("NG");
    return 0;
}

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

int solve(vector<int>& ht,int n,int k) {
    vector<int>dp(n,0);
    dp[0]=0;
    dp[1]=abs(ht[1]-ht[0]);
    int mn=INT_MAX;

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

        }
        dp[i]=mn;
        mn=INT_MAX;


    }
    return dp[n-1];
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

if (fopen("input.txt", "r")) {
   freopen("input.txt", "r", stdin);
}
    vector<int>ht;
    int n,k;
    cin>>n>>k;
    for(int i=0; i<n; i++) {
        int a;
        cin>>a;
        ht.push_back(a);
    }

    cout<<solve(ht,n,k)<<endl;



}


Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e ;
  int s;
  if(a==0){
    s=1;
  }
  else if(b==0){
    s=2;
  }
  else if(c==0){
    s=3;
  }
  else if(d==0){
    s=4;
  }
  else{
    s=5;
  }
  
  cout<<s <<endl;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

void solve(){
    
  int k;
  cin>>k;
  string a;
    cin>>a;
  
  if((int)a.size()>k){
    a = a.substr(0,k)+"...";
  }
   cout<<a<<"\n";
    
}

int main()
{

           solve();

    return 0; 
}


Measured memory_bytes: 3636
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	int n ; cin >> n ;
	string s,t ;
	cin >> s >> t ;
	for(int i=0;i<n+1;i++){
		bool ok = true ;
		for(int j=0;j<n-i;j++){
			if(s.at(i+j)!=t.at(j)) ok = false ;
		}
		if(ok){
			cout << n+i << endl ;
			return 0 ;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>

using namespace std;

int main(void)
{
    long long int sum=0,range=0;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=0,money;
    long long int a1,a2,a3,ar,as,at1;
    char c;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    string s,s1;
    cin>>c;
    cout<<(char)(c+1);
    return 0;
}





Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,n,v,j,s;
  int a[1000];

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

  for( i=0 ; i<n ; i++ ){
    printf("%d",a[i]);
    if( i != n-1 ) printf(" ");
  }

  printf("\n");

  for( i=1 ; i<=n-1 ; i++ ){
    v = a[i];
    j = i-1;
    while( j>=0 && a[j]>v ){
      a[j+1] = a[j];
      j--;
      a[j+1] = v;
    }
    for( s=0 ; s<n ; s++ ){
      printf("%d",a[s]);
      if( s != n-1 ) printf(" ");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 608
N = int(input())

xs = set();ys = set()
P = []
for i in range(N):
    x1,y1,x2,y2 = map(int, input().split())
    xs.add(x1);xs.add(x2)
    ys.add(y1);ys.add(y2)
    P.append((x1,x2,y1,y2))
    
X = sorted(xs);Y = sorted(ys)
MX = {x: i for i, x in enumerate(X)}
MY = {y: i for i, y in enumerate(Y)}

H = len(Y);W = len(X)
S = [[0]*(W+1) for i in range(H+1)]
for x1, x2, y1, y2 in P:
    p1 = MY[y1]; q1 = MX[x1]
    p2 = MY[y2]; q2 = MX[x2]
    
    S[p1][q1] += 1
    S[p1][q2] -= 1
    S[p2][q1] -= 1
    S[p2][q2] += 1

#右側に囲まれている長方形の辺があれば正になる？
for i in range(H):
    for j in range(W):
        S[i][j+1] += S[i][j]
#上側に囲まれている長方形の辺があれば正になる？
for j in range(W):
    for i in range(H):
        S[i+1][j]+= S[i][j]
        
ans = 0

for i in range(H):
    for j in range(W):
        if S[i][j]:
            ans += (Y[i+1]-Y[i])*(X[j+1]-X[j])
print(ans)


Measured memory_bytes: 343352
#include<iostream>>
using namespace std;
int main()
{
int a;
int b;
cin>>a>>b;

if(a>b)
{
cout<<"a > b"<<endl;
}

if(a<b){
cout<<"a < b"<<endl;
}

if(a==b)
{
cout<<"a == b"<<endl;
}
return 0;
}

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

using namespace std;


#define MOD 1000000007
#define ll long long int
#define ff first
#define ss second
#define N 1000001


template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.ff<<", "<<a.ss<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}
    

void solve()
{
	string s,t;
	cin>>s>>t;

	int n=s.length(),m=t.length();
	int dp[n+1][m+1];
	memset(dp,0,sizeof dp);
	
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i-1]==t[j-1])
				dp[i][j]=1+dp[i-1][j-1];
			else
				dp[i][j]=max({dp[i-1][j],dp[i][j-1]});
		}
	}
	int i=n,j=m;
	string ans="";
	while(i>0 && j>0)
	{
		if(i-1>=0 && dp[i-1][j]==dp[i][j])
			i-=1;
		else if(j-1>=0 && dp[i][j-1]==dp[i][j])
			j-=1;
		else if(i-1>=0 && j-1>=0 && dp[i-1][j-1]+1==dp[i][j])
			ans+=s[i-1],i--,j--;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<"\n";
}	


int32_t main()
{
	
 
    //your code goes here...
    int t=1;
   // cin>>t;
    while(t--)
    {
        solve();
    }    
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int MAX_N = 3010;
long double dp[MAX_N][MAX_N];
int main()
{
    int n;
    cin >> n;
    vector<long double> p(n);
    rep(i, n) cin>>p[i];
    dp[0][0] = 1;
    rep(i, n){
        dp[i+1][0] = dp[i][0]*(1-p[i]);
        rep(j, n){
            dp[i+1][j+1] = dp[i][j]*p[i] + dp[i][j+1]*(1-p[i]);
        }
    }
    long double ans = 0;
    repran(i, n/2+1, n+1) ans += dp[n][i];
    cout << fixed << setprecision(10) << ans << endl;

}

Measured memory_bytes: 144920
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<climits>
#include<bitset>
#include<algorithm>
using namespace std;

int D, G;

int main(void)
{
	cin >> D >> G;

	vector<int> p(D), c(D);
	for(int i=0; i<D; i++)
		cin >> p[i] >> c[i];

	vector<vector<int>> imos(D, vector<int>(1, 0));
	for(int i=0; i<D; i++){
		for(int j=0; j<p[i]; j++){
			imos[i].push_back(imos[i].back() + 100*(1+i));
		}
		imos[i][p[i]] += c[i];
	}

	int ret = INT_MAX;
	for(int i=(1<<D)-1; i>=0; i--){
		int score = G;
		int cnt = 0;
		int pos = -1;
		bitset<10> bit(i);
		for(int j=0; j<D; j++){
			if(bit[j] == true){
				score -= imos[j].back();
				cnt += p[j];
			}
			else
				pos = j;
		}

		if(score <= 0){
			ret = min(ret, cnt);
			continue;
		}

		if(pos == -1){
			continue;
		}
		auto it = lower_bound(imos[pos].begin(), imos[pos].begin()+p[pos], score);
		if(it != imos[pos].begin()+p[pos])
			ret = min(ret, cnt+int(it-imos[pos].begin()));
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
import sys

a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
n = int(input())

b = []
for l in sys.stdin:
    b.append(int(l))

def bingo():
  if len(set(a1) &  set(b)) == 3 or len(set(a2) &  set(b)) == 3 or len(set(a3) &  set(b)) == 3:
    print('Yes')
    return
  
  if a1[0] in b and a2[1] in b and a3[2] in b: 
    print('Yes')
    return
  
  if a1[2] in b and a2[1] in b and a3[0] in b: 
    print('Yes')
    return
  
  for i in range(3):
    if a1[i] in b and a2[i] in b and a3[i] in b:
      print('Yes')
      return
  print('No')
  return

bingo()
    
   

# リストが全て満たされている場合
# リストと一致する数値が全て一致する場合
# リストの数値が±1のステップで一致する場合

Measured memory_bytes: 9192
N, M = map(int, input().split())
D = [list(map(int,input().split())) for i in range(N)]

D.sort()
ans = 0

while M > 0:
    for i in D:
        if i[1] >= M:
            ans += M*i[0]
            M = 0
        else:
            ans += i[1]*i[0]
            M -= i[1]

print(ans)

Measured memory_bytes: 27464
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <time.h>
#define _USE_MATH_DEFINES
#define LL long long
#define UN unsigned
using namespace std;
const double PI = acos(-1.0);

int max_num(int ary[], int length) {
	int max = ary[0];
	for (int i = 1; i < length; i++)
		if (max < ary[i]) max = ary[i];
	return max;
}

int max_ord(int ary[], int length) {
	int max;
	max = max_num(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == max) return i;
	}
	return -1;
}

int min_num(int ary[], int length) {
	int min = ary[0];
	for (int i = 1; i < length; i++)
		if (min > ary[i]) min = ary[i];
	return min;
}

int min_ord(int ary[], int length) {
	int min;
	min = min_num(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == min) return i;
	}
	return -1;
}

void dfs(int rest, string s) {
	if (rest == 0)
		cout << s << endl;
	else
		for (char c = 'a'; c <= 'c'; c++)
			dfs(rest - 1, s + c);
}

int main() {
	string s;
	cin >> s;
	cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - Neither AB nor BA
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10000000;
const int MOD = 998244353;

/* typedef */

typedef long long ll;

/* global variables */

int e2s[MAX_N + 1], cns[MAX_N + 1];

/* subroutines */

inline void addmod(int &a, int b) { a = (a + b) % MOD; }

int powmod(int a, int n) {  // a^n % MOD
  int pm = 1;
  while (n > 0) {
    if (n & 1) pm = (ll)pm * a % MOD;
    a = (ll)a * a % MOD;
    n >>= 1;
  }
  return pm;
}

/* main */

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

  int e3 = powmod(3, n);

  e2s[0] = 1;
  for (int i = 1; i <= n; i++) e2s[i] = (ll)e2s[i - 1] * 2 % MOD;

  cns[0] = 1;
  for (int i = 1; i <= n / 2; i++)
    cns[i] = (ll)cns[i - 1] * (n + 1 - i) % MOD * powmod(i, MOD - 2) % MOD;

  int sum = 0;
  for (int i = n / 2 + 1; i <= n; i++) {
    int d = (ll)cns[n - i] * e2s[n - i] % MOD;
    addmod(sum, d);
  }

  int ans = (e3 + MOD - (ll)sum * 2 % MOD) % MOD;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 59904
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAX 120
typedef long long ll;

int main(){
  ll ans,A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  ans=max(X,Y)*C*2;
  if(X<Y){
    swap(X,Y);
    swap(A,B);
  }
  ans=min(ans,Y*2*C+(X-Y)*A);
  ans=min(ans,A*X+Y*B);
  cout<<ans<<endl;
  
}


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

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

struct V {int to; int id;};

int N, D = 0;
vector<vector<V>> G;
vector<int> E;

inline int input() {
  cin >> N;
  G.resize(N);
  E.resize(N-1);
  int a, b;
  rep(i, N-1) {
    cin >> a >> b;
    a--;b--;
    G.at(a).emplace_back(V{b, i});
    G.at(b).emplace_back(V{a, i});
    E.at(i) = -1;
  }
  return a;
}

inline void dfs(int parent, int color) {
  int c = 1;
  D = max(D, (int)G.at(parent).size());

  for(V target : G.at(parent)) {
    if(target.to == parent) continue;
    if(E.at(target.id) != -1) continue;
    if(c == color) c++;

    E.at(target.id) = c;
    dfs(target.to, c);
    c++;
  }
}

inline void result() {
  cout << D << endl;
  for(int c : E) {
    cout << c << endl;
  }
}

inline void Main() {
  // code
  dfs(input(), 0);
  result();
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <iomanip>

using namespace std;

int main(){
	int n;
	double total, arr[105];
	cin >> n;
	total = 0;
	for(int i = 0 ; i < n ; i++){
		cin >> arr[i];
		total += arr[i];
	}
	total = round(total/(double)n);
	double stamina = 0;
	for(int i = 0 ; i < n ; i++){
		stamina += (arr[i]-total)*(arr[i]-total);
	}
	cout << stamina << endl;
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>
#include <list>
#include <iomanip>
#include <cctype>
#include<chrono>
#include<random>

#define for0(i, N)    for (long long i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (long long i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (long long i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (long long i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (long long i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (long long i = (x), a = 0; a < (N);    \
                              i = (i + 1) % (N), ++a)
#define int long long

long double constexpr pi = 3.141592653589793;

template<class T>
constexpr T sigma1(T i, T n){
    return (n - i + 1) * (i + n) / 2;
}

template<class T>
constexpr T sigma2(T i, T n){
    return (i == 1 ? n * (n + 1) * (2 * n + 1) / 6 :
            sigma2(1, n) - sigma2(1, i - 1));
}

template<class T>
constexpr T sigma3(T i, T n){
    if (i == 1) {
        auto temp = sigma1(i, n);
        return temp * temp;
    }
    return sigma2(1, n) - sigma2(1, i - 1);
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

long long constexpr inf = std::numeric_limits<long long>::max();

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;


signed main(void){
    cin.tie(0); ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);
    ll n;
    cin >> n;

    cout << (n % 10 == 3 ? "bon" : n % 10 == 0 || n % 10 == 1 || n % 10 == 6
             || n % 10 == 8 ? "pon" : "hon") << "\n";

    return 0;
}


Measured memory_bytes: 3608
f a b c x y = minimum [abOnly, abNasi, ababab]
  where
    abOnly = 2 * c * max x y
    abNasi = a * x + b * y
    ababab = if x > y
               then 2 * c * y + a * (x - y)
               else 2 * c * x + b * (y - x)

main = do
  [a,b,c,x,y] <- (map read . words) <$> getLine
  print $ f a b c x y


Measured memory_bytes: 508
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		int n = scan.nextInt();
		
		if(n % 2 == 0) {
			System.out.println(n);
		} else {
			System.out.println(2 * n);
		}
    }
}


Measured memory_bytes: 22100
#include<stdio.h>

int main(void)
{
  int a,b;

  scanf("%d%d",&a,&b);

  if(a>b){
    printf("a > b\n");
  }else if(a<b){
    printf("a < b\n");
  }else{
    printf("a == b\n");
  }


  return 0;
}

Measured memory_bytes: 1752
n=int(input())
List=[str(input()) for i in range(n)] 
S_List=[]
A_List=[]
ans=1
for i in range(n):
  S_List.append(sorted(List[i]))
S_List.sort()
tmp = S_List[0]
for i in range(1,n):
  if tmp == S_List[i]:
    ans+=1
  else:
    A_List.append(ans)
    ans=1
    tmp=S_List[i]
A_List.append(ans)
ANS=0
for i in range(len(A_List)):
  ANS+=int(A_List[i]*(A_List[i]-1)/2)
print(ANS)

Measured memory_bytes: 32464
use std::io::stdin;

#[allow(unused_macros)]
macro_rules! read {
    ($($t:ty), *) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

fn main() {
    let (n,) = read!(u8);
    let (s,) = read!(String);

    println!("{}", solve(n, &s));
}

fn solve(n: u8, s: &str) -> String {
    let base = 'A' as u8;
    s.as_bytes()
        .iter()
        .map(|&b| (((b - base + n) % 26) + base) as char)
        .collect()
}

#[cfg(test)]
mod tests {
    #[allow(unused_imports)]
    use super::*;

    #[test]
    fn it_works() {
        assert_eq!(solve(2, "ABCXYZ"), "CDEZAB");
        assert_eq!(solve(0, "ABCXYZ"), "ABCXYZ");
        assert_eq!(
            solve(13, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
            "NOPQRSTUVWXYZABCDEFGHIJKLM"
        );
    }
}


Measured memory_bytes: 4352
#include <iostream>
#define REP(i, a, n) for(int i = 0; i < n; i++)
using namespace std;


int x, y;

int main(void) {
  REP(i, 0, 3000) {
    cin >> x >> y;
    if(x == 0 && y == 0) break;
    if(x > y) swap(x, y);
    cout << x << " " << y << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void){
  int n, m, l;
  scanf("%d %d %d\n", &n, &m, &l);
  long long int A[n][m], B[m][l], C[n][l];
  for(int i=0; i<n; i++){
    for(int j=0; j<l; j++){
      C[i][j] = 0;
    }
  }

  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      scanf("%lld", &A[i][j]);
    }
  }
  for(int i=0; i<m; i++){
    for(int j=0; j<l; j++){
      scanf("%lld", &B[i][j]);
    }
  }
  for(int i=0; i<n; i++){
    for(int j=0; j<l; j++){
      for(int k=0; k<m; k++){
        C[i][j] += A[i][k]*B[k][j];
      }
    }
  }

  for(int i=0; i<n; i++){
    for(int j=0; j<l; j++){
      if(j == l-1) printf("%lld\n", C[i][j]);
      else printf("%lld ", C[i][j]);
    }
  }

  return 0;
}


Measured memory_bytes: 2128
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int ta[1010],to[100010],nt[100010],co[100010],F[1010];
int MF(int s,int t,int e,int min){
  if(s==t||min==0)return min;
  int i,r;
  F[s]=1;
  for(i=ta[s];i+1;i=nt[i]){
    if(F[to[i]])continue;
    r=MF(to[i],t,e,MIN(min,co[i]));
    co[i]-=r;
    co[(i+e)%(2*e)]+=r;
    if(r)return r;
  }
  return 0;
}
int maxf(int s,int t,int v,int e,int *a,int *b,int *c){
  int i,f,r;
  for(i=0;i<=v;i++)ta[i]=-1;
  for(i=0;i<e;i++){
    nt[i  ]=ta[to[i+e]=a[i]];
    nt[i+e]=ta[to[i  ]=b[i]];
    co[ta[a[i]]=i  ]=c[i];
    co[ta[b[i]]=i+e]=0;
  }
  for(i=0;i<=v;i++)F[i]=0;
  for(f=0;r=MF(s,t,e,1000000000);f+=r){
    if(f>1)return f;
    for(i=0;i<=v;i++)F[i]=0;
  }
  return f;
}
int main(){
  int n,m,i,r=0,a[100010],b[100010],c[100010],s,t;
  scanf("%d %d",&n,&m);
  for(i=1;i<=n;i++){
    a[r]=i;
    b[r]=i+n;
    c[r++]=1;
  }
  while(m--){
    scanf("%d %d",&s,&t);
    a[r]=s+n;
    b[r]=0;
    c[r]=1;
    a[r+1]=t+n;
    b[r+1]=0;
    c[r+1]=1;
    printf("%s\n",maxf(1+n,0,n*2+1,r+2,a,b,c)>1?"Yes":"No");
    a[r]=s+n;
    b[r]=t;
    c[r++]=1;
    a[r]=t+n;
    b[r]=s;
    c[r++]=1;
  }
  return 0;
}

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

int main() {
  int X, A, B, C;
  int a = 0;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> X;
  X = X;
  for(int i = 0; i <= A; i++) {
    for(int j = 0; j <= B; j++) {
      for(int k = 0; k <= C; k++) {
        if(500*i+100*j+50*k == X) {
          a++;
        }
      }
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 256
import sys
from collections import deque


input = lambda: sys.stdin.readline().rstrip()


if __name__ == "__main__":
    H, W = map(int, input().split())
    ch, cw = map(lambda x: int(x)+1, input().split())
    dh, dw = map(lambda x: int(x)+1, input().split())
    maze = ["#"*(W+4), "#"*(W+4)]
    maze += [list("##"+input()+"##") for _ in range(H)]
    maze += ["#"*(W+4), "#"*(W+4)]
    INF = 10**8
    mc = [[INF]*(W+4) for _ in range(H+4)]
    mc[ch][cw] = 0
    walk = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    warp = [(y, x) for x in range(-2, 3) for y in range(-2, 3) if abs(y) + abs(x) > 1]
    que = deque()
    que.append((ch, cw, 0))
    while que:
        y, x, w = que.popleft()
        if mc[y][x] < w:
            continue
        for dy, dx in walk:
            ny = y + dy
            nx = x + dx
            if maze[ny][nx] == "." and mc[ny][nx] > w:
                mc[ny][nx] = w
                que.appendleft((ny, nx, w))
        for dy, dx in warp:
            ny = y + dy
            nx = x + dx
            if maze[ny][nx] == "." and mc[ny][nx] > w+1:
                mc[ny][nx] = w+1
                que.append((ny, nx, w+1))
    if mc[dh][dw] == INF:
        print(-1)
    else:
        print(mc[dh][dw])


Measured memory_bytes: 131880
def main(K, A, B):
    for i in range(A, B+1):
        if i%K==0:
            print('OK')
            return
    print('NG')
    return

if __name__ == '__main__':
    K = int(input())
    A, B = map(int, input().split())
    main(K, A, B)



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

bool ok(int n) {
	int k = n % 10;
	n /= 10;
	while ( n ) {
		if ( n % 10 != k-1 ) return false;
		k = n % 10;
		n /= 10;
	}

	return true;
}

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

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

	int ans = -1;
	for ( int i = 0; i < n; i++ ) {
		for ( int j = i+1; j < n; j++ ) {
			int p = v[i]*v[j];\
			//cout << p << endl;
			if ( ok(p) ) ans = max(ans, p);
		}
	}

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



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

using namespace std;

int main(){
    long N, M;
    cin >> N >> M;
    if(N * M == 1) {
        cout << 1 << endl;    
        return 0;
    }
    if(min(N, M) == 1){
        cout << max(N, M) - 2 << endl;
        return 0;
    }
    cout << (N - 2) * (M - 2) << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
  $money = intval(fgets(STDIN));
  $money_100d = 0;
  $coin500 = 0;
  $coin5 = 0;
  $happy = 0;
  
  $coin500 = ($money - ($money % 500)) / 500;
  $money_100d = $money % 500;
  $coin5 = ($money_100d - ($money_100d % 5)) / 5;
  
  $happy = $coin500 * 1000 + $coin5 * 5;
  
  print($happy);

?>


Measured memory_bytes: 4604
#include <iostream>
#include <map>

int n;
std::map<int, int> map;

int main(){
	while(true){
		map.clear();
		
		std::cin >> n;
		if(n == 0)break;
		
		for(int i = 0; i < n; ++i){
			int a, b, c;
			std::cin >> a >> b >> c;
			map[b] = a + map.find(b) ->second;
			map[c] = -a + map.find(c)->second;
		}
		
		auto it = map.begin();
		int bef = it->second;
		++it;
		while(it != map.end()){
			it->second += bef;
			bef = it->second;
			++it;
		}
		
		bool f = true;
		for(it = map.begin(); it != map.end(); ++it){
			if(it->second > 150)f = false;
		}
		
		if(f)std::cout << "OK" << std::endl;
		else std::cout << "NG" << std::endl;
	}
	
	return 0;
}

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

using namespace std;
typedef long long ll;

int ans,mx,temp;
int main(){
	int n;
	cin >> n;
	ll a[n],b[n];

	for (int i = 0; i < n; ++i){
		cin >> a[i];
	}
	for (int i = 0; i < n; ++i){
		b[i] = a[i];
	}
	bool ok = true;
	for(int i = 0; i < n ; i++){
		if(a[i] >= a[i + 1]){
			ans++;
		}
		else {
			mx = max(mx,ans);
			ans = 0;
		}
	}
	cout << mx << endl;
}

Measured memory_bytes: 1792
n = gets().to_i
aibi = []
n.times{|i|
	aibi[i] = gets().split(' ').map(&:to_i)
}

aibi.sort_by!{|a|
	a[1]
}

tm = 0
result = true
aibi.each{|a|
	ai = a[0]
	bi = a[1]

	tm += ai
	if tm > bi
		result = false
		break
	end
}

puts (result ? "Yes" : "No")


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

int main() {
    int n,a,b;
    string s;
    cin>>n>>a>>b>>s;
    int na=0;
    int nb=0;
    for (size_t i = 0; i < n; i++)
    {
        if(s[i]=='a') {
            if (na+nb<a+b) {
                na++;
                printf("Yes\n");
            }
            else {
                printf("No\n");
            }
        }
        else if (s[i]=='b'){
            if (na+nb<a+b && nb<b) {
                nb++;
                printf("Yes\n");
            }
            else {
                printf("No\n");
            }
        }
        else {
            printf("No\n");
        }
        /* code */
    }
    
}

Measured memory_bytes: 896