akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD ((ll)1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)
template<class F,class S>void add(map<F,S>&mp,F f,S s){if(mp.find(f)==mp.end())mp[f]=F();mp[f]+=s;}

int main(){
    int n;
    cin>>n;
    rep(i,n){
        string s;
        cin>>s;
        if(s=="Y"){
            cout<<"Four"<<endl;
            return 0;
        }
    }
    cout<<"Three"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 100005


typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P);
P dequeue(void);
int isEmpty(void);
int isFull(void);



int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
    enqueue(Q[i]);
  }
  
  while(1){

   
    if(Q[head].t>q){
       strcpy(u.name,Q[head].name);
       u.t=Q[head].t-q;
    
       dequeue();
       enqueue(u);
       elaps+=q;
     }
    else if(Q[head].t==q){
	elaps+=q;
	printf("%s %d\n",Q[head].name,elaps);
	dequeue();
	}
    else if(Q[head].t<q){
	elaps+=Q[head].t;
	printf("%s %d\n",Q[head].name,elaps);
	dequeue();
    }
    
      
      if(isEmpty()==1) break;
  }
  
  return 0;
}

int isEmpty(void){
  if(head==tail) return 1;
  else return 0;
}

int isFull(void){
  if(head==(tail+1)%LEN) return 1;
  else return 0;
}


void enqueue(P x){
  if (isFull()==1){
    printf("error\n");
  }
  Q[tail] = x;
  if (tail + 1 == LEN){
    tail = 0;
  }
  else
    tail++;
       }
 

P dequeue(void){
  P x;
  if (isEmpty()==1){
    printf("error\n");
  }
  x = Q[head];
  if (head + 1 == LEN){
    head = 0;
  }
   else
     head++;
  return x;
       }



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

string S;
vector<string> X = {"dream", "dreamer", "erase", "eraser"};

int dp[100005];

int solve(int x)
{
    if(x == S.size())
        return 1;
    
    if(x > S.size())
        return 0;

    if(dp[x] != -1)
        return dp[x];
    
    int ans = 0;

    for(auto y : X)
        if(S.substr(x, y.size()) == y)
            ans |= solve(x+y.size());

    return dp[x] = ans;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    cin >> S;
    memset(dp, -1, sizeof(dp));
    
    if(solve(0))
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}


Measured memory_bytes: 3024
#include <stdio.h>

int main(void)
{
    int prime[1000000]; //prime[i] = 1 ... i is prime number.
    int a, d, n;
    int i, j;
    for (i = 1; i < 1000000; i++) {
	prime[i] = 1;
    }
    prime[1] = 0;
    for (i = 4; i < 1000000; i += 2) {
	prime[i] = 0;
    }
    for (i = 3; i < 1000; i += 2) {
	if (prime[i] == 0) continue;
	for (j = i * i; j < 1000000; j += i) {
	    prime[j] = 0;
	}
    }

    while(1) {
	scanf("%d %d %d", &a, &d, &n);
	if (a == 0) break;
	i = 0;
	while(1) {
	    if (prime[a + d * i]) {
		n--;
	    }
	    if (n == 0) break;
	    i++;
	}
	printf("%d\n", a + d * i);
    }
    return 0;
}

Measured memory_bytes: 4932
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
// VAR(int, x);
#define VAR(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { std::cin >> first; Scan(rest...); }
#define OUT(d) std::cout<<d;
#define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d;
#define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d;
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define ENDL std::cout<<std::endl;
#define FLUSH std::cout<<std::flush;
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
#define PAIR std::pair<int, int>
#define IN(a, x, b) (a<=x && x<=b)
#define IN2(a0, y, a1, b0, x, b1) (a0<=y && y<a1 && b0<=x && x<b1)
#define SHOW(d) {std::cout << #d << "\t:" << d << "\n";}
#define SHOWVECTOR(v) {std::cout << #v << "\t:";for(const auto& i : v){std::cout << i << " ";}std::cout << "\n";}
#define SHOWVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout << j << " ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout<<'('<<j.first<<", "<<j.second<<") ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR(v) {for(const auto& i:v){std::cout<<'('<<i.first<<", "<<i.second<<") ";}std::cout<<"\n";}
#define CHECKTIME(state) {auto start=std::chrono::system_clock::now();state();auto end=std::chrono::system_clock::now();auto res=std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count();std::cerr<<"[Time:"<<res<<"ns  ("<<res/(1.0e9)<<"s)]\n";}

//#define int ll
using ll = long long;
constexpr int INFINT = 1 << 30;
constexpr ll INFLL = 1LL << 60;
constexpr double EPS = 0.0000001;
constexpr int MOD = 1000000007;

signed main() {
	INIT;
	VEC(int, a, 3);
	std::sort(ALL(a));
	if (a == std::vector<int>{5, 5, 7}) {
		OUT("YES")BR;
	}
	else {
		OUT("NO")BR;
	}
	return 0;
}

