akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main() {

    int n;
    cin >> n;

    vector<int> v(n);

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

        char ch;
        cin >> ch;

        v[i] = ch - '0';

    }

    int sum = 0;

    for(int i = 0; i <= 9; ++i) {
        for(int j = 0; j <= 9; ++j) {
            for(int k = 0; k <= 9; ++k) {

                int index = 0;
                while(index < n && v[index] != i)
                    index++;

                if(index == n)
                    continue;

                index++;

                while(index < n && v[index] != j)
                    index++;

                if(index == n)
                    continue;
                
                index++;

                while(index < n && v[index] != k)
                    index++;

                if(index != n)
                    sum++;

            }
        }

    }


    cout << sum << endl;

    return 0;

}

Measured memory_bytes: 3716
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

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

	long long asum = 0, bsum = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i]) {
			asum += a[i] - b[i];
		} else if (a[i] < b[i]) {
			bsum += (b[i] - a[i] + 1) / 2;
		}
	}
	
	if (asum > sum || bsum > sum) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
	int ans[105]={0};
	int a,b,c;
	cin>>a>>b>>c;
	ans[a]++;
	ans[b]++;
	ans[c]++;
	int sum=0;
	for(int i=1;i<=100;i++){
		if(ans[i]>0)
			sum++;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
 
using namespace std;
 
typedef long long int ll;
 
template<class T> inline bool chmax(T& a,T b){ if(a<b){ a=b; return true;} return false; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){ a=b; return true;} return false; }
 
typedef pair<int,int> pair;
 
int main(){
    string s; cin >> s;

    int i=0;
    while(s[i]!='\0'){
        cout << "x";
        i++;
    }
    cout << endl;
}

Measured memory_bytes: 256
//0044 Prime Number II

#include<cstdio>
#include<cmath>
using namespace std;

bool isPrime(int x)
{
	if(x <= 3)
		return true;
	if((x&1) == 0)
		return false;
	for(int i = 3; i*i <= x; i++)
	{
		if(x%i==0)
			return false;
	}
	return true;
}

int main(void)
{
	int n;
	int i;
	while(scanf("%d", &n) == 1)
	{
		for(i = n-1; i>= 2; i--)
		{
			if(isPrime(i))
			{
				printf("%d ", i);
				break;
			}
		}
		for(i = n+1; ; i++)
		{
			if(isPrime(i))
			{
				printf("%d\n", i);
				break;
			}
		}
	}
	return 0;
}

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

int main ()
{
	string a,b; cin>>a>>b;
	
	if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]){
		cout<<"YES"<<endl;
	}
	else 
	cout<<"NO"<<endl;
	


}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		int m, n, i, j;
		String mark = "NULL";
		
		int cards[][];
		cards = new int[4][13];
		
		for(i = 0; i < 4; i++) {
			for(j = 0; j < 13; j++) {
				cards[i][j] = 0;
			}
		}
		
		
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		
		for(i = 0; i < n; i++) {
			
			mark = scan.next();
			m = scan.nextInt();
			
			if(mark.equals("S")) {
				cards[0][m-1] = 1;
			} else if (mark.equals("H")) {
				cards[1][m-1] = 1;
			} else if (mark.equals("C")) {
				cards[2][m-1] = 1;
			} else if (mark.equals("D")) {
				cards[3][m-1] = 1;
			}
		}
		
		
		
		for(i = 0; i < 4; i++) {
			switch(i) {
			case 0 : mark = "S"; break;
			case 1 : mark = "H"; break;
			case 2 : mark = "C"; break;
			case 3 : mark = "D"; break;
			}
			for(j = 0; j < 13; j++) {
				if(cards[i][j] == 0) {
					System.out.println(mark + " " + (j + 1));
				}
			}
		}
	}
}


Measured memory_bytes: 26028
#include <bits/stdc++.h>
using namespace std;
int answer(vector<int> arr,int n)
{
    vector<int>dp(n+1);
    dp[1]=0;

    for(int i =2;i<=n;i++)
    {
        int op1 = abs(arr[i]-arr[i-1]) + dp[i-1] ;
        int op2 =(i==2) ? INT_MAX: abs(arr[i]-arr[i-2]) + dp[i-2] ;
        dp[i]=min(op1,op2);
    }
    return dp[n];
}
int main() {
  int n;
  cin>>n;
  vector<int> arr(n+1);
  for(int i =1;i<=n;i++)
  cin>>arr[i];

  cout<<answer(arr,n)<<endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int MX_N = 2e5+5;

int N,X,Y;
vector<int> c1[MX_N], c2[MX_N];

queue<int> q;
int d1[MX_N], d2[MX_N], p2[MX_N];
bool inf[MX_N];

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> X >> Y;
    FOR(i,1,N-1){
        int a,b; cin>>a>>b;
        c1[a].push_back(b);
        c1[b].push_back(a);
    }
    FOR(i,1,N-1){
        int a,b; cin>>a>>b;
        c2[a].push_back(b);
        c2[b].push_back(a);
    }

    memset(d2,-1,sizeof d2);
    memset(p2,-1,sizeof p2);
    d2[Y]=0; p2[Y]=0; q.push(Y);
    while(!q.empty()){
        int u=q.front(); q.pop();
        for(int v:c2[u])if(d2[v]==-1)d2[v]=d2[u]+1,p2[v]=u,q.push(v);
    }

    FOR(i,1,N) for(int v:c1[i]){
        int a=i,b=v; if(d2[a]<d2[b]) swap(a,b);
        if(p2[a]==b||p2[p2[a]]==b||p2[a]==p2[b]) continue;
        inf[i]=inf[v]=1;
    }

    int ans=d2[X]*2;
    memset(d1,-1,sizeof d1);
    d1[X]=0; q.push(X);
    while(!q.empty()){
        int u=q.front(); q.pop();
        if(inf[u]){ans=-1; break;}
        for(int v:c1[u])if(d1[v]==-1){d1[v]=d1[u]+1;ans=max(ans,d2[v]*2);if(d1[v]<d2[v])q.push(v);}
    }
    cout<<ans;
}



