akhauriyash/Code-Regression huggingface dataset:
A,B,C = map(int,input().split())
cnt = 0
if A == B and B == C and A % 2 == 0:
	print(-1)
	exit()
while True:
	if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
		break
	a = A / 2
	b = B / 2
	c = C / 2
	A = b + c
	B = a + c
	C = a + b
	cnt+=1
print(cnt)

Measured memory_bytes: 3064
#pragma region Macros
#include <bits/stdc++.h>

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

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    string s;
    cin >> s;
    int n = (int)s.size();

    reverse(s.begin(), s.end());
    vector<int> dp1(n+1), dp2(n+1);
    for (int i=1; i<n+1; i++) {
        int cur = (int)(s.at(i-1) - '0');
        dp1.at(i) = min(dp1.at(i-1) + cur, dp2.at(i-1) + cur + 1);
        if (i == 1) dp2.at(i) = dp1.at(i-1) + 10 - cur;
        else dp2.at(i) = min(dp1.at(i-1) + 10 - cur, dp2.at(i-1) + 10 - cur - 1);
    }

    cout << min(dp1.at(n), dp2.at(n) + 1) << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 9116
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0].split(" ")[0])
    var H = Number(lines[0].split(" ")[1]);

    lines.shift();

    var AB = lines.map(i => i.split(" ").map(i => Number(i)));

    var x = AB.concat().sort((a, b) => b[0] - a[0]);
    var y = AB.concat().sort((a, b) => b[1] - a[1]);

    var max = x[0][0];
    var damage = 0; var ans = Math.ceil(H / max);

    for (var i = 0; i < N; i++) {
        damage += y[i][1];

        var m = Math.ceil((H - damage) / max)
        if (m < 0) { m = 0 }

        ans = Math.min(ans, m + i + 1)
    }
    console.log(ans);
});

Measured memory_bytes: 52684
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T &a, T b) {if (a < b) {a = b;return 1;}return 0;}
template<class T> inline bool chmin(T &a, T b) {if (a > b) {a = b;return 1;}return 0;}

int main() {
  int x;
  cin >> x;
  if (x < 30) cout << "No" << endl;
  else cout << "Yes" << endl;
}


Measured memory_bytes: 3548
#include<stdio.h>

int main(){
	int i, j, k, S[100000], T[50000], n, q, c = 0, right, left, mid;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}
	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		scanf("%d", &T[i]);
	}
	
	for (i = 0; i < q; i++) {
		right = n - 1;
		left = 0;
		mid = (left + right) / 2;
		while (right != mid && left != mid) {
			if (S[mid] > T[i]) {
				right = mid;
				mid = (left + right) / 2;
			}
			else if (S[mid] < T[i]) {
				left = mid;
				mid = (left + right) / 2;
			}
			else {
				left = mid;
				right = mid;
			}
		}
		if (T[i] == S[left] || T[i] == S[mid] || T[i] == S[right]) {
			c++;
		}
	}
	printf("%d\n", c);
	return 0;
}



Measured memory_bytes: 2256
x = int(input())

if 400 <= x <= 599:
  print('8')
elif 600 <= x <= 799:
  print('7')
elif 800 <= x <= 999:
  print('6')
elif 1000 <= x <= 1199:
  print('5')
elif 1200 <= x <= 1399:
  print('4')
elif 1400 <= x <= 1599:
  print('3')
elif 1600 <= x <= 1799:
  print('2')
else:
  print('1')

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

int main()
{
    int ans = -10000;
    int n;
    cin>>n;
    vector< vector<int> > m(n+2, vector<int>(n+2, 0));
    for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) cin>>m[i][j];
    for(int i=1; i<=n; i++) for(int j=2; j<=n; j++) m[i][j] += m[i][j-1];
    for(int j=1; j<=n; j++) for(int i=2; i<=n; i++) m[i][j] += m[i-1][j];
    for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) for(int k=i; k<=n; k++) for(int l=j; l<=n; l++) {
        int sum = m[k][l] - m[i-1][l] - m[k][j-1] + m[i-1][j-1];
        ans = max(ans, sum);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1260
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    String[] S;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        S = new String[N];
        for (int i=0; i<N; i++) {
        	S[i] = sc.next();
        }
    }
    
    //解答処理
    private List<String> solve() {
    	int max = 0;
    	HashMap<String,Integer> map = new HashMap<String,Integer>();
    	List<String> list = new ArrayList<String>();
    	
    	for (int i=0; i<N; i++) {
    		int count = 1;
    		if (map.containsKey(S[i])) {
    			count += map.get(S[i]);
    		}
    		map.put(S[i], count);
    	}
    	
    	for (String s : map.keySet()) {
    		max = Math.max(max, map.get(s));
    	}
    	for (String s : map.keySet()) {
    		if (max == map.get(s)) {
				list.add(s);
			}
    	}
        
    	Collections.sort(list);
        return list;
    }
    
    //出力
    public void show(List<String> answer) {
    	for (String s : answer) {
    		System.out.println(s);  		
    	}
    }

}


