akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int X = int.Parse(input[0]);
            int A = int.Parse(input[1]);
            if (X < A) Console.WriteLine("0");
            else Console.WriteLine("10");
        }
    }
}


Measured memory_bytes: 11092
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val a = sc.intList()
        var sum = 0
        for (i in 0 until n) {
            var t = a[i]
            while (t % 2 == 0) {
                sum++
                t /= 2
            }
        }


        println(sum)
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        string S; cin >> S;
        vector<string> W = {"SUN", "MON","TUE","WED","THU","FRI","SAT","SUN", "MON","TUE","WED","THU","FRI","SAT"};
        rep(i, W.size()) {
            if(W[i] == S) {
                repeat(j, i + 1, W.size()) {
                    if(W[j] == "SUN") {
                        cout << j - i << endl;
                        return 0;
                    }
                }
            }
        }
        return 0;
    }
};

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  ll ans = a*x+b*y;
  ans = min(ans,min(x,y)*2*c+(x-min(x,y))*a+(y-min(x,y))*b);
  ans = min(ans,max(x,y)*2*c);
  cout << ans << endl;
}


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


typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#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 FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
/*--------------------------------------------*/
ll point(ll a){
  return max((ll)0,(4-a) * 100000);
}
int main(){
 //cout.precision(10);
 cin.tie(0);
 ios::sync_with_stdio(false);

  ll x,y;
  cin >> x >> y;
  
  cout << point(x) + point(y) + (x*y==1?400000:0) << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int n;
	int a[10000];
	int ans = 0;
	
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] % 2 == 0) {
			while (a[i] % 2 == 0) {
				a[i] /= 2;
				ans++;
			}
		}
	}
	
	cout << ans << endl;
	
	return (0);
}

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

namespace ABC136A
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split(' ');
            int A = int.Parse(word[0]);
            int B = int.Parse(word[1]);
            int C = int.Parse(word[2]);
            if (A>=B+C)
           {
                Console.WriteLine(0);
           }
           else if(A<B+C)
           {
                Console.WriteLine(B + C - A);
           }
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
int sum(int n){
    if(n ==0)return 0;
    return n%10 +sum(n/10);
}

int main(){
    int a;
    scanf("%d", &a);
    int lesser = a;
    for(int i=1; i<a; i++){
        int s = sum(a-i)+sum(i);
        if(s<lesser){
            lesser = s;
        }
    }
    printf("%i\n", lesser);
    return 0;
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int n,m;cin>>n>>m;
  	vector<vector<int>> g(n,vector<int>(n));
  	for(int i=0;i<m;i++){
    	int a,b;
      	cin>>a>>b;
      	a--;b--;
      	g[a][b]=g[b][a]=1;
    }
  	vector<int> perm(n);
  	iota(perm.begin(),perm.end(),0);
  	int ans=0;
  	do{
    	int ok=1;
      	for(int i=0;i<n-1;i++){
        	if(g[perm[i]][perm[i+1]]==false) ok=0;
        }
      ans+=ok;
    }while(next_permutation(perm.begin()+1,perm.end()));
  	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		int a = 0;
		int b = 0;
		ArrayList array = new ArrayList();
		array.add("A");
		array.add("B");
		array.add("C");
		array.add("D");
		array.add("E");
		array.add("F");
		for (int i = 0; i < 6; i++) {
			if(x.equals(array.get(i))){
				a = i;
				break;
			}
		}
		for (int i = 0; i < 6; i++) {
			if(y.equals(array.get(i))){
				b = i;
				break;
			}
		}
		if(a == b){
			System.out.println("=");
		}else if(a < b){
			System.out.println("<");
		}else if(a > b){
			System.out.println(">");
		}
	}
}

Measured memory_bytes: 21972
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

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

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", texto);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){

	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<char> ans;
	string s;
	cin >> s;
	int tam = s.length();
	for(int i = 0; i < tam; i++){
		if(s[i] == 'B'){
			if(!len(ans)) continue;
			ans.pop_back();
		}else{
			ans.pb(s[i]);
		}
	}
	ans.pb('\n');
	for(char c : ans)
		cout << c;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#if 1
