akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// using lint = long long;
#define int long long
signed main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  bool flg;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> h[i];
  }
  int vx, vy, vh;
  for (int vx = 0; vx <= 100; vx++) {
    for (int vy = 0; vy <= 100; vy++) {
      for (int i = 0; i < n; i++) {
        if (h[i] > 0) {
          vh = h[i] + abs(x[i] - vx) + abs(y[i] - vy);
          break;
        }
      }
      flg = true;
      for (int i = 0; i < n; i++) {
        int vh0 = max(vh - abs(x[i] - vx) - abs(y[i] - vy), 0ll);
        if (vh0 != h[i]) {
          // cout << flg << " " << vx << " " << vy << " " << vh << " " << i << "
          // "
          //      << vh0 << endl;
          flg = false;
          break;
        }
      }
      if (flg == true) {
        cout << vx << " " << vy << " " << vh << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.S;
		var t=s;
		var d=s.ToCharArray();
		s+=s;
		var c=s.ToCharArray();
		var n=sc.L;
		var h=new int[27];
		for(int i = 0;i<d.Length;i++) {h[d[i]-'a']++;}
		if(h.Max()==d.Length){
			Console.WriteLine("{0}",n*d.Length/2);
			return;
		}
		if(d.Length==1){Console.WriteLine("{0}",n/2);return;}
		long ans=0,ans2=0,ans3=0;
		for(int i = 1;i<c.Length;i++) {
			if(c[i]==c[i-1]){
				c[i]='`';
				ans++;
			}
		}
			for(int i = 1;i<d.Length;i++) {
				if(d[i]==d[i-1]){
					d[i]='`';
					ans2++;
				}
			}
			Console.WriteLine("{0}",(ans-ans2)*(n-1)+ans2);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13268
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>


using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;


typedef string::const_iterator State;
class ParseError {};




#define ll long long




/*
class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e, H, W, L;
ll A[300005] = {};
ll B[2][300005] = {};
ll C[300005] = {};
bool f, ff;
string S;
set <long long>sll;
pl bufpl;
vector <long long>vl;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;

/*struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}



ll minn, maxx;
double ansa;
bool fl[30] = {};

string ss, sss;

int main() {


	cin >> N;
	a = 0;

	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		vl.push_back(A[i]);
	}
	
	sort(vl.begin(), vl.end());


	for (int i = 0; i < N; i++) {
		C[i+1] = vl[i];
		if (A[i + 1] == C[i + 1]) {
			a++;
		}
	}

	cin >> M;

	for (int i = 1; i <= M; i++) {
		cin >> B[0][i] >> B[1][i];
	}

	e = -1;

	for (int i = 1; i <= M; i++) {
		if (a == N) {
			e = i - 1;
			break;
		}
		b = B[0][i];
		c = B[1][i];
		if (A[b] == C[b]) {
			a--;
		}
		if (A[c] == C[c]) {
			a--;
		}
		swap(A[b], A[c]);
		if (A[b] == C[b]) {
			a++;
		}
		if (A[c] == C[c]) {
			a++;
		}

		if (i == M) {
			if (a == N) {
				e = i;
				break;
			}
		}

	}



	cout << e<<endl;

	return 0;

}



Measured memory_bytes: 14608
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <string>
#include <utility>

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

using namespace std;

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

int main(){
	//source
	int n,k;
	cin >> n >> k;
	int a[n];
	rep(i,n){
		cin >> a[i];
	}

	int ans=(n-1)/(k-1);
	if((n-1)%(k-1)!=0){
		ans++;
	}

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

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

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

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

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


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end(),greater<ll>());

  if(n%2==0){
    ll res=0;
    for(int i=0;i<n/2; i++) res+=a[i]*2;
    res-=a[n/2-1]+a[n/2];
    for(int i=n/2+1; i<n; i++) res-=a[i]*2;
    cout << res << endl;
  }

  else{
    ll res1=0,res2=0;
    for(int i=0; i<n/2; i++) res1+=a[i]*2;
    res1-=a[n/2]+a[n/2+1];
    for(int i=n/2+2; i<n; i++) res1-=a[i]*2;

    for(int i=0; i<n/2-1; i++) res2+=a[i]*2;
    res2+=a[n/2-1]+a[n/2];
    for(int i=n/2+1; i<n; i++) res2-=a[i]*2;
    cout << max(res1,res2) << endl;
  }
  return 0;
}


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

int main (){
long long  h,w;
 
cin >> h >> w ;
if(h == 1 || w == 1){
    cout << 1<< endl;
    return 0;
}

if(h * w % 2 == 0)
    cout << h * w / 2 << endl;
else
    cout << h * w / 2 + 1 << endl;
return 0;
}

Measured memory_bytes: 256
#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;

template<class T>
struct Edge {
    int to;
    T capacity, cost, rev;
};

template<class T=ll, T T_INF=INFL>
struct MinCostFlow {
    int N;
    vector<vector<Edge<T>>> E;

    MinCostFlow(int n) : N(n) {
        E.resize(N);
    }
    void add_arc(int from, int to, T cap, T cost) {
        E[from].push_back(Edge<T>{to, cap, cost, (ll)E[to].size()});
        E[to].push_back(Edge<T>{from, 0, -cost, (ll)E[from].size() - 1});
    }
    T flow(int s, int t, T f) {
        T res = 0;
        vector<T> prev_v(N), prev_e(N);
        while(f > 0) {
            vector<T> dist(N, T_INF);
            dist[s] = 0;
            bool updated = true;
            while(updated) {
                updated = false;
                rep(v, N) if(dist[v] < T_INF) {
                    rep(i, E[v].size()) {
                        auto &e = E[v][i];
                        if(e.capacity > 0 and dist[e.to] > dist[v] + e.cost) {
                            dist[e.to] = dist[v] + e.cost;
                            prev_v[e.to] = v;
                            prev_e[e.to] = i;
                            updated = true;
                        }
                    }
                }
            }
            if(dist[t] == T_INF) return -1;
            T d = f;
            for(int v = t; v != s; v = prev_v[v]) {
                d = min(d, E[prev_v[v]][prev_e[v]].capacity);
            }
            f -= d;
            res += d * dist[t];
            for(int v = t; v != s; v = prev_v[v]) {
                auto &e = E[prev_v[v]][prev_e[v]];
                e.capacity -= d;
                E[v][e.rev].capacity += d;
            }            
        }
        return res;
    }
};
    
class Solver {
  public:
    bool solve() {
        int V, E, F; cin >> V >> E >> F;
        MinCostFlow<> graph(V);
        rep(i, E) {
            int u, v, c, d; cin >> u >> v >> c >> d;
            graph.add_arc(u, v, c, d);
        }
        cout << graph.flow(0, V - 1, F) << endl; 
        return 0;
    }
};

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

Measured memory_bytes: 3244
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>

using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

ll d, g;
vector<ll> p(15), c(15);

int main(){
    cin >> d >> g;
    rep(i, d)cin >> p[i] >> c[i];
    ll ans = 10000;
    rep(i, 2<<10){
        ll point = 0;
        ll cnt = 0;
        rep(j, d)if(i&(1<<j)){
            point += p[j]*(j+1)*100+c[j];
            cnt += p[j];
        }
        if(point < g){
            ll mx = d-1;
            while(i&(1<<mx))mx--;
            ll k = 0;
            while(point < g && k <= p[mx])point+=(mx+1)*100, k++, cnt++;
        }
        if(point >= g)ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
import java.io.IOException;
	public class Main {
		
	    public static void main(String[] args) throws IOException {
	    	Scanner teclado = new Scanner(System.in);
	    	int[][] x = new int[11][21];
	    	int a = teclado.nextInt();
	    	int b = teclado.nextInt();
	    	for(int i = 0;i<a;i++) {
	    		for(int ii = 0;ii<b;ii++) {
	    			x[i][ii] = teclado.nextInt();
	    		}
	    	}
	    	int orozco = 0;
	    	for(int i = 0;i<a-1;i++) {
	    		for(int ii = i+1;ii<a;ii++) {
	    			int orozcolord =0;
	    			for(int iii =0;iii<b;iii++) {
	    				orozcolord += (x[i][iii]-x[ii][iii])*(x[i][iii]-x[ii][iii]);
	    			}
	    			double sla = Math.sqrt(orozcolord);
	    			if(sla == (int)sla) {
	    				orozco++;
	    			}
	    		}
	    	}
	    	System.out.println(orozco);
	    }
	
	}

Measured memory_bytes: 23124
#include<stdio.h>
#include<math.h>

int main(void) {
  unsigned long int x;
  unsigned long int n=100;
  unsigned long int prev_n;
  unsigned long int count=0;
  unsigned long int prev_count;
  unsigned long int money_zouka;
  unsigned long int year_zouka;
  scanf("%ld", &x);
  while(n < x) {
    prev_n = n;
    prev_count = count;
    money_zouka = n / 100;
    year_zouka = (unsigned long int)ceil((double)(100-n%100)/money_zouka);
    count += year_zouka;
    n += money_zouka * year_zouka;
  }
  //printf("%ld, %ld\n", prev_n, prev_count);
  while(prev_n < x) {
    prev_n += prev_n / 100;
    prev_count++;
  }
  printf("%ld\n", prev_count);
  return 0;
}


Measured memory_bytes: 1732
use std::io::*;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().trim().split_whitespace()
        .map(|w| w.parse().ok().unwrap()).collect()
}

fn main() {
    let v = read_vec::<usize>();
    let (mut x,y) = (v[0],v[1]);
    let mut ans = 0;
    while x <= y {
        x *= 2;
        ans += 1;
    }
    println!("{}",ans);
}


Measured memory_bytes: 4352
a, b = map(int, input().split())


def tax8(p):
    return (p * 0.08 // 1)


def tax10(p):
    return (p * 0.1 // 1)


for p in range(1, 2000):
    tmp8 = tax8(p)
    tmp10 = tax10(p)
    if tmp8 == a and tmp10 == b:
        print(p)
        exit(0)

print('-1')


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
    {
    	cout<<"Yes"<<endl;
    }
    else
    {
    	cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
/*mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());*/
using ll = long long;
#define endl '\n'
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

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


}
int main(){
    /*ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);*/

    int t = 1;
    /*cin >> t;*/
    /*int test = 0;*/
    while(t--){
        /*cout << "Case " << ++test << ": ";*/
        solve();
    }

}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ld float
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define vvi vector<vi >
#define str string
#define vs vector<str>
#define vb vector<bool>
#define slli set<lli>
#define mii map<int, int>
#define mlli map<int, lli>
#define msi map<str, int>
#define mp make_pair
#define pii pair<int, int>
#define pll pair<lli, lli>
#define vpii vector<pii >
#define vpll vector<pll >
#define pb push_back
#define loop(i, s, l, j) for(int i = s; i < l; i += j)
#define rloop(i, s, l, j) for(int i = s; i >= l; i -= j)
#define rep(i, n) loop(i,0,n,1)
#define rrep(i, n) rloop(i,n-1,0,1) 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ft first
#define sd second
#define all(a) a.begin(),a.end()
#define rev(a) reverse(all(a))
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define mod 1000000007
#define inf 2000000000
#define limit 1000005
#define minval -100000000000000000
#define maxval 1000000000000000
int dx4[4] = {0, -1, 0, 1};
int dy4[4] = {1, 0, -1, 0};
int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Power(int base,int exp){int ans=1;  while(exp > 0){if(exp&1)ans=(1LL*ans*base)%mod; exp=exp>>1; base=(1LL*base*base)%mod;}  return ans;}

void solve(int test_case)
{
    int n;
    cin >> n;

    vi a(n), b(n);
    rep(i,n)    
        cin >> a[i] >> b[i];
    
    rep(i,n-2)
    {
        bool ok = 0;
        loop(j,i,i+3,1)
            if(a[j] != b[j])
                ok = 1;
        if(ok == 0)
        {
            cout << "Yes\n";
            return;
        }
 
    }
    cout << "No\n";
}
int main()
{
   /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   */
    fastio();
    int q = 1;
    //cin >> q;
    rep(i,q)
        solve(i+1);
}


Measured memory_bytes: 3652
#include <iostream>
using namespace std;
const int N = 111;
int w, h, ans;
char ch, maze[N][N];
const int cx[] = {1, -1, 0, 0}, cy[] = {0, 0, 1, -1};
void dfs(int x, int y){
    maze[x][y] = '-';
    for(int i = 0; i < 4; ++i){
        int nx = x + cx[i], ny = y + cy[i];
        if(0 <= nx && nx < h && 0 <= ny && ny < w && maze[nx][ny] == ch)
            dfs(nx, ny);
    }
}
int main(){
    while(cin >> h >> w, (h && w)){
        for(int i = 0; i < h; ++i)
            for(int j = 0; j < w; ++j)
                cin >> maze[i][j];
        ans = 0;
        for(int i = 0; i < h; ++i)
            for(int j = 0; j < w; ++j){
                if(maze[i][j] != '-'){
                    ch = maze[i][j];
                    ++ans;
                    dfs(i, j);
                }
            }
        cout << ans << endl;
    }
    return 0;
}

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

int main(){
    int n, m, k, a, ans=0, c[50]={};
    cin >> n >> m;
    for(int i=0; i<n; i++){
        cin >> k;
        for(int j=0; j<k; j++){
            cin >> a;
            c[a]++;
        }
    }
    for(int i=1; i<=m; i++){
        if(c[i]==n){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string c;
  cin >> c; 
  
  if(c == "a"){
    
    cout << "vowel" << endl;
    
  }
  else if(c == "u"){
    
    cout << "vowel" << endl;
    
  }
  else if(c == "e"){
    
    cout << "vowel" << endl;
    
  }
  else if(c == "i"){
    
    cout << "vowel" << endl;
    
  }
    
  else if(c == "o"){
    
    cout << "vowel" << endl;
    
  }
  
  else{
    
    cout << "consonant" << endl;
    
  }
 
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

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

#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

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

	int A[3];
	cin >> A[0] >> A[1] >> A[2];

	int ret = 0;
	while(A[0] != A[1] || A[1] != A[2]){
		sort(A, A + 3);
		if(A[0] % 2 == A[2] % 2){
			A[0] += 2;
		}
		else{
			A[0]++;
			A[1]++;
		}
		ret++;
	}

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

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////



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

	ll A[MAX];
	repn(i, N) cin >> A[i];

	ll v = 0;
	repn(i, N) {
		if (A[i] == v+1) { v++; }
	}

	if (v == 0) { cout << -1; }
	else { cout << N - v; }
	
	
	system("PAUSE");
}

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

int main() {

    int a[3],b[3],c[5];
    int i,j=0,k=0,l=0,m=0;

    for(i=0;i<3;i++){
        cin >> a[i];
        cin >> b[i];
    }

    for(i=0;i<3;i++){
    if(a[i] == 1){
        j = j+1;
    }else if(a[i] == 2){
        k = k+1;
    }else if(a[i] == 3){
        l = l+1;
    }else if(a[i] == 4){
        m = m+1;
    }

    if(b[i] == 1){
        j = j+1;
    }else if(b[i] == 2){
        k = k+1;
    }else if(b[i] == 3){
        l = l+1;
    }else if(b[i] == 4){
        m = m+1;
    }
    }

    if(j<3 && k<3 && l<3 && m<3){
        cout << "YES" << endl;
    }else{
        cout << "NO" <<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    vector<string> s(3);
    cin >> s[0] >> s[1] >> s[2];
    string ret = "";
    rep(i,3)ret += s[i][0];
    cout << ret << endl;   

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> alphabet(26,0);
int N;
string S;
const long long M=(long long)1e9+7;
long long ans=1LL;

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

for (int i=0;i<N;i++){
    alphabet[S[i]-'a']++;
}
for (int i=0;i<26;i++){
    ans=(ans*(alphabet[i]+1))%M;
}
cout <<ans-1 <<endl;
}

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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N=nextInt();
		int K=nextInt();
		int[] h = new int[N];


		for(int i=0;i<N;i++){
			h[i]=nextInt();
		}

		Arrays.sort(h);
		long ans = h[K-1]-h[0];

		for(int i=K;i<N;i++){
			ans=Math.min(ans,h[i]-h[i-K+1]);
		}

		System.out.println(ans);

	}
	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 34732
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <tuple>

// さんこう :https://beta.atcoder.jp/contests/abc109/submissions/3153889
using namespace std;

typedef long long ll;

int N;
int v[100010];
int dp[2][100010];

int main() {
   cin >> N;
   for (int i=0;i<N;i++) {
      cin >> v[i];
      dp[i % 2][v[i]]++;
   }
   int max[2] = {100010, 100020};
   int max_2nd[2] = {100009, 100008};
   int max_tmp[2] = {0, 0};
   for (int i=1;i<=100000;i++) {
      if (max_tmp[0] <= dp[0][i]) {
         max_tmp[0] = dp[0][i];
         max[0] = i;
      }
      if (max_tmp[1] <= dp[1][i]) {
         max_tmp[1] = dp[1][i];
         max[1] = i;
      }
   }
   max_tmp[0] = 0;
   max_tmp[1] = 0;
   for (int i=1;i<=100000;i++) {
      if (max_tmp[0] <= dp[0][i] && i != max[0]) {
         max_tmp[0] = dp[0][i];
         max_2nd[0] = i;
      }
      if (max_tmp[1] <= dp[1][i] && i != max[1]) {
         max_tmp[1] = dp[1][i];
         max_2nd[1] = i;
      }
   }
   int should_change_basis[2] = {max[0], max[1]};
   if (should_change_basis[0] == should_change_basis[1]) {
      if (dp[1][max_2nd[1]] > dp[0][max_2nd[0]]) {
         should_change_basis[1] = max_2nd[1];
      } else {
         should_change_basis[0] = max_2nd[0];
      }
      // もはや1種類しかない場合でもこれで問題ない
   }
   printf("%d\n", N - dp[0][should_change_basis[0]] - dp[1][should_change_basis[1]]);
   return 0;
}


Measured memory_bytes: 1408
#include"bits/stdc++.h"
using namespace std;

#define ll long long int
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define eb(x) emplace_back(x)
#define mp(a,b) make_pair(a,b)
#define sz(a) int((a).size())
#define mod 1000000007
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }


void seethis(vector<ll>vect)
{
    for(ll x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / __gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}

int main()
{
	FASTIO;
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif*/
	
	ll n;
	 cin>>n;
	 vector<ll>vect(n+1);
	 for(int i=1;i<=n;i++)
	 	cin>>vect[i];

	 //Ai+i
	 vector<ll>A(n+1);
	 for(int i=1;i<=n;i++)
	 	A[i]=i+vect[i];
	 
	 vector<ll>B(n+1);
	 map<ll,ll>mp;
	 for(int i=1;i<=n;i++)
	 {
	 	B[i]=i-vect[i];
	 	mp[B[i]]++;
	 }
	 ll ans=0;
	 for(int i=1;i<=n;i++)
	 {
	 	mp.erase(B[i]);

	 	ans+=mp[A[i]];
	 }
	 cout<<ans<<"\n";

	
	return 0;
}

Measured memory_bytes: 20240
def q(a,k):
 d[a]=k
 for b in t[a]:
  if'-1'!=b:q(b,k+1)
def n(a,k):
 h[a]=max(h[a],k)if a in h else k
 if'-1'!=p[a]:n(p[a],k+1)
t,p,s,d,h={},{},{},{},{}
for _ in[0]*int(input()):
 x,y,z=input().split()
 t[x]=set([y,z])-set(['-1'])
 p[y]=p[z]=x
 s[y],s[z]=z,y
r=(set(t)-set(p)).pop()
p[r],s[r]=['-1']*2
q(r,0)
for i in t:
 if not t[i]:n(i,0)
print('\n'.join(f"node {i}: parent = {p[i]}, sibling = {s[i]}, degree = {len(t[i])}, depth = {d[i]}, height = {h[i]}, {'root'if d[i]==0else'internal node'if t[i]else'leaf'}"for i in map(str,sorted(map(int,t)))))


Measured memory_bytes: 5632
flist = []
slist = []
for i in range(4):
    flist.append(int(input()))
for i in range(2):
    slist.append(int(input()))
    
mf = min(flist)
ms = min(slist)
flist.remove(mf)
slist.remove(ms)
print(sum(flist) + sum(slist))


Measured memory_bytes: 5596
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  int d = a+b; int e = a+c; int f = b+c;
  int g = min(d, e);
  cout << min(f,g) <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll sx, sy, tx, ty;
    cin>>sx>>sy>>tx>>ty;
    rep(i, tx-sx) cout<<"R";
    rep(i, ty-sy) cout<<"U";
    rep(i, tx-sx) cout<<"L";
    rep(i, ty-sy) cout<<"D";
    cout<<"D";
    rep(i, tx-sx+1) cout<<"R";
    rep(i, ty-sy+1) cout<<"U";
    cout<<"L";
    cout<<"U";
    rep(i, tx-sx+1) cout<<"L";
    rep(i, ty-sy+1) cout<<"D";
    cout<<"R"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{

    string s,t;
    cin >> s >> t;
    string ans = "";
    rep(i,t.size())
    {
        ans += t[i];
    }
    rep(i,s.size())
    {
        ans += s[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
	
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		byte divisor;
		byte div8 = 0;
		
		if (n % 2 == 0) {
			n--;
		}
		
		for (; n > 0; n -=2) {
			
			divisor = 0;
		
		
			for (int i = 1; i <= n; i++ ) {
				if (n % i == 0) {
					divisor++;
				}
			}
			
			if (divisor == 8) {
				div8++;
			}
			
		}
		
		System.out.println(div8);
	
	}

}

Measured memory_bytes: 23764
#include<iostream>

using namespace std;

int main()
{
    unsigned long long a,b,n;
    cin >> a >> b >> n;

    /*
    unsigned long long tmp,tmp1,tmp2,ans;
    tmp = n%b;
    tmp1 = a*tmp/b;
    */

    cout << a*min(n,b-1)/b << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>

int main(void){
	int a,b,c,d;
	scanf("%d %d\n",&a,&b);
	scanf("%d %d",&c,&d);

	if(a != c){
		printf("1\n");
	}else{
		printf("0\n");
	}

	return 0;
}

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

void print(std::string s1, std::string s2)
{
	for (int i = 0; i < s1.length(); i++)
	{
		if (s1[i] == s2[i])
			continue;
		if (s1[i] > s2[i])
		{
			std::cout << "GREATER";
			return;
		}
		if (s1[i] < s2[i])
		{
			std::cout << "LESS";
			return;
		}
	}
	std::cout << "EQUAL";
}

int main()
{
	std::string s1, s2;
	std::cin >> s1 >> s2;
	if (s1.length() > s2.length())
		std::cout << "GREATER";
	else if (s1.length() < s2.length())
		std::cout << "LESS";
	else if (s1.length() == s2.length())
		print(s1, s2);
	return 0;
}

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

using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(i,k,h) for(int i = k; i <= h; ++i)
#define INF LONG_LONG_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;

int main(){
    int n;
    cin >> n;
    rep(i,n) {
        int x;
        cin >> x;
        if(x %2 == 0 ) {
            if(x % 3 == 0 || x %5 == 0) {

            } else {
                cout << "DENIED";
                return 0;

            }
        }
    }
    cout << "APPROVED";
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	var r, g, b int
	for i := 0; i < n; i++ {
		if s[i] == 'R' {
			r++
		} else if s[i] == 'G' {
			g++
		} else {
			b++
		}
	}

	ans := r * g * b
	for i := 0; i < n; i++ {
		for j := i+1; j < n; j++ {
			k := 2*j - i
			if k == j || k >= n {
				continue
			}
			if s[i] != s[j] && s[j] != s[k] && s[k] != s[i] {
				ans--
			}
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 1812
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<set>
#include<stdlib.h>
#include<vector>
#include<utility>
#include<stdbool.h>
using namespace std;
typedef long long ll;


int main(void) {
	int N, X,min=10000;
	cin >> N >> X;
	int sum = 0;
	int* m = (int*)malloc(sizeof(int)*N);
	for (int i = 0;i < N;i++) {
		cin >> m[i];
		sum += m[i];
		if (min > m[i])min = m[i];
	}
	cout << N + (X - sum) / min << endl;
	return 0;
}

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

ans,x=0,0
wa,haita=0,0
for j in range(N):
    while x<N and haita^A[x]==wa+A[x]:
        haita^=A[x]
        wa+=A[x]
        x+=1
    ans+=x-j
    haita^=A[j]
    wa-=A[j]
print(ans)

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

#define P pair<char,int>
#define fir first
#define sec second
#define PA pair<int,int>


void f(int n,int l){
    P a[10000]={};
    queue<PA> q;

    for(int i=0;i<n;i++){
        char d;
        int p;
        cin>>d>>p;
        a[i].fir=d;
        a[i].sec=p;
    }
    int sum=0,last=0,time=0,latime=0;
    while(sum<n){
        for(int i=0;i<n;i++){
            if(a[i].fir=='R') a[i].sec++;
            if(a[i].fir=='L') a[i].sec--;
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(a[i].fir=='L'&&a[j].fir=='R'&&
                        a[i].sec==a[j].sec){
                    a[i].fir='R';
                    a[j].fir='L';
                }
            }
        }
        for(int i=0;i<n;i++){
            if(a[i].sec==0||a[i].sec==l){
                sum++;
                if(n==sum&&latime==time&&a[i].sec==l) continue;
                last = i+1;
                latime=time;
            }
        }
        time++;
    }

    cout<<time<<' '<<last<<endl;
}



signed main(){
    int n,l;
    while(1){
        cin>>n>>l;
        if(!n) break;
        f(n,l);
    }
}


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

using namespace std;

const int MAX_N = 2e5 + 10;

int N, A[MAX_N];

bool check(int sigma) {
    static pair<int, int> stk[MAX_N];
    int top = 0;
    for (int i = 1; i <= N; i++) {
        int delta = A[i] - A[i - 1];
        if (delta > 0) {
            stk[++top] = make_pair(1, delta);
        } else {
            while (delta) {
                if (delta + stk[top].second <= 0) {
                    delta += stk[top].second;
                    top--;
                } else {
                    stk[top].second += delta;
                    delta = 0;
                }
            }
            int popped = 0;
            while (top && stk[top].first == sigma) {
                popped += stk[top].second;
                top--;
            }
            if (!top) return false;
            if (stk[top].second != 1) {
                stk[top + 1] = make_pair(stk[top].first, 1);
                stk[top].second--;
                top++;
            }
            stk[top].first++;
            if (popped) {
                stk[++top] = make_pair(1, popped);
            }
        }
    }
    return true;
}

int main() {
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) scanf("%d", &A[i]);
    int l = 1, r = N;
    while (l != r) {
        int m = (l + r) / 2;
        if (check(m)) r = m;
        else l = m + 1;
    }
    printf("%d\n", l);
}


Measured memory_bytes: 2560
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    //int t = 1; cin >> t; while(t--)
    {
        int n, p;
        string s;
        cin >> n >> p >> s;
        
        int a[n] = {};
        for(int i = 0; i < n; i++) {
            a[i] = s[i] - '0';
        }   

        int ans = 0;
        if(p == 2 || p == 5) {
            for(int i = 0; i < n; i++) {
                if(a[i] % p == 0)
                    ans += i + 1;
            }
        }
        else {
            map<int, int> mp;
            mp[0]++;
            int x = 0, y = 1;
            for(int i = n - 1; i >= 0; i--) {
                x = (x + a[i] * y) % p;
                ans += mp[x];
                mp[x]++;
                y = y * 10 % p;
            }
        }
        cout << ans << '\n';
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 2580
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int n,a[100],ans=1e9;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	
	for(int i=0;i<n;i++){
		ans=ans+a[i];
	}
	
	for(int i=0;i<n;i++){
		int l=0,s=0;
		for(int j=0;j<i;j++){
			l+=a[j];
		}
		
		for(int j=i;j<n;j++){
			s+=a[j];
		}
		
		ans=min(ans,abs(l-s));
		
	}
	
	cout<<ans<<endl;
	
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int a[100010] = {};
int main(){
	int i,n,q,k;
	cin >> n >> k >> q;
	for(i=0;i<n;i++){
		a[i] = k-q;
	}
	for(i=0;i<q;i++){
		int x; cin >> x; x--;
		a[x]++;
	}
	for(i=0;i<n;i++){
		if(a[i]>0){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
}

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

int main() {
  int H, W;
  cin >> H >> W;
  string board[60];
  for (int i = 0; i < H; i++) cin >> board[i];

  int dx[4] = {-1, 0, 1, 0};
  int dy[4] = {0, 1, 0, -1};
  
  bool ans = true;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (board[i][j] == '.') continue;
      bool ok = false;
      for (int k = 0; k < 4; k++) {
        int x = i + dx[k];
        int y = j + dy[k];
        if (x < 0 || x > H || y < 0 || y > W) continue;
        if (board[x][y] == '#') ok = true;
      }
      if (!ok) {
        ans = false;
        break;
      }
    }
    if (!ans) break;
  }

  cout << (ans ? "Yes" : "No") << endl;
}

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

using namespace std;

struct State {
  vector<int> S[3];
  int step;
  int parent_from;
  int parent_to;

  bool empty(size_t i) const { return S[i].size() == 0; }
  void push(size_t i, int v) { S[i].push_back(v); }
  void pop(size_t i) { S[i].pop_back(); }
  int top(size_t i) const { return S[i].back(); }
};

bool Done(const State& s, const State& goal) {
  for (int i = 0; i <= 2; ++i) {
    if (s.S[i].size() != goal.S[i].size()) return false;
    if (s.S[i] != goal.S[i])
      return false;
  }
  return true;
}

inline bool IsMovable(int from, int to, const State& p) {
  if (to < 0 || to >= 3) return false;
  if (p.empty(from)) return false;
  if (to == p.parent_from && from == p.parent_to) return false;
  return p.empty(to) || p.top(from) > p.top(to);
}

int BFS(const State& start, const State& goal) {
  queue<State> q;
  q.push(start);

  int step = 0;
  while (!q.empty()) {
    const auto p = q.front();
    q.pop();

    if (Done(p, goal)) {
      step = p.step;
      break;
    }
    for (int from = 0; from < 3; ++from) {
      for (int d : {-1, 1}) {
        const int to = from + d;
        if (IsMovable(from, to, p)) {
          State new_state = p;
          new_state.step = p.step + 1;
          new_state.parent_from = from;
          new_state.parent_to = to;
          new_state.push(to, p.top(from));
          new_state.pop(from);
          q.push(new_state);
        }
      }
    }
  }
  return step;
}

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

  int n, m;
  for (;;) {
    cin >> n >> m;
    if (n == 0 && m == 0) break;

    // 初期状態
    State start;
    start.step = 0;
    start.parent_from = -1;
    start.parent_to = -1;
    for (int i = 0; i < 3; ++i) {
      int t;
      cin >> t;
      int k;
      for (int j = 0; j < t; ++j) {
        cin >> k;
        start.S[i].push_back(k);
      }
    }
    // Cにすべてのコップが重ねられている状態
    State goal;
    goal.step = 0;
    goal.parent_from = -1;
    goal.parent_to = -1;
    for (int i = 1; i <= n; ++i) {
      goal.S[2].push_back(i);
    }

    const int N = pow(3, n) - 1;
    const int step = BFS(goal, start);
    const int ans = min(step, N - step);
    if (ans <= m)
      cout << ans << endl;
    else
      cout << "-1" << endl;
  }
  return 0;
}



Measured memory_bytes: 3240
#include <string>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <math.h>
 
#define MOD 1000000007
 
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
 
	int x,y,z;
	cin >> x >> y >> z;
    if(z ==1){cout << y-x+1;return 0;}
    int p = x/z;
    int q = y/z;
    if(x%z==0){cout << q-p+1;return 0;}
    cout << q - p;
  
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s[0]=='R' && s[1]=='R' && s[2]=='R')
      printf("3\n");
  else if((s[0]=='R' && s[1]=='R') || (s[1]=='R' && s[2]=='R'))
      printf("2\n");
  else if(s[0]=='R' ||s[1]=='R' || s[2]=='R')
      printf("1\n");
    else
        printf("0\n");
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

constexpr int MAX_H = 8;
constexpr int MAX_W = 8;
int H, W;
char a[MAX_H + 1][MAX_W + 1];

void _main() {
  cin >> H >> W;
  rep(i, 0, H) cin >> a[i];

  int cnt = 0;
  rep(i, 0, H) rep(j, 0, W) if (a[i][j] == '#') cnt++;
  if (cnt == H + W - 1) cout << "Possible" << "\n";
  else cout << "Impossible" << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int n,m;cin>>n>>m;
   priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>> > que;
   rep(i,n){
       ll a,b;cin>>a>>b;
       que.push({a,b});
   }
   ll now=m,res=0;
   while(now>0){
       auto p=que.top();que.pop();
       ll a=p.first,b=p.second;
       if(b>now){
           res+=now*a;
           now=0;
           break;
       }else{
           res+=b*a;
           now-=b;
       }
   }
   cout<<res<<endl;
}

Measured memory_bytes: 2420