akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}


int main()
{
    int k;
    cin >> k;
    ll now=0;
    REP(i,k){
        now+=1;
        string s=to_string(now);
        string yobi="";
        REP(j,s.size()-1){
            if(s[j]=='9'&&s[j+1]=='0'){
                int a=9;
                string tmp = "";
                for (int z = j + 1; z < s.size(); z++)
                {
                    if (a != 0)
                        a--;
                    tmp = to_string(a);
                    s[z] = tmp[0];
                }
                break;
            }
            if(abs((s[j]-'0')-(s[j+1]-'0'))>1){
                while(1){
                    if(j!=0&&(s[j]-'0')-(s[j-1]-'0')==1){
                        j--;
                    }else{
                        break;
                    }
                }
                int a;
                string tmp="";
                tmp = to_string((s[j] - '0') + 1);
                a = (s[j] - '0') + 1;
                s[j] = tmp[0];
                for (int z = j + 1; z < s.size(); z++)
                {
                    if(a!=0)a--;
                    tmp = to_string(a);
                    s[z] =  tmp[0];
                }
            }
        }
        s=yobi+s;
        now=stoll(s);
    }
    cout << now << endl;
}


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

#ifdef _DEBUG
#define debug(x) cout << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#define INFILE freopen("input.txt", "r", stdin)
#else
#define debug(x)
#define INFILE
#endif

#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL9_MOD = 1000000009LL;
static constexpr ll LL7_MOD = 1000000007LL;
static constexpr ll INF = 1LL << 60;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

ll dp[3010][3010];

int main(int argc, char* argv[]) {
  INFILE;

  ll n;
  cin >> n;

  vector<ll> seq(n);
  scan(seq);
  int sign = n % 2 ? 1 : -1;

  REP(i, 0, n) { dp[i][i] = seq[i] * sign; }

  REP(k, 2, n + 1) {
    sign *= -1;
    REP(i, 0, n + 1 - k) {
      int start = i, end = i + k - 1;
      ll result = 0;
      auto change = sign > 0 ? chmax<ll> : chmin<ll>;

      result = sign * seq[start] + dp[start + 1][end];
      change(result, sign * seq[end] + dp[start][end - 1]);
      dp[start][end] = result;
    }
  }

  cout << dp[0][n - 1] << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

template <class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


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

vector<int> edge[100010];
int v, e;
int par[100010];
bool vis[100010];

int main() {
	cin>>v>>e;
	for(int i=0; i<e; i++) {
		int a, b;
		cin>>a>>b;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}

	queue<int> q;
	q.push(1);
	while(!q.empty()) {
		int now=q.front();
		q.pop();
		for(int i=0; i<(int)edge[now].size(); i++) {
			int nxt=edge[now][i];
			if(!vis[nxt]) {
				vis[nxt]=true;
				par[nxt]=now;
				q.push(nxt);
			}
		}
	}

	bool cond=true;
	for(int i=1; i<=v; i++) {
		if(!vis[i]) cond=false;
	}

	if(!cond) cout<<"No\n";
	else {
		cout<<"Yes\n";
		for(int i=2; i<=v; i++) {
			cout<<par[i]<<"\n";
		}
	}

	return 0;
}

Measured memory_bytes: 10568
#include<iostream>
#include<algorithm>
using namespace std;
#define reps(i,b,n) for(int i = b ; i < n ; ++i )
#define rep(i,n) reps(i,0,n)
#define INF (1 << 30)
#define MOD 100000
int dp[51][3001],N,M,S;
int main(){
  while(cin >> N >> M >> S , N){
    fill_n(dp[0],51*3001,0);
    dp[0][0] = 1;
    for(int i = 1 ; i <= M ; i++ ){
      for(int j = N * N ; j > 0 ; j-- ){
        for(int k = i ; k <= S ; k++ ){
          dp[j][k] = (dp[j][k] + dp[j-1][k-i]);
          if(dp[j][k] >= MOD) dp[j][k] -= 100000;
        }
      }
    }
    cout << dp[N*N][S] << endl;
  }
}

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

int main() {
  int N,M,X;
  cin >> N >> M >> X;
  vector<int> A(N,0);
  for (int i=0; i<N; i++) {
    int a;
    cin >> a;
    A[a] = 1;
  }
  int ans_1,ans_2=0;
  for (int i=X; i<N; i++) {
    ans_1 += A[i];
  }
  for (int i=X; i>0; i--) {
    ans_2 += A[i];
  }
  cout << min(ans_1,ans_2) << endl;
  return 0;

}

Measured memory_bytes: 3572
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))

vector<ll> tree[100001];

