akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using P = pair<int, int>;

signed main() {

    int n;
    cin >> n;

    int ans = 0;
    for(int i=1; i<=n; ++i){
        if(i % 3 == 0 && i % 5 == 0){
           
        }
        else if(i % 3 == 0){
            
        }
        else if(i % 5 == 0){
        }
        else{
            ans += i;
        }
    }
    cout << ans << endl;

    return 0;
}


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

N = int(input())
S = input().strip()

D = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] + ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

ans = [0] * len(S)

for i, s in enumerate(S):
    ans[i] = D[D.index(s) + N]

print(''.join(ans))


Measured memory_bytes: 3188
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 2005
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define mp make_pair
#define ll long long
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
ll n, m, k, a, b, ans;

int main() {
	io(); cin >> n >> a >> b;
	ll cur = a + b;
	ll num = n / cur;
	ans = num * a;
	n -= (cur * num);
	if (n > a) ans += a;
	else ans += n;
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e,A,B,C,D,E,cnt=0;
  cin>>a>>b>>c>>d>>e;
  A=a%10;
  B=b%10;
  C=c%10;
  D=d%10;
  E=e%10;
  if(A==0){A=10;
           cnt++;}
  if(B==0){B=10;
           cnt++;}
  if(C==0){C=10;
           cnt++;}
  if(D==0){D=10;
           cnt++;}
  if(E==0){E=10;
           cnt++;}
  int m=min(A,B);
  int m_1=min(m,C);
  int m_2=min(m_1,D);
  int m_3=min(m_2,E);
  cout<<(a/10)*10+(b/10)*10+(c/10)*10+(d/10)*10+(e/10)*10+40+m_3-10*cnt<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main () {


	int dataset=0;
	int dataset_num=0;
	int input=0;
	int count=0;
	int number=1;
	int mul=1;

	int result1=0;
	int result2=0;
	char f_result=0;

	char bef[10]={};
	char aft[10]={};


	scanf("%d",&dataset);
	dataset_num = dataset;
	count=0;

	while( dataset != 0 ){
		scanf("%s %s",bef,aft);

		result1=0;
		result2=0;
		f_result=0;
		count=0;
		number=1;

		
		while(1){
			mul = 1;

			if (bef[count] >= '2' && bef[count] <= '9'){
				number = bef[count]-48;
				count++;
			}

			if(bef[count] == 'm'){
				mul = mul * 1000;
			}	
			else if(bef[count] == 'c'){
				mul = mul * 100;
			}
			else if(bef[count] == 'x'){
				mul = mul * 10;	
			}	
			else if(bef[count]== 'i'){
					
			}

			result1 += mul * number;
			//printf("%d\n",result1 );
			number = 1;
			count++;

			if(bef[count] == '\n' || bef[count]== ' ' || bef[count]== '\0'){
				//printf("finish\n");
				break;
			}
		}



		//printf("result1:%d\n",result1 );
		count=0;
		while(1){
			mul = 1;

			if (aft[count] >= '2' && aft[count] <= '9'){
				number = aft[count]-48;
				count++;
			}

			if(aft[count] == 'm'){
				mul = mul * 1000;
			}	
			else if(aft[count] == 'c'){
				mul = mul * 100;
			}
			else if(aft[count] == 'x'){
				mul = mul * 10;	
			}	
			else if(aft[count]== 'i'){
					
			}

			result2 += mul * number;
			//printf("%d\n",result2 );
			number = 1;
			count++;

			if(aft[count] == '\n' || aft[count]== ' ' || aft[count]== '\0'){
				//printf("finish\n");
				break;
			}
		}
		//printf("result2:%d\n", result2);


		result1 += result2;
		mul =1000;
		number=1;
		//printf("%d\n",result1 );
		while(1){

			
			if( (int)(result1 / mul) == 0){
				mul = mul/10;
				continue;
			}
			else{
				//printf("mul:%d\n",mul);
				number = result1/mul;

				if( number != 1){
					f_result = number+48;
					printf("%c",f_result );
				}
				

				result1 -= number * mul;



				if(mul==1000){
					printf("m");
				}
				else if(mul==100){
					printf("c");
				}
				else if(mul == 10 ){
					printf("x");
				}

				

				if(mul==1){
					printf("i\n");
					break;
				}
				if(result1 == 0){
					printf("\n");
					break;
				}
				mul = mul/10;
			}
			

		}



	dataset--;
	input++;
	}


	return 0;
}

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

#define ll             long long
#define LL             long long
#define pii            pair<int, int>
#define pll            pair<ll, ll>
#define pil            pair<int, ll>
#define pli            pair<ll, int>
#define vi             vector<int>
#define vl             vector<ll>
#define vii            vector<pii>
#define vll            vector<pll>
#define vil            vector<pil>
#define vli            vector<pli>
#define pb             push_back
#define ppb            pop_back
#define mp             make_pair
#define ff             first
#define ss             second
#define TN             typename
#define all(v)         v.begin(), v.end()
#define endl           '\n'

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> T lcm(T a, T b) {return a * (b / gcd(a, b));}
template <TN T> T sqr(T a) {return a * a;}
template <TN T> T cube(T a) {return a * a * a;}
template <TN T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void smax(T &a, T b) {a = a > b ? a : b;}
template <TN T> void fill(T a[], T n, T b) {for (int i = 0; i <= n; i++) a[i] = b;}

int in() {int n; scanf("%d", &n); return n;}
ll Lin() {ll n; scanf("%lld", &n); return n;}
double Din() {double n; scanf("%lf", &n); return n;}

const ll inf = (ll)1e17;
const ll mod = (ll)1e9 + 7;
const int N = 2e5 + 5;

int a[N], dp[N], dp2[N];

int solve() {
	int n = in();
	for (int i = 1; i <= n; i++) {
		a[i] = in();
		dp[i] = gcd(dp[i - 1], a[i]);
	}
	for (int i = n; i >= 1; i--) {
		dp2[i] = gcd(dp2[i + 1], a[i]);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = max(ans, gcd(dp[i - 1], dp2[i + 1]));
	}
	cout << ans << endl;
	return 0;
}

int main() {
	int test = 1, tc = 0;
	//scanf("%d", &test);
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
	return 0;
}



Measured memory_bytes: 1408
// ABC 040 C
#include<bits/stdc++.h>
 
using namespace std;
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())