Measured memory_bytes: 77796
n = int(input())
a = list(map(int,input().split()))
a1 = a[::2]
a2 = a[1::2]
if n % 2:
  print(*a1[::-1],sep=' ',end=' ')
  print(*a2,sep=' ')
else:
  print(*a2[::-1],sep=' ',end=' ')
  print(*a1,sep=' ')

Measured memory_bytes: 26360
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ch() getchar()
#define pc(x) putchar(x)
template<typename T>inline void read(T&x){
	int f;char c;
	for(f=1,c=ch();c<'0'||c>'9';c=ch())if(c=='-')f=-f;
	for(x=0;c<='9'&&c>='0';c=ch())x=x*10+(c&15);x*=f;
}
template<typename T>inline void write(T x){
	static char q[64];int cnt=0;
	if(!x)pc('0');if(x<0)pc('-'),x=-x;
	while(x)q[cnt++]=x%10+'0',x/=10;
	while(cnt--)pc(q[cnt]);
}
const int maxn=3005,mod=1000000007,inv2=500000004;
int a[maxn],dp[maxn][maxn];
int mo(const int x){return x>=mod?x-mod:x;}
int main(){
	int n,q;
	read(n),read(q);
	for(int i=1;i<=n;++i)
		read(a[i]);
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j){
			dp[i][j]=(a[i]>a[j]);
		}
	}
	int tmp=1;
	while(q--){
		int u,v;tmp=mo(tmp<<1);
		read(u),read(v);
		dp[u][v]=dp[v][u]=1ll*mo(dp[u][v]+dp[v][u])*inv2%mod;
		for(int i=1;i<=n;++i){
			if(i==u||i==v)continue;
			dp[i][u]=dp[i][v]=1ll*mo(dp[i][u]+dp[i][v])*inv2%mod;
			dp[u][i]=dp[v][i]=1ll*mo(dp[u][i]+dp[v][i])*inv2%mod;
		}
	}
	int ans=0;
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n;++j){
			ans=mo(ans+dp[i][j]);
		}
	}
	write(1ll*ans*tmp%mod),pc('\n');
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
            #include<iostream>
            #include<cstdio>
            #include<vector>
            #include<queue>
            #include<map>
            #include<cstring>
            #include<string>
            #include <math.h>
            #include<algorithm>
        //    #include <boost/multiprecision/cpp_int.hpp>
            #include<functional>
          #define int long long
            #define inf  1000000007
            #define pa pair<int,int>
    #define ll long long
            #define pal pair<ll,ll>
            #define ppa pair<int,pa>
            #define  mp make_pair
            #define EPS (1e-10)
            #define equals(a,b) (fabs((a)-(b))<EPS)
     
            using namespace std;
     
            class Point{
            	public:
            	double x,y;
            	Point(double x=0,double y=0):x(x),y(y) {}
            	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
            	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
            	Point operator * (double a) {return Point(x*a,y*a);}
            	Point operator / (double a) {return Point(x/a,y/a);}
            	double absv() {return sqrt(norm());}
            	double norm() {return x*x+y*y;}
            	bool operator < (const Point &p) const{
            		return x != p.x ? x<p.x: y<p.y;
            	}
            	bool operator == (const Point &p) const{
            		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
            	}
            };
            typedef Point Vector;
     
            struct Segment{
            Point p1,p2;
            };
     
        double hen(Vector a){
        if(fabs(a.x)<EPS && a.y>0) return acos(0);
        else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
        else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
        else if(fabs(a.y)<EPS && a.x>0) return 0.0;
        else if(a.y>0) return acos(a.x/a.absv());
        else return 2*acos(0)+acos(-a.x/a.absv());
     
        }
     
            double dot(Vector a,Vector b){
            	return a.x*b.x+a.y*b.y;
            }
            double cross(Vector a,Vector b){
            	return a.x*b.y-a.y*b.x;
            }
        
            //----------------kokomade temple------------
int n,m,k,x,t;

int N=262144;

int a[100002]={0};
int aa[100002]={0};



    signed main(){
int n,t;
    	cin>>n>>t;
    	
    	for(int i=1;i<=N;i++){
    		cin>>a[i];
    	
    		
    	}
    	for(int i=100000;i>=0;i--){
    		aa[i]=max(aa[i+1],a[i]);
    	}
    	
    	int ma=-1,d=0;
    	for(int i=1;i<=n;i++){
    		int m=aa[i]-a[i];
    		if(ma<m){
    			ma=m;
    			d=1;
    		}
    		else if(ma==m){
    			d++;
    		}
    	}
    	cout<<d<<endl;
    //	printf("%.10f\n",ans);
    	return 0;
    }

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<cctype>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    string S;
    cin >> S;
    ll ans=0;
    ll i;
    for(i=0;i<S.size();i++){
        if(i!=S.size()-1&&S[i]==S[i+1]){
           if(i!=S.size()-2)ans++;
           i+=2;
        }
        ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int n5 = 0 ;
		int n7 = 0 ;
		for(int i = 0 ; i < a.length ; i++) {
			if(Integer.parseInt(a[i]) == 5)
				n5 ++ ;
			if(Integer.parseInt(a[i]) == 7)
					n7 ++ ;
		}
		if(n5 == 2 && n7 == 1) 
			System.out.println("YES");
		
	   else
		   System.out.println("NO");
	}

}


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

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	vector<int> b(n - 1);
	for(int i = 0; i + 1 < n; i++){
		cin>>b[i];
	}
	int sum = b[0] + b.back();
	for(int i = 1; i + 1 < n; i++){
		sum += min(b[i - 1], b[i]);
	}
	cout<<sum<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int n,w;
