akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

int main() {
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    int q; cin >> q;
    while (q--) {
        int l, r; cin >> l >> r;
        reverse(v.begin() + l, v.begin() + r);
    }
    rep(i, n) {
        cout << v[i] << " \n"[i==n-1];
    }
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    vector<int> math(3);
    for (int i = 0;i < 3;i++){
        cin >> math.at(i);
    }

    
    sort(math.begin(), math.end());
    reverse(math.begin(), math.end());

    cout << math.at(0)*10+math.at(1)+math.at(2) << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define forep(i, a, b) for(int64_t i=(a);i<(b);++i)
#define all(obj) (obj).begin(), (obj).end()
#define in(x) cin >> (x)
#define out(y) cout << (y) << "\n"
#define i64 int64_t
#define str string
using namespace std;
void Main() {
	/*----------------------------------------------------------------------------------------------------*/
	char a;
	in(a);

	if (isupper(a)) out("A");
	else out("a");

	/*----------------------------------------------------------------------------------------------------*/
}
int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int j=0;
  cin >> N;
  for (int i=0; i<N; i++){
    string S;
    cin >> S;
    if (j==0 && S=="Y"){
      j++;
    }
    if (i==N-1 && j==1){
      cout << "Four" << endl;
    }
    else if(i==N-1 && j==0){
      cout << "Three" << endl;
    }
  }
}

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

void calc(int sum,int i,vector<char> &op,vector<char> &ans,vector<char> &s){
  if(i==3){
    if(sum==7)
      for(int j=0;j<3;j++)
        ans.at(j) = op.at(j);
    return;
  }
  op.at(i)='+';
  calc(sum+(s.at(i+1)-'0'),i+1,op,ans,s);
  op.at(i)='-';
  calc(sum-(s.at(i+1)-'0'),i+1,op,ans,s);  
}