#define PB(a) push_back(a)

#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//-----------------------------------------
//Groval variables
const int nmax = 50;
bool graph[nmax][nmax];
//------------------------------------------
void dfs(int v,int N,bool visited[nmax]){
  visited[v]=true;
  REP(i,N){
    if(graph[v][i]==false) continue;
    if(visited[i]) continue;
    dfs(i,N,visited);
  }
}
//------------------------------------------

int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------

  int n,m,ans=0;
  bool visited[nmax];
  cin >> n >> m;
  int a[nmax],b[nmax];
  REP(i,m){
    cin >> a[i]>> b[i];
    a[i]--;b[i]--;
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
  }
  REP(i,m){
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=false;
    REP(j,n) visited[j]=false;
    dfs(0,n,visited);
    bool isBridge = false;
    REP(j,n){
      if(!visited[j]) isBridge=true;
    }
    if(isBridge) ans++;
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
  }

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


Measured memory_bytes: 256
function Main(input) {
  var nums = input.split(' ');

  var mai = Math.floor(nums[0]);
  var kingaku = Math.floor(nums[1]);
  
  if (mai * 500 >= kingaku) {
    console.log('Yes');
  } else {
    console.log('No');
  }
  
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

vector<ll> v;
ll divisor(ll x){
	ll j = 1;
	for (ll i = 1;i * i < x;i++){
		if (x % i == 0){
			v.pb(i);
			j++;
		}
		if (x/i != i && x % (x/i) == 0){
			v.pb(x / i);
			j++;
		}
	}
	v.pb(x);
	return j;
}

int main(){
	ll N,M;
	cin >> N >> M;
	ll len = divisor(M);
	M = M / N;
	sort(ALL(v));
	auto position = upper_bound(ALL(v),M);
	int key = distance(v.begin(),position - 1);
	cout << v[key] <<endl;

	return 0;
}

Measured memory_bytes: 256
N,T = gets.strip.split.map(&:to_i)
i = 1
cnt = 10**9
while i <= N
  c,t = gets.strip.split.map(&:to_i)
  if t <= T
    if c <= cnt
      cnt = c
    end
  end
  i += 1
end

if cnt == 10**9
  puts "TLE"
else
  puts cnt
end

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <regex>

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

using namespace std;

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

string S;

int main() {
    cin >> S;

    regex r = regex("(?:dream(?:er)?|eraser?)*");
    bool match = regex_match(S, r);
    cout << (match ? "YES" : "NO") << endl;
}



Measured memory_bytes: 32128
import bisect


primes = [0, 0] + [1] * 9999999
for i in range(2, 3163):
    if primes[i]:
        for j in range(i*i, 10000001, i):
            primes[j] = 0

values = [i for i, v in enumerate(primes) if v]
while True:
    n = int(input())
    if n == 0:
        break
    index = bisect.bisect(values, n)
    for i in range(2, index)[::-1]:
        if all(primes[values[i]-j] for j in [0, 2, 6, 8]):
            print(values[i])
            break

Measured memory_bytes: 163440
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    int n;
    int ans=0;
    cin >> n;
    map<int,int>mochi;
    rep(i,n){
        int a;
        cin >> a;
        mochi[a]++;
    }
    for(auto c:mochi){
        ans++;
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
#define ll long long int
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef pair<ll, ll> pairs;
typedef pair<ll, pairs> tpl;
vector<string> v;
ll mod = 1000000007, dp[1001][1001], n, m;
ll getAns(ll i, ll j)
{
	if (i < 0 || j < 0 || i > n - 1 || j > m - 1 || v[i][j] == '#')
		return 0;
	if (i == n - 1 && j == m - 1)
		return 1;
	if (dp[i][j] != -1)
		return dp[i][j];
	return dp[i][j] = (getAns(i + 1, j) + getAns(i, j + 1)) % mod;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> m;
	for (ll i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		v.push_back(s);
	}
	memset(dp, -1, sizeof(dp));
	cout << getAns(0, 0);
}


Measured memory_bytes: 12612
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var a, b string
	con.Scan(&a, &b)
	honest := b == "H"
	if a == "D" {
		honest = !honest
	}
	if honest {
		con.Println("H")
	} else {
		con.Println("D")
	}
	return nil
}


Measured memory_bytes: 640
/*author:anshumanc007
   created on:08/01/2019
            */
//EMBRACE THE STRUGGLE!!!
#include <bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;



//typedef pair<long long int,long long int> pa;
#define MAX 100005
long long int MOD=1e9+7;
long long int INF=1e18;
long long int dp[3001][3001];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long int i,j,k,l,m,n,o,p,q,r,x,y,a,b,mini=INF,maxi=0,cnt=0,W,ans;
    string s,t;
    cin>>s>>t;
    m=s.size();
    n=t.size();
    for(i=0;i<=m;i++)
    {
        for(j=0;j<=n;j++)
        {
            dp[i][j]=0;
        }
    }
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
           if(s[i-1]==t[j-1])
           {
               dp[i][j]=dp[i-1][j-1]+1;
           }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    i=m;
    j=n;
    vector<char>as;
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            as.push_back(s[i-1]);
            i--;
            j--;
        }
        else
        {
            if(dp[i-1][j]>dp[i][j-1])
            {
                i--;
            }
            else
            {
                j--;
            }
        }
    }
    reverse(as.begin(),as.end());
    for(i=0;i<as.size();i++)
    {
        cout<<as[i];
    }
    
}