int a[105],b[105];
ll dp[105][100005];

int main()
{
//	freopen("input.txt","r",stdin);
	memset(dp,0x3f,sizeof(dp));
	ios_base::sync_with_stdio(false);
	cin>>n>>w;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	dp[0][b[0]]=a[0];
	dp[0][0]=0;
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<=100000;j++)
		{
			if(j-b[i]>=0) dp[i][j]=min(dp[i][j],dp[i-1][j-b[i]]+a[i]);
			dp[i][j]=min(dp[i][j],dp[i-1][j]);
		}
	}
	ll res=0;
	for(int i=100000;i>=0;i--)
	{
		if(dp[n-1][i]<=w)
		{
			over(i);
		}
	}
	return 0;
}

Measured memory_bytes: 82304
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int n1,commandNum,b,e,t;
    cin >> n1;
    vector<int>a1(n1),a2(n1);
    for(int i = 0;i < n1;++i){
        cin >> a1[i];
        a2[i] = a1[i];
    }
    cin >> commandNum;
    for(int i = 0;i < commandNum;++i){
        cin >> b >> e >> t;
        // 左側文字列を右側に代入する
        for(int k = b;k < b + (e - b);++k){
            int moveIndex = (k - b) + t;
            a2[moveIndex] = a1[k];
        }
        // 右側文字列を左側に代入する
         for(int k = t;k < t + (e - b);++k){
             int moveIndex = b + (k - t);
             a2[moveIndex] = a1[k];
         }
        copy(a2.begin(),a2.end(),a1.begin());
    }
    for(int i = 0;i < n1;++i){
        if(i) cout << " ";
        cout << a2[i];
    }
    cout << endl;
}



Measured memory_bytes: 3172
<?php
  
fscanf(STDIN,"%d%d",$n,$m);
$a_li = array();



for($i=0;$i<$m;$i++){
 $a_li[] = explode(" ",trim(fgets(STDIN))); 
 }

sort($a_li);
//print_r($a_li);

foreach($a_li as $v){
  if($v[0]==1){
    $visited[$v[1]] = true;
  }elseif($visited[$v[0]]){
    if($v[1]==$n){
      echo 'POSSIBLE';
      exit;
    }
  }
  
}


echo 'IMPOSSIBLE';


Measured memory_bytes: 105584
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;

struct node{
	int parent_id;
	int left_child_id;
	int right_child_id;
	int sibling_id;
};

int get_depth(node* b, int id);
int get_degree(node* b, int id);
int get_height(node* b, int id);
const char* get_position_name(node* b, int id);

int main(){
	int n;
	cin >> n;
	node* b = (node*)calloc(n, sizeof(node));
	for(int i = 0; i < n; ++i){
		b[i].parent_id  = -1;
		b[i].sibling_id = -1;
	}
	//input data
	for(int i = 0; i < n; ++i){
		int id;
		int left_child_id;
		int right_child_id;
		cin >> id;
		cin >> left_child_id;
		cin >> right_child_id;
		b[id].left_child_id  = left_child_id;
		b[id].right_child_id = right_child_id;
		if(left_child_id  != -1) b[left_child_id].parent_id  = id;
		if(right_child_id != -1) b[right_child_id].parent_id = id;
		if(left_child_id  != -1 && right_child_id != -1){
			b[left_child_id].sibling_id  = right_child_id;
			b[right_child_id].sibling_id = left_child_id;
		}
	}
	for(int i = 0; i < n; ++i){
		int depth = get_depth(b, i);
		int height = get_height(b, i);
		int degree = get_degree(b, i);
		const char* position_name = get_position_name(b, i);
		cout
		<< "node " << i
		<< ": parent = " << b[i].parent_id
		<< ", sibling = " << b[i].sibling_id
		<< ", degree = " << degree
		<< ", depth = " << depth
		<< ", height = " << height 
		<< ", " << position_name 
		<< endl;
		}
	return 0;
}

int get_degree(node* b, int id){
	int degree = 0;
	if(b[id].left_child_id  != -1) ++degree;
	if(b[id].right_child_id != -1) ++degree;
	return degree;
}

int get_depth(node* b, int id){
	int depth = 0;
	int current_id = id;
	while(b[current_id].parent_id != -1){
		++depth;
		current_id = b[current_id].parent_id;
	}
	return depth;
}