int main()
{
  vector<char> op(3),ans(3),s(4);
  for(int i=0;i<4;i++)
    cin >> s.at(i); 
  calc(s.at(0)-'0',0,op,ans,s);
  for(int j=0;j<3;j++)
    cout << s.at(j) << ans.at(j);
  cout << s.at(3) << "=7" << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// atoi : atoi(変数名.c_str())
// find(): int i = 変数名.find(“文字列”) 何番目にあるかを得る
// cout << (条件 ? "Yes" : "No") << endl;
// 降順 sort(a.begin(),a.end(),greater<int>());
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int a,b;
  rep(i,n){
    if(s.at(i) == 'A'){
      a = i;
      break;
    }
  }
  rep(i,n){
    if(s.at(n-1-i) == 'Z'){
      b = n-1-i;
      break;
    }
  }
  cout << b - a + 1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    string s;
    cin >> s;
    int cnt = 0;
    if (s[0] != s[1]) cnt++;
    if (s[1] != s[2]) cnt++;
    if (cnt == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

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

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


	ll a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 100005
#define INF 1000000005LL
//#define INF 1e18
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int prime[SIZE]; //i番目の素数
bool is_prime[SIZE];

//n以下の素数判定
int sieve(int n){
  int p=0;
  fill(is_prime,is_prime+SIZE,true);
  is_prime[0] = is_prime[1]=false;
  rep(i,2,n+1){
    if(is_prime[i]){
      prime[p++] = i;
      for(int j=2*i;j<=n;j+=i) is_prime[j] = false;
    }
  }
  return p;
}

int a[SIZE];

int main(){
  int q;
  cin >> q;
  int n = 100000;
  sieve(n);
  rep(i,1,n+1){
    if(i%2==0)continue;
    if(is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
  }
  rep(i,1,n+1){
    a[i] += a[i-1];
  }
  rep(i,0,q){
    int l,r;
    cin >> l >> r;
    cout << a[r]-a[l-1] << endl;
  }

  return 0;
}


Measured memory_bytes: 1152
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = str(input())

ans = 0
win = [1] * N

for i in range(N):
  if T[i] == "r":
    ans += P
    x = P
  elif T[i] == "s":
    ans += R
    x = R
  else:
    ans += S
    x = S
  if i >= K:
    if (T[i] == T[i - K]) and (win[i - K] == 1):
      ans -= x
      win[i] = 0
  #print(ans)
print(ans)

Measured memory_bytes: 4084
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_H = 500, MAX_W = 500;
int H, W;
int a[MAX_H+1][MAX_W+1];
int N;
int ans[MAX_H*MAX_W][4];

void set_ans(int n, int a, int b, int c, int d) {
  ans[n][0] = a;
  ans[n][1] = b;
  ans[n][2] = c;
  ans[n][3] = d;
}

int main() {
  cin >> H >> W;
  for (int i = 1; i <= H; ++i) {
    for (int j = 1; j <= W; ++j) {
      cin >> a[i][j];
    }
  }

  

  for (int i = 1; i <= H; ++i) {
    if (i%2 == 1) {
      for (int j = 1; j < W; ++j) {
        if (a[i][j]%2 == 1) {
          set_ans(N, i, j, i, j+1);
          ++N;
          ++a[i][j+1];
        }
      }

      if (a[i][W]%2 == 1 && i != H) {
        set_ans(N, i, W, i+1, W);
        ++N;
        ++a[i+1][W];
      }
    } else {
      for (int j = W; j > 1; --j) {
        if (a[i][j]%2 == 1) {
          set_ans(N, i, j, i, j-1);
          ++N;
          ++a[i][j-1];
        }
      }

      if (a[i][1]%2 == 1 && i != H) {
        set_ans(N, i, 1, i+1, 1);
        ++N;
        ++a[i+1][1];
      }
    }
  }

  cout << N << endl;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 4; ++j) {
      printf("%d%c", ans[i][j], j+1 != 4 ? ' ' : '\n');
    }
  }

  return 0;
}


Measured memory_bytes: 6912
// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<n;i++)
#define show(s) cout<<s<<endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define LINF (1000000000000000000ll)
//typedef pair < int, int> P;
ll gcd(ll a, ll b) {//最大公約数を求める///最大公倍数a*b/gcd(a,b)
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcd(ll a, ll b) {//最小公倍数を求める　b=0のときaを返す
	if (b == 0) return a;
	return (a / gcd(a, b)) * b;
}
vector<int> divnum(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p;
}
int digiter(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p.size();
}
vector<int> convertstring(string s) {
	vector<int> d;
	ll n = s.size();
	rep(i, n) {
		d.push_back(s[i] - '0');
	}
	return d;
}

ll  K;
ll dp[1000000] = { 1,2,3,4,5,6,7,8,9,10};
void maker(ll n) {
	vector<int> edig = divnum(dp[n - 1]);
	//cout << edig[0] << endl;
	//reverse(edig.begin(), edig.end());
	auto match = [&](int d) {
		for (int i = d; i > 0; --i) {
			if (edig[i] > 0) {
				edig[i - 1] = edig[i] - 1;
			}
			else {
				edig[i - 1] = 0;
			}
		}
	};
	for(int i = 1; i < edig.size(); i++) {
		//cout << edig[i] << " " << edig[i - 1] << endl;
		if (edig[i] + 1 > edig[i - 1]&&edig[i-1]<9) {
			
			edig[i-1]++;
			match(i - 1);
			break;
		}
		if (i == edig.size() - 1&&edig[i]<9) {
			edig[i]++;
			match(i);
			break;
		}
		else if (i == edig.size() - 1 && edig[i] == 9) {
			edig.push_back(1);//if(dp[n-1]==99)cout << "work" << endl;
			match(i + 1);
			break;
		}
	}
	dp[n] = 0;
	//reverse(edig.begin(), edig.end());
	rep(i, edig.size()) {
		dp[n]+=pow(10, i)* edig[i];
		//cout << edig[i] << " " << n << endl;
	}
}
int main()
{
	cin >> K;
	for (int i = 10; i < K; i++) {
		maker(i);
		//cout << dp[i] << endl;
	}
	cout << dp[K - 1] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    map<char, int> ab;
    rep(i, n) ab[s[i]]++;

    for (char c = 'a'; c <= 'z'; c++) {
        if (ab[c] == 0) {
            cout << c << endl;
            exit(0);
        }
    }

    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 3820
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		final int N = in.nextInt();
		final int M = in.nextInt();
		int[] votes = new int[N];
		int total = 0;
		for(int i = 0; i < N; i++) {
			votes[i] = in.nextInt();
			total += votes[i];
		}
		Arrays.sort(votes);
		if(votes[(N - 1) - (M - 1)] < (double) total * ((double) 1 / ((double) 4 * M)))
			System.out.println("No");
		else System.out.println("Yes");
	}
}

Measured memory_bytes: 23252
from math import ceil
N = int(input())
A, B = [], []
for _ in range(N):
    ai, bi = map(int, input().split())
    A.append(ai)
    B.append(bi)

# 回数だけ確定する
# 後ろから順番にすれば良い気がする (iのボタンは1からiまでしか作用しないので)
count = 0
for j in range(N - 1, -1, -1):
    if (count + A[j]) % B[j] == 0:
        continue
    else:
        # 足りない分をカウントする
        count += B[j] - (count + A[j]) % B[j]
print(count)

Measured memory_bytes: 56792
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.HashSet;
import java.util.List;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Library lib = new Library();
        int n = sc.nextInt();
        ArrayList<Integer> d = new ArrayList<>();
        for (int i=0;i<n;i++){
            d.add(sc.nextInt());
        }
        Collections.sort(d);
        int len = d.size();
        int left = d.get(len/2-1);
        int right = d.get(len/2);
        int ans = right - left;
        System.out.println(ans);
    }
}

class Library{
    static long a;
    static long b;

    public static long gcd(long a,long b){
        Library lib = new Library();
        if (a<b){
            lib.swap(a,b);
        }
        if (b==0){
            return a;
        } else {
            return gcd(b,a%b);
        }
    }

    public static void swap(long a,long b){
        long x = a;
        a = b;
        b = x;
        return;
    }
}

Measured memory_bytes: 58332
#include<iostream>
#include<queue>
#define BMAX 100
#define DMAX 1000000

using namespace std;

struct data { 
	int cost;
	int where;
};

//bool bind[BMAX][BMAX];
int cost[BMAX][BMAX];
int dis[BMAX][BMAX];
bool check[BMAX];



bool operator<( const data& a, const data& b) {
	return a.cost > b.cost;
}