Measured memory_bytes: 26740
#include<iostream>
using namespace std;
int main()
{
  string a;
  cin>>a;
  if(a=="Rainy")
  {cout<<"Sunny";
   return 0;}
  if(a=="Sunny")
  {cout<<"Cloudy";
   return 0;}
  if(a=="Cloudy")
  {cout<<"Rainy";
     return 0;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200000 + 10;
ll a[N],b[N],ok[N];
int main(){
    int n; scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    for(int i=0;i<n;i++) scanf("%lld",&b[i]);
    for(int i=0;i<n;i++){
        if(a[i]>b[i]) return 0 * printf("-1\n");
        if(a[i]==b[i]) ok[i] = 1;
    }
    queue<int> q;
    for(int i=0;i<n;i++) if(b[i]>=b[(i+1)%n]&&b[i]>=b[(i+n-1)%n]) q.push(i);
    ll ans = 0;
    while(!q.empty()){
        int p = q.front(); q.pop();
        if(ok[p]) continue;
        int x = (p+n-1)%n, y = (p+1)%n;
        if(ok[x]&&ok[y]){
            ll d = b[x]+b[y];
            if((b[p]-a[p])%d) return 0 * printf("-1\n");
            ans += (b[p]-a[p])/d;
            b[p] = a[p], ok[p] = 1;
        }
        else{
            ll mx = 0;
            if(!ok[x]) mx = max(mx,b[x]);
            if(!ok[y]) mx = max(mx,b[y]);
            if(b[p]<mx) continue;
            ll d = b[x]+b[y];
            ans += (b[p]-mx+d-1)/d;
            b[p] -= ((b[p]-mx)+d-1)/d*d;
            while(b[p]>=mx) b[p]-=d, ans++;
            if(b[p]<a[p]) return 0 * printf("-1\n");
            if(b[p]==a[p]) ok[p] = 1;
            q.push(x), q.push(y);
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 5504
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Scanner;

class Main{
    private static final Scanner sc = new Scanner(System.in);
    private static final DecimalFormat fmt = new DecimalFormat("0.########");
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args) throws IOException{
        while(true){
            final int n = Integer.parseInt(sc.next());
            if(n==0) break;
            final int s[] = new int[n];
            for(int i = 0; i<s.length; i++){
                s[i] = Integer.parseInt(sc.next());
            }
            double m = 0;
            for(final int e:s)
                m += e;
            m /= n;
            double a = 0;
            for(final int e:s)
                a += (e-m)* (e-m);

            out.println(fmt.format(Math.sqrt(a/n)));
        }
        out.flush();
    }
}

Measured memory_bytes: 30496
import sys


def main():
    # input = sys.stdin.readline
    day = input()

    days = [
        'SUN',
        'MON',
        'TUE',
        'WED',
        'THU',
        'FRI',
        'SAT'
    ]

    print(7-days.index(day))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef pair<int, int> P;
#define rep(i, n) for(i = 0; i < n; i++)

int n, m;
int p, y;
vector<P> city[100000];
string ans[100000];
int p10[6];

string toAns(int x) {
	int i;
	string ret;
	for (i = 5; i >= 0; i--) {
		ret += (char)((x / p10[i]) % 10 + '0');
	}
	return ret;
}

signed main() {
	int i, j;
	
	p10[0] = 1;
	for (i = 1; i < 6; i++) p10[i] = (p10[i - 1] * 10);
	
	cin >> n >> m;
	rep(i, m) {
		cin >> p >> y;
		p--;
		city[p].push_back(P(y, i));
	}
	rep(i, n) { sort(city[i].begin(), city[i].end()); }
	
	rep(i, n) {
		rep(j, city[i].size()) {
			ans[city[i][j].second] = toAns(i + 1) + toAns(j + 1);
		}
	}
	
	rep(i, m) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 13952
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); int max = 1, rem = 0;
		Map<String, Integer> map = new HashMap<String, Integer>();
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			if(map.containsKey(s)) {
				rem = map.get(s)+1;
				map.replace(s, rem);
				max = Math.max(max,rem);
			}else {
				map.put(s, 1);
			}
		}
		List<String> list = new ArrayList<String>();
		for(String key : map.keySet()) if(map.get(key) == max)list.add(key);
		Collections.sort(list);
		StringBuilder sb = new StringBuilder();
		for(String key : list) {
			sb.append(key);
			sb.append('\n');
		}
		System.out.println(new String(sb));
	}
}


Measured memory_bytes: 85712
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void){
    long long int n;
    cin >> n;
    long long int check = sqrt(n);
   // cout << check << endl;
    long long int ans = 0;
    for(long long int i = 1; i <= check; i++){
        if(n%i == 0)
            ans = i;
        if(i == check && ans == 0)
            ans = n;
    }
    if(ans == n)
    cout << check - 1 << endl;
    else
        cout << (ans-1)+((n/ans)-1) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int a,long long int b)
{
 if(b%a==0)
   return a;
  else
 {
   return gcd(b%a,a);
 }  
}
int main()
{
  long long int a,b;cin>>a>>b;
  long long int ans;
 cout<<(a*b)/gcd(a,b);
}

