akhauriyash/Code-Regression huggingface dataset:
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	int n,m;
	cin>>n>>m;
	vi d(n+1,0);
	int x,y;
	for0(i,m){
		cin>>x>>y;
		d[x]++;
		d[y]++;
		}
	for1(i,n)cout<<d[i]<<nw;
	
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
# 3 2
# 4 1 5
# N, M = map(int, '3 2'.split())
# As = list(map(int, '4 1 5'.split()))
N, M = map(int, input().split())
As = list(map(int, input().split()))

ct = Counter()
ct[0] = 1

ans = 0
s = 0
for a in As:
	s+=a
	ans += ct[s%M]
	ct[s%M] += 1

print(ans)



Measured memory_bytes: 14920
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

int main()
{
	ll W, H, x, y;
	cin >> W >> H >> x >> y;

	double ans = (double) (W * H )/ 2;

	cout << setprecision(10) << ans << " ";

	if (x * 2 == W && y * 2 == H) {
		cout << 1 << endl;
	} else
		cout << 0 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
  int n, h, m, s;
  std::cin >> n;
  h = n / 3600;
  m = (n % 3600) / 60;
  s = (n % 3600) % 60;

  std::cout << h << ':' << m << ':' << s << std::endl;

  return 0;
}

Measured memory_bytes: 3080
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int a,b,c;
	cin>>a>>b>>c;
	if(a==b)
	{
		if(b!=c)
		{
			cout<<"Yes";
			return 0;
		}
		else 
		{
			cout<<"No";
			return 0;
		}
	} 
	if(b==c)
	{
		if(a!=b)
		{
			cout<<"Yes";
			return 0;
		}
		else
		{
			cout<<"No";
			return 0;
		}
	}
	if(a==c)
	{
		if(a!=b)
		{
			cout<<"Yes";
			return 0;
		}
		else 
		{
			cout<<"No";
			return 0;
		}
	}
	else cout<<"No";
    return 0;
} 

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


