akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;
int main() 
{
    string s;
    cin >> s;

    if(s.at(2) == 'E'){
        cout << 5 << endl;
    }
    else if(s.at(2) == 'D'){
        cout << 4 << endl;
    }
    else if(s.at(2) == 'U')
    {
        cout << 3 << endl;
    }
    else if(s.at(2) == 'I'){
        cout << 2 << endl;
    }
    else if(s.at(2) == 'T'){
        cout << 1 << endl;
    }
    else if(s.at(0) == 'S'){
        cout << 7 << endl;
    }
    else{
        cout << 6 << endl;
    }
    
}

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

int main(void) {

char inp[100];
int i;
int year;
double nm;
int c,j,count;
char str[100]={'\0'};
char *ln;

fgets(str, 100, stdin); // 入力："123456\n"
ln = strchr(str, '\n'); /* 改行文字を検索 */
if (ln != NULL) { /* 改行が読み取られていたかどうか */
   *ln = '\0';    /* 改行文字を終端文字に置き換える */
}
else {            /* 入力ストリーム上に文字が残ってる場合 */
   while (1) {    /* 改行文字が読み取られるまで空読みする */
       c = getchar();
      if (c == '\n' || c == EOF) break;
   }
}

//printf("%s\n",str);



//double sum=0;

//sscanf(str, "%d", &year);
//printf("%d\n",year);

//for(i=1;i<=year;i++){




//fgets(str, 100, stdin); // 入力："123456\n"
//ln = strchr(str, '\n'); /* 改行文字を検索 */
//if (ln != NULL) { /* 改行が読み取られていたかどうか */
//   *ln = '\0';    /* 改行文字を終端文字に置き換える */
//}
//else {            /* 入力ストリーム上に文字が残ってる場合 */
//   while (1) {    /* 改行文字が読み取られるまで空読みする */
//       c = getchar();
//      if (c == '\n' || c == EOF) break;
//   }
//}

//printf("%s\n",str);



int a,b;

 sscanf(str, "%d %d %d", &a, &b, &c);

//printf("%d\n",a);
//printf("%d\n",b);
//printf("%d\n",c);

int d;
int e=0;

if(a>b){
	for(i=0;i<a;i++){
	if(a%(i+1)==0 && b%(i+1)==0){
//		printf("%d\n",i+1);
		e=e+1;
//		if(e==c){
//		printf("%d\n",i+1);
//		break;}

		}
	}
}
else {
	for(i=0;i<b;i++){
	if(a%(i+1)==0 && b%(i+1)==0){
//		printf("%d\n",i+1);
		e=e+1;
//		if(e==c){
//		printf("%d\n",i+1);
//		break;}
		}
}
}



int f=0;

if(a>b){
	for(i=0;i<a;i++){
	if(a%(i+1)==0 && b%(i+1)==0){
//		printf("%d\n",i+1);
		f=f+1;
		if(f==e-c+1){
		printf("%d\n",i+1);
		break;}

		}
	}
}
else {
	for(i=0;i<b;i++){
	if(a%(i+1)==0 && b%(i+1)==0){
//		printf("%d\n",i+1);
		f=f+1;
		if(f==e-c+1){
		printf("%d\n",i+1);
		break;}
		}
}
}







//		printf("%d\n",e);


    return 0;
}


Measured memory_bytes: 128
a,b,c=map(int,input().split());lis=[a,b]
for i in range(c):
    if lis[i%2]%2==1:lis[i%2]-=1
    lis[(i+1)%2]+=lis[i%2]/2;lis[i%2]/=2
print(int(lis[0]),int(lis[1]))

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