Measured memory_bytes: 256
#include <stdio.h>
 
#define DSIZE 20000
#define PSIZE 10000
 
int top = 0, dipth[DSIZE] = {0};
 
typedef struct {
  int posi;
  int area;
} puddle_t;
 
puddle_t p[PSIZE];
 
int isEmpty(){
  return top == 0;
}
  
int isFull(){
  return DSIZE - 1 <= top;
}
  
int push(int posi){
  if (isFull())
    puts("over flow");
  top++;
  dipth[top] = posi;
  return 0;
}
  
int pop(){
  if (isEmpty())
    puts("under flow");
  top--;
  return dipth[top + 1];
}
 
int calculate(int width){
  if (width == 2)
    // triangle
    return width * 1 / 2;
  else
    // trapezoid
    return (width + width - 2) * 1 / 2;
}
 
int main(void){
  char c;
  int allArea = 0, posi = 0, i = 0, x, j;
 
  while ((c = fgetc(stdin)) != '\n') {
    switch (c) {
    case '\\':
      push(posi);
      break;
    case '/':
      if (isEmpty())
	break;
      x = pop();
      p[i].posi = x;
      p[i].area = calculate(posi + 1 - x);
      // check puddle integration
      if (x < p[i - 1].posi) {
	for (; x < p[i - 1].posi; i--)
	  p[i - 1].area += p[i].area;
      }
      i++;
      break;
    case '_':
      break;
    default:
      puts("Non definition symbol!");
      break;
    }
    posi++;
  }
   
  // output
  for (j = 0; j < i; j++)
    allArea += p[j].area;
  printf("%d\n", allArea);
 
  printf("%d", i);
  for (j = 0; j < i; j++)
    printf(" %d", p[j].area);
  puts("");
  return 0;
}

Measured memory_bytes: 596
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int k=sc.nextInt();
		long s=0;
		for(int a=1;a<k+1;a++){
		for(int b=1;b<k+1;b++){
		for(int c=1;c<k+1;c++){
			s+=gcd(gcd(a,b),c);
		}
		}
		}
		System.out.println(s);
	}
	public static int gcd(int a, int b){
    		if(b==0) return a;
    		return gcd(b, a%b);
	}
}

Measured memory_bytes: 35780
#include <stdio.h>

struct _map {
  int  iHeight;
  char chMap;
} stMap[20000];

int chLake(int* staMap, const int finMap, const struct _map* stMap, const int nDepth);
int A=0,L[10000],k=0;

int main(){
  int maxH=0,minH=0,maxMap=0;

  if (1) {
    char theMap; int m=0;
    int curH=0;
    while(scanf("%c",&theMap) !=EOF){
      stMap[m].chMap = theMap;
      if(theMap=='\\'){
	stMap[m].iHeight = --curH;
	if(curH<minH) minH=curH;
      }
      else if(theMap=='/'){
	stMap[m].iHeight = curH++;
	if(curH>maxH) maxH=curH;
      }
      else
	stMap[m].iHeight = curH;
      m++;
    }
    maxMap=m;
  }

  if(0){
    int m;
    for(m=0;m<maxMap;m++){
    printf(" %c ",stMap[m].chMap);
  }
  printf("\n");
  for(m=0;m<maxMap;m++){
    printf("%2d ",stMap[m].iHeight);
  }
  printf("\n");
  printf("maxH:%d,minH:%d\n",maxH,minH);
  }


  if (0){
    int ch,curMap=0;
    for(ch=maxH;ch>=minH;ch--){
      int sumArea;
      while((sumArea = chLake(&curMap, maxMap, stMap, ch))>0) {
		printf("Found:m:%d,a=%d,d=%d\n",curMap,sumArea/2,ch);
	L[k] = sumArea/2; k++;
	A = A+sumArea/2;
      }
    }
  }
  if (1) {
    int curMap=0;
    for(curMap=0; curMap<maxMap; curMap++) {
      if(stMap[curMap].chMap=='\\') {
	int sumArea;
	sumArea = chLake(&curMap, maxMap, stMap, stMap[curMap].iHeight);
	//	printf("Found:m:%d,a=%d,d=%d\n",curMap,sumArea/2,stMap[curMap].iHeight);
	if (sumArea>0) {
	  L[k] = sumArea/2; k++;
	  A = A+sumArea/2;
	  curMap--;
	}
      }
    }
  }
  printf("%d\n",A);
  if (k==0)
    printf("%d\n",0);
  else {
    int l;
    printf("%d ",k);
    for(l=0; l<k-1; l++)
      printf("%d ",L[l]);
    printf("%d\n",L[k-1]);
  }
  return 0;
}