#define int long long
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define stoi stoll
#else
#define MAX INT_MAX
#define MIN INT_MIN
#endif
#define INF MAX/2
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second
const int NIL = -1;
const int MOD = 1000000007;
#define REP(i,n) for (int i=0; i < (n); ++i)
#define FOR(i,a,b) for (int i=(a); i < (b); ++i)
using namespace std;

int pow(int x, int n) {int res=1; while(n){if(n&1)res*=x;x*=x;n>>=1;} return res;}
int get_gcd(int a, int b) {while(1){if (a < b) swap(a, b); if (b == 0) return a; a %= b;}}
int get_lcm(int a, int b) {return a * b / get_gcd(a, b);}
bool chmin(int &a, int b) {if(a>b){a=b; return true;} else return false;}
bool chmax(int &a, int b) {if(a<b){a=b; return true;} else return false;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//-------------------------テンプレここまで-------------------------//

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

  int N, K;
  cin >> N >> K;
  static int h[100000];
  REP(i,N) cin >> h[i];

  // dp[i] ... 足場i番目(0-index)にいるときの最小コスト
  static int dp[100000];
  REP(i,N) dp[i] = INF;
  dp[0] = 0;

  // 配るdp
  REP(i,N-1) {
    REP(k,K) {
      // k+1飛ぶとき
      if (i+k+1 < N) chmin(dp[i+k+1], dp[i]+abs(h[i+k+1]-h[i]));
    }
  }

  cout << dp[N-1] << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,a[105],ans=0;
    cin>>n;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for (int j=0;j<n;j++)
    {
        if (a[j]!=a[j+1])
            ans++;
    }
    cout<<ans<<endl;
    system("pause");
    return 0;
}

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

#define SZ(x) ((int(x.size())))

typedef long long ll;
typedef long double ld;

using namespace std;

ll n, x, tmp, base, cur, ans;

int main()
{
    cin >> n >> x;
    ans = n;
    base = max (x, n - x);
    cur = min (x, n - x);
    while (base % cur != 0)
    {
        ans += (base / cur) * 2 * cur;
        tmp = cur;
        cur = base % cur;
        base = tmp;
    }
    ans += (base / cur) * 2 * cur - cur;
    cout << ans;
	return 0;
}

Measured memory_bytes: 256
/* Code by : Suraj (@suraj1611) */

#include<bits/stdc++.h>
#include <string>

using namespace std;

#define ll long long int
#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mx INT_MAX
#define mn INT_MIN
#define md 1000000007
#define pb push_back
#define mp make_pair
#define maxsize 1100005
#define lb cout<<endl;
#define endl "\n"
#define F first
#define S second
#define label cout<<"hello!"<<endl
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll x, ll  y) 
{ 
	ll m=md;
   	ll ans=1;
    while (y > 0) 
    {
        if (y & 1)
            ans = (ans * x) % m;
        x = (x * x) % m;
        y >>= 1;
    }
    return ans;
} 

int main()
{
	IOS
	


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

	bool dp[k+1];
	fill(dp,dp+k+1,0);

	rep(i,k+1)
	{
		for(auto j:a)
		{
			if((i-j)>=0 and !dp[i-j])
				dp[i]=1;
		}
	}
	if(dp[k])
		cout<<"First"<<endl;
	else
		cout<<"Second"<<endl;



    return 0;
}

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

using namespace std;

int grid[101][101];

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int h, w;
	cin>>h>>w;
	
	int n;
	cin>>n;
	
	vector<int> count(n+1, 0);
	
	for(int i = 1; i <= n; i++){
		int x;
		cin>>x;
		count[i] = x;
	}
	