int main(){
	int N, Y;
	cin >> N >> Y;
	REP(i, N+1) REP(j, N+1) {
		int k = N - i - j;
		if(0 <= k && k <= N) {
			if(i * 10000 + j * 5000 + k * 1000 == Y) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}

	cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
def Is_ToPut(p,w,k):
    count =1
    temp =p
    for i in w:
        if temp >= i:
            temp -=i
        elif i > p :
            return 0
        else:     
            count +=1
            temp =p-i
    if count <= k:return 1
    else:return 0

n,k = list(map(int,input().split(' ')))
w =[]
for _ in range(n):
    w.append(int(input()))
ans =100000*10000
left = 0
right = 100000*10000
while left < right:
    p = (left+right)//2
    if Is_ToPut(p,w,k):
        if ans > p:ans =p
        right=p
    else:
        left = p +1
print(ans)
        


Measured memory_bytes: 9560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = 1e9;

int N,K;
int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> K;
    vector<int> dp(N+K,INF),h(N);
    for(int i = 0; i < N;++i) cin >> h[i];
    dp[0] = 0;
    for(int i = 0; i < N;++i){
        for(int k = 1; i+k < N && k <= K;++k){
            dp[i+k] = min(dp[i+k], dp[i] + abs(h[i+k]-h[i]));
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}



Measured memory_bytes: 1024
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int ans = 0;
		for(int i = 0; i < 3; i++)
			if(S.charAt(i) == 'R')
				ans++;
		if(S.equals("RSR"))
			ans = 1;
		System.out.println(ans);
	}

}


Measured memory_bytes: 35544
import sys
input=sys.stdin.readline
N,A,B=map(int,input().split())

hlist=[]
mh=0
for i in range(N):
  h=int(input())
  hlist.append(h)
  mh=max(mh,h)
#print(mh,hlist)

res_dic={0:False}
def isOK(m):
  if m in res_dic:
    return res_dic[m]
  
  h2list=[]
  mh2=-float("inf")
  for i in range(N):
    h2=hlist[i]-m*B
    h2list.append(h2)
    mh2=max(h2,mh2)
  if mh2<=0:
    res_dic[m]=True
    return res_dic[m]
  
  cnt=0
  for i in range(N):
    if h2list[i]>0:
      cnt+=-(-h2list[i]//(A-B))
      
  res_dic[m]=(cnt<=m)
  return res_dic[m]

l,r=1,-(-mh//B)
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  if not isOK(mid-1) and isOK(mid):
    print(mid)
    break
  elif isOK(mid-1):
    r=mid-1
  else:
    l=mid+1

Measured memory_bytes: 118620
#include<stdio.h>

int main(){
	int k, x;
	scanf("%d%d",&k,&x);
	int l_end, r_end;
	l_end = x-k+1;
	if(l_end < -1000000) l_end = -1000000;
	r_end = x+k-1;
	if(r_end > 1000000) r_end = 1000000;
	
	for(int i=l_end; i<=r_end; i++){
		printf("%d ",i);
	}
	
	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<double> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  sort(v.rbegin(), v.rend());
  while (2 <= v.size()) {
    double a = v.back(); v.pop_back();
    double b = v.back(); v.pop_back();
    v.push_back((a+b)/2.0);
  }
  cout << v.front() << '\n';
  return 0;
}


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

int main()
{
	int n, r;
	while (cin >> n >> r, n + r)
	{
		deque<int> ary;
		for (int i = 1; i <= n; i++) ary.push_front(i);

		while (r--)
		{
			int p, c;
			cin >> p >> c;
			int i = p + c - 2;
			while (c--)
			{
				int tmp = ary[i];
				ary.erase(ary.begin() + i);
				ary.push_front(tmp);
			}
		}

		cout << ary.front() << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <cmath>

using namespace std;

int main(void)
{
    int X;
    cin >> X;

    int ans = 1;
    for(int b = 2; b < X; ++b)
    {
        int p = 2;
        int tmp_ans = 1;
        while(1)
        {
            int exp = (int)pow(b, p);
            if(X < exp)
            {
                break;
            }
            tmp_ans = max(tmp_ans, exp);
            ++p;
        }
        ans = max(ans, tmp_ans);
    }

    cout << ans << endl;

    return 0;
}

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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

ll a[10010];
int cnt[1000010];
ll MOD = 1e9 + 7;


void faktorisi(ll x)
{
    for(int i = 2; i * i <= x; i++)
    {
        int br = 0;
        while(x % i == 0)
        {
            br++;
            x /= i;
            if(x == 1) break;
        }
        cnt[i] = max(cnt[i], br);
        if(x == 1) break;
    }
    if(x > 1) cnt[x] = max(cnt[x], 1);
}

ll mul(ll a, ll b)
{
    return (a*b)%MOD;
}

ll add(ll a, ll b)
{
    return (a + b)%MOD;
}

ll inverz(ll a, int k)
{
    if(k == 0) return 1;
    ll rez = inverz(a, k/2);
    rez = mul(rez, rez);
    if(k % 2 == 1) rez = mul(rez, a);
    return rez;
}

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

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

    ll sum = 0;
    ll NZS = 1;
    for(ll i = 2; i < 1000009; i++)
        if(cnt[i] > 0) NZS = mul(NZS, inverz(i,cnt[i]));

    for(int i = 0; i < n; i++)
    {
        ll b = mul(NZS, inverz(a[i], MOD - 2));
        sum = add(sum, b);
    }
    cout << sum;


    return 0;
}


Measured memory_bytes: 2944
def inN():
    return int(input())
def inL():
    return list(map(int,input().split()))
def inNL(n):
    return [list(map(int,input().split())) for i in range(n)]
k = inN()
s = input()
l = len(s)
if k >= l:
    print(s)
else:
    print(s[:k]+"...")

Measured memory_bytes: 61984
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

ll N;
ll H[MAX];

int main() {
    cin >> N;
    REP(i, N) {
        cin >> H[i];
    }    

    ll ans = 0;
    ll counter = 0;
    REP(i, N) {
        if(H[i] <= H[i-1]) {
            counter++;
        } else {
            counter = 0;
        } 
        ans = max(ans, counter);
    }

    print(ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x)                   cout << '>' << #x << ':' << x << endl;
typedef long long int ll;
int n,m,a,b,c,box[13],cost[1010],open[1010],box_num[1010][13];
ll dp[1010][(1<<12)+1];
int Set(int mask,int n)
{
    n--;
    return mask|(1<<n);
}
ll solve(int i,int mask)
{
    //cout<<mask<<" "<<(1<<n)-1<<endl;
    if(mask==(1<<n)-1)
    {

        return 0;
    }
    if(i>=m)
    return INT_MAX;
    if(dp[i][mask]!=-1)
        return dp[i][mask];
    int Mask=mask;
    for(int j=0;j<open[i];j++)
    {
        Mask=Set(Mask,box_num[i][j]);
    }
    ll temp=cost[i]+solve(i+1,Mask);
    ll temp1=solve(i+1,mask);
    return dp[i][mask]=min(temp,temp1);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        cin>>cost[i]>>open[i];
        for(int j=0;j<open[i];j++)
            cin>>box_num[i][j];
    }
    memset(dp,-1,sizeof(dp));
   ll ans=solve(0,0);
   if(ans>=INT_MAX)
    cout<<-1<<endl;
   else
    cout<<ans<<endl;


    return 0;
}



Measured memory_bytes: 32640
#include<stdio.h>
#include<string.h>
int main()
{
	int k, a, b, i;
	scanf("%d%d%d", &k, &a, &b);
	for (i = a; i <= b; i++)
	{
		if (i % k == 0)
		{
			printf("OK");
			return 0;
		}
	}
	printf("NG");
	return 0;
}

Measured memory_bytes: 1732
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
    	public void solve(int testNumber, InputReader in, PrintWriter out) {
    		int N = 0;
    		String S = in.next();
    		for(int i = 0; i < S.length(); i++) {
    			if(S.charAt(i) == '+') {
    				N++;
    			}else {
    				N--;
    			}
    		}
    		out.println(N);
    	}
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include<iostream>
#include<vector>
#include <cmath>

using namespace std;
int main()
{   
    // 整数の入力
    int i;
    std::string a;
    cin >> a;
//    vector<int> vect;

    int n = 7;
    if(a=="SUN"){

    }else if(a=="MON"){
        n=6;
    }else if(a=="TUE"){
        n=5;
    }else if(a=="WED"){
        n=4;
    }else if(a=="THU"){
        n=3;
    }else if(a=="FRI"){
        n=2;
    }else if(a=="SAT"){
        n=1;
    }
        cout << n;
        return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! 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 ) * } } ; }

fn main() {
    input! {
        h: usize,
        w: usize,
        d: usize,
        a: [[usize; w]; h],
        q: usize,
        lr: [(i32, i32); q],
    }

    let mut inv = vec![(0, 0); h * w + 1];
    for i in 0..h {
        for j in 0..w {
            inv[a[i][j]] = (i as i32, j as i32);
       }
    }

    let mut dp = vec![0; h * w + 1];
    for dd in 1..=d {
        for i in 0..h * w {
            if dd + (i + 1) * d > h * w {
                break;
            }
            let (xp, yp) = inv[dd + i * d];
            let (xc, yc) = inv[dd + (i + 1) * d];
            dp[dd + (i + 1) * d] = dp[dd + i * d] + (xc - xp).abs() + (yc - yp).abs();
        }
    }

    for (l, r) in &lr {
        println!("{}", dp[*r as usize] - dp[*l as usize]);
    }

}


Measured memory_bytes: 4704
#include<bits/stdc++.h>
  using namespace std;
  #define magic ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define rep(i,a,b) for(int i = a; i <=b; i++)
  #define rep2(i,a,b) for(int i = a; i>=b; i--)
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(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 trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)


 
  int32_t main()
  {        

     magic

     int a, b, c;
      cin >> a >> b >> c;


      if(a+b+c >=22)
      {
        cout << "bust";
      }
      else
      {
        cout << "win";
      }

      
    return  0;
     }



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int MAX_N = 200000;

int main(int argc, char const *argv[])
{
	int n, x[MAX_N], y[MAX_N];
	vector<int> b;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> x[i];
		y[i] = x[i];
	}
	sort(y, y+n);

	int mid = n/2 - 1;

	for (int i = 0; i < n; ++i) {
		if (x[i]<=y[mid]) b.push_back(y[mid+1]);
		else b.push_back(y[mid]);
	}

	for (int i = 0; i < n; ++i) {
		cout << b[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4724
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    string ans;
    while(N!=0) {
        int a=N%26;
        if(a==0){
            ans+='z';
        } else {
            ans+=(char)('a'+(a-1));
        }
        if(N>=26)N--;
        N/=26;
    }
    reverse(all(ans));
    cout << ans << endl;
}


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

vector<ll> divisor(ll a){
    vector<ll> res;
    for(int i=2; i<=sqrt(a); i++){ //1を含んでいない
        if(a%i==0){
            res.push_back(i);
            if(i!=a/i) res.push_back(a/i);
        }
    }
    res.push_back(a);
    sort(all(res));
    reverse(all(res));
    return res;
}

int main(){
    ll n,m; cin >> n >> m;
    vector<ll> re;
    re=divisor(m);
    rep(i,re.size()){
        if(m-re[i]*n>=0 && (m-re[i]*n)%re[i]==0){
            cout << re[i] << endl;
            return 0;
        }
    }
    cout << 1 << endl;
return 0;
}


Measured memory_bytes: 3684
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

int main() {
    int ans;
    string S;
    cin >> S;

    if(S == "SUN"){
        ans = 7;
    }
    else if (S == "MON")
    {
        ans = 6;
    }else if(S == "TUE"){
        ans = 5;
    }else if(S == "WED"){
        ans = 4;
    }else if(S == "THU"){
        ans = 3;
    }else if(S == "FRI"){
        ans = 2;
    }else if(S == "SAT"){
        ans = 1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}


int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    string s;
    cin >> s;
    int len = s.size();
    bool flag = 1;
    for (int i = 0; i < len; ++i) {
        if ((i & 1) == 0) {
            if (!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) {
                flag = 0;
                break;
            }
        }else{
            if (!(s[i] == 'L' || s[i] == 'U' || s[i] =='D')) {
                flag = 0;
                break;
            }
        }
    }
    if (flag) {
        puts("Yes");
    }else puts("No");

    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	
	vector<int> h(n);
	for (auto &&e : h)
		cin >> e;
	
	sort(h.begin(), h.end());
	
	vector<int> c(n - (k - 1));
	
	for (int i = 0; i + k <= n; ++i)
		c[i] = h[i + (k - 1)] - h[i];
	
	sort(c.begin(), c.end());
	
	cout << c[0] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n; cin >> n;
    double x, ans=0; string u;
    for(int i = 0; i < n; i++){
        cin >> x >> u;
        ans += (u=="JPY" ? x : (x * 380000.0));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
 
    string s;
    int ans;

    cin >> s;

    for(int i=0;i<3;i++){
        if(s[i]=='1'){
            ans = ans +1;
        }
    }

    cout << ans <<endl;

    return 0;
}

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

int gcd(int m, int n);

int main(int argc, const char * argv[])
{
    //std::cout << "Hello World\n";
    int n, m;
    while(cin >> n >> m){
        //std::cout << n << "," << m << "\n";
        cout << gcd(n, m) << "\n";
    }
    return 0;
}

int gcd(int m, int n){
	// 引数に０がある場合は０を返す
	if ((0 == m)||(0 == n))
		return 0;
	
	// ユークリッドの方法
	while(m != n){
		if(m > n) m = m - n;
		else n = n - m;
	}
	return m;
}

Measured memory_bytes: 1160
#include <cstdio>

using namespace std;

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

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

    int ans = 0;

    for(int i = 0,x;i < N;++i){
        scanf("%d",&x);
        if(x < A || x >= B) ++ans;
    }

    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 128
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
use std::f64::consts::PI;

#[fastout]
fn main() {
    input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }
    let alpha = (60_f64 * h + m) / 720_f64 * 2_f64 * PI;
    let a_x = a * alpha.cos();
    let a_y = a * alpha.sin();
    let beta = m / 60_f64 * 2_f64 * PI;
    let b_x = b * beta.cos();
    let b_y = b * beta.sin();
    let ans = ((a_x - b_x).powi(2) + (a_y - b_y).powi(2)).powf(0.5);
    println!("{}", ans);
}


Measured memory_bytes: 2840
n, m, x = map(int, input().split())

Book = [[int(x) for x in input().split()] for j in range(n)]
Cost = 10 ** 7
for i in range(2**n):
  bag = [0 for k in range(n+1)]
 
  for j in range(n):
    if ((i >> j) &1):
      bag = [ x + y for (x,y) in zip (bag,Book[j])]
  if all(b >= x for b in bag[1:]):
    if Cost >= bag[0]:
      Cost = bag[0]
if Cost != 10 ** 7:
  print(Cost)
else:
  print(-1)

Measured memory_bytes: 9224
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a,n) sort(a, a + n)
#define vi vector<int>
#define vd vector<double>

//ここからAtCoder向けdefine
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;

using namespace std;

long long int luca[86];

long long int lucas(int N){
    if(luca[N] != 0){
        return luca[N];
    }else{
        luca[N] = lucas(N - 2) + lucas(N - 1);
        return lucas(N - 2) + lucas(N - 1);
    }
}

int main(){
    ios::sync_with_stdio(false);
    long long int N;
    cin >> N;
    luca[0] = 2;
    luca[1] = 1;
    cout << lucas(N) << endl;
    return 0;
}

Measured memory_bytes: 256
S = [int(x) for x in input().split()]
N = S[0]
A = S[1]
B = S[2]

Amari = N % (A+B)
Wari = N // (A+B)
if Amari > A:
    ans =Wari*A+A
else:
    ans =Wari*A+Amari
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
const lint mod = 1e9 + 7;

int d[2010];
vector<int> G[2010];
pii E[2010];

void dfs(int v, int dep){
    d[v] = dep;
    for(int nv: G[v])if(d[nv] < 0) dfs(nv, dep+1);
}

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    rep(i, n-1){
        int a, b;
        scanf("%d%d", &a, &b);
        G[--a].push_back(--b);
        G[b].push_back(a);
        E[i] = pii(a, b);
    }
    int ans = n;
    if(k % 2 == 0){
        rep(v, n){
            rep(i, n) d[i] = -1;
            dfs(v, 0);
            int cnt = 0;
            rep(i, n)if(d[i] > k/2) ++cnt;
            ans = min(ans, cnt);
        }
    }
    else{
        for(pii e: E){
            rep(i, n) d[i] = -1;
            d[e.fi] = d[e.se] = 0;
            dfs(e.fi, 0);
            dfs(e.se, 0);
            int cnt = 0;
            rep(i, n)if(d[i] > k/2) ++cnt;
            ans = min(ans, cnt);
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
const int N = 1e6;
 
int cnt[N + 1];
bool flg[N + 1];
std::vector<int> prime;
 
inline void eular()
{
    memset(flg, true, sizeof flg);
    for (int i = 2; i <= N; ++i)
    {
        if (flg[i])
        {
            prime.push_back(i);
        }
        for (std::vector<int>::iterator it = prime.begin(); it != prime.end() && i * (*it) <= N; ++it)
        {
            flg[i * (*it)] = false;
            if (i % *it == 0)
            {
                break;
            }
        }
    }
}
 
inline void divide(int x)
{
    for (std::vector<int>::iterator it = prime.begin(); it != prime.end() && *it * (*it) <= x; ++it)
    {
        if (x % *it == 0)
        {
            cnt[*it]++;
            while (x % *it == 0)
            {
                x /= *it;
            }
        }
    }
    if (x != 1)
    {
        cnt[x]++;
    }
}
 
inline int gcd(int a, int b)
{
    if (!b)
    {
        return a;
    }
    return gcd(b, a % b);
}
 
int main()
{
    eular();
 
    int n;
    std::cin >> n;
    int a, g;
    std::cin >> g;
    divide(g);
    for (int i = 1; i < n; ++i)
    {
        std::cin >> a;
        divide(a);
        g = gcd(a, g);
    }
 
    if (g != 1)
    {
        std::cout << "not coprime" << std::endl;
    }
    else
    {
        bool flg = true;
        for (std::vector<int>::iterator it = prime.begin(); it != prime.end(); ++it)
        {
            if (cnt[*it] > 1)
            {
                flg = false;
                break;
            }
        }
        if (flg)
        {
            std::cout << "pairwise coprime" << std::endl;
        }
        else
        {
            std::cout << "setwise coprime" << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 8584
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n;
  ll t, h[SIZE];
  
  scanf("%d%lld",&n,&t);

  ll start = 0;
  ll maxh = 0;
  ll sum = 0;
  ll l = 0;
  
  for(int i=0;i<n;i++){
    scanf("%lld",h+i);
    
    if(i > 0 && maxh <= h[i]){
      ll pos = (t-start) / h[l];
      printf("%lld\n",max(pos+1,1LL));
      ll subsum = 0;
      
      for(int j=l+1;j<i;j++){
        subsum += h[j];
        
        while(t-start < subsum + pos*h[l]) pos--;
        
        printf("%lld\n",max(pos+1,1LL));
      }
      
      l = i;
      start += sum;
      maxh = h[i];
      sum = h[i];
    }else{
      sum += h[i];
      if(i==0) maxh = h[0];
    }
  }

  ll pos = (t-start) / h[l];
  printf("%lld\n",max(pos+1,1LL));
  ll subsum = 0;
  
  for(int j=l+1;j<n;j++){
    subsum += h[j];
        
    while(t-start < subsum + pos*h[l]) pos--;
    
    printf("%lld\n",max(pos+1,1LL));
  }
  
  return 0;
}




Measured memory_bytes: 4012
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    string S;
    cin >> S;
    int N = S.size();
    vint A(N, 0);
    vint B(N, 0);

    rep(i, N) {
        if (S[i] == 'R') A[i] = 1;
        else B[i] = 1;
    }
    rep(i, N - 1) {
        if (S[i] == 'R' && S[i + 1] == 'R') {
            A[i + 1] = A[i] + 1;
            A[i] = 0;
        }
    }

    for (int i = N - 1; i > 0; i--) {
        if (S[i] == 'L' && S[i - 1] == 'L') {
            B[i - 1] = B[i] + 1;
            B[i] = 0;
        }
    }

    vint ans(N, 0);
    rep(i, N - 1) {
        if (S[i] == 'R' && S[i + 1] == 'L') {
            if ((A[i] + B[i + 1]) % 2 == 0) {
                ans[i] = (A[i] + B[i + 1]) / 2;
                ans[i + 1] = (A[i] + B[i + 1]) / 2;
            }
            else {
                ans[i] = (A[i] + B[i + 1]) / 2;
                ans[i + 1] = (A[i] + B[i + 1]) / 2;
                if (A[i] - 1 > B[i + 1] - 1) {
        
                    if ((A[i] - 1) % 2 == 0) {
                        ans[i] += 1;
                    }
                    else {
                        ans[i + 1] += 1;
                     }
                }
                else {
                    if ((B[i + 1] - 1) % 2 == 0) {
                        ans[i + 1] += 1;
                    }
                    else {
                        ans[i] += 1;
                    }
                }
            }
        }
    }
    rep(i, N) {
        cout << ans[i] << " " ;
    }
    cout << endl;
    return 0;
}

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

edges = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)


def dfs(node, track):
    if len(track) == N:
        global res
        res += 1
    else:
        for dst in [x for x in edges[node] if x not in track]:
            dfs(dst, track + tuple([dst]))


res = 0
dfs(0, tuple([0]))
print(res)


Measured memory_bytes: 3064
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX 10000

int main()
{
    int n;
    scanf("%d", &n);
    int S[MAX];
    for (int i=0; i<n; i++) scanf("%d", &S[i]);
    int q;
    scanf("%d", &q);
    vector<int> T;
    for (int i=0; i<q; i++) {
        int x;
        scanf("%d", &x);
        T.push_back(x);
    }

    vector<int> M;
    for (int i=0; i<n; i++) {
        int s = S[i];
        for (int j=0; j<T.size(); j++) {
            vector<int>::iterator iter = find(M.begin(), M.end(), s);
            if (s == T[j] && iter == M.end()) {
                M.push_back(s);
            }
        }
    }
    printf("%lu\n", M.size());

    return 0;
}

Measured memory_bytes: 1096
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  vector<int> b(n);
  REP(i,n) cin >> b[i];
  
  vector<int> c(n);
  REP(i,n) cin >> c[i];
  
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());

  //2段目にbの小さい方からi番目を選ぶ組み合わせをd[i]とする
  //これは、b[i]の値よりも真に小さいaの要素の個数
  vector<int> d(n);
  REP(i,n) d[i] = lower_bound(a.begin(),a.end(),b[i]) - a.begin();

  //3段目にc[i]をおく組み合わせを計算
  //これは、bのc[i]よりも小さい要素の選び方の総和なので、累積和的に前計算できる
  //e[i]:bの小さい方からi個を取れるときの取り方
  vector<int> e(n+1,0);
  REP(i,n) e[i+1] = e[i]+d[i];

  //各c[i]について組み合わせを計算
  int ans = 0;
  REP(i,n) ans += e[lower_bound(b.begin(),b.end(),c[i])-b.begin()];

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4224
using System;
using System.Collections.Generic;

namespace AtTest.AGC026
{
    class C
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            string left = "";
            string right = "";

            for (int i = 0; i < n; i++)
            {
                left += s[i];
                right += s[2 * n - i - 1];
            }

            var patMapR = new Dictionary<string, Dictionary<string, long>>();
            int allPat = (int)Math.Pow(2, n);
            for (int i = 0; i < allPat; i++)
            {
                var strs = new string[2];
                strs[0] = "";
                strs[1] = "";
                for (int sI = 0; sI < n; sI++)
                {
                    if ((i >> sI & 1) == 1)
                    {
                        strs[0] += right[sI];
                    }
                    else
                    {
                        strs[1] += right[sI];
                    }
                }

                if (patMapR.ContainsKey(strs[0]))
                {
                    if (patMapR[strs[0]].ContainsKey(strs[1]))
                    {
                        patMapR[strs[0]][strs[1]]++;
                    }
                    else
                    {
                        patMapR[strs[0]].Add(strs[1], 1);
                    }
                }
                else
                {
                    patMapR.Add(strs[0], new Dictionary<string, long>());
                    patMapR[strs[0]].Add(strs[1], 1);
                }
            }

            long patterns = 0;
            for (int i = 0; i < allPat; i++)
            {
                var patL = new string[2];
                patL[0] = "";
                patL[1] = "";
                for (int sI = 0; sI < n; sI++)
                {
                    if ((i >> sI & 1) == 1)
                    {
                        patL[0] += left[sI];

                    }
                    else
                    {
                        patL[1] += left[sI];
                    }
                }
                if (patMapR.ContainsKey(patL[0])&&patMapR[patL[0]].ContainsKey(patL[1]))
                {
                    patterns += patMapR[patL[0]][patL[1]];
                }
            }

            Console.WriteLine(patterns);
        }
    }
}