int chLake(int* staMap, int finMap, const struct _map* stMap, int nDepth){
  int isLake=0;
  int sumArea=0,s=0;
  int m;
  for(m=*staMap;m<=finMap;m++){
    if(stMap[m].iHeight != nDepth){
      if(isLake==1)
	sumArea=sumArea+2;
      continue;
    }
    if((isLake==0)&&(stMap[m].chMap=='\\')){
      isLake=1; sumArea=1; s = m+1;
    }
    else if((isLake==1)&&(stMap[m].chMap=='_')){
      sumArea=sumArea+2;
      while(m!=s)
	sumArea=sumArea+chLake(&s, (m-1), stMap, nDepth-1);
      s = m+1;
    }
    else if((isLake==1)&&(stMap[m].chMap=='/')){
      sumArea=sumArea+1;
      while(m!=s) {
	sumArea=sumArea+chLake(&s, (m-1), stMap, nDepth-1);
      }
      isLake=0; 
      *staMap = m+1; 
      return (sumArea);
    }
    else if((isLake==2)&&(stMap[m].chMap=='_')){
      s = m+1;
    }
    else if((isLake==2)&&
	    ((stMap[m].chMap=='/') || (stMap[m].chMap=='*'))){
      while(m!=s) {
	sumArea = chLake(&s, (m-1), stMap, nDepth-1);
	printf("Found2:m:%d,a=%d,d=%d\n",m,sumArea/2,nDepth-1);
	if (sumArea>0) {
	   L[k] = sumArea/2; k++;
	   A = A+sumArea/2;
	}
      }
      //      *staMap = m+1;
      //      *staMap = m+1;
      //      return 0;
      //      if(sumArea) return(sumArea);
    }
  }
  //  *staMap = *staMap+1;
  return (0);
}

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


