akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
retu = int(input())
gyo1 = list(map(int,input().split()))
gyo2 = list(map(int,input().split()))
num = 0
kai=0
boss=[]
for i in range(retu):
    for ii in range(i + 1):
        num += gyo1[ii]
    for iii in range(retu-i):
        num += gyo2[iii+i]
    boss.append(num)
    num=0
#print(boss)
oss = sorted(boss)
print(oss[retu-1])

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 110
const int MOD = 1000000007;

void solve() {
    int n;
    cin >> n;

    map<int, int> mp;
    for (int i = n; i > 0; i--) {
        int cur = i;
        for (int j = 2; j <= i; j++) {
            while (cur % j == 0)
                mp[j]++, cur /= j;
        }
    }

    map<int, int> cnt;
    for (auto x: mp) {
        if (x.second >= 74)cnt[74]++;
        if (x.second >= 14)cnt[14]++;
        if (x.second >= 4)cnt[4]++;
        if (x.second >= 24)cnt[24]++;
        if (x.second >= 2)cnt[2]++;
    }
    int ans = 0;
    //5 5 3
    ans = cnt[4] * (cnt[4] - 1) * (cnt[2] - 2) / 2;
    // 15 5
    ans += (cnt[4] - 1) * cnt[14];
    // 75
    ans += cnt[74];
    // 25 3
    ans += (cnt[2] - 1) * cnt[24];
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(strings.Split(sc.Text(), " ")[0])

	var queues = make([][]string, num)
	for i := range queues {
		queues[i] = []string{}
	}

	for sc.Scan() {
		inputs := strings.Split(sc.Text(), " ")
		i, _ := strconv.Atoi(inputs[1])

		switch inputs[0] {
		case "0":
			queues[i] = append(queues[i], inputs[2])
		case "1":
			if len(queues[i]) > 0 {
				fmt.Println(queues[i][0])
			}
		case "2":
			if len(queues[i]) > 0 {
				queues[i] = queues[i][1:]
			}
		}
	}
}



Measured memory_bytes: 19904
import java.io.*;
import java.util.*;
class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int n=Integer.parseInt(bu.readLine());
        int i,j,k,a[]=new int[n],c=0;
        String s[]=bu.readLine().split(" ");
        for(i=0;i<n;i++)
            a[i]=Integer.parseInt(s[i]);

        for(i=0;i<n;i++)
        for(j=i+1;j<n;j++)
        for(k=j+1;k<n;k++)
        {
            Set<Integer> set=new HashSet<>();
            set.add(a[i]); set.add(a[j]); set.add(a[k]);
            if(set.size()!=3) continue;
            if(possible(a[i],a[j],a[k])) c++;
        }
        System.out.print(c);
    }

    static boolean possible(int a,int b,int c)
    {
        if(a+b>c && b+c>a && a+c>b) return true;
        else return false;
    }
}

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

