akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#ifndef ONLINE_JUDGE
#include <custom/prettyprint.hpp>
#endif
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define pow10(n) stoll("1"+string(n,'0'))
#define dbg(x) cout << ">>> " << #x << ": " << x << '\n'

const int MOD = 1e9+7; //998244353
const int inf = 1e9+3;
const ll INF = ll(3e18)+3;
const ld PI = acos((ld)-1);
const int dx[8] = {1,0,-1,0,1,1,-1,-1}, dy[8] = {0,1,0,-1,-1,1,1,-1};
mt19937_64 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll n) { return uniform_int_distribution<ll>(0, n)(rng); }
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

void setIO(const string& s) {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

int main() {
    
    setIO("input");
    int n; ll d; cin >> n >> d;
    d *= d;
    int cnt = 0;
    for(int i=0; i<n; ++i) {
        ll x,y; cin >> x >> y;
        if(x*x + y*y <= d)
            cnt++;
    }
    cout << cnt << '\n';
    
}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

Measured memory_bytes: 3660
#include <cmath>
#include <iostream>

int roundUpFirstDigit(int value);
int compareFirstDigit(int minFirstDigitValue, int value);

int main() {
	int sumTime = 0;
	int minFirstDigitValue = 10;
 
	for (int i = 0; i < 5; i++) {
        int input;
        std::cin >> input;
		minFirstDigitValue = compareFirstDigit(minFirstDigitValue, input);
		sumTime += roundUpFirstDigit(input);
	}
 
	sumTime -= 10 - minFirstDigitValue;
 
    std::cout << sumTime << std::endl;
  
    return 0;
}

int roundUpFirstDigit(int value) {
	return std::ceil(double(value) * 0.1) * 10;
}
 
int compareFirstDigit(int minFirstDigitValue, int value) {
	int firstDigit = value % 10;
	if (firstDigit < minFirstDigitValue && firstDigit > 0) {
		minFirstDigitValue = firstDigit;
	}
	return minFirstDigitValue;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	ll n, m;
	ll ans = 0;
	cin >> n >> m;
	if (m >= 2*n) {
		ans += n;
		m -= 2 * n;
		ans += m / 4;
	}
	else {
		ans += m / 2;

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

Measured memory_bytes: 256
import math
n,m = map(int,input().split())
a = math.factorial(n)
b = math.factorial(m)
if abs(n-m) >= 2:
    print(0)
    exit()
if (n+m) % 2 == 0:
    print((a*b)*2%(10**9+7))
else:print((a*b) % (10**9+7))

Measured memory_bytes: 5196
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
using namespace std;
int main() {
    int a,b;
    char c;
    cin>>a>>c>>b;
    if(c=='+'){
        cout<<a+b<<endl;
    }else{
        cout<<a-b<<endl;
    }
}   



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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n,a[101],b[101],c[101],s=0;

void nhap()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
    {
        scanf("%d",&a[i]);
    }
    for (int i=1;i<=n;++i)
    {
        scanf("%d",&b[i]);
    }
    for (int i=1;i<n;++i)
    {
        scanf("%d",&c[i]);
    }
}

void process()
{
    for (int i=1;i<=n;++i)
    {
        s+=b[a[i]];
        s+=c[a[i]]*(a[i+1]==a[i]+1);
    }
    cout<<s;
}

int main()
{
    nhap();
    process();
    return 0;
}


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

int main()
{
    int n,mn,mx,c;
    cin >> n;
    cin >> mn;
    mx=mn;
    for (int i=1;i<n;i++)
    {
        cin >> c;
        mn=min(c,mn);
        mx=max(c,mx);
    }
    cout << mx-mn;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    
    ll ans=0;
    
    ll count=0;
    
    for(int i=0; i<a; i++){
        count++;

        ans += 1;
        if(count == k) {
            cout << ans << endl;
            return 0;
        }
    }
    //cout << ans << endl;
    
    for(int i=0; i<b; i++){
        count++;
        if(count == k) {
            cout << ans << endl;
            return 0;
        }
        //ans += 0;
    }
    //cout << ans << endl;
    
    for(int i=0; i<c; i++){
        count++;
        ans -= 1;
        if(count == k) {
            cout << ans << endl;
            return 0;
        }
        
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  if (A.at(A.size()-1)==B.at(0)&&B.at(B.size()-1)==C.at(0)) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

using namespace std;

string minx(const string &a, const string &b) {
    auto n = a.size();
    auto m = b.size();
    if(m > n) {
        return "~";
    }
    for(int idx = 0; idx < m; ++idx) {
        if(b[m-idx-1] != a[n-idx-1]) {
            return "~";
        }
    }
    return a.substr(0,n-m);
}

int main() {
    string S;
    vector<string> words = 
    {"dream", "dreamer", "erase", "eraser"};
    cin >> S;
    while(S.size() > 0) {
        bool flag = false;
        for(auto T: words) {
            if(minx(S,T) != "~") {
                flag = true;
                S = minx(S,T);
            }
        }
        if(!flag) {
            break;
        }
    }
    if(S.size() > 0)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
    return 0;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();

        int answer = n % 2 == 0 ? n : n * 2;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int a, b, t;
	cin >> a >> b >> t;

	cout << (t / a * b) << "\n";

	return 0;
}


Measured memory_bytes: 256
import sys

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

S = input().rstrip()

A = [s for s in S]
B = []

now = -1
cur = 0
for i, a in enumerate(A):
	if now == -1:
		B.append(a)
		now = a
	if now != a:
		B.append(a)
		now = a

# print(B)

print(len(B)-1)

Measured memory_bytes: 49332
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b;
    c=b*2;
    if(c>=a){
        cout << '0'<<endl;

    }
    else{
        cout<< a-c << endl;

    }
    return 0;
}


Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS

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

//#define F first
//#define S second

// TIMER
std::clock_t __start;
double __duration;
void start_timer() { __start = std::clock(); }
void print_timer() {
	__duration = (std::clock() - __start) / (double)CLOCKS_PER_SEC;
	std::cout << "Duration (msec): " << __duration * 1000 << '\n';
}
// END TIMER

//PI
# define M_PI		3.14159265358979323846
// fast input
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)

template <class T>
T min_(T a, T b) { return (a < b ? a : b); }
template <class T>
T max_(T a, T b) { return (a > b ? a : b); }

double EPS = 1e-16;
bool eq_(const double& lhs, const double &rhs) {
	return (fabs(lhs - rhs) < EPS);
}

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> llll;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<llll> vllll;
typedef vector<int> vi;
typedef vector<ull> vull;


# define M_PI		3.14159265358979323846
const int INF = int(2e9);
const ll INF_LL = LLONG_MAX;
const ll MOD = 1e9 + 7;

unordered_map<ull, int> smallest_base;
bool perfect_square(ull N) {
	return eq_(ull(sqrt(N))*ull(sqrt(N)), N);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string S;
	cin >> S;
	int res = 0;
	char last = S[0];
	for (int i = 1; i < S.size(); ++i) {
		if (S[i] != last) {
			++res;
			last = S[i];
		}
	}
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 512
use std::io;
use std::io::{Read, BufReader};
use std::cmp;

fn next_token<R: Read>(reader: &mut R) -> Vec<u8> {
    let mut buf: [u8; 1] = [0];
    let mut read_chars = false;
    let mut ret: Vec<u8> = vec![];

    loop {
        if reader.read(&mut buf).unwrap() == 0 {
            break;
        } else {
            if buf[0] == '\r' as u8 || buf[0] == '\n' as u8 || buf[0] == ' ' as u8 {
                if read_chars {
                    break;
                }
            } else {
                read_chars = true;
                ret.push(buf[0]);
            }
        }
    };
    ret
}
fn next_i64<R: Read>(reader: &mut R) -> i64 {
    let token = next_token(reader);
    let mut ret: i64 = 0;
    let mut sgn = false;

    for c in token {
        if '0' as u8 <= c && c <= '9' as u8 {
            ret = ret * 10 + (c - ('0' as u8)) as i64;
        } else if '-' as u8 == c {
            sgn = true;
        }
    };
    ret * if sgn { -1 } else { 1 }
}
fn next_i32<R: Read>(reader: &mut R) -> i32 {
    next_i64(reader) as i32
}
fn abs(t: i32) -> i32 {
    if t > 0 {
        t
    } else {
        -t
    }
}
fn apply(x: i32, mv: i32) -> i32 {
    cmp::min(x, cmp::max(x - mv, mv / 2))
}
fn main() {
    let buf = &mut BufReader::new(io::stdin());

    let n = next_i32(buf);
    let d = next_i32(buf);
    let mut di = vec![];

    for _ in 0..n {
        di.push(next_i32(buf));
    }

    let mut ans = vec![false; n as usize];
    let mut bnd = vec![0 as i32; (n+1) as usize];
    bnd[n as usize] = 0;
    let mut i = n - 1;
    while i >= 0 {
        let mut lo = 0;
        let mut hi = 1001001001;
        while lo < hi {
            let mid = (lo + hi + 1) / 2;
            let dd = apply(mid, di[i as usize]);

            if dd <= bnd[(i + 1) as usize] {
                lo = mid
            } else {
                hi = mid - 1
            }
        }
        bnd[i as usize] = lo;
        i -= 1;
    }
    let mut curd = d;
    for i in 0..n {
        ans[i as usize] = curd > bnd[(i + 1) as usize];
        curd = cmp::min(curd, abs(curd - di[i as usize]));
    }

    let q = next_i32(buf);
    for _ in 0..q {
        let qi = next_i32(buf);
        println!("{}", if ans[(qi - 1) as usize] { "YES" } else { "NO" } );
    }
}


Measured memory_bytes: 10108
import itertools
 
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

dic = itertools.permutations(range(1, N + 1), N)
count = [False, 0]
for i in dic:
    if list(i) == P:
        if count[0]:
            break
        else:
            count[0] = True
    if list(i) == Q:
        if count[0]:
            break
        else:
            count[0] = True
    if count[0]:
        count[1] += 1

print(count[1])

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

using namespace std;

#define long long long
#define INF ((long) 2e18)
#define MOD ((long) (1e9 + 7))
#define umap unordered_map

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

    long t = 1;
    //cin >> t;

    while (t--) {
        long n;
        cin >> n;

        long best = INF;
        for (long k = 1; k <= sqrt(n); k++) {
            if (n % k == 0) {
                long l = n/k;
                long aux = k + l - 2;
                best = min(aux, best);
            }
        }
        printf("%lld\n", best);
        return 0;
    }
}


Measured memory_bytes: 3740
package main

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

func nextInt(s *bufio.Scanner) int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func nextFloat64(s *bufio.Scanner) float64 {
	s.Scan()
	f, _ := strconv.ParseFloat(s.Text(), 64)
	return f
}

func solve(n int, p []float64) float64 {
	dp := make([][]float64, n+1)
	dp[0] = []float64{1}

	for i := 0; i < n; i++ {
		dp[i+1] = make([]float64, i+2)
		for j := 0; j < i+1; j++ {
			dp[i+1][j] += dp[i][j] * (1 - p[i])
			dp[i+1][j+1] += dp[i][j] * p[i]
		}
	}

	r := 0.0
	for i := n/2 + 1; i <= n; i++ {
		r += dp[n][i]
	}

	return r
}

func main() {
	s := bufio.NewScanner(bufio.NewReader(os.Stdin))
	s.Split(bufio.ScanWords)

	n := nextInt(s)
	p := make([]float64, n)
	for i := 0; i < n; i++ {
		p[i] = nextFloat64(s)
	}

	fmt.Println(solve(n, p))
}


Measured memory_bytes: 40064
import java.util.*;
public class Main {
    public static void main(String[]args){
        // 標準入力
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        // 9*9の答えの格納
        int [][]answers = new int[10][10];
        
        for (int i=1;i < 10;i++){

            for (int j = 1; j<10 ;j++){
              
                answers [i][j] = i * j;
            }
        }
        
        boolean flg = false;
        
        for (int i=1;i < 10;i++){
            
            for (int j = 1;j<10;j++){
                
                // 該当するものがあれば処理を終了し答えを出力
                if (N == answers[i][j]){
                    flg = true;
                    System.out.println("Yes");
                    break;
                } 
            }
            if (flg) break;

        }
        
        if (!flg){
            System.out.println("No");
        }
    }   
       
}       

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

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

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

    int n;
    cin>>n;
    vector<tuple<int, int, char, ll, string>> ts;
    rep(i, n) {
        int v, w;
        ll d;
        char t;
        string s;
        cin>>v>>w>>t>>d>>s;
        ts.emplace_back(v, w, t, d, s);
    }

    sort(ts.begin(), ts.end());
    rep(i, n) cout<<get<0>(ts[i])<<' '<<get<1>(ts[i])<<' '<<get<2>(ts[i])<<' '<<get<3>(ts[i])<<' '<<get<4>(ts[i])<<endl;
}


Measured memory_bytes: 11196
a,b,c,d,e,f = map(int, input().split())

A = []
i = 0
while(100*a*i < f):
    A.append(100*a*i)
    i += 1

B = []
i = 0
while(100*b*i < f):
    B.append(100*b*i)
    i += 1

AB = set()
for aa in A:
    for bb in B:
        if aa+bb < f:
            AB.add(aa+bb)
AB.remove(0)

max_sugar = e * f / (100.0 + e)
#print(max_sugar)
C = []
i = 0
while(c*i <= max_sugar):
    C.append(c*i)
    i += 1

D = []
i = 0
while(d*i <= max_sugar):
    D.append(d*i)
    i += 1

CD = set()
for cc in C:
    for dd in D:
        if cc+dd <= max_sugar:
            CD.add(cc+dd)

#print(AB)
#print(CD)

# 全パターン試す
MAX_DENS = e/(e+100.0)
#print(MAX_DENS)
max_dens = -1
max_ws = ()
for water in AB:
    for sugar in CD:
        weight = water + sugar
        dens = sugar / weight
        if weight > f or dens > MAX_DENS:
            continue
        if max_dens < dens:
            #print(dens, MAX_DENS)
            max_dens = dens
            max_ws = (weight, sugar)
#print(max_dens)
print('%d %d' % max_ws)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,M;
  int count = 0;
  double sum = 0;
  cin >> N >> M;
  vector<int> A(N);
  for (int i=0; i<N; i++)
  {
    cin >> A[i];
    sum += A[i];
  }
  sort(A.begin(), A.end(), greater<int>());
  
  double jud = sum/(4*M);  
  for (int i=0; i<N; i++)
  {
    if (A[i] >= jud)
    {
      count++;
    }
    else break;
  }
  if (count < M) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
n, m = [int(x) for x in input().split()]
pi_yi_list = [[] for i in range(n)]
input_list = []
iddict = {}
for i in range(m):
    pi, yi = [int(x) for x in input().split()]
    pi_yi_list[pi - 1].append(yi)
    input_list.append(str(pi) + str(yi))
    iddict[str(pi) + str(yi)] = -1
pi_yi_list_sorted = [sorted(x) for x in pi_yi_list]
for pi, pilist in enumerate(pi_yi_list_sorted):
    for j, yi in enumerate(pilist):
        iddict[str(pi + 1) + str(yi)] = '{:0=6}'.format(pi+1) + '{:0=6}'.format(j+1)

for input in input_list:
    print(iddict[input])

Measured memory_bytes: 57260
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
using namespace std;

int step;
char gard[200][200];
int dir[4][2] = { {1,0},{-1,0},{0,1},{0,-1} };

void dfs( int y, int x , char pattern)
{
	int nx, ny;
	for(int i=0; i<4; ++i)
	{
		nx = x+dir[i][0]; ny = y+dir[i][1];
		if( gard[ny][nx]==pattern )
		{
			gard[ny][nx]=0;
			dfs(ny,nx,pattern);
		}
	}
}

int main(void)
{
	ios::sync_with_stdio(false);
	int W, H;
	while(cin>>H>>W && H && W)
	{
		memset(gard,0x00,sizeof(gard));
		step = 0;
		for(int i=1; i<=H; ++i)
		{
			for(int j=1; j<=W; ++j)
			{
				cin>>gard[i][j];
			}
		}
		for(int i=1; i<=H; ++i){
			for(int j=1; j<=W; ++j){
				if( gard[i][j] )
				{
					char pattern = gard[i][j];
					gard[i][j] = 0;
					dfs(i, j, pattern);
					++step;
				}
			}
		}
		cout<<step<<'\n';
	}
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define db double
#define ld long double
#define pii pair<int,int> 
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<vi>
#define lb lower_bound
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,b,a) for(int i=(b);i>=(a);--i)
#define rep0(i,a,b) for(int i=(a);i<(b);++i)
#define fore(i,a) for(int i=0;i<a.size();++i) 
#define ls ch[x][0]
#define rs ch[x][1]
inline int rd()
{
	int x=0,w=1;char c=getchar();while(!isdigit(c)&&c!='-')c=getchar();
	if(c=='-')w=-1,c=getchar();while(isdigit(c))x=x*10+c-48,c=getchar();return x*w;
}
const int N=200005;
int n,a,b,tp,stk[N],f[N];
int main()
{
	scanf("%d%d",&a,&b);n=a+b;
	if(a<=b){puts("Impossible");return 0;}
	rep(i,0,n-1)
	{
		if(!tp){stk[++tp]=i;continue;}
		printf("? %d %d\n",stk[tp],i);
		fflush(stdout);char o[5];scanf("%s",o);
		if(o[0]=='Y')stk[++tp]=i;else tp--;
	}
	f[stk[tp]]=1;
	rep(i,0,n-1)if(i!=stk[tp])
	{
		printf("? %d %d\n",stk[tp],i);
		fflush(stdout);char o[5];scanf("%s",o);
		if(o[0]=='Y')f[i]=1;
	}
	printf("! ");
	rep(i,0,n-1)putchar('0'+f[i]);
	return 0; 
}

Measured memory_bytes: 724
#include <stdio.h>

int main(void){
    int i,j,n;float m[8],e;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=0;j<8;j++){scanf("%f",&m[j]);}
        e=(m[3]-m[1])*(m[6]-m[4])-(m[7]-m[5])*(m[2]-m[0]);
        printf("%s\n",(e==0)?"YES":"NO");
    }
    return 0;
}