Measured memory_bytes: 70656
#include <stdio.h>

int main(){
  int x, y;
  while(scanf("%d%d", &x, &y)){
    if(x == 0 && y == 0) break;
    if(x > y) x += y, y = x - y, x -= y;
    printf("%d %d\n", x, y);
  }
  return 0;
}

Measured memory_bytes: 600
#include<stdio.h>

#define NIL -2000000001
#define INFTY 2000000001

int H=1;
int A[INFTY-1];

void maxHeapify(int i){
  int l,r,largest,x;

  l = 2*i;
  r = 2*i+1;

  if ((l <= H) &&( A[l] > A[i]))
    largest = l;
  else
    largest = i;
  if ((r<= H)&&( A[r] > A[largest]))
    largest = r;

  if (largest != i){
    x=A[i];
    A[i]=A[largest];
    A[largest]=x;
    maxHeapify(largest);
  }
}

/*void buildMaxHeap(void){
  int i;
  for (i=H/2;i>=1;i--){
    maxHeapify(i);
  }
  }*/

int extract(){
  int maxv;
  if(H<1)return -INFTY;
  maxv=A[1];
  A[1]=A[H--];
   maxHeapify(1);
   return maxv;
}

void increaseKey(int i,int key){
  int temp;
  if(key<A[i])return ;
  A[i]=key;
  while((i>1)&&(A[i/2]<A[i])){
    temp=A[i/2];
    A[i/2]=A[i];
    A[i]=temp;
    i=i/2;
  }
}

void insert(int key){
  H++;
  A[H]=-INFTY;
  increaseKey(H,key);
}

int main(){
  char order[10];
  int key,a;

  while(1){
    scanf("%s",order);
    if(order[2]=='s'){
      scanf("%d",&key);
      insert(key);
    }
    else if(order[2]=='t'){
      a=extract();
      printf("%d\n",a);
    }
    else if(order[2]=='d'){
      break;
    }
    else{
      printf("miss order!\n");
    }
  }

  return 0;
}



Measured memory_bytes: 5708
F=->n{E[n]||=(*r=E[n]=n*D
[2,3,5].zip(A){|y,a|r<<F[n/y]+a+n%y*D<<F[0--n/y]+a+-n%y*D};r.min)}
$<.map{eval"N,*A,D="+_1.split*?,
E={}
p F[N]if D}

Measured memory_bytes: 17916
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


# Union Find（経路圧縮有）
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # 親が同じか判別
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # 根を繋ぎ直す
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    # 親が同じか判別
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # 連結成分の大きさを返す
    def size(self, x):
        return -self.parents[self.find(x)]


def kruskal(max_node, edge):
    """
    :param max_node: UnionFind木に渡す頂点数です
    :param edge: edge = [(コスト, 頂点1, 頂点2),...]の形で重み付き隣接リストを渡して下さい
    :return: 最小全域木のコストの和
    """
    edge.sort()
    uf = UnionFind(max_node)
    cost_sum = 0
    for cost, node1, node2 in edge:
        if not uf.same(node1, node2):
            cost_sum += cost
            uf.union(node1, node2)
    return cost_sum