/*	for(int i = 1; i <= n; i++)
		cout<<count[i]<<" ";
*/		
	int x = 0, y = 0;
	bool state = true;
	
	for(int i = 1; i <= n; i++){
		while(count[i] != 0){
			grid[x][y] = i;
			count[i]--;
			
			if(state == true)
				y++;
			else
				y--;
				
			if(y == w || y == -1){
				state ^= true;
				x++;
			}
				
			if(y == w)
				y--;
			else if(y == -1)
				y++;
		}
	}
	
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++)
			cout<<grid[i][j]<<" ";
			
		cout<<"\n";
	}
	
	return 0;
}

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

#define vi vector<int>
#define vvi vector<vi>

using namespace std;

typedef long long ll;

int main() {
  int N, ans;
  string s, t;
  cin >> N >> s >> t;
  for (int i = 0; i <= s.size(); i++) {
    bool flag = true;
    for (int j = i; j < s.size(); j++) {
      if (s[j] != t[j - i]) {
        flag = false;
      }
    }
    if (flag) {
      ans = N + i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 16:01:34 2020

@author: matsui
"""

N=int(input())
A=input().split()
A=[int(a) for a in A]
A.sort()

ans='YES'
for i in range(1,N):
    if A[i]==A[i-1]:
        ans='NO'
        break
    
print(ans)

Measured memory_bytes: 25208
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    d = {}
    for i in range(N):
        s = input().strip()
        if s in d:
            d[s] += 1
        else:
            d[s] = 1

    ans = list(sorted(d.items(), key=lambda x: x[1], reverse=True))
    n = ans[0][1]
    ans2 = []
    for k, v in ans:
        if v != n: break
        ans2.append(k)
    for s in sorted(ans2):
        print(s)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 48692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;

const ll inf = 1LL<<50;


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

    int a, b; cin >> a >> b;
    int h = 100, w = 100;
    vector<vector<char>> fi(110, vector<char>(110));

    for(int i=1; i<=50; ++i) for(int j=1; j<=100; ++j) fi[i][j] = '.';
    for(int i=51; i<=100; ++i) for(int j=1; j<=100; ++j) fi[i][j] = '#';

    --a; --b;
    for(int i=1; i<50; i+=2) for(int j=1; j<100; j+=2){
        if(b==0) break;
        fi[i][j] = '#';
        --b;
    }

    for(int i=52; i<=100; i+=2) for(int j=1; j<100; j+=2){
        if(a==0) break;
        fi[i][j] = '.';
        --a;
    }

    cout << 100 << ' ' << 100 << endl;
    for(int i=1; i<=100; ++i){
        for(int j=1; j<=100; ++j){
            cout << fi[i][j];
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
s = int(input())
def functionF(n):
    result = n/2 if n % 2 == 0 else 3 * n + 1
    return int(result)

def calc(s):
    array = []
    for i in range(1,1000000):
        if i == 1:
            array.append(s)
        elif i > 1:
            array.append(functionF(array[i - 2]))
            for k in range(1, i):
#                 print(i, k)
#                 print(array[i-1], array[k-1])
                if array[i-1] == array[k-1]:
                    print(i)
                    return
calc(s)

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

int main(){
  int s;
  cin>>s;
  int count=1;
  while(s!=4&&s!=2&&s!=1){
   if(s%2==0){
     s/=2;
   }else{
     s=s*3+1;
   }
   count++;
  }
  cout<<count+3<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

int main() {
    ll N;
    cin >> N;
    ll count = 0;
    ll p[9][9];
    for(int yi = 0; yi < 9; yi++){
        for(int xi = 0; xi < 9; xi++){
            p[yi][xi] = 0;
        }
    }
    for(int i = 1; i <= N; i++){
        int digit = 0;
        int tmp = i;
        int lastDigit = 0;
        while (tmp > 0){
            digit++;
            if(tmp / 10 == 0){
                lastDigit = tmp;
            }
            tmp /= 10;
        }
        int firstDigit = i % 10;
        if(firstDigit == 0){
            continue;
        }
        p[lastDigit-1][firstDigit-1]++;
        //cout << lastDigit << "," << digit << " ";

    }
    for(int i = 0; i < 9; i++){
        for(int j = 0; j < 9; j++){
            ll a = p[i][j];
            ll b = p[j][i];
            //cout << a << ",";
            count += a * b;
        }
        //cout << endl;
    }
    cout << count << endl;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int h[n];
    for (int i=0; i<n; i++) {
        cin >> h[i];
    }
    int cnt =0, maxMove = 0;
    for (int i=1; i<n; i++) {
        if (h[i] <= h[i-1]) {
            cnt++;
            maxMove = max(cnt, maxMove);
        } else {
            cnt = 0;
        }
    }
    cout << maxMove << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define ld long double
#define endl "\n"
using namespace std;

int32_t main() {
  string s;
  cin>>s;
  int sum = 0;
  for(int i = 0;s[i];i++) {
    sum += s[i]-'0';
  }
  cout<<(sum%9==0?"Yes":"No");
  cout<<endl;
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int n = 0;
    cin >> n;
    vector<int> l(n);
    for(int i = 0;i < n;i++){
        cin >> l[i];
    }
    int cnt = 0;
    for(int i = 0;i < n;i++){
        for(int j = i;j < n;j++){
            if(i == j || l[i] == l[j]){
                continue;
            }
            for(int k = j;k < n;k++){
                if(j == k || i == k || l[i] == l[k] || l[j] == l[k]){
                    continue;
                }
                if(l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i]){
                    //cout << "i " << l[i] << " j " << l[j] << " k " << l[k] << endl;
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){
  int n, a, odd = 0, x2 = 0, x4 = 0;
  
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a;
    if(a % 4 == 0) x4++;
    else if(a % 2 == 0) x2++;
    else odd++;
  }
  
  if(x2 == 0 && odd - 1 <= x4) cout << "Yes" << endl;
  else if(x2 > 0 && odd <= x4) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
from itertools import permutations

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

def distance(a, b):
    x1, y1 = a[0], a[1]
    x2, y2 = b[0], b[1]
    dis = ((x1-x2)**2 + (y1-y2)**2)**0.5
    return dis


paths = list(permutations(a, len(a)))

distances = []
for p in paths:
    dis_path = []
    for i in range(len(a)-1):
        dis_path.append(distance(p[i], p[i+1]))
    distances.append(sum(dis_path))

print(sum(distances) / len(distances))


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

int main() {
	string s;
	cin >> s;
	int count = 0;
	int ans = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'S') {
			count++;
		}
		else {
			if (count > 0) {
				count--;
				ans++;
			}
		}
	}
	cout << s.length()-ans * 2 << endl;
	return 0;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))

a.sort()

if n % 2 == 0:
    suma = 2*sum(a[-int((n/2)):])-a[-1]
else:
    suma = 2*sum(a[-int(((n+1)/2)):])-a[-1]-a[-int(((n+1)/2))]

print(suma)

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

int main(){
    int n,m=0,cnt=0;
    cin>>n;

    for(int i=0; i<n; i++){
        int h;
        cin>>h;
        if(h>=m){
            m=h;
            cnt++;
        }
    }

    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

bool dp[100001];

int main(){
    int x;
    cin >> x;
    fill(dp, dp + 100001, false);

    dp[0] = true;
    for(int i = 1; i <= x; i++){
        //morau
        for(int j = 100; j <= 105; j++){
            int k = i - j;
            if(k >= 0){
                if(dp[k]) dp[i] = true;
            }
        }
    }

    if(dp[x]){
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(int i=int(x);i<int(y);++i)
#define For(i,x,y)  for(int i=int(x);i<=int(y);++i)
#define FOr(i,x,y)  for(int i=int(x);i>=int(y);--i)
#define pi acos(-1) 
#define mk make_pair
#define pa pair<ll,ll>
#define lf else if
#define IL inline
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
#define Add(x,y)    ((x)=((x)+(y))%mod)
#define Max(x,y)    ((x)=((x)<(y)?(y):(x)))
#define Min(x,y)    ((x)=((x)>(y)?(y):(x)))
#define E(x)        return writeln(x),0
#define LL			(long long)
#define p(x)        printf("~%lld~\n",LL(x))
#define pp(x,y)     printf("~~%lld %lld~~\n",LL(x),LL(y))
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z))
#define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d))
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define fi first
#define se second
#define GuYue		puts("\nGuYueNa________________________________________________________________________________")
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_; 
#endif 
#define NEG 1
    static const int GYN=2333333;
    char SZB[GYN],*SS=SZB,*TT=SZB;
    inline char gc(){   if (SS==TT){  TT=(SS=SZB)+fread(SZB,1,GYN,stdin); if (SS==TT) return '\n';  }   return *SS++;    }
#if NEG
    inline ll read(){    ll x=0,g=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*g; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
	void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);}
	void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);}
	void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);}
	void writeln(ll x){write(x);puts("");}
}using namespace SHENZHEBEI;
const int N=500105;
ll a[N],n;char s[N];
bool check(ll x){
	memset(a,0,sizeof a);
	For(i,1,n)a[i]=(s[n-i+1]-'0')*9;
	a[1]+=x*9;ll sum=0;
	For(i,1,n+100){
		for(;a[i]>9;a[i]-=10,a[i+1]++);
		sum+=a[i];
	}
	return sum<=x*9;
}
int main(){
	n=readstr(s+1);
	ll l=0,r=n*9,ans=0;
	for(;l<=r;){
		ll mid=(l+r)>>1;
		if (check(mid))	ans=mid,r=mid-1;
		else			l=mid+1;
	}writeln(ans);
}

Measured memory_bytes: 4352
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

main = do
  [a,b,c,d] <- getInts
  print $ max (a*b) (c*d)


-- util
getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

substr :: Int -> Int -> B.ByteString -> B.ByteString
substr b l s = B.take l $ B.drop b s


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1,2,0,-2,0};
const int dy[]={0,1,0,-1,1,1,-1,-1,0,2,0,-2};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef pair<int,int> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
long long LCM(ll a, ll b){
	return a*b/__gcd(a,b);
}
int main(){
	while(true){
		ll a,b;
		ll ans = 1;
		ll n = 1;
		rep(i,3){
			ll cnt = 0;
			cin >> a >> b;
			if( a == 0 && b == 0 )goto end;
			n = a*n % b;
			while(n!=1){
				n = a*n % b;
				cnt++;
			}
			ans = LCM(cnt+1,ans);
		}
		cout << ans << "\n";
	}
	end:;
    return 0;
}

Measured memory_bytes: 1156
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int d=sc.nextInt();

        System.out.println(Math.max(a*b,c*d));
    }
}

Measured memory_bytes: 23764
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long R, G;
  cin >> R >> G;
  cout << 2 * G - R << endl;
}

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


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};
// h(n, r) = c(n+r-1, r)
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
    ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
    return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main()
{
  string s;
  int k;
  cin >> s >> k;
  int n = s.size();

  ll dp[n+1][2][k+2];
  rep(i, n+1) rep(j, 2) rep(t, k+2) dp[i][j][t] = 0;

  dp[0][0][0] = 1;

  rep(i, n) {
    int x = s[i]-'0';
    rep(j, 2) {
      rep(t, k+1) {
        rep(c, (j?10:x+1)) dp[i+1][j || c < x][t + ((c!=0)?1:0)] += dp[i][j][t];
      }
    }
  }
  cout << dp[n][0][k] + dp[n][1][k] << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>

using namespace std;

#define mod 1000000007

int n;
int d[101], v[101];
int graph[101][101] = {};

int solve(int k, int cnt)
{
	d[k] = cnt;
	int nowcnt = cnt;
	for(int i = 0; i < n; i++){
		if(d[i] < 0 && graph[k][i] > 0) nowcnt = solve(i, nowcnt + 1);
	}
	return v[k] = nowcnt + 1;
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++){
		d[i] = -1;
		v[i] = -1;
		int u, k;
		cin >> u >> k;
		u--;
		for(int j = 0; j < k; j++){
			int v;
			cin >> v;
			v--;
			graph[u][v] = 1;
		}
	}
	int nowcnt = 1;
	for(int i = 0; i < n; i++){
		if(d[i] < 0) nowcnt = solve(i, nowcnt) + 1;
	}
	for(int i = 0; i < n; i++){
		cout << i + 1 << " " << d[i] << " " << v[i] << endl;
	}
}

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

int main(){
  int x,n;
  cin >> x >> n;
  vector<int> p(n); rep(i,n) cin>>p[i];
  vector<int> pa(n); rep(i,n) cin>>pa[i];
  rep(i,n) pa[i]=abs(p[i]-x);
  sort(pa.begin(),pa.end());
  int diff=0,ans=0;
  int cnt=0;
  rep(i,n){
    if(pa[i]!=0) cnt++;
  }
  if(cnt==n) diff=0;
  else{
    for(int i=1; i<101; i++){
      cnt=0;
      for(int j=1; j<n; j++){
        if(pa[j]==i) cnt++;
      }
      if(cnt!=2){
        diff=i;
        break;
      }
    }
  }
  rep(i,n){
    ans=x+diff;
    if(p[i]==x-diff) break;
    ans=x-diff;
    if(p[i]==x+diff) break;
  }
  if(n==0) ans=x;
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

// 0.0 0.0 2.0 0.0 2.0 2.0 1.5 0.5
// 0.0 0.0 1.0 4.0 5.0 3.0 -1.0 3.0
//
int main() {

//    double p1[2] = {0.0, 0.0};
//    double p2[2] = {2.0, 0.0};
//    double p3[2] = {2.0, 2.0};
//    double c[2]  = {1.5, 0.5};
//
    double p1[2] = {0.0, 0.0};
    double p2[2] = {1.0, 4.0};
    double p3[2] = {5.0, 3.0};
    double c[2]  = {-1.0, 3.0};
    double *a[3] = {p1, p2, p3};

    while ( scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &p1[0], &p1[1], &p2[0], &p2[1], &p3[0], &p3[1], &c[0], &c[1]) != EOF ) {


        int cnt = 0;
        int i;
        double x = c[0];
        double y = c[1];
        for (i = 0; i < 3; ++i ) {
            double *t1 = a[ i % 3 ];
            double *t2 = a[(i + 1) % 3];

            //(y - y1) = (y2 - y1) / (x2 - x1) (x - x1)
            //y = { (y2 - y1 ) / (x2 - x1) * (x - x1) } + y1;
            //a = (y2 - y1) / (x2 - x1)
            //y = a * x - a * x1 + y1
            //a * x = N + a * x1 - y1
            //x = { y + a * x1 - y1 } / a

            double x1 = t1[0];
            double y1 = t1[1];
            double x2 = t2[0];
            double y2 = t2[1];
            double by = y1 > y2 ? y1 : y2;
            double sy = y1 < y2 ? y1 : y2;

            if ( x2 - x1 == 0 ) {
                if ( x2 >= x && by >= y && sy < y)
                    ++cnt;
            } else {
                if( by >= y && sy < y) {
                    double a =  ( y2 - y1 ) / ( x2 - x1 );
                    if ( a == 0 )
                        continue;
                    double mx = ( y + a * x1 - y1 ) / a;
                    if ( mx >= x )
                        ++cnt;
                }
            }
        }

        if ( cnt % 2 ) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}

Measured memory_bytes: 612
#include <stdio.h>
 
int main(void){

  int a,b;
  
  scanf("%d %d",&a,&b);
  
  if(b==1)b = b + 13;
  if(a==1)a = a + 13;
  
  if(a > b){
  printf("Alice\n");
  } else if(b > a){
  printf("Bob\n");
  } else {
  printf("Draw\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int A=scan.nextInt();
		int B=scan.nextInt();
		if(A<6) {
			System.out.println(0);
		}
		else if(A<13) {
			System.out.println(B/2);
		}
		else 
		{
			System.out.println(B);
		}
	}

}

Measured memory_bytes: 35740
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort((x).rbegin(),(x).rend())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl
#define END(ans) ANS(ans); return
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
template<class T>inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
// clang-format on

void solve(long long N, long long W, std::vector<long long> w, std::vector<long long> v) {
  vector<vector<ll>> dp(N + 1, vector<ll>(N * 1000 + 1, INF));
  dp[0][0] = 0;
  rep(i, N) rep(sum_v, N * 1000 + 1) {
    if (sum_v - v[i] >= 0) {
      chmin(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i]);
    }
    chmin(dp[i + 1][sum_v], dp[i][sum_v]);
  }
  ll ans = 0;
  rrep(sum_v, N * 1000 + 1) {
    if (dp[N][sum_v] <= W) {
      ANS(sum_v);
      return;
    }
  }
}

// clang-format off
int main() {
  long long N;
  scanf("%lld",&N);
  long long W;
  scanf("%lld",&W);
  std::vector<long long> w(N);
  std::vector<long long> v(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&w[i]);
    scanf("%lld",&v[i]);
  }
  solve(N, W, std::move(w), std::move(v));
  return 0;
}


Measured memory_bytes: 80256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    ll x,y,i,j;
    cin>>x>>y;
    for(i=0;i<=200;i++)
    {
    	for(j=0;j<=200;j++)
    	{
    		ll ha1 = 4*i + 2*j;
    		ll ha2 = i+j;
    		if(ha1==y and ha2==x)
    		{
    			cout<<"Yes";
    			return 0;
    		}
    	}
    }
    cout<<"No";
}

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

const double PI = acos(-1);

void solve(long long A, long long B, long long H, long long M){
    double th = double(H*60+M)/720 * 2 * PI;
    double tm = double(M)/60 * 2 * PI;
    double xh = A*cos(th), yh = A*sin(th);
    double xm = B*cos(tm), ym = B*sin(tm);
    double dx = xh-xm, dy = yh-ym;
    double ans = sqrt(dx*dx + dy*dy);
    printf("%.10f\n", ans);
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long H;
    scanf("%lld",&H);
    long long M;
    scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4120
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        s:chars,
        t:chars
    }
    let n = s.len();
    let mut is_ok = false;
    for i in 0..n {
        let mut is_same = true;
        let mut j = i;
        let mut k = 0;
        loop {
            if s[j] != t[k] {
                is_same = false;
                break;
            }
            j += 1;
            k += 1;
            j %= n;
            if j == i {break;}
        }
        if is_same {
            is_ok = true;
            break;
        }
    }
    println!("{}", if is_ok {"Yes"} else {"No"});
}

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

using namespace std;

#define sz(a) int(a.size())

int a [410];
long long res[410][410];
long long dp(int l, int r) {
	if (l == r) return 0;
	if (res[l][r] != -1) return res[l][r];
	long long best = LLONG_MAX;
	long long s2 = 0, s1 = 0;
	for (int i = l; i <= r; i++) s2 += a[i];
	for (int i = l; i < r; i++) {
		s2 -= a[i], s1 += a[i];
		best = min(best, s1+s2 + dp(l, i)+dp(i+1, r));
	}
	return res[l][r] = best;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	memset(res, -1, sizeof(res));
	cout << dp(0, n-1) << endl;
}


Measured memory_bytes: 1536
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
s=gs
l=s.length

puts "x"*l

Measured memory_bytes: 1788
import java.util.Scanner;

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

			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if ( a < 10 && b < 10 ) {
				System.out.println(a * b);
			}
			else {
				System.out.println(-1);
			}
			
		}
	}
}


Measured memory_bytes: 21844
n, m = map(int, input().split())
h = list(map(int, input().split()))
H = [1] * n
for i in range(m):
  a, b = map(int, input().split())
  if h[a-1] > h[b-1]:
    H[b-1] = 0;
  elif h[a-1] < h[b-1]:
    H[a-1] = 0;
  else:
    H[a-1] = 0;
    H[b-1] = 0;
print(H.count(1))

Measured memory_bytes: 19948
#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(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;



int main(void){
    double d,t,s;
    cin >> d >> t >> s;
    double x=d/s;
    if(x<=t)
        cout << "Yes";
    else
    {
        cout << "No";
    }
    
    return 0;
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 105

char table[NUM][NUM];

int main(){

	int A,B;
	scanf("%d %d",&A,&B);

	for(int row = 0; row <= 49; row++){
		for(int col = 0; col <= 99; col++){
			table[row][col] = '#';
		}
	}

	for(int row = 50; row <= 99; row++){
		for(int col = 0; col <= 99; col++){
			table[row][col] = '.';
		}
	}

	int count = 0;

	for(int row = 0; row <= 48 && count < A-1; row += 2){
		for(int col = 0; col <= 98 && count < A-1; col+= 2){

			table[row][col] = '.';
			count++;
		}
	}

	count = 0;

	for(int row = 99; row >= 51 && count < B-1; row -= 2){
		for(int col = 0; col <= 98 && count < B-1; col += 2){

			table[row][col] = '#';
			count++;
		}
	}

	printf("100 100\n");

	for(int row = 0; row < 100; row++){
		for(int col = 0; col < 100; col++){
			printf("%c",table[row][col]);
		}
		printf("\n");
	}


	return 0;
}


Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

X=gets.to_i
head=0
tail=10**9
while tail-head>1
    mid=(head+tail)/2
    if mid*(mid+1)/2>=X
        tail=mid
    else
        head=mid
    end
end
puts tail

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repa(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define PI (acos(-1))
#define _GLIBCXX_DEBUG

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

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int h,w,n,A[200000],b=0;
    cin>>h>>w>>n;
    rep(i,n) cin>>A[i];
    vector<int> B;
    rep(i,n)rep(j,A[i]) B.push_back(i+1);
    rep(i,h/2) reverse(B.begin()+(2*i+1)*w,B.begin()+2*(i+1)*w);
    rep(i,h){rep(j,w) cout<<B[b]<<" ",b++;cout<<endl;}
}

Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int n;
	cin >> n;
	string str1,str2;
	cin >> str1 >> str2;

	for(int i=0 ; i<n ; i++)
		cout << str1[i] << str2[i];

	return 0;
}

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

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

long long int N, M;
list<int>edge[100];

int main() {
	ios::sync_with_stdio(false);
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	for (int i = 1; i <= N; i++)cout << edge[i].size() << endl;
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
typedef long long ll;
#include <bits/stdc++.h>

using namespace std;

ll mod = 1000000007;

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

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y)
	{
		swap(x, y);
	}

	while (0 < y)
	{
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
bool isPrime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2)
	{
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++)
	{
		if (isPrime[i])
		{
			Type j = i + i;
			while (j <= n)
			{
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binarySearchJudge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binarySearch(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok))
	{
		int mid = (ng + ok) / 2;
		if (binarySearchJudge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

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

	for (int i = 0; i < min(k, (ll)s.size()); i++)
	{
		if (s[i] != '1')
		{
			cout << s[i] << endl;
			return 0;
		}
	}
	cout << 1 << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N,Q = map(int,input().split())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
PX = [tuple(map(int,input().split())) for i in range(Q)]
es = [[] for _ in range(N)]
for a,b in AB:
    a,b = a-1,b-1
    es[a].append(b)
    es[b].append(a)
ps = [0] * N
for p,x in PX:
    ps[p-1] += x

ans = [0] * N
ans[0] = ps[0]
stack = [0]
visited = [0] * N
visited[0] = 1
while stack:
    v = stack.pop()
    for to in es[v]:
        if visited[to]: continue
        visited[to] = 1
        ans[to] = ans[v] + ps[to]
        stack.append(to)
print(*ans)

Measured memory_bytes: 125608