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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

ll N, M, V, P;
vector<ll> A, S;

bool check(int x) {
    int X = upper_bound(A.begin(), A.end(), A[x]) - A.begin() - 1;
    if (X + P >= V) {
        return (A[X] + M) >= A[N - P];
    }
    int l = X + 1, r = N - P;
    ll gain = A[X] + M;
    // 配らなければいけない残スコア
    ll rest = M * (V - X - P); // x以下の問題と上位P-1個にはM個配って良い,x自身にもM個配っているので,それらを除いた個数*M
    ll pool = 0;
    for (int i = l; i <= r; i++) {
        if (A[i] > gain) return false;
        pool += min(M, gain - A[i]);
    }
    return (rest <= pool);
}

int main() {
    cin >> N >> M >> V >> P;
    A.resize(N);
    S.resize(N + 1);
    rep(i, N)cin >> A[i];
    sort(A.begin(), A.end());
    rep(i, N)S[i + 1] = S[i] + A[i];

    int ok = N - 1, ng = -1;
    while (ok - ng > 1) {
        int mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }
    cout << N - ok << endl;
    return 0;
}

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

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

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

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

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

vector<ll> num(51), p(51);
void level(int n) {
  if(n == 0) {
    num[n] = 1;
    p[n] = 1;
  }
  else {
    num[n] = 2*num[n-1]+3;
    p[n] = 2*p[n-1]+1;
  }
}

ll check(int level, ll x) {
  if(level == 0) return 1;
  if(x == num[level]) return p[level];
  if(x > num[level-1]+2) return p[level-1]+1+check(level-1, x-num[level-1]-2);
  if(x == num[level-1]+2) return p[level-1]+1;
  if(x > 1) return check(level-1, x-1);
  else return 0;
}

int main()
{
  int n;
  ll x;
  cin >> n >> x;
  rep(i, 51) level(i);

  cout << check(n, x) << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  static long ans = 0;
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    ans++;
    func(N/2,0);
    System.out.println(ans);
  }
  static void func(long N, long now){
    if(N == 0){
      return;
    }
    ans += (long)Math.pow(2, now+1);
    func(N/2, now+1);
  }
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int h, w;
    cin >> h >> w;
    int cnt = 0;
    rep(i, h){
        string s;
        cin >> s;
        cnt += count(ALL(s),'#');
    }

    if(cnt == h+w-1)
        ppp("Possible");
    else
        ppp("Impossible");


    return 0;
}


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