int main(){
    long long int a,b;
    cin>>a>>b;

    long long int ans=-1;

    for(int i=1;i<10000;i++){
        int A,B;
        A=i*8/100;
        B=i/10;
        if(a==A&&b==B){
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
    }


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct{
    char str[256];
    int num;
    int index;
} setter;
int main(){
    int size = 0;
    setter **data = NULL;
    scanf("%d", &size);
    data = (setter**)malloc(sizeof(setter*)*size);
    for (int i = 0; i < size; i++){
        data[i] = (setter*)malloc(sizeof(setter));
        scanf("%s %d", data[i]->str, &data[i]->num);
        data[i]->index = i+1;
    }
    for (int i = 0; i < size; i++){
        for (int j = 0; j < size; j++){
            if (strcmp(data[i]->str, data[j]->str) < 0){
                setter *tmp = data[i];
                data[i] = data[j];
                data[j] = tmp;
            }else if (!strcmp(data[i]->str, data[j]->str) && data[i]->num > data[j]->num){
                setter *tmp = data[i];
                data[i] = data[j];
                data[j] = tmp;
            }
        }
    }
    for (int i = 0; i < size; i++){
        printf("%d\n", data[i]->index);
    }
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;

int S[100000], n;

int binarySearch(int key){
	int left = 0;
	int right = n;
	int mid;
	while(left < right){
		mid = (left + right) / 2;
		if(S[mid] == key) return 1;
		if(S[mid] < key) left = mid + 1;
		else if(S[mid] > key) right = mid;
	}
	return 0;
}

int main(){
	int q, k;
	int count = 0;
	
	cin >> n;
	for (int i = 0; i < n; i++){
		scanf("%d", &S[i]);
	}
	
	cin >> q;
	for (int i = 0; i < q; i++){
		scanf("%d", &k);
		if(binarySearch(k)) count++ ;
	}
	
	cout << count << endl;
	
	return 0;
}

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

const int maxn=1005;
int n,m,a,b,fa[maxn],flag,vis[maxn];
vector<int> to[maxn],cyc;

bool check(int x,int t)
{
	cyc.clear();
	memset(vis,0,sizeof vis);
	int now=x;
	cyc.push_back(x);
	while(now!=t&&fa[now]!=0) {
		cyc.push_back(fa[now]);
		now=fa[now];
	}
	if(cyc.size()==1) return 0;
//	for(int i=0;i<cyc.size();++i) {
//		printf("%d ",cyc[i]);
//	}
//	puts("");
	for(int i=0;i<cyc.size();++i) {
		vis[cyc[i]]=1;
	}
	for(int i=0;i<cyc.size();++i) {
		int cnt=0;
		for(int j=0;j<to[cyc[i]].size();++j) {
			if(vis[to[cyc[i]][j]]) cnt++;
		}
		if(cnt>1||cnt==0) {
			return 0;
		}
	}
	printf("%d\n",int(cyc.size()));
	for(int i=0;i<cyc.size();++i) {
		printf("%d\n",cyc[i]);
	}
	return 1;
}
	
void dfs(int x)
{
	if(flag) return ;
	for(int a=0;a<to[x].size();++a) {
		if(flag) return ;
		int t=to[x][a];
		if(fa[t]==-1) fa[t]=x,dfs(t);
		else {
			if(check(x,t)) {
				flag=1;
				return ;
			}
		}
	}
}

int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;++i) {
		scanf("%d %d",&a,&b);
		to[a].push_back(b);
	}
	for(int i=1;i<=n;++i) {
		memset(fa,-1,sizeof fa);
		fa[i]=0;
		dfs(i);
	}
	if(!flag) printf("-1");
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	int e1 = 0, e2 = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'E') e2++;
	}
	int ans = 1 << 30;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'E') e2--;
		int sum = (i - e1) + e2;
		ans = min(ans, sum);
		if (S[i] == 'E') e1++;
	}
	cout << ans << endl;
}

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

using namespace std;

int W, H, GoalX, GoalY, TargetColor;
int MapData[101][101];
const int Dx[] = {1,0,-1,0}; // right,down,left,up
const int Dy[] = {0,1,0,-1};


void setBlock(int c, int d, int x, int y) {
	int lenX, lenY;

	if (d == 1) {
		lenX = x + 2;
		lenY = y + 4;
	}
	else {
		lenX = x + 4;
		lenY = y + 2;
	}

	for (int i = y; i < lenY; ++i) {
		for (int j = x; j < lenX; ++j) {
			MapData[i][j] = c;
		}
	}
}

bool solve(int x, int y) {
	int nowX, nowY;

	if (x == GoalX && y == GoalY) {
		return true;
	}

	MapData[y][x] = 0;
	for (int i = 0; i < 4; ++i) {
		nowX = x + Dx[i];
		nowY = y + Dy[i];

		if (nowX<1 || nowX>W || nowY<1 || nowY>H) {
			continue;
		}
		if (MapData[nowY][nowX] == TargetColor && solve(nowX, nowY)) {
			return true;
		}
	}
	return false;
}