int main () {
	int count = 0;
	while ( true ) {

		int n,m,s,g1,g2;
		cin >> n >> m>> s>> g1>> g2;
		s--;
		g1--;
		g2--;
		if ( n == 0 )
			break;

		for ( int i=0; i<n; i++ ) {
			for ( int j=0; j<n; j++ ) {
				cost[i][j] = DMAX;
				dis[i][j] = DMAX;
			}
		}

		for ( int i=0; i<n; i++ ) {
			cost[i][i] = 0;
			dis[i][i] = 0;
		}

		for ( int i=0; i<m; i++ ) {
			int x,y,c;
			cin >> x >> y >> c;
			cost[x-1][y-1] = c;
		}

		for ( int i=0; i<n; i++ ) {
			priority_queue<data> flow;

			while(!flow.empty()) {
				flow.pop();
			}

			data now;
			now.cost = 0;
			now.where = i;
			flow.push(now);
			while ( !flow.empty() ) {
				data now = flow.top();
				flow.pop();

				data next;


				for ( int j=0; j<n; j++ ) {
					check[j] = true;
				}
				check[now.where] = false;

				for ( int j=0; j<n; j++ ) {
					if ( check[j] ) {
						check[j] = false;
						int newDCost = dis[now.where][j] + now.cost ;
						int newCCost = cost[now.where][j] + now.cost ;
						int newCost;
						if ( newDCost < newCCost )
							newCost = newDCost;
						else
							newCost = newCCost;
						if ( dis[i][j] > newCost ) {
							dis[i][j] = newCost;
							next.cost = newCost;
							next.where = j;
							if ( next.cost != DMAX ) {
								flow.push(next);
							}
						}
					}
				}
			}
		}

		int min = DMAX;
		int minb;
		for ( int i=0; i<n; i++ ) {
			if ( min > dis[s][i] + dis[i][g1] + dis[i][g2] ) {
				min = dis[s][i] + dis[i][g1] + dis[i][g2];
				minb = i;
			}
		}

		cout << min << endl;
	}
}

Measured memory_bytes: 988
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

#include <vector>
#include <cmath>
#include <cstring>

const double EPS = 1e-10;
#define equals(a,b) (fabs((a) - (b)) < EPS)
struct Point{
	double x,y;
	Point(double x = 0.0,double y =0.0):x(x),y(y){}
	Point operator + (const Point& p){ return Point(x+p.x,y+p.y);	}
	Point operator - (const Point& p){ return Point(x-p.x,y-p.y); }
	Point operator * (double k){ return Point(x*k,y*k);	}
	Point operator / (double k){ return Point(x/k,y/k); }

	double norm(){return x*x+y*y;}
	double abs(){return sqrt(norm());}

	bool operator < (const Point& p) const {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator == (const Point &p) const{
		return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
	}
};
typedef Point Vector;

double dot(Vector a, Vector b){
	return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b){
	return a.x*b.y - a.y*b.x;
}


struct Segment{
	Point p1,p2;
	Segment(Point p1,Point p2):p1(p1),p2(p2){}
};

typedef Segment Line;
class Circle{
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0): c(c),r(r){}
};
typedef vector<Point> Polygon;

bool isOrthgonal(Vector a, Vector b){
	return equals(dot(a,b),0.0);
}

bool isOrthgonal(Point a1, Point a2, Point b1, Point b2){
	return isOrthgonal(a1-a2,b1-b2);
}

bool isOrthgonal(Segment s1, Segment s2){
	return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1),0.0);
}

bool isParallel(Vector a,Vector b){
	return equals(cross(a,b),0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2){
	return isParallel(a1-a2,b1-b2);
}

bool isParallel(Segment s1, Segment s2){
	return equals(cross(s1.p2 - s1.p1,s2.p2-s2.p1),0.0);
}

Point project(Segment s,Point p){
	Vector base = s.p2 - s.p1;
	double r = dot(p-s.p1,base)/base.norm();
	return s.p1 + base * r;
}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	Segment s(Point(a,b),Point(c,d));
	int q;cin>>q;
	while(q--){
		int x,y;cin>>x>>y;
		Point ans = project(s,Point(x,y));
		cout << fixed << setprecision(8) << ans.x << ' ' << ans.y << endl;
	}
  return 0;
}

Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N, M; cin >> N >> M;
    vector<int> cnt(N, 1);
    vector<bool> red(N);
    red[0] = true;
    for (int i = 0; i < M; i++) {
        int x, y; cin >> x >> y; x--, y--;
        cnt[x]--, cnt[y]++;
        if (red[x]) red[y] = true;
        if (cnt[x] == 0) red[x] = false;
    }
    cout << accumulate(begin(red), end(red), 0) << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int a,b;
  cin >> a >> b;
  if(a*500>=b) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int N, M;
    cin >> N >> M;
    cout << (1900 * M + 100 * (N - M)) * (int)pow(2, M) << endl;
    return 0;
}


Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int mod = 1e9+7;
int main(){
  int count = 0;
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  while(a>=b){
    b *= 2;
    count++;
  }
  while(b>=c){
    c *=2;
    count++;
  }
  cout<<(k>=count? "Yes":"No")<<endl;
	     
//    cout << fixed << setprecision(10);
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    
    int n, a[100];
    
    cin >> n;
    if(n == 1){
        cout << "0\n";
        return 0;
    }
    
    for(int i = 0; i < n; i ++) cin >> a[i];
    
    int c = 0, ans = 0;
    for(int i = 1; i < n; i ++){
        if(a[i] == a[i-1]) c ++;
        else if(c > 0){
            ans += (c+1)/2;
            c = 0;
        }
    }
    ans += (c+1)/2;
    cout << ans << "\n";
}


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