Measured memory_bytes: 105248
#include <stdio.h>
int main(void)
{
    int Atm[9]={0},Btm[9]={0},Ctm[9]={0},i,j;
    for(i=0;i<6;i++)
        scanf("%d",&Atm[i]);
    for(i=0;i<6;i++)
        scanf("%d",&Btm[i]);
    for(i=0;i<6;i++)
        scanf("%d",&Ctm[i]);
    for(i=6;i<9;i++)
    {
        Atm[i]=Atm[i-3]-Atm[i-6];
        Btm[i]=Btm[i-3]-Btm[i-6];
        Ctm[i]=Ctm[i-3]-Ctm[i-6];
    }
    for(j=0;j<3;j++)
    {
        for(i=6;i<9;i++)
        {
            if(Atm[i]<0)
            {
                Atm[i-1]-=1;
                Atm[i]+=60;
            }
            if(Btm[i]<0)
            {
                Btm[i-1]-=1;
                Btm[i]+=60;
            }
            if(Ctm[i]<0)
            {
                Ctm[i-1]-=1;
                Ctm[i]+=60;
            }
        }
    }
    for(i=6;i<9;i++)
    {
        printf("%d",Atm[i]);
        if(i!=8)
            printf(" ");
        else
            printf("\n");
    }
    for(i=6;i<9;i++)
    {
        printf("%d",Btm[i]);
        if(i!=8)
            printf(" ");
        else
            printf("\n");
    }
    for(i=6;i<9;i++)
    {
        printf("%d",Ctm[i]);
        if(i!=8)
            printf(" ");
        else
            printf("\n");
    }
    return 0;
}