def resolve():
    n = int(input())
    X, Y = [], []
    for i in range(n):
        x, y = map(int, input().split())
        X.append([i, x])
        Y.append([i, y])

    def calc(L):
        for i in range(n - 1):
            cost = abs(L[i][1] - L[i + 1][1])
            edge.append((cost, L[i][0], L[i + 1][0]))

    edge = []
    X.sort(key=lambda x: x[1])
    Y.sort(key=lambda x: x[1])
    calc(X)
    calc(Y)
    print(kruskal(n, edge))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 56980
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main() {
    int n;cin>>n;
    vector<int>V(n),A(n);
    rep(i,n){
        cin>>V[i];
        A[i]=V[i];
    }
    int count=0;
    sort(all(V));
    rep(i,n){
        if(V[i]!=A[i])count++;
    }
    if(count<=2)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    
}

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

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

    vector<int> c(26 + 1);
    rep (i, 26)
        cin >> c[i];

    vector<vector<int>> s(d + 1, vector<int>(26 + 1));
    rep (i, d)
        rep (j, 26)
            cin >> s[i][j];

    /*vector<int> t(d + 1);
    rep (i, d)
        cin >> t[i];*/

    int score = 0;
    vector<int> ans(d + 1);
    vector<int> last(26 + 1, 0);
    rep (i, d)
    {
        vector<pair<int, int>> temp(26);
        rep (t, 26)
        {
            temp[t - 1].second = t;
            temp[t - 1].first = s[i][t] + score;
            rep (j, 26)
            {
                if (j == t)
                    continue;
                temp[t - 1].first -= c[j] * (i - last[j]);
            }
        }
        sort(temp.begin(), temp.end());
        score += temp[26 - 1].first;
        ans[i] = temp[26 - 1].second;
        last[temp[26 - 1].second] = i;
    }

    rep (i, d)
        cout << ans[i] << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  set<string> st;
  rep(i,n) {
    string s;
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;
  return 0;
}

Measured memory_bytes: 19156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);
// priority_queue<ll, vector<ll>, greater<ll>> pq;


int main(){
    ll a, b, c; cin >> a >> b >> c;
    if(a == b && b == c){
        if(a%2 == 0) cout << -1 << endl;
        else cout << 0 << endl;
        return 0;
    }
    ll cnt = 0;
    while(1){
        if(a%2 == 1 || b%2 == 1 || c%2 == 1) break;
        cnt++;
        ll na = (b+c)/2, nb = (c+a)/2, nc = (a+b)/2;
        a = na, b = nb, c = nc;
    }
    cout << cnt << endl;
}


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

int main(){
  int n,d,ans=0,dist,sdist;cin>>n>>d;
  vector<vector<int>> x(n,(vector<int>(d)));
  REP(i,n) REP(j,d) cin>>x.at(i).at(j);

  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      dist=0;
      for(int k=0;k<d;k++){
        dist+=pow(x.at(i).at(k)-x.at(j).at(k),2);
      }
      sdist=sqrt(dist);
      if(dist==sdist*sdist) ans++;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int a, b, c, t;
	cin >> a >> b >> c;
	if (a > b) { t = a; a = b; b = t; }
	if (b > c) { t = b; b = c; c = t; }
	if (a > b) { t = a; a = b; b = t; }
	cout << a << " " << b << " " << c << endl;
	return 0;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, t, a;
    cin >> n >> a;
    int tot = 0;
    for(int i = 0; i < a; ++i) {
        cin >> t;
        tot += t;
    }
    if(tot >= n) puts("Yes");
    else puts("No");
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }




int minimam(int a,int b,int c, int d);

int main() {
  int a,b,c,d; cin >> a >> b >> c >> d;
  int num;
  num = minimam(a,b,c,d);
  cout << num << endl;
  return 0;
}
int minimam(int a,int b,int c, int d) {
  return min(a,b)+min(c,d);
}

Measured memory_bytes: 256
use std;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn a_calc() {
    let a = read::<i32>();
    let ans = a + a.pow(2) + a.pow(3);
    println!("{}", ans);
}

fn main() {
    a_calc();
}


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

typedef long long int in; 

double dp[3005],ans;

int main() 
{
    in n,i,j;
    cin>>n;
    
    double p[n+1];
    
    for(i=1;i<=n;++i)
    {
        cin>>p[i];
    }
    
    dp[0]=1;
    
    for(i=1;i<=n;++i)
    {
        for(j=i;j>=0;--j)
        dp[j]=dp[j-1]*p[i]+dp[j]*(1-p[i]);
    }
    
    for(i=1;i<=n;++i)
    {
        if(i>n-i)
        ans+=dp[i];
    }
    
    cout<<fixed<<setprecision(10)<<ans;
    
	return 0;
}

Measured memory_bytes: 256
n = input()