int main() {
	int n, c, d, x, y, startX, startY;

	while (cin >> W >> H, W) {
		cin >> startX >> startY >> GoalX >> GoalY >> n;
		memset(MapData, 0, sizeof(MapData));
		for (int i = 0; i < n; ++i) {
			cin >> c >> d >> x >> y;
			setBlock(c, d, x, y);
		}

		TargetColor = MapData[startY][startX];
		//cout << "startColor:" << TargetColor << endl;
		if (TargetColor == 0) {
			cout << "NG" << endl;
			continue;
		}

		if (solve(startX, startY)) {
			cout << "OK" << endl;
		}
		else {
			cout << "NG" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3128
import math
N=math.factorial(int(input()))
i=2
ans=1
M=10**9+7
while i*i<=N:
    cnt=1
    while N%i==0:
        cnt+=1
        N//=i
    ans*=cnt
    i+=1
if N!=1:ans*=2
print(int(ans%M))

Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
 
#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define mod 1000000007
#define MOD 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
#define dd double
#define fori(x,n) for(ll i=x;i<n;i++)
#define modd 998244353
#define umap unordered_map<ll,ll>
#define mmap map<ll,ll>

int32_t main() 
{ 
  
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    
 
       char n;
       cin>>n;

       if(n-'A'<26)cout<<'A';
       else cout<<'a';
        
      
 

     
 
return 0;
}     

Measured memory_bytes: 3608
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=gets.chomp
ans={}
ans["ARC"]="ABC"
ans["ABC"]="ARC"
puts ans[S]

Measured memory_bytes: 14336
#include<iostream>
#include<cctype>
#include<cstdio>
using namespace std;
int main(){
    string str;
    getline(cin, str);
    for(int i = 0; i < (int)str.size(); ++i){
        char ch = str[i];
        if(isalpha(ch)){
            if(isupper(ch)){
                printf("%c", tolower(ch));
            }else{
                printf("%c", toupper(ch));
            }
        }else cout << ch;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3160
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, long long k, std::vector<long long> a){

    for(int j = 0; j < k; ++j){
        vector<int> rui(n + 1, 0);
        for(int i = 0; i < n; ++i){
            ++rui[max(0LL, i - a[i])];
            --rui[min(n, i + a[i] + 1)];
        }
        vector<i64> b(n, 0);
        b[0] = rui[0];
        for(int i = 1; i < n; ++i)
            b[i] = b[i - 1] + rui[i];
        a = move(b);
        if(*min_element(a.begin(), a.end()) == n){
            break;
        }
    }
    for(int i = 0; i < n; ++i)
        cout << a[i] << " \n"[i == n - 1];
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, std::move(A));
    return 0;
}


Measured memory_bytes: 7132
#include <iostream>
#include <cstring>
#include <fstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
using namespace std;
  
int main() {
	long long r;
	cin>>r;
	cout << r*r;
  return 0;
}

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

using namespace std;

const int MX = 1000000;

struct {
	int total, cnt[26], to[26];
} t[MX + 1];

int main() {
	int n, tv = 1;
	ignore = scanf("%d", &n);
	
	vector<pair<int, int>> queries;
	for (int i = 0; i < n; i++) {
		static char s[MX + 1];
		ignore = scanf("%s", s);
		
		int len = strlen(s);
		reverse(s, s + len);
		
		vector<int> left(26, 0);
		for (int j = 0; j < len; j++) left[s[j] - 'a']++;
		
		auto add = [&left](int v) {
			t[v].total++;
			for (int c = 0; c < 26; c++) {
				if (left[c] > 0) t[v].cnt[c]++;
			}
		};
		
		add(0);
		
		for (int j = 0, v = 0; j < len; j++) {
			int c = s[j] - 'a';
			
			if (j == len - 1) queries.emplace_back(v, c);
			
			if (t[v].to[c] == 0) {
				t[v].to[c] = tv++;
			}
			
			v = t[v].to[c];
			left[c]--;
			
			add(v);
		}
	}
	
	long long ans = 0;
	for (auto& q : queries) {
		ans += t[q.first].cnt[q.second] - 1;
	}
	
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 210432
from collections import deque

H,W=map(int,input().split())
S=[list(input()) for i in range(H)]
direc = [(-1,0), (0,-1), (1,0), (0,1)]
ans = 0
for y in range(H):
    for x in range(W):
        if S[y][x] == '#':
            continue

        dist = [[-1] * W for i in range(H)]
        dist[y][x] = 0
        que = deque([[y,x]])
        while que:
            nh, nw = que.pop()
            for dh, dw in direc:
                if nh + dh < 0 or nh + dh >= H:
                    continue
                elif nw + dw < 0 or nw + dw >= W:
                    continue
                elif S[nh + dh][nw + dw] == '#':
                    continue
                elif dist[nh + dh][nw + dw] != -1:
                    continue
                else:
                    dist[nh + dh][nw + dw] = dist[nh][nw] + 1
                    que.appendleft([nh + dh, nw + dw])
        ans = max(ans, max([max(d) for d in dist]))
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

double angle(int n);
double X(int n);
double Y(int n);

double angle(int n) {
	if(n == 1)	return 0;
	else		return (angle(n - 1) + atan(1 / sqrt((double)(n - 1))));
}

double X(int n) {
	return (sqrt((double)n) * cos(angle(n)));
}

double Y(int n) {
	return (sqrt((double)n) * sin(angle(n)));
}

int main()
{
	int n;
	while(cin >> n, n != -1) {
		printf("%.2f\n%.2f\n", X(n), Y(n));
	}
	return 0;
}

Measured memory_bytes: 1304
#include<bits/stdc++.h>
#include <atcoder/all>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using namespace atcoder;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/* g++ a.cpp -std=c++14 -I ../ */

signed main(){
    int n, m;
    cin >> n >> m;
    dsu town(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        town.merge(a, b);
    }
    cout << town.groups().size() - 1 << endl;
}

Measured memory_bytes: 8976
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>
#include <map>
using namespace std;
// 1 2 3 4 5 6
int a[200001];
int b[200001];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n); 
	int Max = b[n - 1];
	int Max2 = b[n - 2];
	for (int i = 0; i < n; i++) {
		if (a[i] == Max) {
			cout << Max2 << '\n';
		}
		else {
			cout << Max << '\n';
		}
	}


}


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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

typedef pair<int,int> P;
vector<P> List('Z' - 'A' + 1);
vector<char> In(200);
// ある時点で、
// 「一番得票した人」と「二番目に得票した人」の票差が、
// 「まだ開票していない票」より大きかったら、その人の当選が確定する
bool solve()
{
    int n;
    cin >> n;
    if(n == 0) return false;
    for(int i = 0; i < n; ++i) cin >> In[i];
    vector<int> Vote('Z' - 'A' + 1, 0);
    for(int i = 0; i < n; ++i) {
        ++Vote[In[i] - 'A'];
        // 当選確定か判定
        for(int j = 0; j < 'Z' - 'A' + 1; ++j){
            List[j].first = Vote[j], List[j].second = j;
        }
        sort(List.begin(), List.end(), greater<P>());
        if(List[0].first - List[1].first > (n - 1 - i)) {
            cout << (char)(List[0].second + 'A') <<" " << i+1 << endl;
            return true;
        }
    }
    cout << "TIE" << endl;
    return true;
}

int main(void){
    while(solve());
    return 0;
}


Measured memory_bytes: 3096
#include<stdio.h>

int main(){
  int n,d[51],i,j,ans=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&d[i]);
  }
  
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      ans+=d[i]*d[j];
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <utility>
#include <queue>

using namespace std;

const int MAX_H=1000,MAX_W=1000;
const int INF=10000000;

int H,W,N;
char f[MAX_H][MAX_W+1];

typedef pair<int,int> P;

P fac[9];	//???????????\??´?????????
int d[MAX_H][MAX_W];

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int bfs(P s,P g){
	//s??????g?????§??????????????¢
	//d????????????
	for (int i=0;i<H;i++){
		for (int j=0;j<W;j++){
			d[i][j]=INF;
		}
	}
	queue<P> que;
	//?§???????????????????0
	d[s.second][s.first]=0;
	que.push(s);
	while (!que.empty()){
		P p=que.front();
		que.pop();
		if (g==p){
			break;
		}
		//4???????????¢?´¢
		for (int i=0;i<4;i++){
			int x=p.first+dx[i],y=p.second+dy[i];
			if (x>=0 && x<W && y>=0 && y<H && f[y][x]!='X' && d[y][x]==INF){
				d[y][x]=d[p.second][p.first]+1;	//???????????´??°
				que.push(P(x,y));
			}
		}
	}
	return d[g.second][g.first];
}

int main(){
	cin>>H>>W>>N;
	P s;
	for (int i=0;i<H;i++){
		cin>>f[i];
		for (int j=0;j<W;j++){
			if ('1'<=f[i][j] && f[i][j]<='9'){
				fac[(int)(f[i][j]-'1')].first=j;
				fac[(int)(f[i][j]-'1')].second=i;
			}
			else if (f[i][j]=='S'){
				s.first=j;
				s.second=i;
			}
		}
	}
	int res=0;
	for (int i=0;i<N;i++){
		res+=bfs(s,fac[i]);
		s=fac[i];
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 6104
#include <stdio.h>
   
int main(){

  int counter = 0;
  int val[3] = {0};

    scanf("%d %d %d", &val[0], &val[1], &val[2]);

    for (int i=val[0]; i<=val[1]; i++){
        
        if ((val[2] % i) == 0){
          counter++;
        }
    }

    printf("%d\n", counter);

  return 0;

}

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

int main() {
    vector<int> A(3);
    for(int i = 0; i < 3; i++) cin >> A[i];
    sort(A.begin(), A.end());
    cout << (A[1]-A[0]) + (A[2]-A[1]) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <map>
using namespace std;

const long long int INF=1e9;
vector<long long int>A(500005,INF);

long long int calculate_normal(int i, string& S){
	if(A[i]!=INF){
		return A[i];
	}
	if(S[i]=='>'){
		if(A[i+1]==0){
			return A[i]=1;
		}
		else{
			return A[i]=1+calculate_normal(i+1,S);
		}
	}
	if(S[i-1]=='<'){
		if(A[i-1]==0){
			return A[i]=1;
		}
		else{
			return A[i]=1+calculate_normal(i-1,S);
		}
	}
	return 0;
}

long long int calculate_peak(int i, string& S){
	return A[i]=max(A[i-1]+1,A[i+1]+1);
}

int main(){
	string S;
	cin>>S;
	unsigned int i;
	//map<int,int>Normals;
	vector<int>Normals;
	//map<int,int>Peaks;
	vector<int>Peaks;
	unsigned int n=S.size();
	for(i=0;i<n+1;i++){
		/*if(i==0&&S[i]=='<'){
			A[i]=0;
		}
		else if(S[i-1]=='>'&&S[i]=='<'){
			A[i]=0;
		}
		else if(i==n&&S[i-1]=='>'){
			A[i]=0;
		}
		else if((i==n&&S[i-1]=='<')||(i==0&&S[i]=='>')){
			Normals.push_back(i);
		}
		else if(S[i-1]==S[i]){
			Normals.push_back(i);
		}
		else{
			Peaks.push_back(i);
		}*/
		
		if(i==0){
			if(S[i]=='<'){
				A[i]=0;
			}
			else{
				Normals.push_back(i);
			}
		}
		else if(i==n){
			if(S[i-1]=='>'){
				A[i]=0;
			}
			else{
				Normals.push_back(i);
			}
		}
		else{
			if(S[i-1]=='>'&&S[i]=='<'){
				A[i]=0;
			}
			else if(S[i-1]==S[i]){
				Normals.push_back(i);
			}
			else{
				Peaks.push_back(i);
			}
		}
	}
	//cout<<Normals.size()<<" Normals and "<<Peaks.size()<<" Peaks\n";
	long long int sum=0;
	for(i=0;i<Normals.size();i++){
		A[Normals[i]]=calculate_normal(Normals[i],S);
		sum+=A[Normals[i]];
	}
	for(i=0;i<Peaks.size();i++){
		A[Peaks[i]]=calculate_peak(Peaks[i],S);
		sum+=A[Peaks[i]];
	}
	/*for(i=0;i<A.size();i++){
		//cout<<A[i]<<" ";
		sum+=A[i];
	}*/
	//cout<<"\n";
	cout<<sum;
	return 0;
}


Measured memory_bytes: 30328
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y <<endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626

const int mod = 1000000007;
//==============================


int main() {

    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);


    int n,i;
    si(n);
    for(i=0;i<n;i++)
    {
	cout<<"ACL";
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3780
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    double xa1,xa2,xb1,xb2,ya1,ya2,yb1,yb2;
    while(true){
        if(!(cin>>xa1>>ya1>>xa2>>ya2>>xb1>>yb1>>xb2>>yb2))
            break;

       bool f=true;
       if(xa1>xb2||xa2<xb1)f=false;
       if(ya1>yb2||ya2<yb1)f=false;
       if(f)cout<<"YES"<<endl;
       else cout<<"NO"<<endl;
    }
}

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

const int N = 101;
int vet[N];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int sum = 0;
	for (int i=0; i<n; i++){
		scanf("%d", &vet[i]);
		sum += vet[i];
	}
	int div = sum/(m*4);
	if(sum%(m*4) != 0) div++;
	int qtd = 0;
	for (int i=0; i<n; i++){
		if(vet[i] >= div) qtd++;
	}
	if(qtd >= m) puts("Yes");
	else puts("No");
}

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

using namespace std;

int main(int arc, char **argv)
{
	unsigned int H, W, N;
	cin >> H >> W >> N;
	vector<unsigned int> numbers;
	for (unsigned int i = 0; i < N; ++i)
	{
		int tmp;
		cin >> tmp;
		numbers.push_back(tmp);
	}
	int col = 0;
	for (unsigned int i = 0; i < H; ++i)
	{
		// cerr << "col, numbers: " << col << " " << numbers[col] << endl;
		vector<int> line;
		unsigned int colors= 0;
		while (colors < W)
		{
			line.push_back(col+1);
			++colors;
			// cerr << "col: " << col << ('1' + col) << endl;
			numbers[col]--;
			if (numbers[col] == 0) ++col;
		}
		if ((i % 2) == 1) reverse(line.begin(), line.end());
		for (unsigned int j = 0; j < line.size(); ++j)
		{
			if (j != 0) cout << " ";
			cout << line[j];
		}
		cout << endl;
	}
	return 0;
}


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

int main()
{
    string a, b;

    cin >> a >> b;

    if (a == "H") {
        cout << b << endl;
    } else {
        if (b == "H") {
            cout << "D" << endl;
        } else {
            cout << "H" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr ll INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

ll modpow(ll a, ll b){
    if(b == 0) return 1;
    else if(b % 2 == 0){
        ll d = modpow(a, b/2) % MOD;
        return (d * d) % MOD;
    }
    else{
        return (a * modpow(a, b-1)) % MOD;
    }
}

const int MAX_N = 200010;

ll fact[MAX_N], finv[MAX_N];
ll comb(int n, int r){
    if(n < r || r < 0) return 0;
    return fact[n] * finv[n-r] % MOD * finv[r] % MOD;
}

void calc(int n){
    fact[0] = finv[0] = 1;
    for(int i=1; i<=n; i++){
        fact[i] = (fact[i-1] * i) % MOD;
        finv[i] = modpow(fact[i], MOD-2);
    }
}

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

    calc(200005);

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

    ll ans = 0;
    for(ll i=n; i<=2*n-1; i++){
        ll child = (modpow(a, n) * modpow(b, i - n) % MOD + modpow(a, i - n) * modpow(b, n) % MOD) * i * 100 % MOD;
        ll mother = modpow(a + b, i) * (100 - c) % MOD;
        (ans += comb(i - 1, n - 1) * child % MOD * modpow(mother, MOD - 2)) %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
// 6/13
// リアルタイム参加
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;

int main() {
    ll N, K;
    cin >> N >> K;

    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    // rep(i, K) {
    //     ll sum = 0;
    //     map<int, int> mp;  // i番目までのsum
    //     rep(i, N) {
    //     }
    // }

    vector<ll> B(N + 1);

    // 以下、touristさんの実装を参考に。
    // https://atcoder.jp/contests/tokiomarine2020/submissions/14237306

    while (K--) {
        for (ll i = 0; i <= N; i++) {
            B[i] =0;
        }

        rep(i, N) {
            ll from = max(i - A[i], (ll)0);
            ll to = min(i + A[i], N - 1);
            B[from] += 1;
            B[to + 1] -= 1;
        }

        bool changed = false;
        for (ll i = 0; i < N; i++) {
            changed |= (A[i] != B[i]);
            A[i] = B[i];
            B[i + 1] += B[i];  // このためにB(N+1)まで確保しているが、実際にB[N]が使われることはない。
        }

        if (!changed) {
            break;
        } 
    }

    rep(i, N) {
        if (i > 0) {
            cout << " ";
        }
        cout << A[i];
    }
    cout << endl;
}

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

int main() {
  int n, a, b, point;
  cin >> n;
  a = 0;
  point = 0;
  vector<int> card(n);
  for (int i = 0; i < n; i++) {
    cin >> card.at(i);
  }
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (card.at(j) > a) {
        a = card.at(j);
        b = j;
      }
    }
    
    if (i % 2 == 0) {
      point += a;
    }
    else {
      point -= a;
    }
    a = 0;
    card.at(b) = 0;
    
  }
  cout << point << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int room[4][3][10]={};
	int b,f,r,v;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d%d%d",&b,&f,&r,&v);
		room[b-1][f-1][r-1] += v;
	}
	for(int i=0;i<4;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<10;k++)printf(" %d",room[i][j][k]);
			printf("\n");
		}
		if(i+1!=4){
			for(int j=0;j<20;j++)printf("#");
			printf("\n");
		}
	}
	
	return 0;
}


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

const int INF = pow(2, 31) - 1;
#define DEBUG(x) cout << "DEBUG PRINT (" << #x << " = " << x  << ")" << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)

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



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

int main(){
  std::string s, t;
  std::cin>>s>>t;
  if(s.length()+1 ==  t.length()){
    t.resize(s.length());
    if(s == t)
      std::cout<<"Yes";
    else
      std::cout<<"No";
  }
  else
    std::cout<<"No";
}


Measured memory_bytes: 3624
using System;

public class Hello
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        var w = 1L;
        while (n > 0)
        {
            n /= 2;
            w *= 2;
        }
        Console.WriteLine(w - 1);
    }
}