int main(void) {
	int a=0, b=0, c=0, d=0;

	scanf("%d %d %d %d",&a,&b,&c,&d);
	if (a + b > c + d) {
		printf("Left\n");
	}else if (a + b == c + d) {
		printf("Balanced\n");
	}else {
		printf("Right\n");
	}
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

int main() {
    long long X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<long long> p(A);
    vector<long long> q(B);
    vector<long long> r(C);
    vector<long long> use;
    rep(i, 0, A) { cin >> p[i]; }
    rep(i, 0, B) { cin >> q[i]; }
    rep(i, 0, C) { cin >> r[i]; }
    sort(p.begin(), p.end(), greater<long long>());
    sort(q.begin(), q.end(), greater<long long>());
    rep(i, 0, X) { use.push_back(p[i]); }
    rep(i, 0, Y) { use.push_back(q[i]); }
    rep(i, 0, C) { use.push_back(r[i]); }
    sort(use.begin(), use.end(), greater<long long>());
    long long sum = 0;
    rep(i, 0, X + Y) { sum += use[i]; }
    cout << sum << endl;
}


Measured memory_bytes: 8816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000
ll cnt[27];

int main()
{
   ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
   ll n;
   string s;
   cin>>n>>s;
   ll ans = 0;
   for(ll i=n-1; i>=0; i--) {

        ll ctr = 1;
        for(ll j=0; j<26; j++) {
            if(j == s[i]-'a')
                cnt[j] = 1 + cnt[j];
            else
                ctr = ((ctr%M)*((cnt[j] + 1)%M))%M;
        }
        ans = (ans + ctr)%M;
   }

   cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 512
#include <bits//stdc++.h>
using namespace std;
int main(void){
    int a,b,c,ans,i,j;
    cin>>a;
    int big1,big2,fig[a];
    b=0;
    big1=0;
    for(i=0;i<a;i++){
        cin>>fig[i];
        if(fig[i]==big1)
        b=1;
        else if(fig[i]>big1){
            big2=big1;
            big1=fig[i];
            b=0;
        }
        else if(big2<fig[i])
        big2=fig[i];
    }
    if(b){
        for(i=0;i<a;i++)
        cout<<big1<<endl;
    }
    else{
        for(i=0;i<a;i++){
            if(fig[i]==big1)
            cout<<big2<<endl;
            else
            cout<<big1<<endl;
        }
    }
    
    
}


Measured memory_bytes: 2432
package main

import (
	"fmt"
	"reflect"
)

func main() {
	var n int
	fmt.Scan(&n)
	list := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&list[i])
	}
	list0 := make([]int, n)

	res := 0
	loop := true
	for loop == true {
		if reflect.DeepEqual(list, list0) {
			fmt.Println(res)
			return
		}
		i := 0
		for i < n {
			if list[i] == 0 {
				i++
			} else {
				res++
				for i < n {
					if list[i] == 0 {
						break
					} else {
						list[i]--
						i++
					}
				}
			}
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> N;
}

int solve(){
    cout << fixed << setprecision(10) << 2*M_PI*N << endl; 
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 3804
/*
AizuOnline A0219
A Popular Ice-cream Shop
*/
#include <stdio.h>


main()
{
  int cnt;
  int hist[10];
  int ice;
  int i,j;

  
  while(EOF != scanf("%d",&cnt) && cnt>0)
    {
      for(i=0;i<10;i++)
        hist[i]=0;
      for(i=0;i<cnt;i++)
        { scanf("%d",&ice);
          hist[ice] ++;
        }
      for(i=0;i<10;i++)
        if(hist[i]==0)
          printf("-\n");
        else
          {for(j=0;j<hist[i];j++)
            printf("*");
           printf("\n");
          }
    }
return(0);
}

Measured memory_bytes: 0
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        _n: usize,
        q: usize,
        s: String,
        ranges: [(usize, usize); q],
    };
    let mut s_table = vec![0; s.len() + 1];
    let mut prev_c = 'G';
    for (index, c) in s.chars().enumerate() {
        let mut sum = if index == 0 { 0 } else { s_table[index] };
        if prev_c == 'A' && c == 'C' {
            sum += 1;
        };
        s_table[index + 1] = sum;
        prev_c = c;
    }

    for range in ranges {
        println!("{}", s_table[range.1] - s_table[range.0]);
    }
}


Measured memory_bytes: 6908
#include<iostream>
using namespace std;
int main()
{
    char ch[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    long long n,i,k,l=1,m=0,j,q,x=1,p,r,s;
    cin>>n;
    if(n<=26)
    {
        cout<<ch[n-1]<<endl;
    }
    else
    {
      for(i=1;i>=1;i++)
      {
        l=l*26;
        m=m+l;
        k=l*26;
        k=k+m;
        if(n>m&&n<=k)
        {
            p=n-m;        
            for(j=i;j>=0;j--)
            {
                x=1;
                for(q=1;q<=j;q++)
                {
                   x=x*26;                       
                }
                s=p%x;
                r=p/x;
                if(p%x!=0)
                {
                   r++;
                }
                else
                {
                   s=x;
                }
                p=s;
                cout<<ch[r-1];                                       
            }
            cout<<endl;      
            break;
        }                
      }
    }
    return 0;

}

Measured memory_bytes: 3544
import java.util.Scanner;

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 = (n - 1) / (k - 1);
		if((n - 1) % (k - 1) != 0) {
			ans++;
		}
		System.out.println(ans);
	}

}


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