for i in range(1<<(len(n)-1)):
    num = int(n[0])
    ope =[]
    for j in range(0,len(n)-1):
        if i & (1 << j):
            num += int(n[j+1])
            ope.append('+')
        else:
            num -= int(n[j+1])
            ope.append('-')
    if num == 7:
        for k in range(len(n)):
            if k == len(n) -1:
                print(n[k],"=7",sep="",end="")
            else:
                print(n[k],end="")
                print(ope[k],end="")

        break


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
    string S;
    cin >> S;

    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }

    else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }

    else if(S == "Rainy"){
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 256
//ITP1_6_C:   Official House
#include <stdio.h>
int main(){
    int loop, counter, b, f, r, v;
    int room[4][3][10]={};
    scanf("%d", &loop);
    for (counter=-1; ++counter<loop;){
        scanf("%d%d%d%d", &b, &f, &r, &v);
        room[b-1][f-1][r-1] += v;
    }
    for(b=-1;++b<4;){
        if(b!=0)printf("%s", (b>0&&b<4)?"####################\n":"\n");
        for(f=-1;++f<3;){
            printf(" ");
            for(r=-1;++r<10;)
                    printf("%d%c", room[b][f][r], (r!=9)?' ':'\n');
        }
    }
}



Measured memory_bytes: 1932
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
int sz;
long long arr[100000+2];
void doit(int rem, long long now){
  if(sz >= 100000){
    return;
  }
  if(rem==0){
    arr[sz++] = now;
    return;
  }
  if(now==0){
    int i;
    for(i=(1);i<(10);i++){
      doit(rem-1, now*10+i);
    }
    return;
  }
  int k = now % 10;
  if(k!=0){
    doit(rem-1, now*10 + k-1);
  }
  doit(rem-1, now*10 + k);
  if(k!=9){
    doit(rem-1, now*10 + k+1);
  }
}
int main(){
  int i;
  for(i=(1);i<(15);i++){
    doit(i, 0);
  }
  rd(N);
  wt_L(arr[N-1]);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200404-1

// --- original code ---
// int N;
// int sz;
// ll arr[1d5+2];
// 
// void doit(int rem, ll now){
//   if(sz >= 1d5) return;
//   if(rem==0) arr[sz++] = now, return;
//   if(now==0){
//     rep(i,1,10) doit(rem-1, now*10+i);
//     return;
//   }
//   int k = now % 10;
//   if(k!=0) doit(rem-1, now*10 + k-1);
//   doit(rem-1, now*10 + k);
//   if(k!=9) doit(rem-1, now*10 + k+1);
// }
// 
// {
//   rep(i,1,15) doit(i, 0);
//   rd(N);
//   wt(arr[N-1]);
// }


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    int D; cin >> D;
    vector<int> c(27); for (int i = 1; i <= 26; ++i) cin >> c[i];
    vector<vector<int>> s(D + 1);
    for (int i = 1; i <= D; ++i) {
        vector<int> v(27);
        for (int j = 1; j <= 26; ++j) cin >> v[j];
        s[i] = v;
    }

    // input
    vector<int> t(D + 1);
    for (int i = 1; i <= D; ++i) {
        cin >> t[i];
    }
    // score
    vector<int> last(27, 0);
    ll satisfy = 0;
    for (int i = 1; i <= D; ++i) {
        int con = t[i];
        // add satisfy
        satisfy += s[i][con];
        // update last
        last[con] = i;
        // sub satisfy
        for (int j = 1; j <= 26; ++j) {
            satisfy -= c[j] * (i - last[j]);
        }
        cout << satisfy << endl;
    }
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

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

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int h, w, k; std::cin >> h >> w >> k;
  ll x1, y1, x2, y2; std::cin >> x1 >> y1 >> x2 >> y2;
  x1--, y1--, x2--, y2--;
  std::vector<std::string> G(h);
  rep(i,h) std::cin >> G[i];

  // dijkstra
  const ll inf = 1e18;
  std::vector<std::vector<ll>> dist(h, std::vector<ll>(w,inf));
  using P = std::pair<ll,ll>;
  std::queue<P> q;
  q.emplace(x1,y1);
  dist[x1][y1] = 0;
  while(!q.empty()) {
    auto cur = q.front(); q.pop();
    ll x = cur.first;
    ll y = cur.second;
    
    // goal
    if ( x == x2 && y == y2 ) {
      std::cout << dist[x][y] << std::endl;
      return 0;
    }

    // Visit 4-direction
    constexpr ll dx[] = { 1, -1, 0,  0 };
    constexpr ll dy[] = { 0,  0, 1, -1 };
    rep(i,4) {
      for(int j=1; j<=k; j++) {
        ll nx = x + j*dx[i];
        ll ny = y + j*dy[i];
        if ( nx < 0 || nx >= h || ny < 0 || ny >= w  ) break;
        if ( G[nx][ny] == '@' ) break;
        if ( dist[nx][ny] <= dist[x][y] ) break;
        if ( dist[nx][ny] == inf ) {
          dist[nx][ny] = dist[x][y] + 1;
          q.emplace(nx,ny);
        }
      }
    }
  }
  std::cout << -1 << std::endl;
  return 0;
}



Measured memory_bytes: 19832
package main
import "fmt"
func main() {
  var n,a,b,c,d int
  var s string
  fmt.Scan(&n,&a,&b,&c,&d,&s)
  x := make([]int,n+1)
  y := make([]int,n+1)
  for i:=1;i<n+1;i++ {
    if s[i-1:i] == "#" { x[i],y[i] = -1,-1 }
  }
  x[c] = 1
  for i:=c;i>a;i-- {
    if x[i] == 1 {
      if x[i-1] != -1 { x[i-1] = 1 }
      if x[i-2] != -1 { x[i-2] = 1 }
    }
  }
  y[d] = 1
  for i:=d;i>b;i-- {
    if y[i] == 1 {
      if y[i-1] != -1 { y[i-1] = 1 }
      if y[i-2] != -1 { y[i-2] = 1 }
    }
  }
  if c < d && x[a] == 1 && y[b] == 1 { fmt.Println("Yes");return }
  if x[a] == 0 || y[b] == 0 { fmt.Println("No");return }
  for i:=b;i<=d;i++ {
    if y[i] == 1 && y[i-1] != -1 && y[i+1] != -1 && x[i-1] == 1 { fmt.Println("Yes");return }
  }
  fmt.Println("No")
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e2 + 5);

int n;
double a[MAX_N];

int main(void) {
  // Here your code !
  scanf("%d", &n);

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

  double cnt = 0.0;

  for (int i = 0; i < n; ++i) {
    cnt += 1.0 / a[i];
  }

  double ans = 1.0 / cnt;

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

  return 0;
}


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

const ll MX = 1e18;

int main() {
  int n;
  cin >> n;
  ll ans = 1;
  bool ng = false;
  while(n--){
    ll a;
    cin >> a;
    if (a == 0) {
      cout << 0 << endl;
      return 0;
    }
    if (ng || (MX+1)/ans < a || ans*a > MX) {
      ng = true;
    }
    ans *= a;
  }
  if (ng) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
int main() {
	int n; rd(n);
	if(n%2) printf("%d\n",n/2);
	else printf("%d\n",n/2-1);
	return 0;
}

Measured memory_bytes: 256
class WeightedUnionFind
  def initialize(n)
    @parent = (0...n).to_a # 親の番号
    @rank = Array.new(n, 0) # 木の深さ
    @diff_weight = Array.new(n, 0) # 親との重みの差
  end

  def root(x)
    return x if @parent[x] == x
    r = root(@parent[x])
    @diff_weight[x] += @diff_weight[@parent[x]]
    @parent[x] = r
    return r
  end

  def weight(x)
    root(x)
    return @diff_weight[x]
  end

  def same?(x, y)
    root(x) == root(y)
  end

  def diff(x, y)
    # x と y とが同じグループにいるとき、weight(y) - weight(x) を返す
    # 同じグループでないならnil
    return nil if !same?(x, y)
    return weight(y) - weight(x)
  end

  def merge(x, y, w)
    # weight(y) - weight(x) = wとなるように結合
    w += weight(x)
    w -= weight(y)
    x, y = root(x), root(y)
    return false if x == y
    if @rank[x] < @rank[y]
      x, y = y, x
      w = -w
    end
    @rank[x] += 1 if @rank[x] == @rank[y]
    @parent[y] = x
    @diff_weight[y] = w
    return true
  end
end

N,M=gets.split.map(&:to_i)
uf= WeightedUnionFind.new(N)
M.times do
  l, r, d = gets.split.map(&:to_i)
  if uf.same?(l-1, r-1)
    if uf.diff(l-1, r-1) != d
      puts 'No'
      exit(0)
    end
  end
  uf.merge(l-1, r-1, d)
end

puts 'Yes'

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

int main()
{
    ll n;
    cin >> n;
    int arr[n];
    ll x = 0;
    for(int i = 0; i  < n; i++) {
        cin >> arr[i];
        x ^= arr[i];
    }
    //cout << x;
    for(int i = 0; i < n; i++)  {
        arr[i] = arr[i]^x;
        cout << arr[i] << " ";
    }

        return 0;
}


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


int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a+b<=b+c && a+b<=c+a)
printf("%d",a+b);
else if(a+c<=a+b && a+c<=b+c)
printf("%d",a+c);
else 
printf("%d",b+c);


return 0;

}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
using namespace std;

