akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2e5+4;
const int MOD=2019;
int n;
char s[N];
int sum[N];
int cnt[2020];
int fpow(int a,int b) {
	int ret=1;
	while (b) {
		if (b&1) ret=ret*a%MOD;
		b>>=1,a=a*a%MOD;
	}
	return ret;
}
int main() {
	scanf("%s",s+1);
	n=strlen(s+1);
	++cnt[0];
	for (register int i=n;i;--i) {
		sum[i]=(sum[i+1]+(s[i]-'0')*fpow(10,n-i))%MOD;
		++cnt[sum[i]];
	}
	ll ans=0;
	for (int i=0;i<2019;++i)
		ans+=1ll*cnt[i]*(cnt[i]-1)/2;
	printf("%lld\n",ans);
	return 0;
}

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

long long pow(long long a,long long b) {
  if(b == 0)return 1;
  else return (pow((a*a)%1000000007,b/2)*(b%2>0?a:1))%1000000007;
}

int main() {
  int K,S;
  string s;
  cin >> K >> s;
  S = s.length();
  long long F[2000010],iF[2000010];
  F[0] = 1;
  int i;
  for(i=0;i<2000000;i++)F[i+1] = F[i]*(i+1)%1000000007;
  for(i=0;i<=2000000;i++)iF[i] = pow(F[i],1000000005);
  long long ans = 0;
  for(i=0;i<=K;i++) {
    ans += (F[i+S-1]*iF[S-1]%1000000007)*(iF[i]*(pow(25,i)*pow(26,K-i)%1000000007)%1000000007)%1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}

Measured memory_bytes: 35568
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first

#ifdef MYDEBUG
#define DBG(...) {string dst__=#__VA_ARGS__;dreplace(dst__);stringstream dss__; dss__<<dst__; debug(dss__,__VA_ARGS__);}
#else
#define DBG(...)
#endif
void debug(stringstream& ds){cerr<<endl;return;}
template<typename F, typename... R>void debug(stringstream& ds,const F& f, const R&... r){string n; ds>>n; cerr<< n <<'='<<f<<' '; debug(ds,r...);}
void dreplace(string &s){int l=s.length(),n=0;for(int i=0; i<l; ++i){if(s[i]=='(')++n;if(s[i]==')')--n;if(s[i]==','&&!n)s[i]=' ';}}

typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
template<typename T> using V = vector<T>;
constexpr LL LINF=334ll<<53; constexpr int INF=15<<26; constexpr LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<vector<LL>> a (2002,vector<LL>(2002));
    auto dp = [&](int x, int y) -> LL& {return (x<0||y<0)?a[0][0]:a[x+1][y+1];};
    dp(0,0)=1;
    for(int i=0; i<=m+n; i=i+k-1){
        int l=max(0,i-m), h=min(i,m);
        for(int j=0; j<k; ++j){
            dp(l,h)+=dp(l-k+1+j,h-j);
            if(dp(l,h)>MOD)dp(l,h)-=MOD;
        }
        for(int j=max(0,i-m)+1; j<=min(i,n); ++j){
            dp(j,i-j)=dp(j-1,i-j+1)+dp(j,i-j-k+1)-dp(j-k,i-j+1);
            if(dp(j,i-j)<0)dp(j,i-j)+=MOD;
            else if(dp(j,i-j)>MOD)dp(j,i-j)-=MOD;
        }
    }
    LL ans=0;
    for(int i=n; i>0; i-=k-1){
        for(int j=m; j>0; j-=k-1){
            for(int h=1; h<k; ++h){
                ans+=dp(i-h,j-k+h);
                if(ans>MOD)ans-=MOD;
            }
        }
    }
    cout << ans <<"\n";
    return 0;
}



Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;

ll comb(ll n){
  ll ret = n * (n-1) / 2;
  return ret;
}

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> b = a;
  sort(ALL(b));
  map<ll, ll> mp;
  ll ind = b[0];
  ll cnt = 1;
  for (int i = 1; i < n; i++){
    if (b[i] == ind) cnt++;
    else {
      mp[ind] = cnt;
      ind = b[i];
      cnt = 1;
    }
  }
  mp[ind] = cnt;

  map<ll, ll> c, d;
  ll sum = 0;
  for (auto p : mp){
    c[p.first] = comb(p.second);
    d[p.first] = comb(p.second - 1);
    sum += c[p.first];
  }
  rep(i, n){
    int now = a[i];
    ll ans = (ll)sum - c[now] + d[now];
    cout << ans << endl;
  }
} 

Measured memory_bytes: 28416
#include<stdio.h>

int main() {
	int A, B, T;
	int time = 0, sum = 0, cnt = 1;

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

	while (1) {
		time += A;
		if (time > T + 0.5)
			break;
		sum += B;
	}
	printf("%d", sum);

	return 0;
}

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

N = int(input().split()[0])
a_list = list(map(int, input().split()))
before_a = 0
total = 0
for i, a in enumerate(a_list):
    if i == 0:
        before_a = a
        continue
    total += max(before_a - a, 0)
    before_a = a + max(before_a - a, 0)