int get_height(node* b, int id){
	int left_child_id  = b[id].left_child_id;
	int right_child_id = b[id].right_child_id;
	if(b[id].left_child_id != -1 || b[id].right_child_id != -1 ){
		if(b[id].right_child_id == -1) return get_height(b, left_child_id)+1;
		if(b[id].left_child_id  == -1) return get_height(b, right_child_id)+1;
		return max(get_height(b, left_child_id), get_height(b, right_child_id))+1;
	}
	return 0;
}
const char* get_position_name(node* b, int id){
	if(b[id].parent_id == -1) return "root";
	if(b[id].left_child_id == -1 && b[id].right_child_id == -1 ) return "leaf";
	return "internal node";
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;
bool a[105]={0};
int t,x,n;
int main()
{
	cin>>x>>n;
	rep(i,n)
	{
		cin>>t;
		a[t]=1;
	}
	t=0;
	while(1)
	{
		if(a[x-t]==0) re(x-t)
		if(a[x+t]==0) re(x+t)
		t++;
	}
	return 0;}

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

int main(){
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    int cnt = 0;

    for(int i=0; i<N-1; i++){
        if(S[i] == S[i+1]) cnt++;
    }

    cout << min(N-1, cnt + 2 * K) <<endl;

    return 0;
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//aとbの大きい方

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//aとbの小さい方

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//aとbの差の絶対値

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	int N, A, B;

	cin >> N >> A >> B;

	cout << min(A*N, B) << endl;

	return 0;
}

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

int main(){
  int a,b;
  string s;
  cin>>a>>b>>s;
  
  int i_cou=0;
  if((int)s.find("-")==-1) puts("No\n");
  else{
      if((int)s.find("-") != a) i_cou++;
      for(int i=0;i<s.size();i++){
          if(s[i]=='-') i_cou++;
      }
      if(i_cou>1) puts("No\n");
      else puts("Yes\n");
  }

}

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

int main(void){
    
    unsigned long H,W;
    cin >> H >> W;
    
    if(H%2 == 1 && W%2 == 1){
        if(H == 1 || W == 1){
            cout << 1 << endl;
        }
        else{
            cout<< H*W/2 + 1 <<endl;
        }
        
    }
    else{
        if(H == 1 || W == 1){
            cout << 1 << endl;
        }
        else{
            cout<< H*W/2 <<endl;
        }
        
    }
   
}

Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef vector<LL> VLL;
const LL LLMAX = numeric_limits<LL>::max();

int main()
{
  int A, B, Q;
  cin >> A >> B >> Q;

  VLL s(A), t(B), x(Q);
  for (int i = 0; i < A; ++i) cin >> s[i]; sort(s.begin(), s.end());
  for (int i = 0; i < B; ++i) cin >> t[i]; sort(t.begin(), t.end());
  for (int i = 0; i < Q; ++i) cin >> x[i];

  VLL st(A, LLMAX), ts(B, LLMAX);
  int j;
  for (int i = 0; i < A; ++i) {
    j = lower_bound(t.begin(), t.end(), s[i]) - t.begin();
    if (j < B) st[i] = min(st[i], abs(s[i] - t[j]));
    if (j > 0) st[i] = min(st[i], abs(s[i] - t[j - 1]));
  }
  for (int i = 0; i < B; ++i) {
    j = lower_bound(s.begin(), s.end(), t[i]) - s.begin();
    if (j < A) ts[i] = min(ts[i], abs(t[i] - s[j]));
    if (j > 0) ts[i] = min(ts[i], abs(t[i] - s[j - 1]));
  }
  
  for (int i = 0; i < Q; ++i) {
    LL ans = LLMAX;
    //cout << "x=" << x[i] << endl;
    //cout << "ans=" << ans << endl;

    int j;
    j = lower_bound(s.begin(), s.end(), x[i]) - s.begin();
    if (j < A) {
      ans = min(ans, abs(s[j] - x[i]) + st[j]);
      //cout << "test " << j << " ans=" << ans << endl;
    }
    if (j > 0) {
      --j;
      //cout << "test " << j << " ans=" << ans << endl;
      ans = min(ans, abs(s[j] - x[i]) + st[j]);
    }

    j = lower_bound(t.begin(), t.end(), x[i]) - t.begin();
    if (j < B) {
      //cout << "test " << j << " ans=" << ans << endl;
      ans = min(ans, abs(t[j] - x[i]) + ts[j]);
    }
    if (j > 0) {
      --j;
      //cout << "test " << j << " ans=" << ans << endl;
      ans = min(ans, abs(t[j] - x[i]) + ts[j]);
    }

    cout << ans << endl;
    //cout << endl;
  }

  return 0;
}

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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


int main() {
	ll n;
	cin >> n;
	vector<string> vecs(n);
	set<string> s;
	rep(i, n)	cin >> vecs[i];
	rep(i, n)	s.insert(vecs[i]);

	cout << s.size() << endl;
	


}

Measured memory_bytes: 25108
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        long ac = (long)a*c;
        long ad = (long)a*d;
        long bc = (long)b*c;
        long bd = (long)b*d;
        long ans = Math.max(ac,ad);
        ans = Math.max(ans,bc);
        ans = Math.max(ans,bd);
        System.out.println(ans);
    }
}


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

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++) cin >> S[i];
    map<string, int> mp;
    int mx = 0;
    for (int i = 0; i < N; i++) {
        mp[S[i]]++;
        mx = max(mx, mp[S[i]]);
    }
    vector<string> ans;
    auto it = mp.begin();
    while (it != mp.end()) {
        if ((*it).second == mx) ans.push_back((*it).first);
        it++;
    }
    sort(ans.begin(), ans.end());
    for (string s : ans) cout << s << endl;
    return 0;
}


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