int main()
{
	string s;
    cin >> s;
    
    bool flag = false;
    REP(i, 3) {
        if (s[i] == s[i+1]) flag = true;
    }

    if (flag) cout << "Bad" << endl;
    else      cout << "Good" << endl;
}


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

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): pass
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
A = LI()
acc = [0] + list(accumulate(A))
dp = [[0] * n for _ in range(n)]

def f(l, r):
    if dp[l][r] or l == r:
        return dp[l][r]
    m = INF
    for i in range(l, r):
        m = min(m, f(l, i) + f(i + 1, r) + acc[r + 1] - acc[l])
    dp[l][r] = m
    return m

print(f(0, n-1))




Measured memory_bytes: 85504
import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    static Scanner sc=new Scanner(System.in);
    static int count=0,res=0; 
    static int n=sc.nextInt();
    static int m=n;
    static int map[][]=new int[3][n+1];
 //   static int book[][]=new int[3][n+1];
    static int result[]=new int[2*n+1];
    public static void dfs(int count,int x,int y){
        if(count==m+1) {
           // if(res==0) m+=1;
            res++;  
            return;}
       if(x<0||x>2||y<0||y>n) return;
        System.out.println(count+" "+x+" "+y+" "+map[x][y]);
        result[res]+=map[x][y];
        count++;
        dfs(count,x+1,y);
        dfs(count,x,y+1);
        
         
    }
    public static void main(String[] args) {
        // TODO code application logic here
      //  Scanner sc=new Scanner(System.in);
        for(int i=1;i<=2;i++){
            for(int j=1;j<=n;j++){
                map[i][j]=sc.nextInt();
                map[i][j]+=Math.max(map[i-1][j],map[i][j-1]);
            }
        }
        System.out.println(map[2][n]);
        //dfs(0,1,1);
//        int max=result[0];
//        for(int i=0;i<res;i++){
//            System.out.println(result[i]);
//            if(max<result[i])
//                max=result[i];
//        }
//        System.out.println(max);
//        
       
     
        


        }
        
    }
    



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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[], int n) {
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}
int disum(int n) {
	int sum = 0;

	while (n) {

		sum += n % 10;
		// sum++;
		n /= 10;





	}
	return sum;

}


// #define maxa 1000000




int give(int m) {


	if (m % 2)
		return 3 * m + 1;
	return m / 2;


}





int main() {
	int i, n, m, k, c1 = 0, sum = 0;
	c_p_c();
	cin>>n;
	double t, a;
	cin >> t >> a;
	double maxa = INF;
	int index=0;
	for (int i = 0; i < n; ++i)
	{
		cin>>k;
		double ans = t- (k*0.006);
		/* code */
		// debug(ans);

		// debug(ans,abs(a-ans));
		if(abs(a-ans)<maxa){
			maxa=abs(a-ans);
			index=i+1;
		}

	}
	cout<<index<<endl;


}




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

int main()
{
    int N, X, T;
    cin >> N >> X >> T;
    int cnt = 0;
    int t = 0;
    while (true)
    {
        t += T;
        cnt += X;
        if (cnt>=N) break;
    }
    cout << t << endl;
}

Measured memory_bytes: 3632
a,b,n=map(int,input().split())
if a <= b:
    if n >= b:
        ans=(a*(b-1))//b
    else:
        ans=(a*n)//b - a*(n//b)
else:
    if n >= b:
        ans=(a*(b-1))//b
    else:
        ans=(a*n)//b - a*(n//b)
print(ans)


Measured memory_bytes: 9188
#include<iostream>
using namespace std;
int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int t;
		cin>>t;
		if(i%2==1&&t%2==1)
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define int long long
using namespace std;

int bpw(int a, int n, int md) {
    if (n == 0)
        return 1;
    int t = bpw(a, n / 2, md);
    t = (t * t) % md;
    if (n % 2 == 1)
        t = (t * a) % md;
    return t;
}

int solve(int x) {
    if (x == 0)
        return 0;
    int d = __builtin_popcount(x);
    return 1 + solve(x % d);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        char now;
        cin >> now;
        if (now == '1')
           a[i] = 1;
    }

    int cnt = 0;
    for (int i = 0; i < n; ++i)
        cnt += a[i];

