akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())

int main(){
	int n;  cin>>n;
	if(n == 1){
		cout<<"Hello World"<<endl;
		return 0;
	}
	else{
		int a, b; cin>>a>>b;
		cout<<a + b<<endl;
	}
}


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

int maxTime(int x){
	
	return(x+9)/10*10;
	
}

int remTime(int x){
	
	return maxTime(x)-x;
	
}

int main() {
 
	vector<int> dishes(5);
	for(int i=0; i<5; i++){
		
		cin >>dishes.at(i);
		
	}
	
	int sum=0;
	for(int i=0; i<5; i++){
		
		sum+=maxTime(dishes.at(i));
		
	}
	
	vector<int> rem(5);
	for(int i=0; i<5; i++){
		
		rem.at(i)=remTime(dishes.at(i));
		
	}
	
	sum-=*max_element(rem.begin(),rem.end());
	cout <<sum <<endl;
  
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int N, M; {int[] a = in.ii(); N = a[0]; M = a[1];}
        String[] A = new String[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = in.s();
        }
        String[] B = new String[M];
        for (int i = 0; i < B.length; i++) {
            B[i] = in.s();
        }
        int L = N - M + 1;
        String ans = "No";
        loop1: for (int i = 0; i < L; i++) {
            loop2: for (int j = 0; j < L; j++) {
                for (int k = 0; k < B.length; k++) {
                    for (int l = 0; l < B.length; l++) {
                        if (A[i + k].charAt(j + l) != B[k].charAt(l)) {
                            continue loop2;
                        }
                    }
                }
                ans = "Yes";
                break loop1;
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 22996
#include<cstdio>
using ll = long long;
const static int MOD = 1000000007;

int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	ll x = 0;
	for (int i = 0; i < n; ++i){
		ll tmp;
		scanf("%lld", &tmp);
		x += tmp*(i*2 - (n - 1));
	}
	x %= MOD;
	ll y = 0;
	for (int i = 0; i < m; ++i){
		ll tmp;
		scanf("%lld", &tmp);
		y += tmp*(i*2 - (m - 1));
	}
	y %= MOD;
	printf("%lld\n", x*y % MOD);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    double a, b, x; cin >> a >> b >> x;
    double ans = 0;
    if (x <= a * a * b / 2) {
        ans = atan(a * b * b / (2 * x)) * 180 / M_PI;
    } else {
        ans = atan((2 * a * a * b - 2 * x) / pow(a, 3)) * 180 / M_PI;
    }
    printf("%.12lf\n", ans);
    return 0;
}

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

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

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

	int mod = X % 100;
	int div = X / 100;
	if (mod == 0) {
		cout << "1" << endl;
		return 0;
	}

	int ans = 0;
	for (int i = 5; i >= 1; --i) {
		int tmpmod = mod % i;
		int tmpdiv = mod / i;

		if (div > tmpdiv) {
			if (tmpmod == 0) {
				ans = 1;
				break;
			}
			div -= tmpdiv;
			mod = tmpmod;
		}
		else  if (div == tmpdiv) {
			if (tmpmod == 0) {
				ans = 1;
			}
			break;
		}
		else {
			break;
		}
	}

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


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1001001001;

int main() {
    int a, b;
    cin >> a >> b;
    int c = a + b;
    if (c % 2 == 1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    cout << (c / 2) << endl;

}


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

using namespace std;

int main()
{
    long long int a[3];

    cin >> a[0] >>a[1] >> a[2];


    if(a[0] + a[1] == a[2])
        cout <<"Yes" << endl;
    else if(a[1] + a[2] == a[0])
        cout << "Yes" << endl;
    else if(a[0] + a[2] == a[1])
        cout << "Yes" << endl;

    else
        cout << "No" << endl;
    return 0;

}


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


int main()
{
    long S;
    std::cin >> S;
    long X1,X2,Y1,Y2,X3,Y3;
    X3=0;
    Y3=0;
    double temp=std::sqrt(S);
    long temps=temp;
    long temps2=std::ceil(temp);
    if(temps2==temps){
        //ぴったり2乗
        long max=std::pow(10,18);
        if(S!=max){
            X1=std::ceil(temp);
            Y2=X1+1;
        }else{
            X1=std::pow(10,9);
            Y2=X1;
        }
    }else{
        X1=std::ceil(temp);
        Y2=X1;
    }
    long temp2=X1*Y2-S;
    Y1=1;
    X2=temp2;

    std::cout << X1 << " " << Y1 << " " << X2 << " " << Y2 << " " << 0 << " " << 0 << std::endl;
    return 0;
}

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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
   	string s;cin>>s;
   	if(s[2]==s[3] && s[4]==s[5])cout<<"Yes";
   	else	cout<<"No";
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

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

const int MOD = 1000000007;

int main() {
  int n;
  string s;
  cin >> n >> s;
  map<char, int> mp;
  rep(i, n) mp[s[i]]++;
  ll ans = 1;
  for (auto x : mp) ans = (ans * (x.second + 1)) % MOD;
  cout << ans - 1 << endl;
  return 0;
}


Measured memory_bytes: 3724
#トポロジカルソートなるもの
#再帰で書いてるところをwhileで書いてる
#要は無駄な探索(再帰呼び出し)を無くしてる
#まぁ思いつかない

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    n,m = map(int,input().split())
    edge = [[] for i in range(n)]
    #st:入る辺が無い頂点
    st = []
    #to[i]:頂点iに入る辺数
    to = [0]*n
    for i in range(m):
        x,y = map(int, input().split())
        edge[x-1].append(y-1)
        to[y-1] += 1
    for i in range(n):
        if to[i] == 0:
            st.append(i)

    #dp[i]:頂点iを終点とする最長のパスの長さ
    dp = [0]*n
    while st:
        go = st.pop()
        for e in edge[go]:
            to[e] -= 1
            if to[e] == 0:
                st.append(e)
            dp[e] = max(dp[e],dp[go]+1)
    print(max(dp))


if __name__ == '__main__':
    main()

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

using namespace std;

int main(){
  int a;
  string s;
  
  scanf("%d", &a);
  cin >> s;
  
  if(a < 3200){
    cout << "red" << endl;
  }else{
    cout << s << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ld long double
#define pa pair<int,int>
#define pii pair<ll,ll>
#define st first
#define nd second
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
const int MAX=1<<18;
pii tab[MAX];
ll t[2*MAX];
ll ans=0;
vector<ll>cordinates;

void update(int u,int v,ll c)
{
  for (u+=MAX,v+=MAX;u<v;u>>=1,v>>=1)
  {
    if (u&1)t[u++]+=c;
    if (v&1)t[--v]+=c;
  }
}

ll query(int u)
{
  ll suma=0;
  for (u+=MAX;u>0;u>>=1)
  {
    suma+=t[u];
  }
  return suma;
}

int main()
{
  BOOST;
  ll n,d,a;
  cin>>n>>d>>a;

  for (int i=1;i<=n;i++)
  {
    cin>>tab[i].st>>tab[i].nd;
  }

  sort (tab+1,tab+n+1);

  for (int i=1;i<=n;i++)
  {
   // cout<<"CO "<<i<<" "<<tab[i].nd<<"\n";
    update(i,i+1,tab[i].nd);
    cordinates.pb(tab[i].st);
  }

  //cout<<query(1)<<"\n";

  for (int i=1;i<=n;i++)
  {
    if (query(i)>0)
    {
      ll trafiam=tab[i].st+d;
      ll ilezostalo=query(i);
      //cout<<"TERAZ "<<ilezostalo<<"\n";
      ll walnac=ilezostalo/a;
      if (ilezostalo%a!=0)walnac++;
      ll ilezabrac=walnac*a;
      auto przedzial1=i;
      auto przedzial2=(--upper_bound(cordinates.begin(),cordinates.end(),trafiam+d))-cordinates.begin()+1;
      //cout<<i<<" "<<przedzial1<<" "<<przedzial2<<" "<<ilezabrac<<"\n";
      ans+=walnac;
      update(przedzial1,przedzial2+1,-ilezabrac);
    }
  }

  cout<<ans;
  return 0;
}


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

using namespace std;

int main() {
    char s[10];
    scanf("%s",s);
    sort(s,s+ 4);
    printf((s[0] ==s[1] &&s[1] !=s[2] &&s[2] ==s[3])? "Yes\n" : "No\n");
}


Measured memory_bytes: 256
//  Created by conan1024hao in 2020.
//  Copyright © 2020 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

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

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????统一类型        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,m,k;cin>>n>>m>>k;
    map<int,int>mm;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            int black=0;
            black=i*m+j*n-2*i*j;
            mm[black]++;
        }
    }
    if(mm[k]==0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------







Measured memory_bytes: 13184
import Foundation

let input_line: String = readLine()!

let n: Int = Int(input_line)!

let input_line2: String = readLine()!
let split2: [String] = input_line2.components(separatedBy: " ") //ブランクで区切られている場合
var array: [Int] = []

for a in split2 {
    array.append(Int(a)!)
}

var ansArray: [Int] = Array(repeating: 0, count: n-1)

for a in array {
    if a == 0 {
    } else {
        ansArray[a-1] += 1
    }
}

ansArray.append(0)

for ans in ansArray {
    print(ans)
}

Measured memory_bytes: 23660
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;
type I = usize;

fn main() {
    input!{
      h: usize,
      w: usize,
      hh: usize,
      ww: usize,
    }
    println!("{}", h*w + hh*ww - hh*w - ww*h);
}


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

int main(){
	int n,*S;
	int q,*T;
	int count=0;

	scanf("%d",&n);
	S=(int*)malloc(sizeof(int)*n);
	for(int i=0;i<n;i++){
		scanf("%d",&S[i]);
	}
	scanf("%d",&q);
	T=(int*)malloc(sizeof(int)*q);
	for(int i=0;i<q;i++){
		scanf("%d",&T[i]);
	}

	for(int i=0;i<q;i++){
		for(int j=0;j<n;j++){
			if(T[i]==S[j]){
				count++;
				break;
			}
		}
	}
	printf("%d\n",count);

   return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
using namespace std;
char a[10][10];
int main()
{
    int f=0;
    scanf("%s",a[1]);
    scanf("%s",a[2]);
    for(int i=0;i<3;i++)
    {
        if(a[1][i]==a[2][2-i])
        {
            f=1;
        }
        else
        {
            f=0;
            break;
        }
    }
    if(f==1)
        printf("YES\n");
    else
    {
        printf("NO\n");
    }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main() {
  int n,m,i;
  scanf("%d %d",&n,&m);
  int pi,acnum,x = 0,warongnum[n + 1],tyouhuku[n + 1];
  char si[3],ac[] = "AC";
  acnum = 0;

  for (i = 1;i <= n; i ++) {
    warongnum[i] = 0;
    tyouhuku[i] = 0;
  }
  for (i = 1;i <= m;i ++) {
    scanf("%d %s",&pi,&si);
    if (strcmp(si,ac) == 0) {
      if (tyouhuku[pi] != 1) {
      acnum ++;
      x = x + warongnum[pi];
      tyouhuku[pi] = 1;
      }
    }
    else {
      warongnum[pi] ++;
    }
  }
  printf("%d %d",acnum,x);
}


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

#define print cout <<

int main(){
    string N;
    cin >> N;
    int sum = 0;
    for(auto s : N){
      int num = (int)(s - '0');
      sum += num;
    }
    if(sum%9==0){
      print "Yes" << endl;
    }else{
      print "No" << endl;
    }
}


Measured memory_bytes: 3712
// 2020-08-16 00:05:10
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  if(k <= x / d) {
    cout << x - k * d << '\n';
  } else {
    ll l = d * (x / d);
    if((k - x / d) % 2) {
      l += d;
    }
    cout << abs(x - l) << '\n';
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
const long long int val = 1e18;
int main()
{
    long long n,x=1;
    bool flag=true;
    cin>>n;
    long long arr[n+5];
    for(long long i=0;i<n;++i){
    cin>>arr[i];
    }
    sort(arr,arr+n);
    if(arr[0]==0){
        cout<<0<<endl;
    }
    else{
    for(long long i=0;i<n;++i){
        if(arr[i]<=val/x){
        x*=arr[i];
        }
        else{
            flag=false;
            break;
        }
    }
    if(flag){
        cout<<x<<endl;
    }
    else
        cout<<-1<<endl;
}
}



Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		int[] XS = new int[N];
		for(int i=0; i<N; i++) {
			X[i] = sc.nextInt();
			XS[i] = X[i];
		}Arrays.sort(XS);

		for(int j=0; j<N; j++) {
			if(X[j] * 2 > XS[N/2-1] + XS[N/2]) {
				System.out.println(XS[N/2-1]);
			}else {
				System.out.println(XS[N/2]);
			}
		}

	}

}


Measured memory_bytes: 94464
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <cstring>

using namespace std;

long long g(long long n) {
  return 1LL << __builtin_ctz(~n);
}

int trie[100001][2];
bool accept[100001];
int pt = 1;

long long f(int u, long long l) {
  if (u == -1) return g(l);
  if (accept[u]) return 0;
  return f(trie[u][0], l - 1) ^ f(trie[u][1], l - 1);
}

int main() {
  int n;
  long long l;
  cin >> n >> l;

  memset(trie, -1, sizeof(trie));

  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;

    int u = 0;
    for (char c : s) {
      c -= '0';
      if (trie[u][c] == -1) {
        trie[u][c] = pt++;
      }
      u = trie[u][c];
    }
    accept[u] = true;
  }

  if (f(0, l) != 0) {
    cout << "Alice" << endl;
  } else {
    cout << "Bob" << endl;
  }
}


Measured memory_bytes: 4252
#include<stdbool.h>
#define rep(i,n)for(int i=0;i<(int)(n);i++)
n;ans=0;x;char c[30009];bool f1,f2,f3;main(){scanf("%d%s",&n,c);rep(i,10){rep(j,10){rep(k,10){f1=false;f2=false;f3=false;x=0;while(!f1&&x<n){f1=(c[x]-48==i);x++;}while(!f2&&x<n){f2=(c[x]-48==j);x++;}while(!f3&&x<n){f3=(c[x]-48==k);x++;}if(f1&&f2&&f3)ans++;}}}printf("%d", ans);}

Measured memory_bytes: 128
using System;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var line = Console.ReadLine().Split(' ');
                var H = int.Parse(line[0]);
                var W = int.Parse(line[1]);
                if (H == 0 && W ==0)
                {
                    return;
                }

                for (int j = 0; j < H; j++)
                {
                    for (int i = 0; i < W; i++)
                    {
                        if ((i + j) % 2 == 0)
                        {
                            Console.Write("#");
                        }
                        else
                        {
                            Console.Write('.');
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}


Measured memory_bytes: 15936
import java.util.*;

public class Main {

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		long n = new Integer(Integer.parseInt(sc.next()));

		long result = 0;
		for (long i = 1; i <= n; i++) {
			long kosuu = n / i;
			result += (i + (i * kosuu)) * kosuu / 2;
		}

		System.out.println(result);

	}
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    set<string> kind;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        kind.insert(s);
    }
    cout<<kind.size()<<endl;
    return 0;
}

Measured memory_bytes: 19200
package main

import (
	"fmt"
	"math"
)

func main() {
	var a int
	fmt.Scan(&a)
	pi := 3.14159265358979323846264338327950288419716939937510582097494459
	res := float64(a+a) * pi
	fmt.Printf("%f", res)
}

//-------------------------------------------
// util tools

// abs 絶対値を返す
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// sliceInt []intをスライスする
func sliceInt(k int) []int {
	s := make([]int, getDigit(k))
	count := 0
	for k > 0 {
		i := k % 10
		s[len(s)-1-count] = i
		count++
		k = k / 10
	}
	return s
}

// sliceIntSum []intの合計を出す
func sliceIntSum(v []int) int {
	sum := 0
	for _, x := range v {
		sum += x
	}
	return sum
}

// reverse []intを反転
func reverse(s []int) []int {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s
}

// getDigit intの桁数を取得
func getDigit(num int) int {
	digit := 0
	for num != 0 {
		num /= 10
		digit++
	}
	return digit
}

// getSumDigit intの各位の和を返す
func getSumDigit(num int) int {
	sum := 0
	for num != 0 {
		t := num % 10
		num /= 10
		sum += t
	}
	return sum
}

// lastPrime 素数 エラトステネスの篩
func lastPrime(max int64) int64 {
	if max <= 1 {
		return 2
	}
	primes := make([]int64, 1, max)
	primesF := make([]float64, 1, max)
	primes[0] = 2
	primesF[0] = 2.0

	count := int64(1)
	for n := int64(3); ; n += 2 {
		flag := true
		f := float64(n)
		rf := math.Sqrt(f)
		for i := 1; i < len(primes); i++ {
			if primesF[i] > rf {
				break
			} else if (n % primes[i]) == 0 {
				flag = false
				break
			}
		}
		if flag {
			count++
			if count >= max {
				return n
			}
			primes = append(primes, n)
			primesF = append(primesF, f)
		}
	}
}

// gcd 最大公約数
func gcd(p, q int64) int64 {
	for q != 0 {
		r := p % q
		p = q
		q = r
	}
	return p
}


Measured memory_bytes: 1820
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	while (true)
	{
		cin >> a >> b;
		if( a == 0 && b == 0 )break;
		if( a > b ) cout << b << " " << a << endl;
		else cout << a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 3052
use std::cmp;
use std::collections::BinaryHeap;

const INF: i64 = std::i64::MAX;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n: usize = sc.read();
    let m: usize = sc.read();
    let k: usize = sc.read();
    let bread: Vec<i64> = sc.vec(n);
    let jam_kind: Vec<usize> = sc.vec::<usize>(n).into_iter().map(|k| k - 1).collect();
    let jam_value: Vec<i64> = sc.vec(n);

    let mut graph = vec![vec![]; n];
    for _ in 0..m {
        let u = sc.read::<usize>() - 1;
        let v = sc.read::<usize>() - 1;
        let t = sc.read::<i64>();
        graph[v].push((u, t));
        graph[u].push((v, t));
    }

    let dist = dijkstra(&graph);

    let bread_dist = bread_dijkstra(&graph, &bread, &dist);
    let mut ans = vec![-INF; k];
    for i in 0..n {
        let bread_dist = bread_dist[i];
        let dist = dist[i];
        let jam_kind = jam_kind[i];
        let jam_value = jam_value[i];
        ans[jam_kind] = cmp::max(ans[jam_kind], jam_value - dist - bread_dist);
    }

    for ans in ans.into_iter() {
        println!("{}", ans);
    }
}

fn dijkstra(graph: &Vec<Vec<(usize, i64)>>) -> Vec<i64> {
    let n = graph.len();
    let mut dist = vec![INF; n];
    dist[0] = 0;
    let mut q = BinaryHeap::new();
    q.push((0, 0));

    let mut vis = vec![false; n];
    while let Some((_, v)) = q.pop() {
        if vis[v] {
            continue;
        }
        vis[v] = true;
        for &(next, weight) in graph[v].iter() {
            if dist[next] > dist[v] + weight {
                dist[next] = dist[v] + weight;
                q.push((-dist[next], next));
            }
        }
    }
    dist
}

fn bread_dijkstra(
    graph: &Vec<Vec<(usize, i64)>>,
    bread: &Vec<i64>,
    prev_dist: &Vec<i64>,
) -> Vec<i64> {
    let n = graph.len();
    let mut dist = vec![INF; n];
    let mut q = BinaryHeap::new();
    for i in 0..n {
        dist[i] = prev_dist[i] - bread[i];
        q.push((-dist[i], i));
    }

    let mut vis = vec![false; n];
    while let Some((_, v)) = q.pop() {
        if vis[v] {
            continue;
        }
        vis[v] = true;

        for &(next, weight) in graph[v].iter() {
            if dist[next] > dist[v] + weight {
                dist[next] = dist[v] + weight;
                q.push((-dist[next], next));
            }
        }
    }
    dist
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



Measured memory_bytes: 27808
from math import ceil

N = int(input())
H = list(map(int, input().split()))

for i in range(len(H)):
  res = "node {}: key = {}, ".format(i+1, H[i])
  parent = ceil(i/2) - 1
  left = 2*i + 1
  right = 2*i + 2
  if parent >= 0:
    res += "parent key = {}, ".format(H[parent])
  if left < N:
    res += "left key = {}, ".format(H[left])
    if right < N:
      res += "right key = {}, ".format(H[right])
  print(res)



Measured memory_bytes: 5676
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int mo = 1e9 + 7;

int n, cnt[26];
string s;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	cin >> s;

	for (int i = 0; i < n; ++i)
		++cnt[s[i]-'a'];

	long long ans = 1;
	for (int i = 0; i < 26; ++i)
		if (cnt[i])
			ans = ans * (cnt[i] + 1) % mo;

	--ans;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
s=input()
l=[int(s[0:2]),int(s[2:4])]

if 1 <= l[0] <= 12:
    if 1 <= l[1] <= 12:
        print("AMBIGUOUS")
    elif l[1] == 0 or 13 <= l[1]:
        print("MMYY")
    else:
        print("NA")
elif l[0] == 0 or 13 <= l[0]:
    if 1 <= l[1] <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    print("NA")

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<queue>
#include<map>
#include<functional>
#include<vector>
#define rep(i,k) for(int i=0;i<k;i++)
using namespace std;
typedef pair<double,int> P;
int main(){
	int x;
	double y;
	priority_queue<P,vector<P>,greater<P> > a[3];
	priority_queue<P,vector<P>,greater<P> > b;
	rep(i,3){
		rep(j,8){
			cin>>x>>y;
			a[i].push(P(y,x));
		}
		rep(k,2){
			P q=a[i].top();
			printf("%d %.2lf\n",q.second,q.first);
			a[i].pop();
		}
		rep(k,6){
			b.push(a[i].top());
			a[i].pop();
		}
	}
	rep(k,2){
		P p=b.top();
		printf("%d %.2lf\n",p.second,p.first);
		b.pop();
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner io = new Scanner(System.in);
		int N = io.nextInt();
		int[] s = new int[N];
		int sum = 0;
		for (int i = 0; i < N; i++) {
			s[i] = io.nextInt();
			sum += s[i];
		}
		
		Arrays.sort(s);
		
		if(sum%10!=0){
			System.out.println(sum);
		}else{
			for (int i = 0; i < N; i++) {
				if(s[i]%10 != 0){
					System.out.println(sum-s[i]);
					return;
				}
			}
			System.out.println(0);
		}	
	}
}

Measured memory_bytes: 21716
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest
{
    class ABC_055_B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int div = 1000000000 + 7;
            long pow = 1;
            for (int i = 1; i <= n; i++)
            {
                pow *= i;
                pow %= div;
            }
            Console.WriteLine(pow);
        }
    }
}


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

// macros
#define overload_rep(_1, _2 ,_3 ,name, ...) name
#define re_p(i, n) for(int i = 0; i < (n); ++i)
#define r_ep(i, x, y) for(int i = (x); i <= (y); ++i)
#define rep(...) overload_rep(__VA_ARGS__, r_ep, re_p)(__VA_ARGS__)
#define all(a) a.begin(), a.end()
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif

// functions
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; }
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
    cerr << ' ' << head;
    debug_cerr(tail...);
}

// cin/cout setup
struct IoSetup{
    IoSetup(){
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} iosetup;

// AtCoder Beginner Contest 144
typedef long long ll;

int main(){

    int N;
    ll K;
    cin >> N >> K;
    vector<ll> a(N), f(N);
    rep(i, N)cin >> a[i];
    rep(i, N)cin >> f[i];

    sort(all(a));
    sort(all(f), greater<ll>());

    auto can = [&](ll X){
        ll tmp = 0;
        rep(i, N){
            ll t = X / f[i];
            if(a[i] <= t)continue;
            else tmp += a[i] - t;
        }
        return tmp <= K;
    };

    ll L = -1, R = 1000000000000;
    while(R - L > 1){
        ll M = (R + L) / 2;
        if(can(M))R = M;
        else L = M;
    }
    cout << R << '\n';

}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main () {
	int A,B,C;
	cin >> A >> B >> C;
	if(A == B){
		cout << C << endl;
	}else if(B == C){
		cout << A << endl;
	}else if(A == C){
		cout << B << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define MP make_pair
#define pb push_back
#define PI 3.1415926535897932384626433832795
typedef long long ll;
#define MOD 1000000007
ll gcd(ll a,ll b){if (b == 0)return a;return gcd(b, a % b);} 
#define cases int t;cin>>t;while(t--) 

int main(){
    int n;cin>>n;
    ll sum = 0;

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

        if(i%3 != 0 && i%5 != 0)
        {
            sum += i;

        }
    }
   cout<<sum<<endl;
}


Measured memory_bytes: 3572
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
//#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>

#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

ll a, b;

ll nod(ll a, ll b)
{
	while (b != 0)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("meetings.in", "r", stdin);
	//freopen("meetings.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> a >> b;
	cout << a * b / nod(a, b);



	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define _ ios::sync_with_stdio(false);cin.tie(0);

using namespace std;

int main() { _ 
    int n;
    for(int i = 1; i <= 5; i++){
        cin >> n;
        if(n==0){ cout << i << endl; }
    }   

    return 0;
}



Measured memory_bytes: 3536
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

const ll MOD = 1e9+7;

signed main(){  
    ll a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;
    return 0;
}


Measured memory_bytes: 3588
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define N 505
#define rep(i,j,k) for (ll i=j;i<=k;++i)
#define per(i,j,k) for (ll i=j;i>=k;--i)
using namespace std;
inline ll read(){
	char ch=getchar(); ll x=0,f=1;
	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;
}
ll n,m,a[N][N],b[N][N]; char s[N][N];
int main(){
	n=read(); m=read();
	rep(i,1,n) scanf("%s",s[i]+1);
	rep(i,1,n) rep(j,1,m)
		if (s[i][j]=='#'||i&1) a[i][j]=1;
	rep(i,1,n) rep(j,1,m)
		if (s[i][j]=='#'||!(i&1)) b[i][j]=1;
	rep(i,1,n) a[i][1]=b[i][m]=0,a[i][m]=b[i][1]=1;
	rep(i,1,n){
		rep(j,1,m) putchar(a[i][j]?'#':'.');
		puts("");
	}
	puts("");
	rep(i,1,n){
		rep(j,1,m) putchar(b[i][j]?'#':'.');
		puts("");
	}
}

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

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

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

  cout << max({a + b, a - b, a * b}) << '\n';

  return (0);
}


Measured memory_bytes: 3568
S = list(input())
ans = 0

fst = 0
lst = len(S)-1
flg = 1

while(1):
    if fst>=lst:
        break

    if S[fst]==S[lst]:
        fst += 1
        lst -= 1
        continue
    
    elif S[fst]=="x":
        ans += 1
        fst += 1
    
    elif S[lst]=="x":
        ans += 1
        lst -= 1
    
    else:
        flg = 0
        break

if flg:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 4084
main = do
  line <- getLine
  let 
    [a,b,c] = map read $ words line :: [Int]
    divisor cnt seq fin x
      | seq <= fin && (mod x seq == 0)  = divisor (cnt+1) (seq+1) fin x
      | seq <= fin && (mod x seq /= 0)  = divisor cnt (seq+1) fin x
      | otherwise = do putStrLn $ show cnt
    in divisor 0 a b c



Measured memory_bytes: 4128
#include<stdio.h>

int main(void){
  int a, b, c, i, ans;
  scanf("%d %d %d", &a, &b, &c);
  i = ( a > b ) ? b : a;
  while ( c ) {
    if ( !(a % i) && !(b % i) ) {
      c -= 1;
      ans = i;
    }
    i--;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;

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

 return 0;
}

Measured memory_bytes: 256
A, B, N = map(int, input().split())

# ans = 0
# for x in range(N+1):
#     tmp = A * x // B - A * (x // B)
#     ans = max(ans, tmp)
#     print(x, A * x // B, A * (x // B), tmp)
# print(ans)

# if A < B:
if N < B:
    if N % B == 0:
        x = N-1
    else:
        x = N
        # x = (N//B)*B-1
else:
    x = (N//B)*B-1

print(A * x // B - A * (x // B))
# print(x)



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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        ll K, A, B; cin >> K >> A >> B;
        if(B - A <= 2 or K < A) {
            cout << K + 1 << endl;
        } else {
            K -= A - 1;
            cout << A + (B - A) * (K / 2) + (K % 2) << endl;
        }
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


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

const string hands[] = {"Rock", "Fire", "Scissors", "Snake", "Human",
			"Tree", "Wolf", "Sponge", "Paper", "Air",
			"Water", "Dragon", "Devil", "Lightning", "Gun" };
int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int n;
  while(cin >> n,n){
    vector<int> use(15,0);
    while(n--){
      string s;
      cin >> s;
      for(int i=0;i<15;i++){
	if(s == hands[i])use[i] = 1;
      }
    }

    vector<int> win(15,0), lose(15,0);
    for(int i=0;i<15;i++){
      for(int j=1;j<=7;j++){
	int nxt = (i+j)%15;
	if(use[i] && use[nxt]){
	  win[i] = 1; lose[nxt] = 1;
	}
      }
    }

    int id = -1;
    for(int i=0;i<15;i++){
      if(win[i] && !lose[i])id = i;
    }
    if(id<0)cout << "Draw" << endl;
    else cout << hands[id] << endl;
  }
}

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

int main(){
    string s;
    cin >> s;
    bool flag = false;
    int res=0;
    rep(i,s.size()){
        if(flag){
            if(s[i]=='g') res++;
            flag = false;
        }
        else{
            if(s[i]=='p') res--;
            flag = true;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cmath>
using namespace std;
 
int main(){
 
    int n, x, y;
    cin >> n >> x >> y;
    // the question actually tests the logical ability. there's no need of making the graph actually.
 
    int distance[n]={0};
 
    for(int i=1; i<=n-1; i++){
        int count=0;
        for(int j=i+1; j<=n; j++){
            int dist = min(abs(j-i),abs(x-i)+abs(y-j)+1);
            dist=min(dist, abs(y-i)+abs(x-j)+1);
            distance[dist]++;
        }
    }
    for(int i=1; i<n; i++) cout << distance[i] << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cassert>
#include<iomanip>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;


void draw(int n)
{
  int G[n][n];
  rep(i,n)rep(j,n)G[i][j] = 0;
  int x = n/2;
  int y = (int)(n/2) + 1;
  int px,py;
  rep(i,n*n)
    {

      assert(G[y][x] == 0);
      G[y][x] = i+1;
      if(i == n*n-1)break;
      px = x,py = y;
      x++,y++;
      if(x >= n)x = (x-n);
      if(y >= n)y = (y-n);
      if(G[y][x] != 0)
	{
	BACK:; 
	  x--,y++;
	  if(x < 0)x = n + x;
	  if(y >= n)y = y-n;
	  if(G[y][x] != 0)goto BACK;
	}

    }
  rep(i,n)
    {
      rep(j,n)
	{
	  cout << setw(4) << G[i][j];
	}
      cout << endl;
    }
}

int main()
{
  int n;
  while(cin >> n,n)draw(n);
  return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int a[MAXN];
int G[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3816
S = str(input())
Q = int(input())

topFlg = True

leftStr = ""
rightStr = ""

for _ in range(Q):
    query = list(map(str, input().split()))
    if query[0] == "1":
        topFlg = not (topFlg)
    else:
        if query[1] == "1":
            if topFlg:
                leftStr = query[2] + leftStr
            else:
                rightStr += query[2]
        else:
            if topFlg:
                rightStr += query[2]
            else:
                leftStr = query[2] + leftStr

print(leftStr + S + rightStr if topFlg else (leftStr + S + rightStr)[::-1])


Measured memory_bytes: 4424
#include <iostream>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    if ( m > n ) {cout << "No" <<endl;   return 0 ; }
    if ( n == m ){ cout << "Yes"<<endl;    return 0 ;}
    else {cout << "No" <<endl; }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if (N >= 64) {
            System.out.println(64);
        } else if (N >= 32) {
            System.out.println(32);
        } else if (N >= 16) {
            System.out.println(16);
        } else if (N >= 8) {
            System.out.println(8);
        } else if (N >= 4) {
            System.out.println(4);
        } else if (N >= 2) {
            System.out.println(2);
        } else {
            System.out.println(1);
        }
    }

}

Measured memory_bytes: 22868
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        long min = 1000000;

        loop: for (long i=a; i<=b; i++) {
            for (long j=i+1; j<=b; j++) {
                long times = i * j;
                long mod = times % 2019;
                if (mod == 0) {
                    min = 0;
                    break loop;
                }

                if (min > times % 2019) {
                    min = times % 2019;
                }
            }
        }

        System.out.println(min);
    }
}


Measured memory_bytes: 23892
// reference : https://twitter.com/knshnb/status/1256952059061927936

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

int main() {
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<string> s(n);
    for (auto &e : s) cin >> e;
    
    vector<char> ans;
    int num[3] = {a, b, c};
    
    auto dfs = [&] (auto f, int i) -> void {
        if (i == n) {
            cout << "Yes" << '\n';
            for (const char &c : ans) cout << c << '\n';
            exit(0);
        }
        int x = s[i][0] - 'A', y = s[i][1] - 'A';
        for (int _ = 0; _ < 2; _++) {
            if (num[x] > 0) {
                num[x]--; num[y]++;
                ans.push_back('A' + y);
                f(f, i + 1);
                num[x]++; num[y]--;
                ans.pop_back();
            }
            swap(x, y);
        }
    };
    
    dfs(dfs, 0);
    cout << "No" << '\n';
    return 0;
}

Measured memory_bytes: 19432
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e3 + 10, K = 30, mod = 1e9 + 7;

ll add(ll x, ll y) {
	x += y;
	if (x >= mod) {
		x -= mod;
	}
	return x;
}

ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) {
		x += mod;
	}
	return x;
}

ll mul(ll x, ll y) {
	x *= y;
	return x % mod;
}

ll pwr(ll x, ll e) {
	ll res = 1;
	while (e) {
		if (e & 1) {
			res = mul(res, x);
		}
		x = mul(x, x);
		e /= 2;
	}
	return res;
}

int a[K];
ll choose[N][N], dp[N][K];

int main() {
	fast_cin();
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= k; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i <= n; ++i) {
		choose[i][i] = choose[i][0] = 1;
		for (int j = 1; j < i; ++j) {
			choose[i][j] = add(choose[i - 1][j], choose[i - 1][j - 1]);
		}
	}
	for (int j = 0; j <= k; ++j) {
		dp[0][0] = 1;
	}
	for (int i = 0; i <= n; ++i) {
		for (int j = 1; j <= k; ++j) {
			for (int c = 0; c <= min(i, a[j]); ++c) {
				dp[i][j] = add(dp[i][j], mul(mul(choose[i][c], choose[n - c][a[j] - c]), dp[i - c][j - 1]));
			}
		}
	}
	cout << dp[n][k] << endl;
}

Measured memory_bytes: 7808