akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI2(A,B);
    print(max(A,B)*2-(A!=B?1:0));
    return 0;
}

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

int main() {
  long long N, M; cin >> N >> M;
  long long set, ans = 0;
  while ((N == 0 && M >= 4) || (N && M >= 2)) {
    if (N <= M / 2) set = N; else set = M / 2;
    ans += set;
    M -= 2 * set;
    N = M / 4, M -= 2 * N;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    A, B, _ = map(int, sys.stdin.readline().split())
    print(int((A * B) / 2))

Measured memory_bytes: 5072
#include<iostream>
#include<string>
using namespace std;
int main()
{
char str;
while(cin>>str)
{
switch(str)
{
case 'A':cout<<"T";break;
case 'T':cout<<"A";break;
case 'C':cout<<"G";break;
default:cout<<"C";
}
}
return 0;
}

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

int main(){
  double n, t, a, x, y, m, d, ans = 1;
  cin >> n >> t >> a;
  
  cin >> x;
  y = t - (x * 0.006);
  m = max(y,a)-min(y,a);
  
  for(int i = 1; i < n; i++){
    cin >> x;
    y = t - (x * 0.006);
    d = max(y,a)-min(y,a);
    if(d < m){
      m = d;
      ans = i+1;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type pair struct {
	l, r int
}

func main() {
	n, q := getInt(), getInt()
	s := []rune(getString())
	ps := make([]pair, q)
	for i := range ps {
		ps[i].l = getInt()
		ps[i].r = getInt()
	}

	cSum := make([]int, n+1)
	for i := 1; i < n; i++ {
		cSum[i+1] = cSum[i]
		if (s[i-1] == 'A') && (s[i] == 'C') {
			cSum[i+1]++
		}
	}

	for _, p := range ps {
		res := cSum[p.r] - cSum[p.l]
		fmt.Println(res)
	}
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := 200001
	sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


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

int main(){
    int N;
    string sN;
    cin>>N;
    sN=to_string(N);
    if(sN[0]=='7' || sN[1]=='7' || sN[2]=='7') cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
} 

Measured memory_bytes: 3692
#include<bits/stdc++.h> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
const int maxn=1e5+5;
inline int read(){
	int n=0,f=1;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if (c=='-') c=getchar(),f=-1;
	for(;c>='0'&&c<='9';c=getchar()) n=n*10+c-48;
	return n*f;
}
int i,j,n,a[maxn],t,x,now;ll sum;
int gcd(int x,int y){
	return (y)?gcd(y,x%y):x;
}
int main(){
	n=read();
	fo(i,1,n) a[i]=read(),sum+=a[i],t+=a[i]&1,t+=a[i]==1;
	if (!(n&1)){
		if (sum&1) puts("First");else puts("Second");
		return 0;
	}
	if (!(sum&1)) {
		puts("First");
		return 0;
	}
	if (t>1) {
		puts("Second");
		return 0;
	}
	for(;;){
		now^=1;
		fo(i,1,n) if (a[i]&1) {a[i]--;break;}
		x=a[1];
		fo(i,2,n) x=gcd(x,a[i]);
		t=sum=0;
		fo(i,1,n) a[i]/=x,sum+=a[i],t+=a[i]&1,t+=a[i]==1;
		if (!(sum&1)){
			if (!now) puts("First");else puts("Second");
			return 0;
		}
		if (t>1){
			if (now) puts("First");else puts("Second");
			return 0;
		}
	}	
}

Measured memory_bytes: 768
a, b, k= map(int, input().split())
if a+k >= b-k:
    for i in range(a, b+1):
        if i < a+k or b-i+1 <= k:
            print(i)
else:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)


Measured memory_bytes: 3060
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
int n,x,pos[110000];
int gcd(int a,int b){
  return (b==0)?a:gcd(b,a%b);
}
int main(){
  cin>>n>>x;
  for(int i=1;i<=n;i++)
    cin>>pos[i];
  for(int i=1;i<=n;i++)
    pos[i]-=x;
  ++n;
  pos[n]=0;
  sort(pos+1,pos+n+1);
  int ans=pos[2]-pos[1];
  for(int i=2;i<=n-1;i++){
    ans=gcd(ans,pos[i+1]-pos[i]);
  }
  cout<<ans;
  return 0;
}

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

#define N (1000 + 10)

#define max(a, b) (a < b ? b : a) 



int dp[N][N];
char a[N], b[N];

int LCS(void)
{
  const int a_size = strlen(a) - 1;
  const int b_size = strlen(b) - 1;
  int i,j,MAX;

  memset(dp,0,sizeof(dp));

  for(i=1;i<a_size+1;++i){
    for(j=1;j<b_size+1;++j){
      MAX = max(dp[i][j - 1],dp[i - 1][j]);
      if(a[i - 1] == b[j - 1]){
	MAX = max(MAX,dp[i - 1][j - 1]+1);
      }
      
      dp[i][j] = MAX;
    }
  }

  return dp[a_size][b_size];

}

int main(){
  
  int i,n;
  
  scanf("%d\n",&n);
  
  for(i=0;i<n;i++){
    
    fgets(a,N,stdin);
    fgets(b,N,stdin);
    printf("%d\n",LCS());
  }
  
  return 0;

}



Measured memory_bytes: 5848
k, x = map(int, input().split())
number = []
# xから前ｋ-1個、後k-1個の数をリストに加える
for i in range(x - (k - 1), x + (k - 1) + 1):
    number.append(i)
# リストの要素を文字列型に変換
number_str = [str(n) for n in number]
# リストの要素をjoinで連結
num = " ".join(number_str)
print(num)

Measured memory_bytes: 9108
package main

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

var (
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	ts  = []string{"dream", "dreamer", "erase", "eraser"}
	s   = ""
)

func main() {
	s = readLine()
	if len(s) == 0 {
		fmt.Println("NO")
		return
	}

	if rec(0) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func rec(i int) bool {
	if i == len(s) {
		return true
	}
	for _, t := range ts {
		if len(s[i:]) >= len(t) && s[i:i+len(t)] == t {
			if rec(i + len(t)) {
				return true
			}
		}
	}
	return false
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		pnc(e)
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func pnc(err error) {
	if err != nil {
		panic(err)
	}
}


Measured memory_bytes: 5596
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;

int num[2005];

int main(){
	int n;
	int z,w;
	scanf("%d%d%d", &n, &z, &w);
	for(int i = 0 ; i < n; i++){
		scanf("%d", &num[i]);
	}
	int ans;
	if(n == 1){
		ans = abs(num[0] - w);
	}
	else{
		ans = max(abs(num[n-2]-num[n-1]), abs(num[n-1]-w));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int K;
    string S;
    string S_ = "";
    cin >> K >> S;
    if(S.size() > K){
        for(int i=0; i<K; i++)
            S_ += S[i];
        
        S_ += "...";
    }
    
    else
        S_ = S;
        
    cout << S_;
}

Measured memory_bytes: 3624
#include<stdio.h>
#define N 100*2

int main()
{
  int l,A[N],i,v,j,k;
  
  scanf ("%d",&l);

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



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

int PrimeNum(int n) {
	for (int i = n;; ++i) {
		for (int j = 2; j < i; ++j) {
			if (!(i%j)) break;
			if (j + 1 == i) return i;
		}
	}
}

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

	if (X == 2) cout << 2 << endl;
	else cout << PrimeNum(X) << endl;
}

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

int main(void){
    int a, b, c, f = 0;
    cin >> a >> b >> c;
    
    for(int x = a; x <= b; x++){
        if(c % x == 0)  f++;
    }
    
    cout << f << endl;
    
    return 0;
}


Measured memory_bytes: 3104
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	waters := getIntSlice(2)
	waters[0], waters[1] = waters[0]*100, waters[1]*100
	sugars := getIntSlice(2)
	e, f := getInt(), getInt()

	// dp[砂糖水] = 砂糖
	dp := make([]int, f+1)
	for i := range dp {
		dp[i] = -1
	}
	dp[0] = 0

	for i := range dp {
		if dp[i] == -1 {
			continue
		}
		for j := range waters {
			if i+waters[j] <= f {
				dp[i+waters[j]] = max(dp[i+waters[j]], dp[i])
			}
		}

		for j := range sugars {
			if w := (i - dp[i]) / 100; (dp[i]+sugars[j] <= e*w) && (i+sugars[j] <= f) {
				dp[i+sugars[j]] = max(dp[i+sugars[j]], dp[i]+sugars[j])
			}
		}
	}

	sugarWater, sugar := waters[0], 0
	for i := 1; i <= f; i++ {
		nowSW := i
		nowSgr := dp[i]
		nowWtr := nowSW - nowSgr

		if (nowWtr == 0) || (nowSgr == -1) {
			continue
		}

		if nowSgr*sugarWater > sugar*nowSW {
			sugarWater = nowSW
			sugar = nowSgr
		}
	}

	fmt.Println(sugarWater, sugar)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
<?php
$S=trim(fgets(STDIN));
$Q=trim(fgets(STDIN));
for($I=0;$I<$Q;$I++){
  $C=explode(' ',trim(fgets(STDIN)));

  if($C[0][2]=='i'){
    $p='';
    for($i=$C[1];$i<=$C[2];$i++) $p.=$S[$i];
    echo $p,PHP_EOL;
    continue;
  }
  if($C[0][2]=='v'){
    $l=$C[1]+(($C[2]+1-$C[1])>>1);
    for($i=$C[1];$i<$l;$i++){
      $j=$C[1]+$C[2]-$i;
      $s=$S[$j];
      $S[$j]=$S[$i];
      $S[$i]=$s;
    }
    continue;
  }
  for($i=$C[1];$i<=$C[2];$i++) $S[$i]=$C[3][$i-$C[1]];
}

Measured memory_bytes: 15524
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($A,$B) =  explode(" ",trim(fgets(STDIN)));
$H = explode(" ",trim(fgets(STDIN)));

$mv = 0;
$res=0;
for($i=1;$i<$N;$i++) {
  if ($H[$i-1]>=$H[$i]) {
    $mv++;
  }
  else {
    $res = max($mv,$res);
    $mv=0;
  }
}
if ($mv > 0) {
  $res = max($mv,$res);
}
printf("%d\n",$res);


Measured memory_bytes: 14840
n = int(input())
w = list(map(int,input().split()))
s = 0
for i in range(n):
    s = s + w[i]
    
s1 = 0
s2 = 0
ans = 100 * 100

for i in range(n): #i[0,1,2]
    #for j in range(0,i + 1):
    s1 += w[i]
        
    s2 = s - s1
    if(ans > abs(s1 -s2)):
        ans = abs(s1 - s2)
        
print(ans) 

Measured memory_bytes: 3064
N,M,X,Y = map(int,input().split())
x = [_ for _ in map(int,input().split())]
y = [_ for _ in map(int,input().split())]
Z = [z for z in range(-100,101)]
x.sort(reverse=True)
y.sort()
num = 0

for z in Z:
    if X<z and z<=Y:
        if x[0]<z and y[0]>=z:
            print('No War')
            num += 1
            break
    else:
        continue
if num == 0:
    print('War')


Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int d = in.nextInt();
            if (Math.abs(a - c) <= d) {
                out.println("Yes");
                return;
            }
            if (Math.abs(a - b) <= d && Math.abs(c - b) <= d)
                out.println("Yes");
            else
                out.println("No");

        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufLength == -1)
                throw new InputMismatchException();
            if (bufPointer >= bufLength) {
                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (bufLength == -1)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

        public long nextLong() {
            long n = 0;

            boolean minus = false;
            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || b > '9')
                throw new NumberFormatException();

            while (true) {
                if (b >= '0' && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (isSpaceChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}



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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1000000007ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll inf = 1ll << 60;



int main() {
    char s[100005];
    scanf("%s", s);
    int n = strlen(s);
    vector<vector<ll>> dp(100005, vector<ll>(13));
    dp.at(0).at(0) = 1ll;
    int m = 1;
    rp(i, 0, n) {
        if(s[n-1-i] == '?') {
            rp(k, 0, 10) { //?にkを入れた場合
                rp(j, 0, 13) {
                    dp.at(i+1).at((j+m*k) % 13) += dp.at(i).at(j);
                    dp.at(i+1).at((j+m*k) % 13) %= mod;
                }
            }
        } else {
            int l;
            l = s[n-1-i] - '0';
            rp(j, 0, 13) {
                dp.at(i+1).at((j+l*m)%13) += dp.at(i).at(j);
                dp.at(i+1).at((j+l*m)%13) %= mod;
            }
        }
        m = (m*10)%13;
    }
    printf("%lld", dp.at(n).at(5));
    return 0;
}


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

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll c = (a + b);
    ll ans = a*(n/c);
    ans += min(n%c, a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
ll a[int(2*1e5)+100]; 
int main() {
	int n;
	cin >> n;
	rep(i,n) cin >> a[i];
	
	map<ll,ll> d;
	d[0] = 1;

	ll sum = 0;
	set<ll> s;
	s.insert(0);
	rep(i,n) {
		sum += a[i];
		s.insert(sum);
		d[sum]++;
	}

	ll ans = 0;
	for (auto itr = s.begin(); itr != s.end(); itr++) {
		ll i = *itr;
		ans += d[i] * (d[i]-1) / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 27072
N = int(input())
H = list(map(int, input().split()))

ans = 0
t_ans = -1
height = float('inf')
for i in H:
    if i <= height:
        t_ans += 1
        height = i
    else:
        ans = max(ans, t_ans)
        t_ans = 0
        height = i
print(max(ans, t_ans))


Measured memory_bytes: 14224
import bisect
n,W=map(int,input().split())
w=[0]*n
v=[0]*n
for i in range(n):
  w[i],v[i]=map(int,input().split())
V=sum(v)
INF=10**10
G=[[INF]*(V+3) for i in range(n+1)]
for i in range(1,n+1):
  for j in range(V+3):
    if j-v[i-1]<0:
      G[i][j]=min(G[i-1][j],w[i-1])
    else:
      G[i][j]=min(G[i-1][j],G[i-1][j-v[i-1]]+w[i-1])
A=G[n][0:V+3]
print(bisect.bisect_right(A,W,lo=0,hi=len(A)))

Measured memory_bytes: 120428
#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;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  int ans=0,cnt=0;
  rep(i,32){
    rep(j,n){
      if(a[j]%2==0){
        cnt++;
        a[j]/=2;
      }
    }
    if(cnt==n) ans++;
    cnt=0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int main()
{
  string line;
  vector<int> v;
  int x;
  int i = 1;
  while (1)
  {
    getline (cin,line);
    stringstream(line) >> x;
    if ( x == 0 ) break;
    v.push_back(x);
  }
  for ( auto a: v )
  { cout << "Case " << i++ << ": " << a << '\n'; }
  return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << b+c-d << " " << -a+c+d << " " << a+b-d << " " << -a+b+c << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    int a[200];
    int max,min;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    max=a[0];min=a[0];
    for(int i=1;i<n;i++){
        if(a[i]>max) max=a[i];
        if(a[i]<min) min=a[i];
    }
    cout <<max-min<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/
bool all_string(string s){
  int sz = s.size();
  rep(i, sz-1){
    if(s.at(i)!=s.at(i+1)) return false;
  }
  return true;
}

int main(){
  string s;
  cin >> s;
  int sz = s.size();
  char m;
  string t = "";
  string p = s;
  int i;
  int ch = 0;
  int ans = 0;
  if(all_string(p)) cout << 0 << endl;
  else{
    for(m='a'; m<='z'; ++m){
    while(!(all_string(p))){
    int szt = p.size();  
    //cout << szt << endl;
    for(i=0; i<szt-1; i++){
      if(m==p.at(i)||m==p.at(i+1)) {t = t + m; ch = 1;}
      else t = t+p.at(i);
    }
    //cout << t << endl;
    if(ch==0) {p=s; t=""; break;}
    else {p = t; t = "";}
    }
    if(ch==1){
    ch = 0;
    int l = p.size();
    ans = max(ans, l);
    t = ""; p = s;}
  }
  cout << sz-ans << endl;
  //string t = s;
  //sort(t.begin(), t.end());
  }

  //int ch = all_string(s, sz);
  //cout << ch << endl;
}



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

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> a(N), color(9,0);
    for(int i=0; i<N; i++){
        cin >> a[i];
        if(1<=a[i] && a[i]<=399)
            color[0]++;
        else if(400<=a[i] && a[i]<=799)
            color[1]++;
        else if(800<=a[i] && a[i]<=1199)
            color[2]++;
        else if(1200<=a[i] && a[i]<=1599)
            color[3]++;
        else if(1600<=a[i] && a[i]<=1999)
            color[4]++;
        else if(2000<=a[i] && a[i]<=2399)
            color[5]++;
        else if(2400<=a[i] && a[i]<=2799)
            color[6]++;
        else if(2800<=a[i] && a[i]<=3199)
            color[7]++;
        else if(3200<=a[i] && a[i]<=4800)
            color[8]++;
    }
    
    int cnt=0;
    for(int i=0; i<8; i++){
        //cout << color[i] << endl;
        if(color[i]>0)
            cnt++;
    }
    if(color[8]==N)
        cout << 1 <<" "<< color[8] << endl;
    else
        cout << cnt <<" "<< cnt+color[8] << endl;
    
    
}


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

#define SQ(X) \
  ( (X) * (X) )

int
main (
  int   argc,
  char *argv[ ]
  )
{
  double x1, y1, x2, y2;

  scanf ( "%lf%lf%lf%lf", &x1, &y1, &x2, &y2 );
  printf ( "%.4f\n", sqrt ( SQ( x2 - x1 ) + SQ( y2 - y1 ) ) );

  return ( 0 );
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <algorithm>
#include <fstream>
#define mp make_pair
#define Debug(...) fprintf(stdout, __VA_ARGS__)

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;

const int MAXN = 5e3 + 7;
const int MOD = 1e9 + 7;

inline void proc_status() {
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline T read() {
	T res = 0, flag = 1; char in = getchar();
	while(!isdigit(in)) { if(in == '-') flag = -1; in = getchar(); }
	while(isdigit(in)) { res = (res << 1) + (res << 3) + in - '0'; in = getchar(); }
	return res * flag;
}

template<typename T> inline void chkmax(T &a, T b) { if(a < b) a = b; }
template<typename T> inline void chkmin(T &a, T b) { if(a > b) a = b; }

inline void Add(int &x, int y) { x += y; if(x >= MOD) x -= MOD; }

int n;
int siz[MAXN];
int g[MAXN], tmp[MAXN], f[MAXN][MAXN];
int dex, head[MAXN], nxt[MAXN << 1], to[MAXN << 1];

inline void Link(int x, int y) { nxt[++dex] = head[x]; to[dex] = y; head[x] = dex; }

void dfs(int u, int fa) {
	f[u][1] = siz[u] = 1;
	for(int e = head[u]; e; e = nxt[e]) {
		int v = to[e];
		if(v == fa) continue;
		dfs(v, u);
		int tp = siz[u] + siz[v];
		for(int i = 0; i <= tp; ++i) tmp[i] = 0;
		for(int i = 1; i <= siz[u]; ++i) {
			for(int j = 0; j <= siz[v]; ++j) {
				Add(tmp[i + j], (LL) f[u][i] * f[v][j] % MOD);
			}
		}
		for(int i = 1; i <= tp; ++i) f[u][i] = tmp[i];
		siz[u] = tp;
	}
	for(int i = 1; i <= siz[u]; ++i) {
		Add(f[u][0], MOD - (LL) g[i] * f[u][i] % MOD);
	}
}


inline void init() {
	n = read<int>();
	for(int i = 1; i < n; ++i) {
		int x = read<int>();
		int y = read<int>();
		Link(x, y); Link(y, x);
	}
	g[0] = 1;
	for(int i = 2; i <= n; i += 2) g[i] = (LL) g[i - 2] * (i - 1) % MOD;
}

inline void solve() {
	dfs(1, 0);
//	for(int i = 1; i <= n; ++i) {
//		printf("In Node %d | %d	\n", i, siz[i]);
//		for(int j = 0; j <= 10; ++j) {
//			printf("%d ", f[i][j]);
//		}
//		cout << endl;
//	}
	printf("%d\n", (MOD - f[1][0]) % MOD);
}

int main() {

	init();
	solve();

	return 0;
}



Measured memory_bytes: 97280
#include <iostream>
using namespace std;
int main()
{
  int n,x,ans[10000];
  for(int i=0; ;i++)
  { cin>>n>>x;
    if(n==0 && x==0)break;
    ans[i]=0;
  for(int a=1;a<n-1;a++){
    for(int b=a+1;b<n;b++){
      for(int c=b+1;c<n+1;c++){
        if(a+b+c==x)ans[i]+=1;
      }
    }
  }
  cout<<ans[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 3096
#pragma region template

#include <bits/stdc++.h>
using namespace std;

// -type-
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vpii = vector<pii>;
using vpll = vector<pll>;


// -const-
const ll MOD = 1000000007;

const ll INF = (ll)0x3f0000003f000000;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1},
          dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


// -define-
#define reps(i, k, n) for (int i = (k), i##_len = (n); i < i##_len; ++i)
#define rep(i, n) reps(i, 0, n)
#define repsr(i, k, n) \
    for (int i = int(n) - 1, i##_len = (k); i >= i##_len; --i)
#define repr(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(o) begin(o), end(o)
#define sz(a) ((int)(a).size())
#define debug(...) debug_args(__LINE__, __VA_ARGS__)


// clang-format off
// -functions-
inline bool in(string s, string c) {return (s.find(c) != string::npos);}
inline bool in(string s,   char c) {return (s.find(c) != string::npos);}

template <class T> T udiv(T a, T b) {return (a + b - 1) / b;}
template <class T> T rdiv(T a, T b) {return (a + b / 2) / b;}

void print_args(ostream&) {}
template <class S, class... T>
void print_args(ostream& out,const S& a,const T&... args) {
    out << ' ' << a;
    print_args(out, args...);
}
template <class S, class... T>
void print(const S& a, const T&... args) {
    std::cout << a;
    print_args(std::cout, args...);
    std::cout << '\n';
}
template <class S, class... T>
void debug_args(const S& a, const T&... args) {
    std::cout << "(L:" << std::setw(3) << a << ")";
    print_args(std::cout, args...);
    std::cout << '\n';
}
// clang-format on

struct setup_main {
    setup_main() {
        std::cin.tie(0);
        std::ios::sync_with_stdio(0);
        std::cout << fixed << setprecision(15);
    }
} setup_main_;

ll ans = 0;
#pragma endregion

signed main() {
    long long N;
    scanf("%lld", &N);
    long long W;
    scanf("%lld", &W);

    vvl dp(N + 1, vl(W + 1, 0));
    long long w;
    long long v;

    reps(i, 0, N) {
        scanf("%lld", &w);
        scanf("%lld", &v);
        for (int wi = 0; wi <= W; wi++) {
            dp[i + 1][wi] = max(dp[i + 1][wi], dp[i][wi]);
            if (wi - w >= 0) {
                dp[i + 1][wi] = max(dp[i + 1][wi], dp[i][wi - w] + v);
            }
        }
    }

    rep(i, W + 1) ans = max(ans, dp[N][i]);

    print(ans);
}


Measured memory_bytes: 80256
#include<stdio.h>
#define N 36
struct Card{
  char suit;
  char value;
};

main(){
  struct Card R1[N], R2[N],key;
  int i,j,y,f,l=0,mini;
  scanf("%d",&y);
  for(i=0;i<y;i++){
    scanf(" %c%c",&R1[i].suit,&R1[i].value);
  }
  for(i=0;i<y;i++){
    R2[i]=R1[i];
  }

  /*B*/
  for(i=0;i<y;i++){
    for(j=y-1;j>i;j--){
      if(R1[j].value<R1[j-1].value){
	key=R1[j];
	R1[j]=R1[j-1];  
	R1[j-1]=key;
      }
    }
  }
 for(i=0;i<y-1;i++){
   printf("%c%c ",R1[i].suit,R1[i].value);
 }
 printf("%c%c\n",R1[i].suit,R1[i].value);
 printf("Stable\n");

 /*S*/ 
 for(i=0;i<y;i++){
    mini=i;
    f=0;
    for(j=i+1;j<y;j++){
      if(R2[j].value==R2[mini].value) f=1;
      if(R2[j].value<R2[mini].value){
	mini=j;
	if(f==1) l=1;
      }
    }
    if(mini!=i){
    key=R2[i];
    R2[i]=R2[mini];
    R2[mini]=key;
    }
  }
 for(i=0;i<y-1;i++){
   printf("%c%c ",R2[i].suit,R2[i].value);
 }
 printf("%c%c\n",R2[i].suit,R2[i].value);
 if(l==1) printf("Not stable\n"); 
 else
   printf("Stable\n");
  return 0;
}

Measured memory_bytes: 608
def main():
    """
    Si: '1' to '9'
    1 <= |S| <= 100
    1 <=  K  <= 10^18

    5000兆: 5_000_000_000_000_000
        5 * 10^15
    """
    S = input()
    K = int(input())
    ans = f(S, K)
    print(ans)


def f(S, K):
    """
    10^18 <<<<<<<<<<<< 2^(5 * 10^15)
    """
    ans = "1"
    for i, c in enumerate(S, 1):
        if c != "1":
            return c
        elif i == K:
            return "1"

    return ans


def NG(S, K):
    """
    1: 不変
    2: 2^d
        day0: 2
        day1: 22
        day2: 2222
        day3: 22222222
    """
    import datetime
    day = 5 * (10 ** 15)
    ls = {1: 1}
    for i in range(2, 9+1):
        ls[i] = i ** day
        print(i, datetime.datetime.now())

    idx = 1
    for c in S:
        idx += ls[c]
        if idx >= K:
            return c


if __name__ == '__main__':
    main()


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

typedef long long lo;
typedef pair<lo,lo> ll;//pair
typedef vector<lo> vl;  //vector of long
typedef vector<ll > vll;   //vector of pair
typedef priority_queue<lo>p_q;
#define mp(a,b) make_pair((a),(b))
#define REP(a,b) for(lo i=(a);i<(b);i++)//no need to declare variable i
 
#define REP2(a,b) for(lo j=(a);j<(b);j++)
#define REPE(a,b,c,d) REP(a,b)for(lo j=(c);j<(d);j++)//no need to declare vaiables i,j
#define REPV(a,b,c) for(lo (a)=b;(a)<(c);(a)++)//a is the variable
#define IREP(a,b) for(lo i=(a);i>=(b);i--)
#define IREPV(a,b,c) for(lo (a)=b;(a)>=(c);(a)--)
#define all(v) (v).begin(),(v).end()
#define TRvl(c) for (vl::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvll(c) for (vll::iterator it = (c).begin(); it != (c).end(); it++)
#define INF INT_MAX
#define gc getchar_unlocked
#define pc putchar_unlocked3
#define pb(a) push_back((a))
#define sz(x) x.size()
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define F first
#define S second


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

string lala(lo n){
      string s(3,0);
      if(n<100 and n>9){
            s[0]='0';
            s[1]=char(48+(n/10)%10);
            s[2]=char(48+(n%10));
      }
      if(n<10){
            s[0]=s[1]='0';
            s[2]=char(48+n%10);
      }
      if(n>99){
            s[0]=char(48+(n/100)%10);
           s[1]=char(48+(n/10)%10);
            s[2]=char(48+(n%10));
      }
      //cout<<s<<endl;
      return s;
}

lo check(lo n, string s){
      string me = lala(n);
      //cout<<me<<endl;
      lo flag=0,j=0;
      REP(0,sz(s)){
            if(me[j]==s[i]){
                  j++;
            }
            if(j>=3){
                  
                  flag=1;
                  break;
            }
      }
      if(flag){return 1;}
      return 0;
}

void solve(){
    lo n;
    string s;
    cin>>n>>s;
    lo ans=0;
    REP(0,1000){
          ans+=check(i,s);
    }
    cout<<ans;
}
 
 






 
 
 
int main(){
{ 
      
	flash

}	
// 	lo t;
// 	cin>>t;
// 	while(t--)
		solve();
 
 
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll a,b,x;
    cin >> a >> b >> x;
    ll vol = a*a*b;
    double theta=0;
    double res = 0;
    double pi = 2*acos(0);
    if(vol/2.0<=(double)x){
        // 水筒にたくさん水が入っている場合
        // cout << "test1" << endl;
        double remain = (double(vol-x))/((double)a*a/2.0);
        res = atan2((double)remain, (double)a);
        res = res *(180.0/pi);
    }else{
        // 水筒にあまり水が入っていない場合
        // cout << "test2" << endl;
        res = atan2((double)x*2/(double)(a*b), (double)b);
        res = 90.0 - res *(180.0/pi);
    }
    cout << setprecision(10) << res << endl;
}

Measured memory_bytes: 512
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

k, s = inpl()
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z and z <=k:
            ans += 1
print(ans)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

map<int, int> PrimeFactor(int n) {
    map<int, int> res;
    for(int i = 2; i * i <= n; ++i) {
        while(n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if(n != 1) { res[n] = 1; }
    return res;
}

ll N, P;

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

    map<int, int> ret = PrimeFactor(P);
    ll ans = 1;
    for(auto& r : ret) {
        if(r.second >= N) {
            REP(i, r.second / N) {
                ans *= r.first;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main( )
{
     ll N;
     cin>>N;
     if(N%2 == 1){
         cout<<"0"<<endl;
     }
     else{
         ll cnt=0;
         N /= 2;
         for(ll i=5;(N/i)>=1;i *= 5){
             cnt += (N/i);
         }
         cout<<cnt<<endl;
     }
}

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

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define endl "\n"
#define all(V) V.begin( ), V.end( )
#define Unique(V) sort( all( V ) ), V.erase( unique( all( V ) ), V.end() )
#define Check( N , p ) ( !( ( N & ( 1LL << p ) ) == 0 ) )
#define ON( N , p ) ( N = N | ( 1LL << p ) )
#define OFF( N , p ) ( N = N & ~( 1LL << p ) )
std::mt19937 rng( chrono::steady_clock::now().time_since_epoch().count() );
#define rnd(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
#define ran(a, b) rng() % ( (b) - (a) + 1 ) + (a)
#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template < typename Arg1 >
void __f( const char* name , Arg1&& arg1 ) { cerr << name << " : " << arg1 << "\n"; }
template < typename Arg1 , typename... Args >
void __f( const char* names , Arg1&& arg1 , Args&&... args ) {
const char* comma = strchr( names + 1 , ',' );
cerr.write( names , comma - names ) << " : " << arg1 << " , " ; __f( comma + 1 , args... ); }
typedef long long int LL;
typedef pair <int,int> pii;
typedef pair <long long,long long> pll;
const int MOD = 1e9 + 7;
const double EPS = 1e-8;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;


int main( int argc , char const *argv[] ) {
        ios_base::sync_with_stdio( false ); cin.tie( nullptr );
        int n , m;
        cin >> n >> m;
        map <int,int> M;
        for( int i = 1; i <= n; i++ ) {
                int k;
                cin >> k;
                for( int j = 1; j <= k; j++ ) {
                        int val;
                        cin >> val;
                        M[val]++;
                }
        }
        int ans = 0;
        for( auto x : M ) {
                if( x.second == n ) ans++;
        }
        cout << ans << endl;
        return 0;
}














Measured memory_bytes: 256
s = int(input())

an = 0
list = []

for i in range(1, 1000001):
    if i == 1:
        an = s
        list.append(an)

    elif an % 2 == 0:
        an = an/2
        list.append(an)

    else:
        an = 3 * an + 1
        list.append(an)

    for j in range(len(list)-1):
        if list[j] == an:
            print(i)
            break
        else:
            continue
    else:
        continue
    break

Measured memory_bytes: 3064
from math import sqrt

# C-Digits in Multiplication
# 問題URl:http://abc057.contest.atcoder.jp/tasks/abc057_c

N = int(input())
F = 999;
for i in range(1,int(sqrt(N))+1):
    
    if N%i == 0: #余りが0 = iは整数なので整数同士の割り算ということ(余りを求める際には少数まで商を求めない）
        F =  min(F , max( len(str(i)) , len(str(N//i)) ) )
print(F)
        

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
bool isprime(int n){
	for(int i=2;i*i<=n;i++){
		if(n%i==0) return false;
	}
	return true;
}

signed main(){
	int a,b;
	cin>>a>>b;
	int g=gcd(a,b);
	
	vi yaku;
	for(int i=1;i*i<=g;i++){
		if(g%i==0){
			yaku.pb(i);
			if(i*i!=g) yaku.pb(g/i);
		}
	}
	sort(all(yaku));


	// cout<<"g="<<g<<endl;
	int ans=0;
	for(auto p:yaku){
		if(p==1||isprime(p)){
			ans++;
			// cout<<p<<endl;
		}
	}
	cout<<ans<<endl;



	return 0;
}



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



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


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

int main(){
    int a ,b;
    cin >> a >>b;
    
    if(a > b){
        cout<<"a > b"<< endl;
    }else if(a < b){
        cout<<"a < b" << endl;
    }else{
        cout<< "a == b" << endl;
    }
    
}


Measured memory_bytes: 3100
#include<stdio.h>
#include <iostream>
#include <string.h>
#include <cstdlib>
 
using namespace std;
 
#define BUF_SIZE 1024
 
struct Node{
    int data;
    Node* prev;
    Node* next;
};
 
class ConnectedList{
public:
    ConnectedList(){
        motherNode = new Node();
        motherNode->data = -1;
        motherNode->prev = motherNode;   
        motherNode->next = motherNode;
    };
    ~ConnectedList(){
        Node* tmpNode = motherNode->next;
        Node* nextNode;
        while(tmpNode != motherNode){
            nextNode = tmpNode->next;
            delete tmpNode;
            tmpNode = nextNode;
        }
        delete motherNode;
    };
    void insertNode(int x){
        Node* tmpNode = motherNode->next;
        motherNode->next = new Node();
        motherNode->next->data = x;
        motherNode->next->next = tmpNode;
        motherNode->next->prev = motherNode;
        tmpNode->prev = motherNode->next;
    };
    void deleteNode(int x){
        Node* tmpNode = motherNode->next;
        while(tmpNode != motherNode && tmpNode->data != x){
            tmpNode = tmpNode->next;
        }
        if(tmpNode != motherNode){  
            tmpNode->prev->next = tmpNode->next;
            tmpNode->next->prev = tmpNode->prev;
            delete tmpNode;
        }
    };
 
    void deleteFirst(){
        Node* tmpNode = motherNode->next;
        motherNode->next = motherNode->next->next;
        motherNode->next->prev = motherNode;
        delete tmpNode; 
    };
 
    void deleteLast(){
        Node* tmpNode = motherNode->prev;
        motherNode->prev = motherNode->prev->prev;
        motherNode->prev->next = motherNode;
        delete tmpNode; 
    };
 
    void showList(){
        Node* tmpNode = motherNode->next;
        printf("%d",tmpNode->data);
        tmpNode = tmpNode->next;
        while(tmpNode != motherNode){
            printf(" %d",tmpNode->data);
            tmpNode = tmpNode->next;
        }
        printf("\n");
    }
 
private:
    Node* motherNode;
};
 
 
int main(){
 
    char buf[BUF_SIZE];
    int n = atoi(fgets(buf,BUF_SIZE,stdin));
 
    ConnectedList list;
 
    for(int i = 0; i < n; i++){
 
        fgets(buf,BUF_SIZE,stdin);
 
        if(buf[6] == 'F'){
            list.deleteFirst();
        }else if(buf[6] == 'L'){
            list.deleteLast();
        }else{
            int S = 0;
             
            if(buf[0] == 'i'){  //insert x
 
                for(int i = 0; buf[i] != '\0';i++){
                    if(buf[i] >= '0' && buf[i] <= '9'){
                        S = 10*S + (buf[i] - '0');
                    }
                }
                list.insertNode(S);
            }else{  
                for(int i = 0;buf[i] != '\0';i++){
                    if(buf[i] >= '0' && buf[i] <= '9'){
                        S = 10*S + (buf[i] - '0');
                    }
                }
                list.deleteNode(S);
            }
 
        }
 
    }
 
    list.showList();
 
}


Measured memory_bytes: 34468
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


class DisjointSet {
    public:
        DisjointSet(int n) : pars(n, -1), N(n), sz(n) {
        }
        int find(int x) {
            return pars[x] < 0 ? x : (pars[x] = find(pars[x]));
        }
        bool unite(int x, int y) {
            x = find(x);
            y = find(y);
            if (x == y) {
                return false;
            }
            if (pars[x] < pars[y]) {
                swap(x, y);
            }
            pars[y] += pars[x];
            pars[x] = y;
            --sz;
            return true;
        }

        int size() { return sz; }
    private:
        int N;
        int sz;
        vector<int> pars;
};


class Solution {
public:
    int solve(int n, vector<int>& X, vector<int>& Y, vector<int>& Z) {
        DisjointSet ds(n);

        int m = X.size();
        for (int i = 0; i < m; ++i) {
            if ((Z[i] & 1) == 0) {
                int u = X[i], v = Y[i];
                ds.unite(u, v);
            }
        }

        map<int,int> MP;
        int idx = 0;
        vector<int> indices(n, -1);
        for (int i = 0; i < n; ++i) {
            int s = ds.find(i);
            if (MP.count(s) == 0) {
                MP[s] = idx;
                indices[i] = idx;
                ++idx;
            } else {
                indices[i] = MP[s];
            }
        }

        int N = idx;
        DisjointSet ds2(N);
        for (int i = 0; i < m; ++i) {
            if (Z[i] & 1) {
                int u = X[i], v = Y[i];
                u = indices[u], v = indices[v];
                assert(u != v);
                ds2.unite(u, v);
            }
        }

        return ds2.size();                
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    vector<int> X(m);
    vector<int> Y(m);
    vector<int> Z(m);
    for (int i = 0; i < m; ++i) {
        cin >> X[i] >> Y[i] >> Z[i];
        --X[i], --Y[i];
    }
    Solution sol;
    cout << sol.solve(n, X, Y, Z) << "\n";

    return 0;
}

Measured memory_bytes: 7296
K = gets.chomp.to_i               # 単一整数
S = gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
 
K.freeze
S.freeze
 
wk = S[0...K]
nagasa = S.length

if nagasa <= K then
  puts S
else
  puts wk.to_s + "..." 
end

Measured memory_bytes: 14268
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef long long ll;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int i,j,k;
int n;
long long int w;
int items[int(1e3)];
int values[int(1e3)];

long long int cache[int(1e5)+500];
long long int maxv=0;



int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);

    cin >> n >> w;

    for(i=1;i<=n;i++){
        cin >> items[i] >> values[i]; 
        maxv+=values[i];
    }
    for(i=0;i<int(1e5)+30;i++){
        cache[i] = (long long int)1e13;   
    }
    cache[0] = 0;

    for(int item = 1; item <=n ;item++){
        for(int ind = maxv;ind>=values[item];ind--){
            cache[ind] = min(cache[ind],cache[ind-values[item]]+items[item]);
        }
    }

    for(int i = maxv ; i>=0 ;i--){
        if(cache[i] <= w ){
            cout << i << endl;
            break;
        }
    }
    return 0;


}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
template<class TT>inline void read(TT &xx)
{
	xx=0;char cc=getchar();bool ff=false;
	while(cc<'0'||cc>'9'){if(cc=='-')ff=true; cc=getchar();}
	while(cc>='0'&&cc<='9'){xx=(xx<<3)+(xx<<1)+cc-'0';cc=getchar();}
	if(ff) xx=-xx;
}
int n,a[200105],tmp;
long long ans=0;
int main()
{
   read(n);
   for(int i=1;i<=n;i++)read(a[i]);
   for(int i=1;i<=n;i++)
   {
      if(tmp>=a[i]) ans+=tmp-a[i];
      else tmp=a[i];
   }
   printf("%lld\n",ans);
   return 0;
}


Measured memory_bytes: 4428
#include<cstdio>
#include<vector>

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

using namespace std;

typedef	vector<int>	vi;

int main(){
	const int Ne=30100;
	static bool er[Ne+1]; er[0]=er[1]=true;
	for(int i=2;i*i<=Ne;i++) if(!er[i]) for(int j=i*i;j<=Ne;j+=i) er[j]=true;
	vi p; rep(i,Ne+1) if(!er[i]) p.pb(i);

	for(int len;scanf("%d",&len),len;){
		int cnt=0;
		rep(j,p.size())rep(i,j+1){
			int a=p[i],b=p[j],c=len-a-b;
			if(b>c)	break;
			if(c<a+b && !er[c])	cnt++;
		}
		printf("%d\n",cnt);
	}

	return 0;
}

Measured memory_bytes: 876
# 変える必要がある人を数える

def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    n = int(input())
    s = input()

    e_count = s.count('E')
    if s[0] == 'E':
        e_count -= 1
    w_count = 0
    ans = e_count
    for i in range(1, n):
        if s[i - 1] == 'W':
            w_count += 1
        if s[i] == 'E':
            e_count -= 1

        ans = min(ans, w_count + e_count)
    print(ans)
    


if __name__ == '__main__':
    main()

Measured memory_bytes: 4084