const int N=25005;
const int K=405;
const int mod=1e9+7;
int n,k,m,a[N],gt[N],igt[N],dp[N][K],f[N][K],sum[N][K];
int have[N];

int Power(int x,int n)
{
    if(!n) return 1;
    int tmp=Power(x,n/2);
    if(n%2) return tmp*tmp%mod*x%mod;
    return tmp*tmp%mod;
}

int C(int k,int n)
{
    if(k>n||n<0) return 0;
    return gt[n]*igt[k]%mod*igt[n-k]%mod;
}


main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    gt[0]=1;
    for(int i=1;i<N;i++) gt[i]=gt[i-1]*i%mod;
    igt[N-1]=Power(gt[N-1],mod-2);
    for(int i=N-2;i>=0;i--) igt[i]=igt[i+1]*(i+1)%mod;
    cin>>n>>k>>m;
    int total=(n-m+1)*Power(k,n-m)%mod;
    bool check=false;
    for(int i=1;i<=m;i++)
    {
        cin>>a[i];
        if(have[a[i]]) check=true;
        have[a[i]]=1;
    }
    bool colorful=false;
    for(int i=1;i<=m-k+1;i++)
    {
        bool ok=true;
        for(int j=1;j<=k;j++) have[j]=0;
        for(int j=i;j<=i+k-1;j++) have[a[j]]=1;
        for(int j=1;j<=k;j++) if(!have[j]) ok=false;
        if(ok) colorful=ok;
    }
    if(colorful) return cout<<total,0;
    dp[0][0]=1;
    for(int j=0;j<k;j++) sum[0][j]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<k;j++)
        {
            (dp[i][j]+=dp[i-1][j-1]*(k-j+1)%mod)%=mod;
            (dp[i][j]+=sum[i-1][k-1]-sum[i-1][j-1]+mod)%=mod;
            sum[i][j]=(sum[i][j-1]+dp[i][j])%mod;
        }
    }
    if(!check)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<k;j++)
            {
                if(j>=m) f[i][j]=dp[i][j];
                (f[i][j]+=f[i-1][j-1]*(k-j+1)%mod)%=mod;
                (f[i][j]+=sum[i-1][k-1]-sum[i-1][j-1]+mod)%=mod;
                sum[i][j]=(sum[i][j-1]+f[i][j])%mod;
            }
        }
        int sub=sum[n][k-1]*gt[k-m]%mod*igt[k]%mod;
        return cout<<(total-sub+mod)%mod,0;
    }
    int lsame,rsame;
    memset(have,0,sizeof have);
    for(int i=1;i<=m;i++)
    {
        if(have[a[i]])
        {
            lsame=i;
            break;
        }
        have[a[i]]=1;
    }
    memset(have,0,sizeof have);
    for(int i=m;i>=1;i--)
    {
        if(have[a[i]])
        {
            rsame=i;
            break;
        }
        have[a[i]]=1;
    }
    int ldiff=lsame-1;
    int rdiff=m-rsame;
    int div=igt[k]*gt[k-ldiff]%mod*igt[k]%mod*gt[k-rdiff]%mod;
    int sub=0;
    for(int i=1;i<=n-m+1;i++)
    {
        int l=i,r=i+m-1;
        vector<pii>way(2);
        vector<int>ans;
        way[0]=(mp(l,lsame));
        way[1]=mp(n-r+1,n-rsame+1);
        for(auto&x:way)
        {
            int start=x.fi;
            int en=x.se;
            en--;
            int now=0;
            for(int j=start;j>=1;j--)
            {
                int num=en-j+1;
                if(num>=k) break;
                (now+=dp[en][num])%=mod;
            }
            ans.push_back(now);
        }
        (sub+=ans[0]*ans[1]%mod)%=mod;
        lsame++;
        rsame++;
    }
    sub=(sub*div)%mod;
    cout<<(total-sub+mod)%mod;
}


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