vector<ll> bfs(ll start){
    vector<bool> h(100001,false);//houmonzumi
    queue<ll> q;
    q.push(start);
    ll v=start;
    h[v]=true;
    vector<ll> nagasa(100001,0);
    nagasa[v]=0;
    while(!q.empty()){
        v=q.front();
        q.pop();
        vector<ll>::iterator i;
        for(i=tree[v].begin();i!=tree[v].end();i++){
            if(h[*i])continue;
            h[*i]=true;
            q.push(*i);
            nagasa[*i]=nagasa[v]+1;
        }
    }
    return nagasa;

}

int main(){
    ll ans=0,n,u,v;
    cin>>n>>u>>v;
    //vector<ll> tree[n+1];
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    vector<ll> lena,lenb;
    lena=bfs(v);
    lenb=bfs(u);
    for(int i=0;i<n+1;i++){
        dbg cout <<lena[i]<<" "<<lenb[i]<<endl;
        if(lena[i]>lenb[i]){
            ans=max(lena[i],ans);
        }
    }

    cout <<(ans-1)<<endl;

    return 0;

}

Measured memory_bytes: 8064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		new A1141().ans(sc);
	}

}

class Code {

}

class A1130 {

	int[] xdis = { -1, 0, +1, 0 };
	int[] ydis = { 0, -1, 0, +1 };

	int[][] cm;

	public void ans(Scanner sc) {
		while (true) {
			String str = sc.nextLine();
			String[] cut = str.split(" ");
			int W = Integer.parseInt(cut[0], 10);
			int H = Integer.parseInt(cut[1], 10);

			if (W == 0) {
				break;
			}

			cm = new int[H][W];

			int x = 0;
			int y = 0;
			for (int h = 0; h < H; h++) {
				String map = sc.nextLine();
				for (int w = 0; w < W; w++) {
					char c = map.charAt(w);
					switch (c) {
					case '.':
						cm[h][w] = 0;
						break;
					case '@':
						x = w;
						y = h;
						cm[h][w] = 0;
						break;
					case '#':
						cm[h][w] = -1;
						break;
					}
				}
			}
			rec(x, y);

			int count = 0;
			for (int h = 0; h < H; h++) {
				for (int w = 0; w < W; w++) {
					if (cm[h][w] == 1) {
						count++;
					}
				}
			}
			System.out.println(count);

		}
	}

	void rec(int x, int y) {
		if (y < 0 || cm.length <= y) {
			return;
		}
		if (x < 0 || cm[0].length <= x) {
			return;
		}
		if (cm[y][x] != 0) {
			return;
		}

		cm[y][x] = 1;
		for (int i = 0; i < xdis.length; i++) {
			rec(x + xdis[i], y + ydis[i]);
		}
	}
}

class A1141 {
	boolean[] ss;

	public void ans(Scanner sc) {
		ss = new boolean[1000000];
		for (int i = 0; i < ss.length; i++) {
			ss[i]=true;
		}
		ss[0] = false;
		ss[1] = false;

		for (int i = 4; i < ss.length; i += 2) {
			ss[i] = false;
		}

		for (int i = 3; i < ss.length / 2; i += 2) {
			if (ss[i]) {
				for (int j = 2; i * j < ss.length; j++) {
					ss[i * j] = false;
				}
			}
		}

		while (true) {
			int a = sc.nextInt();
			int d = sc.nextInt();
			int n = sc.nextInt();

			if(a==0){
				break;
			}

			int c = 0;
			int i;
			for(i=0;;i++){
//				System.out.println(a+i*d);
				if(ss[a+i*d]){
					c++;
				}
				if(c==n){
					System.out.println(a+i*d);
					break;
				}
			}
		}
	}

}

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