int main(){
    string S, month, date;
    cin >> S;
    int intS = stoi(S.substr(0, 4) + S.substr(5, 2) +  S.substr(8, 2));
    string ans = intS <= 20190430 ? "Heisei" : "TBD";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a%3==0||b%3==0||(a+b)%3==0){
    cout<<"Possible"<<endl;
  }
  else{
    cout<<"Impossible"<<endl;
  }
  return(0);
}


Measured memory_bytes: 256
using System;

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            string s = Console.ReadLine();
            int cnt = 0;
            if (s=="RRR")
            {
                cnt = 3;
            }
            else if (s.Contains("RR"))
            {
                cnt = 2;
            }
            else if (s.Contains("R"))
            {
                cnt = 1;
            }

            Console.WriteLine(cnt);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 25948
#include<cstdio>
#include<queue>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
#include<map>
using namespace std;
long long m=1000000007;
long long ksm(long long a,long long b){
	if(b==1)
	return a%m;
	if(b%2)
	return a%m*ksm(a,b-1)%m;
	long long x=ksm(a,b/2)%m;
	return x*x%m;
}
int  main(){
	long long i,n,a,b,ans;
	scanf("%lld%lld%lld",&n,&a,&b);
	ans=ksm(2,n);
	ans=(ans-1+m)%m;
	long long t1=1,t2=1;
	for(i=1;i<=a;i++){
		t1*=(n+1-i);
		t1%=m;
		t1*=ksm(i,m-2);
		t1%=m;
	}
	ans=(ans+m-t1)%m;
	t1=1;
	for(i=1;i<=b;i++){
		t1*=(n+1-i);
		t1%=m;
		t1*=ksm(i,m-2);
		t1%=m;
	}
	ans=(ans+m-t1)%m;
	printf("%lld\n",ans);
	
}









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

using namespace std;

