akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H;
	string s;
	while(cin>>N) {
		VI A(N);
		REP(i, N) cin>>A[i];
		sort(ALL(A));
		string ans = "second";
		REP(i, N) if(A[i]%2) ans="first";
		cout<<ans<<endl;
	}
	
	return 0;
}


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

int main(){
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    for(int j=0;j+i<s.size();j++){
      string t = s;
      t.erase(i,j);
      if(t=="keyence"){
        puts("YES");
        return 0;
      }
    }
  }

  puts("NO");
}

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




    int main(){
        int n;
        std::cin >> n;
        std::vector<int> p(n);
        rep(i, n) std::cin >> p[i];
        int ans = 0;
        for (int i = 1; i < n - 1; ++i)
        {
            if((p[i - 1] < p[i]) && (p[i] < p[i+1])) ans++;
            else if((p[i - 1] > p[i]) && (p[i] > p[i+1])) ans++;

        }
        std::cout << ans << "\n";
        return 0;
        
    }


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n, m;
int main(){
	scanf("%d%d", &n, &m);
	if(m % 1000){
		puts("-1 -1 -1");
		return 0;
	}
	m /= 1000;
	for(int i = 0; i <= n; ++i){
		for(int j = 0; j <= n - i; ++j){
			if(i * 10 + j * 5 + n - i - j == m){
				printf("%d %d %d\n", i, j, n - i - j);
				return 0;
			}
		}
	}
	puts("-1 -1 -1");
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl
template<typename T>
T ncr(T left, T right) {
	right = min(left - right, right);
	T ans = 1;
	for (T i = 1; i <= right; i++) {
		ans = ans * (left - right + i) / i;
	}
	return ans;
}

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;


int main() {
	int A, B;
	cin >> A >> B;
	int n = A < B ? B : A;
	if (A == B) {
		cout << n*2<< endl;
		return 0;
	}
	cout << n + n - 1 << endl;
	return 0;
}



Measured memory_bytes: 256
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    s = ns()
    n = len(s)
    mid = s[:(n - 1) // 2]
    san = s[(n + 3) // 2 - 1:]
    
    if s == s[::-1]:
        if mid == mid[::-1]:
            if san == san[::-1]:
                print("Yes")
                return
    print("No")    


if __name__ == '__main__':
    main()

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

using namespace std;

int main(int argc, char *argv[]) {
	string S;
	cin >> S;

	bool is_ok(false);
	set<char> chars;
	chars.insert(S[0]);
	chars.insert(S[1]);
	chars.insert(S[2]);

	cout << ((chars.size() == 3) ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

// input に使うやつ
var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

// string から int へ
func atoi(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

// 一つの文字を int として読み込み
func readInt() int {
	return atoi(readLine())
}

// 複数の文字を int のスライスとして読み込み
func readInts() []int {
	in := readLine()
	ins := strings.Split(in, " ")
	out := make([]int, len(ins))
	for i, v := range ins {
		out[i] = atoi(v)
	}
	return out
}

// sortしたスライスを返す
func sorted(a []int) []int {
	b := make([]int, len(a))
	copy(b, a)
	sort.Ints(b)
	return b
}

// 逆順のsort
func reverse(a []int) []int {
	b := make([]int, len(a))
	copy(b, a)
	sort.Sort(sort.Reverse(sort.IntSlice(b)))
	return b
}

func main() {
	n := readInts()
	a := float64(n[0])
	b := float64(n[1])

	max := math.Max(a+b, math.Max(a-b, a*b))
	fmt.Println(max)

	// if a+b >= a-b && a+b >= a*b {
	// 	fmt.Println(a +)
	// }
	// if a-b >= a+b && a-b >= a*b {
	// 	fmt.Println(a - b)
	// }
	// if a*b >= a+b && a*b >= a-b {
	// 	fmt.Println(a * b)
	// }
}


Measured memory_bytes: 640
s=input()
ans=['KIHBR']
for i in range(1,16):
  flag=format(i,'b')
  flag='0'*(4-len(flag))+flag
  tmp='A'*int(flag[0])+'KIH'+'A'*int(flag[1])+'B'+'A'*int(flag[2])+'R'+'A'*int(flag[3])
  ans.append(tmp)
if s in ans:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<functional>

using namespace std;

typedef long long ll;

template <class Monoid1, class Monoid2> struct LazySegTree {
	int N;
	vector<Monoid1> node;
	vector<Monoid2> lazy;
	std::function<Monoid1(Monoid1, Monoid1)> operation1;
	std::function<Monoid2(Monoid2, Monoid2)> operation2;
	std::function<Monoid1(Monoid1, Monoid2)> operation3;
	std::function<Monoid2(Monoid2, int)> operation4;
	Monoid1 unit1;//Monoid1の単位元
	Monoid2 unit2;//Monoid2の単位元

	LazySegTree(vector<Monoid1>& data,
		std::function<Monoid1(Monoid1, Monoid1)> op1,
		std::function<Monoid2(Monoid2, Monoid2)> op2,
		std::function<Monoid1(Monoid1, Monoid2)> op3,
		std::function<Monoid2(Monoid2, int)> op4,
		Monoid1 U1, Monoid2 U2) {
		//データ　演算1~4　単位元1~2
		operation1 = op1;
		operation2 = op2;
		operation3 = op3;
		operation4 = op4;
		unit1 = U1;
		unit2 = U2;
		int size = data.size();
		N = 1;
		while (N < size)N <<= 1;
		node.resize(2 * N - 1, unit1);
		lazy.resize(2 * N - 1, unit2);

		for (int i = 0; i < size; i++) {
			node[i + N - 1] = data[i];
		}

		for (int i = N - 2; i >= 0; i--) {
			node[i] = operation1(node[i * 2 + 1], node[i * 2 + 2]);
		}
	}

	//番号kのデータを伝播させる。
	void eval(int k, int l, int r) {
		if (lazy[k] == unit2)return;
		node[k] = operation3(node[k], operation4(lazy[k], r - l));
		if (r - l > 1) {
			//子を持ってる
			lazy[2 * k + 1] = operation2(lazy[2 * k + 1], lazy[k]);
			lazy[2 * k + 2] = operation2(lazy[2 * k + 2], lazy[k]);
		}
		lazy[k] = unit2;
	}

	void update(Monoid2 val, int idx, int a, int b, int l = 0, int r = -1) {
		//[a, b)
		if (r < 0)r = N;
		eval(idx, l, r);
		//範囲外なら何もしない
		if (b <= l || r <= a)return;
		if (a <= l && r <= b) {
			//完全に被覆してるのなら、遅延配列を更新して評価。
			lazy[idx] = operation3(lazy[idx], val);
			eval(idx, l, r);
			return;
		}
		update(val, idx * 2 + 1, a, b, l, (l + r) / 2);
		update(val, idx * 2 + 2, a, b, (l + r) / 2, r);
		node[idx] = operation1(node[idx * 2 + 1], node[idx * 2 + 2]);
	}

	void update(Monoid2 val, int a, int b) {
		//[a, b)
		update(val, 0, a, b, 0, -1);
	}

	Monoid1 getval(int a, int b, int idx, int l, int r = -1) {
		eval(idx, l, r);
		//[a, b)を求める。　使い方はgetval(a, b, );
		if (r == -1)r = N;
		if (b <= l || r <= a)return unit1;
		if (a <= l && r <= b)return node[idx];
		Monoid1 left = getval(a, b, idx * 2 + 1, l, (l + r) / 2);
		Monoid1 right = getval(a, b, idx * 2 + 2, (l + r) / 2, r);
		return operation1(left, right);
	}

	Monoid1 getval(int a, int b) {
		//ラッパー。
		return getval(a, b, 0, 0, -1);
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	
	vector<ll> tmp(n);
	LazySegTree<ll, ll> lst(tmp, 
		plus<ll>(), 
		plus<ll>(),
		plus<ll>(),
		multiplies<ll>(),
		0, 0);

	for (int i = 0; i < q; i++) {
		int a;
		cin >> a;
		if (a == 0) {
			int s, t, x;
			cin >> s >> t >> x;
			s--, t--;
			lst.update(x, s, t + 1);
		}else {
			int s, t;
			cin >> s >> t;
			s--, t--;
			cout << lst.getval(s, t + 1) << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 7876
n = [int(x) for x in input()]


for i in range(8):
    ans = n[0]
    strs = [str(n[0])]
    for j in range(3):
        if (i >> j) & 1:
            ans += n[j + 1]
            strs += '+' + str(n[j + 1])
        else:
            ans -= n[j + 1]
            strs += '-' + str(n[j + 1])
    if ans == 7:
        break
print(''.join(strs) + '=7')


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;

  for(int i=c;i<1000000;i+=60){
    if(i%(a+b)<=a){
      cout<<i<<endl;
      return 0;
    }
  }

  cout<<"-1"<<endl;
}



Measured memory_bytes: 3104
#include<stdio.h>

int Fibo(int);

int b[50];

int main(){
int n,i,a; 

for(i=0;i<50;i++){
b[i]=-1;
}
scanf("%d", &n);
a=Fibo(n);
printf("%d\n",a);

return 0;
}

int Fibo(int n){
if(n==0||n==1){
return 1;
}
if(b[n]!=-1){
return b[n];
}
return b[n]=Fibo(n-1)+Fibo(n-2);
}



Measured memory_bytes: 2112
#include<iostream>
using namespace std;
int main()
{
    int A,B,C,D;
    int a[2]={0};
    cin>>A>>B>>C>>D;
    if(A<B)
    {
        a[0]=A;
    }
    else
        a[0]=B;
    if(C<D)
    {
        a[1]=C;
    }
    else
        a[1]=D;
    cout<<a[0]+a[1]<<endl;
    return 0;
}




Measured memory_bytes: 256
X=int(input())
for B in range(-10**3,10**3):
    if type((X+B**5)**0.2)!=complex:
        if int((X+B**5)**0.2)-0.0001<=(X+B**5)**0.2<=int((X+B**5)**0.2)+0.0001:
            print(int((X+B**5)**0.2), B)
            break

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


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで


using namespace std;
int h,w;
int ban[600][600];
vector<string> s;

signed main(){
  cin >> h >> w;
  FOR(i,h){
    FOR(j,w){
      cin >> ban[i][j];
    }
  }
  FOR(i,h){
    FOR(j,w){
      if(i%2 ==1){
        if(ban[i][j]%2==1){
          if(j!=w){
            s.pb(to_string(i)+" "+to_string(j)+" "+to_string(i)+" "+to_string(j+1));
            ban[i][j+1] ++;
          }
          else if(i<h){
            s.pb(to_string(i)+" "+to_string(j)+" "+to_string(i+1)+" "+to_string(j));
            //cout << i << " " << j << " " << i+1 << " " << j << endl;
            ban[i+1][j] ++;
          }
        }
      }
      else{
        if(ban[i][w-j+1]%2==1){
          if(j!=w){
            s.pb(to_string(i)+" "+to_string(w-j+1)+" "+to_string(i)+" "+to_string(w-j));
            //cout << i << " " << w-j+1 << " " << i << " " << w-j << endl;
            ban[i][w-j] ++;
          }
          else if(i<h){
            s.pb(to_string(i)+" "+to_string(w-j+1)+" "+to_string(i+1)+" "+to_string(w-j+1));
            //cout << i << " " << w-j+1 << " " << i+1 << " " << w-j+1 << endl;
            ban[i+1][w-j+1] ++;
          }
        }
      }
    }
  }
  cout << s.size() << endl;
  REP(i,s.size()){
    cout << s[i] << endl;
  }
  return 0;
}


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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	for(int n,m;cin>>n>>m&&n|m;){
		vvi a(n,vi(m));
		rep(i,n) rep(j,m) cin>>a[i][j],a[i][j]--;

		int res=n;
		vi flg(m);
		for(;count(all(flg),1)<m;){
			vi cnt(m);
			rep(i,n)
				rep(j,m)
					if(!flg[a[i][j]]){
						cnt[a[i][j]]++;
						break;
					}
			int mx=*max_element(all(cnt));
			res=min(res,mx);
			rep(i,m) if(cnt[i]==mx) flg[i]=1;
		}
		
		cout<<res<<endl;
	}
}


Measured memory_bytes: 640
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;

class UnionFind {
public:
	vector<int> par;

	UnionFind(int n) {
		par = vector<int>(n, -1);
	}

	int root(int a) {
		if (par[a] < 0) {
			return a;
		}
		else {
			return par[a] = root(par[a]);
		}
	}

	int size(int a) {
		return -par[root(a)];
	}

	bool connect(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) {
			return false;
		}
		if (size(a) < size(b)) {
			swap(a, b);
		}
		par[a] += par[b];
		par[b] = a;
		return true;
	}

};


int main() {
	int n, m; cin >> n >> m;
	vector<int> a(n);
	rep(i, n) {
		int p; cin >> p;
		p--; a[i] = p;
	}
	UnionFind uni(n);
	rep(i, m) {
		int p1, p2; cin >> p1 >> p2;
		p1--; p2--;
		uni.connect(p1, p2);
	}
	int ans = 0;
	rep(i, n) {
		if (uni.root(i) == uni.root(a[i])) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
a = [int(input()) for i in range(n)]
cnt = d = 0 
while True:
  cnt += 1
  if a[d] == 2:
    print(cnt)
    break
  elif cnt >= 10**5:
    print(-1)
    break
  else:
    d = a[d] - 1

Measured memory_bytes: 7084
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n,q; cin >> n >> q;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> x(q);
  rep(i,q) cin >> x[i];
  rep(i,q){
    ll ans=0;
    ll sum=0;
    for(int j=0,k=0;j<n;j++){
      sum+=a[j];
      while(sum>x[i]){
        sum-=a[k];
        k++;
      }
      ans+=j-k+1;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3564
#include<stdio.h>
#include<string.h>
int main(){
	int a,b,c,d,e,f;
	char x[100];
	x[1]='a';
	x[2]='b';
	x[3]='c';
	x[4]='d';
	x[5]='e';
	x[6]='f';
	x[7]='g';
	x[8]='h';
	x[9]='i';
	x[10]='j';
	x[11]='k';
	x[12]='l';
	x[13]='m';
	x[14]='n';
	x[15]='o';
	x[16]='p';
	x[17]='q';
	x[18]='r';
	x[19]='s';
	x[20]='t';
	x[21]='u';
	x[22]='v';
	x[23]='w';
	x[24]='x';
	x[25]='y';
	x[26]='z';
	scanf("%c",&x[27]);
	for(a=1;a<27;a++)
	{
		if(x[27]==x[a])
		{
			break;
		}
	}
	printf("%c\n",x[a+1]);
	return 0;
}	


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (lld)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;

int main(void) {
  lld n;
  cin >> n;
  lld s = 1;
  bool z = false;
  for (lld i = 0; i < n; i++) {
    lld a, d = s;
    cin >> a;
    if (s != -1) s *= a;
    if (a == 0) {
      z = true;
      s = 0;
      break;
    }
    if (s < d || s > 1000000000000000000) {
      s = -1;
    }
  }
  cout << s << "\n";
}

Measured memory_bytes: 3636
A, B, C, X, Y = map(int, input().split(' '))

a = A * X + B * Y
b = 0
m = min(X, Y)
if m == X:
    b = 2 * C * m + B * (Y-X)
else:
    b = C * 2 * m + A * (X-Y)
c = C * 2 * max(X, Y)
print(min(a, b, c))

Measured memory_bytes: 3064
operand = ["+", "-", "*"]
src = [x if x in operand else int(x) for x in  input().split(" ")]
stack = []

for s in src:
    if isinstance(s, int):
        stack.append(s)
    elif s == "+":
       b, a = stack.pop(), stack.pop()
       stack.append(a+b)

    elif s == "-":
        b, a = stack.pop(), stack.pop()
        stack.append(a-b)
    elif s == "*":
        b, a = stack.pop(), stack.pop()
        stack.append(a*b)

print(stack[0])

Measured memory_bytes: 7752
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

void remove_minmax(vector<int> &data){
  int max = 0;
  int min = 1000000;
  int min_i = 0;
  int max_i = 0;
  int count = 0;
  vector<int>::iterator it = data.begin();
  while (it != data.end()){
    if (*it < min){
      min = *it;
      min_i = count;
    }
    if (*it > max){
      max = *it;
      max_i = count;
    }
    ++count;
    ++it;
  }
  data[max_i] = 0;
  data[min_i] = 0;
}

int main(void){
  int n;
  while (cin >> n){
    if (n == 0){
      return 0;
    }
    
    vector<int> data;
    
    for (int i=0; i<n; ++i){
      int num;
      cin >> num;
      data.push_back(num);
    }
    remove_minmax(data);

    int total = floor((double)accumulate(data.begin(), data.end(), 0)/(n-2));
    cout << total << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const long long INF = 1LL << 60;
const ll C = 1000000000+7;

int main() {
    int N, total;
    cin >> N;
    vector<ll> A(N), B(N);
    for(int i=0; i<N; i++) cin >> A[i], B[i] = A[i] - i - 1;

    //medium(中央値を取る)
    sort(B.begin(), B.end());
    ll x = B[N/2];

    ll res = 0;
    for(int i=0; i<N; i++) {
        res += abs(x - B[i]); // |A| = max(A, -A)
    }
    cout << res << endl;
}

Measured memory_bytes: 6336
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

R, G, B = input().split()
if int(R + G + B) % 4 == 0:
    ans = 'YES'
else:
    ans = 'NO'
print(ans)



Measured memory_bytes: 5460
#include<stdio.h>
int main(void){
    int n,x;
    int i,j,k;
    int sum;
    int cnt;
    while(1){
        sum=0;
        cnt=0;
        scanf("%d %d",&n,&x);
        if(n==0 && x==0)
            break;
        for(i=1;i<=n;i++)
            for(j=i+1;j<=n;j++)
                    for(k=j+1;k<=n;k++){
                            sum=i+j+k;
                            if(sum==x)
                                cnt++;
                        }
        printf("%d\n",cnt);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
    ll n, m;
    while(cin>>n>>m){
        ll ans=1, i=2;
        while(n>1 && i*i<=n){
            if(n%i==0&&m%i==0){
                ++ans;
            }
            while(n%i==0){
                n/=i;
            }
            ++i;
        }
        if(m%n==0 && n>1){
            ++ans;
        }
        cout<<ans<<endl;
    }
  return 0;
}




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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		int a,b,sum=1,cnt=0;

		Scanner sc = new Scanner(System.in);

		a = sc.nextInt();

		b = sc.nextInt();

		while(sum<b) {
			sum+=(a-1);
			cnt++;
		}

		System.out.println(cnt);
	}

}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#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 repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    vi m(n);
    rep(i, n-1) {
        int a;
        cin >> a;
        --a;
        m[a]++;
    }
    rep(i, n) cout << m[i] << endl;
    return 0;
}


Measured memory_bytes: 4048
#include <stdio.h>
#define ll long long int
#include <queue>
#include <vector>
#include <iostream>
using namespace std;

int main(){
 ll n[200];
 ll t[200];
priority_queue<ll>q;
ll total,x,s,y,diff,sum,atur;
sum=0;
cin>>total;

for(ll i=0;i<2*total;i++){
  cin>>x;
  q.push(x);
}
while(q.size()){
s=q.top();
q.pop();
y=q.top();
q.pop();

  if(s>y){

sum+=y;
  }else if(s<y){

sum+=s;
  }else if(s==y){
    sum+=s;
  }

}

cout<<sum;


}

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

typedef long long ll;

int main(){
  string s;
  cin >> s;
  int count = 0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='1'){
      count++;
    }
  }
  printf("%d\n",count);  
  return 0;
}

Measured memory_bytes: 256
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}

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

  ll A, B;
  cin >> A >> B;
  ll ans = A * B / gcd(A, B);
  out(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repr(i, a, b) for (int i = (int)a; i > (int)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 4e18 + 5;
const char ENDL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    map<int, int> idx;
    vii p(n);
    rep(i, n){ 
        cin >> p[i];
        idx[p[i]] = i;
    }
    multiset<int> big;
    big.insert(-1);
    ll ans = 0;
    repr(i,n,0){
        big.insert(idx[i]);
        if (i==n)
            continue;
        int a, b, c, d,x;
        auto itr = big.lower_bound(idx[i]);
        x = *itr;
        auto ittr = itr;
        ittr++;
        if (ittr==big.end()){
            c = d = n - 1;
        }
        else{
            c = *ittr -1;
            ittr++;
            if (ittr==big.end())
                d = n - 1;
            else
                d = *ittr -1;
        }
        ittr = itr;
        ittr--;
        if (ittr==big.begin()){
            a = b = 0;
        }
        else{
            b = *ittr +1;
            ittr--;
            if(ittr==big.begin())
                a = 0;
            else
                a = *ittr +1;
        }
        ans += 1ll* i * (b - a) * (c - x + 1) + 1ll * i * (x - b + 1) * (d - c);
    }
    cout << ans << ENDL;
}

Measured memory_bytes: 9984
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

x = int(input())
for i in range(x, x + 10 ** 5):
    if is_prime(i):
        print(i)
        exit()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  k--;
  string s;
  cin >> s;
  s.at(k) = tolower(s.at(k));
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3604
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int N, a[100000]; cin >> N;
  int diff, sum = 0;
  REP(i, N){
    cin >> a[i];
    sum += a[i];
  }
  if(sum % ((N*(N+1))/2) != 0){
    cout << "NO" << endl;
    return 0;
  }
  int times = sum / ((N*(N+1))/2);
  int cnt = 0;
  REP(i, N){
    if(i == N-1) diff = a[0]-a[i];
    else diff = a[i+1] - a[i];
    if(times-diff < 0 or (times-diff)%N != 0){
      cout << "NO" << endl;
      return 0;
    }
    cnt += (times-diff) / N;
  }
  if(cnt != times) cout << "NO" << endl;
  else cout << "YES" << endl;

  return 0;
}

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

using namespace std;

#define debug(x) cout << '[' << #x << " is: " << x << "] " << '\n';
#define imod(a , n) (a % n + n ) % n

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define inF freopen("milkvisits.in","r",stdin );
#define outF freopen("milkvisits.out" , "w" , stdout ) ;
#define sor(v) sort(v.begin() , v.end());
#define print(v) for(auto f : v ) cout << f << " " ;
#define rsor(v) sort(v.rbegin() , v.rend());
#define rev(v) reverse(v.begin() , v.end());
#define lp(i , n) for(int x = i ; x < n ; x ++)
#define ll long long
#define read(arr , x , n) for(int i = x ; i < n ; i ++ )cin >> arr[i];
const double eps = 1e-6 , PI = acos(-1) ;
const long long OO = 1e18 ;
const ll N = 22  , oo = 1e9 + 1  , M = 2000002, mod = 1e9 + 7 , K = 12;


//                                                +_+
int32_t main(){
    // inF;outF;
    fastio;
    // Dont Forget memset
   string s ,t ;
   cin >> s >> t ;

   int mn = oo ;

   for(int i = 0 ; i <= (s.size() - t.size()) ; i ++){
        int cnt = 0 ;
        for(int j = 0 ; j < t.size() ; j ++)
            cnt += (s[i + j] != t[j]);

        mn = min(mn , cnt);


   }
   cout << mn ;

}


Measured memory_bytes: 3644
package main

import (
  "fmt"
)

func main() {
  solve()
}

func solve() {
  var s string
  m := make(map[rune]int)
  fmt.Scan(&s)
  for _, v := range s {
    m[v]++
  }
 
  for _, v := range m {
    if v % 2 != 0 {
      fmt.Println("No")
      return
    }
  }
  fmt.Println("Yes")
}

Measured memory_bytes: 512
//
// Created by munaiyi on 2020/3/27.
//
#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;

int two[maxn];
int inv2 = (mod + 1) / 2;
int n;
int h[maxn], mem;
int siz[maxn];
struct {
    int v;
    int next;
} e[maxn << 1];

void add(int u, int v) {
    e[mem].v = v;
    e[mem].next = h[u];
    h[u] = mem++;
}

void dfs_size(int u, int fa) {
    siz[u] = 1;
    for (int i = h[u]; i + 1; i = e[i].next) {
        int v = e[i].v;
        if (v == fa) continue;
        dfs_size(v, u);
        siz[u] += siz[v];
    }
}

void dfs_ans(int u, int fa, long long &ans) {
    long long tans = two[n - 1] - 1;
    for (int i = h[u]; i + 1; i = e[i].next) {
        int v = e[i].v;
        tans ++;
        if (v == fa) {
            tans -= two[n - siz[u]];
        } else {
            tans -= two[siz[v] ];
            dfs_ans(v, u, ans);
        }
    }
    ans = (ans + tans) % mod;
}

long long fast(long long num, int ci) {
    long long ans = 1;
    while (ci) {
        if (ci & 1) ans = ans * num % mod;
        num = num * num % mod;
        ci = ci >> 1;
    }
    return ans;
}

int main() {
    two[0] = 1;
    for (int i = 1; i < maxn; i++) {
        two[i] = two[i - 1] << 1;
        if (two[i] >= mod) two[i] -= mod;
    }
    scanf("%d", &n);
    mem = 0;
    memset(h, -1, sizeof(h));
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        add(x, y);
        add(y, x);
    }
    dfs_size(1, 1);
    long long ans = 0;
    dfs_ans(1, 1, ans);
    ans = ans * fast(inv2, n) % mod;
    ans = (ans + mod) % mod;
    printf("%lld\n", ans);
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio( false );

	int N, D, X;
	cin >> N >> D >> X;

	vector<int> A( N );
	for( auto& v: A ) { cin >> v; }

	int result = X;
	for( int i = 0; i < N; ++i ) {
		result += (D + A[i]-1) / A[i];
	}

	cout << result << endl;
	return 0;
}


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

int main(int argc, const char * argv[]) {
    int ans = 0;
    for (int i = 0; i < 5; i++) {
        int tmp;
        cin >> tmp;
        if (tmp == 0) {
            ans = i + 1;
            break;
        }
    }
    
    std::cout << ans;
    return 0;
}


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

int main() {
  string s;
  cin >> s;

  int n = (int)s.size();
  vector<vector<int>> a(26);
  for (int i = 0; i < n; i++) {
    a[s[i] - 'a'].push_back(i + 1);
  }

  int l = 0, r = 0;
  for (int i = 0; i < 26; i++) {
    int m = (int)a[i].size();
    if(m <= 1) continue;
    for (int j = 1; j < m; j++) {
      if(a[i][j] - a[i][j - 1] <= 2) {
        l = a[i][j - 1];
        r = a[i][j];
      }
    }
    if(l != 0) break;
  }
  if(l == 0) cout << -1 << " " << -1 << '\n';
  else cout << l << " " << r << '\n';
}

Measured memory_bytes: 1148
n = int(input())
a = list()
for i in range(n):
  x, y = input().split()
  y = int(y)
  if x == "S":
    a.append(y + 0)
  elif x =="H":
    a.append(y + 13)
  elif x == "C":
    a.append(y + 26)
  else:
    a.append(y + 39)

for i in range(1,53):
  if not (i in a):
    if i <= 13:
      print("S", i - 0)
    elif i <= 26:
      print("H", i - 13)
    elif i <= 39:
      print("C", i - 26)
    elif i <= 52:
      print("D", i - 39)





Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  string S;
  cin >> S;
  cout << S.substr(0, 3) << endl;
  return 0;
}

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

int w, h, n, x, y, d, mw, mh;
int main() {
	int i;
	cin >> w >> h >> n;
	while(n--) {
		scanf("%d%d%d", &x, &y, &d);
		if(d==1) mw = max(mw, x);
		if(d==2) w = min(w, x);
		if(d==3) mh = max(mh, y);
		if(d==4) h = min(h, y);
	}
	if(mw>w || mh>h) cout << 0;
	else cout << (w-mw)*(h-mh);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	int n, m; cin >> n >> m;
	int total = 0;
	vector<int>v(n);
	for (int i = 0; i < n; i++){
		cin >> v[i];
		total += v[i];
	}
	int c = 0;
  	int x = m * 4;
  	int comp = (total + x - 1) / x;
	for (int i = 0; i < n; i++)
	{
		if (v[i] >= comp)
			c += 1;
	}
 
	if (c >= m)
		cout << "Yes";
	else
		cout << "No";
 
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int N, K;
    string S;
    cin >> N >> S >> K;
    char c = S[K-1];
    rep(i, N) {
        if (S[i] != c) cout << '*';
        else cout << S[i];
    }
    cout << endl;
    return 0;
}

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

const int MAX_N = (int)205;
const int INF = (int)1e7;
int H, W;
int cost[10][10];
int A[MAX_N][MAX_N];
int d[10][10];

struct edge { int from, to, cost; };
int V = 10;
int E = 100;

edge es[105];

void shortest_path(int s) {
  d[s][s] = 0;
  while (true) {
    bool update = false;
    for (int i = 0; i < E; ++i) {
      edge e = es[i];
      if (d[s][e.from] != INF && d[s][e.to] > d[s][e.from] + e.cost) {
        d[s][e.to] = d[s][e.from] + e.cost;
        update = true;
      }
    }
    if (!update) break;
  }
}

int main(void) {
    // Here your code !
    int tmp;
    scanf("%d %d", &H, &W);
    for (int i = 0; i < 10; ++i) {
      for (int j = 0; j < 10; ++j) {
        scanf("%d ", &tmp);
        es[i * 10 + j].from = (int)i;
        es[i * 10 + j].to = (int)j;
        es[i * 10 + j].cost = (int)tmp;
        d[i][j] = INF;
      }
    }
    for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
        scanf("%d", &A[i][j]);
      }
    }

    for (int i = 0; i < 10; ++i) {
      shortest_path(i);
    }

    int ans = 0;
    for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
        if (A[i][j] != -1 && A[i][j] != 1) {
          ans += d[A[i][j]][1];
        }
      }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int S[20];
int A[200];
int n;


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-S[i]);
    return res;
}

int main(){
    int q,x;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&S[i]);
    }
    scanf("%d",&q);
    for(int i=0;i<q;i++){
        scanf("%d",&A[i]);
        x=solve(0,A[i]);
    if(x==1) printf("yes\n");
    if(x==0) printf("no\n");
    }
    return 0;
}