int main(void) {
	string s; cin >> s;
	int K; cin >> K;
	int i;
	for (i = 0; i < K; i++) {
		if (s[i] != '1') {
			cout << s[i] << endl;
			return 0;
		}
	}
	cout << "1" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = pow(10, 9) + 7;

// DAME:
// TIPS: 素因数分解して約数の個数を求める

map<int, int>  divisor;

void divide(int n){
    for(int i=2; i<=n; i++){
        if(n%i==0){
            while(n%i==0 && n>0){
                divisor[i]++;
                n /= i;
            }
        }
    }
}


int main() {
    int n;
    cin >> n;
    ll ans = 1;
    // 階乗の計算
    for(int j=2; j<=n; j++){
        // それぞれの素因数分解
        divide(j);
    }
    
    for (auto it : divisor) {
        int cnt = it.second;
        ans = ans * (1 + cnt);
        ans %= MOD;
    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
int main(){
        double x1,y1,x2,y2;
        scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
        printf("%.10lf\n",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
        return 0;
}

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

int main()
{
	string str;
  	cin>>str;
  	if(str=="A")
    cout<<"T";
  	else if(str=="T")
    cout<<"A";
  	else if(str=="G")
    cout<<"C";
  	else if(str=="C")
    cout<<"G";
  	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
local function gcd(a,b)
    if b>0 then
        return gcd(b,a%b)
    else
        return a
    end
end

local n,m=io.read("*n","*n","*l")
local s=io.read()
local t=io.read()

local l=n*m//gcd(n,m)
local ln=m//gcd(n,m)
local lm=n//gcd(n,m)

local x={}
for i=1,n do
    local p=(i-1)*ln+1
    x[p]=s:sub(i,i)
end

local bool=true
for i=1,m do
    local p=(i-1)*lm+1
    if x[p] and x[p]~=t:sub(i,i) then
        bool=false
        break
    end
end
print(bool and l or -1)

Measured memory_bytes: 6816
use proconio::input;

use rand::Rng;

struct State {
    c: Vec<i32>,
    s: Vec<Vec<i32>>,
    cur_seq: Vec<usize>,
    sat: i32,
}

impl State {
    fn init(&mut self) {
        let mut last = vec![0; 26];
        self.sat = 0;

        for i in 0..self.cur_seq.len() {
            self.sat += self.s[i][self.cur_seq[i]];
            last[self.cur_seq[i]] = (i + 1) as i32;

            for j in 0..26 {
                self.sat -= self.c[j] * ((i + 1 - last[j] as usize) as i32);
            }
        }
    }

    fn change(&mut self, d: usize, q: usize) {
        self.sat -= self.s[d][self.cur_seq[d]];
        self.sat += self.s[d][q];

        let mut last = vec![0; 26];
        for i in 0..self.cur_seq.len() {
            last[self.cur_seq[i]] = (i + 1) as i32;
            let j = self.cur_seq[d];
            self.sat += self.c[j] * ((i + 1 - last[j] as usize) as i32);
            self.sat += self.c[q] * ((i + 1 - last[q] as usize) as i32);
        }

        last = vec![0; 26];
        let p = self.cur_seq[d];
        self.cur_seq[d] = q;
        for i in 0..self.cur_seq.len() {
            last[self.cur_seq[i]] = (i + 1) as i32;

            self.sat -= self.c[p] * ((i + 1 - last[p] as usize) as i32);
            self.sat -= self.c[q] * ((i + 1 - last[q] as usize) as i32);
        }
    }
}

fn main() {
    input! {
        d: usize,
        c: [i32;26],
        s: [[i32;26]; d],
    }

    let mut state = State {
        c,
        s,
        cur_seq: vec![0; d],
        sat: 0,
    };

    let mut rng = rand::thread_rng();
    for j in 0..d {
        state.cur_seq[j] = j % 26;
    }
    state.init();
    let mut cur_sat = state.sat;
    let mut cur_ans = state.cur_seq.to_owned();

    for _ in 0..500000 {
        let d = rng.gen_range(0, d);
        let q = rng.gen_range(0, 26);
        if state.cur_seq[d] == q {
            continue;
        }
        state.change(d, q);
        if state.sat > cur_sat {
            dbg!(state.sat, cur_sat);
            cur_sat = state.sat;
            cur_ans = state.cur_seq.to_owned();
        }
    }

    dbg!(cur_sat);

    for i in cur_ans {
        println!("{}", i + 1);
    }
}


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

typedef unsigned long long L;
L a[100000];
L b[100000];

int main()
{
    int N, max_idx=0;
    L max_val_a=0, count=0;
    signed long long H, max_val_b=0;
    scanf("%d %lld", &N, &H);
    for (int i=0; i<N; i++){
        scanf("%lld %lld", &a[i], &b[i]);
        if (a[i] > max_val_a){
            max_val_a = a[i];
            max_val_b = b[i];
            max_idx = i;
        }
    }
    b[max_idx] = 0;
    sort(b, b+N);
    for (int i=N-1; i>=0; i--){
        if (H - max_val_b > 0){
            if (b[i] > max_val_a){
                H -= b[i];
                count++;
            }
        }
    }
    while (H > 0){
        if (H - max_val_b <= 0){
            count++;
            H -= max_val_b;
        }
        else{
            H -= max_val_a;
            count++;
        }
    }
    printf("%lld\n", count);
    return 0;
}

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

int main(){


int T,X,N;
cin >> N >> X >> T;

int time =0;

if(N % X ==0)
{
    time = N/X;
}else 
{
    time = N/X +1;
}

cout <<  (time * T);

    return 0;
}




Measured memory_bytes: 3612
cal = {}
month = [[31,28,31,30,31,30,31,31,30,31,30,31],
         [31,29,31,30,31,30,31,31,30,31,30,31]]
count = 1
for y in xrange(3000):#
    f = 1 if y%4 == 0 and y%100 != 0 or y%400 == 0 else 0
    for m in xrange(12):
        for d in xrange(month[f][m]):
            cal[(y,m+1,d+1)] = count
            count += 1
while True:
    y1,m1,d1,y2,m2,d2 = map(int,raw_input().split())
    if any(i<0 for i in (y1,m1,d1,y2,m2,d2)):
        break
    print cal[(y2,m2,d2)] - cal[(y1,m1,d1)]

Measured memory_bytes: 168640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=k;i<n;i++)
	{
		if(a[i]>a[i-k])
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 5192
#include <iostream>

int main() {
    int rate;
    std::cin >> rate;

    if (rate < 1200) {
        std::cout << "ABC" << "\n";
    } else if (rate < 2800) {
        std::cout << "ARC" << "\n";
    } else {
        std::cout << "AGC" << "\n";
    }
    return 0;
}


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

using namespace std;

string d2b(int x, int M)
{
    string s;
    while (x > 0) {
        s += (x % 2 == 0 ? "0" : "1");
        x /= 2;
    }
    while ((int)s.size() < M) {
        s += "0";
    }
    reverse(s.begin(), s.end());
    return s;
}

int main()
{
    int N, M;
    while (cin >> N >> M, N) {
        vector<int> L(N);
        for (int i = 0; i < N; i++) {
            cin >> L[i];
        }

        vector<string> bits;
        for (int i = 0; i < (1<<M); i++) {
            if (L[0] == __builtin_popcount(i)) {
                bits.push_back(d2b(i, M));
            }
        }
        
        for (int i = 1; i < N; i++) {
            vector<string> nbits;
            for (int j = 0; j < (int)bits.size(); j++) {
                int cnt = 0;
                for (int k = i; k < i + M; k++) {
                    if (bits[j][k] == '1') {
                        cnt++;
                    }
                }
                int bit_cnt = L[i];
                if (cnt == bit_cnt) {
                    nbits.push_back(bits[j] + "0");
                } else if (cnt + 1 == bit_cnt) {
                    nbits.push_back(bits[j] + "1");
                }
            }
            bits = nbits;
        }

        if (bits.size() == 0) {
            cout << "Goofy" << endl;
        } else {
            cout << bits[0] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3272
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()
S = i_s()

r = S.count('R')
g = S.count('G')
b = S.count('B')

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        k = j + j - i
        if k >= N:
            break
        if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
            cnt += 1

print((r * g * b) - cnt)

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

int main(int argc, char *argv[]){
  long long min = 1000000, max = -1000000, sum=0,nline,i;
  cin >> nline;
  const int n = nline;
  int arr[n];
  //  int *arr = new int(nline);
  for(i = 0;i < n;i++){
    cin >> arr[i];
  }
   for(i = 0;i < n;i++){
    if(arr[i] < min)min = arr[i];
    if(arr[i] > max)max = arr[i];
  }
  for(i = 0;i < n; i++){
    sum += arr[i];
  }
  cout << min << " " << max << " " << sum << endl;
  //  delete[] arr;
  return 0;
}

Measured memory_bytes: 1208
use std::collections::*;
use std::cmp::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        s: [String; n]
    }

    let s: HashSet<String> = s.into_iter().collect();
    println!("{}", s.iter().count());
}


Measured memory_bytes: 21348
#include <stdio.h>
#include <string.h>
int main(void){
	int i,len;
	char str[1024];
	gets(str);
	len=strlen(str);
	len-=5;
	for(i=0;i<=len;i++){
		if(str[i]=='a' && str[i+1]=='p' && str[i+2]=='p' && str[i+3]=='l' && str[i+4]=='e'){
			str[i]='p';
			str[i+1]='e';
			str[i+2]='a';
			str[i+3]='c';
			str[i+4]='h';
		}
		else if(str[i]=='p' && str[i+1]=='e' && str[i+2]=='a' && str[i+3]=='c' && str[i+4]=='h'){
			str[i]='a';
			str[i+1]='p';
			str[i+2]='p';
			str[i+3]='l';
			str[i+4]='e';
		}
	}
	puts(str);
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

int N, M;

int main() {
    cin >> N >> M;
    cout << (N * (N - 1) + M * (M - 1)) / 2 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

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

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;

  ll k = 0;
  bool ok = true;
  while (N >= 10) {
    if (N % 10 < 9) ok = false;
    k += 9;
    N /= 10;
  }
  k += N;

  if (!ok) {
    k--;
  }
  cout << k;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define LENGTH 101

int main(void) {
    char strings[LENGTH][500];
    int i = 0, j, k, data_count, length, flag, ans_count = 0;
    while(scanf("%s",strings[i]) != EOF) {
        i++;
    }
    data_count = i;
    for(i = 0; i < data_count; i++ ) {
        flag = 0;
        length = strlen(strings[i]);

        for(j = 0, k = length - 1; j < length / 2; j++, k--) {
            if(strings[i][j] != strings[i][k] ) {
                flag = 1;
                break;
            }
        }
        if(!flag) {
            ans_count++;
        }
    }
    printf("%d\n",ans_count);
    return 0;
}

Measured memory_bytes: 560
#include<iostream>
int main(){
  std::string x,y;
  int a[1001][1001];
  int cnt=0;

  std::cin>>x;
  std::cin>>y;
  for(int j=0;j<1001;j++){
    for(int k=0;k<1001;k++){
      a[j][k]=0;
      if(j==0) a[j][k]=k;
      if(k==0) a[j][k]=j;
    }
  }

  for(int j=0;j<=x.size();j++){
    for(int k=0;k<=y.size();k++){
     // std::cout<<a[j][k];
    }
   // std::cout<<"\n";
  }
  int b00,b01,b10,b11;
  for(int j=1;j<=x.size();j++){
    for(int k=1;k<=y.size();k++){
      b00=a[j-1][k-1];
      b01=a[j][k-1]+1;
      b10=a[j-1][k]+1;
      if(x[j-1]==y[k-1]){
	if(b00<=b01 && b00<=b10) a[j][k]=b00;
	else if(b01<=b00 && b01<=b10) a[j][k]=b01;
	else a[j][k]=b10;
      }else{
	if(b00+1<=b01 && b00+1<=b10) a[j][k]=b00+1;
	else if(b01<=b00 && b01<=b10) a[j][k]=b01;
	else a[j][k]=b10;
      }
    }

  }


  for(int j=1;j<=x.size();j++){
    for(int k=1;k<=y.size();k++){
     // std::cout<<a[j][k];
    }
   // std::cout<<"\n";
  }


  std::cout<<a[x.size()][y.size()]<<"\n";

  return 0;
}


Measured memory_bytes: 7132
// Problem : A - Takoyaki
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
typedef long long       ll;
#define PI                acos(-1)
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define forr(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define deb(x)			  cerr << "# " << (#x) << " = " << (x) << endl;
#define sz(x)             (int)x.size()
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
const int INF = 1234567890;

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
	int n, x, t;
	cin >> n >> x >> t;
	cout << (n/x + (n%x > 0)) * t << endl;
    return 0;
}
// Dinosaurs are cool

Measured memory_bytes: 3536
#include <stdio.h>
int main(){
	int a[5];
	scanf("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]);
	int max = 0;
	int wait = 0;
	for(int i=0;i<5;i++){
		if(a[i]%10 == 0){
			wait+=a[i];
		}
		else{
			wait += (a[i]/10 + 1) *10;
			if(max<= (10 - a[i]%10)%10){
				max=(10 - a[i]%10)%10;
			}
		}
	}
	printf("%d",wait-max);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using llong = long long;

const int INF = 100100100;
const int MOD = 1e9 + 7;

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

    int N;
    cin >> N;

    int tmp1 = N % 10;
    int tmp2 = N & 100;
    int tmp3 = N & 1000;
    int tmp4 = N & 10000;
    if(1 <= N && N <= 9) {
        cout << N;
    } else if(10 <= N && N <= 99) {
        cout << 9;
    } else if(100 <= N && N <= 999) {
        cout << 9 + (N - 99);
    } else if(1000 <= N && N <= 9999) {
        cout << 9 + 900;
    } else if(10000 <= N && N <= 99999) {
        cout << 9 + 900 + (N - 9999);
    } else if(100000 <= N && N <= 999999) {
        cout << 9 + 900 + 90000;
    }

    return 0;
}


Measured memory_bytes: 256
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

if V[0] == V[A-1]:
    cnt = sum(nCr(a_num,i) for i in range(A,min(B,a_num)+1)) 
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))


Measured memory_bytes: 3316
package main

import "fmt"

func main() {
        var n int
        fmt.Scan(&n)
        fmt.Println(solve(n))
}

func min(x, y int) int {
        if x < y {
                return x
        }
        return y
}

func solve(n int) int {
        if n <= 0 {
                return 0
        }
        s6 := 46656
        for s6 > n {
                s6 /= 6
        }
        s9 := 59049
        for s9 > n {
                s9 /= 9
        }
        return min(solve(n-s6), solve(n-s9)) + 1
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> s(M),c(M);
    for (int j=0; j<M; j++){
        cin >> s[j] >> c[j];
    } 
    for (int i=0; i<1000; i++){
        vector<int> num;
        int cnt=0;
        int n = i;
        if (i==0) num.push_back(n);
        while(n!=0){
            num.push_back(n%10);
            n/=10;
        }
        if (num.size()!=N){
            continue;
        }
        reverse(num.begin(),num.end());
        for (int j=0; j<M; j++){
            if(num[s[j]-1]==c[j]){
                cnt++;
            }
        }
        if (cnt==M){
            for (int x:num){
                cout << x;
            }
            cout << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
#define PB push_back


main(){
  int n;
  while(cin>>n,n){
    vector<int> biru[2];
    rep(i,2){
      rep(j,n){
        int t;
        cin>>t;
        biru[i].PB(t);
      }
    }

    int ans=-1;
    queue<pair<PI,int> > Q;//biru,takasa,cost;
    Q.push(MP(MP(0,0),0));
    Q.push(MP(MP(1,0),0));
    set<PI> dp;
    while(!Q.empty()){
      int b=Q.front().first.first,st=Q.front().first.second,cost=Q.front().second;
      Q.pop();

      if(biru[b][st]==1){
        while(st<n && biru[b][st]==1)++st;
        --st;
      }else if(biru[b][st]==2){
        while(biru[b][st]==2)--st;
      }

      if(dp.count(MP(b,st)))continue;
      dp.insert(MP(b,st));
      if(st==n-1){
        if(ans==-1)ans=cost;
        else ans=min(ans,cost);
        break;
      }

      rep(i,3){
        int ns=st+i;
        if(ns>=n)break;
        if(dp.count(MP(!b,ns)))continue;
        Q.push(MP(MP(!b,ns),cost+1));
      }
    }
    if(ans==-1)cout<<"NA"<<endl;
    else cout<<ans<<endl;
  }
}

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

using namespace std;

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

#define int ll

main(){
	int M,D;
	cin >> M >> D;

	int ans = 0;

	for(int m=1;m<=M;m++){
		for(int d=1;d<=D;d++){
			int d1 = d%10;
			int d10 = d/10;
			if(d1>=2 && d10>=2 && d1*d10==m) ans++;
		}
	}
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[100];scanf("%s",s);int flag=0,flag1=0;
    for(int i=0;i<strlen(s);i++)
    {
        if(s[i]=='C') flag=1;
        if(flag==1&&s[i]=='F') {cout<<"Yes";flag1=1;break;}
    }
    if(flag1==0) cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<algorithm>
using std::cout;
using std::cin;
using std::endl;

int main(void){
    long long answer=1;
    int D, N;
    cin >> D >> N;
    if(N==100)
        N++;
    for (int i = 0; i < D; i++)
    {
        answer *= 100;
    }

    answer *= N;
    cout << answer << endl;

    return 0;
}

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

constexpr auto no_value = numeric_limits<uint64_t>::max();

int main() {
  int n;
  cin >> n;
  vector<vector<int>> edges(n, vector<int>());
  for (int i = 0; i < n; ++i) {
    int u;
    int k;
    cin >> u >> k;
    edges[u - 1].reserve(k);
    for (int j = 0; j < k; ++j) {
      int v;
      cin >> v;
      edges[u - 1].push_back(v - 1);
    }
  }

  vector<vector<int>> mat(n, vector<int>(n, 0));
  for (int i = 0; i < n; ++i) {
    for (auto&& e : edges[i]) {
      mat[i][e] = 1;
    }
  }

  for (auto it = mat.begin(); it != mat.end(); ++it) {
    bool first = true;
    for (auto it2 = it->begin(); it2 != it->end(); ++it2) {
      if (!first) {
        cout << " ";
      }
      first = false;
      cout << *it2;
    }
    cout << endl;
  }
}

Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = 0, b = 0, c = 0; // a>=b>=c
		while (sc.hasNext()) {
			String line = sc.nextLine();
			Scanner s = new Scanner(line);
			int h = s.nextInt();
			if (a < h) {
				c = b;
				b = a;
				a = h;
			} else if (b < h) {
				c = b;
				b = h;
			} else if (c < h) {
				c = h;
			}
		}
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);
	}
}

Measured memory_bytes: 19372
#include <stdio.h>

#define MAX 100
#define less(a,b) (a<b)?a:b

int main(void)
{
  int N, sum=0;
  int B[MAX+1];
  int i;

  scanf("%d",&N);
  for(i=1;i<=N-1;i++)scanf("%d",&B[i]);

  sum = B[1] + B[N-1];
  for(i=2;i<=N-1;i++){
    sum += less(B[i-1],B[i]);
  }
  printf("%d\n",sum);


  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while (true) {
			String s = sc.next();
			if (s.equals("0")) {break;}
			else {
				int sum = 0;
				for (int i=0; i<s.length(); i++) {
					int n = Integer.parseInt(String.valueOf(s.charAt(i)));
					sum += n;
				}
				System.out.println(sum);
			}
		}
	}
}


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

typedef long long LL;

const int N=18,M=262144;

int n,cq,a[M+9],b[M+9];
vector<int>qm[M+9],qid[M+9];

void into(){
  scanf("%d",&n);
  for (int i=1;i<=n;++i)
	scanf("%d%d",&a[i],&b[i]);
  scanf("%d",&cq);
  for (int i=1;i<=cq;++i){
	int x,m;
	scanf("%d%d",&x,&m);
	qm[x].push_back(m);
	qid[x].push_back(i);
  }
}

LL dp[N+9][M+9];

void Get_dp(int d,int k){
  for (int i=0;i<=M;++i){
	dp[d][i]=dp[d-1][i];
	if (i>=b[k]) dp[d][i]=max(dp[d][i],dp[d-1][i-b[k]]+a[k]);
  }
}

vector<int>x,nw;
vector<LL>nv;

void Dfs_now(int k,LL v,int w){
  if (w>M) return;
  if (k>=x.size()){
	nv.push_back(v);
	nw.push_back(w);
	return;
  }
  Dfs_now(k+1,v,w);
  Dfs_now(k+1,v+a[x[k]],w+b[x[k]]);
}

LL ans[M+9];

void Dfs_ans(int k){
  if (k>n) return;
  x.push_back(k);
  nv.clear();nw.clear();
  Dfs_now(0,0,0);
  for (int vs=qm[k].size(),i=0;i<vs;++i){
	int m=qm[k][i],id=qid[k][i];
	for (int vs=nv.size(),j=0;j<vs;++j)
	  if (m>=nw[j]) ans[id]=max(ans[id],nv[j]+dp[9][m-nw[j]]);
  }
  Dfs_ans(k<<1);
  Dfs_ans(k<<1|1);
  x.pop_back();
}

void Dfs_dp(int k,int d){
  if (k>n) return;
  if (d>9){
	Dfs_ans(k);
	return;
  }
  Get_dp(d,k);
  for (int vs=qm[k].size(),i=0;i<vs;++i) ans[qid[k][i]]=dp[d][qm[k][i]];
  Dfs_dp(k<<1,d+1);
  Dfs_dp(k<<1|1,d+1);
}

void work(){
  Dfs_dp(1,1);
}

void outo(){
  for (int i=1;i<=cq;++i)
	printf("%lld\n",ans[i]);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 43564
// be name khoda
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
const ll maxn=100009;
vector <ll> adj[maxn];
ll a[maxn],cnt[maxn];
int main()
{
	ios_base::sync_with_stdio(false);
	ll n; cin>>n; 
	ll maxx=0;
	for (ll i=0;i<n;i++)
	{
		cin>>a[i];
		cnt[a[i]]++; cnt[a[i]+1]++; cnt[a[i]+2]++;
	}
	for (ll i=0;i<maxn-1;i++)
		maxx=max(maxx,cnt[i]);
	cout<<maxx;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,g,h,i;
int main(){
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
  if(a-d==b-e && a-d==c-f && d-g==e-h && d-g==f-i &&
     a-b==d-e && a-b==g-h && b-c==e-f && b-c==h-i){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<cmath>
#include<iomanip>
#define ll long long
using namespace std;
#define rep(n) for(int i=0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<=n;i++)
int main(void){
    // Your code here!
string input[3]{"Sunny", "Cloudy", "Rainy"};
string s;
cin>>s;
rep(3){
    if(s==input[i])
        cout<<input[(i+1)%3];
}

}


Measured memory_bytes: 3032
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;
#define pi 3.14159265358979


int main()
{
	int n, ans = 0;
	cin >> n;
	vector<int>b(n-1);
	vector<int>a(n);
	rep(i, n - 1) cin >> b[i];
	
	ans += b[0];
	ans += b[n - 2];
	for (int i = 1; i < n - 1; i++) ans += min(b[i - 1], b[i]);
	cout << ans;
	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 200010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

vector<vector <int> > G;
vector<int> cost, ans;
int sum = 0;
void dfs(int cur = 1, int prev = 0) {
    sum += cost[cur]; // cur: 現在の位置。
    ans[cur] = sum;
    for(int i: G[cur]) { 
        if (i!=prev) { // 木なので親は2つ以上はない => prevで親を保存して更新しないようにする。
            dfs(i,cur);
        }
    }
    sum -= cost[cur]; // すべての子に対して足し終わったので引く。
}
int main() {
    int N, Q;
    cin >> N >> Q;

    G.resize(N+1);
    cost.resize(N+1);
    ans.resize(N+1);


    int a, b;


    rep(re, N-1) {
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    int p, x;

    rep(i, Q) {
        cin >> p >> x;
        cost[p] += x;
    }

    dfs();
    

    for(int i=1; i<=N; ++i) {
        cout << ans[i] << " ";
    }
    cout << endl;
}



Measured memory_bytes: 24320
n = int(input())
h = [int(i) for i in input().split()]
x = 1
if n == 1:
    print(x)
else:
    if h[1] >= h[0]:
        x += 1

    for i in range(2, n):
            hh = h[0:i]
            if h[i] >= max(hh):
                x += 1
    print(x)

Measured memory_bytes: 3060
class unionfind:
    sz = 0
    par = []
    def __init__(self, n):
        self.sz = n
        for i in range(n):
            self.par.append(-1)

    def find(self, a):
        if self.par[a]<0: return a
        self.par[a] = self.find(self.par[a])
        return self.par[a]
    
    def size(self, a):
        a = self.find(a)
        return -self.par[a]
    
    def same(self, a,b):
        return self.find(a) == self.find(b)

    def unite(self, a,b):
        a = self.find(a)
        b = self.find(b)
        if self.same(a,b): return False
        if self.size(a) < self.size(b):
            a,b=b,a
        self.par[a] += self.par[b]
        self.par[b] = a
        return True

n,q = map(int,input().split())

UF = unionfind(n+1)
for _ in range(q):
    c,a,b = map(int,input().split())
    if c == 0:
        UF.unite(a,b)
    else:
        if UF.same(a,b):
            print(1)
        else : print(0)


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

//solution:
#define int int64_t

void hike() {
    int n; cin >> n;
    map<string, int> hash;
    for(int i = 0; i < n; ++i) {
        string s; cin >> s;
        hash[s]++;
    }
    cout << "AC x " << hash["AC"] << "\n";
    cout << "WA x " << hash["WA"] << "\n";
    cout << "TLE x " << hash["TLE"] << "\n";
    cout << "RE x " << hash["RE"] << "\n";

}

signed main() {
    int t = 1; //cin >> t;
    while(t--) hike();
    return 0;
} //farewell, until we meet again..

Measured memory_bytes: 3628