ans = total
print(ans)


Measured memory_bytes: 32160
/*
 *	
 *	Created by Ziyi Tang
 *
 */

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
using namespace std;
#define INF 1E18
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vpi> vvpi;
const int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};

map<string,int> freq;
string maxletter1;
int maxletter2 = 0;

bool comp(pair<string,int> a, pair<string,int> b){
	if (a.second > b.second){
		return true;
	}
	else{
		return false;
	}
}
int main(){
	string tmp;
	//cin >> tmp;
	while (cin >> tmp){
		int sz = tmp.size();
		if (sz > maxletter2){
			maxletter1 = tmp;
			maxletter2 = sz;
		}
		freq[tmp] += 1;
		
	}
	auto maxfreq = min_element(freq.begin(), freq.end(), comp);
	cout << (*maxfreq).first << " " << maxletter1 << endl;

	

	return 0;
}

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

int grundy[205][105];

// calculate grundy
int solve(int w, int b){
    if(w==0 && b==0) return 0;
    if(grundy[w][b] != -1) return grundy[w][b];
    set<int> S;
    if(w > 0) S.insert(solve(w-1, b));
    if(b > 0) S.insert(solve(w+1, b-1));
    for(int i=1;i<=min(b,w);i++){
        S.insert(solve(w,b-i));
    }
    int res = 0;
    while(S.count(res)) res++;
    return grundy[w][b] = res;
}

int main() {
    for(int i=0;i<=200;i++) fill(grundy[i], grundy[i]+101, -1);
    int N, X = 0;
    cin >> N;
    for(int i=0;i<N;i++){
        int w, b;
        cin >> w >> b;
        X ^= solve(w, b);
    }
    cout << (X == 0) << endl;
    return 0;
}





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

char chess(int h, int w){
    if((h+w)%2==0){return '#';}
    return '.';}

int main(void){
    int H,W;
    while(true){
        cin >> H >> W;
        if (H == 0 && W == 0){break;}
        for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){cout << chess(i,j);}
        cout << endl;}
        cout << endl;
    }
}


Measured memory_bytes: 3116
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		PriorityQueue<Paren> queue = new PriorityQueue<>();
		for (int i = 0; i < n; i++) {
		    queue.add(new Paren(sc.next().toCharArray()));
		}
		long current = 0;
		while (queue.size() > 0) {
		    Paren p = queue.poll();
		    if (current + p.min1 < 0) {
		        System.out.println("No");
		        return;
		    }
		    current += p.result;
		}
		if (current == 0) {
		    System.out.println("Yes");
		} else {
		    System.out.println("No");
		}
	}
	
	static class Paren implements Comparable<Paren> {
	    int result;
	    int min1;
	    int min2;
	    
	    public Paren(char[] arr) {
	        min1 = 0;
	        result = 0;
	        for (char c : arr) {
	            if (c == '(') {
	                result++;
	            } else {
	                result--;
	            }
	            min1 = Math.min(min1, result);
	        }
	        min2 = min1 - result;
	    }
	    
	    public int compareTo(Paren another) {
	        if (result > 0 && another.result > 0) {
	            return another.min1 - min1;
	        } else if (result > 0 && another.result <= 0) {
	            return -1;
	        } else if (result <= 0 && another.result > 0) {
	            return 1;
	        } else {
	            return min2 - another.min2;
	        }
	    }
	}
}