long long ans = 1;
int main(){
	string str;
	cin >> str;
	
	long long alp[26] = {0};
	for(int i = 0;i < str.size();i++){
		alp[str[i] - 'a']++;
	}
	
	for(int i = 0;i < 26;i++){
		for(int j = i+1;j < 26;j++){
			ans = ans + alp[i] * alp[j];
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 640
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import Data.List

readIntsLine :: IO [Int]
readIntsLine = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

solve :: [(Int, Int)] -> Int
solve [] = 0
solve ((num, len):as)
  | num < len = len - num + solve as
  | num > len = len + solve as
  | otherwise = solve as

main :: IO ()
main = do
  getLine
  as <- map (\x -> (head x, length x)) . group . sort <$> readIntsLine
  print $ solve as

Measured memory_bytes: 16764
n, x = gets.chomp.split(" ").map{|u| u.to_i}

if x == 1 || x == 2 * n - 1
  puts "No"
  exit
elsif n == 2
  puts "Yes"
  puts "1 2 3"
  exit
end

@ans = Array.new(2 * n - 1){-1}
@unused = (1..(2*n-1)).to_a

def use(ind, m)
  @ans[ind] = m
  @unused.delete(m)
end

use(n-1, x)
if x != 2 * n - 2
  use(n - 2, 1)
  use(n - 3, 2 * n - 2)
  use(n, 2 * n - 1)
else
  use(n - 2, 2 * n - 1)
  use(n - 3, 1)
  use(n, 2)
end

for i in 0...(2*n-1)
  if @ans[i] == -1
    @ans[i] = @unused.first
    @unused.shift
  end
end

puts "Yes"
puts @ans.join(" ")



Measured memory_bytes: 8188
import java.util.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrint: (String)->Unit = { msg -> System.err.println(msg) }


fun solveD(X:Long) {
    fun pow5(x: Long):Long { return x*x*x*x*x }

    for (a in 0L..1000L) {
        for (b in -a.. a) {
            if (pow5(a) - pow5(b) == X) {
                println("$a $b")
                return
            }
        }
    }
}


fun main(args: Array<String>) {
    val X = readLong()
    solveD(X)
}


Measured memory_bytes: 34612
dat = {}

for i in range(0, 500):
	for j in range(0, 500):
		res = i ** 5 - j ** 5
		dat[res] = [i, j]
		res = i ** 5 + j ** 5
		dat[res] = [i, -j]

tmp = int(input())
if tmp in dat:
	print(dat[tmp][0], dat[tmp][1])


Measured memory_bytes: 87660
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<ll> v(n);
    forn(i, n) cin >> v[i];

    ll ans = 0;
    forn(x, k / 2 + 1)
    {
        if (k - x >= n)
        {
            ll res = 0;
            vector<ll> nega;
            forn(i, n)
            {
                res += v[i];
                if (v[i] < 0)
                    nega.push_back(v[i]);
            }
            sort(allele(nega));
            forn(i, min(x, (ll)nega.size())) res -= nega[i];
            ans = max(ans, res);
        }
        else
        {
            forn(lft, k - x + 1)
            {
                vector<ll> nega;
                bool flag=true;
                ll sum=0;
                forr(i,lft-1,0)
                {
                    if(flag&&v[i]<=0)continue;
                    if(flag&&v[i]>0)flag=false;
                    sum += v[i];
                    if(v[i]<0)nega.push_back(v[i]);
                }
                flag=true;
                fori(i, n - (k - x - lft), n)
                {
                    if(flag&&v[i]<=0)continue;
                    if(flag&&v[i]>0)flag=false;
                    sum += v[i];
                    if(v[i]<0)nega.push_back(v[i]);
                }
                sort(allele(nega));
                forn(i, min(x, (ll)nega.size())) sum -= nega[i];
                ans = max(ans, sum);
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import sys
def flush() : sys.stdout.flush()

def main():
    N = int(input())
    print(0)
    flush()
    sex = input()
    if sex == "Vacant":
        exit()

    even_sex = sex
    def isOK(mid):
        print(mid)
        flush()
        sex = input()
        if sex == "Vacant":
            exit()
        elif mid%2 == 0:
            if even_sex == sex: return True
            else:return False
        else:
            if even_sex != sex: return True
            else: return False
        
    def bin_search():
        l = 0
        r = N
        while l!=r:
            mid = l + (r-l)//2
            if isOK(mid):
                l = mid
            else:
                r = mid
                
    bin_search()

if __name__ == "__main__":
    main()

Measured memory_bytes: 3660
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	
	if(a*b<=c*d) cout  << c*d << endl;
	else cout << a*b << endl;
		
	return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
//#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

signed main(void){
  int n;cin >> n;
  int cnt=0;
  rep(i,n){
    int p;cin >> p;
    if(p!=i+1)cnt++;
  }
  if(cnt==2||cnt==0)
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

#define T int

class Dijkstra {
public:
	struct edge{
		int to; T cost;
	};
	vector<vector<edge> > G;
	vector<T> d;
	int V;
	using pti = pair<T,int>;
	Dijkstra(int node_size){
		V = node_size;
		G.resize(V),d.resize(V,numeric_limits<T>::max());
	}
	//無向グラフの場合
	void add_edge(int u,int v,T cost){
		G[u].pb((edge){v,cost});
	}
	void solve(int s){
		priority_queue<pti,vector<pti>,greater<pti> > que;
		d[s] = 0;
		que.push(pti(0,s));
		while(!que.empty()){
			pti p = que.top();
			que.pop();
			int v = p.second;
			if(d[v] < p.first) continue;
			for(auto& w : G[v]){
				if(d[w.to] > d[v] + w.cost){
					d[w.to] = d[v] + w.cost;
					que.push(pti(d[w.to],w.to));
				}
			}
		}
	}
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, r;
    cin >> n >> m >> r;
	Dijkstra dj(n);
	rep(i,m){
		int a,b,c;
		cin >> a >> b >> c;
		dj.add_edge(a, b, c);
	}
	dj.solve(r);
	each(val,dj.d){
		if(val == numeric_limits<T>::max()){
			cout << "INF\n";
		}else{
			cout << val << "\n";
		}
	}
    return 0;
}



Measured memory_bytes: 13080
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int a[1001];
int main(){
int n;
cin>>n;
int cnt=0;
a[0]=9999999;
int b=0;
while (n)
{
b++;
a[b]=n%10;
if (a[b-1]==a[b])cnt++;
else if (cnt<=1) cnt=0;
n=n/10;
}
if (cnt>=2) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] av){
	Scanner sc=new Scanner(System.in);

	while(true){
	    int m=sc.nextInt();
	    int f=sc.nextInt();
	    int r=sc.nextInt();
	    if(m==-1&&f==-1&&r==-1) break;
	    if(m==-1 || f==-1){ System.out.println('F'); continue;}
	    if((m+f)>=80)System.out.println('A');
	    if((m+f)>=65&&(m+f)<80)System.out.println('B');
	    if((m+f)>=50&&(m+f)<65)System.out.println('C');
	    if((m+f)>=30&&(m+f)<50){
		if(r>=50){
		    System.out.println('C');
		}else{
		System.out.println('D');
		}
	    }
	    if((m+f)<30)System.out.println('F');
	   
	}
    }
}


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

int main() {
	int n;
	cin >> n;
	vector<int> t(n);
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> t[i];
	}
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	if(t[n-1] != a[0]){
		cout << 0 << endl;
		return 0;
	}else{
		for(int i = 1; i < n - 1; i++){
			if((t[i-1] < t[i]) && (a[i] < t[i]) && (a[i] == a[i+1])){
				cout << 0 << endl;
				return 0;
			}
			if((a[i+1] < a[i]) && (t[i] < a[i]) && (t[i] == t[i-1])){
				cout << 0 << endl;
				return 0;
			}
		}
	}
	
	long long ans = 1;
	const long long mod = 1000000007;
	
	for(int i = 1; i < n - 1; i++){
		if((a[i] == a[i+1]) && (t[i] == t[i-1])){
			ans *= min(a[i], t[i]);
			ans %= mod;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
	int W, H, x, y, r;
	scanf("%d %d %d %d %d",&W, &H, &x, &y, &r);
	if( (x-r)<0 || (x+r)>W || (y-r)<0 || (y+r)>H || (2*r)>W || (2*r)>H){
		printf("No\n");
	}
	else {
		printf("Yes\n");
	}
	
	return 0;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 1e9 + 1
#define INF_LL 1LL<<60
#define ll long long

#define MAX_V 105

#define MAX_N 100
#define MAX_M 100

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    
    int pos_alice = a;
    int pos_bolys = b;

    while(1) {
        /* alice */
        if(a+1 != b) {
            a++;
        } else {
            if(a == 1) {
                cout << "Borys" << endl;
                return 0;
            } else {
                a--;
            }
        }
        /* bolys */
        if(a+1 != b) {
            b--;
        } else {
            if(b == n) {
                cout << "Alice" << endl;
                return 0;
            } else {
                b++;
            }
        }
    }

    return 0;
}

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

using ll = long long;

/*
given weights and values array, each i-th means it weights[i] and values[i] 

find the maximum with given W 

3 8
3 30
4 50
5 60
dp[i][w] = i-th means consider up to i, w means the weight it used 
1. add it (if w >= weights[i])
dp[i][w] = dp[i-1][w-weights[i]] + values[i]
2. ignore it 
dp[i][w] = dp[i-1][w]
*/

int main() {
    int n;
    int W;
    ll ans = 0;
    scanf("%d%d", &n, &W);
    
    vector<ll> dp(W+1);
    
    for (int i = 1; i <= n; i++) {
        int weight;
        int value;
        scanf("%d%d", &weight, &value);
        for (int w = W; w >= 0; w--) {
            if (w >= weight) {
                dp[w] = max(dp[w], dp[w-weight]+value); // add
            }
        }
    }
    
    ans = 0;
    
    for (ll num : dp) {
        ans = max(ans, num);
    }
    
    printf("%lld", ans);
    
	return 0;
}






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

typedef long long ll;

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

	ll t=1;
	//cin >> t;

	for(ll i=1;i<=t;i++){
		ll n;
		cin >> n;

		string s;
		cin >> s;

		ll w=0;
		for(ll j=0;j<s.size();j++){
			if(s[j]=='W')
				w++;
		}
		ll idx=s.size()-1;
		ll copy=w;
		ll r=0;
		while(copy>0){
			copy--;
			if(s[idx]=='R')
				r++;
			idx--;
		}

		cout << r << "\n";
	}
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll x,y;
        cin>>x>>y;
        if(y%2!=0)
        {
            cout<<"No";
        }
        else
        {
            if(x*4<y || y<x*2)
            {
                cout<<"No";
            }
            else
            {
                cout<<"Yes";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>

using namespace std;

int main(){
	int n;
	cin>>n;
	vector<vector<int> >inp(n,vector<int>(3,0)); 
	for(int i=0; i<n; i++){
		cin>>inp[i][0]>>inp[i][1]>>inp[i][2];
	}
	vector<vector<int> > dp(n, vector<int>(3,-1));
	dp[0][0]=inp[0][0];
	dp[0][1]=inp[0][1];
	dp[0][2]=inp[0][2];
	//cout<<dp[0][0]<<" "<<dp[0][1]<<" "<<dp[0][2]<<"\n";
	for(int i=1; i<n; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<3; k++){
				if(k!=j)
				dp[i][j]=max(dp[i][j], dp[i-1][k]);
			}
			dp[i][j]+=inp[i][j];
			//cout<<dp[i][j]<<" ";
		}		
	}
	int ans=-1;
	for(int i=0; i<3; i++){
		ans=max(ans, dp[dp.size()-1][i]);
	}
	cout<<ans<<"\n";
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
#define PI 3.1415926
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	string s;
	cin >> s;

	if(s.size() == 1){
		cout << s << endl;
		return 0;
	}

	ll a = stoll(s);
	ll ans = 0;

	for(int i = 0; i < pow(2, s.size()-1); i++){
		int cnt = 1, tmp = i;
		for(int j = s.size()-1; j >= 0; j--){
			ans += (ll)cnt * (ll)(s[j]-48);

			if(tmp % 2 == 1){	// +が入る
				cnt = 1;
			} else {
				cnt *= 10;
			}

			tmp /= 2;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d %d %d\n" @@ fun h w k ->
  let ss = Array.init h @@ fun _ ->
    Scanf.scanf "%s\n" @@ fun s -> s in
  let draw cnt s =
    let cakes = ref 0 in
    String.iter (fun c ->
      if c = '#' then incr cakes;
      Printf.printf "%d " (cnt + max 0 (!cakes - 1))) s;
    print_newline ();
    !cakes in
  let cnt = ref 1 in
  let rec solve' s cakes i =
    if i < h then begin
      let s =
        if 
          List.for_all (( = ) '.') @@
          Array.to_list @@
          Array.init (String.length ss.(i)) (String.get ss.(i))
        then s
        else (cnt := cakes + !cnt; ss.(i)) in
      solve' s (draw !cnt s) (i + 1)
    end in
  let rec solve i =
    if 
      List.for_all (( = ) '.') @@
      Array.to_list @@
      Array.init (String.length ss.(i)) (String.get ss.(i))
    then solve (i + 1)
    else begin
      for j = 0 to i - 1 do
        draw 1 ss.(i)
      done;
      solve' ss.(i) 0 i
    end in
  solve 0;



Measured memory_bytes: 6144
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<vint> vvint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }
int N, T, A;

vvint G;
vint D, E, R, V;

int dfs(int cur, int dist) {
  int ret = dist;
  D[cur] = dist;
  REP(i, G[cur].size()) {
    int nxt = G[cur][i];
    if(D[nxt] == -1) {
      int tmp = dfs(nxt, dist+1);
      if(tmp > ret) ret = tmp;
    }
  }
  if(E[cur] < ret) E[cur] = ret;
  return ret;
}

vint RR;

void dfs2(int cur) {
  V[cur] = 1;
  R.push_back(cur);
  if(cur == T) {
    //    pp(R, R.size());
    RR = R;
  }
  REP(i, G[cur].size()) {
    int nxt = G[cur][i];
    if(V[nxt] == 0) {
      dfs2(nxt);
    }
  }
  R.pop_back();
}

int f(const int a, const int t, const int d) {
  return (a + d - 1);
}

int main() {
  cin >> N >> T >> A;
  T--; A--;
  D = vint(N, -1);
  E = vint(N, -1);
  G = vvint(N);
  V = vint(N, 0);
  REP(i,N-1) {
    int a, b; cin>>a>>b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(A, 0);
  //  pp(D, D.size());
  //  pp(E, E.size());
  dfs2(A);
  
  //  pp(RR, RR.size());
  R = RR;
  int ans = 0;
  int Tdist = R.size() - 1;
  REP(i, R.size()) {
    if(i > Tdist / 2) {
      int pos = R[i];
      int tmp = f(D[pos], Tdist - D[pos], E[pos] - D[pos]);
      //      cout << i << ";" << pos << " " << tmp << " " << ans << endl;
      if(tmp > ans) ans = tmp;
    }

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


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

const int NOT_FOUND=-1;

int binarysearch(int key,int A[],int n){
  int left=0;
  int right=n;
  
  while(left<right){
    int mid=(left+right)/2;
    if(A[mid]==key){
      return mid;
     }
     else if(key<A[mid]){
       right=mid;
     }
     else{
       left=mid+1;
     }
   }
   return NOT_FOUND;

}
         
int main(){
  int n;
  cin>>n;
  
  int S[100000];
  for(int i=0;i<n;i++){
    cin>>S[i];
  }
  
  int q;
  cin>>q;
  int T[50000];
  for(int i=0;i<q;i++){
    cin>>T[i];
  }
  
  int C=0;
  
  for(int i=0;i<q;i++){
    if(binarysearch(T[i],S,n)!=NOT_FOUND){
      C++;
    }
  }
  
  cout<<C<<endl;
  return 0;
}          

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll mod=1000000007;
ll fact[2005],ifact[2005];
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)
        res=(res*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return res;
}
ll ncr(ll n,ll r){
    if(n<r)return 0;
    if(n==r)return 1;
    ll ans;
    ans=fact[n];
    ans=(ans*ifact[r])%mod;
    ans=(ans*ifact[n-r])%mod;
    return ans;
}
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ll n;cin>>n;
        fact[0]=1;
        for(ll i=1;i<2005;i++)
        fact[i]=(i*fact[i-1])%mod;
        ifact[2004]=power(fact[2004],mod-2);
        for(ll i=2003;i>=0;i--){
            ifact[i]=((i+1)*ifact[i+1])%mod;
        }
        ll ans=0,curr;
        for(ll i=1;i<n/3+1;i++){
            curr=ncr(n-i*3+i-1,i-1);
            // cout<<curr<<" ";
            ans=(ans+curr)%mod;
        }
        cout<<ans;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>

using namespace std;

int main() 
{
	int n , a[1000];
	int i;
	double ans = 0.0;
	cin >> n;
	for (i = 0; i < n; i++)
		cin >> a[i];
	for (i = 0; i < n; i++)
		ans += 1.0 / a[i];
	ans = 1.0 / ans;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int string_length, i, current_score = 0, max_score = 0;
  scanf("%d", &string_length);
  char input_str[string_length+1];
  scanf("%s", input_str);
  for(i = 0; i < string_length; i++) {
    if(input_str[i] == 'I') {
      current_score++;
      if(max_score < current_score) {
        max_score = current_score;
      }
    } else {
      current_score--;
    }
  }
  printf("%d\n", max_score);
  return 0;
}


Measured memory_bytes: 128