//    if (cnt == 0) {
//        cout << 0 << endl;
//        return 0;
//    }
//    if (cnt == 1) {
//        cout << 1 << endl;
//        return 0;
//    }

    int cntmd = 0, cnt1md = 0;

    for (int i = 0; i < n; ++i) {
        cntmd = (cntmd * 2 + a[i]) % (cnt + 1);
    }
    if (cnt != 1)
    for (int i = 0; i < n; ++i) {
        cnt1md = (cnt1md * 2 + a[i]) % (cnt - 1);
    }

    for (int i = 0; i < n; ++i) {
        int now = -179;
        if (a[i] == 1) {
            if (cnt == 1)
                cout << 0 << '\n';
            else if (cnt == 2)
                cout << 1 << '\n';
            else
                now = (cnt1md - bpw(2, n - 1 - i, cnt - 1) + cnt - 1) % (cnt - 1);
        }
        else {
            if (cnt == 0)
                cout << 1 << '\n';
            else
                now = (cntmd + bpw(2, n - 1 - i, cnt + 1)) % (cnt + 1);
        }
        if (now != -179)    
        cout << 1 + solve(now) << '\n';
    }

    return 0;
}


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

int main () {
  int n;
  cin >> n;
  vector<int>vec(n);
  
  for(int i=0;i<n;i++){
    cin >> vec[i];
  }
  
  sort(vec.begin(),vec.end());
  
  cout << vec[n-1]-vec[0] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        int n;
        cin >> n;
        if(n%2){
            cout << "No";
            return 0;
        }
        string s;
        cin >> s;
        
        string a="";
        
        for(int i=0; i<n/2; i++){
            a+=s[i];
        }
        if(a+a==s){
            cout << "Yes";
        }
        else{
            cout << "No";
        }
        
        

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    bool f = false;
    rep(i, 0, n + 1){
        rep(j, 0, m + 1){
            int tmp = i * (m - j) + j * (n - i);
            if(tmp == k) f = true;
        }
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

struct edge {
    int from;
    int to;
    int cost;
};

long long V, E, d[2510];
edge es[5010];

void short_path() {
    fill(d, d + V, 1e15);
    d[0]=0;
    for (int i = 0; i < V-1; i++) {
        for (int j = 0; j < E; j++) {
            edge e = es[j];
            if (d[e.to] > d[e.from] + e.cost && d[e.from]!=1e15) {
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }
}

void has_negative_loop() {
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < E; j++) {
            edge e = es[j];
            if (d[e.to] > d[e.from] + e.cost && d[e.to]!=1e15) {
                d[e.to]=-1e15;
            }
        }
    }
}


int main(){
    int p;
    cin>>V>>E>>p;
    for(int i=0;i<E;++i){
        cin>>es[i].from>>es[i].to>>es[i].cost;
        es[i].to--;
        es[i].from--;
        es[i].cost-=p;
        es[i].cost*=-1;
    }
    short_path();
    long long ans=max((long long)0,-d[V-1]);
    has_negative_loop();
    if(d[V-1]==-1e15){
        cout<<-1<<endl;
    }
    else cout<<ans<<endl;
}


Measured memory_bytes: 3672
#!/usr/bin/env python3


def solve(A, B, K):
    mx = min(A, B)
    div_ab = list(filter(
        lambda x: A % x == 0 and B % x == 0,
        range(1, mx+1)))
    return div_ab[-K]


if __name__ == '__main__':
    A, B, K = map(int, input().split())

    ans = solve(A, B, K)

    print(ans)


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

int main() {

    int N = -1, l = 0;
    while(true){
    
        // 1. input end check.
        cin >> N;
        if(N == 0) break;
        
        // 2. increment.
        l++;
        
        // 3. output answer.
        cout << "Case " << l << ": " << N << endl;
    
    }
    
    return 0;
    
}


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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

vll C;
vector<vll> S;
vll last(26, 0);

ll calcScore(ll d, ll t) {
    ll s = 0;
    s += S[d][t];
    for(ll j = 0; j < 26; j++) {
        if(j != t) {
            s -= C[j] * (d + 1 - last[j]);
        }
    }
    return s;
}

int main() {
    ll i, j, k;
    ll D;
    cin >> D;
    for(i = 0; i < 26; i++) {
        ll c;
        cin >> c;
        C.push_back(c);
    }
    for(i = 0; i < D; i++) {
        vll si;
        for(j = 0; j < 26; j++) {
            ll s;
            cin >> s;
            si.push_back(s);
        }
        S.push_back(si);
    }

    ll score = 0;
    for(i = 0; i < D; i++) {
        ll ti;
        ll smax = -INF;
        for(j = 0; j < 26; j++) {
            ll ssub = calcScore(i, j);
            if(ssub > smax) {
                smax = ssub;
                ti = j;
            }
        }
        last[ti] = i + 1;
        cout << ti + 1 << endl;
        score += calcScore(i, ti);
    }

    return 0;
}


Measured memory_bytes: 3704
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  a, b = map(int, input().strip().split())
  if   a >= 13:
    print(b)
  elif a >=6:
    print(b//2)
  else:
    print(0)

if __name__=='__main__':
  main()



Measured memory_bytes: 2940
#include <bits/stdc++.h>  
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
#define REP(i, a, op1, n, op2) for(int i=a; i op1 (int)(n); op2 ## op2 i)
#define cout(val) cout << (val) << endl

using namespace std;  

int main(){
    string s, c;
    cin >> s;
    int len = s.size() - 1;
    long long int result = 0;
    rep(i, 1<<len){
        rep(j, len){
            c.push_back(s[j]);
            if(i&1<<j && c != ""){
                result += stol(c);
                c = "";
            }
        }
        c.push_back(s[len]);
        if(c != ""){
            result += stol(c);
            c = "";
        }
    }
    cout(result);
}


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

using namespace std;

map <int, int> m;
vector <int> v;

int main() {
	int N, H;
	scanf("%d %d", &N, &H);
	for (int i = 0; i < N; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		m[x]++;
		v.push_back(x);
		v.push_back(y);
	}
	sort(v.begin(), v.end());
	int ans = 0;
	int cur = 0;
	bool flag = true;
	for (int i = v.size() - 1; i >= 0 && flag; i--) {
		cur += v[i];
		ans++;
		if (cur >= H) 
			break;
		if (m.count(v[i]) > 0) {
			int x = H - cur;
			int xx = x / v[i];
			if (xx * v[i] < x) {
				xx++;
			}
			ans += xx;
			flag = false;
		}
		if (flag == false)
			break;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  ll n, m; cin>>n>>m;
  vector<ll> p(m);
  vector<string> s(m);
  rep(i, m) {
    cin>>p[i]>>s[i];
    p[i]--;
  }
  vector<ll> cnt(n, 0);
  vector<bool> stt(n, false);
  rep(i, m) {
    if (!stt[p[i]]) {
      if (s[i] == "WA") cnt[p[i]]++;
      else stt[p[i]] = true;
    }
  }
  ll accnt = 0;
  ll wacnt = 0;
  rep(i, n) {
    if (stt[i]) {
      accnt++;
      wacnt += cnt[i];
    }
  }
  printf("%lld %lld\n", accnt, wacnt);

  return 0;
}


Measured memory_bytes: 7924
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main(){
	string s, t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	vector<vector<int>> is(26);
	rep(i, n) is[s[i] - 'a'].push_back(i);
	rep(i, n) is[s[i] - 'a'].push_back(i+n);
	ll ans = 0;
	int p = 0;
	rep(i,m){
		int c = t[i] - 'a';
		if(is[c].size() == 0){
			cout << -1 << endl;
			return 0;
		}
		p = *lower_bound(all(is[c]), p) + 1;
		if(p >= n){
			p -= n;
			ans += n;
		}
	}
	ans += p;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1852
n=int(input())
s=[int(input()) for _ in range(n)]
ss=sorted(s)
if sum(s) % 10 ==0:
    for i in range(len(ss)):
        if ss[i] %10 ==0:
            continue
        else:
            ss[i]=0
            break
    else:
        print(0)
        exit(0)
print(sum(ss))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
int n;
int a[30];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int cnt=0;
	for(int i=2;i<n;i++){
		if(min(a[i-1],a[i+1])<a[i]&&max(a[i-1],a[i+1])>a[i])
			cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


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


int main() {
  map<string,int> mp;
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
      string s;
      cin >> s;
      mp[s]++;
  }
  int max1 = 0;
  for(const auto& value:mp){
      max1 = max(max1,value.second);
  }
  for(const auto& value:mp){
      if(value.second== max1){
          cout << value.first << endl;
      }
  }
  return 0;
}


Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination{
    vector<mint> fact,ifact;
    combination(int n):fact(n+1),ifact(n+1){
        assert(n < mod);
        fact[0] = 1;
        for(int i = 1;i <= n; ++i){
            fact[i] = fact[i-1]*i;
        }
        ifact[n] = fact[n].inv();
        for(int i = n; i >= 1; --i){
            ifact[i-1] = ifact[i]*i;
        }
    }
        mint operator()(int n, int k){
            if( k < 0 || k > n) return 0;
            return fact[n]*ifact[k]*ifact[n-k];
        }
    
};

ll modpow(ll p,ll q){
    if(q == 0)return 1;
    if(q%2 == 0){
        ll x = modpow(p,q/2);
        return x*x%mod;
    }else{
        return modpow(p,q-1)*p%mod;
    }
}

ll choose(ll n,ll k){
    ll x=1,y=1;
    rep(i,k){
        x = x*(n-i)%mod;
        y = y*(k-i)%mod;
    }
    y = modpow(y,mod-2);
    return x*y%mod;
}




int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int a,b,ans = 1e8;
    cin >> a >> b;
    for(int i = 20000;i > 0; --i){
        int p = i*8/100,q = i*10/100;
        if(p == a && q == b){
            ans = i;
        }
    }
    if(ans == 1e8)cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
(let* ((a (read))
       (b (read))
       (s (read-line))
       (as (subseq s 0 a))
       (cs (subseq s a (1+ a)))
       (bs (subseq s (1+ a))))
      (if (and (every #'digit-char-p as)
               (equal cs "-")
               (every #'digit-char-p bs))
          (princ "Yes")
          (princ "No")))

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

using namespace std;

#define INF 2e9

int main(){
    int n;
    cin >> n;
    vector<vector<int>> happiness(n, vector<int>(3));
    vector<vector<int> > dp(n, vector<int>(3, -INF)); // Maxima felicidad eligiendo a la actividad X

    for(int i=0;i<n;++i)
    {
        for(int j=0;j<3;j++)
        {
            int a; cin >> a;
            happiness[i][j] = a;
        }
    }

    for(auto x : {0,1,2}){
        dp[0][x] = happiness[0][x];
    }

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


    int maxi = -INF;
    for(int i=0;i<3;++i){
        maxi = max(maxi, dp[n-1][i]);
    }

    cout << maxi << '\n';



    return 0;
}


Measured memory_bytes: 11136
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    int A, B, C;

    cin >> A >> B >> C;

    if(A==B&&B==C&&C==A || A!=B&&B!=C&&C!=A) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
    
}

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

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		PriorityQueue<Integer> queue = new PriorityQueue<Integer>();
		while(true) {
			int n = stdIn.nextInt();
			int m = stdIn.nextInt();
			if(n == 0 && m == 0) {
				break;
			}
		
			for(int i = 0; i < n+m; i++) {
				queue.add(stdIn.nextInt());
			}
			int lastTime = 0;;
			int max = 0;
			for(int i = 0; i < n+m; i++) {
				int tmp = queue.poll();
				int s = tmp - lastTime;
				if(max < s) {
					max = s;
				}
				lastTime = tmp;
			}
		
			System.out.println(max);
			queue.clear();
		}
	}
	
}

Measured memory_bytes: 61664
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;
int dx[]={0,0,1,-1},dy[]={-1,1,0,0};

int N,A,B,C,M,K,Q;
string s,t;

signed main() {
    IOS();
    cin>>A>>B>>C;
    if(A==B&&B==C)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

char weeks[20][8] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};

int main(){
    char day[20];
    scanf("%s", day);
    for(int i = 0; i < 7; i++){
        if(strcmp(day, weeks[i]) == 0){
            if(i < 6) printf("%d\n", 6 - i);
            else printf("7\n");
            return 0;
        }
    }
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;
const int MAX_N = 1e5 + 5;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> sorted = a;
    sort(sorted.begin(), sorted.end(), greater<int>());
    for (int i = 0; i < n; i++) {
        if (a[i] == sorted[0])
            cout << sorted[1] << endl;
        else
            cout << sorted[0] << endl;
    }
}


Measured memory_bytes: 3200
#include<iostream>

using namespace std;

int main(){

   string s;
   int K;
   cin>> s>> K;

   int n=s.size();
   int dist[n];
   for(int i=0; i<n; i++){
      dist[i]=('z'-s[i]+1);//%26;
   }

   string ans;
   for(int i=0; i<n; i++){
      if(i==n-1){
         K%=26;
         ans+=('a'+(s[i]-'a'+K)%26);
         break;
      }
      if(K-dist[i]<0){
         if(i==n-1){
            ans+=s[i]+K;
         }else{
            ans+=s[i];
         }
      }else if(K==dist[i]){
         ans+='a';
         ans+=s.substr(i+1);
         break;
      }else{
         if(dist[i]!=26){
            K-=dist[i];
         }
         ans+='a';
      }
   }

   cout<< ans<< endl;

   return 0;
}


Measured memory_bytes: 1152
import java.util.Arrays;
import java.util.Scanner;

//Dragon Fantasy
public class Main{

	int n, hx, hy, dx, dy;
	R[] p;
	double EPS = 1e-8;
	
	class R implements Comparable<R>{
		int x, y;
		double r;
		public R(int x, int y) {
			this.x = x;
			this.y = y;
			r = Math.hypot(dx-x, dy-y);
		}
		public int compareTo(R o) {
			return (int) Math.signum(r-o.r);
		}
	}
	
	boolean dfs(int k, int S, double t){
		if(S==(1<<n)-1)return true;
		int x = k==-1?hx:p[k].x, y = k==-1?hy:p[k].y;
		for(int i=0;i<n;i++){
			if(((S>>i)&1)>0)continue;
			if(p[i].r<t+Math.hypot(x-p[i].x, y-p[i].y)+EPS)return false;
		}
		for(int i=0;i<n;i++){
			if(((S>>i)&1)>0)continue;
			if(p[i].r>t+Math.hypot(x-p[i].x, y-p[i].y)){
				if(dfs(i, S+(1<<i), t+Math.hypot(x-p[i].x, y-p[i].y)))return true;
			}
		}
		return false;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			n = sc.nextInt(); hx = sc.nextInt(); hy = sc.nextInt(); dx = sc.nextInt(); dy = sc.nextInt();
			if((n|hx|hy|dx|dy)==0)break;
			p = new R[n];
			for(int i=0;i<n;i++)p[i] = new R(sc.nextInt(), sc.nextInt());
			Arrays.sort(p);
			System.out.println(dfs(-1, 0, 0)?"YES":"NO");
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
n,k=map(int,input().split())
p=list(map(int,input().split()))

#スライド最小値、スライド最大値
from collections import deque
def slide_max_index(a, K):
    # max_idx[i]: 区間 [i - K + 1, i] (両側閉区間)における a の最大値を与えるインデックス
    N = len(a)
    max_idx = [0] * N # (長さKに満たない左側領域もついでに計算する)
    deq = deque() # デック．番長順番待ちキューをシミュレートする．インデックスを格納しておく
    for i in range(0,N):
        while len(deq) > 0 and deq[0] <= i - K : deq.popleft() # 卒業する
        while len(deq) > 0 and a[deq[-1]] < a[i] : deq.pop()   # a[i] の入学で 望みがなくなった先輩達が脱落する
        deq.append(i)                                          # 新入生i は常に番長になる望みがある
        max_idx[i] = deq[0]                                    # 番長順番待ちキューの最左が番長
    return max_idx
def slide_min_index(a, K):
    # max_idx[i]: 区間 [i - K + 1, i] (両側閉区間)における a の最大値を与えるインデックス
    N = len(a)
    min_idx = [0] * N # (長さKに満たない左側領域もついでに計算する)
    deq = deque() # デック．番長順番待ちキューをシミュレートする．インデックスを格納しておく
    for i in range(0,N):
        while len(deq) > 0 and deq[0] <= i - K : deq.popleft() # 卒業する
        while len(deq) > 0 and a[deq[-1]] > a[i] : deq.pop()   # a[i] の入学で 望みがなくなった先輩達が脱落する
        deq.append(i)                                          # 新入生i は常に番長になる望みがある
        min_idx[i] = deq[0]                                    # 番長順番待ちキューの最左が番長
    return min_idx

min_idx=slide_min_index(p,k+1)
max_idx=slide_max_index(p,k+1)
eq=list(range(n-k+1))
for i in range(n-(k+1)+1):
  if i==min_idx[i+k] and i+k==max_idx[i+k]:
    eq[i+1]=eq[i]

pre=p[0]
a=[0]
c=0
for pi in p[1:]:
  if pre<pi:
    c+=1
  else:
    c=0
  pre=pi
  a.append(c)
eqi=-1
for i in range(n-k+1):
  if a[i+k-1]>=k-1:
    if eqi==-1:
      eqi=i
    else:
      eq[i]=eqi

print(len(set(eq)))
#print(eq)
#print(a)


Measured memory_bytes: 40240
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define mod 1000000007

int main() {
  ll h;
  cin >> h;
  ll hp = h;
  ll num = 1;
  ll ans = 0;
  while (hp > 0) {
    ans += num;
    hp /= 2;
    num *= 2;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3580
from math import floor
N = int(input())
X = list(map(int, input().split()))
Left = floor(sum(X)/N)
Right = Left + 1
candidate1 = 0
candidate2 = 0
for i in range(N):
  candidate1 += (X[i] - Left) ** 2
  candidate2 += (X[i] - Right) ** 2
print(min(candidate1, candidate2))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb push_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=2e14;
const ll ms=(1e5) +5;

int pr[1000005];
int ar[ms];
map<int,int> mm;
map<int,int> m2;
void check()
{
    int n=1e6;
    int i;
    for(i=0;i<=n;i++)pr[i]=i;
    int j;
    for(i=2;i*i<=n;i++)
    {
        if(pr[i]==i)
        {
            for(j=i*i;j<=n;j+=i)pr[j]=min(pr[j],i);
        }
    }
}

ll mpow(ll a,ll b)
{
    ll r=1;
    while(b>0)
    {
        if(b&1)
        {
            r*=a;
            r%=modo;
        }
        a*=a;
        a%=modo;
        b>>=1;
    }
    return r;
}

int main()
{
    idfc;
    check();
    int n;
    cin>>n;
    int i;
    int e;
    int x,y;
    for(i=1;i<=n;i++)
    {
        cin>>ar[i];
        e=ar[i];
        m2.clear();
        while(e>1)
        {
            m2[pr[e]]+=1;
            e/=pr[e];
        }
        for(auto it:m2)
        {
            x=it.first;
            y=it.second;
           // cout<<x<<" "<<y<<endl;
            if(mm.count(x))
            mm[x]=max(mm[x],y);
            else mm[x]=y;
        }
    }
    ll lc=1;
    for(auto it:mm)
    {

        x=it.first;
        y=it.second;
       // cout<<x<<" "<<y<<endl;
        lc*=mpow(x,y);
        lc%=modo;
    }
    //cout<<lc<<endl;
    ll ans=0;
    ll a;
    for(i=1;i<=n;i++)
    {
        a=lc*mpow(ar[i],modo-2);
        a%=modo;
        ans+=a;
        ans%=modo;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 4736