Measured memory_bytes: 2108
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)
{
	if (a < b)
		swap(&a, &b);

	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}

int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}

int main()
{
	int N;
	int M;
	int a[100000];
	int ans = 0;

	scanf("%d%d",&N,&M);

	if (N == M)
		printf("Yes\n");
	else
		printf("No\n");
	//printf("%d\n",ans);
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int R; cin >> R;
    cout << R*R << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
s1, s2 = gets.scan(/.{1,#{2}}/).map(&:to_i)
if (s1<=12 && 0<s1)
  puts (s2<=12 && 0<s2) ? "AMBIGUOUS" : "MMYY"
else
  puts (s2<=12 && 0<s2) ? "YYMM" : "NA"
end

Measured memory_bytes: 1788
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
var q=arr.shift()-0;
var str="";
var  set = new Set();
for(var i=0;i<q;i++){
   var [a,b]=arr[i].split(" ");
   if(a=="0"){
      set.add(b);
      str+=set.size+"\n";
   }else {
      str+=((set.has(b))?1:0)+"\n";
   }
}
console.log(str.trim());


Measured memory_bytes: 91076
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)   (x).begin(),(x).end()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define mp       make_pair
#define eb       emplace_back
typedef pair<LL, double> P;
typedef pair<P, P> PP;
 
struct edge { int to; double cost; };
 
#define int LL
 
int x[1010], y[1010], r[1010];
 
double d[100100]; //距離
vector<edge> vec[100100];
 
void dijkstra() {
	for (int i = 0; i < 1100; i++)d[i] = DINF;
	priority_queue<P, std::vector<P>, std::greater<P>> pq;
	d[0] = 0;
	pq.push(make_pair(d[0], 0));//cost,to
	while (!pq.empty()) {
		P p = pq.top();
		pq.pop();
		int i = p.second;
		if (d[i] < p.first)continue;
		for (int k = 0; k < vec[i].size(); k++) {
			edge e = vec[i][k];
			if (d[e.to] <= d[i] + e.cost)continue;
			d[e.to] = d[i] + e.cost;
			pq.push(make_pair(d[e.to], e.to));
		}
	}
	
}
 
signed main() {
	int n;
	cin >> x[0] >> y[0] >> x[1000 + 1] >> y[1000 + 1];
	cin >> n;
	x[n + 1] = x[1001], y[n + 1] = y[1001];
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i] >> r[i];
	}
	for (int i = 0; i <= n+1; i++) {
		for (int j = 0; j <= n + 1;j++) {
			if (i == j)continue;
			double num = sqrt(abs(x[i] - x[j])*abs(x[i] - x[j]) + abs(y[i] - y[j])*abs(y[i] - y[j]));
			vec[i].emplace_back(edge{ j,max(0.0,num - r[i] - r[j]) });
		}
	}
	dijkstra();
	cout <<fixed<<setprecision(20)<< d[n + 1] << endl;
	//cout << dijkstra() << endl;
	//system("pause");
 
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    while(a!=-1||b!=-1||c!=-1){
        char grade;
        if(a+b>=80)grade='A';
        if(a+b>=65&&a+b<80)grade='B';
        if(a+b>=50&&a+b<65)grade='C';
        if(a+b>=30&&a+b<50){
            if(c>=50)grade='C';
            else grade='D';
        }
        if(a+b<30)grade='F';
        if(a==-1||b==-1)grade='F';
        cout<<grade<<endl;
        cin>>a>>b>>c;
    }
    return 0;
}