Measured memory_bytes: 2032
package main

import "fmt"

const MAX_N int = 100000

func gcd(x, y int) int {
    for y > 0 {
        x, y = y, x % y
    }
    return x
}

func max(x, y int) int {
    if x > y {
        return x
    }
    return y
}

func main() {
    var n int
    fmt.Scan(&n)
    var a [MAX_N]int
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
    }
    var forward, backword [MAX_N + 1]int
    forward[0], backword[n] = 0, 0
    for i := 1; i <= n; i++ {
        forward[i] = gcd(forward[i - 1], a[i - 1])
    }
    for i := n; i > 0; i-- {
        backword[i - 1] = gcd(backword[i], a[i - 1])
    }
    ans := 0
    for i := 0; i < n; i++ {
        g := gcd(forward[i], backword[i + 1])
        if g > ans {
            ans = g
        }
    }
    fmt.Println(ans)
}



Measured memory_bytes: 7040
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy" << endl;
    if (s == "Cloudy") cout << "Rainy" << endl;
    if (s == "Rainy") cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});
//条件式が真ならwhileの中身を回し続ける

bool flag[1050000];

int main() {
	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;
	if (s == u)cout << a - 1 << " " << b << endl;
	else cout << a << " " << b - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
	if(y<=0) return 1;
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

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

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<<fixed<<setprecision(10);

	ll n, k, x;
	cin>>n>>k;
	vi neg, pos;
	for(ll i=0;i<n;i++){
		cin>>x;
		if(x<0) neg.pb(x);
		else pos.pb(x);
	}
	if(pos.size()==0){
		ll ans=1;
		if(k%2==0){
			sort(all(neg));
			for(ll i=0;i<k;i++){
				ans = mul(ans, neg[i]);
			}
		}
		else{
			sort(all(neg), greater<ll>());
			for(ll i=0;i<k;i++){
				ans = mul(ans, neg[i]);
			}
		}
  		if(ans<0) ans+=2*mod;
		cout<<ans%mod;
	}
	else{
		ll ans=1;
		sort(all(neg));
		sort(all(pos), greater<ll>());
		ll i=0, j=0;
		j = min(k, (ll)(pos.size()));
		i = k-j;
		if(i%2==1 && i<(ll)neg.size()) {
			j--;i++;
		}
		ll op1, op2;
		while(1){
			if(i+2<=(ll)(neg.size()) && j>=2){
				op1 = neg[i]*neg[i+1];
				op2 = pos[j-1]*pos[j-2];
				if(op1>op2){
					i+=2;
					j-=2;
				}
				else break;
			}
			else break;
		}
		for(ll it=0;it<j;it++){
			ans = mul(ans, pos[it]);
		}
		for(ll it=0;it<i;it++){
			ans = mul(ans, neg[it]);
		}
		if(ans<0) ans+=2*mod;
		cout<<ans%mod;
	}
    return 0;
}


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