void solve(long long A, long long B){
    if(A + B <= 16 && A <= 8 && B <= 8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static int const MAX = 100;

void trace(int A[], int N)
{
  for (int i = 0; i < N; i++)
  {
    if (i > 0)
      cout << " ";
    cout << A[i];
  }
  cout << endl;
}

void insertionSort(int A[], int N)
{
  int v;
  int j;
  for (int i = 1; i < N; i++)
  {
    v = A[i]; // この値を挿入する場所を探す
    j = i - 1;
    while (j >= 0 && A[j] > v)
    {
      // 大きい数値ならばずらしていく
      A[j + 1] = A[j];
      j--;
    }
    // j--;しているので+1する
    A[j + 1] = v;

    trace(A, N);
  }
}

int main()
{
  int N;
  int A[MAX];

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

  trace(A, N);
  insertionSort(A, N);

  return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  ll x;
  cin>>x;
  ll i;i=1;long k;ll ans=100;
  while(i)
  {
  	//cout<<100*pow(1.01,i)<<endl;
  	ll a=ans*1.01;
  	if(a>=x)
  	{
  		cout<<i<<endl;
  		break;
	  }
	  i++;
	  ans=a;
  }
  return 0;
}

  
  
  	


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <cassert>
#define N (ll)(2e6+5)
#define INF (ll)(1e18+3)

#define ll long long
#define rep(i,a,n) for(ll i = a; i < n; i++)
#define per(i,a,n) for(ll i = n-1; i >= a; i--)

using namespace std;

ll h[N];

void solve() {
    ll n, a, b;
    cin >> n >> a >> b;
    a -= b;
    rep(i,0,n) {
        cin >> h[i];
    }
    ll l = 0, r = (ll)(1e9+1);
    ll ans = 0;
    while (l < r) {
        ll mid = (l+r)/2;
        ans = 0;        
        rep(i,0,n) {
            ll cur = h[i] - mid*b;
            if (cur > 0)
                ans += (cur+a-1)/a;
        }
        if (ans > mid) {
            l = mid+1;
        }
        else {
            r = mid;
        }
    }

    cout << l << endl;
}

int main() {
    solve();
}

Measured memory_bytes: 1024
#include <iostream>
#include<string>
#include<cstring>
#include<sstream>
#include<vector>

using namespace std;
int main()
{
int a,b,x,y,z;
cin>>a>>b;
x=a+b;
y=a*b;
z=a-b;
if(x>y&& x>z)cout<<x;
else if(y>x&&y>z)cout<<y;
else cout<<z;
}

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

Colors = [0 for _ in range(8)]
any_color = 0

for a in A:
    if a <= 399:
        Colors[0] = 1
    elif a <= 799:
        Colors[1] = 1
    elif a <= 1199:
        Colors[2] = 1
    elif a <= 1599:
        Colors[3] = 1
    elif a <= 1999:
        Colors[4] = 1
    elif a <= 2399:
        Colors[5] = 1
    elif a <= 2799:
        Colors[6] = 1
    elif a <= 3199:
        Colors[7] = 1
    else:
        any_color += 1

ans_min = max(sum(Colors), 1)
ans_max = sum(Colors) + any_color

print(str(ans_min) + ' ' + str(ans_max))

Measured memory_bytes: 3064
n=int(input())
if n%10==2 or n%10==4 or n%10==5 or n%10==7 or n%10==9:
    print("hon")
if n%10==0 or n%10==1 or n%10==6 or n%10==8:
    print("pon")
if n%10==3:
    print("bon")


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

int main(){
  int N,K,X,Y;
  cin >> N >> K >> X >> Y;
  if(N>=K){
    cout << K*X+(N-K)*Y << endl;
  }else{
    cout << N*X << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  int n;
  scanf("%d", &n);
  long a[n];
  for (int i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  int flag = 0;
  int count = 1;
  for (int i = 1; i < n; i++) {
    if (flag == 0) {
      if (a[i] > a[i-1]) {
        flag = 1;
      } else if (a[i] < a[i-1]) {
        flag = -1;
      }
    } else if (flag == 1) {
      if (a[i] < a[i-1]) {
        count++;
        flag = 0;
      }
    } else {
      if (a[i] > a[i-1]) {
        count++;
        flag = 0;
      }
    }
  }
  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 896
#include <stdio.h>

int main(void)
{
	//iとjはループ変数、heightは縦の長さ、widthは横の長さ
	int i, j;
	int height, width;

	//heightとwidthがともに0ならループ終了
	while((height != 0) || (width != 0)){
		scanf("%d %d", &height, &width);
		//heightかwidthが0ならば何も出力しない
		if((height > 0) && (width > 0)){
			for(i = 0; i < height; i++){
				for(j = 0; j < width; j++){
					if((j == 0) || (j == (width - 1))){
						printf("#");
					}
					else if((i == 0) || (i == (height - 1))){
						printf("#");
					}
					else{
						printf(".");
					}
				}
				printf("\n");
			}
			printf("\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2104
//コンパイラ最適化用
#pragma GCC optimize("Ofast")

//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//INT_MAXなど
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

// clang++ main.cc -std=c++11 -stdlib=libc++

/*
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
*/

signed main(){
  int N;
  cin >> N;

  int x = 1;
  while (1) {
    x *= 2;
    if (x == N)
      break;
    if (x > N) {
      x /= 2;
      break;
    }
  }
  cout << x << endl;

  return 0;
}

Measured memory_bytes: 3576
N , M  =list(map(int,input().split(" ")))

ans = 0
N #個のS
2*N #個のC
#  N 個 の S と 2N個の C で SCCを作る
kosu = min(M//2,N)  #Sを使ってSCCを作れる個数

ans += kosu
M -= 2*kosu
N -= kosu


ans += M//4

print(ans)

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

int main(){
    int x,y;
    while(1){
        cin >> x >> y;
        if(x==0 && y==0){
            break;
        }
        for(int i=1;i<=x;i++){
            for(int j=1;j<=y;j++){
                cout<<"#";
            }
        cout<<endl;
        
        
            
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a - c + 1)*(a - b + 1) << endl;
    return 0;
}


Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long InF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑



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

	for (int i = 0; i <= d; ++i) {
		for (int j = 0; j <= d; ++j) {
			if ((d - a * i - b * j) % c == 0&& (d - a * i - b * j) /c >=0) { ++ans; }
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
short*p,v[][99];main(c,n,m,i,y){for(;m=scanf("%d %[^\n] %[^\n]",&n,v,v+1)*n;printf(m>n?"NA\n":"%d\n",m))for(i=2;i--;m=c)for(c=0,y=n;c<m&y-->1;y+=y==n|*p&2?2:*p&p[-1]&1?0:~!++c)p=y+v[c+i&1];}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
    cout << fixed << setprecision(5);
    double x1,x2,y1,y2, distance;
    cin >> x1 >> y1 >> x2 >> y2;

    distance = sqrt(pow(x2-x1,2)+pow(y2-y1,2));
    cout << distance << endl;

    return 0;
}


Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
 
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mp make_pair
#define mod 1000000007
#define qmod 998244353
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll LINF = LLONG_MAX;

int main(){
	faster;
	ll a,b,c;
	cin>>a>>b>>c;
	swap(a,c);
	swap(b,c);
	cout<<a<<" "<<b<<" "<<c;
}

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



#define SIZE 200005

ll N,M,K;
ll A[SIZE],B[SIZE];

int main(){

	scanf("%lld %lld %lld",&N,&M,&K);

	A[0] = 0;
	for(ll i = 1; i <= N; i++){

		scanf("%lld",&A[i]);
		A[i] += A[i-1];
	}

	B[0] = 0;
	for(ll i = 1; i <= M; i++){

		scanf("%lld",&B[i]);
		B[i] += B[i-1];
	}

	ll ans = 0;
	ll left,right,mid,add;


	for(ll i = 0; i <= N; i++){
		if(A[i] > K)break;

		ll rest = K-A[i];

		left = 1,right = M,mid = (left+right)/2;
		add = 0;

		while(left <= right){
			if(B[mid] <= rest){

				add = mid;
				left = mid+1;

			}else{

				right = mid-1;
			}
			mid = (left+right)/2;
		}
		ans = max(ans,i+add);
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 6936
function main(lines) {
  const input = lines.split(' ')
  const X = input[0]-0
  const Y = input[1]-0
  
  const tsuru = 2*X - Y/2;
  const kame = (Y-2*X)/2;
  if(Number.isInteger(tsuru, kame) && tsuru >=0 && kame >= 0){
      console.log('Yes')
  } else {
      console.log('No')
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 29632
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int sum=0;
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			for(int k=j+1;k<n;k++){
				if(a[i]+a[j]>a[k]){
					sum++;
				}else{
					break;
				}
			}
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007
#define iP pair<int,int>
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define inf 1e15
#define mod1 998244353
#define pi 3.141592653589793238
int32_t main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);cout<<fixed;cerr.tie(NULL);cout.precision(20);
    int k,n;
    cin>>k>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    int mi=inf;
    for(int i=1;i<n;i++){
        mi=min(mi,k-(v[i]-v[i-1]));
    }
    cout<<min(mi,v[n-1]-v[0]);
}

Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main(){
  long long a,b;
  cin >> a >> b;
  long long gcd = 1;
  long long lcm = 1;
  
  if (a<b){
    for (int i=a;i>1;i--){
      if (a%i==0 && b%i==0){
        gcd = i;
        break;
      }
    }
  }
  else if(a>b){
    for (int i=b;i>1;i--){
      if (a%i==0 && b%i==0){
        gcd = i;
        break;
      }
    }
  }
  else{
    gcd = a;
  }
  
  lcm = a * b / gcd;
  cout << lcm << endl; 

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = int(input())

def judge(x):
    ret = 1
    for i in range(1,x):
        if x%i==0:
            ret += 1
    return ret

ret = 0
for i in range(1,n+1):
    if i%2==1 and judge(i)==8:
        ret += 1
print(ret)


Measured memory_bytes: 2940
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e18;
const int mod=1000000007;
//const int mod=998244353;

int n,m,k;
const int N=1e6+10;



int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int q,t,u,v,h;
    ll x,a,b,c,d,y,w,z,k;
    cin >> x >> k >> d;
    if(x<0)x=-x;
    if(k<inf/d&&x-k*d>=0){
        cout << x-k*d << el;
    }
    else{
        if(((x/d+1)^k)&1){
            cout << abs(x-x/d*d) << el;
        }
        else{
            cout << abs(x-(x/d+1)*d) << el;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3644
#include <iostream>
 
int main()
{
  int N, sum = 0;
  std::cin >> N;

  for(int temp = N; temp >= 1; temp /= 10)
  {
      sum += temp % 10;
  }

  if(N % sum == 0)
  {
    std::cout << "Yes";
  }
  else
  {
    std::cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define MODNUM pow(10,9)+7;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    vector<int> abc(26,0);
    cin >> N;
    string str;
    cin >> str;
    for(int i = 0; i < N;i++){
        abc[str[i] - 'a']++;
    }
    ll ans = 1;
    for(int i = 0; i < abc.size();i++){
        ans = (ans * (abc[i]+1))% 1000000007;;
    }

    cout << ans - 1 << endl;

    

    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <utility>
using namespace std;
#define foreach(i,n) for (int i = 0; i < n; ++i)
#define foreach_down(i,n) for (int i = (n)-1; 0 <= i; --i)
#define foreach_from(i,m,n) for (int i = m; i < n; ++i)
typedef vector<int> veci;

#define MAX_PAZZLE 1000
int dirctions[4] = { -4, 4, -1, 1 };
bool on_board(int n) { return 0 <= n && n < 8; }
bool movable(int n, int m) { return on_board(m) && (n+1) * (m+1) != (3+1) * (4+1); }
int find_zero(const veci & v) { return find(v.begin(), v.end(), 0) - v.begin(); }

int main() {
    veci pzl = veci(8); foreach (i,8) pzl[i] = i;
    int cnt = 0;
    map<veci,int> memo;
    memo[pzl] = cnt;
    queue<veci> que;
    que.push(pzl);
    while (not que.empty()) {
        pzl = que.front(); que.pop();
        cnt = memo[pzl];
        int zero = find_zero(pzl);
        foreach (d,4) {
            int nzero = zero + dirctions[d];
            if (movable(zero,nzero)) {
                veci npzl = pzl;
                swap(npzl[zero], npzl[nzero]);
                if (memo.find(npzl) == memo.end()) {
                    memo[npzl] = cnt + 1;
                    que.push(npzl);
                }
            }
        }
    }
    while (true) {
        foreach (i,8) cin >> pzl[i];
        if (cin.fail()) break;
        cout << memo[pzl] << endl;
    }
    return 0;
}

Measured memory_bytes: 3760
#include<stdio.h>

int main(int argc, char* argv[])
{
  int m, f, r;

  scanf("%d %d %d", &m, &f, &r);
  while((m != -1)||(f != -1)||(r != -1)){
    if((m == -1)||(f == -1)){
      printf("F\n");
    }else if(80 <= m+f){
      printf("A\n");
    }else if(65 <= m+f){
      printf("B\n");
    }else if(50 <= m+f){
      printf("C\n");
    }else if((30 <= m+f) && (50 <= r)){
      printf("C\n");
    }else if(30 <= m+f){
      printf("D\n");
    }else{
      printf("F\n");
    }
    scanf("%d %d %d", &m, &f, &r);
  }
  return(0);
}

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

int main() {
    ll P, Q, R;
    cin >> P >> Q >> R;
    cout << min({P + Q, Q + R, R + P}) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
typedef long long ll;
using namespace std;
//#define int long long

//素数判定
inline bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
inline int GetDigit(int num) {
	return (int)log10(num) + 1;
}

//各位の和を返す
int GetDigitsSum(int num) {
	int N = 0;
	while (num > 0) {
		N += num % 10;
		num /= 10;
	}
	return N;
}

//互除法
ll gcd(ll a, ll b) {
	if (a < b) {
		return gcd(b, a);
	}
	else if (a%b) {
		return gcd(b, a%b);
	}
	else {
		return b;
	}
}

//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow

}


//異なるn個からr個の整数を取り出す組合せの数を求める
int combination(int n, int r) {
	if (r == 0 || n == r) {
		return 1;
	}
	else if (r == 1) {
		return n;
	}
	else {
		return combination(n - 1, r - 1) + combination(n - 1, r);
	}

}

//Ｏ(√n)
//素因数分解
map<int, int> prime_factor(int n) {
	map<int, int> res; // map[i]:=ｎを素因数分解したときiは何乗か。
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) {
				res[i]++;
				n /= i;
			}
		}
	}
	if (n != 1)
		res[n] = 1;
	return res;
}

int ans = 0;


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

	int N;
	int h[120] = { 0 };

	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> h[i];
	}
	
	int ans = 0;
	while (true)
	{
		bool flg=false;
		int tmp=0;
		for (int i = 0; i < N+1; i++)
		{
			if (h[i] != 0) {
				tmp = h[i];
				h[i]--;
				flg=true;
			}
			else {
				if (tmp != 0) {
					ans++;
					tmp = 0;
					//cout << "++++" << endl;
				}
			}
			//cout << "aa" << i << "  " << h[i] << endl;
		}
		

		if (!flg) {
			break;
		}
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i = l; i < (r); i++)
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0);cin.tie(0)
using ll = long long;
using ull = unsigned long long;

int main() {
  fastio;
  int R; cin >> R;
  cout << 2*atan(1)*4*R << endl;
}


Measured memory_bytes: 3804
#include<stdio.h>
 
int main()
{
  int x, y, key1, key2;
 
  scanf("%d%d",&x,&y);
 
  if(x < y)
    {
      key1 = x;
      x = y;
      y = key1;
    }
 
  key2 = x % y;
 
  while(key2 != 0)
    {
      x = y;
      y = key2;
      key2 = x % y;
    }
 
  printf("%d\n",y);
 
  return 0;
}

Measured memory_bytes: 1760
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  ld a, b, c; cin >> a >> b >> c;
  if (c - a - b >= 0 && a + 2 * sqrt(a * b) + b < c) Yes();
  else No();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(16);

  solve();
}


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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> vec(n + 1);
  vec[0] = 0;
  for (int i = 1; i < n + 1; i++) {
    cin >> vec[i];
    vec[i] += vec[i-1];
  }
  
  vector<int> subt(n - k + 1);
  for (int i = 0; i < n - k + 1; i++) {
    subt[i] = vec[i+k] - vec[i];
  }
  double ans = 0;
  for (int i = 0; i < n - k + 1; i++) {
    double ave = (subt[i] + k) / 2.0;
    if (ans < ave) {
      ans = ave;
    }
  }
  //cout << ans << endl;
  printf("%lf\n",ans);
}


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

using namespace std;

int main(void)
{
	unordered_map <string,int> red,blue;
	int n,m;
	string s;
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n;

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

	cin >> m;
	for(int i=0;i<m;i++)
	{
		cin >> s;
		red[s]++;
	}

	int res=0;
	for(auto card:blue)
	{
		res = max(res,blue[card.first]-red[card.first]);
	}

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, = map(int, input().split())
rs = []
for _ in range(N):
    A, = map(int, input().split())
    ts, fs = set(), set()
    for _ in range(A):
        x, y = map(int, input().split())
        if y:
            ts.add(x-1)
        else:
            fs.add(x-1)
    rs.append((ts, fs))
r = 0
for i in range(2**N):
    i = i+2**N
    bi = bin(i)[3:]
    ok = True
    for j in range(N):
        if int(bi[j]):
            for t in rs[j][0]:
                if not int(bi[t]):
                    ok = False
            for t in rs[j][1]:
                if int(bi[t]):
                    ok = False
    if ok:
        r = max(r, bi.count("1"))
print(r)


Measured memory_bytes: 44496
package main

import (
  "fmt"
  "strings"
)

func main() {
  var s string
  fmt.Scanf("%s", &s)
  
  ans := ""
  if s == strings.ToLower(s) {
    ans = "a"
  }
  if s == strings.ToUpper(s) {
    ans = "A"
  }
  
  fmt.Printf("%s\n", ans)
}

Measured memory_bytes: 1844
#include <stdio.h>
#define N 100000
int parent_key(int);
int left_key(int);
int right_key(int);
int main()
{
  int i,n,A[N+1];
  
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i=1;i<=n;i++)
    {
      printf("node %d: key = %d, ",i,A[i]);
      if(parent_key(i)>=1) printf("parent key = %d, ",A[parent_key(i)]);
      if(left_key(i)<=n) printf("left key = %d, ",A[left_key(i)]);
      if(right_key(i)<=n) printf("right key = %d, ",A[right_key(i)]);
      printf("\n");     
    }
  return 0;
}

int parent_key(int x)
{
  return x/2;
}
int left_key(int x)
{
  return 2*x;
}
int right_key(int x)
{
  return 2*x+1;
}

Measured memory_bytes: 2592
import random
import copy
D=int(input())                                          #コンテの日数
c=list(map(int,input().split()))                        #26タイプ(AAC~AZC)のコンテストの満足度低下度
s=[list(map(int,input().split())) for _ in range(D)]    #s[d][i]...d(1<=d<=D)日目にi(1<=i<=26)番目のコンテストを行った時の満足度上昇
#types=[int(input()) for _ in range(D)]                  #コンテタイプ(1~26)
#満足度低下はΣ(1<=i<=26)ci*(d-last(d,i))                  #なおlast(d,i)=d日目以前に最後にタイプiのコンテストをやった日にち(ない場合0)
#よって満足度はs[d][i]-Σ(1<=i<=26)ci*(d-last(d,i))
#i日目のスコアはmax(10^6+s[d][i]-Σ(1<=i<=26)ci*(d-last(d,i)),0)
#last=[0]*26                                             #typeごとに、最後に使われた日にちを記録するよ
typ=0
ans=0
#D=365
types=[(i%26)+1 for i in range(D)]
#print(l)
sc = [0] * D
last=[0]*26
#<考え>
#元となるseedは[i%26]の列
#スコアはi日目に積むscoreをsc[i]としてΣsc[i]とできる
#sc[i]の最小をとる日にち(ind)を選び、そのコンテストタイプを選ぶ。
#swap対象として適当なタイプ(上で選んだものでない)を選ぶ
#前から26日のスパンを考えて置換していく。つまり、""ind日のはいるスパン""について上述した二つのコンテストタイプをswapする
#swap結果増えればその結果を反映。減るなら変更を取り消す
for i in range(D):
    typ = types[i] - 1
    score = s[i][typ]
    dwn = 0
    last[typ] = (i + 1)
    for j in range(26):
        dwn = dwn + c[j] * ((i + 1) - last[j])
    ans = score - dwn
    # print(score,last)
    sc[i] = max(ans+10**6,0)
all = sum(sc)
for _ in range(15000):
    types2 = []
    mi=float("inf")
    ind=0
    for i in range(D):
        if mi>sc[i]:
            mi=sc[i]
            ind=i
    l=list(range(1,D+1))
    #print(l)
    #print(ind,types[ind]-1)
    l.pop(ind-1)
    ind2=random.choice(l)
    spans=ind//26
    types2=copy.deepcopy(types)
    buf=types[ind]
    types[ind]=types[ind2-1]
    types[ind2-1]=buf
    sc2=[0]*D
    last=[0]*26
    for i in range(D):
        typ = types[i] - 1
        score = s[i][typ]
        dwn = 0
        last[typ] = (i + 1)
        for j in range(26):
            dwn = dwn + c[j] * ((i + 1) - last[j])
        ans = score - dwn
                # print(score,last)
        sc2[i] = max(ans+10**6,0)
    all2 = sum(sc2)
    if all2<=all:
        types=types2
    else:
        sc=sc2
        all=all2
        sc2=[]
        #print(114514)
    #print(all)
    #input()
for i in range(D):
    print(types[i])





Measured memory_bytes: 84868
#include <iostream>

using namespace std;

int main(void) {
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	int L = A+B;
	int R = C+D;
	if (L == R) {
		cout << "Balanced" << endl;
	}
	else if (L > R) {
		cout << "Left" << endl;
	}
	else {
		cout << "Right" << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <stack>
#include <queue>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using ld = long double;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll L;

    cin >> L;

    cout << setprecision(20) << L*L*L/(ld)27 << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * 
 * @author morisin
 * 
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int AB = sc.nextInt();
		int BC = sc.nextInt();
		int CA = sc.nextInt();
		
		System.out.println(AB*BC/2);
	}

}


Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <bitset>
#include <sstream>
#include <queue>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define sz(a) ((int) (a).size())
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

typedef long long int64;
typedef long double ldb;

const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);

template <class T> T sqr (T x) {return x * x;}
template <class T> T abs (T x) {return x < 0 ? -x : x;}

char dir[4] = {'N', 'W', 'S', 'E'};

int getNum (char c) {
	for (int i = 0; i < 4; ++i) {
		if (dir[i] == c) {
			return i;
		}
	}
	return -1;
}

string s;
int num[4];

int main () {
    ios_base::sync_with_stdio(0);
//	freopen("input.txt", "rt", stdin);
//	freopen("output.txt", "wt", stdout);

	cin >> s;
	int n = sz(s);

	for (int i = 0; i < n; ++i) {
		num[getNum(s[i])]++;
	}

	bool key = true;
	for (int i = 0; i < 4; ++i) {
		if (num[i] > 0 && num[(i + 2) % 4] == 0) {
			key = false;
			break;
		}
	}

	cout << (key ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <set>
#include <cstdio>
#include <cstring>
#include <cstdlib>

using namespace std;


int main(){
  long long int ans;
  int N, K;
  cin >> N >> K;
  ans = K;
  int tmp = (K -1);
  if(N==1)tmp = 1;
  for(int i = 1; i < N; i++){
    ans *= tmp;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let mut v = [0, 0, 0];
    for i in 0..3 {
        v[i] = iter.next().unwrap().parse().unwrap();
    }
    v.sort();
    println!("{} {} {}", v[0], v[1], v[2]);
}


Measured memory_bytes: 5036
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	int h,w;
	cin>>h>>w;
	int c[10][10];
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++) cin>>c[i][j];
	}
	for(int k=0;k<10;k++){
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				if(c[i][j]>c[i][k]+c[k][j]) c[i][j]=c[i][k]+c[k][j];
			}
		}
	}
	ll a,ans;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a;
			if(a>=0) ans+=c[a][1];
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main()
{
	int t = 0;
	vector<int> cooking_time(5);

	for (int i = 0; i < 5; i++)
	{
		cin >> cooking_time.at(i);
	}

	int rmin = INT_MAX;
	int rmin_index;
	for (int i = 0; i < 5; i++)
	{
		int tmp = cooking_time.at(i) % 10;
		if (tmp != 0 && tmp < rmin)
		{
			rmin = tmp;
			rmin_index = i;
		}
	}

	for (int i = 0; i < 5; i++)
	{
		if (i != rmin_index)
		{
			t += cooking_time.at(i);
		}
		
		while (t % 10 != 0)
		{
			t++;
		}
	}
	cout << t + cooking_time.at(rmin_index) << endl;
}


Measured memory_bytes: 256
N = int(input())
S = input()
assert len(S) == N
count = 0

# j-i = k-jを探す
for i in range(0, len(S)-2):
  for j in range(i+1, len(S)-1):
    k = j + (j - i)
    if k < len(S):
      if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
        count += 1
numR = 0
numG = 0
numB = 0
for s in S:
  if s == 'R':
    numR += 1
  elif s == 'G':
    numG += 1
  else:
    numB += 1

print(numR * numG * numB - count)

Measured memory_bytes: 73828