Measured memory_bytes: 11220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		Arrays.sort(a);
		long ans = 0;
		for(int i = n-1; i >= 0; i--) {
			for(int j = i-1; j >= 0; j--) {
				for(int k = j-1; k >= 0; k--) {
					if((a[i] < a[j] + a[k]) && Math.abs(a[j]-a[k]) < a[i]
							&& a[i] != a[j] && a[j] != a[k] && a[i] != a[k]) {
						ans++;
					}
				}
			}
		}
		System.out.println(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 33484
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, H, W;
  cin>>N>>H>>W;
  vector<int> x(N);
  cin>>x;

  vector<int> cnt( N * W + 100);
  for(int i=0;i<N;i++){
    if(i % 2 == 0) cnt[W * i + x[i]]++, cnt[W * i + x[i] + W]--;
    else cnt[W * i - x[i]]++, cnt[W * i - x[i] + W]--;
  }
  for(int i=1;i<N * W;i++) cnt[i] += cnt[i-1];
  int c = 0;
  for(int i=0;i<N * W;i++) if(cnt[i] == 0) c++;
  int ans = c * H;
  cout<<ans<<endl;
  

  return 0;
}



Measured memory_bytes: 3244
N, point, Q = map(int, input().split())
ans = [int(input()) for i in range(Q)]
ans = [n-1 for n in ans]
# participants = [i for i in range(N)]
points = [point for i in range(N)]