using namespace std;

int main() {
    long long a,b,k;
    cin >> a >> b >> k;
    a -= k;
    if (a < 0) {
        b += a;
        a = 0;
        if (b < 0) b = 0;
    }

    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  string S,T;
  cin>>S>>T;
  string ans;
  for(int i=0;i<N;i++){
    ans.push_back(S[i]);
    ans.push_back(T[i]);
  }
cout<<ans<<endl;
}


Measured memory_bytes: 256
import math

s = input().rstrip().split()

n = int(s[0])
k = int(s[1]) - 1

a = input()

block = math.ceil(n / k)
if(k == 1):
  	print(n-1)

elif(n % k == 1):
    print(block - 1)
elif(n == k + 1):
    print(1)
else:
    print(block)

Measured memory_bytes: 4724
#include <stdio.h>
#include <string.h>

int main()
{
	int n, m, max = 0;
	int sports[1000], judge[1000], vote[1000] = { 0 }, ans;
	int i, j;
	scanf("%d%d", &n, &m);
	for (i = 0;i < n;i++)
		scanf("%d", &sports[i]);
	for (i = 0;i < m;i++)
		scanf("%d", &judge[i]);
	for (i = 0;i < n;i++) {
		for (j = 0;j < m;j++) {
			if (judge[j] >= sports[i] && judge[j] != 0) {
				vote[i] += 1;
				judge[j] = 0;
			}
		}
	}
	for (i = 0;i < n;i++){
		if (max < vote[i]) {
			max = vote[i];
			ans = i+1;
		}
}
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 608
n = int(input())
nn = n
def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

import math
from collections import Counter


prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(n))+1):
  while n % i == 0:
    n /= i
    prime_count[i] += 1
if n > 1:
  prime_count[int(n)] += 1

if len(prime_count) == 0:
  print(0)
  exit()

z = 0
zz = 0
cnt = 0
for k, v in prime_count.items():
  for i in range(1, v+1):
    if nn % pow(k, i) == 0:
      cnt += 1
      nn = nn // pow(k, i)
    else:
      break

print(cnt)

Measured memory_bytes: 68376
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
#define F first
#define S second
int main()
{
    Hello
    int n;
    cin >> n;
    cout << n / 2 + (n % 2);
    return 0;
}


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