Measured memory_bytes: 256
/* 
 * Project: AtCoder Beginners Contest 069 A - K-City
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/04
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int n, m;

void solve() {

    int ward = (n-1) * (m-1);
    printf("%d\n", ward);

}

int main() {

    scanf("%d", &n);
    scanf("%d", &m);

    solve();

}

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

double find_standard_deviation(double n, std::vector<double> s){
    double temp_sum1 = 0.0;
    for(int i = 0; i < n; i++) temp_sum1 += s[i];
    double average = temp_sum1 / n;
    
    double temp_sum2 = 0.0;
    for(int i = 0; i < n; i++) temp_sum2 += (s[i] - average) * (s[i] - average);
    
    double sd = std::pow(temp_sum2 / n, 0.5);
    return sd;
}

int main(){
    double n;
    
    while(1){
        std::cin >> n;
        
        if(n == 0) break;
        
        std::vector<double> s(n);
        for(int i = 0; i < n; i++) std::cin >> s[i];
        
        double ans = find_standard_deviation(n, s);
        printf("%lf\n", ans);
    }
}


Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int k = sc.nextInt();
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		int d[] = new int[n];
		d[0] = a[0] + (k - a[n - 1]);
		int max = d[0];
		
		for(int i = 1; i < n; i++) {
			d[i] = a[i] - a[i - 1];
			max = Math.max(max, d[i]);
		}
		
		System.out.println(k - max);
	}

}


Measured memory_bytes: 84968
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

ll ma = 3234566667;
map<ll, int> d;

void Search(ll n) {
	if (n <= ma)
		d[n];
	else
		return;
	if (n % 10)
		Search(n * 10 + (n % 10) - 1);
	Search(n * 10 + (n % 10));
	if(n % 10 < 9)
		Search(n * 10 + (n % 10) + 1);
}

int main(void) {
	ll num, i, k;
	cin >> k;
	for (i = 1; i < 10; i++)
		Search(i);
	auto it = d.begin();
	rep(i, k - 1)
		it++;
	cout << (*it).first << "\n";
	return 0;
}

Measured memory_bytes: 8448
<?php
// D
fscanf(STDIN, '%d %d', $n, $m);
for ($i  = 0; $i < $m; $i++) {
    fscanf(STDIN, '%d %d', $a, $b);
    $a--;
    $b--;
    if (isset($x[$a])) {
        $x[$a] = min($x[$a], $b);
    } else {
        $x[$a] = $b;
    }
}
asort($x);
$ans = 0;
$prem = -1; // 直前に取り除いた橋
foreach ($x as $l => $r) {
    if ($l > $prem) {
        $ans++;
        $prem = $r - 1;
    }
}
echo $ans;

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define debug(x) cout << (x) << "\n";
#define mp make_pair
#define pb push_back

constexpr auto inf = numeric_limits<int>().max();
constexpr auto llinf = numeric_limits<ll>().max();

template<typename ForwardIterator>
void dump(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << *it << " ";
	}
	cout << "\n";
}

template<typename ForwardIterator>
void dump_map(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << (*it).first << ":" << (*it).second << " ";
	}
	cout << "\n";
}

void solve() {
  int x[6];
  rep(i, 5) cin >> x[i];
  rep(i, 5) {
    if (x[i] == 0) {
      cout << i + 1;
    }
  }
	cout << "\n";
}

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

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a > b) System.out.println("a > b");
		else if(a < b) System.out.println("a < b");
		else System.out.println("a == b");
	}

}

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

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	fastio
	int n;
	cin >> n;
	int a[n], b[n];
	for(auto &x : a) cin >> x;
	for(int i = 0;i < n;i++){
		b[i] = a[i];
		if(i!=0) b[i] += b[i-1];
	}
	int dp[n][n];
	memset(dp,0,sizeof dp);
	for(int i = 1;i < n;i++){
		for(int j = 0;j+i < n;j++){
			int l = j, r = j+i;
			dp[l][r] = 1e18;
			for(int k = l;k < r;k++){
				dp[l][r] = min( dp[l][r], dp[l][k] + dp[k+1][r] + b[r] - (l==0 ? 0 : b[l-1]) );
			//	cout << l << " " << r << "  " << k << "     ";
			}
		}
		cout << endl ;
	}
	cout << dp[0][n-1] << "\n";
}

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

int str2i(string s) {
  int i = s.at(1) - '0';
  return i;
}

int main() {
  // Input
  int N;
  cin >> N;
  
  vector<string> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  // Compute
  // Bubble sort
  vector<string> A_bs(N);
  A_bs = A;
  string temp;
  for (int i = 0; i < N; i++) {
    for (int j = N - 1; j > i; j--) {
      if (str2i(A_bs.at(j-1)) > str2i(A_bs.at(j))) {
        temp = A_bs.at(j-1);
        A_bs.at(j-1) = A_bs.at(j);
        A_bs.at(j) = temp;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    if (i != 0) {
      cout << " ";
    }
    cout << A_bs.at(i);
  }
  cout << endl;
  cout << "Stable" << endl;
  
  // Selection sort
  vector<string> A_ss(N);
  A_ss = A;
  int min_j;
  for (int i = 0; i < N; i++) {
    min_j = i;
    for (int j = i; j < N; j++) {
      if (str2i(A_ss.at(j)) < str2i(A_ss.at(min_j))) {
        min_j = j;
      }
    }
    temp = A_ss.at(i);
    A_ss.at(i) = A_ss.at(min_j);
    A_ss.at(min_j) = temp;
  }
  
  for (int i = 0; i < N; i++) {
    if (i != 0) {
      cout << " ";
    }
    cout << A_ss.at(i);
  }
  cout << endl;
  
  if (A_ss == A_bs) {
    cout << "Stable" << endl;
  }
  else {
    cout << "Not stable" << endl;
  }
}


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

#include <iostream>

using namespace std;

int main()
{
    int S;
    double h, m, s;
    cin >> S;
    h = int(S / 3600);
    m = int((S - h * 3600) / 60);
    s = S - h * 3600 - m * 60;
    cout << h << ":" << m << ":" << s << endl;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します



Measured memory_bytes: 3284
#include <iostream>
#include <math.h> 
using namespace std;

bool IsPrime(int num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int X;
    cin >> X;
    for (;; X++) {
        if (IsPrime(X)) break;
    }
    cout << X << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  char a,b,c;
  cin>>a>>b>>c;
  if(a=='1')cout<<9;
  else cout<<1;
  if(b=='1')cout<<9;
  else cout<<1;
  if(c=='1')cout<<9;
  else cout<<1;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define P pair<ll,ll>
#define V vector<ll>

#define rep(i,n) for(ll i = 0; i < (n); i++)
#define repd(i,n) for(ll i = (n); i >= 0; i--)
#define FOR(i,t,n) for(ll i = (t); i < (n); i++)
#define FORD(i,t,n) for(ll i = (n); i >= t; i--)
#define ALL(x) x.begin(),x.end()
#define asort(x) sort(ALL(x))

int main() {
    int l, r, d, ans = 0;
    cin >> l >> r >> d;
    for(int i = 0; i <= r; i+=d) {
        if(i < l) continue;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    n=n%10;
    if (n==2||n==4||n==5||n==7||n==9){
        cout <<"hon";
    }
    if (n==0||n==1||n==6||n==8){
        cout <<"pon";
    }
    if (n==3){
        cout <<"bon";
    }
}


Measured memory_bytes: 3632
n=int(input())
a=list(map(int,input().split()))
import sys

b=a[0]
if a.count(0)>0:
    print(0)
    sys.exit()

for i in range(1,n):
    b*=a[i]
    if b>1000000000000000000:
        print(-1)
        sys.exit()

print(b)

Measured memory_bytes: 21660
def resolve():
    A = [int(i) for i in input().split()]
    sumA = 0
    for a in A:
        if a == 1:
            sumA += 300000
        elif a == 2:
            sumA += 200000
        elif a == 3:
            sumA += 100000
    if max(A) == 1:
        sumA += 400000
    print(sumA)

resolve()


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

int main(){
  //cout << fixed << setprecision(10);
  int n; cin>>n;
  int ans;
  ans = n/2;
  if(n%2==0){
    ans --;
  }
  if(n==1){
    ans = 0;
  }
  cout<<ans<<endl;
}


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

int main() 
{
  int H, W;
  cin >> H >> W;
  vector <string> A(H);
  for (int i=0; i<H; i++)
  {
    cin >> A.at(i);
  }
  for (int i=0; i<W+2; i++)
  {
    cout << "#";
  }
  cout << endl;
  for (int i=0; i<H; i++)
  {
    cout << "#" << A.at(i) << "#" << endl;
  }
  for (int i=0; i<W+2; i++)
  {
    cout << "#";
  }
  cout << endl;
  
}

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

int main(void) {
	int i,j,k,m,h[100],count;
	char card[201],copy[201];
	
	while(1){
		scanf("%s",card);
		if(strcmp(card,"-")==0){
			break;
		}
		count =strlen(card);
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%d",&h[i]);
			for(j=0;j<h[i];j++){
				copy[j] = card[j];
			}
		for(j=0;j<count - h[i];j++){
			card[j] = card[h[i]+j];
		}
		for(j =0;j<h[i];j++){
			card[count-h[i]+j]=copy[j];
		}
		}
		printf("%s\n",card);
	}
	
	return 0;
}

Measured memory_bytes: 1812
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    x=input()
    case=1
    while x!=0:
        print("Case {}: {}".format(case,x))
        case+=1
        x=int(input())

main()



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

class Main {
	Scanner sc;
	int N;
	int[] P;
	
	private void calc() {
		sc = new Scanner(new BufferedInputStream(System.in));
		int N = sc.nextInt();
		P = new int[N];
		for (int i = 0; i < N; i++) P[i] = sc.nextInt();

		int c = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			if (min > P[i]) c++;
			min = Math.min(min, P[i]);
		}

		System.out.println(c);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}


Measured memory_bytes: 64700
w, h, x, y, r = map(int, input().split())
xr = x + r
xl = x + r
yu = y + r
yd = y + r


if x < 0 or y < 0:
    print('No')
elif xr in range(0,w+1) and xl in range(0,w+1):
    if yu in range(0,h+1) and yd in range(0,h+1):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 7672
#include <bits/stdc++.h>
using namespace std;
int main () {
  char b;
  cin >> b;
  if(b == 'A') cout << 'T' << endl;
  else if(b == 'T') cout << 'A' << endl;
  else if(b == 'G') cout << 'C' << endl;
  else if(b == 'C') cout << 'G' << endl;
  return 0;
}

Measured memory_bytes: 256
import numpy as np

N,C = list(map(int, input().split()))
XV = [list(map(int, input().split())) for _ in range(N)]
X = np.array([0] + [x for x,v in XV])
V = np.array([0] + [v for x,v in XV])

V_cw_cumsum = V.cumsum()

right_one_ways = V_cw_cumsum - X

V_ccw_cumsum = V[::-1].cumsum()[::-1]

left_one_ways = V_ccw_cumsum - (C-X)

def reduce_each(func, l):
  temp = l.copy()
  for i in range(1,len(l)):
    temp[i] = func(temp[i-1], temp[i])
  return temp


additional_left = np.roll(reduce_each(max, left_one_ways[::-1])[::-1], -1)
additional_left[-1] = 0
right_to_left = V_cw_cumsum - 2*X + additional_left

additional_right = np.roll(reduce_each(max, right_one_ways), 1)
additional_right[0] = 0
left_to_right = V_ccw_cumsum - 2*(C-X) + additional_right

print(max(max(right_one_ways),
          max(left_one_ways),
          max(right_to_left),
          max(left_to_right)))

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

template<typename T> T LargestRectangle(vector<T>& h)
{
   // be careful not to overflow
   int N=h.size();
   vector<int> l(N),r(N);
   stack<int> S;
   for(int i=0;i<N;i++){
      while(!S.empty() and h[S.top()]>=h[i]) S.pop();
      l[i]=(S.empty()? 0:S.top()+1); S.push(i);
   }
   S=stack<int>();
   for(int i=N-1;i>=0;i--){
      while(!S.empty() and h[S.top()]>=h[i]) S.pop();
      r[i]=(S.empty()? N:S.top()); S.push(i);
   }
   T res=0;
   for(int i=0;i<N;i++) res=max(res,h[i]*(r[i]-l[i]));
   return res;
}

int main()
{
   int H,W; cin>>H>>W;
   vector<vector<int>> c(H,vector<int>(W));
   for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin>>c[i][j];

   vector<vector<int>> cntU(H,vector<int>(W));
   for(int j=0;j<W;j++){
      int cnt=0;
      for(int i=0;i<H;i++){
         if(c[i][j]) cnt=0; else cnt++;
         cntU[i][j]=cnt;
      }
   }
   int ans=0;
   for(int i=0;i<H;i++) ans=max(ans,LargestRectangle(cntU[i]));
   cout<<ans<<endl;
   return 0;
}



Measured memory_bytes: 18104
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val dList = readLine()!!.split(" ").map { it.toInt() }
  var sum = 0L
  for (x in 0 until n - 1) {
    for (y in x + 1 until n) {
      sum += dList[x] * dList[y]
    }
  }
  println(sum)
}


Measured memory_bytes: 35948
IDENTIFICATION DIVISION.
PROGRAM-ID. 169C.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP        PIC X(30).
01 A          PIC 9(16).
01 B          PIC 9V99.
01 OUT        PIC Z(16)9.
*>
PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ' '
      INTO A B.
*>
  COMPUTE OUT = A * B.
*>
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.


Measured memory_bytes: 3940
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x1= sc.nextDouble(),y1= sc.nextDouble(),x2=sc.nextDouble(),y2=sc.nextDouble();
		double xd= Math.abs((x1-x2));
		double xd2 = Math.pow(xd, 2);
		double yd = Math.abs((y1-y2));
		double yd2 = Math.pow(yd, 2);
		double distance = Math.sqrt(xd2+yd2);
		System.out.printf("%9f",distance);
		System.out.println();
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll>pll;

ll n,x[100010]={0},y[100010]={0};
vector<pll>vx,vy;
vector<pll>edge[100010];
priority_queue<pll,vector<pll>,greater<pll>>q;
//priority_queue<pll>q;
bool used[100010];
ll res=0;

signed main(){

    cin>>n;
    for(int i=0;i<n;++i){
        cin>>x[i]>>y[i];
        vx.push_back(pll(x[i],i));
        vy.push_back(pll(y[i],i));
    }

    sort(vx.begin(),vx.end());
    sort(vy.begin(),vy.end());
    for(int i=0;i<n-1;++i){
        ll j=vx[i].second,k=vx[i+1].second;
        ll wj=vx[i].first,wk=vx[i+1].first;
        edge[j].push_back(pll(wk-wj,k));
        edge[k].push_back(pll(wk-wj,j));
        j=vy[i].second,k=vy[i+1].second;
        wj=vy[i].first,wk=vy[i+1].first;
        edge[j].push_back(pll(wk-wj,k));
        edge[k].push_back(pll(wk-wj,j));
    }

    for(int i=0;i<n;++i){
        used[i]=false;
    }
    int c=1;
    for(int i=0;i<edge[0].size();++i)q.push(edge[0][i]);
    used[0]=true;
    while(c<n){
        pll t=q.top();
        q.pop();
        if(!used[t.second]){
            res+=t.first;
            for(int i=0;i<edge[t.second].size();++i){
                q.push(edge[t.second][i]);
            }
            used[t.second]=true;
            c++;
            //cout<<t.first<<" "<<t.second<<endl;
        }
    }

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 21988
#include<iostream>

using namespace std;

long long N,M;
int i,j;
long long a[105];
long long b[105];

void solver(long long n){
	if(n==1){
		i++;
		b[i]=M--;
		return ;
	}
	if(n&1) {
		i++;
		b[i]=M--;;
		solver(n>>=1);
		
	}
	else{
		j++;
		a[j]=M--;
		solver(n-1);
	}
}

int main()
{
	long long N;
	cin>>N;
	M=100;
	solver(N);
	cout<<2*(i+j)<<endl;
	for(int m=1;m<=j;m++){
		cout<<a[m]<<" ";
	}
	for(int m=i;m>=1;m--){
		cout<<b[m]<<" ";
	}
	
//	cout<<" ! "<<i<<" ! "<<j<<"!";
	for(int m=101-i-j;m<=100;m++){
		cout<<m<<" ";
	}
	return 0;
}


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

using namespace std;

int main(){
	long long int mod_num = pow(10, 9.0) + 7;
	int n,m;
	int res = 1;
	int judge = -1;

	cin >> n;
	int pre_data[n];

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

	for (int i = 0; i < n; ++i)
	{
		int tmp;
		cin >> tmp;
		if (tmp==0)
		{
			pre_data[tmp/2] += 2;
		}
		else
		{
			++pre_data[tmp/2];
		}
	}

	for (int i = 0; i < n/2; ++i)
	{
		if (pre_data[i]!=2)
		{
			cout << 0 << endl;
			return 0;
		}
	}

	if (n%2==0)
	{
		for (int i = 0; i < n/2; ++i)
		{
			res = (res*2)%mod_num;
		}
	}
	else
	{
		for (int i = 0; i < (n-1)/2; ++i)
		{
			res = (res*2)%mod_num;
		}		
	}

	cout << res << endl;

	return 0;

}

Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	string S; cin >> S;
	int flag = 0;
	if (S[0] != 'A') flag = 1;
	int idx = -1;
	rep(i, S.length()) {
		if (S[i] == 'C') {
			if (idx != -1) flag = 2;
			idx = i;
		}
	}
	if (idx < 2 || idx > S.length() - 2) flag = 3;

	rep(i, S.length()) {
		if (i == 0 || i == idx) continue;
		if (S[i] < 'a') flag = 4;
	}
	if (flag == 0) cout << "AC" << endl;
	else cout << "WA" << endl;

    return 0;
}


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

int main() {
  int N, K;
  std::cin >> N >> K;
  int num_of_cases = K;
  for (int i = 1; i < N; i++) {
    num_of_cases *= (K - 1);
  }
  std::cout << num_of_cases << std::endl;
}

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

const int N = 1e5 + 100;
#define int long long

int n, m, x[N], a[N];
int s[N], p[N];
int tot, k;
int bel[N], dep[N];
int vis[N];
vector <int> v[N];

void dfs(int u, int depth) {
  dep[u] = depth;
  vis[u] = 1;
  bel[u] = tot;
  v[tot].push_back(u);
  if (!vis[p[u]]) {
    dfs(p[u], depth + 1);
  }
}

signed main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x[i]);
  }
  for (int i = 1; i < n; i++) {
    s[i] = x[i + 1] - x[i];
    p[i] = i;
  }
  scanf("%lld %lld", &m, &k);
  for (int i = 1; i <= m; i++) {
    scanf("%lld", &a[i]);
    swap(p[a[i]], p[a[i] - 1]);
  }
  for (int i = 1; i < n; i++) {
    if (vis[i] == 0) {
      tot++;
      dfs(i, 0);
    }
  }
  printf("%lld\n", x[1]);
  int cur = x[1];
  for (int i = 1; i < n; i++) {
    cur += s[v[bel[i]][(dep[i] + k) % v[bel[i]].size()]];
    printf("%lld\n", cur);
  }
  return 0;
}

Measured memory_bytes: 13044
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int d;
  cin>>d;
  int y=0;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
	if(i*500+j*100+k*50==d){
	  //cout<<i<<" "<<j<<" "<<k<<"\n";
	  y++;
      }
      }
    }
  }
  cout<<y<<"\n";
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n;
	cin >> n;
	vector<int>A(n), B(n);
	rep(i, n)cin >> A[i] >> B[i];
	ll btn = 0;
	if (A[n - 1] % B[n - 1] != 0)btn = ll((B[n - 1] * ceil(double(A[n - 1]) / double(B[n - 1]))) - A[n - 1]);
	for (int i = n - 2; i >= 0; i--) {
		if ((A[i] + btn) % B[i] != 0)btn += ll((B[i] * ceil(double(A[i] + btn) / double(B[i]))) - (A[i]+ btn));
	}
	cout << btn << endl;
	return 0;
}



Measured memory_bytes: 3996
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, a_ratio, b_ratio = LI()
L = LIR(n)
A, B, cost = [[L[i][j] for i in range(n)] for j in range(3)]
dp = [[INF] * 401 for _ in range(401)]
dp[0][0] = 0
for i in range(n):
    for j in range(401, -1, -1):
        for k in range(401, -1, -1):
            if 0 <= j + A[i] <= 400 and 0 <= k + B[i] <= 400:
                dp[j + A[i]][k + B[i]] = min(dp[j + A[i]][k + B[i]], dp[j][k] + cost[i])



ans = INF
for l in range(1, min(400 // b_ratio, 400 // a_ratio)):
    ans = min(ans, dp[a_ratio * l][b_ratio * l])


if ans == INF:
    print(-1)
else:
    print(ans)


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

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    rep(i, m) cin >> a.at(i);

    int tozero = 0, ton = 0;
    rep(i, m) {
        if(x < a.at(i)) ton++;
        if(a.at(i) < x) tozero++;
    }
    cout << min(tozero, ton) << endl;
    return 0;
}

Measured memory_bytes: 256
X = int(input())

mid = -150
for A in range(-149,150):
    B1 = -150
    B2 = A-1
    A5 = A**5
    while B2-B1>1:
        mid = (B1+B2)/2
        if A5 - int(mid)**5 == X:
            break
        elif A5 - mid**5 <= X:
            B2 = mid
        else:
            B1 = mid
    if A5 - int(mid)**5 == X:
        break

print(A,int(mid))

Measured memory_bytes: 9496
n=int(input())
C=[0]*(n+1)
for i in range(2,n+1):
    tmp=i
    for j in range(2,i+1):
        while tmp%j==0:
            C[j]+=1
            tmp//=j
def num(n):
    return len(list(filter(lambda x:x>=n-1,C)))
print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)

Measured memory_bytes: 3064
import sys

array = list(map(int, input().strip().split(' ')))

N = array[0]


if N < 1:
    sys.exit()
if N > 1000:
    sys.exit()

#print("Aok")



array1 = list(map(int, input().strip().split(' ')))

T = array1[0]
A = array1[1]


if T < 0:
    sys.exit()
if T > 50:
    sys.exit()

if A < -60:
    sys.exit()
if A > T:
    sys.exit()

array2 = list(map(int, input().strip().split(' ')))

kazu = len(array2)

if kazu != N:
    sys.exit()

saiteki = 0

saiteki = 10**5

for i in range(N):

    #print("i",i)

    kensa = T - array2[i] * 0.006

    kensa1 = abs(A - kensa)

    if saiteki > kensa1:
        saiteki = kensa1
        saiteki_no = i


saiteki_no = saiteki_no + 1

print(saiteki_no)


Measured memory_bytes: 3188
<?php
fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);

$t_zero = intdiv($a + $d - 1, $d);
$a_zero = intdiv($c + $b - 1, $b);

if ($t_zero >= $a_zero) {
    print("Yes");
} else {
    print("No");
}

Measured memory_bytes: 16180
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.math.BigInteger;

public class Main {	

	static int[] F;
	
	public static void main(String[] args) throws Exception {
		
		//int N = scan.nextInt();
		//long L = scan.nextLong();
		//double D = scan.nextDouble();
		//char[] A = scan.next().toCharArray();
		
		int N = scan.nextInt();
		out.println(N*N);
		
		out.flush();
	}

	static FastScanner scan = new FastScanner();
	static PrintWriter out = new PrintWriter(System.out);			 
	static long MOD = 1_000_000_007;

	static int[] dx = {1,-1,0,0};
	static int[] dy = {0,0,1,-1};
	static int[] dx8 = {1,-1,0,0,1,1,-1,-1};
	static int[] dy8 = {0,0,1,-1,1,-1,1,-1};

	//GCD最大公約数を返す
	static long gcd(long a, long b){
		if(b == 0) return a;
		return gcd(b, a%b);
	}

	//aとbの最小公倍数を返す
	static long lcm (long a, long b) {
		return ((a/gcd(a,b))*b);
	}
	
	//入力
	//https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        if (!hasNext()) throw new NoSuchElementException();
	        long n = 0;
	        boolean minus = false;
	        int b = readByte();
	        if (b == '-') {
	            minus = true;
	            b = readByte();
	        }
	        if (b < '0' || '9' < b) {
	            throw new NumberFormatException();
	        }
	        while(true){
	            if ('0' <= b && b <= '9') {
	                n *= 10;
	                n += b - '0';
	            }else if(b == -1 || !isPrintableChar(b)){
	                return minus ? -n : n;
	            }else{
	                throw new NumberFormatException();
	            }
	            b = readByte();
	        }
	    }
	    public int nextInt() {
	        long nl = nextLong();
	        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
	        return (int) nl;
	    }
	    public double nextDouble() { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 32540
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int a[100];

int main()
{
	int n;

	cin >> n;
	rep(i, n) cin >> a[i];

	rrepc(i, n - 1, 1) cout << a[i] << ' ';
	cout << a[0] << endl;


	return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;

using namespace std;

ll get(ll n, pair<ll,ll> a)
{
    return (n)*(a.first-1) + a.second;
}

bool isCyclicUtil(ll v, bool visited[], bool *recStack, vector<ll> adj[]) 
{ 
    if(visited[v] == false) 
    { 
        visited[v] = true; 
        recStack[v] = true; 
        //list<ll>::iterator i; 
        for(auto i = adj[v].begin(); i != adj[v].end(); ++i) 
        { 
            if ( !visited[*i] && isCyclicUtil(*i, visited, recStack, adj) ) 
                return true; 
            else if (recStack[*i]) 
                return true; 
        } 
  
    } 
    recStack[v] = false;   
    return false; 
} 
  
bool isCyclic(ll V, vector<ll> adj[]) 
{ 
    bool *visited = new bool[V]; 
    bool *recStack = new bool[V]; 
    for(ll i = 0; i < V; i++) 
    { 
        visited[i] = false; 
        recStack[i] = false; 
    } 
    
    for(ll i = 0; i < V; i++) 
        if (isCyclicUtil(i, visited, recStack,adj)) 
            return true; 
  
    return false; 
} 

ll get(ll i, ll store[], vector<ll> hold[])
{
    if(store[i]!=-1)
        return store[i];
    if(hold[i].size() == 0)
        return 1;
    ll temp =0;
           for(auto it = hold[i].begin();it!=hold[i].end();it++)
           {
               temp = max(temp, get(*it,store,hold));
           }
    return store[i] = temp+1;       
}

int main()
{
   FAST/**/
    
   ll n;
   cin>>n;
   
   ll siz = n*(n-1);
   siz/=2;
   
   ll store[2*siz+5];
   memset(store,-1,sizeof(store));
   
   vector<ll> hold[2*siz+5];
   for(ll i=1;i<=n;i++)
   {
       ll temp1;
       cin>>temp1;
       //cout<<"for "<<i<<"\n";
       pair<ll,ll> prev = make_pair(min(i,temp1), max(i, temp1));
       //cout<<get(n,prev)<<" ";
       
       for(ll j=2;j<=n-1;j++)
       {
           ll temp;
           cin>>temp;
           pair<ll,ll> curr = make_pair(min(i,temp), max(i,temp));
           //cout<<get(n,curr)<<" ";
           hold[get(n,prev)-1].push_back(get(n,curr)-1);
           prev = curr;
       }
       //cout<<"\n";
   }
   
   bool temp = isCyclic(2*siz+5, hold);
   if(temp)
        cout<<-1;
   else
   {
       ll ans = 0;
       for(ll i=0;i<2*siz+5;i++)
       {
           ans = max(ans, get(i,store,hold));
       }
       cout<<ans;
   }
   
   
   
   return 0;
}

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