points = [n-len(ans) for n in points]

for i in ans:
    points[i] += 1

#print(N, point, Q, ans, points)

for i in range(N):
    if points[i] > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 58328
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    int n, q, l, r;
    string s;

    cin >> n >> q >> s;
    vector<int> data(n+1, 0);
    for(int i = 1; i < n; i++){
        if(s[i-1] == 'A' && s[i] == 'C'){
            data[i] += 1;
        }
        data[i] += data[i-1]; 
    }
    data[n] += data[n-1]; 

    for(int i = 0; i < q; i++){
        scanf("%d%d", &l, &r);
        cout << data[r-1] - data[l-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))
ans=0
def tw(n):
    cnt=0
    while True:
        if n%2==0:
            n=n//2
            cnt+=1
        else:
            return cnt
for i in range(N):
    #print(tw(A[i]))
    ans+=tw(A[i])
print(ans)

Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int a[200007], n;
ll res = 0;
int main(){
  cin >> n;
  for(int i = 1; i<=n; i++) cin >> a[i];
  a[0] = -1;
  for(int i = 1; i<=n; i++){
    if(a[i]-a[i-1]>1) return 0*printf("-1\n");
    else if(a[i]-a[i-1]==1) res++;
    else res+=a[i];
  }
  std::cout << res-1 << '\n';
}


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

