akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int n;
    int w[1011];
    int min = 1000010;
    int left = 0, right = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }

    for (int i = 0; i < n; i++) {
        left = right = 0;
        for (int j = 0; j <= i; j++) {
            left += w[j];
        }
        for (int k = i+1; k < n; k++) {
            right += w[k];
        }
        if (min > abs(right - left)) {
            min = abs(right -left);
        }
    }

    cout << min << endl;
}


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

int main (void) {
    int n;
    scanf("%d", &n);
    long int a[n + 1];

    if (n == 1 || n == 2) {
        printf("0\n");
    } else {
        a[0] = 1;
        a[1] = 0;
        a[2] = 0;
        for (int i = 3; i <= n; i++) {
            a[i] = a[i - 1] + a[i - 3];
            if (a[i] >= 1000000007) {
                a[i] %= 1000000007;
            }
        }
        printf("%ld\n", a[n]);
    }
    return 0;
}

Measured memory_bytes: 1708
n, x, y = map(int, input().split())
ans = [0]*n

for i in range(1, n):
    for j in range(i + 1, n + 1):
        diff1 = j - i
        diff2 = x + y - i - j + 1
        if i <= x and j >= y:
            diff2 = x - y - i + j + 1
        elif x <= i <= y and x <= j <= y:
            diff2 = -x + y + i - j + 1
        elif x < i < y and j > y:
            diff2 = -x - y + i + j + 1
        if diff2 < 1:
            diff2 = diff1
        diff = min(diff1, diff2)
        ans[diff] = ans[diff] + 1

for i in range(1, n):
    print(ans[i])

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

int A, B;

int main() {
  cin >> A >> B;
  vector<int> ans(0);

  for (int s = 0; s < 10000; s++) {
    double tax_A = s * 0.08;
    double tax_B = s * 0.1;
    if (A <= tax_A && tax_A < A+1 && B <= tax_B && tax_B < B+1) {
      ans.push_back(s);
    }
  }
  if (ans.empty()) {
    cout << "-1" << endl;
  }
  else {
    sort(ans.begin(), ans.end());
    cout << ans[0] << endl;
  }
}


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

int main(){
	string S; cin >> S;
	stack<char> cube;
	int cnt = 0;

	for(int i = 0; i < S.size(); ++i){
		if(!cube.empty() && S[i]-cube.top() != 0){
			cnt++;
			cube.pop();
		}else{
			cube.push(S[i]);
		}
	}

	cout << cnt * 2 << endl;
}


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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define LL long long
#define SZ(X) X.size()
#define pii pair<int,int>
#define ALL(X) X.begin(),X.end()

using namespace std;

LL gcd(LL a, LL b) {return b ? gcd(b, a % b) : a;}
LL lcm(LL a, LL b) {return a / gcd(a, b) * b;}
LL powmod(LL a, LL b, LL MOD) {LL ans = 1; while (b) {if (b % 2)ans = ans * a % MOD; a = a * a % MOD; b /= 2;} return ans;}
const int N = 2e5 + 11;
int n, d, a;
struct uzi {
  int x, h;
  bool operator <(const uzi &t)const {
    return x < t.x;
  }
} p[N];
LL t[N];
void add(int p, LL d) {
  for (; p < N; p += p & -p)t[p] += d;
}
LL ge(int p) {
  LL res = 0;
  for (; p; p -= p & -p)res += t[p];
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> d >> a;
  for (int i = 1; i <= n; i++)cin >> p[i].x >> p[i].h;// f[i] = 1e18;
  sort(p + 1, p + 1 + n);
  auto get = [&](int po) {
    int l = 1, r = po, res = po;
    while (l <= r) {
      int mid = l + r >> 1;
      if (p[po].x - p[mid].x <= 2 * d)res = mid, r = mid - 1;
      else l = mid + 1;
    }
    return res;
  };
  LL ans = 0;
  for (int i = n; i >= 1; i--) {
    int pos = get(i);
    LL now = p[i].h + ge(i);
    if (now <= 0)continue;
    int cnt = now / a + (now % a ? 1 : 0);
    ans += cnt;
    add(pos, -1ll * cnt * a);
  }
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 3328
n, m = map(int, input().split())
info = [tuple(map(int, input().split())) for _ in range(m)]
# print(info)
num = [-1] * n
answer = ''
ok = True
for si, ci in info:
    # print(si, ci)
    if num[si-1] == -1:
        num[si-1] = ci
    if num[si-1] != ci:
        ok = False
    if num[0] == 0 and n != 1:
        ok = False


if ok:
    for i in range(n):
        if num[i] == -1:
            if i == 0:
                if n == 1:
                    answer += '0'
                else:
                    answer += '1'
            else:
                answer += '0'
        else:
            answer += str(num[i])
    print(answer)
else:
    print(-1)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {

		try(Scanner scan = new Scanner(System.in)){

			int h = scan.nextInt();
			int w = scan.nextInt();

			int[][] arrays = new int[h][w];

			for(int i=0; i<h; i++) {
				for(int j=0; j<w; j++) {
					arrays[i][j] = scan.nextInt();
				}
			}

			int min = Integer.MAX_VALUE;

			for(int i=0; i<h; i++) {
				for(int j=0; j<w; j++) {

					int sum = 0;

					for(int k=0; k<h; k++) {
						for(int l=0; l<w; l++) {

							sum += Math.min(Math.abs(i-k), Math.abs(j-l)) * arrays[k][l];

						}
					}

					min = Math.min(min, sum);
				}
			}
			System.out.println(min);
		}
	}
}