class Dice{
	private:
		int temp;

	public:
		int e1,e2,e3,e4,e5,e6 = {};

		void set_eyes(int v1, int v2, int v3,
				int v4, int v5, int v6){
			e1 = v1; e2 = v2; e3 = v3;
			e4 = v4; e5 = v5; e6 = v6;
		}

		void rotate(char direction){
			switch(direction){
				case 'N':
					temp=e1;
					e1=e2; e2=e6; e6=e5; e5=temp;	
					break;
				case 'E':
					temp=e1;
					e1=e4; e4=e6; e6=e3; e3=temp;
					break;
				case 'S':
					temp=e1;
					e1=e5; e5=e6; e6=e2; e2=temp;
					break;
				case 'W':
					temp=e1;
					e1=e3; e3=e6; e6=e4; e4=temp;
					break;
			}
		}

		int return_top(){
			return e1;
		}
};

int main(){
	int v1,v2,v3,v4,v5,v6={};
	string directions;
	
	cin >>v1>>v2>>v3>>v4>>v5>>v6;
	cin >> directions;

	Dice Dice1;
	Dice1.set_eyes(v1,v2,v3,v4,v5,v6);

	for(int i=0;i<directions.length();i++){
		Dice1.rotate(directions[i]);
	}

	cout << Dice1.return_top() << endl;

	return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define MAX 100000

int n, d[2][MAX];
vector<int> e[MAX];
bool b[2][MAX];

void dfs(int i, int s, int k){
	b[i][s]=true;
	d[i][s]=k;
	for(int j=0; j<e[s].size(); j++){
		if(!b[i][e[s][j]]){
			dfs(i, e[s][j], k+1);
		}
	}
	return;
}

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

	for(int i=0; i<2; i++){
		for(int j=0; j<n; j++){
			b[i][j]=false;
		}
	}

	dfs(0, 0, 0);
	dfs(1, n-1, 0);

	int cnt1=0, cnt2=0;
	for(int i=0; i<n; i++){
		if(d[0][i]<=d[1][i]) cnt1++;
		else cnt2++;
	}
	if(cnt1>cnt2) cout << "Fennec" << endl;
	else cout << "Snuke" << endl;
	return 0;
}