long long int gcd(long long int m,long long int n){
	if(0==m||0==n){
		return 0;
    }	
	while(m!=n){
      if(m>n){
        m=m-n;
      }
      else{
        n=n-m;
      }	
    }
  return m;
}

int main() {
  int n;
  long long int x;
  cin>>n>>x;
  long long int answer;
  vector<long long int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  answer=abs(vec.at(0)-x);
  for(int i=0;i<n-1;i++){
    answer=gcd(answer,abs(vec.at(i+1)-vec.at(i)));
  }
  cout<<answer<<endl;
}

Measured memory_bytes: 1024
#include<algorithm>
#include<chrono>
#include<ctime>  
#include<climits>
#include<functional>
#include<numeric>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
// #include<bits/stdc++.h>
using namespace std;
 
struct Debug{
    int cnt = 0;
    bool on = false;
    char debug[10] = "debug";
    template<class T>
    Debug & operator<<(const T & v) {
        if(on && cnt++ == 0) cerr << "debug: ";
        if(on) cerr << v << ' ';
        return *this;
    }
    Debug & operator<<(ostream&(*pManip)(ostream&)) {
        if(on) cerr << (*pManip);
        cnt = 0;
        return *this;
    }
} debug;
#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define print(v) {if(debug.on){for(auto x : v) debug << x; debug << endl;}}
#define printn(v, n) {if(debug.on){for(int _i = 0; _i < n; _i++) debug << *(v + _i); debug << endl;}}
#define mini(a, b) a = min(a, b)
#define maxi(a, b) a = max(a, b)