Measured memory_bytes: 94280
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return a / __gcd(a, b) * b;
}
int logn(int n, int r)
{
    return log(n) / log(r);
}
map<int, int> mp;
void solve()
{
    for (int i = 1; i <= 100;i++){
        for (int j = 1; j <= 100;j++){
            for (int k = 1; k <= 100;k++){
                mp[i * i + j * j + k * k + i * j + j * k + k * i]++;
            }
        }
    }
    int n;
    cin>>n;

    for (int i = 1; i <= n;i++){
        cout << mp[i] << endl;
    }
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    //cin >> tc;
    while (tc--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 6124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int A, B, C;
int main() {
  cin >> A >> B >> C;
  bool yes = false;
  rep(i, B) {
    if (((i + 1) * A) % B == C) yes = true;
  }
  cout << (yes ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256
function Main (input) {
  input = input.split("\n")[0].split(" ").map(Number).sort((a, b) => b > a);
  console.log(input[0] == 7 && input[1] == 5 && input[2] == 5 ? "YES" : "NO");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7492
#include<bits/stdc++.h>
using namespace std;
 int main()
 {
     int a,b,c,d,e,f,g,h,j;
     int i,ans=0,sum=0;
     vector<int>v;
     cin>>a;
     int ar[a];
     int arr[a];
     for(i=0;i<a;i++){cin>>ar[i];}
     for(i=0;i<a;i++){cin>>arr[i];}
     int cnt=0,flag=0;
     for(i=0;i<a;i++)
     {
         ans+=ar[i];

         sum=0;
         for(j=i;j<a;j++)
         {
             sum+=arr[j];

         }

         v.push_back(sum+ans);


     }
     sort(v.begin(),v.end(),greater<int>());
     cout<<v[0]<<endl;
     return 0;
 }


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
#define fastIO_ ios_base::sync_with_stdio(false); cin.tie(false); cout.tie(false);
int main()
{
    double a, b;
    cin>>a>>b;
    cout<<(int) ceil(a/b)<<endl;
    return 0;
}

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

int main(){
     int n;
     cin >> n;
     cout << 800*n-200*(n/15) <<endl;
    }

Measured memory_bytes: 256
void main() {
    int[] abc = readln.split.to!(int[]);
    writeln(abc.sum - 2 * abc.reduce!max == 0 ? "Yes" : "No");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
//
//  ALDS1_4_B.cpp
//  
//
//  Created by mk on 2016/05/23.
//
//

#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

int binarySearch(int A[], int start, int end, int target){
    int middle = (start + end) / 2;
    if (A[start] == target || A[end] == target || A[middle] == target){
        return 1;
    }
    if (middle == start || middle == end) {
        return 0;
    }
    if (A[middle] < target) {
        binarySearch(A, middle, end, target);
    }else{
        binarySearch(A, start, middle, target);
    }

}

int main(int argc, const char * argv[]){
    int n, q;
    scanf("%d", &n);
    int S[n];
    for (int i=0; i<n; i++) {
        scanf("%d", &S[i]);
    }

    int T[n];
    scanf("%d", &q);
    for (int i=0; i<q; i++) {
        scanf("%d", &T[i]);
    }
    
    int count = 0;
    for (int i=0; i<q; i++) {
        int result = binarySearch(S,0,n-1,T[i]);
        count += result;
    }
    
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define f(i,x,n) for(ll int i=x;i<n;i++) 
#define re(j,x,n) for(int j=x;j>=n;j--)
#define f1(k,x,n) for(int k=x;k<=n;k++)
using namespace std;
int main()
{   
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll int n;
  cin>>n;
  ll int a[n],flag=1,i=1;
  f(i,0,n)
  cin>>a[i];
  sort(a,a+n);
  while(flag==1)
  { 
   if(a[i]%a[0]!=0)
   {
   	a[i]%=a[0];
   	sort(a,a+n);
   }
   flag=0;
   f(j,1,n)
   {
     if(a[j]%a[0]!=0)
     flag=1;
   }
   if(a[i]%a[0]==0)
   	i++;
  }
  cout<<a[0];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    int N;
    cin>>N;
    vector<pii> task(N);
    for(int i=0;i<N;i++){
        int a,b;
        cin>>a>>b;
        task[i]=make_pair(b,a);
    }
    sort(ALL(task));
    bool ok=true;
    ll time=0;
    for(int i=0;i<N;i++){
        time+=task[i].second;
        if(time>task[i].first){
            ok=false;break;
        }
    }
    cout<<(ok?"Yes":"No")<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int N = int(round(pow(3,6)));

vi ch(N);
vector<vi> r(N, vi(N));
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    forn(i,N) r[i].resize(N);
    forsn(n,1,N) {
        ch[n] = 3*ch[n/3];
        if (n%3) ch[n] += 3-n%3;
    }

    forn(i,N) forn(j,N) r[i][j] = j*N+i;

    int n; string s;
    cin >> n >> s;

    bool is_swap = false;
    for(auto c : s) {
        if (c == 'S') {
            forn(i,N) if (i < ch[i]) swap(r[i], r[ch[i]]);
            is_swap = !is_swap;
        }
        else {
            forsn(i,1,N) swap(r[0], r[i]);
            if (is_swap) forn(i,N) if (i < ch[i]) swap(r[0][i], r[0][ch[i]]);
            forsn(i,1,N) swap(r[0][0], r[0][i]);
            if (is_swap) forn(i,N) if (i < ch[i]) swap(r[0][i], r[0][ch[i]]);
        }
    }

    int sz = int(round(pow(3,n)));
    if (is_swap) forn(idx, N) {
        forn(i,N) if (i < ch[i]) swap(r[idx][i], r[idx][ch[i]]);
    }

    vi ans(sz);
    forn(idx, N) forn(i,N) {
        int x = r[idx][i];
        int y = i*N + idx;
        ans[x%sz] = y%sz;
    }
    
    for (auto x : ans) cout << x << ' ';

    return 0;
}


Measured memory_bytes: 8504
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,x,m = map(int, readline().split())
#lr = [list(map(int, readline().split())) for _ in range(k)]


nxt = [x*x%m for x in range(m)]
wa = list(range(m))
ans = 0

while n:
    if n&1:
        ans += wa[x]
        x = nxt[x]
    wa = [wa[nxt[i]] + wa[i] for i in range(m)]    
    nxt = [nxt[i] for i in nxt]
    n >>= 1

print(ans)

Measured memory_bytes: 24000
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            String[] result = new String[n];
            Arrays.fill(result, "0");

            int keta;
            String num;
            boolean flag = true;
            for (int i = 0; i < m; i++) {
                keta = in.nextInt() - 1;
                num = in.next();

                if (keta == 0 && num.equals("0") && n > 1) {
                    flag = false;
                    break;
                }
                if (result[keta].equals(num)) {
                    continue;
                }
                if (!result[keta].equals("0")) {
                    flag = false;
                    break;
                }
                result[keta] = num;
            }

            if (flag) {
                if (result[0].equals("0") && n != 1) {
                    result[0] = "1";
                }
                out.append(String.join("", result));
            } else {
                out.append("-1");
            }
        }

    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n; cin >>n;
	int dp[n][3];
	for(int i=0;i<n;i++)
	{
		dp[i][0]=dp[i][1]=dp[i][2]=0;
	}
	cin >> dp[0][0] >> dp[0][1] >> dp[0][2];
	for(int i=1;i<n;i++)
	{
		int x,y,z;
		cin >> x>> y>> z;
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+x;
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+y;
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+z;
	}
	cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;
	
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <map>

using namespace std;

char st[100010];
int out[100010];
int main()
{
    int n,m;scanf("%d%d",&n,&m);
    scanf("%s",st);
    int step=0,now=n;

    int cuo=0;
    for (int i=1;i<n;++i){
        if (st[i]=='0') cuo=0;
        else ++cuo;
        if (cuo>=m){
            printf("-1");return 0;
        }
    }

    while (now){
        for (int i=m;i>0;--i){
            if (now-i>=0 && st[now-i]=='0'){
                now=now-i;out[step++]=i;
                break;
            }
        }
    }
    for (int i=step-1;i>=0;--i)
        printf("%d ",out[i]);
}






Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a<=c&&b>=c)
		printf("Yes");
	else if(a>=c&&b<=c)
		printf("Yes");
	else
		printf("No");
    return 0;
}

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

typedef long long ll;
ll n, k, x, i, ans;
int main()
{
	cin >> n >> k;
	for (i = k + 1; i <= n; i++) {
		x = n / i;
		ans += x * (i - k);
		if (k == 0) ans += n - (x * i);
		else ans += max(0LL, n - (x * i + k) + 1);
	}
	cout << ans;
    return 0;
}


Measured memory_bytes: 256
import math

a, b, x = map(int, input().split())

if (a * a * b) / 2 >= x:
    tan = (a * b * b) / (2 * x)
    print(math.degrees(math.atan(tan)))
else:
    tan = 2 * ((a * a * b) - x) / (a * a * a)
    print(math.degrees(math.atan(tan)))


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

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

int main()
{
	ll K;
	cin >> K;
	set<ll> done;
	ll x = 7 % K;
	int ans = 1;
	for (;;) {
		if (x == 0) break;
		if (done.find(x) != done.end()) {
			ans = -1;
			break;
		}
		done.insert(x);
		x = (x * 10 + 7) % K;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll a, b, c, K;
    cin >> a >> b >> c;
    cin >> K;

    vec B(K+1), C(K+1);
    REP(i,0,K+1) {
        B[i] = b << i;
        C[i] = c << i;
    }

    bool f = false;
    REP(i,0,K+1) {
        ll _b = B[i];
        REP(j,0,K-i+1) {
            if(a < _b && _b < C[j]) {
                f = true;
                break;
            }
        }
    }

    if(f) PR("Yes");
    else PR("No");

    return 0;
}

/*



*/

Measured memory_bytes: 3628
import java.util.*;
class Res {
    String s;
    int index;
    int p;
    public Res(int index, String s, int p) {
	this.index = index;
	this.s = s;
	this.p = p;
    }
}
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = Integer.parseInt(sc.next());
	Res[] res = new Res[n];

	for(int i = 0; i<res.length; i++) {
	    res[i] = new Res(i+1, sc.next(), Integer.parseInt(sc.next()));
	}
	
	Arrays.sort(res, (a,b) -> a.s.compareTo(b.s));

	int nextI = 1;
	for(int i = 0; i<n; i++) {
	    nextI = i;
	    while(nextI<n && res[i].s.equals(res[nextI].s)) {
		nextI++;
	    }
	    Res max = res[i];
	    for(int k = i; k<nextI; k++) {
		max = res[k];
		int ind = k;
		for(int l = i; l<nextI; l++) {
		    if(max.p < res[l].p) {
			ind = l;
			max = res[l];
			
		    }
		}
		res[ind].p = -1;
		System.out.println(res[ind].index);
	    }
	    i = nextI -1;
	}

    }
}

Measured memory_bytes: 26580
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	int ta,tb;
	int ka,kb;
	int sa,sb;
	int min = 0x7FFF;
	scanf("%d", &n);
	for (int a = 1; a <= n / 2; ++a)
	{
		ta = a;
		tb = n - a;

		ka = 0;	sa = 0;
		while(ta){
			sa += (ta % 10);
			ta /= 10;
			++ka;
		}
		kb = 0;	sb = 0;
		while(tb){
			sb += (tb % 10);
			tb /= 10;
			++kb;
		}
		if(sa + sb < min)	min = (sa + sb);
	}
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;

using Graph = vector<vector<int>>;
vector<int> A(100010, 0);
bool ok = true;

//深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v){
  seen[v] = true; // v を訪問済みにする

  // vから行ける各頂点 next_v について
  for(auto nv : G[v]){
    if(A[nv] == A[v]){
      ok = false;
      break;
    }
    else A[nv] = A[v] * -1;
    
    if (seen[nv]) continue; // next_v が探索済みだったらスルー
    dfs(G, nv); // 再帰的に探索
  } 
}

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

  int N, M; cin >> N >> M;
  
  Graph G(N);
  for(int i=0;i<M;i++){
    int A, B;
    cin >> A >> B;
    A--; B--;
    G[A].push_back(B);
    G[B].push_back(A);
  }

  seen.assign(N, false); // 全頂点を「未訪問」にして初期化
  A[0] = 1;
  dfs(G, 0);

  if(ok){
    int count0{}, count1{};
    rep(i,N){
      if(A[i] == 1) count0++;
      else count1++;
    }
    cout << count0 * count1 - M << endl;
  }
  else{
    cout << N*(N-1)/2 - M << endl;
  }

}

Measured memory_bytes: 7808
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<string,int> P;

int main(){
	string str;

	map<string,string> table;
	for(int y=1;y<=6;y++){
		for(int x=1;x<=5;x++){
			string key="";
			key = (char)(y+'0');
			key = key + (char)(x+'0');
			table[key]='a'+(x-1)+(y-1)*5;
		}
	}
	table["62"] = ".";
	table["63"] = "?";
	table["64"] = "!";
	table["65"] = " ";

	while(getline(cin,str)){

		string res="";
		for(int i=0;i<str.size();){
			if(table.find(str.substr(i,2)) != table.end()){
				res += table[str.substr(i,2)];
				i+=2;
			}
			else{
				res = "NA";
				break;
			}
		}

		cout << res << endl;
	}
}

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

int main(){
ll N;
cin >> N;
vector<ll> A(N);
vector<ll> a(N+1,0);
rep(i, N) {
  cin >> A[i];
  a[A[i]]++;
}
ll cnt = 0;
rep(i, N+1){
  cnt += a[i]*(a[i]-1)/2;
}

rep(i, N){
  cout << cnt - a[A[i]] + 1 << endl;
}





}


Measured memory_bytes: 5760
def bfs(field,H,W,start_x,start_y,tmp_N):
    direction = [[-1,0],[1,0],[0,-1],[0,1]]
    que = []
    que.append([start_x,start_y])
    INF = 1000000
    min_path = [[INF] * W for i in range(H)]
    min_path[start_y][start_x] = 0
    while len(que) != 0:
        current = que.pop(0)
        for d in direction:
            nx = current[0] + d[0]
            ny = current[1] + d[1]
            if 0 <= nx < W and 0 <= ny < H and field[ny][nx] != "X" and min_path[ny][nx] == INF:
                min_path[ny][nx] = min_path[current[1]][current[0]] + 1
                if field[ny][nx] == tmp_N: # at the same cheese-power number
                    return nx,ny,min_path[ny][nx]
                else:
                    que.append([nx,ny])

def getField():
    matrix = []
    first = input().strip()
    H,W,N = map(int,first.split())
    for i in range(H):
        row = list(input().strip())
        for j in range(W):
            if row[j].isdigit():
                row[j] = int(row[j])
        matrix.append(row)
    return matrix,H,W,N

def getStart(field):
    for y in range(len(field)):
        for x in range(len(field[0])):
            if field[y][x] == "S":
                return x,y

def main():
    matrix,H,W,N = getField()
    sx,sy = getStart(matrix)
    distance = 0
    for k in range(N):
        if k != 0:
            tmp_x,tmp_y,tmp_dist = bfs(matrix,H,W,tmps[0],tmps[1],k+1)
            distance += tmp_dist
            tmps = [tmp_x,tmp_y]
        else:
            tmp_x,tmp_y,tmp_dist = bfs(matrix,H,W,sx,sy,k+1)
            distance += tmp_dist
            tmps = [tmp_x,tmp_y]
    print(distance)


if __name__=='__main__':
    main()

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

using namespace std;

int main(void) {
  int s = 0;
  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    s += a < 40 ? 40 : a;
  }

  cout << s / 5 << endl;

  return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#ifdef _LOCAL //
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout   \
	if (false) \
	cout
#define debug() if (false)
#define dvout(v) if(false);
#endif //
#define next asdnext
#define prev asdprev
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define vrep(i, v) for (auto &i : v)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力
#define vecin(v,n)	\
	vec(v,n);		\
	vin(v);
#define vec(v, n) vector<int> v(n, 0);
#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;



void Main()
{
	int X,Y;
	cin>>X>>Y;
	if((Y%2)!=0){
		cout<<"No\n";
		return;
	}
	if((X*2) > Y || (X*4) < Y){
		cout<<"No\n";
		return;
	}
	cout<<"Yes"<<endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 3564
from collections import deque
import bisect
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()

class Counting():
    def __init__(self,maxim,mod):
        maxim += 1

        self.mod = mod
        self.fact = [0]*maxim
        self.fact[0] = 1
        for i in range(1,maxim):
            self.fact[i] = self.fact[i-1] * i % mod

        self.invfact = [0]*maxim
        self.invfact[maxim-1] = pow(self.fact[maxim-1],mod-2,mod)
        for i in reversed(range(maxim-1)):
            self.invfact[i] = self.invfact[i+1] * (i+1) % mod


    def nCk(self,n,r):
        if n < 0 or n < r: return 0
        return self.fact[n] * self.invfact[r] * self.invfact[n-r] % self.mod

    def nPk(self,n,r):
        if n < 0 or n < r: return 0
        return self.fact[n] * self.invfact[n-r] % self.mod


def main():
    N,K=mi()
    graph = [[] for _ in range(N+1)]
    MOD = 10**9+7

    a = 0
    for i in range(N-1):
        a,b=mi()
        graph[a].append(b)
        graph[b].append(a)

    stack = deque([(a,1)])
    seen = set()

    counting = Counting(K+10,MOD)
    ans = counting.nPk(K,1)

    def _len(X):
        cnt = 0
        for x in X:
            if x in seen: continue
            cnt += 1
        # print(X,cnt)
        return cnt

    while len(stack) > 0:
        next,depth = stack.popleft()
        seen.add(next)
        # print("n",next,depth)

        if depth == 1:
            ans *= counting.nPk(K-1,_len(graph[next]))
            ans %= MOD
            # print(_len(graph[next]))
            # print(K-1,len(graph[next]),counting.nPk(K-1,len(graph[next])),"ans",ans)
        # elif depth == 2: continue
        else:
            ans *= counting.nPk(K-2,_len(graph[next]))
            # print(K-1,len(graph[next]),counting.nPk(K-1,len(graph[next])),"ans",ans)
            # print(_len(graph[next]))
            ans %= MOD


        for g in graph[next]:
            if g in seen: continue
            stack.append((g,depth+1))


    print(ans%MOD)



if __name__ == "__main__":
  main()


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

int main(){

	int a, b, c;
	int ans = 0;

	cin >> a >> b >> c;

	ans += (a != b) ? 1 : 0;
	ans += (b != c) ? 1 : 0;
	ans += (c != a) ? 1 : 0;
	ans += (a == b && b == c) ? 1 : 0;

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
const int N=2e5+5;
int n,m,i,k,a[N];
char s[N];
int main(){
	scanf("%d%d%s",&n,&m,s+1);
	for (i=1;i<=n;i++) a[i]=s[i]-65;
	if (m){
		for (i=1;i<=n;i++){
			if (a[i]^(i&1)) m--;if (!m) break;
			m--;k=i;if (!m) break;
		}
	}
	else i=0;
	if (i<=n){
		int st=i-(k!=i),v=st&1;a[i]=1^v;
		for (k=0,i=st;i;i--,k^=1) a[i]=k;
		for (i=st+1;i<=n;i++) putchar((a[i]^v)+65);
		for (i=1;i<=st;i++) putchar(a[i]+65);
		return 0;
	}
	if (!(n&1)){
		for (i=1;i<=n;i++) putchar((i&1)+65);
		return 0;
	}
	putchar((m&1)?'B':'A');
	for (i=1;i<n;i++) putchar((i&1)+65);
}

Measured memory_bytes: 1280
#include <stdio.h>
#define MOD 1000000007
#define N 500001
typedef long long ll;

ll fac[N], inv[N];
ll C(int n, int r) {return fac[n] * inv[n - r] % MOD * inv[r] % MOD;}
ll P(int n, int r) {return fac[n] * inv[n - r] % MOD;}

ll power(ll a, ll n)
{
    ll ans = 1;
    while(n)
    {
        if(n & 1) ans = ans * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ans;
}

int main()
{
    int n, m;

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

    fac[0] = 1;
    for(int i = 1; i <= m; i++) fac[i] = fac[i - 1] * i % MOD;

    inv[m] = power(fac[m],MOD - 2);//find the inverse fac[m]
    //inverse(n)*n! == n! / n == (n - 1)!
    for(int i = m - 1; i >= 0; i--) inv[i] = inv[i + 1]*(i + 1) % MOD;

    ll ans = 0, sym = 1;
    for(int i = 0; i <= n; i++) 
    {
        ans += sym*C(n,i)*P(m - i,n - i) % MOD;
        sym *= -1;
    }
    ans = (ans % MOD + MOD) % MOD;
    printf("%lld\n", ans * P(m,n) % MOD);

    return 0;
}

Measured memory_bytes: 9484
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	
	int sum = 0;
	
	cin>>N;
	
	for(int j = 1; j <= N; j++){
		int V;
		
		cin>>V;
		
		sum += V - j;
	}
	
	cout<<sum<<endl;
	
	
	return 0;
}


Measured memory_bytes: 3216
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        int a = sc.nextInt();
        double[] h = new double[n+1];
        for(int i=1;i<=n;i++) h[i] = sc.nextDouble();
        int ans = -1;
        double dt = Double.MAX_VALUE/2;
        for(int i=1;i<=n;i++){
            double cur = t-0.006*h[i];
            double now = Math.abs(cur-a);
            if(now<dt){
                dt = now;
                ans = i;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 29296
#include <bits/stdc++.h>
using namespace std;
const int maxn=112345;
int n,m,p[maxn],deg[maxn],dep[maxn];
vector<int> G[maxn];
queue<int> que;
inline void bfs() {
    while (!que.empty()) {
        int u=que.front();
        que.pop();
        for (int i=0;i<(int)G[u].size();++i) {
            int v=G[u][i];
            if (dep[v]<dep[u]+1) {
                dep[v]=dep[u]+1;
                p[v]=u;
            }
            --deg[v];
            if (!deg[v]) que.push(v);
        }
    }
}
int main()
{
    scanf("%d%d",&n,&m);
    for (int i=0;i<n-1+m;++i) {
        int u,v;scanf("%d%d",&u,&v);
        G[u].push_back(v);
        ++deg[v];
    }
    for (int i=1;i<=n;++i)
        if (!deg[i]) que.push(i);
    bfs();
    for (int i=1;i<=n;++i)
        printf("%d\n",p[i]);
    return 0;
}


Measured memory_bytes: 7808
def submit():
    n = int(input())
    ans_count = {i: 0 for i in range(1, n + 1)}

    def f(x, y, z):
        return x * x + y * y + z * z + x * y + y * z + z * x

    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                a = f(x, y, z)
                if a <= n:
                    ans_count[a] += 1

    for a in range(1, n + 1):
        print(ans_count[a])


submit()
                                    

Measured memory_bytes: 69400
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	int h,w;
    	while(true){
    		h = scan.nextInt();
    		w = scan.nextInt();
    		if(h == 0 && w == 0) break;
    		for(int i=0;i<h;i++){
    			for(int j=0;j<w;j++){
    				if(i % 2 == 0){
    					if(j%2 == 0) System.out.print("#");
    					else System.out.print(".");
    				}
    				else {
    					if(j%2 == 0) System.out.print(".");
    					else System.out.print("#");
    				}
    			}
    			System.out.println();
    		}
    		System.out.println();
    	}
    }
}

Measured memory_bytes: 27064
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


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

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M, C, A, B[22], c = 0;

  std::cin >> N >> M >> C;

  for (int j = 0; j < M; j ++)
    std::cin >> B[j];

  for (int i = 0; i < N; i ++) {
    int S = C;
    
    for (int j = 0; j < M; j ++) {
      std::cin >> A;

      S += A * B[j];
    }

    if (S > 0)
      c ++;
  }

  std::cout << c << std::endl;

  return 0;
}


Measured memory_bytes: 256
function Main(input){
    const arr = input.trim().split("\n");
    const AV = arr[0].split(" ").map(Number);
    const BW = arr[1].split(" ").map(Number);
    const T  = Number(arr[2]);
    if(Math.abs(AV[0]-BW[0]) <= T*(AV[1] - BW[1])){
        console.log("YES");
    } else{
        console.log("NO");
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29624
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

int main(int argc, char *argv[]) {
  const ll MOD = 1e9 + 7LL;

  int n, i;
  cin >> n;

  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }

  ll tmp = 0, sum = 0;
  for(i=1;i<n;i++){
    tmp += a[i-1];
    tmp %= MOD;
    sum += (a[i] * tmp) % MOD;
    sum %= MOD;
  }

  if(sum<0LL) sum += MOD;

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 4772
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#include<cstring>
#include<string>
#include<set>

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

using namespace std;
using ll = long long int;

const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(void) {
    int n; cin >> n;
    cout << (long double)(n / 2 + n % 2) / n << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)



ll n, d[100005], fe = 1, sn = 1;
vector<ll> e[100005];

void dfs_fe(ll k, ll deep){
    REP(i, e[k].size()){
        if(d[e[k][i]] == INF){
            d[e[k][i]] = deep + 1;
            dfs_fe(e[k][i], deep + 1);
            fe++;
        }
    }
}

void dfs_sn(ll k, ll deep){
    REP(i, e[k].size()){
        if(d[e[k][i]] == INF){
            d[e[k][i]] = deep + 1;
            dfs_sn(e[k][i], deep + 1);
            sn++;
        }
        else if(d[e[k][i]] - 1 > deep){
            d[e[k][i]] = deep + 1;
            dfs_sn(e[k][i], deep + 1);
            sn++;
            fe--;
        }
    }
}

int main()
{
    cin >> n;
    REP(i, n - 1){
        ll a, b;

        cin >> a >> b;
        
        a--;b--;
        e[a].push_back(b);
        e[b].push_back(a);

        d[i] = INF;
    }
    d[0] = d[n - 1] = 0;

    dfs_fe(0, 0);
    dfs_sn(n - 1, 0);

    //cout << fe << ' ' << sn << endl;
    if(fe > sn){
        cout << "Fennec" << endl;
    }
    else{
        cout << "Snuke" << endl;
    }
}

Measured memory_bytes: 11136
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p_use = p[:X]
q_use = q[:Y]
r_use = r[:]
p_use.extend(q_use)
p_use.extend(r_use)
total = p_use[:]
total.sort(reverse=True)
total_use = total[:X+Y]
sum = 0
for i in range(len(total_use)):
    sum += total_use[i]
print(sum)

Measured memory_bytes: 24880
import sys
N = int(sys.stdin.readline().rstrip())
sec = []

for _ in range(N):
    x, l = map(int, sys.stdin.readline().rstrip().split())
    sec.append((x - l, x + l))

sec = sorted(sec, key=lambda x: x[1])
r = -float("inf")
ans = 0
for s, t in sec:
    if r <= s:
        ans += 1
        r = t
print(ans)

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

int main() {
  int N;
  cin >> N;
  int H0;
  cin >> H0;
  int preH = H0;
  int lastHigher = 0;
  int max = 0;
  int H, move;
  for(int i = 1; i < N; i++) {
    cin >> H;
    if ( preH < H ) {
      move = (i-1) - lastHigher;
      if ( move > max ) {
        max = move;
      }
      lastHigher = i;
    }
    preH = H;
  }
  move = (N-1) - lastHigher;
  if ( move > max ) {
    max = move;
  }
  cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define long long long
const long MOD = 1e9+7;
long floorSqrt(long x)  
{     
    if (x == 0 || x == 1)  
       return x; 
  
    // Do Binary Search for floor(sqrt(x)) 
    long start = 1, end = x, ans;    
    while (start <= end)  
    {         
        long mid = (start + end) / 2; 
  
        // If x is a perfect square 
        if (mid*mid == x) 
            return mid; 
  
        // Since we need floor, we update answer when mid*mid is  
        // smaller than x, and move closer to sqrt(x) 
        if (mid*mid < x)  
        { 
            start = mid + 1; 
            ans = mid; 
        }  
        else // If mid*mid is greater than x 
            end = mid-1;         
    } 
    return ans; 
} 
long digits(long n)
{
    long ans=0;
    while(n)
    {
        ans++;
        n/=10;
    }
    return ans;
}
signed main()
{
    long test;
    test=1;
    // cin>>test;
    while(test--){
    long i,j,a,b,n,x,ans,most,index,c,maxi=0,temp;
    cin>>n;
    ans=digits(n);
    a=floorSqrt(n);
    for(i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            temp=digits(n/i);
        }
        else continue;
    }
    cout<<temp;
    
    
    // if(a*a==n)
    // {
    //     cout<<digits(a);
    // }
    // else 
    // {
    //     while(a>0)
    //     {
    //         if(n%a==0)
    //         {
    //             cout<<digits(n/a);
    //             break;
    //         }
    //         else a--;
    //     }
    // }
    }
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{
    int a,b,c,sum;
    cin>>a>>b>>c;

    sum=a+b+c;

    if(sum>=22)
    {
        cout<<"bust"<<endl;
    }
    else
    {
        cout<<"win"<<endl;
    }
    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    if (s == "SUN")
        cout << 7 << endl;
    if (s == "MON")
        cout << 6 << endl;
    if (s == "TUE")
        cout << 5 << endl;
    if (s == "WED")
        cout << 4 << endl;
    if (s == "THU")
        cout << 3 << endl;
    if (s == "FRI")
        cout << 2 << endl;
    if (s == "SAT")
        cout << 1 << endl;
    return 0;
}


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

public class Main {
	static final int like = 753;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		HashMap<String, Integer> map = new HashMap<>();
		
		int n = sc.nextInt();	
		for(int i = 0; i < n; i++) {
			String key = sc.next();
			if (!map.containsKey(key)) {
				map.put(key, 1);
			} else {
				map.put(key, map.get(key) + 1);
			}
		}
		
		int m = sc.nextInt();
		for(int i = 0; i < m; i++) {
			String key = sc.next();
			if (!map.containsKey(key)) {
				map.put(key, -1);
			} else {
				map.put(key, map.get(key) - 1);
			}
		}
		
		int max = Integer.MIN_VALUE / 10;
		for(String key: map.keySet()) {
			int num = map.get(key);
			if (max < num) max = num;
		}
		if (max < 0) max = 0;
		out.println(max);
		
		out.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());}
}
}



Measured memory_bytes: 21588
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf 2000000000
#define EPS 1e-7
#define MOD 999377ll
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pr;
typedef pair<pair<ll, ll>, pair<ll, ll>> tup;

inline void solve()
{
	int n, m;
	cin >> n >> m;
	cout << n / m + (n % m > 0 ? 1 : 0);
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();

		System.out.println(s.substring(0, 3));
	}
}


Measured memory_bytes: 26956