akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
num = ['7', '5', '3']
stack = [('', 0)]
ans = 0
check = defaultdict(lambda:True)
while stack:
    m, l = stack.pop()
    for x in num:
        if x not in m:
            break
    else:
        ans += 1
    for x in num:
        if 10 * l + int(x) <= n:
            if check[10*l + int(x)]:
                stack.append((m + x, 10 * l + int(x)))
                check[10*l + int(x)] = False
print(ans)

Measured memory_bytes: 76856
import java.util.*;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[150];
		int[] B = new int[150];
		for(int i=0; i<N-1;i++) {
			B[i]=scan.nextInt();			
		}
		for(int i=1; i<N-1;i++) {
			A[i]= Math.min(B[i], B[i-1]);
			
		}
		A[0] =B[0];
		A[N-1]= B[N-2];
		int ans= Arrays.stream(A).sum(); 
		System.out.println(ans);
	}
}
		
	

Measured memory_bytes: 26836
//IncubatorMan
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
double PI = 2*acos(0.0);
void solve(){
    double ans;
    cin>>ans;
    ans = ans*2*PI;
    printf("%.20lf\n",ans);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        int test=1;
        //read(test);
        while(test--){
            solve();
        }
    return 0;
}

Measured memory_bytes: 3804
#include <stdio.h>
#include <iostream>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

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

    int ans = 1;
    REP(0, i, N) {
        if (ans < K) {
            ans *= 2;
        } else {
            ans += K;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
ABCD = str(input())
n = [int(i) for i in ABCD]
#ABCD = '0290'
#n = [0,2,9,0]

ans = ''

for i in range(2**3):

  x = format(i,'b').zfill(3)
  c = n[0]

  for j in range(1,4):
    if x[j-1] == '0':
      c += n[j]
    else :
      c -= n[j]
 
  if c == 7:
    ans = x
    break

ans = ans.replace('0','+')
ans = ans.replace('1','-')

out = ABCD[0]+ans[0]+ABCD[1]+ans[1]+ABCD[2]+ans[2]+ABCD[3]+'=7'
print(out)

Measured memory_bytes: 3064
h, w = (int(i) for i in input().split())
A = [None] * h
for i in range(h):
    A[i] = list(input())

for i in range(h):
    for j in range(w):
        cnt = 0
        if A[i][j] == '.':
            for s in range(-1, 2):
                for t in range(-1, 2):
                    if i+s >= 0 and i+s < h and j+t >= 0 and j+t < w:
                        if A[i+s][j+t] == '#': cnt += 1
            A[i][j] = cnt
            print(cnt, end='')
        else:
            print('#', end='')
    print()


Measured memory_bytes: 3444
#include<cstdio>

int main() {
	int h,n,x,ans=0;
	scanf("%d%d",&h,&n);
	for (int i=1;i<=n;++i) {
		scanf("%d",&x);
		ans+=x;
	}
	if (ans<h) printf("No"); else printf("Yes");
	return 0;
} 

Measured memory_bytes: 128
S = input()
T = input()

flag = False
for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

using namespace std;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	long long g = gcd(a, b);
	return a / g * b;
}

int main() {
	int a, b; cin >> a >> b;

	int ans = a - b * 2;
	if (ans > 0) {
		cout << ans << endl;
	}
	else {
		cout << 0 << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};



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

    ll n,k;
    cin >> n >> k;
    vector<ll> p(n);
    rep(i,n) cin >> p[i];
    vector<double> ans(n+1);
    ll sum = 0;
    rep(i,p[0]){
        sum += i+1;
    }
    ans[0] = 0;
    ans[1] = (double)sum/p[0];
    for(int i = 1;i < n;++i){
        sum = 0;
        rep(j,p[i]){
            sum += j+1;
        }
        ans[i+1] = ans[i] + (double)sum/p[i];
    }
    double res = 0;
    rep(i,n){
        res = max(res,ans[i+k]-ans[i]);
        if(i+k == n) break;
    }

    cout << fixed << setprecision(10) << res << endl;


    cout << endl;
    return 0;
}


Measured memory_bytes: 3456
N = int(input())

m_arr = []
a_arr = []
r_arr = []
c_arr = []
h_arr = []

for i in range(N):
    tmp = input()
    if tmp[0] == 'M':
        m_arr.append(tmp)
    elif tmp[0] == 'A':
        a_arr.append(tmp)
    elif tmp[0] == 'R':
        r_arr.append(tmp)
    elif tmp[0] == 'C':
        c_arr.append(tmp)
    elif tmp[0] == 'H':
        h_arr.append(tmp)
ans = 0

ans += len(m_arr) * len(a_arr) * len(r_arr)
ans += len(m_arr) * len(a_arr) * len(c_arr)
ans += len(m_arr) * len(a_arr) * len(h_arr)
ans += len(m_arr) * len(r_arr) * len(c_arr)
ans += len(m_arr) * len(r_arr) * len(h_arr)
ans += len(m_arr) * len(c_arr) * len(h_arr)
ans += len(a_arr) * len(r_arr) * len(c_arr)
ans += len(a_arr) * len(r_arr) * len(h_arr)
ans += len(a_arr) * len(c_arr) * len(h_arr)
ans += len(r_arr) * len(c_arr) * len(h_arr)
print(ans)

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

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

int main(){

  int N;
  cin >> N;
  vector<int> A(N-1),cnt(N);
  rep(i, N-1) {
    cin >> A.at(i);
  }

  rep(i,N-1){
    //iをAiの所に加算
    cnt.at(A.at(i)-1)++;
  }

  rep(i, N) {
    cout << cnt.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 4840
#![allow(unused_imports)]
#![allow(non_snake_case)]
#![allow(dead_code)]
use proconio::{input, fastout};
use proconio::marker::{Chars, Bytes, Usize1};

struct FenwikTree {
    size: usize,
    depth: usize,
    tree: Vec<i64>
}


#[fastout]
fn main() {
    input!{
        n: usize, q:usize,
        c: [Usize1; n],
        query: [(Usize1, usize); q]
    }
    fn f(x: usize, y:usize) -> usize {
        let mut ret = x / 700 * 600000;
        if x / 700 % 2 > 0 {
            ret += 600000 - y;
        } else {
            ret += y;
        }
        ret
    }
    let mut g = query.iter().enumerate().collect::<Vec<_>>();
    g.sort_by_cached_key(|(_, &(x, y))| f(x, y));
    let mut idxl = 0;
    let mut idxr = 1;
    let mut ans = vec![0; q];
    let mut cur = vec![0; n];
    cur[c[0]] = 1;
    let mut scr = 1;
    for &(i, &(l, r)) in &g {
        while idxr < r {
            if cur[c[idxr]] == 0 {
                scr += 1;
            }
            cur[c[idxr]] += 1;
            idxr += 1;
        }
        while idxl > l {
            idxl -= 1;
            if cur[c[idxl]] == 0 {
                scr += 1;
            }
            cur[c[idxl]] += 1;
        }
        while idxr > r {
            idxr -= 1;
            if cur[c[idxr]] == 1 {
                scr -= 1;
            }
            cur[c[idxr]] -= 1;
        }
        while idxl < l {
            if cur[c[idxl]] == 1 {
                scr -= 1;
            }
            cur[c[idxl]] -= 1;
            idxl += 1;
        }
        ans[i] = scr;
    }
    println!("{}", ans.iter().map(|x| x.to_string()).collect::<Vec<_>>().join("\n"));
}


Measured memory_bytes: 67684
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools
import heapq


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(H, W, inputs):
    d_map = inputs
    best_step_num = None
    for i in range(H):
        for j in range(W):
            process_map = [[False for _ in range(W)] for _ in range(H)]
            bfs_queue = collections.deque([[i, j, 0]])
            last_step_num = None

            while len(bfs_queue) > 0:
                [y, x, step_num] = bfs_queue.pop()
                if y >= H or x >= W or y < 0 or x < 0 or d_map[y][x] == '#' or process_map[y][x] is True:
                    continue
                process_map[y][x] = True
                last_step_num = step_num

                bfs_queue.appendleft((y+1, x, step_num+1))
                bfs_queue.appendleft((y-1, x, step_num+1))
                bfs_queue.appendleft((y, x+1, step_num+1))
                bfs_queue.appendleft((y, x-1, step_num+1))

            if last_step_num is not None and (best_step_num is None or last_step_num > best_step_num):
                best_step_num = last_step_num
    return best_step_num


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [H, W] = string_to_int(input())
    ret = solve(H, W, inputs(H))
    print(ret)


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

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

int main() {
    //input
    int N;
    string S;
    cin >> N;
    if(N%2){
        cout << "No" << endl;
        return 0;
    }
    cin >> S;
    string s2 = S.substr(N/2);
    string s1 = S.erase(N/2);
    if(s1 == s2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  vector<ll>ans;
  map<ll,ll>M;
  rep(i,n)M[a[i]]++;
  for(auto p:M){
    if(p.second>=4){
      ans.push_back(p.first);
      ans.push_back(p.first);
    }
    else if(p.second>=2){
      ans.push_back(p.first);
    }
  }
  sort(ans.begin(),ans.end());
  reverse(ans.begin(),ans.end());
  if(ans.size()<2){
    cout<<0<<endl;
    return 0;
  }
  cout<<ans[0]*ans[1]<<endl;
  return 0;
}

Measured memory_bytes: 7296
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program{
  static void Main(){
	var x = ReadLine().Split(' ').Select(long.Parse).ToArray();
    var j = false;
    long y = x[0]*x[1];
    

    
    if(x[0] == 1 || x[1] == 1){
          j = true;
    }

    
    if(j == true){
    	Write(1);
    }else if(y%2 == 1){
    	Write(y/2+1);
    }else{
    	Write(y/2);
    }

  }
}

Measured memory_bytes: 18844
#include<bits/stdc++.h>
    #include <ext/pb_ds/tree_policy.hpp> 
    #include <functional> // for less 
    using namespace __gnu_pbds; 
    using namespace std;
    //typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;    
    #define ll            long long
    #define pb            push_back
    #define ppb           pop_back
    #define si            set <ll>
    #define endl          '\n'
    #define fr            first
    #define sc            second
    #define mii           map<ll,ll>
    #define msi           map<string,ll>
    #define mis           map<ll,string>
    #define rep(i,a,b)    for(ll  i=a;i<b;i++)
    #define all(v)        v.begin(),v.end()
    #define sort(v)       sort(all(v))
    #define pii           pair<ll ,ll >
    #define vi            vector<ll >
    #define vii           vector<pair<ll,ll>>
    #define vs            vector<string>
    #define sz(x)         (ll)x.size()
    #define M             1000000007
    #define bs            binary_search
    #define rev(a)        reverse(all(a));
    #define sp(n)         setprecision(n)
    #define spl           " "
    #define arr(a,n)      rep(i,0,n) cin>>a[i]
    #define mod           998244353
    #define print_vector(a)  for(auto t:a) cout<<t<<" ";cout<<endl;
    #define print_arr(a,n)   rep(i,0,n) cout<<a[i]<<" "; cout<<endl;        
    #define show(a,n)     for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
    #define N             100000000
    #define debug(x)      cout << #x << " is " << x << endl;
    #define time          cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    #define INF           1ll<<31
    #define hi            cout<<"hi"<<endl;
    const ll maxn=200005;
    void solve()
    {
      ll n,m;
      cin>>n>>m;
      vector<double> v(n);
      rep(i,0,n) cin>>v[i];
      double s=0;
      for(auto t:v) s+=t;
      double tt=(s*1.0)/(4*m);
      ll c=0;
      for(auto t:v) if(t>=tt) c++;
      if(c>=m)cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }
    signed main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        //#ifndef ONLINE_JUDGE
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        //#endif
        ll t=1;
        //cin>>t;
        while(t--) solve();
    }
    
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int best = INT_MAX;
    bool flag = 0;
    int n, T;
    cin >> n >> T;
    for(int i = 0; i < n; i++)
    {
        int c, t;
        cin >> c >> t;
        if(t <= T)
        {
            flag = 1;
            best = min(best, c);
        }
    }
    if(flag)
    {
        cout << best;
    }
    else
    {
        cout << "TLE";
    }

    return 0;
}


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

string my_to_ascii(int i) {
    if (i == 0) return "a";
    if (i == 1) return "b";
    if (i == 2) return "c";
    if (i == 3) return "d";
    if (i == 4) return "e";
    if (i == 5) return "f";
    if (i == 6) return "g";
    if (i == 7) return "h";
    if (i == 8) return "i";
    if (i == 9) return "j";
    if (i == 10) return "k";
    if (i == 11) return "l";
    if (i == 12) return "m";
    if (i == 13) return "n";
    if (i == 14) return "o";
    if (i == 15) return "p";
    if (i == 16) return "q";
    if (i == 17) return "r";
    if (i == 18) return "s";
    if (i == 19) return "t";
    if (i == 20) return "u";
    if (i == 21) return "v";
    if (i == 22) return "w";
    if (i == 23) return "x";
    if (i == 24) return "y";
    if (i == 25) return "z";
}

int main() {
    long long n;
    cin >> n;

    vector<int> a(100);
    int i = 0;
    while (n > 0) {
        a[i] = (n-1)%26;
        n = (n-1)/26;
        i++;
    }
    while (i--) {
        cout << my_to_ascii(a[i]);
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 3628
#[macro_use]
mod utils {
    macro_rules! input {
        ($($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)*}
        };
    }
    macro_rules! input_inner {
        ($next:expr) => {};
        ($iter:expr, ) => {};

        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
            let mut $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
    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 f(x: usize) -> usize {
    if x < 2 {
        0
    } else {
        x * (x - 1) / 2
    }
}

fn main() {
    input! {
        n: usize,
        a: [usize1; n],
    }
    let mut m = vec![0; n];
    for i in 0..n {
        m[a[i]] += 1;
    }
    let mut s = 0;
    for i in 0..n {
        s += f(m[i]);
    }

    for i in 0..n {
        let mut r = s;
        r -= f(m[a[i]]);
        r += f(m[a[i]] - 1);

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


Measured memory_bytes: 10748
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define NIL -1
#define MAX 1000


int main()
{
    int n;
    cin >> n;
    
    int p[3], dp[n+1][3];

    rep(j, 3) dp[0][j] = 0;

    for(int i = 1; i <= n; ++i){
        rep(j, 3) cin >> p[j];
        rep(j, 3){
            int maxi = 0;
            rep(k, 3){
                if(k != j) maxi = max(maxi, dp[i-1][k]);
            }
            dp[i][j] = maxi + p[j];
        }
    }
    int maxv = 0;
    rep(j, 3) maxv = max(maxv, dp[n][j]);

    cout << maxv << endl;

}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final long W = s.nextLong();
			final long H = s.nextLong();
			final long x = s.nextLong();
			final long y = s.nextLong();

			boolean b;
			if (W == 1 && H == 1) {
				b = false;
			} else if (W == 1) {
				b = H == y * 2;
			} else if (H == 1) {
				b = W == x * 2;
			} else {
				b = W == x * 2 && H == y * 2;
			}
			System.out.printf("%f %d%n", W * H / 2.0, b ? 1 : 0);
		}
	}
}


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	ll n;
	cin >> n;

	ll ans = 0;
	for (ll i = sqrtl(n); i >= 1; i--) {
		if (n % i != 0) {
			continue;
		}

		ans = n / i + i;
		break;
	}

	cout << ans - 2LL << endl;
	return 0;
}


Measured memory_bytes: 256
<?php
$n=trim(fgets(STDIN));
$v=explode(" ",trim(fgets(STDIN)));
$c=explode(" ",trim(fgets(STDIN)));

$ans=0;
$i=0;
while($i<$n){
  if($v[$i]-$c[$i]>=0){
    $ans+=$v[$i]-$c[$i];
  }
  ++$i;
}
echo $ans;

Measured memory_bytes: 4728
#include<iostream>
using namespace std;
int main(){
  int s;
  cin>>s;
 int a[1000]={};
  a[0]=s;
  for(int i=1;i<1000;i++){
    if(a[i-1]%2==0){
      a[i]=a[i-1]/2;
    }
    else{
      a[i]=a[i-1]*3+1;
    }
    for(int j=0;j<=i;j++){
      if(a[i]==a[j]&&i!=j){
        cout<<i+1<<endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

#define REP(i,n) for(int i=0; i<n; ++i)

typedef unsigned long long u64;
typedef long long i64;

int n,x;
int l[500];


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

        cin >> n >> x;
        REP(i,n)
                cin >> l[i];

        int c = 0;
        int a = 0;
        REP(i,n) {
                if (c > x)
                        break;
                c += l[i];
                a++;
        }
        if (c <= x)
                a++;

        cout << a << endl;


        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ll,ii>
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

int n,k;
int arr[200005];
int cnt[200005];
int pos[200005];
int off;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin>>n>>k;
	
	off=n;
	
	for (int x=1;x<=n;x++){
		cin>>arr[x];
		cnt[arr[x]]++;
		if (arr[x]-cnt[arr[x]]>=0){
			pos[arr[x]-cnt[arr[x]]]++;
			if (pos[arr[x]-cnt[arr[x]]]==1) off--;
		}
	}
	
	int a,b;
	while (k--){
		cin>>a>>b;
		if (arr[a]-cnt[arr[a]]>=0){
			pos[arr[a]-cnt[arr[a]]]--;
			if (pos[arr[a]-cnt[arr[a]]]==0) off++;
		}
		cnt[arr[a]]--;
		
		arr[a]=b;
		
		cnt[arr[a]]++;
		if (arr[a]-cnt[arr[a]]>=0){
			pos[arr[a]-cnt[arr[a]]]++;
			if (pos[arr[a]-cnt[arr[a]]]==1) off--;
		}
		
		cout<<off<<endl;
	}
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
	int main()
	{
		long long int a,b,c;
		cin>>a>>b>>c;
		if((a==b && b==c && a==c) || (a!=b && b!=c && a!=c))
			cout<<"No"<<endl;
		else
			cout<<"Yes"<<endl;
		return 0;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	ll H;
	cin>>H;
	function<ll(ll)> f=[&](ll h) {
		if (h==1) return 1ll;
		return 2*f(h/2)+1;
	};
	cout<<f(H)<<'\n';
}


Measured memory_bytes: 256
q = int(input())
lr = [list(map(int, input().split())) for _ in range(q)]

def sosuu(num):
    Result = True
    for i in range(2, int(num**(1/2))+1):
        if num%i==0:
            Result = False
            break
    return Result #素数なら True

checker = [1 for i in range(10**5+1)]
checker[0] = 0
checker[1] = 0
for i in range(2, 10**5+1):
    if checker[i]:
        if sosuu(i):
            j = 2
            while i*j <= 10**5:
                checker[i*j] = 0
                j += 1
result = [0]
j = 0
for i in range(1, len(checker)):
    if checker[i] and checker[(i+1)//2]:
        j += 1
    result.append(j)

for l, r in lr:
    print(result[r]-result[l-1])

Measured memory_bytes: 29912
import java.util.*;

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

    int n = sc.nextInt();
    int k = sc.nextInt();
    int ans = k;

    for (int i = 0; i<n-1; i++) {
      ans *= (k-1);
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 23252
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstring>
using namespace std;
inline char tc(void){
	static char fl[10000],*A=fl,*B=fl;
	return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++;
}
inline int read(void){
	int a=0,f=1;char c;
	while((c=tc())<'0'||c>'9')c=='-'?f=-1:0;
	while(c>='0'&&c<='9')a=a*10+c-'0',c=tc();
	return a*f;
}
int n,k,h[100005],f[100005],tot1,tot2,now1,now2,ans=1e9;
int main(void){
	register int i,x;
	n=read(),k=read();
	for(i=1;i<=n;++i){
		x=read();
		if(x<0)f[++tot1]=x;
		else h[++tot2]=x;
	}
	reverse(f+1,f+tot1+1);
	now2=min(k,tot2),now1=k-now2;
	while(now1<=tot1&&now2>=0){
		ans=min(ans,min(f[now1]*-2+h[now2],-f[now1]+h[now2]*2));
		--now2,++now1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
function Main(input){
  input=input.split("\n")[0].split("");
  var list ="abcdefghijklmnopqrstuvwxyz".split("");
  for (var i in input){
    var result = list.indexOf(input[i]);
    if(result!=-1)var spliced=list.splice(result,1);
  }

  if(list.length==0){
    console.log("None");
  }else{
    console.log(list[0]);
  }
}

const fs = require("fs");
Main(fs.readFileSync("/dev/stdin","utf-8"));


Measured memory_bytes: 13340
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
import numpy as np
inf = 10**13
V = 10**5
N, W = map(int, input().split())
dp = np.array([inf]*(V+1), dtype = np.int64)
dp[0] = 0
for _ in range(N):
    w, v = map(int, input().split())
    np.minimum(dp[:-v]+w, dp[v:], out = dp[v:])
print(np.where(dp<=W)[0][-1])


Measured memory_bytes: 14032
#include<bits/stdc++.h>
#define	INF	0x3f3f3f3f
#define	LL	long long
#define	MAXN	100010
using namespace std;
int n, a[MAXN], b[MAXN], maxn, ans, maxnII, pII, p, q, qII, m, mII;

template <typename T> void chkmin(T &x, T y){x = min(x, y);}
template <typename T> void chkmax(T &x, T y){x = max(x, y);}
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}

int main(){
	read(n);
	for (int i = 1; i <= n; ++i)
		read(a[i]);
	for (int i = 1; i <= n; i += 2)
		++b[a[i]];
	for (int i = 1; i <= 100000; ++i){
		if (b[i] > maxn) maxnII = maxn, maxn = b[i], pII = p, p = i;
		else if (b[i] > maxnII) maxnII = b[i], pII = i;
	}
	memset(b, 0, sizeof(b));
	for (int i = 2; i <= n; i += 2)
		++b[a[i]];
	for (int i = 1; i <= 100000; ++i){
		if (b[i] > m) mII = m, m = b[i], qII = q, q = i;
		else if (b[i] > mII) mII = b[i], qII = i;
	}
	if (q == p) {
		ans = min(n - m - maxnII, n - mII - maxn);
	} else {
		ans = n - m - maxn;
	}
	printf("%d\n", ans);
	return 0;
}

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

#define itos(x) to_string(x)
#define stoi(x) stoi(x)
#define ctoi(x) (x-'0')

#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()

#define ll long long
#define ld long double
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld pi = acos((ld)-1);
const ld e = exp(1);

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int num, sum; cin >> num >> sum;
  for (int i = 0; i <= num; i++) {
    if (i*4+(num-i)*2 == sum) {
      cout << "Yes" << "\n";
      return 0;
    }
  }
  cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

  vector<int> A(N);
  for (int i = 0; i < (int)(N); ++i) cin >> A[i];
  for (int i = 0; i < (int)(N); ++i) A.push_back(A[i] + K);

  int d = 0;
  for (int i = 0; i < (int)(N); ++i) chmax(d, A[i + 1] - A[i]);
  cout << K - d << endl;

  return 0;
}


Measured memory_bytes: 1804
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;int k;
  cin>>k;cin>>s;int n=s.length();
  for(int i=0;i<n;i++)
  {
    s[i]=((s[i]-65)+k)%26 + 65;
  }
  cout<<s;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
struct fastio { fastio() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _fastio_;
template<class T> bool chmin (T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> bool chmax (T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }

int main() {
	std::size_t n;
	std::cin >> n;
	std::vector<long long> a(n);
	for (auto &e : a) std::cin >> e;
	
	long long ans = 0, max = a[0];
	for (std::size_t i = 1; i < n; i++) {
		if (max > a[i]) {
			ans += max - a[i];
			a[i] = max;
		}
		max = std::max(max, a[i]);
	}
	
	std::cout << ans << '\n';
	
	return 0;
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
typedef long long ll;
typedef pair<ll,ll> p;
template<class t> inline bool chmax(t& a, t b) { if (a < b) { a = b; return 1; } return 0; }
template<class t> inline bool chmin(t& a, t b) { if (a > b) { a = b; return 1; } return 0; }
const ll mod=1000000007;
const ll linf=1ll<<60;
const int inf=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};



int main(){
    int n,q;cin >> n >> q;
    for (int i = 0; i < q; i++) {
        int v,w;cin >> v >> w;
        if(n==1){
            cout << min(v,w) << endl;
            continue;
        }
        set<int> st;
        while(v){
            st.insert(v);
            v = (v + n - 2) / n;
        }
        while(w){
            if(st.find(w) != st.end()){
                cout << w << endl;
                break;
            }
            w = (w + n - 2) / n;
        }
    }
    return 0;
}


Measured memory_bytes: 1280
/**
  * Created by ecdt on 2016/01/18.
  */
object Main {
  def main(args: Array[String]): Unit = {
    for {
      i <- 1 to 9
      j <- 1 to 9
    } yield {
      println(s"${i}x${j}=${i * j}")
    }
  }
}

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

using namespace std;

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

    int k;
    cin >> k;
    int n = k;
    for (int i = 1; i <= k; i++)
    {
        n = n * 10 + 7;
        n %= k;
        if (n == 0)
        {
            cout << i;
            return 0;
        }
    }
    cout << -1;

    return 0;
}


Measured memory_bytes: 3608
n = gets.to_i

edges = []
g = Array.new(n+1){ [] }
(n-1).times do |i|
  a, b = gets.split.map(&:to_i)
  a, b = a.to_i, b.to_i
  a, b = b, a if a > b # 辺は頂点 i < j の形で入れる。
  g[a] << b # 隣接リストに
  g[b] << a # 反対向きにも隣接リストに.無向グラフなので
  edges << [a,b] # 辺リストにいれる。辺が識別されてて、最後に辺リストから辺を回して色をとりだす。
end

colors = Hash.new() # Esge => color # 辺についてO(1)で使った色を見れる。O(1)はホントに?
colors_used = Array.new(n+1){Hash.new} # 頂点と色についてO(1)で使ったか確かめられる。
used = Array.new(n){false} # 頂点について探索済みかどうかO(1)でわかる。
que = [1] # 頂点1から見ていくので0が入っている # 探索待ちの未探索の頂点リスト

k = 0 # 答えとなる色の数
while v = que.shift # queにある頂点を取り出す. 破壊的メソッドなので先頭は削除される。なければnilを返す
  cur = 1 # 使ってない色がわからないので、とりあず色1から見ていく。
  g[v].each do |w| # vの隣接頂点wを見ていく。
    next if used[w] #trueで、探索済みの頂点なら見ない。
    k = g[v].size if k < g[v].size  # 隣接する頂点数より色数が小さければ色数を更新
    v<w ? (i,j = v,w) : (i,j = w,v) # i < jの並びで頂点を捉える。
    # next if colors[[i,j]] != nil # nilでなければi-jの辺に色がついてて頂点jは探索済みで,次に。
    cur += 1 while colors_used[v][cur] == true # v周りの頂点で色をつかっていれば次の色に更新していく。塗る前に使ってない色にする。
    colors_used[v][cur] = true # vに色を使ったので記録する。
    colors_used[w][cur] = true # wに色を使ったので記録する。
    colors[[i,j]] = cur # 辺に使った色をいれる。
    que.push(w) #探索待ちの未探索頂点リストに頂点wを入れる。
  end
  used[v] = true # 頂点vを探索済みにする。
end

puts k
edges.each{ |e| puts colors[e] }

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  vector<int> a(n), b(n, 0);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  int mem = 0;
  
  while (true){
    if (b[mem] == 1){
      ans = -1;
      break;
    }
    ans++;
    if (a[mem] == 2) break;
    b[mem] = 1;
    mem = a[mem];
    mem--;
  }
  cout << ans << endl;
}
    

Measured memory_bytes: 3976
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

struct State {
    counts: [u64; 13],
    power: u64,
}

fn rec(st: State, c: char) -> State {
    let power = (st.power * 10) % 13;
    let range = if let Some(x) = c.to_digit(10) {
        x..(x + 1)
    } else {
        0..10
    };
    let mut counts = [0; 13];
    for i in range {
        let base = power * i as u64;
        for (j, &count) in st.counts.iter().enumerate() {
            let rem = ((base + j as u64) % 13) as usize;
            counts[rem] += count;
            counts[rem] %= 1_000_000_007;
        }
    }

    State {
        counts: counts,
        power: power,
    }
}

fn initialize(c: char) -> [u64; 13] {
    let mut a = [0; 13];
    if let Some(x) = c.to_digit(10) {
        a[x as usize] = 1;
    } else {
        for i in 0..10 {
            a[i] = 1;
        }
    }
    a
}

fn evaluate(v: Vec<char>) -> u64 {
    let init = State {
        counts: initialize(v[0]),
        power: 1,
    };
    v[1..].into_iter().fold(init, |st, &c| rec(st, c)).counts[5]
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let v: Vec<char> = iter.next().unwrap().chars().rev().collect();

    println!("{}", evaluate(v));
}


Measured memory_bytes: 4476
#include <stdio.h>

int gcd( int, int );

int main( void ) {
	int a, b, G;

	for ( ; scanf( "%d %d", &a, &b ) != EOF; printf( "%d %d\n", G, a / G * b ) )
		G = gcd( a, b );

	return 0;
}

int gcd( int a, int b ) {
	return b == 0 ? a : gcd( b, a % b );
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}

ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b);}

int counter(int x){
    if(x==0) return 0;
    return counter(x>>1)+(x&1);
}


int main(){
    fast_io

    int ans=0;
    int x, y;
    cin>>x>>y;

    if(x==1) ans+=300000;
    if(x==2) ans+=200000;
    if(x==3) ans+=100000;
    if(y==1) ans+=300000;
    if(y==2) ans+=200000;
    if(y==3) ans+=100000;
    if(x==1&&y==1) ans+=400000;

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

Measured memory_bytes: 256
def task_b():
    ss = input().strip()
    a = int(ss[:2])
    b = int(ss[2:])
    if 1 <= a <= 12 and 1 <= b <= 12:
      	print('AMBIGUOUS')
    elif 1 <= a <= 12 and not 1 <= b <= 12:
      	print('MMYY')
    elif not 1 <= a <= 12 and 1 <= b <= 12:
    	print('YYMM')
    else:
    	print('NA')
task_b()

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, n;
  cin >> x >> n;
  if (n == 0) {
    cout << x << '\n';
  } else {
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
      cin >> p[i];
    }
    int ans = -1;
    for (int i = 0; i < 101; i++) {
      int check = x - i;
      bool ok = true;
      for (int j = 0; j < n; j++) {
        if (check == p[j]) {
          ok = false;
        }
      }
      if (ok) {
        ans = check;
        break;
      }

      check = x + i;
      ok = true;
      
      for (int j = 0; j < n; j++) {
        if (check == p[j]) {
          ok = false;
        }
      }
      if (ok) {
        ans = check;
        break;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}

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

int main()
{
  stack<int> a;
  int n;
  while (cin >> n){
    if (n == 0){
      cout << a.top() << endl;
      a.pop();
    }
    else {
      a.push(n);
    }
  }

  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
//#define MOD 1000000007
#define MOD 998244353
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n;
double a[55];
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	for(int i=1;i<n;i++){
		a[i]=(a[i-1]+a[i])/2;
	}
	printf("%.12lf\n",a[n-1]);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i = 0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int ROUND = 10, STR = 2, SP = 1;
typedef pair<int, int> pp;
int main()
{
    int m;
    while(cin >> m && m)
    {
        vector<pp> po;
        rep(k,m)
        {
            int snum, t;
            cin >> snum;

            vector<int> th_pin;
            int fir, sec;
            for(int i_f = 0;i_f < 9; i_f++)
            {
                cin >> fir;
                th_pin.push_back(fir);
                if(fir == 10){ continue;}
                cin >> sec;
                th_pin.push_back(sec);
            }
            cin >> fir;
            if(fir == 10)
            {
                cin >> sec >> t;
                th_pin.push_back(fir); th_pin.push_back(sec);th_pin.push_back(t);
            }
            else
            {
                cin >> sec;
                th_pin.push_back(fir); th_pin.push_back(sec);
                if(fir + sec == 10){cin >>t ; th_pin.push_back(t);}
            }
            //REP(th_pin.size()) cout << i << "th " << th_pin[i] << endl;
            int f_point[10] = {};
            int th = 0;
            for(int i_f = 0;i_f < 10; i_f++)
            {
                if(th_pin[th] == 10)
                    f_point[i_f] = th_pin[th] + th_pin[th+1] + th_pin[th+2];
                else if(th_pin[th] + th_pin[th+1] == 10)
                {
                    f_point[i_f] = th_pin[th] + th_pin[th+1] + th_pin[th+2];
                    th++;
                }
                else
                {
                    f_point[i_f] = th_pin[th] + th_pin[th+1];
                    th++;
                }
                th++;
            }
            int point = 0;
            REP(10) point += f_point[i];
            po.push_back(pp(-point, snum));
        }
        sort(all(po));

        REP(po.size()) cout << po[i].second << " " << -po[i].first << endl;

    }
    return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;

lli modpow(lli a, lli p, lli mod){
	lli ret = 1;
	for(int i=63; i>=0; i--){
		if(ret > (lli)1e7) return -1;
		ret *= ret;
		if(ret > mod) return -1;
		if((1LL<<i & p) != 0){
			ret *= a;
			if(ret > mod) return -1;
		}
	}
	return ret;
}

int main(){
	lli n,p;
	cin >> n >> p;
	if(n == 1){
		cout << p << endl;
		return 0;
	}
	lli ans = 1;
	for(lli i=2; ; i++){
		lli ret = modpow(i, n, p);
		if(ret == -1) break;
		while(p%ret == 0){
			p /= ret;
			ans *= i;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
w=input().strip()

w1 = w[:2]
w2 = w[2:]

m = list(map(lambda x:'%02d' % x, range(1, 13)))
y = list(map(lambda x:'%02d' % x, range(0, 100)))


f1 =  w1 in m
f2 =  w1 in y
f3 =  w2 in m
f4 =  w2 in y


if (f1 and f4) and (f2 and f3):
    print("AMBIGUOUS")
elif ((not f1) and (f2)) and (f3):
    print('YYMM')
elif (f1 and f4) :
    print("MMYY")
else:
    print('NA')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int a,b,c,k; cin>> a >> b >> c >> k;
    rep(i,k){
        if(a>=b) b*=2;
        else if(b>=c) c*=2;
    }
    if(a<b && b<c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long
int memo[50];
int fib(int n){
  if(~memo[n]) return memo[n];
  if(n<=1) return 1;
  return memo[n]=(fib(n-1)+fib(n-2));
}
signed main(){
  int n;
  cin>>n;
  memset(memo,-1,sizeof(memo));
  cout<<fib(n)<<endl;
  return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define ll u_int64_t
#define rep(i, n) for (int i=0; i<n; i++)
 
using namespace std;
const double PI = acos(-1);
using Graph = vector<vector<int>>;
 
int main() {
int a, b, c, k;
cin >> a >> b >> c >> k;
 if(k <= a) cout << k << endl;
 else if(k <= a + b) cout << a << endl;
 else cout << a - (k - a - b) << endl;
 return 0;
}


Measured memory_bytes: 3572
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll n; cin >> n; vl dif(n);
  
  rep(i,n) cin >> dif[i];
  
  sort(all(dif));
  
  cout << dif[n/2] - dif[n/2 - 1] << endl;
  
}
 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define pf pop_front
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod=1e9+7;
const ll maxn=2e5+100;
ll n,k;
double p[200005];
double sum[200005];
int main()
{
    while(cin>>n>>k)
    {
        rep1(i,n) cin>>p[i];
        sum[0]=0;
        rep1(i,n)
        {
            sum[i]=sum[i-1]+p[i];
        }
        double ans=0;
        rep1(i,n)
        {
            if(i-k<0) continue;
            ans=max(ans,sum[i]-sum[i-k]);
        }
        cout<<fixed<<setprecision(6)<<(ans+k)/2<<"\n";

    }
}



Measured memory_bytes: 3328
A,B,C,Q = map(int,input().split())
N = int(input())
P = min(4*A,2*B,C)

if N % 2 == 0 :
    ans = min(P*N,Q*N//2)
else :
    ans = min(P*(N-1), Q*(N-1)//2) + P
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,A[200005];
vector <long long> v[200005];
string s;
int main() {
	cin>>n>>m;
	for(long long i=1;i<=n;i++) {
		cin>>A[i];
	}
	for(long long i=1;i<=m;i++) {
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for(long long i=1;i<=n;i++) {
		l=0;
		for(long long j=0;j<v[i].size();j++) {
			if(A[i]<=A[v[i][j]]) { l=1; break; }
		}
		if(l==0) k++;
	}
	cout<<k;
}

Measured memory_bytes: 12604
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int ans[3];
	cin>>ans[0]>>ans[1]>>ans[2];
	sort(ans,ans+3,cmp);
	int sum=ans[0]*10+ans[1]+ans[2];
	cout<<sum<<endl; 
	return 0;
}

Measured memory_bytes: 256
import numpy as np
N,M  = map(int,input().split())

num_l=[]

for i in range(N):
  d=list(map(int,input().split()))
  num_l.append(d)
         
num_2=np.array(num_l)


n=0
for i in range(N):
  for j in range(i+1,N):
    if(np.linalg.norm(num_2[i]-num_2[j]).is_integer()):
      n+=1
print(n)

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

int32_t main()
{
  IOS;
  int t;
  cin>>t;
  if(t>=30) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>

int main(){
  int x,y,n,d;
  
  scanf("%d%d",&x,&y);
  
  if(x==y){
      printf("%d\n",x);
      return 0;
  }

  if(x>y){
    n=y;
  }else{
    n=x;
  }
  
  for(d=n/2;d>0;d--){
    if(x%d==0&&y%d==0){
      printf("%d\n",d);
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 2080
import math
A, B, H, M = map(int, input().split())

h2min = H * 60 + M
s_long = 1/2 * h2min
s_short = 6 * M
if s_long >= s_short:
    small = s_short
    big = s_long
else:
    small = s_long
    big = s_short
d1 = big - small
d2 = 360 - big + small
if d1 <= d2:
    d = d1
else:
    d = d2
c = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(d)))
print(c)


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const long long INF = 2e18;
const long long MOD = 1e9+7;

#define sx(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i < n; i++)
#define ALL(a) begin(a),end(a)

int main(void) {
    string S;
    cin >> S;
    sort(ALL(S));
    if (S[0] == S[1] && S[2] == S[3] && S[1] != S[2]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256