Measured memory_bytes: 29772
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
	map<string,int>m;
	string s,t,u;
	int a,b=0;
	for(;cin>>s;){
		if(s.length()>u.length())u=s;
		a=++m[s];
		if(a>b){b=a;t=s;}
	}
	cout<<t<<" "<<u<<endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using namespace std;

int main(){

    int H,W;
    cin >> H >> W;

    string S[H+2];
    string s0(W+2,'0');
    for(int i = 0; i < H+2; i++){
        if(i == 0 or i == H+1){
            S[i] = s0;
        }else{
            cin >> S[i];
            S[i] = '0' + S[i] + '0';
        }
    }

    string resultS[H];

    int count = 0;
    for(int i = 1; i<H+1; i++){
        for(int j = 1; j < W+1; j++){
            //printf("unko!\n");
            if(S[i][j] == '#'){
                //printf("bomb!\n");
                resultS[i-1] += '#';
                continue;
            }
            count = 0;
            for(int m = i-1; m <= i+1; m++){
                for(int n = j-1; n <= j+1; n++){
                    //printf("m : %d, n : %d\n", m ,n);
                    if(S[m][n] == '#'){
                        count++;
                        //printf("find a bomb : %d", count);
                    }
                }
            }
            string s = to_string(count);
            //resultS[i-1].push_back('o'); // ok charはpush_backが使える
            //resultS[i-1].push_back(s); // ng stringはダメ
            resultS[i-1] += s; // +=演算子ならok
        }
    }
    for (int i = 0; i < H; i ++){
        cout << resultS[i] << endl;
    }


    return 0;
}


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    string s;
    cin>>n>>s;
    vector<int> v[3];
    for(int i=0;i<3;++i)v[i].resize(4005);
    for(int i=0;i<n;++i){
        for(int j=0;j<3;++j)v[j][i+1] = v[j][i];
        if(s[i] == 'R')v[0][i+1]++;
        if(s[i] == 'G')v[2][i+1]++;
        if(s[i] == 'B')v[1][i+1]++;
    }
    ll sum = 0;
    for(int i=1;i<n-1;++i){
        for(int j=0;j<i;++j){
            if(s[i] == s[j])continue;
            int para = 0;
            if(s[i] == 'R' and s[j] == 'G')para = v[1][n] - v[1][i];
            if(s[i] == 'R' and s[j] == 'B')para = v[2][n] - v[2][i];
            if(s[i] == 'G' and s[j] == 'R')para = v[1][n] - v[1][i];
            if(s[i] == 'G' and s[j] == 'B')para = v[0][n] - v[0][i];
            if(s[i] == 'B' and s[j] == 'R')para = v[2][n] - v[2][i];
            if(s[i] == 'B' and s[j] == 'G')para = v[0][n] - v[0][i];
            if(2*i-j <n and s[j] != s[2*i-j] and s[i] != s[2*i-j])para--;
            sum += para;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string s;cin>>s;
	for(int i = 0; i < 3; i++) {
		if(s[i] == '7'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int mod=1e9+7;
typedef pair<int,int> P;
void add(ll &a,ll b){
    a+=b;
    if(a>=mod)a-=mod;
}
ll dp[1004][1004];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;cin>>h>>w;
    vector<vector<char>> a(h,vector<char>(w));
    rep(i,h)rep(j,w)dp[i][j]=0;
    dp[0][0]=1;
    rep(i,h)rep(j,w)cin>>a[i][j];
    rep(i,h)rep(j,w){
        if(i+1<h&&a[i+1][j]=='.')add(dp[i+1][j],dp[i][j]);
        if(j+1<w&&a[i][j+1]=='.')add(dp[i][j+1],dp[i][j]);
    }
    cout<<dp[h-1][w-1]<<endl;
    return 0;
}


Measured memory_bytes: 9088
#include <iostream>
using namespace std;
const int maxn=1e5+5;
int dp[maxn];
int h[maxn];
int path[maxn];
int main()
{
   int n;
   cin>>n;
   for(int i=1;i<=n;++i){
       cin>>h[i];
   }
   dp[1]=0;
   dp[2]=abs(h[1]-h[2]);
   for(int i=3;i<=n;++i){
       if(dp[i-1]+abs(h[i]-h[i-1])>dp[i-2]+abs(h[i]-h[i-2])){
           dp[i]=dp[i-2]+abs(h[i]-h[i-2]);
       }
       else{
           dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
       }
   }
   cout<<dp[n]<<endl;
   return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=double;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vpll=vector<pll>;
using vvll=vector<vll>;
#define FOR(i,a,b) for(ll i=a;i<(ll)b;++i)
#define ROF(i,a,b) for(ll i=a;i>=(ll)b;--i)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define aa first
#define bb second
#define PB push_back
#define EQ(a,b) (fabs(a-b)<=(fabs(a+b)*EPS))

int main(){
  ios::sync_with_stdio(0);cout.tie(0);cin.tie(0);
  vector<ll> a(3);
  F(3) cin >> a[i];
  sort(a.begin(), a.end());
  ll res = numeric_limits<ll>::max();
  do {
    res = min(res, abs(a[0] - a[1]) + abs(a[1] - a[2]));
  } while (next_permutation(a.begin(), a.end()));
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
/*input
1 2 3
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  100005
#define DEC(N)	cout << std::fixed; cout << setprecision(N);
void solve()
{
	lld a,b,c;
	cin >> a >> b >> c;
	cout << c << ' ' << a << ' ' << b << endl; 
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    string s;
    cin >> s;
    if(s=="Sunny"){
        cout<<"Cloudy"<<endl;
    }else if(s=="Cloudy"){
        cout<<"Rainy"<<endl;
    }else{
        cout<<"Sunny"<<endl;
    }
}

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

using namespace std;
int X,N;
int A[2000010]{};
bool B[2000010]{};

int main()
{
  cin>>N;
  for(int i=0;i<N;i++)cin>>A[i];
  int count=0;
  for(int i=0;count<N;){
  	i=A[i]-1;
    count++;
    if(i==1){
      cout<<count;
      return 0;
    }
  }

  cout<<-1;
  return 0;
}





Measured memory_bytes: 4008
#include<stdio.h>
#include<math.h>
#define N 10000
main(){
  int n,i,k,j,a[N],sosu=0,yakusu;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  
  for(j = 0;j < n;j++){
    yakusu=0;
    if(a[j]==2)sosu++;
    if(a[j]%2==0)continue;
    else {
      for(k=3;k<=sqrt(a[j]);k+=2){
	if(a[j] % k ==0) yakusu++;
      }
      if(yakusu == 0) sosu++;
    }
  }
  printf("%d\n",sosu);
  return 0;
}

Measured memory_bytes: 628
Imports System
Module Module1

    Sub Main()

        Dim temp() As String = Split(Console.ReadLine)
        Dim n As Integer = temp(0)
        Dim a As Integer = temp(1)
        Dim b As Integer = temp(2)

        Dim max As Integer
        If a >= b Then
            max = b
        Else
            max = a
        End If
        Dim min As Integer
        If a + b >= n Then
            min = a + b - n
        Else
            min = 0
        End If

        Console.WriteLine(max & " " & min)

    End Sub

End Module


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

int a[5], ans, temp;

int main()
{
	scanf("%d%d%d", &a[1], &a[2], &a[3]);
	sort(a+1, a+4);
	temp=a[3]-a[2];
	a[1]+=temp; a[2]+=temp;
	ans+=temp;
	if((a[2]-a[1])%2==0) ans+=(a[2]-a[1])/2;
	else ans+=(a[2]-a[1])/2+2;
	printf("%d\n", ans); 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    VI a(n+1);

    REP1(i,1,n) {
        for ( int j=i; j<=n; j+=i ) {
            a[j]++;
        }
    }
    LL ans=0;
    REP1(i,1,n) {
        ans+=(LL)i*a[i];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 42248
#include <stdio.h>

#define Pay(m) if (money >= m && (money -= m)) continue

int main(void)
{
	int i, money;

	while (scanf("%d", &money), money){
		money = 1000 - money;
		for (i = 0; money; i++){
			Pay(500);
			Pay(100);
			Pay(50);
			Pay(10);
			Pay(5);
			Pay(1);
		}
		printf("%d\n", i);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define do(x) for(int i = 1; i <= x; i++){ solve(); }
#define sz(x) (int)x.size()
#define pii pair < int, int >
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const ll MAXN = 1e18;
const ll SIZE = 1e5+2; //are u sure?
const ll mod = 1e9+7;
ll line[3][SIZE];

void solve(){
	set<int> st;
	st.insert(1);
	st.insert(2);
	st.insert(3);
	int a, b; cin >> a >> b;
	st.erase(st.find(a));
	st.erase(st.find(b));
	cout << *st.begin() << endl;
}


int main(){
	speedhack()
	// int it; cin >> it;
	int it = 1;
	do(it);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
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; }
 
// 累乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
 
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
 
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }
 
    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
 
    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }
 
    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};









int main(){
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  K--;
  print(a[K]);
  return 0;

}


Measured memory_bytes: 256
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            String strSplit[] = br.readLine().split(" ");
            int N = Integer.parseInt(strSplit[0]);
            int X = Integer.parseInt(strSplit[1]);
            int T = Integer.parseInt(strSplit[2]);
            
            int count = 0;
            while(true){
                N = N - X;
                count++;
                if(N <= 0){
                    break;
                }
            }
            
            System.out.println(T*count);
            
        }catch(Exception e){
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 32648
N=input()
alp="BDRFHIJKLMNOPQRSUVWXYZ"
cnt=[]

for i in range(0,len(N)):
    for j in range(i,len(N)+1):
        tmp=N[i:j]
        flg=1
        for a in alp:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void C_task();

int main()
{
	C_task();
	fflush(stdout);
	return 0;
}

static void C_task()
{
	int N;
	get1int(N);

	auto value = new double[N + 1];
	for (int i = 0; i < N; i++) {
		scanf(" %lf", &value[i]);
	}
	
	std::sort(value, value + N);

	for (int i = 0; i < N - 1; i++) {
		value[i + 1] = (value[i] + value[i + 1]) / 2.0;
	}
	
	printf("%.6lf", value[N - 1]);

	delete[] value;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
using std::swap;

// priceをキーに降順でソート
//sort(fruits.begin(), fruits.end(),
//     [](const fruit& x, const fruit& y) { return x.price > y.price;});

/*
int main() {
    int x, y;
    std::cin >> x >> y;
    if (x<10 && y<10){
        std::cout << x*y << std::endl;
    }
    else{
        std::cout << -1 << std::endl;
    }
    return 0;
}
 */

int main() {
    int N;
    std::cin >> N;
    for(int i=1; i<10; i++){
        if(N%i==0){
            if(N/i<10){
                std::cout << "Yes" << std::endl;
                return 0;
            }
        }
    }
    std::cout << "No" << std::endl;
    return 0;
}


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


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

    std::string S;
    std::cin >> S;

    // まず辞書順ということは、
    // '('がなるべく左に続くほうがよいし
    // ')'は一番右に続くのがよい
    //
    // そして '(' + X + ')' は正しい括弧列であることを考えると
    // - 足りない左括弧を左側に継ぎ足す
    // - 足りない右括弧を右側に継ぎ足す
    // という操作で括弧を作るのが最もよいことがわかる
    //
    // また問題の括弧列は、文字列全体でみると、
    // 「そこまでに登場した左括弧の数よりも、常に右括弧が少ない」
    // という条件も満たせるように文字列を作る必要がある
    // (これを越えて右括弧があると、後ろに左括弧を足しても訂正するチャンスが得られない)
    //
    // ということは、途中の経過において、
    // そこまでに必要なだけ右括弧を足した結果の文字列で
    // 「左括弧よりも、右括弧の数が一番多くなる場所」
    // での右括弧の数だけ、左括弧を文字列の左側に準備して、
    // 合法な括弧列を作ることができることがわかる

    int need_l = 0, need_r = 0;
    for( size_t i = 0; i < S.size(); ++i ) {
        if( S[ i ] == '(' ) {
            // 左括弧には対応する右括弧が必要
            need_r += 1;
        } else if( S[ i ] == ')' ) {
            if( need_r > 0 ) {
                // 準備しなきゃいけないと思っていた右括弧が
                // 最初から文字列に準備されてたので削除
                need_r -= 1;
            } else {
                // 左括弧の数を右括弧が超えてしまったので準備しておく
                need_l += 1;
            }
        }
    }

    // 左括弧と右括弧をくっつけて出力
    std::cout << std::string( need_l, '(' ) << S << std::string( need_r, ')' ) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
typedef long long int lli;
const lli mod = 1e9 +7;
const lli inf = 1e18;
typedef pair<lli, lli> pll;

int main(){
	int m,d;
	cin >> m >> d;
	int ans = 0;
	for(int i=1; i<=m; i++){
		for(int j=1; j<=d; j++){
			if(j/10>=2 and j%10>=2 and (j/10)*(j%10)==i){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

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

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    string S;
    cin >> S;
    char c = S[0];
    FOR(i, 1, 4){
        if(S[i] == S[i - 1]){
            PRINT("Bad");
            return 0;
        }
    }
    PRINT("Good");
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
n.times{
    x, y, b, p = gets.chomp.split.map(&:to_i)
    amount = x*b + y*p
    amount * 0.8 if b>=5 && p>=2
    addb = [5 - b, 0].max
    addp = [2 - p, 0].max
    amount2 = (x * ( b + addb) + y * (p + addp)) * 0.8
    puts [amount.to_i, amount2.to_i].min
}


Measured memory_bytes: 6912
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import bisect

n = int(readline())
x = list(map(int,readline().split()))
l = int(readline())
q = int(readline())
ab = list(map(int,read().split()))

dbl_l = [[] for _ in range(n)]
dbl_r = [[] for _ in range(n)]
for dbl,xx in zip([dbl_l,dbl_r],[x,x[::-1]]):
    j = 0
    for i in range(n):
        while(j < n-1):
            if(abs(xx[j+1] - xx[i]) > l):
                break
            j += 1
        dbl[i].append(j)

    for i in range(30):
        if(dbl[0][-1] == n-1):
            break
        for j in range(n):
            dbl[j].append(dbl[ dbl[j][i] ][i])

def calc(a,b,dbl):
    if(dbl[a][0] >= b):
        return 1
    ind = bisect.bisect_left(dbl[a],b) - 1
    return 2**ind + calc(dbl[a][ind],b,dbl)

ans = []
it = iter(ab)
for a,b in zip(it,it):
    a -= 1
    b -= 1
    if(a<b):
        ans.append(calc(a,b,dbl_l))
    else:
        a,b = n-1-a,n-1-b
        ans.append(calc(a,b,dbl_r))

print('\n'.join(map(str,ans)))

Measured memory_bytes: 209596
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll dp[2005][2005];
P p[ohara];

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

  cin >> n;
  rep(i, n) cin >> a[i], p[i] = m_p(a[i], i);
  sort(p, p + n);
  reverse(p, p + n);
  rep(i, n) a[i] = p[i].fi;

  dp[0][0] = abs(n - 1 - p[0].se) * a[0];
  dp[0][1] = p[0].se * a[0];
  rrep(i, 1, n) {
    rep(j, n + 1) {
      if (i + 1 < j) continue;
      //左に
      if (j >= 1)
        dp[i][j] =
            max(dp[i][j], dp[i - 1][j - 1] + abs(j - 1 - p[i].se) * a[i]);
      //
      dp[i][j] =
          max(dp[i][j], dp[i - 1][j] + abs((n - (i - j) - 1) - p[i].se) * a[i]);
    }
  }
  rep(i, n + 1) ans = max(ans, dp[n - 1][i]);
  Cout(ans);
  return 0;
}

Measured memory_bytes: 26332
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=32e4;

int p[N],q[N],r[N];
int main(){
	ios::sync_with_stdio(0);
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	for(int i=0;i<a;i++)cin>>p[i];
	for(int i=0;i<b;i++)cin>>q[i];
	for(int i=0;i<c;i++)cin>>r[i];
	sort(p,p+a,greater<int>());
	sort(q,q+b,greater<int>());
	sort(r,r+c,greater<int>());
	priority_queue<int,vector<int>,greater<int>>h;
	for(int i=0;i<x;i++)h.push(p[i]);
	for(int i=0;i<y;i++)h.push(q[i]);
	for(int i=0;i<c;i++)if(h.top()<r[i]){
		h.pop(); h.push(r[i]);
	}
	ll ans=0;
	while(!h.empty()){
		ans+=h.top();h.pop();
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;
 
int w[100001];
int main(){
    int s,t,d;
    cin>>s>>t>>d;
    ll sum=0;
    ll mn=1000100010;
    rep(i,d){
        cin>>w[i];
        sum+=w[i];
        mn=min(mn,sum);
        if(-sum>=s-t){
            cout<<i+1<<endl;
            return 0;
        }
    }
    if(sum>=0){
        cout<<-1<<endl;
        return 0;
    }
    ll ans=0;
    ll sub=s-t+mn;
    ans+=(sub/(-sum)+1)*d;
    sub=s-t-(sub/(-sum)+1)*(-sum);
    rep(i,d){
        if(sub<=0){
            cout<<ans<<endl;
            return 0;
        }
        sub+=w[i];
        ++ans;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3508
h,w=map(int,input().split())
ans=h*w
if h==w==2:
    print(1)
    exit()
if h>2:
    t=[h//3*w,(h-(h//3))//2*w,(h-(h//3)+1)//2*w]
    t.sort()
    ans=min(ans,t[2]-t[0])
if w>2:
    t=[w//3*h,(w-(w//3))//2*h,(w-(w//3)+1)//2*h]
    t.sort()
    ans=min(ans,t[2]-t[0])
a,b=h,w
for i in range(max(1,a//3-1),min(a//2+1,a-1)):
    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
    t.sort()
    ans=min(ans,t[2]-t[0])
a,b=w,h
for i in range(max(1,a//3-1),min(a//2+1,a-1)):
    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
    t.sort()
    ans=min(ans,t[2]-t[0])
print(ans)

Measured memory_bytes: 39280
"use strict"
 
const main = arg => {
  const input = arg.trim().split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  if(N=="0"){
    console.log("1")
  }
  if(N=="1"){
    console.log("0")
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair
#define P pair<int, int>

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;

bool check[10000001];

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

	for (int i = 0; i < 10000001; i++) {
		check[i] = false;
	}
	
	check[s] = true;

	int ans = 1;
	ll num = s;

	while (1) {
		ans++;
		if (num % 2 == 0) {
			num = num / 2;
		}
		else {
			num = 3 * num + 1;
		}
		if (check[num] == true) break;
		check[num] = true;
	}

	cout << ans << endl;
}

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

using namespace std;

const int LN = 20;

int last[LN];

int main() {
	int n;
	scanf("%d", &n);
	int prev = 0;
	long long ans = 0;
	memset(last, -1, sizeof last);
	for (int i = 0; i < n; ++i) {
		int x;
		scanf("%d", &x);
		for (int j = 0; j < LN; ++j) {
			if (x & (1 << j)) {
				prev = max(prev, last[j] + 1);
				last[j] = i;
			}
		}
		ans += i - prev + 1;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  char S[200001]={0};
  char T[200001]={0};
  int i=0;
  int count=0;
  scanf("%s",S);
  scanf("%s",T);
  for(i=0;S[i]!='\0';i++){
    if(S[i]!=T[i]){
      count++;
    }
  }
  printf("%d",count);
  return 0;
}


Measured memory_bytes: 2124
#ifdef LOCAL_BUILD
#include "pch.h"
#define DLOG(msg) cout << "#" << __LINE__ << ":" << msg << endl;
#define DLOG_V(var) \
  cout << "#" << __LINE__ << ":" << #var << " : " << var << endl;
#else
#include <bits/stdc++.h>
#define DLOG(msg)
#define DLOG_V(var)
#endif
using namespace std;

int main() {
  int n, q;
  cin >> n;
  unordered_set<int> nums;
  for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    nums.insert(num);
  }
  cin >> q;
  int count = 0;
  for (int i = 0; i < q; ++i) {
    int num;
    cin >> num;
    if (nums.find(num) != nums.end()) {
      ++count;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3112
N,M=map(int, input().split())
import numpy as np
def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

if M==0:
    print(N)
else:
    check_set=set(map(int, input().split()))
    ans_set = set([i for i in range(-1,102)])
    lst = list(ans_set-check_set)
    sorted_lst=sorted(lst)
    print(getNearestValue(sorted_lst, N))

Measured memory_bytes: 27208
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
int main(void){
    int a,b,tmp;
    cin >> a >> b;
    tmp = max(a,b);
    for(int i = 0;i < tmp;i++){
        if(abs(a-i) == abs(b-i)){
            cout << i << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	string s; cin >> s;
	if (n % 2 == 1) {
		cout << "No";
		return 0;
	}
	REP(i, n / 2) {
		if (s[i] != s[i + n / 2]) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  //char in[120];
  int a,b,n; cin>>a>>b>>n;
  cout << b*(n/a) << endl;
}


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

int main(){

    int a, b, c, i;
    
    cin >> a >> b >> c;
    
    i = 0;
    
    for (int x = a; x <= b; x++){
        if (c % x == 0){
            i++;
        }
       
    }
    
    cout << i <<endl;

    return 0;
}


Measured memory_bytes: 3104
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    map<int, int> stu;
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        stu.insert({a, i});
    }

    for (auto itr = stu.begin(); itr != stu.end(); ++itr) {
        cout << itr->second << ' ';
    }

    return 0;
}

Measured memory_bytes: 5504
s=input()
l=len(s)
ans=1
for i in range(l):
  if i%2==0:
    if not (s[i]=="R" or s[i]=="U" or s[i]=="D"):
      ans=0
  else:
    if not (s[i]=="L" or s[i]=="U" or s[i]=="D"):
      ans=0
if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <stdio.h>
#define MAX 100
static const int INFTY =(1<<21);
#define WHITE 0
#define GLAY 1
#define BLACK 2

int n,m[MAX][MAX];

void daik(){
  int u,minv;
  int d[MAX],p[MAX],color[MAX];
  int i;
  for( i=0;i<n;i++){
    d[i]=INFTY;
    
    color[i]=WHITE;
  
  }
  d[0]=0;
  color[0]=GLAY;
  
  

  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }

    if(u==-1)break;
    color[u]=BLACK;
    int v;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK&&m[u][v]!=INFTY){
	if(d[v]>d[u]+m[u][v]){
	  d[v]=d[u]+m[u][v];
	  
	  color[v]=GLAY;
	}
      }

      
    }
  }

  
  for(i=0;i<n;i++){
    if(d[i]==INFTY)d[i]=-1;
    else d[i]=d[i];
    printf("%d %d\n",i,d[i]);
  }
  
}


int main(){int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      m[i][j]=INFTY;
    }
  }
  

  int k,c,u,v;
   for(i=0;i<n;i++){
     scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
	m[u][v] =c;
    }}
   daik();
 return 0;
}




Measured memory_bytes: 2052
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int a,b,k,ans = 0,temp;
		String str = bf.readLine();
		String[] arrs = str.split(" ");
		a = Integer.parseInt(arrs[0]);
		b = Integer.parseInt(arrs[1]);
		k = Integer.parseInt(arrs[2]);
		for(int i = 100;i>0;--i) {
			if(a%i==0 && b%i==0) {
				k--;
				if(k == 0) {
					ans = i;
					break;
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21204
#include <stdio.h>

int main(void)
{
	int mt[10];
	int i;
	int flag;
	int high[3];
	
	for (i = 0; i < 10; i++){
		scanf("%d", &mt[i]);
	}
	
	flag = 1;
	while (flag == 1){
		flag = 0;
		i = 0;
		while (i < 9){
			if (mt[i] < mt[i + 1]){
				mt[i] += mt[i + 1];
				mt[i + 1] = mt[i] - mt[i + 1];
				mt[i] = mt[i] - mt[i + 1];
				flag = 1;
			}
			i++;
		}
	}
	
	for (i = 0; i < 3; i++){
		printf("%d\n", mt[i]);
	}
	
	return (0);
}

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

int main() {
  int N,K;
  cin>>N>>K;
  vector<int> p(N);
  for(int i=0;i<N;i++)cin>>p[i];
  sort(p.begin(),p.end());
  int ans=0;
  for(int i=0;i<K;i++){
    ans+=p[i];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
/*
CE 头文件 
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>

*/
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define mem(a,b) memset(a,b,sizeof (a))
#define ios std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
// ios和scanf,printf不能混用.即用ios必须全部cin,cout. 
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;

ll ksm(ll a,ll b){ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int N=1e5+10;
char s[N];
int main(){
	scanf("%s",s);
	int len=strlen(s);
	if(s[len-1]=='s'){
		printf("%ses",s);
	}
	else{
		printf("%ss",s);
	}
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
int main(){
    char a,b;
    cin>>a>>b;
    if(a=='H'){
        if(b=='H')cout<<'H'<<endl;
        else cout<<'D'<<endl;
    } else {
        if(b=='D')cout<<'H'<<endl;
        else cout<<'D'<<endl;
    }
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define int int64_t
#define pr(x) cout << x << endl;
#define vi vector<int>
#define vii vector< int , vector<int> >
#define mp make_pair
#define f(i,n) for(i =0 ; i< n ; i++)
#define pb push_back
#define INF 1e9
#define SIZE 200001
#define mod 1000000007
#define int int64_t
void solve();
// class dsu
// {
//     vi rank,parents;
// public:
//     dsu(int n)
//     {
//         rank.assign(n+10,0);
//         parents.assign(n+10,0);
//         for(int i=0;i<=n;i++)
//         {
//             parents[i]=i;
//         }
//     }
//     int findparent(int a)
//     {
//         return parents[a]==a ? a : parents[a]=findparent(parents[a]);
//     }
//     bool isSameParent(int x,int y)
//     {
//         return findparent(x)==findparent(y);
//     }
//     void joindsu(int x,int y)
//     {
//         int a=findparent(x);
//         int b=findparent(y);
//         if(a!=b)
//         {
//             if(rank[a]>rank[b])
//             {
//                 parents[b]=a;
//             }
//             else
//             {
//                 parents[a]=b;
//                 if(rank[a]==rank[b])
//                     rank[b]++;
//             }
//         }
//     }
// };


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}
int32_t  k=0, l=0, i, j, n, m, a, t=0, b, w ;
void solve()
{
    // cin >> t;while(t--)
    {
        cin >> n ;
        while(n)
        {
            k = n;
            bool b =false;
            t=0;
            while(k)
            {
                k/=10;
                t++;
            }

            if(t&1) l++;
            n--;
        }

        pr(l)
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	vector<pair<int,int>> t(n);
	vector<int> akt(n);
	for(int i=0;i<n;++i) {
		cin>>t[i].first;
		akt[i]=t[i].first;
		t[i].second=i;
	}
	sort(t.begin(), t.end());
	int ans=0;
	for(int i=0;i<n;++i) {
		int ez=akt[t[i].second];
		for(int j=t[i].second;j>=0 && akt[j];j--) akt[j]-=ez;
		for(int j=t[i].second+1;j<n && akt[j];j++) akt[j]-=ez;
		ans+=ez;
	}
	cout<<ans<<"\n";
	return 0;
}


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

int main(){
    ll n;
    cin >> n;
    vector<string> s(n);
    for (ll i = 0; i < n; i++){
        cin >> s[i];
    }
    sort(s.begin(),s.end());
    ll ans = 1;
    for (ll i = 1; i < n; i++){
        if (s[i-1] != s[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9596
def operation_of_foa(input_seq, times)
	operated_seq = Array.new
	input_seq.each { |x| operated_seq << input_seq.count(x) }
	if operated_seq == input_seq
		return [operated_seq, times-1]
	else
		operation_of_foa(operated_seq, times+1)
	end
end

def print_seq(seq_times)
	puts seq_times.last
	seq_times.first.each.with_index { |x,i| print (i.zero? ? x : " #{x}") }
	puts ""
end

while gets
	n = $_.to_i
	break if n == 0
	input_seq = gets.chomp.split.map(&:to_i)
	print_seq(operation_of_foa(input_seq, 1))
end

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

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
#define PI 3.1415926536
typedef long long ll;
typedef pair<int, int> P;

int ans = 0;
vector<bool> used;
vector<vector<int>>G;
int N, M;

void dfs(int pos, int par) {
	used[pos] = true;

	bool ok = true;
	rep(i, N) {
		ok = ok && used[i];
	}
	if (ok) {
		ans++;
		used[pos] = false;
		return;
	}

	rep(i, G[pos].size()) {
		if (G[pos][i] == par || used[G[pos][i]])continue;
		dfs(G[pos][i], pos);
	}

	used[pos] = false;
}

int main() {
	cin >> N >> M;
	G = vector<vector<int>>(N);
	used = vector<bool>(N);

	rep(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	dfs(0, -1);

	cout << ans << endl;

	return 0;
}

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


int main() {
    int N, K, Q;
    cin >> N >> K >> Q;

    int n[N];
    for (int i = 0; i < N; ++i) {
        n[i] = K - Q;
    }

    for (int i = 0; i < Q; ++i) {
        int add;
        cin >> add;
        n[add-1]++;
    }

    for (int i = 0; i < N; ++i) {
        if (n[i] > 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class49
    {
        static void Main()
        {
            Dictionary<int, int> Table = new Dictionary<int, int>();
            int N = int.Parse(Console.ReadLine());
            for(int i = 0; i < N; i++)
            {
                int read = int.Parse(Console.ReadLine());
                if (Table.ContainsKey(read))
                    Table.Remove(read);
                else
                    Table.Add(read, 1);
            }
            Console.WriteLine(Table.Count());
        }
    }
}


Measured memory_bytes: 22364