akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int n,r[200100],fa[200100],f[200100];
pair<int,int>p[200100];
stack<int>s;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d",&p[i].first,&p[i].second);
	sort(p+1,p+n+1);
	for(int i=1;i<=n;i++)r[i]=lower_bound(p+i,p+n+1,make_pair(p[i].first+p[i].second,0))-p-1;
	for(int i=n;i;i--){
		while(!s.empty()&&s.top()<=r[i])r[i]=max(r[i],r[s.top()]),fa[s.top()]=i,s.pop();
		s.push(i);
	}
	for(int i=0;i<=n;i++)f[i]=1;
	for(int i=n;i;i--)f[fa[i]]=1ll*f[fa[i]]*(f[i]+1)%mod;
//	for(int i=1;i<=n;i++)printf("%d\n",r[i]);
//	for(int i=1;i<=n;i++)printf("%d\n",fa[i]);
	printf("%d\n",f[0]);
	return 0;
}

Measured memory_bytes: 4608
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var xy = Input.arL;
        WriteLine(Abs(xy[0] - xy[1]) < 2 ? "Brown" : "Alice");
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

int main() {
    string s; cin >> s;
    int res = 0;
    for(int i=0; i<s.length(); i++) {
        res += (s[i] - '0');
    }
    if(res % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3672
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,K;
ll a[100010],b[100010];
int main(){
    cin>>N>>K;
	ll maxA=0;
    for(ll i=0;i<N;i++){
		cin>>a[i]>>b[i];
		maxA=max(maxA,a[i]);
    }
	ll maxBit=0;
	for(ll i=0;(1<<i)<=maxA;i++){
		if((1ll<<i)&maxA)maxBit=i;
	}
	for(ll i=0;(1ll<<i)<=K;i++){
		if((1ll<<i)&K)maxBit=max(maxBit,i);
	}
	ll ans=0;
	for(ll i=0;i<N;i++){
		bool f=true;
		for(ll bit=0;bit<=maxBit;bit++){
			if( ((1ll<<bit)&K)==0 && ((1ll<<bit)&a[i])!=0 ){
				f=false;
				break;
			}
		}
		if(f)ans+=b[i];
	}
	for(ll bit=maxBit;bit>=0;bit--){
		if(((1ll<<bit)&K)==0)continue;
		ll sum=0;
		for(ll i=0;i<N;i++){
			if((1ll<<bit)&a[i])continue;
			bool f=true;
			for(ll j=maxBit;j>bit;j--){
				if( ((1ll<<j)&K)==0 && ((1ll<<j)&a[i])!=0 ){
					f=false;
					break;
				}
			}
			if(f)sum+=b[i];
		}
		ans=max(sum,ans);
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<math.h>

using namespace std;

int main()
{
  string cha;
  cin>>cha;
  if(cha[2]==cha[3]&&cha[4]==cha[5])
  {

      cout<<"Yes";
  }
  else{
    cout<<"No";
  }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
using namespace std;

int main(){
	string s1, s2;
	char s1_1;

	cin >> s1 >> s2;

	for (int i = 0; i < s1.size();i++) {
		if (s1 == s2) {
			cout << "Yes" << endl;
			return 0;
		}
		s1_1 = s1[0];
		s1.erase(s1.begin());
		s1.push_back(s1_1);
	}

	cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <limits.h>
using namespace std;

int main(){
  int k, m; cin >> k >> m;
  if(500 * k >= m) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 605
pair<int,int> mp[MN<<1];
int N,D1,D2,cc;
bool col[MN][MN][2];
struct node{int x,y;};
vector<node> G[5];
void solve(int D,int l){
	register int i,j,k,ct=0,squ=1;
	while(~D&1){ct++;D>>=1;}
	squ=1<<(ct>>1);
	if(~ct&1){
		for(i=0;i<N*2;i++)for(j=0;j<N*2;j++)col[i][j][l]=((i/squ)+(j/squ))&1;
	}
	else{
		for(i=0;i<N*2;i++)for(j=0;j<N*2;j++) col[i][j][l]=(i/squ)&1;
	}
}
int main(){
	register int i,j;
	N=read(),D1=read(),D2=read();
	solve(D1,0),solve(D2,1);
	for(i=0;i<N<<1;i++)for(j=0;j<N<<1;j++)
	G[col[i][j][0]+col[i][j][1]<<1].push_back((node){i,j});
	for(i=0;i<4;i++)if(G[i].size()>=N*N){
		for(j=0;j<N*N;j++) printf("%d %d\n",G[i][j].x,G[i][j].y);
		return 0;
	}
	return 0;
}

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

struct dat {
  int d;
  vector<int> c;
  vector<vector<int>> s;
};

int calc(const dat &a, const vector<int> &last, int day, int t) {
  int v = 0;
  v += a.s.at(day - 1).at(t);
  for (int i = 0; i < 26; i++) {
    if (i == t) continue;
    v -= a.c.at(i) * (day - last.at(i));
  }
  return v;
}

int main() {
  int d;
  cin >> d;
  vector<int> c(26);
  vector<vector<int>> s(d, vector<int>(26));
  for (int i = 0; i < 26; i++) {
    cin >> c.at(i);
  }
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s.at(i).at(j);
    }
  }
  dat a = {d, c, s};
  
  int w = 100;
  vector<vector<int>> last(w, vector<int>(26)), ans(w);
  vector<int> score(w);
  for (int i = 0; i < d; i++) {
    vector<tuple<int, int, int>> idx;
    for (int j = 0; j < w; j++) {
      vector<int> best(w, -1e9), best_t(w);
      for (int t = 0; t < 26; t++) {
        int v = calc(a, last.at(j), i + 1, t);
        if (v > best.at(w - 1)) {
          best.at(w - 1) = v;
          best_t.at(w - 1) = t;
        }
        for (int k = w - 1; k > 0; k--) {
          if (best.at(k - 1) < best.at(k)) {
            swap(best.at(k - 1), best.at(k));
            swap(best_t.at(k - 1), best_t.at(k));
          }
        }
      }
      for (int k = 0; k < w; k++) {
        idx.emplace_back(score.at(j) + best.at(k), j, best_t.at(k));
      }
    }
    sort(idx.rbegin(), idx.rend());
    vector<vector<int>> newans(w);
    for (int j = 0; j < w; j++) {
      int t = get<2>(idx.at(j));
      score.at(j) = get<0>(idx.at(j));
      newans.at(j) = ans.at(get<1>(idx.at(j)));
      newans.at(j).push_back(t);
      last.at(j).at(t) = i + 1;
    }
    ans = newans;
  }
  for (int i = 0; i < d; i++) {
    cout << ans.at(0).at(i) + 1 << endl;
  }
}


Measured memory_bytes: 4456
def solve():
    N, X = list(map(int, input().split()))
    AS = tuple(map(int, input().split()))
    # print(N, X)
    # print(AS)

    cost = 0
    if AS[0] + AS[1] > X:
        should = AS[0] + AS[1] - X
        cost += should
        if AS[1] > should:
            b = AS[1] - should
        else:
            b = 0
    else:
        b = AS[1]

    for i in range(1, len(AS) - 1, 1):
        a = b
        b = AS[i + 1]
        if a + b > X:
            should = a + b - X
            cost += should
            if b > should:
                b = b - should
            else:
                b = 0

    return cost


if __name__ == '__main__':
    res = solve()
    print(res)


Measured memory_bytes: 63984
h, w, K = map(int, input().split())
s = [list(map(int, input())) for _ in range(h)]

def cumsum(s):
    n = len(s)
    cs = [0] * (n+1)
    for i in range(n):
        cs[i+1] = cs[i] + s[i]
    return cs
cums = [cumsum(c) for c in s]
ans = float("inf")    

for i in range(2 ** (h-1)):
    seps = [(i >> j) & 1 for j in range(h-1)] + [1]
    c = [[0] * (w+1) for _ in range(sum(seps))]
    idx = 0
    for j in range(h):
        for k in range(w+1):
            c[idx][k] += cums[j][k]
        if seps[j]: idx += 1
    
    flg = False
    for j in range(len(c)):
        for k in range(w):
            if c[j][k+1]-c[j][k] > K:
                flg = True
    if flg: continue                

    res = 0
    left = 0
    for j in range(w-1):
        for cc in c:
            if cc[j+2] - cc[left] > K:
                break
        else: continue
        res += 1
        left = j+1
    
    ans = min(ans, res+sum(seps)-1)

print(ans)


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

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

using namespace std;

const int inf = 1e18;


int N;
int s[100000];

int calc(int A,int B) {
  //printf("A = %lld, B = %lld\n",A,B);
  int sum = 0;
  int x = 0;
  //while(x < N) {
  while(true) {
    int y = x + A;
    sum += s[y];
    if (y == N - 1) return sum;
    //printf("a y = %lld\n", y);

    y = y - B;
    sum += s[y];
    x = y;
    //printf("b y = %lld\n", y);
  }
  return -1;
}

int dp[100000];

bool in(int A) {
  return 0 < A && A < N;
}

signed main(void) {
  cin >> N;
  rep(i,N) {
    cin >> s[i]; 
  }

  rep(C, N) {
    if (C == 0) continue;
    dp[C] = (N - 1 - C > 0) ? 0 : -inf;
  }

  int ans = 0;
  for (int k = 1; k < N; k++) {
    for (int C = 1;k * C < N ;C++) {
      int A = N - 1 - k * C;
      int B = A - C;
      if (!in(A) || !in(B)) continue;
      //if (B % C == 0 && N - 1 - A - B > 0) continue;
      if ((N - 1) % C == 0 && N - 1 <= 2 * k * C) continue;

      dp[C] += s[N - 1 - k * C] + s[k * C];
      ans = max(dp[C], ans);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MaxN = 100003;
int n,a[MaxN];

int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;++i) scanf("%d",a+i);
    LL l,r;
    if (a[n]==1) l=r=2;else if (a[n]==2) l=2,r=3; else return puts("-1"),0;
    for (int i=n-1;i>=1;--i) {
        int& k=a[i];
        l=(l+k-1)/k*k;
        r=r/k*k+k-1;
        if (l>r) return puts("-1"),0;
    }
    printf("%lld %lld\n",l,r);
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define REP(i,n) for (lint i = 0; i < (n); i++)
#define REP1(i,n) for (lint i = 1; i < (n); i++)

int H, W, N;

int main(void) {
    cin >> H;
    cin >> W;
    cin >> N;
    ((N % max(H, W)) == 0) ? cout << (N / max(H, W)) << endl : cout << (N / max(H, W)) + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;


import java.util.HashSet;
import java.util.Collections;


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

        
            

        
        

    }
    
        
        
    }


Measured memory_bytes: 24912
#include<iostream>
using namespace std;
int A,B,C,tot,a,b,c;
int main()
{
    scanf("%d%d%d",&A,&B,&C);
    while(!((A&1)||(B&1)||(C&1)))
	{
        if(A==B&&B==C)
		{
            cout<<"-1"<<endl;
            return 0;
        }
        tot++,a=(B+C)/2,b=(A+C)/2,c=(B+A)/2;
        A=a,B=b,C=c;
    }
    cout<<tot<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;

void solve()
{
	int n;
	cin>>n;
	int tCnt = 0;
	for(int i=1; i<=n; i++)
	{
		int cnt = 0;
		int temp = i;
		while(temp>0)
		{
			temp/=10;
			cnt++;
		}
//		cout<<i<<": "<<cnt<<"\n";
		if(cnt%2!=0)
			tCnt++;
	}
	cout<<tCnt<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3660
import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, R = MAP()
r = LIST()
ABC = [LIST() for _ in range(M)]

dist_matrix = [[INF]*N for _ in range(N)]
for A, B, C in ABC:
	dist_matrix[A-1][B-1] = C
	dist_matrix[B-1][A-1] = C

for i in range(N):
	dist_matrix[i][i] = 0

#for i in range(N):
#	print(dist_matrix[i])

def Warshall_Floyd(dist, N):
	for k in range(N):
		for i in range(N):
			for j in range(N):
				dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])

Warshall_Floyd(dist_matrix, N)

#for i in range(N):
#	print(dist_matrix[i])

ans = INF
for x in permutations(r):
	dis = 0
	for i in range(1, R):
		dis += dist_matrix[x[i-1]-1][x[i]-1]
	ans = min(ans, dis)

print(ans)


Measured memory_bytes: 77528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,d,x;
    cin >> n >> d >> x;
    int ary[n];
    rep(i, n) cin >> ary[i];

    int ans = 0;
    rep(i,n) {
	ans += (d-1)/ary[i];
    }
    
    cout << ans + n + x << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int [] a = new int [n];
        for (int i = 0 ; i < n ; i++ ) {
            a[sc.nextInt() - 1]++;
        }
        Arrays.sort(a);

        //最初に何種類のボールがあるかを計算
        int ball = 0;
        for (int i = 0 ; i < n ; i++ ) {
            if (a[i] > 0) {
                ball++;
            }
        }

        int changedBall = 0;
        int cursol = 0;
        while (ball > k) {
            changedBall += a[cursol];
            if (a[cursol] > 0) {
                ball--;

            }
            cursol++;
        }
        System.out.println(changedBall);
    }

}

Measured memory_bytes: 64548
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<utility>
#include <numeric>
 
using namespace std;
typedef long long ll;
 
int main(){
ll a,b,c;
  cin>>a>>b>>c;
  if(a*c<b)
    cout<<c;
  else
    cout<<b/a;

  return 0;
 
}
 

Measured memory_bytes: 256
#include <stdio.h>

#define N 100

int main(){

    int i,n,a[N],b,count=0,flag;

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

    flag=1;
    while(flag){
        flag=0;
        for(i=n;i>1;i--){
            if(a[i-1]<a[i-2]){
                b = a[i-2];
                a[i-2] = a[i-1];
                a[i-1] = b;
                count++;
                flag = 1;
            }
        }
    }
    for(i=0;i<n-1;i++){
        printf("%d ",a[i]);
    }
    printf("%d\n%d",a[n-1],count);
    printf("\n");

    return 0;
}

Measured memory_bytes: 2728
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<vector>
#include<deque>
#include<map>
#include<set>

using namespace std;

int a, b;

int input(){
  cin >> a >> b;
  return 0;
}

int run(){
  if( a > b ){
    cout << a-1 << endl;
  }else{
    cout << a << endl;
  }
  return 0;
}

int main(){
  input();
  run();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.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;
	if ((a<c&&c<b)||(b<c&&c<a))
		cout <<"Yes"<<endl;
	else
		cout <<"No"<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int ncrp( int n , int a , int p )
{
    int ans = 1;

    ford(i,n,n-a+1)
    {
        ans = (ans*i)%p;
    }

    rep(i,1,a+1)
    {
        ans = (ans*binpow(i,p-2,p))%p;
    }

    return ans;
}
void solve()
{
    int n,a,b;
    cin>>n>>a>>b;
    
    cout<<(binpow(2,n,mod)-1-ncrp(n,a,mod)-ncrp(n,b,mod) + mod + mod)%mod<<endl;

}

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

    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

const int nmax = 8;
bool graph[nmax][nmax];

Int dfs(Int v, Int N, bool visited[nmax]) {

	bool all_visited = true;
	for (Int i = 0; i < N; i++) {
		if (visited[i] == false) {
			all_visited = false;
		}
	}
	if (all_visited) {
		return 1;
	}

	Int ret = 0;

	for (Int i = 0; i < N; i++) {
		if (graph[v][i] == false)continue;
		if (visited[i])continue;

		visited[i] = true;
		ret += dfs(i, N, visited);
		visited[i] = false;
	}
	return ret;
}


int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, M;
	cin >> N >> M;

	for (Int i = 0; i < M; i++) {
		Int a, b;
		cin >> a >> b;
		graph[a - 1][b - 1] = graph[b - 1][a - 1] = true;
	}

	bool visited[nmax];
	for (Int i = 0; i < N; i++) {
		visited[i] = false;
	}
	visited[0] = true;
	cout << dfs(0, N, visited) << "\n";


}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int A,B,C,D;
	scanf("%d%d%d%d",&A,&B,&C,&D);

//printf ("%d%d%d%d\n",A,B,C,D);

	if(A*B>C*D)
	printf("%d\n",A*B);

	else if(A*B<C*D)
	printf("%d\n",C*D);

	else
		printf("%d\n",A*B);
return 0;

}

Measured memory_bytes: 128
def main():
    n = int(input())
    ans = 0
    for k in range(2,int(n**0.5)+1):
        if n%k==0:
            cnt,mx = 0,0
            while n%k==0:
                n = n//k
                cnt += 1
                if cnt > mx:
                    ans += 1
                    mx += 1
                    cnt = 0
    if n!=1:
        ans += 1
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9268
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int n;
	cin>>n>>s;
	int ans = 0;
	for(int i = 0; i < n; ++i){
		set<char> p;
		for(int k = 0; k < i; ++k){
			p.insert(s[k]);
		}
		set<char> q;
		for(int k = i; k < n; ++k){
			q.insert(s[k]);
		}
		int res = 0;
		for(auto x : p){
			if(q.count(x)){
				res++;
			}
		}
		ans = max(res, ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }
        int[] B = new int[M];
        int[] C = new int[M];
        for (int i = 0; i < M; ++i) {
            B[i] = sc.nextInt();
            C[i] = sc.nextInt();
        }

        System.out.println(solve(A, B, C));

        sc.close();
    }

    static long solve(int[] A, int[] B, int[] C) {
        A = Arrays.stream(A).boxed().sorted().mapToInt(x -> x).toArray();
        int[] sortedIndices = IntStream.range(0, B.length).boxed().sorted((i1, i2) -> -Integer.compare(C[i1], C[i2]))
                .mapToInt(x -> x).toArray();

        int index = 0;
        for (int i = 0; i < A.length; ++i) {
            if (index != sortedIndices.length && C[sortedIndices[index]] > A[i]) {
                A[i] = C[sortedIndices[index]];

                --B[sortedIndices[index]];
                if (B[sortedIndices[index]] == 0) {
                    ++index;
                }
            }
        }

        return Arrays.stream(A).asLongStream().sum();
    }
}

Measured memory_bytes: 63264
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun f(x: CharArray, popcount: Int): Int {
    var ret = 0L
    var pow2 = 1L
    val n = x.count()
    for (i in n - 1 downTo 0) {
        if (x[i] == '1') {
            ret += pow2
            ret %= popcount
        }
        pow2 *= 2
        pow2 %= popcount
    }
    return ret.toInt()
}

fun g(n: Long): Long {
    var popcount = 0L
    var m = n
    while (m > 0) {
        popcount += m % 2
        m /= 2
    }
    return n % popcount
}

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val a = sc.nextLine().toCharArray()
    val popcount = a.count { it == '1' }
    val minus = Array(n) { 0L }
    val plus = Array(n) { 0L }
    var pow2_m = 1L
    var pow2_p = 1L
    for (i in n - 1 downTo 0) {
        minus[i] = pow2_m
        plus[i] = pow2_p
        pow2_m *= 2
        pow2_m %= if (popcount == 1) 1 else popcount - 1
        pow2_p *= 2
        pow2_p %= popcount + 1
    }
    var sum_m = 0L
    var sum_p = 0L
    for (i in 0 until n) {
        if (a[i] == '1') {
            sum_m += minus[i]
            sum_p += plus[i]
            sum_m %= if (popcount == 1) 1 else popcount - 1
            sum_p %= popcount + 1
        }
    }
    for (i in 0 until n) {
        var count = 1
        var v = 0L
        if (a[i] == '0') {
            v = (sum_p + plus[i]) % (popcount + 1)
        }
        else {
            if (popcount == 1) {
                println(0)
                continue
            }
            v = (sum_m - minus[i] + popcount - 1) % (popcount - 1)
        }
        while (v > 0) {
            v = g(v)
            count++
        }
        println(count)
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 66864
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = myconv(next(),4);
  var N = one[0];
  var K = one[1];
  var list = myconv(next(),4);
  var set = new Array(1001);
  for(var i = 1; i <= 1000; i++){
    //種類がiの時の期待値を計算する
    var add = 0;
    for(var j = 1; j <= i; j++){
      add += j / i;
    }
    set[i] = add;
  }
  
  //リスト書き換え
  for(var i = 0; i < N; i++){
    list[i] = set[list[i]];
  }
  
  var max = 0;
  var tmp = 0;
  for(var i = 0; i < N; i++){
    if(i < K){
       max += list[i];
      tmp += list[i];
    }else{
       tmp = tmp - list[i - K] + list[i];
      max = Math.max(tmp,max);
    }
  }
  myout(max);
}

Measured memory_bytes: 32812
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <stdbool.h>

typedef double db;
typedef int in;
typedef long int li;
typedef long long int lli;
typedef long ld;
typedef long lld;

#define pi M_PI
#define in scanf
#define out printf
#define inf INT_MAX
#define rep(i,n) for(int i=0;i<n;++i)
#define debugd(d) printf("%d\n",d)
#define debugs(s) printf("%s\n",s)
#define debugc(c) printf("%c\n",c)
#define debugf(f) printf("%f\n",f)


int main (void)
{
  char s[100000];
  gets(s);
  int len;
  len = strlen(s);
  int isodd = (len)%2;
  for(int i=0;i<len/2;++i)
  {
    printf("%c",s[2*i]);
  }
  if(isodd==1) printf("%c",s[len-1]);
  printf("\n");
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a,b,c,d,e;
int main(){
cin>>a>>b>>c;
if(a==5)d++;
if(b==5)d++;
if(c==5)d++;
if(a==7)e++;
if(b==7)e++;
if(c==7)e++;
if(d==2&&e==1)cout<<"YES";
else cout<<"NO";}

Measured memory_bytes: 256
-- ABC124 B problem
import Control.Monad
import Control.Applicative
import Data.List

toInt :: String -> Int
toInt x = read x :: Int

getInts :: IO [Int]
getInts = do
  x <- getLine
  let y = (map $ toInt) $ words x
  return y

check :: [Int] -> Int -> Int -> Int
check x m n =
  if (null x) then n
  else
    if (head x) >= m then check (tail x) (head x) n
    else check (tail x) m (n-1)

main :: IO ()
main = do
  rd <- getLine
  let n = read rd :: Int
  h <- getInts
  print (check h (head h) n)

Measured memory_bytes: 636
#include<bits/stdc++.h>
#define N 200005
#define ll long long
#define pb push_back
using namespace std; 
int fa[N],n;
ll ans,a[N],m;
struct node
{
	int L,R;
	ll val;
	node(ll x,int y,int z){val=x,L=y,R=z;}
	bool operator < (const node &x) const
	{
		return val<x.val;
	}
};
int search(int x)
{
	if(fa[x]==-1)return x;
	return fa[x]=search(fa[x]);
}
vector<node> v;
void solve(int l,int r)
{
	if(l==r)return;
	int mid=l+r>>1,min_l,min_r;
	ll mn=-1;
	for(int i=l;i<=mid;i++)
	{
		ll value=a[i]-m*(ll)i;
		if(mn==-1||mn>value)
		min_l=i,mn=value;
	}
	mn=-1;
	for(int i=mid+1;i<=r;i++)
	{
		ll value=a[i]+m*(ll)i;
		if(mn==-1||mn>value)
		min_r=i,mn=value;
		ll tmp=a[i]+a[min_l]+m*(ll)(i-min_l);
		v.pb(node(tmp,min_l,i));
	}
	for(int i=l;i<=mid;i++)
	{
		ll tmp=a[i]+a[min_r]+m*(ll)(min_r-i);
		v.pb(node(tmp,i,min_r));
	}
	solve(l,mid);
	solve(mid+1,r);
}
int main()
{
    memset(fa,-1,sizeof(fa));
	scanf("%d%lld",&n,&m);
	for(int i=1;i<=n;i++)
	scanf("%lld",a+i);
	solve(1,n);
	sort(v.begin(),v.end());
    n--;
	for(int i=0;;i++)
	{
		int x=search(v[i].L),y=search(v[i].R);
		if(x==y)continue;
		ans+=v[i].val;n--;
		if(!n)
		{
		printf("%lld\n",ans);
	    return 0;
		}
		fa[x]=y;
	}
}

Measured memory_bytes: 70240
import sys
input = sys.stdin.readline

from collections import Counter

class Unionfind:

    __slots__ = ['nodes','size']

    def __init__(self, n):
        self.nodes = list(range(n))
        self.size = [1]*n

    def root(self, x):
        if self.nodes[x] == x:
            return x
        else:
            root_x = self.root(self.nodes[x])
            self.nodes[x] = root_x
            return root_x

    def unite(self, x, y):
        x = self.root(x); y = self.root(y)
        if x == y:
            return
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.size[x] += self.size[y]
        self.nodes[y] = x

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

N,K,L = map(int,input().split())

uf1 = Unionfind(N)
uf2 = Unionfind(N)

for _ in range(K):
    p,q = map(int,input().split())
    p -= 1; q -= 1
    uf1.unite(p,q)

for _ in range(L):
    r,s = map(int,input().split())
    r -= 1; s -= 1
    uf2.unite(r,s)

# 方針 :各nodeについて(r1,r2)を求める
# dicで(r1,r2)となるようなnodeを数える

keys = []
dic = Counter()

for node in range(N):
    key = (uf1.root(node),uf2.root(node))
    keys.append(key)
    dic[key] += 1

print(*(dic[key] for key in keys))

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


int main(){
    int n,i;
    cin>>n;
    vector <int> a(n+1),b(n+1);
    for(i=1;i<n;++i)cin>>b[i];
    a[1]=b[1];
    for(i=2;i<n;++i)
        a[i]=min(b[i],b[i-1]);
    a[n]=b[n-1];
    int ans=0;
    for(i=1;i<=n;++i)
        ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	string a,b;
	cin>>a>>b;
	string s=a+b;
	int k,p;
	k=stoi(s);
	p=sqrt(k);
	if(k==p*p) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int noDiv(int k)
{
	int c=1;
  	for(int i=2;i<=k;i++)
    {
      if(k%i==0)
        c++;
    }
  return c;
}
int main()
{
  int n,count=0;
  cin>>n;
  int i;
  for(i=1;i<=n;i++)
  {
	if(i%2!=0)
    {
		if(noDiv(i)==8)
          count++;
    }
    else
      continue;
  }
  cout<<count;
}

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

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


int Sum( const int iNum )
{
int n;
int iSum;

	n = iNum;
	iSum = 0;
	while( n > 0 )
	{
		iSum += ( n % 10 );
		n /= 10;
	}

	return iSum;
}

int main()
{
int i;
int N;
int A;
int B;
int iSum;
int iFull;

	cin >> N;
	cin >> A;
	cin >> B;

	iFull = 0;
	rep1( i, N )
	{
		iSum = Sum( i );
		if( iSum >= A && iSum <= B ) iFull += i;
	}

	cout << iFull << endl;

	return 0;
}


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

//型定義
typedef long long ll;

//定数
const ll INF=1e+18;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//省略
using vi  = vector<int>;
using vii = vector<vector<int>>;
using vl  = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
    ll N;
    cin>>N;
    vl X(N),Y(N);
    REP(i,N){
        ll x,y;
        cin>>x>>y;
        X[i]=x+y;
        Y[i]=x-y;
    }

    ll ans=MAX(X)-MIN(X);
    ans=max(ans,MAX(Y)-MIN(Y));
    cout<<ans<<endl;
}

Measured memory_bytes: 6424
#include<stdio.h>
int main()
{
    long long int a[100002];
    a[0]=1;
    for(int i=1;i<100002;i++)
        a[i]=(a[i-1]*i)%(1000000000+7);
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        printf("%lld\n",a[n]);
    }
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
main(){
  ios::sync_with_stdio(false);
  string s;
  while(getline(cin,s),s!="."){
    stack<char> a;
    int i=0;
    for(;i<s.size();++i){
      if(!(s[i]-'(')||!(s[i]-'['))a.push(s[i]);
      if(s[i]==')')if(a.empty()||a.top()!='(')break;else a.pop();
      if(s[i]==']')if(a.empty()||a.top()!='[')break;else a.pop();
    }cout<<(i!=s.size()||!a.empty()?"no":"yes")<<endl;
  }
}

Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n,cnt=0;
	bool s = false;
	cin >> n;
	vector<ll>h(n),a(100);
	rep(i, n)cin >> h[i];
	h.push_back(-1);
	for (ll k = 1; k <= 100; k++) {
		rep(i, n+1) {
			if (h[i] >= k)s = true;
			else {
				if (s == true)cnt++;
				s = false;
			}
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};

int n;

void solve() {
	bool lflag = true, rflag = true;
	bool prev = true;
	
	int cnt = 0;
	for_(i,0,n) {
		string s; cin >> s;
		
		if (s == "lu") {
			lflag = !lflag;
		}
		if (s == "ru") {
			rflag = !rflag;
		}
		if (s == "ld") {
			lflag = !lflag;
		}
		if (s == "rd") {
			rflag = !rflag;
		}
		
		if (lflag == rflag) {
			if (lflag != prev) {
				++cnt;
				prev = !prev;
			}
		}
	}
	
	cout << cnt << endl;
}

int main() {
	while (cin >> n, n) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr auto INF = INT_MAX / 2;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

	ll a, b, n;
	cin >> a >> b >> n;

	if (n < b - 1)cout << a * n / b - a * (n / b) << endl;
	else cout << a * (b - 1) / b << endl;

}

Measured memory_bytes: 3632
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;

typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

long long int MOD = 1000000007;
int N;
int main(){
	cin>>N;
	string str,hoge;
	cin>>str;
	str+='#';
	cin>>hoge;
	ll ans=1;
	int before=0;
	for(int i=0;i<N;i++){
		char x=str[i],y=str[i+1];
		if(x!=y){
			if(before==0){
				ans=(ans*3)%MOD;
			}else if(before==1){
				ans=(ans*2)%MOD;
			}else{
				ans=(ans*1)%MOD;
			}
			before=1;
		}else{
			if(before==0){
				ans=(ans*6)%MOD;
			}else if(before==1){
				ans=(ans*2)%MOD;
			}else{
				ans=(ans*3)%MOD;
			}
			i++;
			before=2;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int num = N % 10;
    if (num == 3){
      System.out.println("bon");
    }else if (num == 0 || num == 1 || num == 6 || num == 8){
      System.out.println("pon");
    } else {
      System.out.println("hon");
    }
  }
}


Measured memory_bytes: 35744
#include<stdio.h>
int main() {
    long long a, b, c, k;
    scanf("%lld%lld%llf%lld", &a, &b, &c, &k);
    if (k % 2 == 0)
        printf("%lld\n", a - b);
    else
        printf("%lld\n", b - a);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    int n;
	vector<int> densha;
	
	while(cin>>n){
		if(n==0){
			cout << densha[densha.size()-1]<<endl;
			densha.pop_back();
		}else{
			densha.push_back(n);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1212
n,k = (int(i) for i in input().split())
mod = 10**9+7
list = [0]*(k+1)
ans = 0
for i in range(1,k+1):
	list[i] = pow((k//i),n,mod)

for i in range(k,0,-1):
	for j in range(2*i,k+1,i):
		list[i]-=list[j]


for i in range(k+1):
    ans += list[i] * i % mod

print(ans%mod)


Measured memory_bytes: 11352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;
//const int MOD = 998244353;

// Lib
//
int N, K;
vector<vector<int> > tree;

// 頂点 v を根として、p のある側は切り落としてできる部分木について
// v から各頂点への距離を depth に格納する
// (特に p = -1 のときは、ツリー全体について v を根とすることを表す)
void rec(int v, int p, int curdepth, vector<int> &depth) {
    depth[v] = curdepth;
    for (auto nv : tree[v]) {
        if (nv == p) continue;
        rec(nv, v, curdepth + 1, depth);
    }
}

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    cin >> N >> K;
    tree.assign(N, vector<int>());
    for (int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        tree[a].push_back(b); tree[b].push_back(a);
    }
    int res = N; // INF の気持ち
    vector<int> depth(N);
    if (K % 2 == 0) {
        for (int v = 0; v < N; ++v) {
            rec(v, -1, 0, depth);
            int num = 0;
            for (int i = 0; i < N; ++i) if (depth[i] > K/2) ++num;
            res = min(res, num);
        }
    }
    else {
        for (int u = 0; u < N; ++u) {
            for (auto v : tree[u]) {
                depth[v] = depth[v] = 0;
                rec(u, v, 0, depth); rec(v, u, 0, depth);
                int num = 0;
                for (int i = 0; i < N; ++i) if (depth[i] > K/2) ++num;
                res = min(res, num);
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define int long long
#define lint long long
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;
using namespace __gnu_pbds;
template <typename T> 
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N=1e5+5, MOD=1e9+7;
const lint INF=1e18;
lint _add(lint x, lint y) {
    lint ret=x+y;
    while(ret<0LL) ret+=MOD;
    return ret;
}
lint _mult(lint x, lint y) {
    x%=MOD; y%=MOD;
    lint ret=x*y;
    ret%=MOD;
    while(ret<0LL) ret+=MOD;
    return ret;
}
inline int modpow(lint base, int exp, int modulo) {
  base %= modulo;  lint result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulo;
    base = (base * base) % modulo; exp >>= 1;
  }
  return result;
}
int n, m, a[N], sum;
signed main()
{
    cin >> n >> m;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum+=a[i];
    }
    sort(a, a+n);
    int cnt = 0;
    for(int i = n-1; i >= 0; i--)
    {
        if(a[i]*4*m < sum)
        {
            break;
        }
        cnt++;
    }
    if(cnt>=m)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
}

Measured memory_bytes: 256
if __name__ == '__main__':
    a,b, c = map(int, input().split())
    if c >= a:
        c = c -a
        a = 0
        if c >= b:
            b = 0
        else:
            b = b- c
    else:
        a = a -c
    print( str(a)+ " "+ str(b) )



Measured memory_bytes: 2940
#include <stdio.h>

void trace(int *A, int n){
	for(int i = 0; i < n; i++){
		if(i > 0) printf(" ");
		printf("%d", A[i]);
	}

	printf("\n");
}

int main(){
	int i, j, t, n, A[100];

	scanf("%d", &n);

	for(i = 0; i < n; i++)
		scanf("%d", A + i);

	int flag = 1;
	int count = 0;
	i = 0;

	while(flag){
		flag = 0;

		for(j = n - 1; j > i; j--){
			if(A[j] < A[j-1]){
				t = A[j];
				A[j] = A[j-1];
				A[j-1] = t;
				flag = 1;
				count++;
			}
		}

		i++;
	}

	trace(A, n);
	printf("%d\n", count);

	return 0;
}



Measured memory_bytes: 2064
x, k, d = map(int, input().split())

if abs(x // d) >= k:
    ans = min(abs(x - k*d), abs(x + k*d))
else:
    k -= x // d
    x -= x // d * d
    if min(abs(x - d), abs(x + d)) <= abs(x):
        if k % 2 == 1:
            ans = min(abs(x - d), abs(x + d))
        else:
            ans = abs(x)
    else:
        if k % 2 == 0:
            ans = abs(x)
        else:
            ans = min(abs(x - d), abs(x + d))
print(ans)


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

#include <algorithm>

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
 
using ll = long long;
using i_i = tuple<int, int>;

int main(){
    int N,L;
    cin >> N >> L;
    vector<string> S(N);
    rep(i, N) cin >> S[i];
    sort(S.begin(),S.end());
    for (int i = 0; i < (N); i++){
        cout << S[i];
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <algorithm>

using namespace std;



int main() {

  //
  unordered_map<string, int> str_fee_map;
  int N, M;
  cin >> N;

  //
  string str;
  for (int i = 0; i < N; ++i) {
    cin >> str;
    if(str_fee_map.find(str) == str_fee_map.end()){
      str_fee_map[str] = 1;
    }else{
      str_fee_map[str] += 1;
    }
  }

  //
  cin >> M;
  for (int i = 0; i < M; ++i) {
    cin >> str;
    if(str_fee_map.find(str) == str_fee_map.end()){
      str_fee_map[str] = -1;
    }else{
      str_fee_map[str] -= 1;
    }
  }


  int max_fee = 0;
  string max_str;
  for (auto k_v_pair: str_fee_map){
    max_fee = max(max_fee, k_v_pair.second);
  }

  cout << max_fee << endl;

  return 0;
}

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

int main()
{
	int d; cin >> d;
	string ans;

	if (d == 25) {
		ans = "Christmas";
	}
	else if (d == 24) {
		ans = "Christmas Eve";
	}
	else if (d == 23) {
		ans = "Christmas Eve Eve";
	}
	else {
		ans = "Christmas Eve Eve Eve";
	}

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

Measured memory_bytes: 256
from math import factorial
from collections import defaultdict
N,A,B = map(int,input().split())
v = list(map(int,input().split()))
vd = defaultdict(int)
for i in range(N):
    vd[v[i]] += 1
vd=sorted(vd.items(),key=lambda x:x[0],reverse=True)
ave,i,cnt = 0,0,0
for v,c in vd:
    if A<=cnt+c:
        break
    cnt += c
    ave += v*c
    i += 1
ans = 0
if i==0:
    ave = vd[i][0]
    ub = min(B,vd[i][1])
    if vd[i][1]==A:
        for j in range(A-1,ub):
            ans += factorial(ub)//(factorial(ub-(j+1))*factorial(j+1))
    else:
        for j in range(A-1,ub):
            ans += factorial(vd[i][1])//(factorial(vd[i][1]-(j+1))*factorial(j+1))
else:
    ave += vd[i][0]*(A-cnt)
    ave /= A 
    ans = factorial(vd[i][1])//(factorial(vd[i][1]-(A-cnt))*factorial(A-cnt))
print(ave)
print(ans)


Measured memory_bytes: 38768
import math
a,b = map(int,input().split())
s = 0
l = [ list(map(int,input().split(" "))) for i in range(a)]
for i in range(a):
  if math.sqrt(l[i][0]**2+l[i][1]**2)<=b:
    s = s+1
print(s)
  

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

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

    vector<int> d(N);
    for(int i=0; i < N; i++){
        cin >> d.at(i);
    }

    int min=d.at(0);
    int count=1;

    for(int i=0; i < N-1; i++){
        if(min > d.at(i+1)){
            min = d.at(i+1);
        }
    }

    for(int i=0; i < N; i++){
        for(int j=0; j < N; j++){
            if((d.at(i) == d.at(j)) && (i!=j)){
                d.at(j) = 0;
            }
        }
    }
/*
    for(int i=0; i < N; i++){
        cout << d.at(i) << endl;
    }
*/
    for(int i=0; i < N; i++){
        if(min < d.at(i)){
            count++;
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 256