int main(){

  int N,M;
  int i;
  
  scanf("%d %d",&N,&M);

  int A[N];

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

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

  int counter;
  counter = 0;

  for(i=0; i<N; i++){
   if( A[i] < Awa/(4*(float)(M)) ){
   }
   else{
     counter += 1;
    }
   }

  if (counter >= M){
    printf("Yes");
  }

  else{
    printf("No");
  }

  return(0);

}



Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    internal static class CR
    {
        public static string GetText() { return Console.ReadLine(); }
        public static List<string> GetTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long GetLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> GetLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }
    }

    public class Program
    {
        public static long X { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            X = CR.GetLong();
            var _500CoinCount = Math.Floor((double)X / 500);
            var p1 = _500CoinCount * 1000;
            var _5CoinCount = Math.Floor((X - (_500CoinCount * 500)) / 5);
            var p2 = _5CoinCount * 5;

            return p1 + p2;
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
    scanf("%d%d%d",&a,&b,&c);
    for(int i=1;i<=100;i++)
     if(a*i%b==c){
         printf("YES\n");
         return 0;
     }
     printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

struct UnionFind{
    vector<int> parents;
    vector<int> ranks;
    vector<int> items;
    int N;

    UnionFind(int N): N(N){
        parents = vector<int>(N,-1);
        ranks = vector<int>(N,0);
        items = vector<int>(N,1);
    }

    int find(int a){
        if(parents[a] == -1)return a;
        int root = find(parents[a]);
        parents[a] = root;
        return root;
    }

    bool connect(int a, int b){
        int root_a = find(a);
        int root_b = find(b);
        if(root_a==root_b)return false;
        if(ranks[root_a]>ranks[root_b]){
            parents[root_b] = root_a;
            items[root_a] += items[root_b];
        }else if(ranks[a]<ranks[b]){
            parents[root_a] = root_b;
            items[root_b] += items[root_a];
        }else{
            parents[root_a] = root_b;
            items[root_b] += items[root_a];
            ranks[root_b]++;
        }
        return true;
    }
};

int main(){
    int N,M,K;
    cin>>N>>M>>K;
    vector<int> block(N,1);
    UnionFind friends(N);
    UnionFind both(N);
    for(int i = 0;i < M;i++){
        int a,b;cin>>a>>b;a--;b--;
        friends.connect(a,b);
        block[a]++;
        block[b]++;
    }
    for(int i = 0;i < K;i++){
        int a,b;cin>>a>>b;a--;b--;
        if(friends.find(a) == friends.find(b)){
            block[a]++;
            block[b]++;
        }
    }
    cout<<friends.items[friends.find(0)] - block[0];
    for(int i = 1;i < N;i++){
        // cout<<both.items[both.find(i)]-1 - friends[i] - block.items[block.find(i)]+1;
        cout<<" "<<friends.items[friends.find(i)] - block[i];
    }
    
}

Measured memory_bytes: 3584
using System;
using System.Collections.Generic;

namespace AOJ.Volume5
{
    public class CaesarCipher
    {
        public static int Main()
        {
            var dic = new Dictionary<char, char>();
            // ????????¨
            // ASCII????????????65(A)??????90(Z)?????§
            for(int i = 65; i <= 90; i++)
            {
                int after = i - 3;
                if (after < 65) { after += 26; }
                dic.Add((char)i, (char)after);
            }

            var input = Console.ReadLine();
            int len = input.Length;
            string answer = "";
            for(int i = 0; i < len; i++)
            {
                answer += dic[input[i]];
            }
            Console.WriteLine(answer);
            return 0;
        }
    }
}

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


bool is_oddstr(string s, int n)
{
    if(n % 2 != 0){
        return false;
    }

    int half = n / 2;
    string s1 = s.substr(0, half);
    string s2 = s.substr(half, half);

    //cerr << s1 << s1.size() << endl;
    //cerr << s2 << s2.size() << endl;

    if(s1 == s2){
        return true;
    }
    return false;
}

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

    for(int i=s.size()-2; i>1; i--){
        if(is_oddstr(s, i)){
            cout << i << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
ll M = 1e9 + 7;
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} }


int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	int a,b,c,d; cin>>a>>b>>c>>d;
	int t1 = c/b; if(c%b!=0) t1++;
	int t2 = a/d; if(a%d!=0) t2++;
	if(t1<=t2) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		solve();
	}

	private static void solve() {
		Scanner scn = new Scanner(System.in);
		int a = scn.nextInt();
		int b = scn.nextInt();
		if(a>b){
			System.out.println("a > b");
		}else if(a<b){
			System.out.println("a < b");
		}else{
			System.out.println("a == b");
		}
		scn.close();
	}

}

Measured memory_bytes: 25932
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

vector<bool> isprime;
vector<int> Era(int n) {
	isprime.resize(n, true);
	vector<int> res;
	isprime[0] = false; isprime[1] = false;
	for (int i = 2; i < n; ++i) isprime[i] = true;
	for (int i = 2; i < n; ++i) {
		if (isprime[i]) {
			res.push_back(i);
			for (int j = i * 2; j < n; j += i) isprime[j] = false;
		}
	}
	return res;
}

int main() {

	int x;
	cin >> x;

	Era(2 * x);

	int ans;
	for (int i = x; i <= 2 * x; i++) {
		if (isprime[i]) {
			ans = i;
			break;
		}
	}

	cout << ans << endl;

	return 0;

}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n; cin >> n;
    map<int, int> freq;
    rep(i, n) {
        int d;
        cin >> d;
        freq[d] ++;
    };

    vector<int> s(1e5+2,0);

    rep(i,1e5+1) {
        s[i+1] = s[i] + freq[i];
    }

    int ans = 0;
    rep(i,1e5+1) {
        if(s[i+1] == n/2) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5376