Measured memory_bytes: 12928
S, T = readlines.map(&:chomp)

h = S.each_char.with_index.with_object(Hash.new{|h, k| h[k] = []}){|(c, i), o| o[c] << i}
i, j = -1, 0
T.chars do |c|
  (puts -1; exit) if h[c].empty?
  i = h[c].bsearch{|v| v > i}
  unless i
    i = h[c].first
    j += 1
  end
end
puts S.length * j + i + 1

Measured memory_bytes: 3196
import numpy as np


N, M = map(int, input().split())
s_mat = np.zeros((M, N), dtype=int)
si_list = []
for i in range(M):
    si = list(map(int, input().split()))[1:]
    for s in si:
        s_mat[i, s-1] = 1
p_list = np.array(list(map(int, input().split())))


prob = 0
for i in range(2**N):
    i_list = []
    for k in range(N-1, -1, -1):
        if i >= 2**k:
            amari = 1
            i -= 2**k
        else:
            amari = 0
        i_list.append(amari)
        
    i_array = s_mat.dot(np.array(i_list)) % 2
    if np.all(i_array == p_list):
        prob += 1

print(prob)


Measured memory_bytes: 12508
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = (a[i]+1)/2
ans = sum(a[0:0+k])
tmp = sum(a[0:0+k])
for i in range(n-k):
    tmp -= a[i]
    tmp += a[i+k]
    if tmp > ans:
        ans = tmp