typedef unsigned long long ull;
typedef long long ll;
 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

const int MAXN = 5e5 + 10;

const long long mod = 998244353;
int n;
ll a[MAXN];
map<int, int> cnt;

ll mypow(ll x, ll y) {
	if(y == 0)return 1;
	ll tmp = mypow(x, y / 2);
	if(y % 2) return tmp * tmp % mod * x % mod;
	else return tmp * tmp % mod;
}

int main(int argc, char * argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout.tie(nullptr);
    if(argc > 1 && !strcmp(argv[1], debug.debug)) debug.on = true;

    cin >> n;
    
    for(int i = 0; i < n; i++) {
    	cin >> a[i];
    	cnt[a[i]]++;
    }
    if(cnt[0] != 1 || a[0] != 0){
    	cout << 0 << endl;
    	return 0;
    }
    // debug << "123" << endl;

    long long res = 1;
    for(auto & p : cnt) {
    	if(p.first == 0) continue;
    	if(!cnt.count(p.first - 1)) {
    		cout << 0 << endl;
    		return 0;
    	}
    	res = res * mypow(cnt[p.first - 1], p.second) % mod;
    }
    cout << res << endl;


    return 0;
 
}














Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  string s;
  map<string,int>m;
  cin>>n;
  long long int ans=0;
  for(int i=0;i<n;i++)
  {
    cin>>s;
    sort(s.begin(),s.end());
    ans+=m[s];
    m[s]+=1;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 11136
fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val S = readInputLine()
    
    var ans = 0
    
    for (i in 0 until N) {
        if (i + ans * 2 >= N) {
            break
        }
        while (i + ans * 2 < N) {
            val subst = S.substring(i..i + ans)
            if (!S.substring(i + ans + 1..N - 1).contains(subst)) {
                break
            }
            ans++
        }
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 46324
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<double>v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  vector<double> dp[2];
  dp[0] = dp[1] = vector<double>(n+1,0);
  
  dp[0][0] = (1-v[0]);
  dp[0][1] = v[0];
 
  for(int i=1;i<n;i++){
    for(int j=0;j<=n;j++){ 
        dp[1][j] = 0;
        if(j-1>=0)
    	    dp[1][j] = v[i]*dp[0][j-1];
    	dp[1][j] += (1-v[i])*dp[0][j];
    }
    for(int j=0;j<=n;j++){
      	dp[0][j] = dp[1][j];
    }
  }
  
  double ans = 0;
    
  for(int i=0;i<=n;i++){
  	ans += (n-i<i?dp[0][i]:0);
  }
  
  cout<<fixed<<setprecision(10)<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
  char c;
  while(1){
    scanf("%c", &c);
    if(c=='\n'){
      printf("\n");
      break;
    }
    if('a'<=c&&c<='z'){
      printf("%c", c - ('a' - 'A'));
    }else if('A'<=c&&c<='Z'){
      printf("%c", c + ('a' - 'A'));
    }else{
      printf("%c",c);
    }
  }
  return 0;
}


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

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

	int max_number = 1;
	int max_count = 0;

	for(int i = 1; i < N + 1; i++){
		int count = 0;
		int tmp = i;

		while(tmp % 2 == 0){
			count++;
			tmp /= 2;
		}

		if(count > max_count){
			max_count = count;
			max_number = i;
		}
	}
	cout << max_number << endl;
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  while(cin >> n, n) {
    int A = 0, B = 0;
    rep(i, n) {
      int a, b;
      cin >> a >> b;
      if(a > b) A += a+b;
      else if(a < b) B += a+b;
      else A += a, B += b;
    }
    cout << A << " " << B << endl;
  }

  return 0;
}

Measured memory_bytes: 3112
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
 
#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <assert.h>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>                                    
#include <deque>                                    
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <random>
#include <ctime>
#include <unordered_map>
#include <set>
#include <unordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
//using namespace __gnu_pbds;
using namespace std;

 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, ans, a[202];

inline void boost () {
   ios_base :: sync_with_stdio (0);
   cin.tie (0), cout.tie (0);
}
 
