akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>

using namespace std;

int main(void){
  string a, b;
  cin >> a >> b;
  //入力終わり

  //つなげたった
  string tmp = a+b;

  //stringのintへの変換
  int n = atoi(tmp.c_str() );

  //ルートnの計算
  double root = sqrt(n);

  //rootのと，rootの整数部分が一致すれば平方数アリ
  if(root == (int)root)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3692
#include<stdio.h>
int main(){
  int h,w;
  int i,j;
  scanf("%d %d",&h,&w);
  while(h!=0||w!=0){
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
    scanf("%d %d",&h,&w);
  }
  return(0);
}

Measured memory_bytes: 2584
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 3e15
    
const int N=2e5+5;
const int MAXN=2e5+5;
const int M=1e9+7;
void solve()
{
	int n;
    cin >> n;
    vector<int> a(n);
    f(i,0,n-1) cin>>a[i];
    int ans=0,right=0,sum=0;
    for (int left = 0; left < n; left++) {
        while (right < n && sum + a[right] == (sum ^ a[right])) {
            sum += a[right];
            right++;
        }
        ans += right - left;
        if (left == right)
            right++;
        else
            sum -= a[left];
    }
    cout<<ans;
	
	
}
signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}



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

int waru(int a){
    if (a%2==1){
        //奇数なら0回しかわれない
        return 0;
    }
    return waru(a/2) + 1;
}