Measured memory_bytes: 600
N = int(input())
s_lst = [input() for i in range(N)]
M = int(input())
t_lst = [input() for i in range(M)]

dict = {}
for i in s_lst:
    if not i in dict.keys():
        dict[i] = 1
    else:
        dict[i] += 1
for i in t_lst:
    if not i in dict.keys():
        dict[i] = -1
    else:
        dict[i] -= 1

infinity = float('inf')
max = -infinity
for i in dict.values():
    if max < i:
        max = i
print(max) if max > 0 else print(0)


Measured memory_bytes: 3064
#include <cstdio>
    #include <cmath>
    #include <cstdlib>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
     
    using namespace std;
    typedef long long ll;
    ll a[1000010];
    ll b[1000010];
    ll c[1000010];
    int main()
    {
    	ll n, i;
    	while(~scanf("%lld", &n))
    	{
    		memset(a, 0, sizeof(a));
    		memset(b, 0, sizeof(b));
			ll k = 0;
    			for(i = 1; i <= n; i++)
    			{
    				//cin >> a[i];
    				scanf("%lld", &a[i]);
    				if(a[i] > n)
    					k++;
    				else
						b[a[i]]++;
    			}
    		/*	ll m = a[1];
    			for(i = 2; i <= n; i++)
    			{
    				if(a[i] >= m)
    					m = a[i];
    			}*/
    		//	ll k = 0;
    			for( i = 1; i <= n; i++)
    			{
    				if(b[i] != 0)
    				{
    					if(b[i] < i)
    						k = k + b[i];
    					else if(b[i] > i)
    						k = k + b[i] - i;
    				}
    			}
    			printf("%lld\n", k);
    		//}
    	}
    }