print(ans)


Measured memory_bytes: 25060
#include <stdio.h>

int main(){
    int n, i, j, check=0;

    scanf("%d", &n);

    for(i=0; i<=n/4; i++){
        for(j=0; j<=n/7; j++){
            if(i*4 + j*7 == n){
                check=1;
                break;
            }
        }

        if(check == 1)
            break;
    }

    if(check == 1)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

Measured memory_bytes: 128
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

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

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::collections::BTreeSet;

fn main() {
    let args: Vec<u32> = read_vec();
    let a = args[0];
    let b = args[1];
    let c = args[2];
    let d = args[3];
    let e = args[4];
    let f = args[5];
    let mut water = BTreeSet::new();
    for i in 0..31 {
        for j in 0..31 {
            if i == 0 && j == 0 {
                continue;
            }
            let tmp = 100 * (a * i + b * j);
            if tmp <= f {
                water.insert(tmp);
            }
        }
    }

    let mut salt = BTreeSet::new();
    for i in 0..101 {
        for j in 0..101 {
            let tmp = c * i + d * j;
            if tmp <= f / 2 {
                salt.insert(tmp);
            }
        }
    }

    let wv: Vec<u32> = water.iter().map(|w| *w).collect();
    let sv: Vec<u32> = salt.iter().map(|s| *s).collect();
    let mut wa: u32 = 100 * a;
    let mut sa: u32 = 0;

    for w in &wv {
        for s in &sv {
            if w + s > f || e * w < s * 100 {
                continue;
            }
            if sa * w < s * wa {
                wa = *w;
                sa = *s;
            }
        }
    }

    println!("{} {}", wa + sa, sa);
}


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

int main()
{
  long double a,b,c;
  cin >> a >> b >> c;
  if(a+b-c + (2*sqrt(a*b)) < 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int a, b;
  cin >> a >> b;

  if (a == b){
    cout << "Draw" << endl;
  }else if (a == 1){
    cout << "Alice" << endl;
  }else if (b == 1){
    cout << "Bob" << endl;
  }else if (a > b){
    cout << "Alice" << endl;
  }else{
    cout << "Bob" << endl;
  }
}


Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <map>
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
using namespace std;

int main() {
	int x,a,b;
	cin >> x >> a >> b;
	cout << (x - a) % b;
	return 0;
}

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

#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;



long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}


//約数をベクトル形式で返す
vector<int> vect_yakusuu(int n) {
	vector<int> ret;
	for (int i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			ret.push_back(i);
			if (i*i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return ret;
}

int popcount(int A) {
	int count = 0;
	while (1) {
		if (A == 0) {
			break;
		}
		if (A % 2 == 1) {
			count++;
		}
		A = A / 2;
	}
	return count;
}

int main() {

	long long N,D,X[200100],Y[200100];
	long long ans;

	cin >> N >>D;

	for (int i = 0; i < N; i++) {
		cin >> X[i] >> Y[i];
	}

	ans = 0;

	for (int i = 0; i < N; i++) {
		if (X[i] * X[i] + Y[i] * Y[i] <= D*D) {
			ans++;
		}
	}

	cout <<ans <<endl;

	cin >> N;

	return 0;


}

Measured memory_bytes: 6756
#include <stdio.h>
#include <stdlib.h>
 
int comparador(const void *a, const void *b){
    return (*(int*)a - *(int*)b);
}
 
int main(){
    int n;
    scanf("%d", &n);
    int vetor[n];
    int vetor2[1000001] = {0};
    int multi, cont = 0, maior = 0, igual = 0;
 
    for(int i = 0; i < n; ++i){
        scanf("%d", &vetor[i]);
        if(vetor[i] > maior)
            maior = vetor[i];
    }
 
    qsort(vetor, n, sizeof(int), comparador);
    
    for(int i = 0; i < n; ++i){
        if(vetor2[vetor[i]] == 0){
            if(vetor[i] != vetor[i + 1])
                cont++; 
                
            for(int j = 1;; ++j){
                multi = vetor[i]*j;
                if(multi > maior)
                    break;
                vetor2[multi] = 1;
            }
        }
    }
    
        printf("%d ", cont);
    
    return 0;
}

Measured memory_bytes: 7064
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin >> a >> b;
	string s;
	int cnt = 0;
	for(int i = a;i <= b;++i){
		s = to_string(i);
		string t = s;
		reverse(all(s));
		cnt += (t == s);
	}
	cout << cnt << '\n';
	return 0;
}


Measured memory_bytes: 256
from math import factorial
N,P=map(int,input().split())
a=list(map(int,input().split()))
odd=0
even=0
for i in range(N):
  if a[i]%2==0:
    even+=1
  else:
    odd+=1
ans=2**even
k=0
if P==0:
  k=0
else:
  k=1
tmp=0
for i in range(k,odd+1,2):
  tmp+=factorial(odd)//factorial(odd-i)//factorial(i)

print(ans*tmp)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <chrono>
//#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);

int main() {
    ll t;
    cin>>N>>K>>t;
    cout<<t * ((N + K - 1) / K)<<endl;
}


Measured memory_bytes: 3632