inline void Solve () {
   cin >> n;
   for (int i = 1; i <= n; i ++) cin >> a[i];
   for (int i = 1; i <= n; i ++)
      for (int j = i + 1; j <= n; j ++)
         for (int k = j + 1; k <= n; k ++)
            if (a[i] != a[j] && a[j] != a[k] && a[i] != a[k] && a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i])
               ans ++;
   cout << ans;
}               
 
signed main () {                                       
  // #ifdef QWERTY
   //   freopen("input", "r", stdin);
   //#endif
  // freopen (".in", "r", stdin);    
  // freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                   

Measured memory_bytes: 3652
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 1e9 + 7;
const int N = 200000;
set < int > ms;
int used[N], t[N], color[N], r[N], cv, v[N], s[N], u[N], n, m, val[N];
pair < int, int > p[N];
vector < pair < int, int > > g[N];
int check(int x){
    for (int i = 1; i <= n; i++) used[i] = 0;
    queue < int > q;
    q.push(cv);
    val[cv] = x;
    used[cv] = 1;

    while(!q.empty()){
        int v = q.front();
        q.pop();
        for (auto u: g[v]){
            if (used[u.F]) continue;
            q.push(u.F);
            used[u.F] = 1;
            val[u.F] = u.S - val[v];
        }
    }
    for (int i = 1; i <= n; i++) if (val[i] <= 0) return 0;
    for (int i = 1; i <= m; i++) if (s[i] != (val[v[i]] + val[u[i]])) return 0;
    return 1;
}
void dfs(int v, int c = 0){
    used[v] = 1;
    color[v] = c;
    for (auto u: g[v]){
        int q;
        if (c == 0) q = t[v] - u.S;
        else    q = t[v] + u.S;
        if (used[u.F]){
            if (color[u.F] == c){
                cv = u.F;
                int x = u.S;
                int y = v;
                int k = -1;
                while(y != u.F){
                    x += k * p[y].S;
                    y = p[y].F;
                    k = -k;
                }
                if (x % 2 == 1){
                    cout << 0;
                    exit(0);
                }
                x = abs(x);
                x /= 2;
                cout << check(x);
                exit(0);
            }
        } else{
            t[u.F] = q;
            p[u.F] = {v, u.S};
            dfs(u.F, c ^ 1);
        }
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) r[i] = 1e9;
    for (int i = 1; i <= m; i++){
        cin >> u[i] >> v[i] >> s[i];
        r[u[i]] = min(r[u[i]], s[i]);
        r[v[i]] = min(r[v[i]], s[i]);
        g[u[i]].pb({v[i], s[i]});
        g[v[i]].pb({u[i], s[i]});
    }
    dfs(n);
    int l = 1;
    int r1 = 1e9;
    for (int i = 1; i <= n; i++){
        if (color[i] == 0){
            l = max(l, 1 -t[i]);
            r1 = min(r1, -t[i] + r[i] - 1);
        } else{
            l = max(l, -r[i] - t[i] + 1);
            r1 = min(-t[i] - 1, r1);
        }
    //    cout << l << " " << r1 << " " << t[i] << " " << color[i] << endl;
    }
    cv = n;
    if (!check(l)) cout << 0; else
    if (l > r1) cout << 0; else cout << r1 - l + 1;
}


Measured memory_bytes: 29440
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int H,W;cin >> H >> W;
    int N;cin >> N;
    vector<int> a(N);
    rep(i,N)cin >> a[i];
    vector<vector<int> > s(H,vector<int>(W));
    int i=0,color=1,now=0;
    while(i<H){
        if(i%2==0){
            s[i][now]=color;
            now++;
            a[color-1]--;
            if(a[color-1]==0)color++;
            if(now==W){
                i++;
                now--;
            }
        }else{
            s[i][now]=color;
            now--;
            a[color-1]--;
            if(a[color-1]==0)color++;
            if(now==-1){
                i++;
                now++;
            }
        }
    }
    rep(i,H){
        rep(j,W){
            cout << s[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int  main(){
    char s;
    cin>>s;
    if(s=='a'||s=='e'||s=='i'||s=='o'||s=='u'){cout<<"vowel"<<endl;
    }
    else{cout<<"consonant"<<endl;}
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,op,b;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+'){
                printf("%d\n",a+b);
        }else if(op=='-'){
                printf("%d\n",a-b);
        }else if(op=='*'){
                printf("%d\n",a*b);
        }else if(op=='/'){
                printf("%d\n",a/b);
        }else if(op=='?')break;
    }
return 0;
}

Measured memory_bytes: 600
import java.util.ArrayList;
import java.util.Scanner;

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

        int count = 1;
        int num = inp.nextInt();

        ArrayList<Integer> nums = new ArrayList<>();

        while (num != 0) {
            nums.add(num);
            num = inp.nextInt();
        }

        for (int n : nums) {
            System.out.println("Case " + count + ": " + n);
            count++;
        }
    }
}



Measured memory_bytes: 43144
#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(){
  ll h,w;
  cin >> h >> w;
  double cnt=h*w+1;
  ll ans = cnt/=2;
  if(h==1||w==1)cout << 1 << endl;
  else cout << ll(ans) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    int k;
    cin >> n >> k;
    int i = 0;
    while(n) {
        i++;
        n = n/k;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256