int main(){
  string s ,t;
  cin >> s >> t;
  int sl = s.length() , tl = t.length();
  int ans = sl;
  for( int i = 0 ; i + tl - 1 < sl ; ++i){
    int cnt = 0;
    for( int j = 0 ; j < tl ; ++j){
      if( s[i + j] != t[j] ) cnt++;
    }
    ans = min( ans , cnt );
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string a,s,b;
    cin >> a >> s >> b;
    cout << "A" << s[0] << "C" << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main(){
    int a, b;
    string s;
    cin >> a >> b >> s;
    for(int i=0; i<a; i++){
        if(s[i]=='-'){
            puts("No");
            return 0;
        }
    }
    if(s[a]!='-'){
        puts("No");
        return 0;
    }
    for(int i=a+1; i<a+b; i++){
        if(s[i]=='-'){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 3556
import sys
from statistics import *
from collections import *
from operator import itemgetter
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

ans = ""
for i in range(3):
    li = input()
    ans += li[i]
print(ans)

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

int main() {
  string X,Y;
  cin >>X >>Y;
  
  if(X>Y){
    cout <<">" <<endl;
  }
  else if(X==Y){
    cout <<"=" <<endl;
  }
  else{
    cout <<"<" <<endl;
  }
  return 0;
}

Measured memory_bytes: 384
N,M = map(int,input().split())
A=list(map(int,input().split()))
total_vote =0
for i in range(N):
    total_vote += A[i]
B = [i for i in A if 4*M*i >= total_vote ]
if len(B)>=M:
    print("Yes")
else:
    print("No")
    

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

int main()
{
	char c[3][3];
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			cin>>c[i][j];
	
	cout<<c[0][0]<<c[1][1]<<c[2][2]<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;

struct Edge{int to,from,cost;};

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define mp make_pair
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,1,-1,-1,0};
const int dy[]={0,0,1,-1,1,-1,1,-1,0};

int d[100100];
int k;
int D;
int n,m;

int dis(int k){
	int a=0,b=n,m;
	while(a<b){
//cout<<" "<<a<<" "<<b<<endl;
		m=(a+b)/2;
		if(k==d[m])return 0;
		if(k<d[m])b=m-1;
		if(k>d[m])a=m+1;
	}
	if(a==b)return min(min(a>0?abs(k-d[a-1]):INF,abs(k-d[a])),a<n?abs(k-d[a+1]):INF);
	else return min(abs(k-d[a]),b>=0?abs(k-d[b]):INF);
}

int main() {
	while(D=in()){
		cin>>n>>m;
		d[0]=0;
		int res=0;
		repn(i,1,n-1)cin>>d[i];
		sort(d,d+n);
		d[n]=D;
//rep(i,n+1)cout<<i<<" "<<d[i]<<endl;
		rep(i,m){
			cin>>k;
//cout<<dis(k)<<endl;
			res+=dis(k);
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define x first
#define y second

const int M = int(1e9) + 7;

int dp[310][310][310];
bool no[310][310][310];
int n, m;

vector<pp> qr[310];

void in(){
	read(n, m);
	for(int i=1; i<=m; ++i){
		int l, r, x;
		read(l, r, x);
		qr[r].pb(pp{l, x});
	}
}

int ans;

void flow(int a, int b, int c, int x, int y, int z){
	if(no[x][y][z]) return;
	//printf("%d %d %d -> %d %d %d\n", a, b, c, x, y, z);
	dp[x][y][z] += dp[a][b][c];
	dp[x][y][z] %= M;
}

void proc(){
	dp[0][0][0]=1;
	for(int i=1; i<=n; ++i){
		for(int j=0; j<=i; ++j){
			for(int k=0; k<=j; ++k){
				if(i && i==j){
					no[i][j][k]=1;
				} else if(j && j==k){
					no[i][j][k]=1;
				} else for(auto Q:qr[i]){
					int l, x; tie(l, x) = Q;
					if(x==1 && l<=j){
						no[i][j][k]=1;
					} else if(x==2 && (j<l || l<=k)){
						no[i][j][k]=1;
					} else if(x==3 && (k<l)){
						no[i][j][k]=1;
					}
				}
			}
		}
	}
	for(int i=0; i<n; ++i){
		for(int j=0; j<=i; ++j){
			for(int k=0; k<=j; ++k){
				if(no[i][j][k]) continue;
				flow(i, j, k, i+1, j, k);
				flow(i, j, k, i+1, i, k);
				flow(i, j, k, i+1, i, j);
			}
		}
	}
}

int main()
{
	in();
	proc();
	int ans=dp[n][0][0];
	for(int j=1; j<n; ++j){
		for(int k=0; k<j; ++k){
			ans = (ans + dp[n][j][k])%M;
		}
	}
	printf("%d\n", ans);
    return 0;
}


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

int main(void){
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int i = 0; i < n; i++) cin >> h.at(i);
    vector<bool> ok(n, true);
    for (int i = 0; i <m; i++){
        int a, b;
        cin >> a >> b;
        //配列の値と揃えるためには、－１しなくてはならない！
        --a; --b;
        if (h[a] <= h[b]) ok[a] = false;
        if (h[b] <= h[a]) ok[b] = false;
    }
    
    int ans = 0;
    for (int i = 0; i < n; i++){
        if(ok[i]) ans++;
    }
    
    cout << ans << endl;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 100005;

void solve(){
	ll sum = 0;
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		if(!(i % 3 == 0 or i % 5 == 0))sum +=i;
	}
	cout << sum << '\n';

}

int main(){
	fastio;
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 3608
package main

import (
	"fmt"
)

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	c := make([]string, h)
	for i := 0; i < h; i++ {
		fmt.Scan(&c[i])
	}

	d := make([]string, 2*h)
	for i := 0; i < 2*h; i++ {
		d[i] = c[i/2]
	}

	for _, v := range d {
		fmt.Println(v)
	}
}


Measured memory_bytes: 640
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#ifdef ONLINE_JUDGE
#define debug(x)
#define debug2(x, y)
#define debug3(x, y, z)
#define dbg(v)
#else
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
#endif

// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);

    int x;
    cin >> x;
    print(8 - (x - 400) / 200);

    return 0;
}

/*
  __ _   ___ _ __  _ __
 / _` | / __| '_ \| '_ \
| (_| || (__| |_) | |_) |
 \__,_(_)___| .__/| .__/
            |_|   |_|
*/


Measured memory_bytes: 3624
import itertools
S=list(input())

l=list(itertools.product(['+',''], repeat=len(S)-1))
str=[]
for i in l:
    str.append(''.join([z for sublist in [[x, y] for x, y in zip(S,i)] for z in sublist]))

for i in range(len(str)):
    str[i]+=S[-1]
summary=0
for i in str:
    summary+=eval(i)

print(summary)

Measured memory_bytes: 3188
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

sx,sy,tx,ty = II()

move = ['U']*(ty-sy) + ['R']*(tx-sx) + ['D']*(ty-sy) + ['L']*(tx-sx)
move2 = ['L'] + ['U']*(ty-sy+1) + ['R']*(tx-sx+1) + ['D'] + \
        ['R'] + ['D']*(ty-sy+1) + ['L']*(tx-sx+1) + ['U']

ans = move+move2
print(*ans,sep='')

Measured memory_bytes: 41456
N,K,T,U,V,L = map(int,raw_input().split())
R = [0]*L
D = [int(raw_input()) for i in range(N)]
dash = have = dashL = 0
for i in range(L):
	if i == dashL:
		if have == 0:
			dash = 0
		else:
			dashL = i + V*T
			have -= 1
	if i in D:
		if dash and have < K:
			have += 1
		else:
			dashL = i + V*T
			dash = 1
	if dash:
		R[i] = 1
print R.count(0)*1.0/U + R.count(1)*1.0/V

Measured memory_bytes: 4636
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/05/02.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC165
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

template<class T> inline bool chmin(T& a, T b){ if(a>b){a=b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b){ if(a<b){a=b; return 1;} return 0;}

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const int MOD = 1000000007;
//#define __DBG__



void solve(void){
  
  string S;
  
  cin >> S;

  if(S=="ABC"){
    cout << "ARC" << endl;
  }
  else
  {
   cout << "ABC" << endl;
  }
  
  return;
}



#define TESTCASES 1

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}




Measured memory_bytes: 3640
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  4 20:58:44 2020

@author: ctiuser
"""
import sys

K = int(input())

if K <=10:
    print(K)
    sys.exit()

M = [0,[1,1,1,1,1,1,1,1,1,1]]
s = 9
while K > s:    
    m = [0 for _ in range(10)]
    for i in range(10):
        if i == 0:
            m[i] += M[-1][i] + M[-1][i+1]
        elif i == 9:
            m[i] += M[-1][i-1] + M[-1][i]
        else:
            m[i] += M[-1][i-1] + M[-1][i] + M[-1][i+1]
    M.append(m)
    s += sum(m[1:])
s -= sum(m[1:])
keta = len(M) - 1
ans = ''

i = 0
while K > s:
    i += 1
    s += M[keta][i]

s -= M[keta][i]
ans += str(i)
keta -= 1
d = K - s
#print(ans)
#print(i, d)
while keta > 0:
    if i == 0:
        d -= M[keta][i]
        if d <= 0:
            i = i
            ans += str(i)
            d += M[keta][i]            
        else:
            d -= M[keta][i+1]
            if d <= 0:
                i = i+1
                ans += str(i)
                d += M[keta][i]
    elif i == 9:
        d -= M[keta][i-1]
        if d <= 0:
            i = i-1
            ans += str(i)
            d += M[keta][i]
        else:
            d -= M[keta][i]
            if d <= 0:
                i = i
                ans += str(i)
                d += M[keta][i]
    else:
        d -= M[keta][i-1]
        if d <= 0:
            i = i-1
            ans += str(i)
            d += M[keta][i]
        else:
            d -= M[keta][i]
            if d <= 0:
                i = i
                ans += str(i)
                d += M[keta][i]
            else:
                d -= M[keta][i+1]
                if d <= 0:
                    i = i+1
                    ans += str(i)
                    d += M[keta][i]
        
        
    keta -= 1
#    print(ans)
#    print(i,d)


print(ans)


Measured memory_bytes: 3192
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;


int main(void) {
	int N, K;
	cin >> N >> K;
	vector<int>H(N);
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	long long int M = 0;
	/*--------------------------------------*/
	/*ソート（大きい順or小さい順）にして最大値を削って、残った配列を足してNと比べる
	または
	Hの配列から最大値になるものを消して、残ったものを足してNと比べる。*/

	sort(H.begin(), H.end(),greater<int>());

	for (int i = K; i < N; i++) {
		M += H[i];
	}
	cout << M << endl;
		/*for (int i = 0; i < N; i++) {
			cout << H[i] ;
		}*/
		

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int 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 Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
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;
bool fl;
struct edge{int to,cost;};
P p[ohara];
map<P,ll> mp;

//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    rep(i,n){
        cin>>a>>b;
        p[cnt++]=m_p(a,b);
    }
    cin>>n;
    rep(i,n){
        cin>>a>>b;
        p[cnt++]=m_p(a,b);
    }
    sort(p,p+cnt);
    ll last;
    rep(i,cnt){
        if(mp[{p[i].fi,p[i].se}]==1)continue;
        mp[{p[i].fi,p[i].se}]=1;
        last=i;
    }
    rep(i,cnt){
        mp[{p[i].fi,p[i].se}]=0;
    }
    rep(i,cnt){
        if(mp[{p[i].fi,p[i].se}]==1)continue;
        mp[{p[i].fi,p[i].se}]=1;
        tmp=p[i].fi;tmpp=p[i].se;
        cout<<tmp<<":";
        s=to_string(tmpp);
        if(Size(s)==1)cout<<"0";
        cout<<tmpp;
        if(i==last)cout<<"\n";
        else cout<<" ";
    }
    return 0;
}


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

//オーバーフロー
//コーナーケース

typedef long long ll;

void yes() {
    cout << "Yay!" << endl;
}
void no() {
    cout << ":(" << endl;
}

int h,w,k;
char maze[310][310];
int ans[310][310];

int main() {
    cin >> h >> w >> k;
    for (int i = 0; i < h; i++) {
        cin >> maze[i];
    }
    int num = 0;
    for (int i = 0; i < h; i++) {        
        bool f = 0;
        for (int j = 0; j < w; j++) {
            if (maze[i][j] == '#') {
                f = 1;
            }
        }
        if (!f) continue;
        for (int j = 0; j < w; j++) {
            if (maze[i][j] != '#') continue;
            num++;
            for (int ii = i; ii >= 0; ii--) {
                if (ans[ii][j] != 0) break;
                for (int jj = j; jj >= 0; jj--) {
                    if (ans[ii][jj] != 0) break;
                    ans[ii][jj] = num;
                }
            }
        }
        for (int ii = i; ii >= 0; ii--) {
            if (ans[ii][w - 1] != 0) break;
            for (int jj = w - 1; jj >= 0; jj--) {
                if (ans[ii][jj] != 0) break;
                ans[ii][jj] = num;
            }
        }
    }

    for (int i = h - 1; i >= 0; i--) {
        bool f = 0;
        for (int j = 0; j < w; j++) {
            if (maze[i][j] == '#') {
                f = 1;
            }
        }
        if (!f) continue;
        for (int j = 0; j < w; j++) {
            for (int ii = i + 1; ii < h; ii++) {
                ans[ii][j] = ans[ii - 1][j];
            }
        }
        break;
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ans[i][j] << " \n"[j == w - 1];
        }
    }
    return 0;
}


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





def main():
  N = int(input())
  xyn = [list(map(int, input().split())) for _ in range(N)]
  xyn = sorted(xyn, key=lambda x: x[0]+x[1])

  pats = set()
  for x1,y1 in xyn:
    for x2,y2 in xyn:
      pats.add((abs(x1-x2),abs(y1-y2)))

  ans = N
  for px,py in pats:
    visited = []
    for x,y in xyn:
      idx = -1
      for i,v in enumerate(visited):
        if abs(x-v[0])==px and abs(y-v[1])==py:
          idx = i
      if idx >= 0:
        visited.pop(idx)
      visited.append([x,y])
    ans = min(ans,len(visited))

  print(ans)
  

if __name__ == "__main__":
  main()

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

using namespace std;

typedef vector<int> vi;
const int M = 51;
vector<string> words;

int main() {
    int n;
    string s;
   cin >> n >> s;
   s.erase(unique(s.begin(), s.end()), s.end());
   cout << s.size();
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    int a,b;
    cin >> a >> b;
    cout << (a+b+1)/2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define ff first
#define ss second
#define p pair<int,int>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi acos(-1)

int main()
{
    fast;
    ll n;
    cin>>n;
    ll l;
    cin>>l;
    vector<ll> vec(n);
    for(auto &i:vec)
    {
        cin>>i;
    }
    int temp=0;
    for(int i=0;i<n-1;i++)
    {
        if(vec[i]+vec[i+1]>=l)temp=i+1;
    }
    if(!temp)cout<<"Impossible"<<endl;
    else
    {
        cout<<"Possible"<<endl;
        for(int i=1;i<temp;i++)
        {
            cout<<i<<endl;
        }
        for(int i=n-1;i>temp;i--)
        {
            cout<<i<<endl;
        }
        cout<<temp;
    }
}



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

double calc(int num, vector<double> v);

int n;

int main(){

    cin >> n;
    vector<double> v(n);
    for (int i=0; i<n; i++){
        cin >> v.at(i);
    }

    sort(v.begin(), v.end());

    double ans;
    ans = calc(n - 1, v);

    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0; 
}

double calc(int num, vector<double> v){

    if (num == 1){
        return (v.at(1) + v.at(0))/2.0;
    }
    else{
        return (v.at(num) + calc(num-1, v))/2.0;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll l,r;
    cin>>l>>r;
    if(r-l>=2019) cout<<0;
    else{
        int mini=2020*2020;
        repi(i,l,r){
            repi(j,i+1,r+1) mini=min(mini,((i%2019)*(j%2019))%2019);
        }
        cout<<mini;
    }
}

Measured memory_bytes: 3576
S = input()
K = int(input())
count = 0

if S[0] != '1':
  print(S[0])
  exit()

for i in range(len(S)):
    if S[i] == '1':
      count += 1
    else:
      break

if count >= K:
  print(1)
else:
  print(S[count])

Measured memory_bytes: 8940
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	cout << "ABC" << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);

int main(){

	map<ll,ll> mp;
	ll n;
	cin>>n;
	ll tmp;
	fo(i,n-1){
		cin>>tmp;
		mp[tmp]++;
	}
	FOR(i,1,n){
		cout<<mp[i]<<endl;
	}
	

}

Measured memory_bytes: 16052
#include <bits/stdc++.h>
#include <stack>
using namespace std;
int main(){
    string s;
    cin>>s;
    stack <char> ch;
    for(int i=0;i<s.size();i++){
        if(ch.size()>=1){
            if(ch.top()=='S'&&s[i]=='T'){
                ch.pop();
                continue;
            }
        }
        ch.push(s[i]);
    }
    cout<<ch.size()<<endl;
    return 0;
}

Measured memory_bytes: 644
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var i = int.Parse(inputs[1]);
        var ans = N - i + 1;
        Console.WriteLine(ans);
    }
}



Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int  main()
{
	ll n;
	cin>>n;
	double ans=0;
	for(int i=0;i<n;i++)
	{
		double x;
		cin>>x;
		ans+=1/x;
	}
	printf("%lf\n",(double)1/ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int s = max(a, c);
    int e = min(b, d);
    if(s<e) {
        cout << e-s << endl;
    } else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
from sys import stdin

def findPathToHome():
    N, T = [int(x) for x in stdin.readline().rstrip().split()]
    minCst = 1001
    for i in range(N):
        c, t = [int(x) for x in stdin.readline().rstrip().split()]
        if t <= T:
            minCst = min(c, minCst)
    if minCst != 1001:
        print(minCst)
    else:
        print("TLE")

if __name__ == '__main__':
    findPathToHome()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define repeat(i,a,b) for(int i=(a),_=(b);i<_;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,_=(a);i>=_;i--)
#define fi first
#define se second
int cansel_sync=(ios::sync_with_stdio(0),cin.tie(0),0);
typedef long long ll;
#define int ll
map<int,int> mp; //mp[]表示转移到first的最小代价为second
int n,a,b,c,d;
void push(int n,int cost){
	if(mp.count(n))mp[n]=min(mp[n],cost);
	else mp[n]=cost;
}
void solve(){
	cin>>n>>a>>b>>c>>d;
	mp.clear();
	mp[n]=0;
	while(1){
		auto it=--mp.end();
		int n=it->fi,cost=it->se;
		if(n==0){cout<<cost<<endl; return;}
		push(n/2,cost+a+d*(n%2));
		push(n/2+1,cost+a+d*(2-n%2));
		push(n/3,cost+b+d*(n%3));
		push(n/3+1,cost+b+d*(3-n%3));
		push(n/5,cost+c+d*(n%5));
		push(n/5+1,cost+c+d*(5-n%5));
		if(n<int(1e18-cost)/d)
			push(0,cost+d*n);
		mp.erase(--mp.end());
	}
}
signed main(){
	int T; cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;


int main(){
    int a, b;
    cin >> a >> b;
    int c=b,d = 0;
    while(c>0){
        d++;
        c /=10;
    }
    int n=a*pow(10,d)+b;
    for(int i=4;i*i<=n;i++){
        if(i*i == n){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" <<endl; 
    
}


Measured memory_bytes: 256
result = [0]*2
N,M = map(int,input().split())
checker = [[0]*2 for i in range(N)]

for i in range(M):
    que, res = input().split()
    que = int(que)

    if res =="WA" and checker[que-1][0]== 0:
        checker[que-1][1] +=1
    
    if res =="AC" and checker[que-1][0]==0:
        checker[que-1][0] = 1
        result[1]+= checker[que-1][1]
        result[0] +=1
print(*result)

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll,ll> pii;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mes(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define dd(x) cout<<#x<<"="<<x<<" "
#define de(x) cout<<#x<<"="<<x<<"\n"
#define debug() cout<<"I love Miyamizu Mitsuha forever.\n"
const int inf=0x3f3f3f3f;
const int maxn=1e6+5;
int n,m,k;
vector<string> str;
string s;
vector<int> dis[maxn];
int dx[]={-1,1,0,0},dy[]={0,0,-1,1};

void bfs(int stx,int sty)
{
	queue<pii> q;
	rep(i,0,n) rep(j,0,m) dis[i].pb(-1);
	dis[stx][sty]=0;
	q.push(mp(stx,sty));
	while(!q.empty())
	{
		int x=q.front().fi,y=q.front().se;
		q.pop();
		rep(i,0,4)
		{
			int xx=x,yy=y;
			rep(j,0,k)
			{
				xx+=dx[i],yy+=dy[i];
				//dd(x);dd(y);dd(xx);de(yy);
			//	if(x==0&&y==3&&xx==1&&yy==3) dd(dis[x][y]),dd(xx),dd(yy),dd(n),dd(m),dd(str[xx][yy]),de(dis[xx][yy]);
				if(xx<0||xx>=n||yy<0||yy>=m||str[xx][yy]=='@'||(dis[xx][yy]!=-1&&dis[xx][yy]<dis[x][y]+1)) break;
				if(dis[xx][yy]==-1)
				{
					dis[xx][yy]=dis[x][y]+1;
				//	dd(xx);dd(yy);dd(x);dd(y);de(dis[xx][yy]);
	//				if(xx==1&&yy==3) dd(x),dd(y),de(dis[x][y]);
					q.push(mp(xx,yy));
				}
			}
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m>>k;
	int stx,sty,edx,edy;
	cin>>stx>>sty>>edx>>edy;
	stx--,sty--,edx--,edy--;
	rep(i,0,n)
	{
		cin>>s;
		str.pb(s);
	}
	bfs(stx,sty);
	cout<<dis[edx][edy]<<"\n";
	return 0;
}

Measured memory_bytes: 34052
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

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

int main() {
    int N, K;
    string S;
    cin >> N >> K >> S;
    for (int i = 0; i < N; i++) {
        if (i + 1 == K) {
            cout << char(S[i] - 'A' + 'a');
        } else {
            cout << S[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

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

fn lcm(a: i64, b: i64) -> i64 {
  a * b / gcd(a, b)
}

fn main() {
  let a = read::<i64>();
  let b = read::<i64>();

  let mut a_str = a.to_string();
  a_str.push_str(&b.to_string());
  let ab_num: i64 = a_str.parse().unwrap();
  let mut ans = "No";

  let mut try_num = 1;

  while try_num * try_num <= ab_num {
    if try_num * try_num == ab_num {
      ans = "Yes";
      break;
    }
    try_num += 1;
  }

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


Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef double db;

int main(void)
{
	ll a;
	int c,d;
	scanf("%lld %d.%d",&a,&c,&d);
	a = a*c + a*d/100;
	printf("%lld",a);
	return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b; cin >> a >> b;
    string res = "Impossible";
    if(a % 3 == 0 or
       b % 3 == 0 or
       (a + b) % 3 == 0){
        res = "Possible";
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/arc098/submissions/2581691
inf = float('inf')


def calc_max_a(min_a):
    cands = []  # 候補
    seq = 0
    for i, aa in enumerate(a):
        if aa < min_a:
            if seq >= K:
                cands.extend(sorted(a[i - seq:i])[:seq - K + 1])
            seq = 0
        else:
            seq += 1
    if seq >= K:
        cands.extend(sorted(a[- seq:])[:seq - K + 1])

    if len(cands) < Q:
        return -1  # Query回数の操作ができない
    else:
        return sorted(cands)[Q - 1]  # Q回目の操作で取り出す値


N, K, Q = map(int, input().split())
a = tuple(map(int, input().split()))

ans = inf
for min_a in sorted(set(a)):
    max_a = calc_max_a(min_a)
    if max_a < 0: break  # min_a以上の値を最小値にするような操作は存在しない
    ans = min(ans, max_a - min_a)
print(ans)


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    string s; cin >> s;

    if (s[2] == s[3] && s[4] == s[5]) {
        puts("Yes");
    } else {
        puts("No");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

vpii v;
int main(){
	int n, k; scanf("%d%d", &n, &k);
	int p = (n-1)*(n-2)/2;
	if(k > p){
		printf("-1\n");
		return 0;
	}
	k -= p;
	for(int i = 2; i <= n; i++) v.EB(1, i);
	for(int i = 2; i <= n; i++){
		for(int j = i+1; j <= n; j++){
			if(k < 0){
				v.EB(i, j);
				k++;
			}
		}
	}
	printf("%d\n", (int)(v.size()));
	for(auto &p : v){
		printf("%d %d\n", p.first, p.second);
	}
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    int[] chars = new int[26];
    while (stdin.hasNext()) {
      String str = stdin.next();
      int len = str.length();
      for (int i = 0; i < len; i++) {
        int j = Character.toLowerCase(str.charAt(i)) - 97;
        if (j >= 0 && j < 26) {
          chars[j]++;
        }
      }
    }

    for (int i = 0; i < 26; i++) {
      System.out.printf("%s : %d%n", (char) (i + 97), chars[i]);
    }
  }

}

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

Measured memory_bytes: 256
#include<stdio.h>

#define N 100000

int partition(int [], int, int);

int partition(int A[], int p, int r){
  int x, i, j, change;

  x = A[r];
  i = p-1;

  for(j=p; j<r; j++){
    if(A[j] <= x){
      i = i+1;
      change = A[i];
      A[i] = A[j];
      A[j] = change;
    }
  }
    change = A[i+1];
    A[i+1] = A[r];
    A[r] = change;

  return i+1;
}

int main(){
  int n, A[N];
  int i, par;

  scanf("%d", &n);
  for(i=0; i<n; i++)
    scanf("%d", &A[i]);

  par = partition(A, 0, n-1);

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

  return 0;
}



Measured memory_bytes: 2192
import java.lang.reflect.Array;
import java.math.*;
import java.util.*;
public class Main
{
	static Scanner sc=new Scanner(System.in);
	static final int MAX=100000+5;
	public static void main(String[] args)
	{
		int n=sc.nextInt();
		int k=sc.nextInt();
		int[] a=new int[MAX];
		for(int i=0;i<n;i++)
			a[i]=sc.nextInt();
		Arrays.sort(a,0,n);
		int ans=Integer.MAX_VALUE;
		for(int i=0;i+k<=n;i++)
			ans=Math.min(ans,Math.abs(a[i]-a[k+i-1]));
		System.out.println(ans);
	}
}

Measured memory_bytes: 50852
import sys

#+++++
		
def main():
	h, w = map(int, input().split())
	
	if h > w:
		(h,w) = (w,h)
	
	if h*w % 3 == 0:
		return 0
	
	if h==2 and w==2:
		return 1
		
	#ii
	mm=h
	
	#t
	for i in range(1, h-1 +1):
		a = w * i
		b = (w // 2) * (h - i)
		c = ((w // 2) + w % 2) * (h - i)
		rt=max(a,b,c)-min(a,b,c)
		mm=min(rt, mm)
	
	#t
	for i in range(1, w-1 +1):
		a = h * i
		b = (h // 2) * (w - i)
		c = ((h // 2) + h % 2) * (w - i)
		rt=max(a,b,c)-min(a,b,c)
		mm=min(rt, mm)	
	
	return mm
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const long long INF = 1LL << 58;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

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

    int ar[60] = {0};
    int tmp;
    REP(i, N)
    {
        cin >> tmp;
        REP(j, 60)
        {
            if (tmp & (1ll << j))
            {
                ar[j]++;
            }
        }
    }
    int ans = 0;
    int mod = 1000000007;
    REP(i, 60)
    {
        tmp = (1ll << i) % mod;
        tmp = (tmp * ar[i]) % mod;
        tmp = (tmp * (N - ar[i])) % mod;
        ans = ans + tmp;
        ans = ans % mod;
    }
    cout << ans << endl;
    return 0;
    // system("pause");
}


Measured memory_bytes: 256