const int MOD = 1000000007;

int main() {
    int n, i;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;
    bool isPair;
    ll ans = 0;
    if (s1[0] == s2[0]) {
        isPair = false;
        ans = 3;
        i = 1;
    } else {
        isPair = true;
        ans = 6;
        i = 2;
    }
    while (i < n) {
        if (isPair) {
            // Y ?
            if (s1[i] == s2[i]) {
                i++;
                isPair = false;
            } else {
                ans = (ans * 3) % MOD;
                i += 2;
                isPair = true;
            }
        } else {
            // X ?
            if (s1[i] == s2[i]) {
                ans = (ans * 2) % MOD;
                isPair = false;
                i++;
            } else {
                ans = (ans * 2) % MOD;
                isPair = true;
                i += 2;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;

struct UnionFind {
  vector<int> par;
  vector<int> siz;

  UnionFind(int n) {
    par = vector<int>(n);
    siz = vector<int>(n, 1);
    rep(i, n) {
      par[i] = i;
    }
  }

  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
  }

int size(int x) {
    return siz[root(x)];
  }
};

int main() {
  int v, e; cin >> v >> e;
  UnionFind uf(v);
  vector<tuple<int, int, int>> vt;
  rep(i, e) {
    int s, t, w; cin >> s >> t >> w;
    vt.push_back(make_tuple(w, s, t));
  }
  sort(vt.begin(), vt.end());
  int ans = 0;
  for (tuple<int, int, int> t : vt) {
    if (!uf.same(get<1>(t), get<2>(t))) {
      uf.unite(get<1>(t), get<2>(t));
      ans += get<0>(t);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 4592
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;

const ll mod = 1000000007;
const int N = 2e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int n, k;
vector<pii> ans;
int main() {
	while(~scanf("%d%d", &n, &k)) {
		ans.clear();
		int top = n * (n - 1) / 2 - (n - 1);
		if(k > top) {
			printf("-1\n");
		} else {
			rep(i, 2, n + 1) ans.pb({1, i});
			int d = top - k;
			while(d) {
				rep(i, 2, n) {
					rep(j, i + 1, n + 1) {
						ans.pb({i, j});
						d--;
						if(!d) break;
					}
					if(!d) break;
				}
			}
			printf("%d\n", sz(ans));
			rep(i, 0, sz(ans)) printf("%d %d\n", ans[i].fi, ans[i].se);
		}
	}
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ

//a^n modをO(logN)で計算
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
// a÷bの余り
int64_t div(int64_t a,int64_t b,int64_t mod){
    return (a%mod)*(modpow(b,mod-2,mod)%mod)%mod;
}

int main(){
    int64_t n,a,b;
    cin>>n>>a>>b;
    //2^n-1-nCa-nCbを何とかして求める
    int64_t ans=modpow(2,n,big)-1;
    //cout<<ans<<endl;
    int64_t cha = 1,moa = 1;
    int64_t chb = 1,mob = 1;
    bool block=true;
    //cout<<(a%big)*(modpow(b,big-2,big)%big)%big<<endl;
    rep(i,a){
        cha = cha*(n-i)%big;
        //cha = (cha%big) * (modpow(a-i,big-2,big)%big) % big;
        cha = div(cha,a-i,big);
    }
    /*
    rep(i,a){
        cha = (cha%big) * (modpow(a-i,big-2,big)%big) % big;
    }
    */
    //cout<<cha<<" "<<moa<<endl;
    rep(i,b){
        chb = chb*(n-i)%big;
        //chb = (chb%big) * (modpow(b-i,big-2,big)%big) % big; 
        chb = div(chb,b-i,big);  
    }
    /*
    rep(i,b){
        chb = (chb%big) * (modpow(b-i,big-2,big)%big) % big;   
    }
    */
    //cout<<chb<<" "<<mob<<endl;
    ans = ans-cha;
    //引き算の結果余りがマイナスになったら10^9+7を足す
    if(ans<0){
        ans += big;
    }
    ans = ans -chb;
    if(ans<0){
        ans += big;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
 
int main()
{
int n,p;
int i,cup;
vector<int> v;
while(cin>>n>>p,n||p){
 v.clear();
 v.resize(n);
 cup=p;
 for(i=0;;i++){
  if(i==n)i=0;
  if(cup){
   v[i]++;
   cup--;
  }else{
   cup+=v[i];
   v[i]=0;
  }
  if(v[i]==p)break;
 }
 cout<<i<<endl;
}
 
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>

int main(void){
    int A;
    int B;
    scanf("%d %d",&A, &B);
    
    if(1<=A<=100 && 1<=B<=100){
        if(A%3 == 0||B%3 == 0||(A+B)%3 == 0){
            printf("Possible");
        } else {
            printf("Impossible");
        }
    } else {
        exit(1);
    }
    return 0;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int ncrm2(int n, int r) { return !(r & (n - r)); }

int calc(int n, vi& v) {
    rep(i, 0, n) v[i] %= 2;
    int sum = 0;
    rep(i, 0, n) if (ncrm2(n - 1, i)) sum ^= v[i];
    return sum;
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    int n; cin >> n;
    vector<int> v(n);
    string s; cin >> s;
    rep(i, 0, n) v[i] = s[i] - '1';
    rep(i, 0, n) if (v[i] == 1) {
        cout << calc(n, v) << endl;
        return 0;
    }
    // no 1
    rep(i, 0, n) v[i] /= 2;
    cout << calc(n, v) * 2 << endl;
}

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



int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int k,n;
  cin>>k>>n;
  int a[200005];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int mxd=0;
  for(int i=0;i<n-1;i++){
     mxd=max(mxd,a[i+1]-a[i]);
  }
  mxd=max(mxd,a[0]+k-a[n-1]);
  cout<<k-mxd<<endl;



}

Measured memory_bytes: 1024
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define PB push_back
#define MP make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<29)
#define LLINF (1LL<<60)
#define MOD 1000000007
#define REP(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
typedef pair<int, int> P;

int main() {
    int n, ans = 0, a[30] = {}, c[30] = {};
    cin >>n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;
        ans += t;
    }
    for (int i = 0; i < n-1; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < n-1; i++) {
        if (a[i + 1] - a[i] == 1)ans += c[a[i]-1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>

using namespace std;

int main(void) {
	
	long long int a,b;
	cin >>a >>b;
	
	long long int ans1,ans2,ans;
	if (a%2==1) {
		if ((a/2)%2==1) {
			ans1=1^(a-1);
		} else {
			ans1=0^(a-1);
		}
	} else {
		if ((a/2)%2==1) {
			ans1=1;
		} else {
			ans1=0;
		}
	}
	if ((b+1)%2==1) {
		if (((b+1)/2)%2==1) {
			ans2=1^b;
		} else {
			ans2=0^b;
		}
	} else {
		if (((b+1)/2)%2==1) {
			ans2=1;
		} else {
			ans2=0;
		}
	}
	ans=ans1^ans2;
	
	cout <<ans <<endl;
	
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	a := intSliceScanner(n)
	sort.Ints(a)
	ans := 1
	for i := 0; i < n; i++ {
		x := ans
		ans *= a[i]
		if a[i] == 0 {
			ans = 0
			break
		}
		if ans > 1000000000000000000 || x != ans/a[i] {
			ans = -1
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5928
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main() {
    int k, x;
    cin >> k >> x;
    if(k * 500 < x) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li,li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li,li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

void Yes(li b){
  if(b)cout<<"Yes";
  else cout<<"No";
}
void yes(li b){
  if(b)cout<<"yes";
  else cout<<"no";
}

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


li H,A;
 
 cin >>H>>A;

 cout<<(H+A-1)/A;


}

Measured memory_bytes: 3652
import java.util.Scanner;
class Main{
    public static void main(String[] args){
		int a,b;
		char op;
		Scanner sc=new Scanner(System.in);
		while(true){
			a=sc.nextInt();
			op=sc.next().charAt(0);
			b=sc.nextInt();
			if(op=='+'){
				System.out.println(a+b);
			}else if(op=='-'){
				System.out.println(a-b);
			}else if(op=='*'){
				System.out.println(a*b);
			}else if(op=='/'){
				System.out.println(a/b);
			}else{
				break;
			}
		}
    }
}




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

using namespace std;
const int INF = -(int)1e17;

int n, arr[N][3], opt[N][3];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
	}
	for(int i=0; i<n; i++) {
		for(int j=0; j<3; j++) {
			int res = INF;
			if(i == 0) res = arr[i][j];
			else {
				if(j == 0) res = max(opt[i-1][1], opt[i-1][2]);
				else if(j == 1) res = max(opt[i-1][0], opt[i-1][2]);
				else res = max(opt[i-1][0], opt[i-1][1]);
				res += arr[i][j];
			}
			opt[i][j] = res;
		}
	}
	int ans = INF;
	for(int i=0; i<3; i++) ans = max(ans, opt[n-1][i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int A,B;
  cin>>A>>B;
  cout<<max(0,A-2*B)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
ll n,m,i,j,k,l,t,arr[sz],brr[sz],crr[sz];
vector<ll>v;
int main()
{
    scanf("%lld %lld %lld %lld",&n,&m,&k,&l);
    while(m<=n && l>0)
        m*=2,l--;
    while(k<=m && l>0)
        k*=2,l--;
    if(n<m && n<k && m<k)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 3688
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = [list(map(lambda x: int(x) - 1, readline().split())) for _ in range(n)]
    ls = [0] * n
    ql = [[0, i] for i in range(n)]
    ql = collections.deque(ql)
    for i in range(10 ** 10):
        fq = collections.defaultdict(int)
        while ql:
            d, p = ql.popleft()
            if d == i:
                if ls[p] < n - 1:
                    rp = a[p][ls[p]]
                    if ls[rp] < n - 1:
                        rrp = a[rp][ls[rp]]
                        if p == rrp:
                            if p not in fq and rp not in fq:
                                fq[p]
                                fq[rp]
                                if ls[p] + 1 < n:
                                    ls[p] += 1
                                    ql.append([d+1, p])
                                if ls[rp] + 1 < n:
                                    ls[rp] += 1
                                    ql.append([d+1, rp])
            elif d > i:
                ql.appendleft([d, p])
                break
        if len(ql) == 0:
            print(i if sum(ls) == (n - 1) * n else -1)
            exit()


if __name__ == '__main__':
    solve()


Measured memory_bytes: 66012
#include<stdio.h>
#define ll long long
int main(){
    ll h,w;
    scanf("%lld%lld",&h,&w);
    if(h==1)
        printf("1\n");
    else if(w==1)
        printf("1\n");
    else if(h%2==0){
        printf("%lld\n",(h/2)*w);
    }
    else{
        if(w%2==1){
            ll p=(h+1)/2;
            ll ans=0;
            ll q=(w+1)/2;
            ans=p*q+(h/2)*(w/2);
            printf("%lld\n",ans);
        }
        else{
            ll p=(h+1)/2;
            ll ans=0;
            ll q=w/2;
            ans+=p+(h/2);
            ans*=q;
            printf("%lld\n",ans);
        }
    }
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	
	if (n%2 == 0)
	{
		cout << n/2 << endl;
	}
	else
	{
		cout << n/2+1 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

  int a[1000000];
  int i = 1;
  a[0] = s;

  while(i < 1000000){
    if(a[i - 1] % 2 == 0){
      a[i] = a[i - 1] / 2;
    }
    else{
      a[i] = 3 * a[i - 1] + 1;
    }
    i++;
  }

  int j = 2;

  while(j != -1){
    for(int k = j - 1; k >= 0; k--){
      if(a[j] == a[k]){
	printf("%d\n", j + 1);
	j = -1;
	break;
      }
      else if(k == 0){
	j++;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 4096
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {
    cin.tie(0);

    string s;
    cin >> s;
    int n = s.length();
    bool flag;
    int ans = 0;
    if (s[0] == '0')
        flag = true;
    else
        flag = false;
    for (int i = 1; i < n; i++) {
        if (flag) {
            if (s[i] == '0') {
                ans++;
            }
            flag = false;
        } else {
            if (s[i] == '1') {
                ans++;
            }
            flag = true;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#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 main(){
    int N,M;
    cin >> N >> M;
    vector<int> cnt(N);
    rep(i,M){
        int a,b;
        cin >> a >> b;
        a--;b--;
        cnt[a]++;
        cnt[b]++;
    }
    rep(i,N){
        cout << cnt[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int a = 0;
		int b = 0;

		try(Scanner scan = new Scanner(System.in)) {
			a = scan.nextInt();
			b = scan.nextInt();

			if(a < b) {
				System.out.println("a < b");
			} else if(a > b) {
				System.out.println("a > b");
			} else if(a == b) {
				System.out.println("a == b");
			}
		}
	}

}

Measured memory_bytes: 26300
#!/usr/bin/python3

import numpy as np
def main():
    N, W = map(int, input().split())

    dp = np.zeros((N+1, W+1), dtype='uint64')

    for i in range(N):
        weight, value = map(int, input().split())

        dp[i+1][:weight] = dp[i][:weight]
        dp[i+1][weight:] = np.maximum(dp[i][weight:], dp[i][:-weight] + value)

    print(dp[-1][-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 92060
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  	string s,t;
  	cin >> s >> t;
  	int l1=s.length();
  	int l2=t.length();
  	int ans = 1e9;
  	for(int i=0;i<=l1-l2;i++){
  	    int count = 0;
  	    for(int j=0;j<l2;j++)
  	        if(s[i+j]!=t[j])
  	            count++;
  	 ans = min(ans,count);
  	}
  	 
 
    cout << ans ;
      
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll n,k;cin>>n>>k;
    //i番目の数字が最小値かつk番目の数字が最大値
    vector<ll> p(n);
    rep(i,n) cin>>p[i];
    priority_queue<ll, vector<ll>, greater<ll> > que;
    priority_queue<ll> que2;
    ll tmp=0;//単調増加何コンボ目か
    ll nat=0;
    rep(i,k){
        que.push(p[i]);
        que2.push(p[i]);
        if(i==k-1)continue;
        if(p[i+1]>p[i]){
            tmp++;
            if(tmp>=k-1){
                nat++;
            }
        }else tmp=0;
    }
    ll mini=que.top(),maxi=que2.top();
    ll res=0;//resは整列が入ってかつダブっている組、natは整列が入らなかった組
    
    vector<bool> used(n,false);
    for(int i=0;i<n-k;i++){
        if(p[i+k]>p[i+k-1]){
            tmp++;
            if(tmp>=k-1){
                nat++;
                goto OUT;
            }
        }else tmp=0;
        
        if(mini==p[i]&&maxi<p[i+k]) res++;
        OUT:
        used[p[i]]=true;//出ていく
        que.push(p[i+k]);
        que2.push(p[i+k]);
        while(true){
            mini=que.top();
            if(!used[mini])break;//まだ連続列の中にある
            que.pop();
        }
        
        while(true){
            maxi=que2.top();
            if(!used[maxi])break;//まだ連続列の中にある
            que2.pop();
        }
        mini=que.top();maxi=que2.top();
    }
    nat=max((ll)0,nat-1);
    res=(n-k+1)-res-nat;
    cout<<res<<endl;
}

Measured memory_bytes: 5100