int main(){
    int n;
    cin>>n;
    int flag = 0;
    for (int i=0; i<n; i++){
        int num;
        cin>>num;
        if (num%2==0){
            if (num%3!=0 and num%5!=0){
                cout<<"DENIED\n";
                flag = 1;
                break;
            }
        }
    }
    if (flag==0){
        cout<<"APPROVED\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
s=int(input())
def f(x):
    if x%2==0:
        return x/2
    else:
        return x*3+1
a=[s]

for i in range(10**8):
    ai1=f(a[i])
    if ai1 in a:
        print(i+2)
        break
    else:
        a.append(ai1)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;
#define endl '\n'

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

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

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

	double r; cin >> r;
	cout << setprecision(15) << r * 2 * acos(-1) << endl;

	return 0;
}


Measured memory_bytes: 3828
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <cstring>
#include <iostream>
#include<algorithm>
#include <queue>
#include <map>
#include <vector>
#include <cmath>
#define INF 0x3f3f3f3f
using namespace std;
#define N 105
#define LL long long

char Map[N][N];
int n, m;

int tab[4][2]=
{
    {0, 1}, {0, -1}, {-1, 0}, {1, 0},
};

void dfs(int x, int y, char ch)
{
    int X, Y, i;
    if(Map[x][y]==ch)
    {
        Map[x][y]='.';
    }
    for(i=0;i<4;i++)
    {
        X=x+tab[i][0];
        Y=y+tab[i][1];
        if(X>=0&&X<n&&Y>=0&&Y<m&&Map[X][Y]==ch)
        {
                dfs(X, Y, ch);
        }
    }
}

int main()
{
    int i, j, sum;
    char ch;
    while(scanf("%d%d", &n, &m), n!=0&&m!=0)
    {
        sum=0;
        for(i=0;i<n;i++)
        {
            scanf("%s", Map[i]);
        }
        for(i=0;i<n;i++)
        {
            for(j=0;j<m;j++)
            {
                if(Map[i][j]!='.')
                {
                    sum++;
                    ch=Map[i][j];
                    dfs(i, j, ch);
                }
            }
        }
        printf("%d\n", sum);
    }
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<map>
#include<cmath>
#define ll long long
using namespace std;
ll N, M;
ll A, B;
int main(){
  cin >> N >> M;
  map<ll, ll> f;
  for(int i=0; i<N; i++){
    cin >> A >> B;
    f[A] += B;
  }
  ll ans=0;
  for(auto u= f.begin(); u!= f.end(); u++){
    ans += u->first * min(M, u->second);
    if (M -(u->second)<= 0) break;
    M -= u->second;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6528
use std::io::stdin;
use num::integer;


fn main() {
    let mut string = String::new();
    stdin().read_line(&mut string);
    let K: i64 = string.trim().parse().unwrap();
    let mut sum: i64 = 0;
    for a in 1..K + 1 {
        for b in 1..K + 1 {
            for c in 1..K + 1 {
                let mut gcd = integer::gcd(a, b);
                gcd = integer::gcd(gcd, c);
                sum += gcd;
            }
        }
    }
    println!("{:?}", sum);
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	float sum=0;
	cin>>N;
	int A[N];
	for(int i =0;i<N;i++){
		cin>>A[i];
		sum+=A[i];
	}
	float Promedio=sum/N;
	int num=round(Promedio),costo=0;
	for(int i =0;i<N;i++){
		costo+=pow((A[i]-num),2);
	}
	cout<<costo;


	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ull)(1e9)+7)

int main(){
	ll n;
	cin >> n;
	if(n==0){
		cout << 0 << endl;
		return 0;
	}

	vector<int> s;
	while(n!=0){
		int k=abs(n)%2;
		s.push_back(k);
		n=-(n-k)/2;
	}
	for(int i=s.size()-1; i>=0; i--){
		cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let W = read::<i32>();
    let H = read::<i32>();
    let N = read::<i32>();
    let mut x_botom = 0;
    let mut x_upper = W;
    let mut y_botom = 0;
    let mut y_upper = H;
    for n in 0..N {
        let x = read::<i32>();
        let y = read::<i32>();
        let a = read::<i32>();
        match a {
            1 => { x_botom = if x_botom < x {x} else {x_botom}; },
            2 => { x_upper = if x < x_upper {x} else {x_upper}; },
            3 => { y_botom = if y_botom < y {y} else {y_botom}; },
            4 => { y_upper = if y < y_upper {y} else {y_upper}; },
            _ => {},
        }
    }
    if x_upper - x_botom > 0 && y_upper - y_botom > 0 {
        println!("{}", (x_upper - x_botom)*(y_upper - y_botom));
    } else {
        println!("0");
    }
}


Measured memory_bytes: 4352
num_ver, num_edge = map(int,input().split())
# 隣接行列
graph_mat = [[0]*num_ver for _ in range(num_ver)]

for i in range(num_edge):
    start, goal = map(int,input().split())
    start -= 1
    goal -= 1
    graph_mat[start][goal] = 1
    graph_mat[goal][start] = 1

visited = [0] * num_ver


#再帰関数
def dfs(now, depth):
    if visited[now]:
        return 0
    if depth == num_ver - 1:
        return 1

    visited[now] = 1
    total_paths = 0
    # 「同じ深さの処理」＝場合わけ
    for i in range(num_ver):
        if graph_mat[now][i]:
            total_paths += dfs(i, depth + 1)

    visited[now] = 0

    return total_paths

print(dfs(0, 0))




Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  string s;
  cin >> n >> s;
  vvl dp(10,vl(n,0));
  ll cnt=0;
  rep(i,1000){
    bool a=false,b=false,c=false;
    rep(j,n){
      if(!a&&i/100==s[j]-'0'){
        a=true;
      }
      else if(!b&&a&&(i/10)%10==s[j]-'0'){
        b=true;
      }
      else if(!c&&a&&b&&i%10==s[j]-'0'){
        c=true;
      }
    }
    if(c){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 2944
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto N = readln.chomp.to!int;
    auto a = readln.split.to!(int[]).array;

    Tuple!(int, int)[] outputResult;
    alias output = (x,y) => outputResult ~= tuple(x, y);
    auto positiveMax = max(0, a.reduce!max);
    auto negativeMax = max(0, -a.reduce!min);

    if (positiveMax > negativeMax) {
        //all positive
        auto maxIndex = cast(int)a.enumerate.reduce!((a,b) => a.value > b.value ? a : b).index;
        foreach (i; 0..N) {
            if (a[i] < 0) {
                output(maxIndex, i);
            }
        }
        // maximize left
        output(maxIndex, 0);
        // all up
        foreach (i; 1..N) {
            output(i-1, i);
        }
    } else {
        // all negative
        auto minIndex = cast(int)a.enumerate.reduce!((a,b) => a.value < b.value ? a : b).index;
        foreach (i; 0..N) {
            if (a[i] > 0) {
                output(minIndex, i);
            }
        }
        // minimize right
        output(minIndex, N-1);
        // all down
        foreach_reverse(i; 1..N) {
            output(i,i-1);
        }
    }

    writeln(outputResult.length);
    foreach (o; outputResult) {
        writefln("%d %d", o[0]+1, o[1]+1);
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define M_PI 3.14159265358979323846

int main()
{
// clock_t begin = clock();
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
tani_nachi_ke  

int n,m;
cin>>n>>m;
char arr[n+1][m+1];
for(int i=1; i<=n; i++)
{
  for(int j=1; j<=m; j++)cin>>arr[i][j];
}
long long mod=1e9+7;
long long dp[n+1][m+1];
memset(dp,0,sizeof(dp));
dp[1][1]=1;
for(int i=1; i<=n; i++)
{
  for(int j=1; j<=m; j++)
  {
    if(arr[i][j]=='#'||(i==1&&j==1))continue;
    dp[i][j]=(dp[i][j-1]+dp[i-1][j])%mod;
  }
}
cout<<dp[n][m]<<endl;

// #ifndef ONLINE_JUDGE 
// clock_t end = clock();
// cout<<endl<<double(end - begin) / CLOCKS_PER_SEC*1000<<" ms";
// #endif 
// return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;cin>>s;
    int n=s.size();
    long array[2019]={0};
    long dp[n+1];
    dp[n]=0;
    array[0]=1;
    int a=1;
    for(int i=n-1;i>=0;i--){
        dp[i]=(dp[i+1]+a*(s.at(i)-'0'))%2019;
        array[dp[i]]++;
        a=10*a%2019;
    }
    long res=0;
    for(int i=0;i<2019;i++){
        res=res+((array[i]-1)*array[i])/2;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 5208
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

char s[10000];
char g[10000];
int in[128];
int out[128];
bool chk[10000];
int n;

int cnt(int i){
  int ret = 1;
  chk[i] = true;
  REP(j,n)
    if((g[i] == s[j] || g[i] == g[j]) && !chk[j])
      ret += cnt(j);
  return ret;
}

int main(){
  while(scanf("%d ",&n), n){
    REP(i,128) in[i] = out[i] = 0;
    REP(i,n){
      char tmp[64];
      scanf("%s",tmp);
      s[i] = tmp[0];
      g[i] = tmp[strlen(tmp) - 1];

      in[s[i] - 'a']++;
      out[g[i] - 'a']++;
      chk[i] = false;
    }

    if(cnt(0) != n)
      goto ng;

    REP(i,128){
      if(in[i] != out[i])
        goto ng;
    }

    puts("OK");
    continue;

  ng:
    puts("NG");
    continue;
  }

  return 0;
}

Measured memory_bytes: 1112
#include <iostream>
#include <string>
#include <set>
#include <map>

using namespace std;

int main() {

	string s, t;
	cin >> s >> t;

	set<char> st, st2;
	map<char, char> mp, mp2;

	bool hh = true;

	for (int i = 0; i < s.size(); i++) {
		if (st.find(s[i]) == st.end()) {
			mp[s[i]] = t[i];
			st.insert(s[i]);
		}
		else if (mp[s[i]] != t[i]){
			//cout << i << endl;
			hh = false;
		}
		if (st2.find(t[i]) == st2.end()) {
			mp2[t[i]] = s[i];
			st2.insert(t[i]);
		}
		else if (mp2[t[i]] != s[i]){
			//cout << ' ' << i << endl;
			hh = false;
		}
	}

	if (hh) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;

int main() {
	ll h, w, k;
	cin >> h >> w >> k;
	k--;
	vector<vector<ll>> dp(h + 1, vector<ll>(w));

	vector<ll> cnt(w);
	cnt[0] = 1;
	if (w > 1) {
		cnt[1] = 1;
		for (int i = 2; i < w;i++) {
			cnt[i] = cnt[i - 1] + cnt[i - 2];
		}
	}
	

	dp[0][0] = 1;


	for (ll i_h = 1; i_h <= h;i_h++) {
		for (ll i_w = 0;i_w < w;i_w++) {
			{	ll coeff = (cnt[max(i_w , 0LL)]*cnt[max(w - 1 - i_w, 0LL)]) % MOD_CONST;
			dp[i_h][i_w] = (dp[i_h - 1][i_w] * coeff)%MOD_CONST;
			}
			//cout << dp[i_h][i_w] << " " <<i_h << " " << i_w<< endl;
			if (i_w != 0) {

				ll coeff = (cnt[max(i_w - 1, 0LL)]*cnt[max(w - 1 - i_w, 0LL)]) % MOD_CONST;
				dp[i_h][i_w] += (dp[i_h - 1][i_w - 1] *coeff)%MOD_CONST;
				dp[i_h][i_w] %= MOD_CONST;
				//cout << dp[i_h][i_w] << " " << i_h << " " << i_w << endl;
			}
			
			if (i_w != w - 1) {
				ll coeff = (cnt[max(i_w , 0LL)]*cnt[max(w - 2- i_w, 0LL)]) % MOD_CONST;
				
				dp[i_h][i_w] += (dp[i_h - 1][i_w + 1] * coeff) %MOD_CONST;
				dp[i_h][i_w] %= MOD_CONST;
				//cout << dp[i_h][i_w] << " " << i_h << " " << i_w << endl;
			}
			
			

		}
	}

	cout << dp[h][k] << endl;
	/*
	ll sum = 0;
	for(int i = 0;i < w; i++) {
		sum += dp[h][i];
		cout << dp[h][i] << endl;
	}
	cout << sum << endl;
	*/

}


Measured memory_bytes: 256
import java.util.Scanner;



public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            if (c % i == 0) {
                count++;
            }
        }
        System.out.println(count);

    }

}



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


class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var d = Console.ReadLine().Split(' ');

        var ret = 0;
        for (var i = 0; i < n; i++)
        {
            for (var j = i + 1; j < n; j++)
            {
                ret += (int.Parse(d[i]) * int.Parse(d[j]));
            }
        }

        Console.Write(ret);
    }
}

Measured memory_bytes: 13140
#include <stdio.h>

void sort(int *array, int length);

int main(int argc, char *argv[])
{
	int i;
	int heights[10];
	for (i=0; i<10; i++) {
		fscanf(stdin, "%d", &heights[i]);
	}

	sort(heights, 10);

	for (i=0; i<3; i++) {
		printf("%d\n", heights[i]);
	}

	return 0;
}

void sort(int *array, int length)
{
	int i, j;
	for (i=0; i<length; i++) {
		for (j=length-1; j>i; j--) {
			if (array[j] > array[j-1]) {
				int w;
				w = array[j-1];
				array[j-1] = array[j];
				array[j] = w;
			}
		}
	}
}

Measured memory_bytes: 604
import bisect

N=int(input())
As=sorted(list(map(int,input().split())))
Bs=sorted(list(map(int,input().split()))) #Bsはソートしなくてもよい
Cs=sorted(list(map(int,input().split())))

Ans=0

for B in Bs:
    a=bisect.bisect_left(As, B)
    c=len(Cs)-bisect.bisect_right(Cs,B)
    Ans+=a*c
    
print(Ans)


Measured memory_bytes: 23156
// atcoder/abc054/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s[] = {
    "2",
    "3",
    "4",
    "5",
    "6",
    "7",
    "8",
    "9",
    "10",
    "11",
    "12",
    "13",
    "1",
  };

  string a, b;
  while (cin >> a >> b) {
    if (a == b) cout << "Draw" << endl;
    else cout << (find(begin(s), end(s), a) - s > find(begin(s), end(s), b) - s ? "Alice" : "Bob") << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;

// #define DEBUG

class Unionfind
{
    vector<int> p;

public:
    Unionfind(int n);
    int find(int x);
    void unite(int x, int y);
    bool match(int x, int y);
};

Unionfind::Unionfind(int n)
{
    for (int i = 0; i < n; i++)
    {
        p.push_back(i);
    }
}

int Unionfind::find(int x)
{
    while (p[x] != x)
    {
        p[x] = p[p[x]];
        x = p[x];
    }
    return x;
}

bool Unionfind::match(int x, int y)
{
    return (find(x) == find(y)) ? true : false;
}

void Unionfind::unite(int x, int y)
{
    x = Unionfind::find(x);
    y = Unionfind::find(y);
    if (x != y)
    {
        p[x] = y;
    }
}

int main()
{
#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, d, x, y, ans;
    cin >> n;
    Unionfind tree(n);
    priority_queue<tuple<int, int, int>> pq;
    tuple<int, int, int> w;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin >> x;
            if (x != -1)
            {
                pq.push(make_tuple(-x, i, j));
            }
        }
    }

    ans = 0;
    while (!pq.empty())
    {
        w = pq.top();
        d = -get<0>(w), x = get<1>(w), y = get<2>(w);
        pq.pop();
        if (!tree.match(x, y))
        {
            tree.unite(x, y);
            ans += d;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3184
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {

  ll  K,A,B;

  cin >> K;
  cin >> A;
  cin >> B;
  
  if(A>=B-1){
    cout << K+1 <<endl;
    return 0;
  }

  if(K-2+1<A){
    cout << K+1 <<endl;
    return 0;
  }

  ll num;
  num=(K-(A-1))/2;

  if((K-(A-1))%2==0){
    cout << num*(B-A)+A << endl;
  }else{
    cout << num*(B-A)+A+1 << endl;
  }
  return 0;
   
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 100001
struct edge{ int to,cost; };
typedef pair<int,int> P;

int N,M;
int d[MAX_N];
vector< edge > G[MAX_N];

int main(){
  cin>>N>>M;
  for(int i=0;i<M;i++){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    G[a].push_back((edge){b,c});
  }
  
  int ans=-1;  
  priority_queue< P , vector<P> , greater<P> > Q;

  fill(d,d+MAX_N, (1e9+1) );
  Q.push(P(1,1));
  d[1]=1;
  
  while(!Q.empty()){
    P p=Q.top();Q.pop();
    int pos=p.second;
    int cost=p.first;
    if(d[pos]<cost)continue;
    for(int i=0;i<(int)G[pos].size();i++){
      edge e=G[pos][i];
      if(e.cost<d[pos])continue;
      if(e.to==N)ans=max(ans,e.cost);
      if(d[e.to]>e.cost){
        d[e.to]=e.cost;
        Q.push(P(d[e.to],e.to));
      }
    }
  }

  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 9572
import sys
from collections import Counter

input = sys.stdin.readline

n = int(input())
S = [input().rstrip() for _ in range(n)]

c = Counter(S).most_common()

words = []
max = c[0][1]
for i in range(len(c)):
    if max == c[i][1]:
        words.append(c[i][0])

words.sort()
print(*words, sep='\n')


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

int main() {
	int A, B; cin >> A >> B;
	if (A > B) {
		int save = A;
		A = B;
		B = save;
	}
	int N = 16 - 2 * A;
	N++;
	N /= 2;
	B -= A;
	if (N < B) {
		cout << ":(" << endl;
		return 0;
	}
	else {
		cout << "Yay!" << endl;
		return 0;
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL n,a,b;
	cin>>n>>a>>b;
	if(n==1){
		if(a==1&&b==1){
			cout<<1<<endl;
		}else{
			cout<<-1<<endl;
		}
		return 0;
	}
	if(n<a||n<b||n<a+b-1||a*b<n){
		cout<<-1<<endl;
		return 0;
	}
	if(a==n&&b==1){
		FOR(i,1,n){
			cout<<i<<" ";
		}
		cout<<n<<endl;
		return 0;
	}
	if(a==1&&b==n){
		FORD(i,n+1,2){
			cout<<i<<" ";
		}
		cout<<1<<endl;
		return 0;
	}
	LL r=1LL*a*b-n;
	FOR(i,0,a){
		cout<<n-a+1+i<<" ";
	}
	//int rem[312345]={};
	FORD(i,n-a+1,1){
		if(r>a-1){
			//cout<<" n ";
			r-=a-1;
			cout<<i<<" ";
		}else if(r>0){
			//cout<<" m ";
			FOR(j,0,a-r){
				cout<<(i-a+r+1+j)<<" ";
			}
			i-=a-r-1;
			r-=r;
		}else{
			//cout<<" a ";
			FOR(j,-a,0){
				cout<<i+j+1<<" ";
			}
			i-=a-1;
		}
	}
	cout<<endl;
    return 0;
}


Measured memory_bytes: 2176
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        if(n == 1 && m == 0){
            System.out.println(0);
            return;
        }
        int[] s = new int[m];
        int[] c = new int[m];
        int[] out = new int[n];
        for(int i = 0; i < m; i++){
            s[i] = scan.nextInt();
            c[i] = scan.nextInt();
        }
        out[0] = 1;
        boolean[] isExist = new boolean[n];
        Arrays.fill(isExist, true);
        for(int i = 0; i < m; i++){
            if(isExist[s[i] - 1] || out[s[i] - 1] == c[i]) {
                out[s[i] - 1] = c[i];
                isExist[s[i] - 1] = false;
            }else{
                System.out.println(-1);
                return;
            }
        }
        if(out[0] == 0 && n != 1){
            System.out.println(-1);
            return;
        }
        for(int i = 0; i < n; i++) System.out.print(out[i]);
        scan.close();
    }
}


Measured memory_bytes: 27056
a,b,c,x,y=map(int,input().split())
X=x
Y=y
MIN=10**9
while True:
    sum_=a*x+b*y+2*c*(max(X-x,Y-y))
    MIN=min(MIN,sum_)
    if x==0 and y==0:
        break
    if x>0:
        x-=1
    else:
        x=0
    if y>0:
        y-=1
    else:
        y=0
print(MIN)

Measured memory_bytes: 39408
#include <iostream>

using namespace std;

int main()
{

	string S, T;
	cin >> S >> T;

	int count = 0;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] != T[i]) {
			count++;
		}
	}

	cout << count << endl;
	


}





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

 
#define infi            1e9
#define infl            1e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)
 
using namespace std;
 
inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
// inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
// inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
//inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}
 
// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//


int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif
    //freopen("in.txt", "r", stdin);
    
    int n=rr;
    
    int d=n/15;

    cout << (n*800) - (d*200) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define rep(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define irep(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define rrep(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

const int MOD = 1e9 + 7;

int main() {
    string s;
    cin >> s;
    if (s.size() >= 4 && s.substr(0, 4) == "YAKI")
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 768
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <cassert>

using namespace std;
int main(){
    string s;
    cin >> s;
    assert(!s.empty());

    if(s.find("9")!=string::npos) {
        cout << "Yes";
    } else{
        cout << "No";
    }
    return 0;

}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  int n, k;
  cin >> n >> k;
  if (n > k) {
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }

  return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k,tmp;
    cin>>n>>k;
    set <int, greater <int> > g;
    while(k--){
        int d;
        cin>>d;
        while(d--){
            cin>>tmp;
            g.insert(tmp);
        }
        
    }
    cout<<n-g.size();
    return 0;
}


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

int monthfront(string s){
  if((s.at(0) == '0' && s.at(1) != '0') || (s.at(0) == '1' && (s.at(1) == '0' || (s.at(1) == '1' || s.at(1) == '2')))){
    return 1;
  }else{
    return 0;
  }
}

int monthback(string s){
  if((s.at(2) == '0' && s.at(3) != '0') || (s.at(2) == '1' && (s.at(3) == '0' || (s.at(3) == '1' || s.at(3) == '2')))){
    return 1;
  }else{
    return 0;
  }
}

int main() {
  string s;
  cin >> s;
  if(monthfront(s) == 0 && monthback(s) == 0){
    cout << "NA" << endl;
  }else if(monthfront(s) == 0 && monthback(s) == 1){
    cout << "YYMM" << endl;
  }else if(monthfront(s) == 1 && monthback(s) == 0){
    cout << "MMYY" << endl;
  }else{
    cout << "AMBIGUOUS" << endl;
  }
}

Measured memory_bytes: 256
import numpy as np
NUMBER = 998244353
 
N = int(input())
D = list(map(int, input().split()))
bincnt = np.bincount(D)
if D[0] != 0:
    print('0')
elif (bincnt==0).sum() > 0:
    print('0')
elif bincnt[0]!=1:
    print('0')
else:
    val = 1
    for i in range(2, bincnt.shape[0]):
        for _ in range(bincnt[i]):
            val = (val*bincnt[i-1]%NUMBER)
    print(val)

Measured memory_bytes: 23388
N, M = map(int, input().split())

ans = 0
if(N<2 and M<2):
    ans = 0
elif(N<2 and M>=2):
    ans = M*(M-1)/2
elif(N>=2 and M<2):
    ans = N*(N-1)/2
else:
    ans = M*(M-1)/2 + N*(N-1)/2

print(int(ans))

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

int main() {
	int N;
	cin >> N;
	vector<int> A(N), B(N), C(N);
	for (int& i : A) cin >> i;
	for (int& i : B) cin >> i;
	for (int& i : C) cin >> i;
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	vector<long> a(N);
	for (int i = 0; i < N; i++) a[i] = C.end() - upper_bound(C.begin(), C.end(), B[i]);
	for (int i = N - 1; 0 < i; i--) a[i - 1] += a[i];
	long ans = 0;
	for (int& i : A) {
		vector<int>::iterator b = upper_bound(B.begin(), B.end(), i);
		if (b == B.end()) continue;
		ans += a[b - B.begin()];
	}
	cout << ans;
}

Measured memory_bytes: 2176
from functools import reduce
l = int(input())
src = list(map(lambda x: 1 if x=="." else 0, input()))
left_black = 0
right_white = sum(src)
ans = right_white
for i in range(l):
  if src[i]==0:
    left_black+=1
  else:
    right_white-=1
  ans = min(ans, left_black + right_white)
  if ans==0:
    break
print(ans)

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

int main()
{
  int i,j,k,l,m;
  cin>>i>>j>>k>>l>>m;
  if(i==0)
    cout<<"1\n";
 else  if(j==0)
    cout<<"2\n";
  else if(k==0)
    cout<<"3\n";
  else if(l==0)
    cout<<"4\n";
  else
    cout<<"5\n";
}


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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        for(int i=0;i<3;i++){
            System.out.print(fsc.next().toUpperCase().toCharArray()[0]);
        }
        fsc.close();
    
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


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


int main(){
	int n;
	cin >> n;
	int ans = 0;
	ans += n / 25;
	n %= 25;
	ans += n / 10;
	n %= 10;	
	ans += n / 5;
	n %= 5;	
	ans += n;
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main(){
    speed;
    int a,b,ans=0,temp=1;
    cin >> a >> b;
    while (temp<b){
        temp--;
        temp+=a;
        ans++;
    }
    cout << ans;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;



int main(){
    string S;
    cin >> S;
    ll K;
    cin >> K;
    

    int diff=0;
    for(int i=1; i<S.length(); i++){
        if(S[i]!=S[i-1]){
            diff=1;
            break;
        }
    }
    if(diff==0){
        ll leng=K*S.length();
        cout<<leng/2<<endl;
        return 0;
    }

    
    
    if(S[0]==S[S.length()-1]){
        ll mae=1;
        for(int i=1; i<S.length(); i++){
            if(S[i]==S[0]){
                mae++;
            }else{
                break;
            }
        }
        ll usiro=1;
        for(int i=S.length()-2; i>=0; i--){
            if(S[i]==S[S.length()-1]){
                usiro++;
            }else{
                break;
            }
        }
        
        

        ll ans=0;
        
        S[S.length()-1]='+';
        
        for(int i=mae+1; i<S.length()-usiro; i++){
            if(S[i]==S[i-1]){
                ans++;
                i++;
            }
        }
        ans *= K;

        ans += mae/2;
        ans += usiro/2;
        ans += (mae+usiro)/2 * (K-1);
        
        cout<<ans<<endl;
        
        //cout<<mae<<endl;
        //cout<<usiro<<endl;
    }else{
        ll ans=0;
        for(int i=1; i<S.length(); i++){
            if(S[i]==S[i-1]){
                ans++;
                i++;
            }
        }
        ans *= K;
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a, v = map(int,input().split())
    b, w = map(int,input().split())
    t = int(input())
    if v <= w or (v-w)*t < abs(a-b):
        print("NO")
    else:
        print("YES")

if __name__=='__main__':
    main()

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


long long dp[51][51][2501];

int main() {
    int N, A;
    cin >> N >> A;
    vector<int> X((unsigned long)N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> X[i];
        sum += X[i];
    }

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

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= N; j++) {
            for (int k = 0; k <= sum; k++) {
                dp[i + 1][j][k] += dp[i][j][k];
                if (j > 0 && X[i] <= k) {
                    dp[i + 1][j][k] += dp[i][j - 1][k - X[i]];
                }
            }
        }
    }
    long long res = 0;
    for (int i = 1; i <= N; i++) {
        res += dp[N][i][i * A];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 50048
const splitByLength = (str, length) => {
    var resultArr = [];
    if (!str || !length || length < 1) {
        return resultArr;
    }
    var index = 0;
    var start = index;
    var end = start + length;
    while (start < str.length) {
        resultArr[index] = str.substring(start, end);
        index++;
        start = end;
        end = start + length;
    }
    return resultArr;
}

const stdin = require("fs").readFileSync("/dev/stdin", "utf8");
const input = stdin.trim();
const SS = splitByLength(input, 10);
// console.log(SS);
const V = SS.map(S => {
	SN = parseInt(S, 2);
	const T = "10".repeat(5).slice(0, S.length);
	const R = SN ^ parseInt(T, 2);
	// console.log(R.toString(2));
	const count = (R.toString(2).match( /1/g ) || []).length;
	return count;
});
// console.log(V);
const sum = V.reduce((acc, cur) => {
  return acc + cur;
}, 0);
// console.log(sum);
if (input.length - sum > sum){
	console.log(sum);
} else {
	console.log(input.length - sum);
}

Measured memory_bytes: 11016
N = int(input())
T,A = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*H[j]
  if k >= A:
    s.append(k - A)
  else:
    s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(flag+1)

Measured memory_bytes: 3064
def prime(n,p):
    iteral = 0
    while n%p == 0:
        n //= p
        iteral += 1
    return iteral,n
def ok(n,target):
    if n*(n+1)//2<=target<(n+1)*(n+2)//2:return True
    else:
        return False
N = int(input())
from collections import defaultdict
d = defaultdict(int)
for i in range(2,int(N**0.5)):
    if N%i==0:
        t,N = prime(N,i)
        d[i] = t
if N != 1:
    d[N] = 1
ans = 0
for n in d:
    k = 1
    while not ok(k,d[n]):
        k += 1
    ans += k

print(ans)

Measured memory_bytes: 9716
n, m = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
a, b = Array.new(m) { gets.split.map(&:to_i) }.transpose
graph = Array.new(n) { [] }
count = 0

a.zip(b).each do |a, b|
  graph[a - 1] << b - 1
  graph[b - 1] << a - 1
end

graph.each_with_index do |nodes, idx|
  if nodes.all? { |v| h[idx] > h[v] }
    count += 1
  end
end

puts count

Measured memory_bytes: 29932
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
int main(){
  int h,w,n;
  cin >> h >> w >>n;
  vector<vector<int>> a(h,vector<int>(w));
  int nw=0;
  int nh=0;
  rep(i,n){
    int b;
    cin >> b;
    rep(j,b){
      a.at(nh).at(nw)=i+1;
      nw++;
      if(nw==w){
        nh++;
        nw=0;
      }
    }
  }
  int c=1;
  while(c<h){
    reverse(all(a.at(c)));
    c+=2;
  }
  rep(i,h){
    rep(j,w)cout << a.at(i).at(j) << ' ';
    cout << endl;
  }
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>//万能头
using namespace std;
int a,b,c,d,e,f,g,h,i;
int main()
{
    cin>>a>>b>>e;   //输入
    c=3*e-a-b;  //复制一遍即可
    h=2*e-b;
    f=2*a-h;
    i=3*e-c-f;
    d=2*e-f;
    g=3*e-h-i;
    printf("%d %d %d\n%d %d %d\n%d %d %d",a,b,c,d,e,f,g,h,i);   //输出
    return 0;
}

Measured memory_bytes: 256
//Let's join Kaede Takagaki Fun Club !!
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}

int n,a[1000005];
string f;

ll C(int a,int b){
	if( (a&b) == b ) return 1;
	else return 0;
}

int main(){
	ios::sync_with_stdio(false);
	g(n); g(f);
	repn(i,n) a[i] = f[i-1] - '0';
	
	ll ans = 0;
	ll ans2 = 0;
	bool ex = 0;
	for(int i=0;i<n-1;i++){
		int v = a[i+2] - a[i+1];
		v = abs(v);
		
		ans += v * C(n-2, i);
		ans %= 2;
		if(v%2 == 1) ex = 1;
		else{
			ans2 += (v/2) * C(n-2, i);
			ans2 %= 2;
		}
	}
	if(ans == 1) puts("1");
	else if(ex) puts("0");
	else puts(ans2?"2":"0");
}


Measured memory_bytes: 5276