int main(void){
    int n, i, count, ans;
    cin >> n;
    int a[n];
    for(i=0; i<n; i++)cin >> a[i];
    // a[i]が何回2で割れるかを数えていく
    ans = 0;
    for(i=0; i<n; i++){
        ans += waru(a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int n,q,i,j,k,a,**A;
    scanf("%d",&n);
    
    A=(int **)malloc(n*sizeof(int *));
    for(i=0;i<n;i++)
        A[i]=(int *)malloc(n*sizeof(int));
        
    for(i=0;i<n;i++)
        for(j=0;j<n;j++)
            A[i][j]=0;
    
    
    for(i=0;i<n;i++){
        scanf("%d%d",&k,&q);
        for(j=0;j<q;j++){
            scanf("%d",&a);
            A[k-1][a-1]=1;
        }
    }
    
    for(i=0;i<n;i++){
        for(j=0;j<n-1;j++)
            printf("%d ",A[i][j]);
        printf("%d\n",A[i][j]);
    }
    return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long double ld;

const int MAX = 501;
const double EPS = 1e-9;

struct Star{ld x,y,z;};
struct Scope{ld x,y,z,theta;};

vector<Star> star;
vector<Scope> scope;

bool input(){
  int n;
  cin >> n;
  if(n == 0) return false;
  
  star.resize(n);
  for(int i = 0; i < n; i++) cin >> star[i].x >> star[i].y >> star[i].z;

  int m;
  cin >> m;
  scope.resize(m);
  for(int i = 0; i < m; i++) cin >> scope[i].x >> scope[i].y >> scope[i].z >> scope[i].theta;

  return true;
}

ld getSize(ld x, ld y, ld z){
  return sqrt(x*x+y*y+z*z);
}

bool canSee(const Scope& sc, const Star& st){

  ld nume = st.x*sc.x+st.y*sc.y+st.z*sc.z;
  ld deno = getSize(sc.x,sc.y,sc.z) * getSize(st.x,st.y,st.z);

  ld theta = acos(nume/deno);
  
  return theta<=sc.theta||fabs(theta-sc.theta) < EPS;
}

int main(){

  while(input()){
    bool see[MAX];
    memset(see,false,sizeof(see));
    
    int ans = 0;

    for(int i = 0; i < scope.size(); i++)
      for(int j = 0; j < star.size(); j++){
	if(see[j]) continue;

	if(canSee(scope[i],star[j])){
	  see[j] = true;
	  ans++;
	}
      }
    cout << ans << endl;
  }
  return 0;
}

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

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



Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int gcd(int m,int n){if(!n)return m;return gcd(n,m%n);}
int main()
{
	int ans,i,n,a[114514],g[114514],h[114514];
	cin>>n;for(i=0;i<n;i++)cin>>a[i];
	g[0]=a[0];for(i=1;i<n;i++)g[i]=gcd(g[i-1],a[i]);
	h[n-1]=a[n-1];for(i=n-2;i>=0;i--)h[i]=gcd(h[i+1],a[i]);
	ans=max(h[1],g[n-2]);for(i=0;i<n-2;i++)ans=max(ans,gcd(g[i],h[i+2]));
	cout<<ans<<endl;
}

Measured memory_bytes: 1408
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  n = int(input())
  if n==1:
    print('Hello World')
  else:
    a = int(input())
    b = int(input())
    print(a+b)
  
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5244
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, m, q;
    cin >> n >> m >> q;

    vector<vector<int>> ruiseki(505, vector<int>(505, 0));
    
    REP(i, m){
        int l, r;
        cin >> l >> r;
        ruiseki[l][r]++;
    }
    REP(i, 505){
        REP(j, 505){
            ruiseki[i][j+1] += ruiseki[i][j];
        }
    }
    
    REP(i, q){
        int l, r;
        cin >> l >> r;
        int ans = 0;
        for(int j = l; j <= r; j++){
            ans += ruiseki[j][r] - ruiseki[j][l-1];
        }
        cout << ans << endl;
    }

}


Measured memory_bytes: 1920
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>
#include <functional>

using namespace std;

int main() {

	int N, M;
	cin >> N >> M;

	priority_queue<int> vNum(N, 0);
	for (int i = 0; i < N; i++)
	{
		int tmp = 0;
		cin >> tmp;
		vNum.push(tmp);
	}

	for (int i = 0; i < M; i++)
	{
		int a = vNum.top();
		vNum.pop();
		vNum.push(a/2);
	}

	long long result = 0;
	for (int i = 0; i < vNum.size(); i++)
	{
		int a = vNum.top();
		vNum.pop();
		result += a;
	}

	cout << result;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {


    public static void main(String[] args) {
        try (CustomReader in = new CustomReader()) {
            new Main().execute(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void execute(CustomReader in) throws IOException {
        int[] nk = in.readLineAsIntArray();
        final int N = nk[0];
        final int K = nk[1];

        int[] x = in.readLineAsIntArray();


        int nm = 0;
        int np = 0;
        for (int i = 0; i < N; i++) {
            if (x[i] >= 0) {
                break;
            }
            nm++;
        }
        np = N - nm;

        int[] minus = new int[nm + 1];
        int[] plus = new int[np + 1];
        for (int i = nm; i < N; i++) {
            plus[i - nm + 1] = x[i];
        }

        for (int j = 1; j <= nm; j++) {
            minus[j] = Math.abs(x[nm - j]);
        }

        int minCost = Integer.MAX_VALUE;
        for (int i = 0; i <= nm && i <= K; i++) {
            if (K - i <= np) {
                minCost = Math.min(minCost, 2 * minus[i] + plus[K - i]);
            }
        }

        for (int i = 0; i <= np && i <= K; i++) {
            if (K - i <= nm) {
                minCost = Math.min(minCost, 2 * plus[i] + minus[K - i]);
            }
        }
        System.out.println(minCost);

    }


    static class CustomReader extends BufferedReader {
        public CustomReader() throws IOException {
            super(new InputStreamReader(System.in));
        }

        public int readLineAsInt() throws IOException {
            return Integer.parseInt(readLine());
        }

        public int[] readLineAsIntArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            int[] intArray = new int[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                intArray[i] = Integer.parseInt(strArray[i]);
            }
            return intArray;
        }

        public int[][] readAsIntMatrix(int rows, int columns) throws IOException {
            int[][] matrix = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                String[] r = this.readLine().split(" ");
                for (int j = 0; j < columns; j++) {
                    matrix[i][j] = Integer.parseInt(r[j]);
                }
            }
            return matrix;
        }

        public char[][] readAsCharMatrix(int rows) throws IOException {
            char[][] matrix = new char[rows][];
            for (int i = 0; i < rows; i++) {
                matrix[i] = this.readLine().toCharArray();
            }
            return matrix;
        }

    }

}

Measured memory_bytes: 39896
#include<iostream>
#include<cmath>
#include<string>

using namespace std;
int main(){
	int count = 0;
	string w;
	string t;


	cin >>w;

	while (1)
	{
		cin >> t;
		
		

		if (t == "END_OF_TEXT")
		{
			break;
		}
		for (int i = 0; i < t.size(); i++)
		{
			t[i] = tolower(t[i]);
		}
		if (w==t)
		{
			count += 1;
		}

	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define optimizator ios_base::sync_with_stdio(0);
#define ll long long
using namespace std;
int a[1001];
int main(){
	optimizator;
	int n,cnt=0;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			cnt+=a[i]*a[j];
		}
	}
	cout<<cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

ll func(ll n, vector<ll>& p) {
	if (n == 0)return 0;
	if (p[n] != 0) return p[n];
	ll temp = n, ones = 0;
	while (temp) {
		if (temp % 2 == 1)ones++;
		temp /= 2;
	}
	p[n] = func(n % ones, p) + 1;
	return p[n];
}

int main() {
	int N; cin >> N;
	string x; cin >> x;
	ll ones = 0;
	for (int i = N - 1; i >= 0; i--) {
		if (x[i] == '1') ones++;
	}
	
	if (ones == 0)for (int i = 0; i < N; i++) cout << 1 << endl;

	else if (ones == 1){
		for (int i = 0; i < N; i++) {
			if (x[i] == '1')cout << 0 << endl;
			else {
				if (i != N - 1)
					cout << 1 << endl;
				else
					cout << 2 << endl;
			}
		}
	}

	else {
		vector<ll> bi0(N, 1), bi1(N, 1);
		ll m0 = 0, m1 = 0;
		for (int i = N - 1; i >= 0; i--) {
			bi0[i] = ((i == N - 1 ? 1 : bi0[i + 1] * 2)) % (ones + 1);
			bi1[i] = ((i == N - 1 ? 1 : bi1[i + 1] * 2)) % (ones - 1);
			if (x[i] == '1') {
				m0 = (m0 + bi0[i]) % (ones + 1);
				m1 = (m1 + bi1[i]) % (ones - 1);
			}
			//cout << "i= " << i << " bi0=" << bi0[i] << " bi1=" << bi1[i] << endl;

		}
		//cout << "ones+1="<<ones + 1 << " ones-1=" << ones - 1 << endl;
		//cout << m0 << " " << m1 << endl;
		vector<ll> p(TE);
		for (int i = 0; i < N; i++) {
			ll n;
			if (x[i] == '0') {
				ll temp = m0 + bi0[i];
				n = temp % (ones + 1);
				//cout << temp;
			}
			else {
				ll temp = m1 - bi1[i];
				n = (temp + (ones - 1)) % (ones - 1);
				//cout << m1 + bi1[i] + (ones - 1);
			}
			//cout << " n=" << n << " ";
			cout << func(n, p) + 1 << endl;
		}
	}
}

Measured memory_bytes: 8388
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

typedef long long ll;
typedef unsigned long long ull;

// 最大公約数
ll gcd(ll a, ll b)
{
    if (a < 0)
        a = -a;
    if (b < 0)
        b = -b;
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b)
    {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <time.h>

#define loop(i, num)  for (int i = 0; i < num; i++)

using namespace std;

int a, b;

string dat;

int main() {
    
    cin >> a >> b >> dat;
    
    loop (i, a) {
        
        if (dat[i] < '0' || dat[i] > '9') {
            
            cout << "No" << endl;
            
            return  0;
            
        }
        
    }
    
    if (dat[a] != '-') {
        
        cout << "No" << endl;
        
        return  0;
        
    }
    
    for (int i = a + 1; i < a + 1 + b; i++) {
        
        if (dat[i] < '0' || dat[i] > '9') {
            
            cout << "No" << endl;
            
            return  0;
            
        }
        
    }
    
    cout << "Yes" << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+100;

void solve()
{
	ll t1,t2,a1,a2,b1,b2;
	cin>>t1>>t2>>a1>>a2>>b1>>b2;
	t1*=60ll,t2*=60ll;
	if(t1*(a1-b1)<0&&t1*(a1-b1)+t2*(a2-b2)>0){
		ll x=-t1*(a1-b1),y=t1*(a1-b1)+t2*(a2-b2);
		ll ans=(x+y-1)/y;
		ans=ans*2-1;
		if(x%y==0)ans++;
		ac;
	}
	else if(t1*(a1-b1)>0&&t1*(a1-b1)+t2*(a2-b2)<0){
		ll x=t1*(a1-b1),y=-(t1*(a1-b1)+t2*(a2-b2));
		ll ans=(x+y-1)/y;//dbg(x);dbg(y);
		ans=ans*2-1;
		if(x%y==0)ans++;
		ac;
	}
	else if(t1*(a1-b1)+t2*(a2-b2)==0)printf("infinity");
	else printf("0");
}
int main(){
    //IOS;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	char S[100000];
	int i = 0, count = 0;
	scanf("%s", S);
	while (S[i] != '\0') {
		if (S[i] == S[i + 1]) {
			count++;
			if (S[i + 1] == '0') {
				S[i + 1] = '1';
			}
			else if (S[i + 1] == '1') {
				S[i + 1] = '0';
			}
		}
		i++;
	}
	printf("%d", count);
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math
import sys
input = sys.stdin.readline


def main():
    k = int(input())
    a, b = map(int, input().split())

    result = False
    for i in range(a, b + 1):
        if i % k == 0:
            result = True
            break

    if result:
        print('OK')
    else:
        print('NG')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-GreenBin.py
#
import collections

n = int(input())
s = []
cnt = 0

for i in range(n):
    s_i = sorted(input())
    s.append("".join(s_i))

# print(s)
c = collections.Counter(s)
pairs = c.most_common()

for i in range(len(pairs)):
    pair_i = pairs[i][1]
    if pair_i > 1:
        cnt += pair_i * (pair_i-1) // 2

print(cnt)


Measured memory_bytes: 24496
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    string s;
    cin >> s;
    string ans = "";
    for (const char ch : s)
    {
        switch (ch)
        {
        case '0':
            ans.push_back('0');
            break;
        case '1':
            ans.push_back('1');
            break;
        default:
            if (!ans.empty())
            {
                ans.pop_back();
            }
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define rep(i, j, k) for (auto i = j; i < k; i++)
#define rrep(i, j, k) for (auto i = j; i > k; i--)
using namespace std;

void solve() {
  int h, w; cin >> h >> w;
  char a[51][51], b[51][51];
  set<char> set1;
  rep(i, 0, h) rep(j, 0, w) {
    cin >> a[i][j];
    if (a[i][j] == '.') continue;
    set1.insert(a[i][j]);
  }
  if (set1.size() < 1) {
    cout << "SAFE" << endl;
    return;
  }
  assert(set1.size() < 8);
  vector<char> v;
  for (auto ite : set1) v.push_back(ite);
  sort(v.begin(), v.end());
  do {
    rep(i, 0, h) rep(j, 0, w) b[i][j] = a[i][j];
    bool ok = true;
    rep(nowi, 0, (int)v.size()) {
      int left = INT_MAX, right = INT_MIN;
      rep(j, 0, w) rep(i, 0, h) {
        if (b[i][j] == v[nowi]) {
          left = min(left, j);
          right = max(right, j);
        }
      }
      int up = INT_MAX, down = INT_MIN;
      rep(i, 0, h) rep(j, 0, w) {
        if (b[i][j] == v[nowi]) {
          up = min(up, i);
          down = max(down, i);
        }
      }
      [&]{
        rep(i, up, down + 1) rep(j, left, right + 1) {
          if (b[i][j] != v[nowi] && b[i][j] != '*') {
            ok = false;
            return;
          }
        }
      }();
      if (ok) {
        rep(i, up, down + 1) rep(j, left, right + 1) {
          if (b[i][j] == v[nowi]) b[i][j] = '*';
        }
      } else {
        break;
      }
    }
    if (ok) {
      cout << "SAFE" << endl;
      return;
    }
  } while (next_permutation(v.begin(), v.end()));
  cout << "SUSPICIOUS" << endl;
}

int main() {
  int n; cin >> n;
  rep(i, 0, n) solve();
}

//////////////////////////////////////////////////////////////////////////
//NOTE
//////////////////////////////////////////////////////////////////////////
// 一つのカバンに入っている物の数は7種類以下とわかっているので、
// どんな順でx座標が大きくなっていくのかを、全通り試していければ良い.


Measured memory_bytes: 3012
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Count Balls
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  ll n, a, b;
  scanf("%lld%lld%lld", &n, &a, &b);

  ll d = a + b;
  ll c = n / d, r = n % d;

  printf("%lld\n", c * a + min(a, r));
  return 0;
}


Measured memory_bytes: 256
# 二分法

import math

a,b,x = map(int, input().split())

l = 0
r = math.pi/2



while r-l>10**(-10):
    z = (l+r)/2
    if b*math.tan(z)>a:
        flag = b*a**2-a**3/2/math.tan(z) > x
    else:
        flag = a*b**2*math.tan(z)/2 > x
    if flag:
        r = z
    else:
        l = z

print(90-math.degrees(l))







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

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

  int fp, fw, fg, fy;
  fp = fw = fg = fy = 0;
  for (int i = 0; i < N; i++) {
    string color;
    cin >> color;

    if (color == "P") {
      fp = 1;
    }
    else if (color == "W") {
      fw = 1;
    }
    else if (color == "G") {
      fg = 1;
    }
    else {
      fy = 1;
    }
  }
  int sum;
  sum = fp + fw + fg + fy;
  if (sum == 3) {
    cout << "Three" << endl;
  }
  else {
    cout << "Four" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string s;
int main(){
	cin>>s;
	int len=s.size();
	if(len%2){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<len;i+=2){
		if(s[i]=='h' && s[i+1]=='i')
			continue;
		else{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n;
    char s[51];
    scanf("%d",&n);
    scanf("%s",s);

    int count=0;
    for(int i=0;i<n-2;i++)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')count++;
    }
    printf("%d\n",count);
}

Measured memory_bytes: 128
#include <iostream>

int main(){
	int n,m,l;
	std::cin>>n>>m>>l;
	int A[n][m];
	int B[m][l];
	long C[n][l];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			std::cin>>A[i][j];
		}
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<l;j++){
			std::cin>>B[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<l;j++){
			C[i][j]=0;
			for(int k=0;k<m;k++){
				C[i][j]+=A[i][k]*B[k][j];
			}
			std::cout<<(j?" ":"")<<C[i][j];
		}
		std::cout<<std::endl;
	}	
	return 0;
}

Measured memory_bytes: 1316
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <list>
#include <chrono>
#include <thread>

using namespace std;

const bool debug = false;

#ifndef M_PI
    const double M_PI = acos(-1.0);
#endif // M_PI

#define y1 roman_kaban
#define rank oryshych_konb
#define ull unsigned long long
//#define ll long long
const int mod = int(1e9) + 9;
//const int inf = 1e7;
//const long long infLL = 1e16;
//const int MX2 = 10100500; //  e7
//const long long INF = 1e18 + 0.5;
const int MX = 1200500; //       e5
const int SZ = 11;

namespace tree{
    const int delta = 1 << 18;
    int a[2 * delta];
    void add(int pos){
        pos += delta;
        while(pos){
            a[pos]++;
            pos >>= 1;
        }
    }

    int get_sum_on_pref(int r){
        int l = delta;
        r += delta;
        int ans = 0;
        while(l <= r){
            if(l & 1) {ans += a[l++]; continue;}
            if(r % 2 == 0) {ans += a[r--]; continue;}
            l >>= 1;
            r >>= 1;
        }
        return ans;
    }
}

int a[MX];
map<long long, int> m;



int main()
{
    //vector<int> a;lower_bound(a.begin(), a.end());
    //brute(); return 0;
    ios_base::sync_with_stdio(false);
    //freopen("/Users/ozzy/Documents/in.txt","r", stdin);
    int n, k;
    cin >> n >> k;
    m[0];
    long long s = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i] -= k;
        s += a[i];
        m[s];
    }
    k = 0;
    for(auto it = m.begin(); it != m.end(); it++){
        it->second = k++;
    }
    s = 0;
    tree::add( m[0] );
    long long ans = 0;
    for(int i = 0; i < n; i++){
        s += a[i];
        int pos = m[s];
        ans += tree::get_sum_on_pref(pos);
        tree::add(pos);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int k[11];
int p[11];
int s[11][11];
int N[11];

// 数字をスイッチに変換(Nbit) N[0]は使わない
void num2switch(int i){
    int j=1;
    while(i){
        if(i%2==1){
            N[j]=1;
        }else{
            N[j]=0;
        }
        j++;
        i/=2;
    }
}

int main(){
    int n,M,cnt=0;
    cin >> n >> M;
    // 入力
    rep(i,M){
        cin >> k[i];
        rep(j,k[i]){
            cin >> s[i][j];
        }
    }
    rep(i,M){
        cin >> p[i];
    }

    //全てのスイッチの組み合わせを総当たりする(2^N)
    for(int num=0;num<pow(2,n);num++){
        num2switch(num);
        bool flag = false;
        rep(i,M){
            if(flag){
                break;
            }
            int tmp = 0;
            rep(j,k[i]){
                tmp+=N[s[i][j]]; //S(i,j)のスイッチが押されていたら+1
                tmp%=2;
            }
            if(tmp!=p[i]){ // 1つでも電球がつかなかったらフラグをたててbreak
                flag = true;
            }
        }
        if(!flag)cnt++; // すべての電球がついたらcnt++
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // Least Commont Multiple オーバーフローしないように先に割る

const ll INF = LONG_MAX;
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()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("a.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;
    cout << n*n*n;

    return 0;
}

/*
  - 1e9 : 10^9
  - vector
    vector<int> A(N);
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - string
    - loop
      for (char& c : s) {}
 */



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

const int INF = (1 << 29);
const int maxV = 128;
std::vector< std::tuple<int, int> > graph[maxV];
bool finished[maxV];
int flow[maxV][maxV], capacity[maxV][maxV];
int depth[maxV];
int src, dest;
int V, E;

void Input() {
  scanf("%d %d", &V, &E);
  for(int i = 0; i < E; ++i) {
    int s, t, c;
    scanf("%d %d %d", &s, &t, &c);
    graph[s].push_back(std::make_tuple(t, c));
    graph[t].push_back(std::make_tuple(s, 0));
    capacity[s][t] = c;
    capacity[t][s] = 0;
  }
  src = 0;
  dest = V - 1;
}

// update depth (foreach, update depth[next])
void bfs() {
  for(int i = 0; i < V; ++i) {
    depth[i] = INF;
  }
  depth[src] = 0;
  int limitdepth = INF;
  std::queue<int> q;
  q.push(src);
  while( not q.empty() ) {
    int id = q.front(); q.pop();
    if( id == dest ) limitdepth = depth[id];
    if( depth[id] > limitdepth ) break;
    for(std::tuple<int, int> I : graph[id]) {
      int next, limit;
      std::tie(next, limit) = I;
      if( limit - flow[id][next] <= 0 ) continue;
      if( depth[next] != INF ) continue;
      depth[next] = depth[id] + 1;
      q.push(next);
    }
  }
  for(int i = 0; i < V; ++i) {
    //printf("depth[%d] : %d\n", i, depth[i]);
  }
}

// try flow once
// return := one flow
int dfs(int id, int fm) {
  if( id == dest ) return fm;
  if( fm == 0 ) return 0;
  if( finished[id] ) return 0;
  for(std::tuple<int, int> I : graph[id]) {
    int next, limit;
    std::tie(next, limit) = I;
    if( not ( depth[id] < depth[next] ) ) continue;
    int ft = dfs(next, std::min(fm, limit - flow[id][next]));
    if( ft <= 0 ) continue;
    flow[id][next] += ft;
    flow[next][id] -= ft;
    return ft;
  }
  finished[id] = true;
  return 0;
}

int Dinic() {
  int total = 0;
  for(;;) {
    bfs();
    for(int i = 0; i < V; ++i) finished[i] = false;
    int f = 0;
    for(;;) {
      int ft = dfs(src, INF);
      if( ft == 0 ) break;
      f += ft;
    }
    if( f == 0 ) break;
    total += f;
  }
  return total;
}

int main() {
  Input();
  int res = Dinic();
  printf("%d\n", res);
  
  return 0;
}

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

using namespace std;

int main()
{
    int n, k, d;
    int a[101] = {0};
    
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        cin >> d;
        for (int j = 0; j < d; j++) {
            int v;
            cin >> v;
            a[v-1] = 1;
        }
    }
    int c = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == 0) {
            c++;
        }
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3636
X, N = $stdin.gets.split.map {|i| i.to_i }
if N == 0
  puts X
  exit
end
P = $stdin.gets.split.map {|i| i.to_i }
p_map = Hash[P.map {|p| [p, true] }]
p_s = X
p_l = X
loop do
  if !p_map[p_s]
    puts p_s
    exit
  elsif !p_map[p_l]
    puts p_l
    exit
  end
  p_s -= 1
  p_l += 1
end


Measured memory_bytes: 14392
#include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define _start  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb 		push_back
#define ss 		second
#define ff 		first
#define int     long long
#define ll		long long
#define mk      make_pair
#define ld 		long double
#define vi 		vector<int>
#define pi		pair<int,int>
#define mod 	1000000007
#define pqg     priority_queue<int>
#define pqs     priority_queue<int,vi,greater<int> >
#define forn(p,n) for(int i=p;i<=n;i++)
#define w(t) 	int t; cin>>t; while(t--)
#define kick(t) int t; cin>>t; for(int p=0;p<t;p++)
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> oset;
ll powmod(ll base,ll exp,ll MOD=mod){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mul_inv(ll a,ll b = mod) {ll t1=a,t2=b,t3,v1=1,v2=0,v3;while(t2!=1){ll x=t1/t2;t3=t1-x*t2;v3=v1-x*v2;t1=t2,t2=t3;v1=v2,v2=v3;}return(v2+b)%b;}

int32_t main() {
    _start
    ld n,x,t;
    cin>>n>>x>>t;
    int32_t temp=ceil( (ld)n/x );
    temp=temp*t;
    cout<<temp<<endl;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int A[100010];
ll ac[100010];
bool r[100010];

int main() {
	cin >> N;
	rep(i, N) cin >> A[i];
	sort(A, A + N);
	rep(i, N) ac[i+1] = ac[i] + A[i];
	r[N] = 1;

	for (int i = N-1; i >= 0; --i) {
		r[i] = r[i+1];
		if (ac[i] * 2 < A[i]) {
			r[i] = 0;
		}
	}

	int ret = 0;
	ll t = LLONG_MAX;

	rep(i, N) {
		t = min(t, A[i] - ac[i] * 2);
		if (A[i] * 2 >= t && r[i+1]) {
			++ret;
		}
	}
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 1536
import sys

n=int(input())
a=[int(x) for x in input().rstrip().split()]

even=0
odd=0
num4=0
for i in a:
  if i%4==0:
    num4+=1
    continue

  elif i%2==0:
    even+=1
  else:
    odd+=1


if odd<=num4:
  print("Yes")
elif odd-1==num4 and even==0:
  print("Yes")
elif odd==0 and 2<=even:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 20036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
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 main()
{
  double r;
  cin >> r;

  cout << r * M_PI * 2 << endl;

  return 0;
}


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


int main() {
    char a[100][100];
    int h,w;
    cin>>h>>w;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            cin>>a[i][j];
        }
    }
    for(int i = 1; i <= w+2;i++){
        cout<<"#";
    }
    cout<<endl;
    for(int i = 0;i < h;i++){
        cout<<"#";
        for(int j = 0; j <w;j++){
            cout<<a[i][j];
        }
        cout<<"#"<<endl;
    }
    for(int i = 1; i <= w+2;i++){
        cout<<"#";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 10000000000000
int main(){
      int n,m,d[1005],c[1005];
      long long dp[1005][1005];
      cin >> n >> m;
      for(int i = 0; i < n;i++)cin >> d[i];
      for(int i = 0; i < m;i++)cin >> c[i];
      for(int i = 0;i <= m;i++)for(int j = 0;j<=n;j++)dp[i][j] = INF;
      dp[0][0] = 0;
      for(int i = 0; i < m;i++){
            for (int j = 0;j <= n;j++){
                  if(dp[i][j]!=INF){
                        dp[i+1][j] = min(dp[i][j],dp[i+1][j]);
                        dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j]+d[j]*c[i]);
                  }
            }
      }
      cout << dp[m][n] << endl;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

int inputValue();
void inputArray(int *, int);
void inputVector(vector<int> *, int);
template <typename T> void output(T, int);

int main() {
    int n, m, q_num;
    cin >> n >> m >> q_num;

    int l[m], r[m];
    rep(i, m) { cin >> l[i] >> r[i]; }

    int p[q_num], q[q_num];
    rep(i, q_num) { cin >> p[i] >> q[i]; }

    int field[n + 1][n + 1];
    memset(field, 0, sizeof field);
    rep(i, m) { field[l[i]][r[i]]++; }

    int sum[n + 1][n + 1];
    memset(sum, 0, sizeof sum);

    rep(i, n + 1) {
        repd(j, 1, n + 1) { sum[i][j] = sum[i][j - 1] + field[i][j]; }
    }

    repd(i, 1, n + 1) {
        repd(j, 1, n + 1) { sum[i][j] += sum[i - 1][j]; }
    }

    rep(i, q_num) {
        int ans = sum[q[i]][q[i]] - sum[q[i]][p[i] - 1] - sum[p[i] - 1][q[i]] +
                  sum[p[i] - 1][p[i] - 1];

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

int inputValue() {
    int a;
    cin >> a;
    return a;
}

void inputArray(int *p, int a) {
    rep(i, a) { cin >> p[i]; }
}

void inputVector(vector<int> *p, int a) {
    rep(i, a) {
        int input;
        cin >> input;
        p->push_back(input);
    }
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}


Measured memory_bytes: 5248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC045A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int h = int.Parse(Console.ReadLine());

            Console.WriteLine((a + b) * h / 2);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
// https://atcoder.jp/contests/dp/tasks/
#include <bits/stdc++.h>

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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a;

    rep(i, n) {
        cin >> a;
        if (a % 2 == 1)
            continue;
        if (a % 3 == 0 || a % 5 == 0) {
            continue;
        } else {
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  sort(a.begin(),a.end());

  vector<ll> edge(n,0);
  int k = 0;

  int cnt = 1;
  ll prev = a[0];
  for(int i=1;i<n;i++){
    if(a[i] == prev){
      cnt++;
      if(cnt==2 || cnt==4){
        edge[k++] = a[i];
      }
    }else{
      prev = a[i];
      cnt = 1;
    }
  }

  sort(edge.begin(),edge.end());

  ll ans = 0;
  ans = edge[n-1]*edge[n-2];
  cout << ans << endl;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			int[] l = Console.ReadLine().Split().Select(int.Parse).OrderBy(p => p).ToArray();
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", l));

			long ans = 0;
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					int t = l[i] + l[j];
					int index = BinarySearch(l, j + 1, n - 1, t);
					if (index < 0) {
						index = ~index;
					}
					ans += index - (j + 1);
				}
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}


		#region 二分探索 int BinarySearch<T>(T[] array, int lower, int upper, T value, Comparison<T> compare)
		public static int BinarySearch<T>(T[] array, T value) { return BinarySearch(array, 0, array.Length - 1, value, Comparer<T>.Default.Compare); }
		public static int BinarySearch<T>(T[] array, T value, IComparer<T> comparer) { return BinarySearch(array, 0, array.Length - 1, value, comparer.Compare); }
		public static int BinarySearch<T>(T[] array, T value, Func<T, T, int> compare) { return BinarySearch(array, 0, array.Length - 1, value, compare); }
		public static int BinarySearch<T>(T[] array, int lower, int upper, T value) { return BinarySearch(array, lower, upper, value, Comparer<T>.Default.Compare); }
		public static int BinarySearch<T>(T[] array, int lower, int upper, T value, IComparer<T> comparer) { return BinarySearch(array, lower, upper, value, comparer.Compare); }
		public static int BinarySearch<T>(T[] array, int lower, int upper, T value, Func<T, T, int> compare)
		{
			if (lower > upper) {
				return ~(upper + 1);
			}
			int up = upper, mid;
			while (lower < up) {
				mid = (lower + up) / 2;
				if (compare(array[mid], value) < 0) {
					lower = mid + 1;
				} else {
					up = mid;
				}
			}
			int r = compare(array[lower], value);
			if (r != 0) {
				if (lower == upper && r < 0) {
					lower++;
				}
				lower = ~lower;
			}
			return lower;
		}
		#endregion


	}
}


Measured memory_bytes: 19648
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;
using namespace std;

char str[10];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    printf("0\n"); fflush(stdout);
    scanf("%s", str);
    if(strcmp(str, "Vacant")==0) {
        return 0;
    }
    int flag0 = (strcmp(str, "Male")==0)? 0: 1;
    int l=0, r=n;
    while(r-l>1) {
        int m=(l+r)/2;
        printf("%d\n", m); fflush(stdout);
        scanf("%s", str);
        if(strcmp(str, "Vacant")==0) {
            return 0;
        }
        int flagtmp = (strcmp(str, "Male")==0)? 0: 1;
        if((m-l+flag0+flagtmp)%2) {
            r=m;
        }
        else {
            l=m;
            flag0=flagtmp;
        }
    }

    return 0;
}


Measured memory_bytes: 844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace atcorder_BeginnerContest_123
{
    class Program
    {

        static void Main(string[] args)
        {

            int[] pointArr = new int[5];
            int lastIdx = 0;
            int lastVal = 0;
            int minLen = 10;

            for (int i = 0; i < 5; i++)
            {
                pointArr[i] = int.Parse(Console.ReadLine());
                int modVal = pointArr[i] % 10;
                if ((0 == i)||((0 != modVal) &&(modVal < minLen)))
                {
                    minLen = modVal;
                    lastVal = pointArr[i];
                    lastIdx = i;
                }

                if (0 < modVal)
                {
                    pointArr[i] += 10 - modVal;
                }

            }

            int ret = 0;
            for(int i = 0; i < 5; i++)
            {
                if (i != lastIdx)
                {
                    ret += pointArr[i];
                }
                else
                {
                    ret += lastVal;
                }
            }

            Console.WriteLine(ret);

        }

    }
}



Measured memory_bytes: 11092
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    string s;

    cin >> s;

    if (s[0] == s[1] && s[1] == s[2])
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
from fractions import gcd
N=int(input())
A=list(map(int,input().split(' ')))
ans = 0
l_1 = 1
l_2 = 1
mod = 10**9+7
def lcm(x,y):
    return x*y//gcd(x,y)
for i in A[:N//2]:
    l_1 = lcm(l_1,i)
for j in A[N//2:]:
    l_2 = lcm(l_2,j)
l = lcm(l_1,l_2)
out1 = sum([l_1//i for i in A[:N//2]])
out2 = sum([l_2//i for i in A[N//2:]])
out1 *= l//l_1
out2 *= l//l_2
print((out1+out2)%mod)

Measured memory_bytes: 168184
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt();
		PriorityQueue<Double> que = new PriorityQueue<Double>();
		for(int i = 0; i < N; i++) {
			double a = sc.nextDouble();
			que.add(-a);	// 逆順に
		}

		while(M > 0) {
			double p = que.poll();
			que.add(p / 2.0);
			M--;
		}

		long sum = 0;
		for(double price : que) {
			sum += -(long)(price);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 95776
local N, M = io.read("n", "n")
local A = {}
for i=1,N do
    A[i] = io.read("n")
end
local T = {}
for i=1,M do
    local b, c = io.read("n", "n")
    T[i] = {b, c}
end
table.sort(A)
table.sort(T, function(x, y) return x[2] > y[2] end)

local card_idx = 1
for i=1, M do
    local b, c = table.unpack(T[i])
    for j = card_idx, math.min(card_idx + b - 1, N) do
        if A[j] < c then
            A[j] = c
        end
    end
    card_idx = card_idx + b
end

local sum = 0
for i=1,N do
    sum = sum + A[i]
end
print(sum)


Measured memory_bytes: 15352
n = gets.to_i
s =  n.abs.to_s(2).reverse

if n==0
  p 0
  exit
end

bit = [0]*34
s.size.times{|i|
  if s[i]==?1
    if i%2==((n>0)? 0:1)
      bit[i] += 1
      while bit[i] >= 2
        bit[i] -= 2
        bit[i+1] += 1
        bit[i+2] += 1
      end
    else
      if bit[i] == 0
        bit[i] = 1
        bit[i+1] = 1
      else
        bit[i] = 0
      end
    end
  end
}

bit.reverse!
puts bit[bit.index(1)..-1]*""


Measured memory_bytes: 1788
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

A,B,C = imn()

count = 0
for i in range(10**6):
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1: break
    count += 1
    a = A
    b = B
    c = C

    A = b//2 + c//2
    B = a//2+ c//2
    C = a//2 + b//2
else:
    count = -1
print(count)

Measured memory_bytes: 5300
#include <stdio.h>

int main(void) {

  int n,a,b;
  scanf("%d %d %d", &n, &a, &b);
  if ((b-a)%2 == 0) {
    printf("Alice\n");
  } else {
    printf("Borys\n");
  }

  return 0;
}

Measured memory_bytes: 128