akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a==5 && b==5 && c==7)
    cout<<"YES";
  else if(a==5 && b==7 && c==5)
    cout<<"YES";
  else if(a==7 && b==5 && c==5)
    cout<<"YES";
  else cout<<"NO";
  return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
#include <bitset> // bitset
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N;
    cin >> N;
    vi data(N, 0);
    int count = 0, MIN = 1000000000;
    for (int i = 0; i < N; i++) {
        cin >> data[i];
        if (data[i] < 0) {
            count++;
        }
        if (abs(data[i]) < abs(MIN)) {
            MIN = data[i];
        }
    }
    ll ans = 0;
    for (int x : data) {
        ans += ll(abs(x));
    }
    if (count % 2 == 1) {
        ans -= ll(abs(MIN)) * 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod (ll) 2019
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  ll L, R, m = inf;
  cin >> L >> R;
  if(R - L >= 2019) {
    cout << 0;
    exit(0);
  }
  int  x = L % mod, y = R - (L - x);
  for(int i = x; i < y; i++) {
    for(int j = i+1; j <= y; j++) {
      m = min(m, ((i % mod) * (j % mod)) % mod);
    }
  }
  cout << m;   
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main() {
    int d = 100000;
    int n;
    cin >> n;
    while(n-- > 0) {
        d *= 1.05;
        if(d % 1000) {
            d = (d / 1000 + 1) * 1000;
        }
    }
        cout << d << endl;
    return 0;
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	int dp[n+1][3];
	//initialize
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	
	for(int i=1;i<n;i++){
		dp[i][0]=max(a[i]+dp[i-1][1],a[i]+dp[i-1][2]);
		dp[i][1]=max(b[i]+dp[i-1][0],b[i]+dp[i-1][2]);
		dp[i][2]=max(c[i]+dp[i-1][0],c[i]+dp[i-1][1]);
	}
	
/*	for(int i=0;i<3;i++){
		for(int j=0;j<n;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
	
	
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>

int main()
{
	int a, b, c, x, y;
	std::cin >> a >> b >> c >> x >> y;
	int buy_each = a * x + b * y;
	int buy_half = 2 * c * std::max(x, y);
	int p = x < y ? b : a;
	int buy_mix = 2 * c * std::min(x, y) +  p * std::abs(x - y);
	std::cout << std::min(std::min(buy_each, buy_half), buy_mix) << '\n';
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cctype>
using namespace std;

inline int read() {
    int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
    for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
}

const int N = 2005;
char s[N][N];
int s1[N][N], s2[N][N], s3[N][N];

int main() {
	int n = read(), m = read(), Q = read();
	for (int i=1; i<=n; ++i) scanf("%s",s[i] + 1);
	for (int i=1; i<=n; ++i) {
		for (int j=1; j<=m; ++j) {
			s1[i][j] = s1[i - 1][j] + s1[i][j - 1] - s1[i - 1][j - 1];
			s2[i][j] = s2[i - 1][j] + s2[i][j - 1] - s2[i - 1][j - 1];
			s3[i][j] = s3[i - 1][j] + s3[i][j - 1] - s3[i - 1][j - 1];
			if (s[i][j] == '1') {
				s1[i][j] ++;
				if (s[i][j] == s[i - 1][j]) s2[i][j] ++;
				if (s[i][j] == s[i][j - 1]) s3[i][j] ++;
			}
		}
	}
	while (Q--) {
		int a1 = read(), b1 = read(), a2 = read(), b2 = read();
		int t1 = s1[a2][b2] - s1[a2][b1 - 1] - s1[a1 - 1][b2] + s1[a1 - 1][b1 - 1];
		int t2 = s2[a2][b2] - s2[a2][b1 - 1] - s2[a1][b2] + s2[a1][b1 - 1];
		int t3 = s3[a2][b2] - s3[a2][b1] - s3[a1 - 1][b2] + s3[a1 - 1][b1];
		printf("%d\n",t1 - t2 - t3);
	}
	return 0;
}

Measured memory_bytes: 52864
#include<iostream>
#include<queue>
#include<map>
#include<cstdio>
#include<cmath>
#define INF 500000000
using namespace std;

typedef pair<int,int> P;

int n,m,k;
int l[100100],a[100100],b[100100];
vector<P> g[5000];
int d[5000],w[5000];
int s[5000];

int main(){
  cin >> n >> m >> k;
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i] >> l[i];
    a[i]--; b[i]--;
    g[a[i]].push_back(P(l[i],b[i]));
    g[b[i]].push_back(P(l[i],a[i]));
  }
 
  for(int i=0;i<k;i++){cin >> s[i]; s[i]--;}

  for(int i=0;i<n;i++)d[i] = INF;
  priority_queue<P,vector<P>,greater<P> > q;
  for(int i=0;i<k;i++){
    d[s[i]] = 0;
    q.push(P(0,s[i]));
  }

  while(q.size()){
    P p = q.top(); q.pop();
    int cost = p.first, pos = p.second;
    
    for(int i=0;i<(int)g[pos].size();i++){
      int dis = cost + g[pos][i].first;
      int next = g[pos][i].second;
      
      if(dis<d[next]){
	d[next] = dis;
	q.push(P(dis,next));
      }
    }
  }

  double ans = 0.0;
  for(int i=0;i<m;i++){
    if(fabs(d[a[i]] - d[b[i]]) >= l[i]){
      ans = max(ans,(double)max(d[a[i]],d[b[i]]));
    }else{
      ans = max(ans,(double)(l[i]+d[a[i]]+d[b[i]])/2);
    }
  }
  cout << (int)(ans+1e-9+0.5) << endl;
}
  

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

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch : s) {
    if (ch == delim) {
      if (!item.empty()) elems.push_back(item);
      item.clear();
    } else {
      item += ch;
    }
  }
  if (!item.empty()) elems.push_back(item);
  return elems;
}

int main() {
  string s;
  cin >> s;
  int n = s.size();
  ll ans = 0;

  // 先頭に + が挿入されることはないので (n - 1) 箇所の隙間が対象
  rep(bit, 1 << (n - 1)) {
    ll tmp = 0;
    for (int i = 0; i < n - 1; i++) {
      tmp *= 10;
      tmp += s[i] - '0';
      if (bit >> i & 1) {
        ans += tmp;
        tmp = 0;
      }
    }
    tmp *= 10;
    tmp += s.back() - '0';
    ans += tmp;
  }

  cout << ans << endl;

  return 0;
}


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

#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265
 
const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n, k;
    cin >> n >> k;
    ll A[n];
    rep(i,0,n)	cin >> A[i];
    sort(A, A+n);
    ll sum = 0;
    rep(i,0,k)	sum += A[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int n, k;
int a[100010], dp[100010];

//先手が勝つか
bool f(int x)
{
  if (dp[x] != -1)
    return dp[x];
  if (x == 0)
    return false;

  rep(i, n)
  {
    if (x - a[i] >= 0 && !f(x - a[i]))
      return dp[x] = true;
  }
  return dp[x] = false;
}

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

  cin >> n >> k;
  rep(i, n) cin >> a[i];
  fill(dp, dp + 100010, -1);
  cout << (f(k) ? "First" : "Second") << endl;

  return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;


int main(){
  int n;cin>>n;
  string s;cin>>s;
  ll d[n+1],dm[n+1],m[n+1];
  d[0]=dm[0]=m[0]=0;
  rep(i,n){
    d[i+1]=d[i];
    m[i+1]=m[i];
    dm[i+1]=dm[i];
    if(s[i]=='D')d[i+1]++;
    if(s[i]=='M'){
      m[i+1]++;
      dm[i+1]+=d[i];
    }
  }
  int q;cin>>q;
  rep(i,q){
    int k;cin>>k;
    ll ans=0;
    rep(j,n){
      if(s[j]!='C')continue;
      ans+=dm[j]-dm[max(0,j-k+1)];
      ans-=d[max(0,j-k+1)]*(m[j]-m[max(0,j-k+1)]);
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 24836
module app;

import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main()
{
	auto input = parseInput();
	auto array = input.v;
	array.sort();
	while (array.length >= 2)
	{
		array[1] = (array[0] + array[1]) / 2;
		array = array[1..$];
	}
	writefln("%.20f", array[0]);
}

struct Input
{
	uint n;
	real[] v;
}

Input parseInput()
{
	Input input = void;
	input.n = readln().strip().to!uint;
	input.v = readln().strip().split().map!(s => s.to!real).array;
	return input;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    int[] w = new int[N];
    int[] e = new int[N];
    w[0] = 0;
    e[N - 1] = 0;
    for (int i = 1; i < N; i++) {
      w[i] = w[i - 1];
      if (S.charAt(i - 1) == 'W') {
        w[i]++;
      }
      e[N - 1 - i] = e[N - i];
      if (S.charAt(N - i) == 'E') {
        e[N - 1 - i]++;
      }
    }
    int min = Integer.MAX_VALUE;
    for (int i = 0; i < N; i++) {
      int tmp = w[i] + e[i];
      if (min > tmp) {
        min = tmp;
      }
    }
    System.out.println(min);
  }
}

Measured memory_bytes: 31152
#include <iostream>

using namespace std;
/** Problem0083 : Era Name Transformation **/
int main()
{
	int y, m, d, dd;
	
	while (cin >> y >> m >> d) {
		dd = y*10000 + m*100 + d;
		if (dd < 18680908)
			cout << "pre-meiji" << endl;
		else if (dd < 19120730)
			cout << "meiji " << y-1867 << " " << m << " " << d << endl;
		else if (dd < 19261225)
			cout << "taisho " << y-1911 << " " << m << " " << d << endl;
		else if (dd < 19890108)
			cout << "showa " << y-1925 << " " << m << " " << d << endl;
		else
			cout << "heisei " << y-1988 << " " << m << " " << d << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<pair<int,int> > vp;
typedef pair<int,int> p;
typedef vector<int> vi;
int n,totalcost;
vi a(100005);
vi costs(100005);
vi fix(100005);

int main(int argc,char const* argv[])
{
  cin >> n;
  for(int i=1;i<=n;i++)
    {
      cin >> a[i];
    }
  for(int i=0;i<=n;i++)
    {
      if(i==0) totalcost+=abs(a[0]);
      if(i==n) totalcost+=abs(a[i]);
      else totalcost+=abs(a[i]-a[i+1]);
    }
  for(int i=1;i<=n;i++)
    {
      if(i==n) fix[i]=(totalcost-(abs(a[i-1]-a[i])+abs(a[i]))+abs(a[i-1]));
      else fix[i]=(totalcost-(abs(a[i-1]-a[i])+abs(a[i]-a[i+1]))+abs(a[i-1]-a[i+1]));
    }
  for(int i=1;i<=n;i++)
    {
      cout << fix[i] << endl;
    }
			   
  return 0;
}


Measured memory_bytes: 2432
if __name__ == "__main__":
    s = input()

    s = set(s)

    if len(s) == 4:
        print('Yes')
    elif len(s) == 3 or len(s) == 1:
        print('No')
    elif len(s) == 2:
        if 'W' in s and 'E' in s:
            print('Yes')
        elif 'N' in s and 'S' in s:
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 3060
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

void Main()
{
	int r;
	cin >> r;
	cout << r*r << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

using namespace std;


int main(){

  int array[51][51] ={0}; 
  bool check[51][51] = {false};
  int x[100],y[100],t[100];
  int p,W,H,T;
  int answer =0;

  cin >>W >> H >> T;
  cin >>p;
  rep(i,p)
    cin >> x[i] >> y[i] >> t[i];
  rep(i,H){
    rep(j,W){
      int n;
      cin >> n;
      if(n==1)
	{
	  check[i][j]= true;
	}
    }
  }
  rep(k,p)
    {
	//cout<<x[k]<<y[k]<<endl;
      //if(check[y[k]][x[k]] == true)
	//cout<<"out"<<endl;
	array[y[k]][x[k]]++;

    }
  rep(i,H){
    rep(j,W)
    {
      if(check[i][j])
	answer =answer + array[i][j];
	//cout<<answer;
	
    }
}
    
  cout << answer << endl;
  return 0;

}

Measured memory_bytes: 1180
MOD=10**9+7

def powmod(a,n,m): #a^n mod m
    ans=1
    while n!=0:
        if n&1: ans=ans*a%m
        a=a*a%m
        n>>=1
    return ans%m

def fact(a,b):
    ans=1
    for i in range(a,b+1): ans=ans*i%MOD
    return ans

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

ans=powmod(2,n,MOD)-1
ta1=fact(n-a+1,n)
tb1=fact(n-b+1,n)
ta2=pow(fact(1,a),MOD-2,MOD)
tb2=pow(fact(1,b),MOD-2,MOD)
a=ta1*ta2%MOD
b=tb1*tb2%MOD
print((ans-a-b)%MOD)

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

int main() {
  int n; cin>>n;
  string s;
  if (n==0) s = '0';
  while (n != 0) {
    int rem = n % -2;
    n /= -2;
    if (rem < 0) {
      rem *= -1;
      n += 1;
    }
    s += ('0' + rem);
  }
  reverse(s.begin(), s.end());
  print(s);

  return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b,c,d=mp()
s=input()
if s[a-1]=="#" or s[b-1]=="#" or s[c-1]=="#" or s[d-1]=="#":
    print("No")
    exit()
for i in range(min(a,b)-1,max(c,d)):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        exit()
if d<c:
    ch=False
    for i in range(b-2,d-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ch=True
    if ch:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    print("Yes")


Measured memory_bytes: 39932
/*
 *
 * Author: r3gz3n
 * 
 * 3b 13 12 9 56 4e
 * 6 56 a a 5f f
 * 6 56 47 18 56 d
 * 13 46 14 1f 13 27
 * 52 52 a 5a 47 1
 * 1d 13 b 1b 49 17
 *
 */


#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;


#define all(x) (x).begin(),(x).end()


#define endl '\n'


class Solution {
public:
    void solve(std::istream& in, std::ostream& out) {
        string s, fr = "", ba = "";
        int q, f, t;
        char c;
        bool isReversed = false;
        in >> s >> q;
        while (q--) {
            in >> t;
            if (t == 1) {
                isReversed = !isReversed;
            }
            else {
                in >> f >> c;
                if (isReversed) {
                    if (f == 1) ba += c;
                    else fr += c;
                }
                else {
                    if (f == 1) fr += c;
                    else ba += c;
                }
            }
        }
        string ans;
        if (isReversed) {
            reverse(all(ba));
            reverse(all(s));
            ans = ba + s + fr;
        }
        else {
            reverse(all(fr));
            ans = fr + s + ba;
        }
        out << ans << endl;

    }
};

void solve(std::istream& in, std::ostream& out)
{
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}


#include <fstream>
#include <iostream>


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


    istream& in = cin;


    ostream& out = cout;

    solve(in, out);
    return 0;
}




Measured memory_bytes: 1300
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  int ret = 0;
  int base = 1;
  while(base < B){
    ret++;
    base--;
    base += A;
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;



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


ll m = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}
ll a[200010];
ll cum[200010];
int main() {
	int N; cin >> N;
	ll sum = 0;
	cum[0] = 0;
	REP(i, N) {
		cin >> a[i];
		sum += a[i];
		cum[i + 1] = cum[i] + a[i];
	}
	ll ans = 2000000000;
	FOR(i,1, N) {
		ans = min(ans, abs((sum - cum[i]) - cum[i]));
	}
	cout << ans << endl;
}


Measured memory_bytes: 3328
#include<stdio.h>
int main(void)
{
  int i,n,flag=0;
  char s[105];
  scanf("%d",&n);
  scanf("%s",s);
  if(n%2==0)
  {
    for(i=0;i<n/2;i++)
    {
      flag=0;
      if(s[i]!=s[i+n/2])
      {
        flag=1;
        break;
      }
    }
    if(flag==1)
      printf("No\n");
    else
      printf("Yes\n");
  }
  else
    printf("No\n");
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N= 3e5 + 5;
const ll mod=1e9 + 7;

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

    ll x,y,z;
    cin>>x>>y>>z;
    cout<<(x*y)/2;

}



Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var x, n int
	fmt.Scan(&x, &n)
	var p int
	set := make(map[int]struct{})
	for i := 0; i < n; i++ {
		fmt.Scan(&p)
		set[p] = struct{}{}
	}
	if _, ok := set[x]; !ok {
		fmt.Println(x)
		return
	}
	for i := 1; ; i++ {
		if _, ok := set[x-i]; !ok {
			fmt.Println(x - i)
			return
		}
		if _, ok := set[x+i]; !ok {
			fmt.Println(x + i)
			return
		}
	}

}


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

using namespace std ; 

int main () { 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ; 
	string a , b ; 
	cin >> a >> b ; 
	
	if ( a.size() > b.size() )
		cout << "GREATER" << endl ;
	else if ( a.size() < b.size() )
		cout << "LESS" << endl ; 
	else {
		for ( int i = 0 ; i < a.size() ; i ++ )  { 
			if ( a[i] > b[i] ){
				cout << "GREATER" << endl ;
				return 0 ;
			} 
			else if ( a[i] < b[i] ) {
				cout << "LESS" << endl ; 
				return 0 ;
			}
			
		}
		cout << "EQUAL" <<endl ; 
		
	}
	
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		double T = sc.nextDouble();

		int seconds = (int)((T + 0.5) / A);
		int ans = B * seconds;

		System.out.println(ans);
	}

}


Measured memory_bytes: 37332
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INF 1e9
#define MOD 1000000007
#define MAX_P 55555
#define MAX_N 56
#define mod(x) ((x % MOD) + MOD) % MOD

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

bool is_bool[MAX_P];
void init() {
    fill(is_bool, is_bool + MAX_P, true);
    is_bool[1] = false;
    for (int i = 2; i < MAX_P; ++i) {
        if (is_bool[i]) {
            for (int k = 2; k <= MAX_P/i; ++k) {
                is_bool[i * k] = false;
            }
        }
    }
}

int main() {
    init();
    int N;
    cin >> N;
    
    int ans[MAX_N];
    int idx = 0;
    for (int i = 0; i < MAX_P; ++i) {
        if (is_bool[i] && i % 5 == 1) {
            ans[idx++] = i;
        }
        if (idx == N) {
            break;
        }
    }
    
    for (int i = 0; i < N; ++i) {
        cout << ans[i] << " ";
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
//#define rep(i, n) for(int (i) = 0, TmP = (n); (i) < (int)TmP ; ++(i))
#define asort(v, n) sort((v), (v + n)) //Using array
#define vsort(v) sort((v).begin(), (v).end()) // Using vector
#define vint vector<int>
//typedef long long ll;
#define int long long

using namespace std;

signed main(){
  int a;
  int num = 100;
  cin >> a;
  int c = 0;
  while(true){
    num += num / 100;
    c++;
    if(num >= a){
      cout << c << endl;
      return 0;
    }
  }
}


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

double power(double x,int n)
{
  double y=1;
  for(int i=0;i<n;i++)
    y*=x;
  return y;
}

int main()
{
  int n;
  int x[100],y[100];
  int p;
  unsigned long long sum;
  cin >> n;
  for(int i=0;i<n;i++)
    cin >> x[i];
  for(int i=0;i<n;i++)
    cin >> y[i];

  for(p=1;p<=3;p++)
    {
      sum=0.0;
      for(int i=0;i<n;i++)
	sum+=power((x[i]-y[i]<0)?(y[i]-x[i]):(x[i]-y[i]),p);
    
      cout.precision(10);
      cout.setf(ios::fixed);
      cout << pow(sum,1.0/p) << endl;
    }

  sum=0.0;
 
  
    
 
  int max=0.0;
  for(int i=0;i<n;i++)
    {
      sum=(x[i]-y[i]<0)?(y[i]-x[i]):(x[i]-y[i]);
      if(sum>max)
	max=sum;
    }
  cout.precision(10);
  cout.setf(ios::fixed);
  cout << max << endl;

  return 0;
}

Measured memory_bytes: 3468
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
const int INF = 1<<28;

int main() {
	int n, q;
	while(cin >> n >> q, n|q) {
		int days[100] = {};
		for(int i=0; i<n; i++) {
			int num;
			cin >> num;
			for(int j=0; j<num; j++) {
				int temp;
				cin >> temp;
				days[temp]++;
			}
		}
		int day = 0, ans = 0;
		for(int i=0; i<100; i++) {
			if(days[i] >= q && days[i] > day) {
				day = days[i];
				ans = i;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<int, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 1000010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    string s;
    cin >> s;
    int res = 0;
    FOR(i,0,(SZ(s)-1)/2) 
        if (s[i] != s[SZ(s)-1-i]) res++;
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
 int n;
 long h;
 long w;
 long a;
 long b;
 int i;
 long count=0;

 scanf("%d %ld %ld",&n,&h,&w);
 for(i=0;i<n;i++) 
 {
   scanf("%ld %ld",&a,&b);
   if( ( (a/h) >= 1)&&( (b/w) >= 1)) count++;
 }
 printf("%ld\n",count);
 return 0;
}


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

int main(){
  int n,cur=0,v;
  cin >> n;
  char c;
  for(int i=0; i<n; i++){
    cin >> c;
    v = (c=='R') ? 1 : -1;
    cur+=v;
  }
  string ans = (cur>0) ? "Yes" : "No";
  cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int num[2000]={},co=n;
        for(int i=0;i<n;i++)cin>>num[i];
        for(int i=0;;i++){
            bool kawa=1;
            if(i==10000){
                cout<<-1<<endl;
                break;
            }
            for(int j=0;j<co&&kawa;j++)if(num[j]!=j+1)kawa=0;
            if(kawa){
                cout<<i<<endl;
                break;
            }
            num[co]=co+1;
            for(int j=0;j<=co;j++){
                if(num[j]==1){
                    for(int k=j+1;k<=co&&num[j]==1;k++)if(num[k]!=1)swap(num[j],num[k]);
                }
                num[j]--;
            }
            for(int j=co+1;j>=0;j--){
                if(num[j]!=0){
                    co=j+1;
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 1168
import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val Array(m1, d1) = in.readLine().split("\\s+").map(_.toInt)
    val Array(m2, d2) = in.readLine().split("\\s+").map(_.toInt)

    System.out.println(
      if (m1 == m2) {
        0
      } else {
        1
      }
    )
  }
}


Measured memory_bytes: 27292
#include <bits/stdc++.h>
#define ll long long
#define WEIGHTSUM weight + i
#define VALUESUM maxValue[i] + value
using namespace std;
ll maxValue[100005];

int main() {
	ll n, w, weight, value;

	cin >> n >> w;
	for (int i = 1; i <= n; i++) {
		cin >> weight >> value;

		for (int i = w; i >= 1; i--)
			if (maxValue[i] && WEIGHTSUM <= w) {
				maxValue[WEIGHTSUM] = max(maxValue[WEIGHTSUM], VALUESUM);
				maxValue[w] = max(maxValue[w], VALUESUM);
			}

		maxValue[weight] = max(maxValue[weight], value);
		maxValue[w] = max(maxValue[w], value);
	}

    cout << maxValue[w];

	return 0;
}


Measured memory_bytes: 4312
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<cstdlib>
#include<queue>
#include<utility>
using namespace std;

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

typedef long long ll;
typedef vector<vector<int>> Graph;

int main() {
	//入力;
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(b / a, c) << endl;


	//小数点以下の桁数表示;
	//cout << fixed << setprecision(15);

	return 0;
}

Measured memory_bytes: 256
local mab = math.abs
local x, n = io.read("*n", "*n")
local t = {}
for i = -101, 101 do
  t[i] = true
end
for i = 1, n do
  local a = io.read("*n")
  t[a] = false
end
local cand = -101
for i = -100, 101 do
  if t[i] then
    if mab(x - i) < mab(x - cand) then
      cand = i
    end
  end
end
print(cand)


Measured memory_bytes: 2752
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<cmath>
#include<deque>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define INF (3000)
int table[2000][2000];
int C[2000];
int main() {
	int N, X, Y;
	scanf("%d%d%d", &N, &X, &Y);
	X--, Y--;
	rep(s, 0, N) {
		rep(e, s + 1, N) {
			table[s][e] = min(e - s, abs(X - s) + 1 + abs(Y - e));
		}
	}
	rep(s, 0, N) {
		rep(t, 0, N) {
			C [table[s][t]] ++;
		}
	}
	rep(i, 1, N)printf("%d\n", C[i]);
	return 0;
}

Measured memory_bytes: 15232
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    priority_queue<ll> pq;
    rep(i, N){
        ll a; cin >> a; pq.push(a);
    }
    
    while(M > 0){
        ll now = pq.top(); pq.pop();
        pq.push(now/2);
        M--;
    }
    
    ll ans = 0;
    while(!pq.empty()){
        ll now = pq.top(); pq.pop();
        ans += now;
    }
    cout << ans << endstr;
    return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>
int main(void)
{
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        if(a+b>c+d) printf("Left\n");
        else if(c+d>a+b) printf("Right\n");
        else printf("Balanced\n");
        return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,K;
  cin >> N >> K;
  long long a[15]{0};
  for(int i=0;i<N;i++) cin >> a[i];
  
  long long ans=150000000001;
  for(int c=0;c<pow(2,N);c++)
  {
    bool look[15]{false};
    long long yen=0;
    long long nowH=0;
    int count=0;
    for(int i=0;i<N;i++)
    {
      int s=pow(2,i);
      if(c%(2*s)/s==1) 
      {
        count++;
        look[i]=true;
      }
    }
    
    nowH=a[0];
    for(int i=1;i<N;i++)
    {
      if(look[i]==true)
      {
        if(nowH>=a[i])
        {
          nowH++;
          yen+=nowH-a[i];
        }
        else nowH=a[i];
      }
      else if(look[i]==false&&nowH<a[i]) 
      {
        count=0;
        continue;
      }
    }
    //cout << count << endl;
    if(count>=K&&yen<ans) ans=yen;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int case1 = 1;

int main()
{
    int k, n;
    cin >> k >> n;
    int ar[n+5] = {};
    for(int i = 1; i <= n; i++)
    {
        cin >> ar[i];
    }
    int ans = ar[n]-ar[1];
    for(int i = 1; i <= n-1; i++)
    {
        int p = abs(0-ar[i])+abs(k-ar[n])+ abs(ar[i+1] - ar[n]);
        ans = min(ans, p);
        p = abs(ar[i]-ar[n])+abs(ar[n]-k)+abs(0-ar[i-1]);
        ans = min(ans, p);
    }
    int p = abs(ar[n]-k)+abs(0-ar[n-1]);
    ans = min(ans, p);
    cout << ans << endl;
    return 0;
}


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

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}


int main() {
	
	int n;
	cin >> n;
	vector<pair<int, int>> x(n);
	rep(i, n){
		int a;
		cin >> a;
		x[i] = make_pair(a, i);
	}
	sort(all(x));
	
	int med1 = x[n / 2 - 1].first;
	int med2 = x[n / 2].first;
	
	rep(i, n){
		x[i].first = i;
	}
	
	sort(all(x), compare_by_b);
	
	rep(i, n){
		if(x[i].first < n / 2) cout << med2 << endl;
		else cout << med1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3712
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
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)*}
    };
}

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)*}
    };
}

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")
    };
}

fn main() {
    input! {
        N: usize,
        A: [u64; N],
    }
    let mut ans = gcd(A[0], A[1]);
    for i in 0..N {
        ans = gcd(ans, A[i]);
    }

    println!("{}", ans);
}

pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}


Measured memory_bytes: 4352
#include<iostream>

int main(void){
  int N;
  std::cin >> N;

  if(N == 1){
    std::cout << "Hello World" << std::endl;
  }else{
    int A,B;
    std::cin >> A >> B;
    std::cout << A + B << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define FILEIN (freopen ("in", "r", stdin))
#define FILEOUT (freopen ("out", "w", stdout))

const int maxn = 33333;
const double eps = 1e-8;

double area[maxn];
int num[maxn];
double sumA[maxn];
int sumN[maxn];

int n, m;
double w, h, s;
struct point {
	double x, y;
} p;
struct line {
	point a, b;
} L[maxn];

double xmult (const point &p1, const point &p2, const point &p0) {
	return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
}

void sumArea () {
	double u, d;
	for (int i = 0; i <= m; ++ i) {
		u = L[i+1].a.y - L[i].a.y;
		d = L[i+1].b.y - L[i].b.y;
		area[i] = (u + d) * w / 2;
	}
}
int bin (const point &p, int l, int r) {
	int m;
	int ret = -1;
	while (l <= r) {
		m = (l+r) / 2;
		if (xmult (L[m].a, L[m].b, p) >= 0) {
			ret = m;
			l = m + 1;
		}
		else {
			r = m - 1;
		}
	}
	return ret;
}
void sumNum () {
	for (int i = 0; i < n; ++ i) {
		scanf ("%lf%lf", &p.x, &p.y);
		int pos = bin (p, 0, m+1); // 二分在&#21738;一条&#32447;后面,不可能在M+1后面
		num[pos] ++;
	}
}
int main () {
	/*FILEIN;
	FILEOUT;*/
	while (~scanf ("%d%d%lf%lf%lf", &n, &m, &w, &h, &s)) {
		if (!n) break;
		memset (area, 0, sizeof (area));
		memset (num, 0, sizeof (num));
		for (int i = 1; i <= m; ++ i) {
			scanf ("%lf%lf", &L[i].a.y, &L[i].b.y);
			L[i].a.x = 0, L[i].b.x = w;
		}
		L[m+1].a.x = 0, L[m+1].a.y = h, L[m+1].b.x = w, L[m+1].b.y = h;
		sumArea ();
		sumNum ();
		memset (sumA, 0, sizeof (sumA));
		memset (sumN, 0, sizeof (sumN));
		sumA[1] = area[0], sumN[1] = num[0];
		for (int i = 2; i <= m+1; ++ i) {
			sumA[i] = sumA[i-1] + area[i-1];
			sumN[i] = sumN[i-1] + num[i-1];
		}
		s = w * h - s;
		int ans = 0;
		for (int i = 1; i <= m+1; ++ i) {
			int l = i, r = m+1;
			while (l <= r) {
				int m = (l + r) / 2;
				if (sumA[m] - sumA[i-1] <= s) {
					l = m + 1;
					if (ans < sumN[m] - sumN[i-1]) ans = sumN[m] - sumN[i-1];
				}
				else r = m - 1;
			}
		}
		printf ("%d\n", n - ans);
	}
	return 0;
}

Measured memory_bytes: 2952
K, S = map(int , input().strip().split(" "))


count = 0
for x in range(K+1):
    if x > S :
        break
    elif S - x > 2*K:
        continue
    for y in range(K+1):
        if x + y > S:
            break
        elif S - (x+y) > K:
            continue
        count+= 1
print(count)


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

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

int main()
{
    char c;
    cin >> c;
    string vowel = "aeiou";
    cout << (vowel.find(c) == string::npos ? "consonant" : "vowel") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int dp[100001][4];
int point[100001][4];

int maxP(int i,  int last){
    if(i==n)
    return 0;
    
    int ret=INT_MIN;
    if(dp[i][last]!=-1) return dp[i][last];
    for(int j=1;j<=3;j++){
        
        if(j!=last)
        {
            ret= max(ret, point[i][j]+maxP(i+1, j));
        }
        
        
     }
     return dp[i][last] = ret;
}



int main() {
     cin>>n;
     for(int i  = 0; i<n; i++)
     {
        cin>>point[i][1]>>point[i][2]>>point[i][3];
     }
     memset(dp, -1, sizeof(dp) );
     cout<<maxP(0,0);
     return 0;
    
}


Measured memory_bytes: 16044
#include <iostream>
using namespace std;
const int INF = 1e9;

int main() {
    int n; cin >> n;
    int x[n + 1];
    for (int i = 0; i < n; i++) cin >> x[i];
    int ans = INF, sum;
    for (int i = 1; i <= 100; i++) {
        sum = 0;
        for (int j = 0; j < n; j++) {
            sum += (x[j] - i) * (x[j] - i);
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int n,A[50];

int solve(int i,int m){
  if(m == 0) return 1;
  if (i >= n) return 0;
  int res = solve(i + 1,m) || solve(i + 1,m - A[i]);
  return res;
}


int main(){
  int q,M,i;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
   scanf("%d",&q);
   for(i=0;i<q;i++) {
     scanf("%d",&M);
     if(solve(0,M)) printf("yes\n");
     else printf("no\n");
   }

   return 0;
}




Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
long long temp[200020],a[200020],n,m,ans;
inline void __merge(int l,int r)
{
	if(l==r) return;
	int mid=(l+r)>>1;
	__merge(l,mid);__merge(mid+1,r);
	int i=l,j=mid+1;
	for(int k=l;k<=r;k++)
	{
		if((i<=mid&&a[i]<a[j])||j>r) temp[k]=a[i++];
		else temp[k]=a[j++]; 
	}
	for(int k=l;k<=r;k++) a[k]=temp[k];
}
int main()
{
	scanf("%lld%lld",&n,&m);
	if(m>=n) {puts("0"); return 0;}
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	__merge(1,n);
	
	for(int i=1;i<=n-m;i++) ans+=a[i];
	printf("%lld",ans);
	return 0;
 } 

Measured memory_bytes: 3328
#include <stdio.h>
#include<string.h>
int main()
{
    char S[100002];
    int i=0,count=0,j=0,b1=0,w1=0;
    gets(S);
    while(S[i]!='\0')
    {
        if(S[i]==S[i+1])
        {
            if(S[i+1]=='1') S[i+1]='0';
            else S[i+1]='1';
            count++;
        }
        i++;
    }
    printf("%d",count);

}


Measured memory_bytes: 256
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
#define read            ZXBs_fast_input
#define write           ZXBs_fast_output
#define int             long long
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool write(int x){
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

int n, d;
int a[200200];
int dpL[200200];
int dpR[200200];

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n >> d;
	rep(i, n) cin >> a[i];
	int res = d * (n - 1);
	rep(i, n) res += a[i];
	dpL[0] = a[0];
	for(int i = 1; i < n; i++){
		dpL[i] = min(a[i], dpL[i - 1] + d);
	}
	dpR[n - 1] = a[n - 1];
	for(int i = n - 2; i >= 0; i--){
		dpR[i] = min(a[i], dpR[i + 1] + d);
	}
	for(int i = 1; i < n - 1; i++){
		res += min(dpL[i], dpR[i]);
	}
	cout << res << endl;
	return 0;
}

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

int N, Y;

int main(void){
    
    cin >> N >> Y;
    
    for(int i = 0; i <= N; ++i){
        for(int j = 0; j <= N - i; ++j){
            int k = N - i - j;
            if(i * 10000 + j * 5000 + k * 1000 == Y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def gcd(a: int, b: int):
    """ https://cocodrips.hateblo.jp/entry/2014/03/05/143623
    """
    while b:
        a, b = b, a%b
    return a

def lcm(a: int, b: int):
    return a * b // gcd(a, b)


def main():
	N,A,B = map(int, input().split())
	#S = input().rstrip()
	#vA = list(map(int, input().split()))
	#vX = [input().rstrip() for _ in [0,]*N]
	
	C = A+B

	res = 0
	
	if N<C:
		res = min(A,N)
	else:
		res = (N//C) * A
		res += min(N%C, A)
	
	#res = "No" if (S=="AAA" or S=="BBB") else "Yes"
	#res = -(-N//M)
	#res = gcd(N,M)
	print(res)
	
if __name__ == "__main__":
    main()


Measured memory_bytes: 38480