Measured memory_bytes: 17536
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <math.h>
#include <vector>
#include <queue>
using namespace std;
#define mod 1000000007
#define INF 0x7fffffffff
#define N 100100
#define endl '\n'
char a[]={"CODEFESTIVAL2016"};
char b[200000];
int main()
{
    int n,A,B;
    scanf("%d%d%d",&n,&A,&B);
    scanf("%s",b);
    int ans=0,sum=0;
    for(int i=0;i<n;i++)
    {
        if(b[i]=='c') cout<<"No"<<endl;
        else if(b[i]=='a')
        {
            if(ans<A+B) ans++,cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
        else
        {
            if(ans<A+B&&sum<B) ans++,sum++,cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
    }
    return 0;
}


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

using namespace std;

#define ll long long

const int N=1e6+5,MOD=1e9+7;

int n,freq[N],a[N],k,tc,x,m,l,r,sum,u,v;

ll ans;

char s[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(int i=0;i<n;i++){
        ll curr=0;
        ll l=0,r=0;
        for(int j=0;j<n;j++){
            if (a[i]>a[j]){
                if (j>i)
                    r++;
                else
                    l++;
            }
        }
        ll p=((ll)k*(k+1))/2 % MOD;
        r=(r * p) % MOD;
        p=((ll)k*(k-1)/2)%MOD;
        l=(l * p)%MOD;
        ans=(ans+l+r)%MOD;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
import math
n,k = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse = True)
e = [0]*n
for i in range(n):#時間をとりあえず計算
    e[i] = A[i]*F[i]
    
def s(e,x):
    kk=0
    for i in range(n):
        if e[i] < x:
            continue
        else:
            kk += math.ceil((e[i]-x)/F[i]) #xになるような値をkkに足す
    if kk > k:#kkの値がkを超えるとそのxを最小にはできない
        return False
    else:
        return True

#最適なxを二分探索する
sma = 0
big = A[-1]*F[0]

while big != sma:
    mid = (big+sma)//2
    if s(e,mid):#midはできる
        big = mid
    else:#midでできない＝それより大きくないとダメ
        sma = mid + 1
print(sma)

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)


int main() {
	int n;
	cin >> n;
	ll h;
	cin >> h;
	int cnt = 0;
	int mcnt = 0;
	FOR(i, 2, n) {
		ll temp;
		cin >> temp;
		if (h < temp) {
			mcnt = max(mcnt, cnt);
			cnt = 0;
		}
		else {
			cnt++;
		}
		h = temp;
	}
	mcnt = max(mcnt, cnt);
	pv(mcnt);
	return(0);
}

Measured memory_bytes: 256