Measured memory_bytes: 3088
import java.util.*;
import java.util.Arrays;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int ans = 0;

        ans = (N < K)? N * X : K * X + (N - K) * Y;

        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
n, x, y = map(int, input().split())
li = [0] * (n - 1)
num = 0

for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        num = min(j-i, abs(i-x)+abs(j-y)+1)
        li[num - 1] += 1

for i in li:
    print(i)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  string S;
  cin>>S;
  
  if(S=="Sunny")
  {
   cout<<"Cloudy"<<endl;
  }
  else if(S=="Cloudy")
  {
   cout<<"Rainy"<<endl;
  }
  else if(S=="Rainy")
  {
   cout<<"Sunny"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int a;
  cin>>a;
  if(a/100==1)
    cout<<"9";
  else
    cout<<"1";
  a=a-a/100*100;
  if(a/10==1)
    cout<<"9";
  else
    cout<<"1";
  if(a%10==1)
    cout<<"9";
  else
    cout<<"1";
  cout<<endl;
  return(0);
}
    


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

int main() {
	ll n;
	cin >> n;
	for (ll i = 0; i < n; ++i) {
		ll a;
		cin >> a;
		if (a % 2 == 0) {
			if (a % 3 != 0 && a % 5 != 0) {
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    string A,B,C;
    cin >> A >> B >> C;
    
    cout << A[0] << B[1] << C[2] << endl;

    return 0;
}



Measured memory_bytes: 256