akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main()
{
	int S, h,m,s;
	cin >> S;
	h = S / 60 / 60;
	m = (S - h * 60 * 60) / 60;
	s = (S - h * 60 * 60) % 60;;
	cout << h << ":" << m << ":" << s << endl;

}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}


inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}


int main()
{
    ///freopen("output.txt","w",stdout);
  // freopen("input.txt","r",stdin);
    FastIO;

    int n,k;

    while(cin>>n){
        lli a[n+1] , dp[n+1][2];

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


        dp[1][0] = a[1]/2;

        if(a[1]%2) dp[1][1] = a[1]/2;

        for(int i=2; i<=n; i++){

            dp[i][0] = dp[i-1][0] + a[i]/2;
            if(a[i]%2 && dp[i-1][1]) dp[i][0] = max(dp[i][0], dp[i-1][1] + a[i]/2 + 1);


            if(a[i]==0) continue;

            if(a[i]%2) dp[i][1] = max(dp[i-1][0],dp[i-1][1]) + a[i]/2;
            else{
                if(dp[i-1][1]) dp[i][1] = dp[i-1][1] + (a[i]-1)/2 + 1;
            }


        }

        cout<<max(dp[n][1],dp[n][0])<<endl;
    }

    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


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

typedef long long ll;

#define MAX 100005
#define forl(i, start, stop, step) for (int i = start; i < stop; i += step)
#define vi vector<int>
#define pb push_back

vi g1[MAX], g2[MAX];
int visited1[MAX], visited2[MAX], ans1[MAX], ans2[MAX];

int dfs1(int u) {
	visited1[u] = 1;
	int ret = 0;
	for (int v : g1[u]) {
		if (!visited1[v]) ret = max(ret, dfs1(v));
		else ret = max(ret, ans1[v]);
	}
	return ans1[u] = ++ret;
}

int dfs2(int u) {
	visited2[u] = 1;
	int ret = 0;
	for (int v : g2[u]) {
		if (!visited2[v]) ret = max(ret, dfs2(v));
		else ret = max(ret, ans2[v]);
	}
	return ans2[u] = ++ret;
}

int main() {
	int n, m, u, v; scanf("%d%d", &n, &m);
	forl(i, 0, m, 1) {
		scanf("%d%d", &u, &v);
		g1[u].pb(v);
		g2[v].pb(u);
	}
	int ans = 0;
	forl(i, 1, n + 1, 1) {
		if (!visited1[i]) ans = max(ans, dfs1(i));
	}
	forl(i, 1, n + 1, 1) {
		if (!visited2[i]) ans = max(ans, dfs2(i));
	}
	--ans; ans = max(ans, 0);

	cout << ans;

	return 0;
}

Measured memory_bytes: 17280
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
//ios::sync_with_stdio(false);
//<< setprecision(5)
const int mod=1000000007;
const long double big=1e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	ios::sync_with_stdio(false);
	string str;cin>>str;
	cout<<str.substr(0,str.size()-8)<<endl;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    for(int i = 0; i < n; i++) cin >> d[i];
    int ans = 0;
    for(int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
//typedef long long ll;
//typedef pair<ll, ll> l_l;
//typedef pair<int, int> i_i;
int main(){
  int n;
  vector <int> l;
  cin>>n;
  for (int i=0; i<n; i++){
    int lnow;
    cin>>lnow;
    l.emplace_back(lnow);
  }
  sort (l.begin(),l.end());
  int ans=0;

 //<<l[1]<<endl<<l[2]<<endl<<l[3]<<endl;
  for (int i=0; i<n-2; i++){
    for (int j=i+1; j<n-1; j++){

      auto temp=lower_bound(l.begin(),l.end(),(l[i]+l[j]))-l.begin();


      ans+=temp-j-1;

    }
}
cout<<ans;
}


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

int main(){

  ll x;
  cin>>x;
  
  ll mon=100;

  ll count=0;
  while(1){

    mon=mon*1.01;
    count++;
    if(mon>=x)break;
    
  }
	
  cout<<count<<endl;

}

Measured memory_bytes: 3600
import java.io.*;
import java.util.*;
class Main {
  public static void main(String... args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    while(s != null) {
      String[] arr = s.split(",");
      int[] ls = new int[10];
      int sum = 0;
      for(int i=0; i<ls.length; i++) {
        ls[i] = Integer.parseInt(arr[i]);
        sum += ls[i];
      }
      int v1 = Integer.parseInt(arr[10]);
      int v2 = Integer.parseInt(arr[11]);
      double point = (double)sum*v1/(v1+v2);
      for(int i=0; i<ls.length; i++) {
        point -= ls[i];
        if(point <= 0) {
          System.out.println(i+1);
          break;
        }
      }
      s = br.readLine();
    }
  }
}

Measured memory_bytes: 16908
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastt ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main()
{
	fastt

	ll n;
	cin>>n;
	ll ar[n+10],br[n+10];
	memset(ar,0,sizeof(ar));
	memset(br,0,sizeof(br));
	for(ll i=1;i<=n;i++){
		cin>>ar[i];
		br[i]=ar[i];
	}
	for(ll i=1;i<=n;i++){
		ar[i]+=ar[i-1];
	}
	ll ans=0;
	for(ll i=1;i<n;i++){
		ll sum=ar[n]-ar[i];
		ll cnt=((sum%mod)*(br[i]%mod))%mod;
		ans=(ans+cnt)%mod;
	}
	cout<<ans<<endl;
		
	return 0;
}



Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  bool flag = true;
  scanf("%d %d", &n, &k);
  int d[k];
  for(int i = 0; i < n; i++) scanf("%d", &d[i]);
  while(flag) {
    flag = false;
    string str = to_string(n);
    for(int i = 0; i < k; i++) {
      for(int j = 0; j < str.size(); j++) {
        string tmp = to_string(d[i]);
        if(str.at(j) == tmp.at(0)) {
          flag = true;
          break;
        }
      }
      if(flag) break;
    }
    if(flag) n++;
  }
  printf("%d\n", n);
}

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

public class Main{
	private static void solve(int n_can,int n_stn) {
    	int[] can_stn= new int[n_can];
    	
    	int tmp=0;
    	int n_cup= n_stn;
		while(true){
			if( n_cup==0 ){
				n_cup= can_stn[tmp];
				can_stn[tmp]= 0;
				tmp= (tmp+1)% n_can;
			} else{
				int div = n_cup / n_can;
				int rem = n_cup % n_can;
				for (int i = 0; i < n_can; i++) {
					can_stn[i] += div;
				}
				for (int i = 0; i < rem; i++) {
					can_stn[tmp] += 1;
					tmp= (tmp+1)% n_can;
				} 
				tmp= (tmp-1+n_can)% n_can;
				if( can_stn[tmp]==n_stn ){
					System.out.println(tmp);
					break;
				}
				n_cup= 0;
				tmp= (tmp+1)% n_can;
			}
		}
	}
	
    public static void main(String args[]) throws Exception{
    	Scanner sc= new Scanner(System.in);
    	int n_can,n_stn;
    	while(true){
    		n_can= sc.nextInt();
    		n_stn= sc.nextInt();
    		if( n_can!=0 || n_stn!=0 ){
    			solve(n_can,n_stn);
    		} else{ break; }
    	}
    }
}

Measured memory_bytes: 20296
#ABC062 A - Grouping
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
x,y = map(int, input().split())
g1 = (1,3,5,7,8,10,12)
g2 = (4,6,9,11)

if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    long long int a,b,c,d,e,n;
     while(scanf("%lld%lld%lld%lld",&a,&b,&c,&d)==4)
     {
         scanf("%lld",&n);
         a=a*8;
         b=b*4;
         c=c*2;
         d=d;
         e=min(a,min(b,min(c,d)));
         if(n%2==0)
         {
             printf("%lld\n",e*n/2);
             continue;
         }
         if(n%2==1)
         {
             printf("%lld\n",e*(n-1)/2+min(a/2,min(b/2,c/2)));
         }

     }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int max = Integer.MIN_VALUE;

			if (max < a + b) {
				max = a + b;
			}
			if (max < a - b) {
				max = a - b;
			}
			if (max < a * b) {
				max = a * b;
			}
			System.out.println(max);
		}
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  string s;
  ll w;
  cin >> s >> w;
  for(ll i=0;i<s.size();i+=w) {
    cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
	int n, a[100000], ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int j = 1; j < n; j++) {
		if (a[j] <= a[j - 1]) {
			ans++;
		}
	}
	cout << ans + 1 << endl << n << endl;
	return 0;
}


Measured memory_bytes: 3496
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

ans = 0
for i in range(m):
    UF = UnionFind(n)
    for j in range(m):
        if i == j:
            continue
        UF.union(ab[j][0] - 1, ab[j][1] - 1)
    if UF.size(0) != n:
        ans += 1
print(ans)

Measured memory_bytes: 73340
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = list("x" * K + input())

win = {"r":P,"s":R,"p":S,"x":0}

ans = 0
for i in range(len(T)):
  if T[i] == T[i - K]:
    T[i] = "x"
  else:
    ans += win[T[i]]

print(ans)

Measured memory_bytes: 10520
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr =sc.nextLine().toCharArray();
		sc.close();

		int count = 0;
		for(char c: arr) {
			count += c == '+' ? +1 : -1;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h, w;
  cin >> h >> w;
  string s[50];
  for(int i=0;i<h;i++)
    cin >> s[i];
  
  int buff[52][52];
  for(int i=0;i<52;i++)
    for(int j=0;j<52;j++)
      buff[i][j]=0;
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(s[i][j] == '#'){
        //buffの[i][j]から[i+2][j+2]までインクリメント
        for(int x=0;x<3;x++){
          for(int y=0;y<3;y++){
            buff[i+x][j+y]++;
          }
        }
      }
    }
  }
  //output
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(s[i][j] == '#')
        cout << '#';
      else
        cout << buff[i+1][j+1];
    }
    cout << endl;
  }
}


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

int main() {
  int64 A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  A *= 100;
  B *= 100;
  int64 max_amount = 0, max_sugar = 0;
  for (int64 a = 0; a <= F / A; ++a) {
    for (int64 b = 0; b <= (F - a * A) / B; ++b) {
      int64 water = a * A + b * B;
      int64 sugar_limit = min(water * E / 100, F - water);
      for (int64 c = 0; c <= sugar_limit / C; ++c) {
        int64 d = (sugar_limit - c * C) / D;
        int64 sugar = c * C + d * D;
        int64 amount = sugar + water;
        if (max_amount == 0 || max_sugar * amount < max_amount * sugar) {
          max_sugar = sugar;
          max_amount = amount;
        }
      }
    }
  }
  cout << max_amount << " " << max_sugar << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a , b , c , x , y ;
	cin >> a >> b >> c ;
	1 <= a , b , c <= 10000 ;
	a <= b ;
	y = 0 ;
	for ( x = a ; x <= b ; x += 1 )
	if ( c % x == 0 )
		y += 1 ;
		cout << y << endl;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <cmath>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

int k;

#define MAXN 20

int ten[MAXN];

ll getnum(vector<int> v) {
	ll ret = 0;
	for (int i = (int)v.size() - 1; i >= 0; i--) {
		ret *= 10;
		ret += v[i];
	}
	return ret;
}

ll getnext(ll num) {
	num++;
	while (true) {
		vector<int> v;
		ll tnum = num;
		while (tnum) {
			v.push_back(tnum % 10);
			tnum /= 10;
		}
		int n = v.size();
		bool ok = true;
		for (int i = n - 1; i > 0; i--) {
			if (abs(v[i] - v[i - 1]) <= 1) {
				continue;
			}
			ok = false;
			num += ten[i - 1];
			break;
		}
		if (ok) {
			return getnum(v);
		}
	}
}

int main() {
	int curt = 1;
	for (int i = 0; i < MAXN; i++) {
		ten[i] = curt;
		curt *= 10;
	}


	cin >> k;
	ll cur = 1;
	int pos = 0;
	while (true) {
		pos++;
		if (pos == k) {
			cout << cur << endl;
			return 0;
		}
		//cout << cur << endl;
		cur = getnext(cur);
	}
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const ll maxn = 3234566670;
int k;
vector<ll> v;
void bfs(int num) 
{ 
    queue<ll> q; 
    q.push(num); 
    while (!q.empty()) 
    { 
        ll stepNum = q.front(); 
        q.pop(); 
        if(stepNum >= 0 && stepNum <= maxn){
        	v.pb(stepNum);
		} 
        if(num == 0 || stepNum > maxn) continue; 
        ll lastDigit = stepNum % 10; 
        ll stepNumA = stepNum * 10 + (lastDigit- 1); 
        ll stepNumB = stepNum * 10 + (lastDigit + 1); 
        ll stepNumC = stepNum * 10 + lastDigit;
        if (lastDigit == 0) q.push(stepNumB), q.push(stepNumC); 
        else if (lastDigit == 9) 
            q.push(stepNumA), q.push(stepNumC); 
            
        else{ 
            q.push(stepNumA); 
            q.push(stepNumB); 
       		 q.push(stepNumC); 
        } 
    } 
}
int main()
{
	cin >> k;
	for (int i = 0 ; i <= 9 ; i++)bfs(i); 
	sort(v.begin(), v.end());
	cout << v[k] << endl;
	return 0;
}

Measured memory_bytes: 1636
#include<bits/stdc++.h>
#define reg register
#define inf 99824435300000000
#define int long long
using namespace std;
inline int  read() {
    reg int s = 0, t = 0; reg char ch = getchar();
    while(ch > '9' || ch < '0') t |= ch == '-', ch = getchar();
    while(ch >= '0' && ch <= '9') s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}
int n, a[111];
int solve(int l, int r, int x, int y){
	int ans = inf; if(l + 1 == r) return 0;
	for(int i = l + 1; i < r; i++){
		int sum = (x + y) * a[i] + solve(l, i, x, x + y) + solve(i, r, x + y, y);
		ans = min(ans, sum);
	}	
	return ans;
}
signed main()
{
	n = read(); 
	for(int i = 1; i <= n; i++) a[i] = read();
	cout << solve(1, n, 1, 1) + a[1] + a[n];
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

void solve()
{
	int M, N;
	cin >> M >> N;
	int max = 0;
	for(int i = 0; i < M; ++i)
	{
		int count = 0;
		for(int j = 0; j < N; ++j)
		{
			int a;
			cin >> a;
			if(a == 1)
			{
				++count;
			}
		}
		if(count > max)
		{
			max = count;
		}
	}
	cout << max << endl;
}

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

Measured memory_bytes: 1164
#include<stdio.h>
int main(){
  int m,f,r;

  for(;;){
    scanf("%d%d%d",&m,&f,&r);
    if(m == -1 && f == -1 && r == -1){
      break;
    }
    if(m + f < 30 || m == -1 || f == -1){
      printf("F");
    }else if(m + f >= 80){
      printf("A");
    }else if(m + f >= 65 && m + f < 80){
      printf("B");
    }else if(m + f >= 50 && m + f < 65){
     printf("C");
    }else if(m + f >= 30 && m + f < 50){
      if(r >= 50){
	printf("C");
      }else{
	printf("D");
      }
    }
    printf("\n");
  
  }
  
  return 0;
}
    
    

Measured memory_bytes: 572
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int k, n;
	cin >> n >> k;;
	vi v(n);
	for(int i = 0; i < n; i++)
	cin >> v[i];
	int ans = 0;
	sort(all(v));
	for(int i = 0; i < k; i++)
	ans += v[i];
	cout << ans << endl;			
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>

using namespace std;

int main(void) {
    string S;
    cin >> S;
    //cout << S;

    string c12;
    c12[0] = S[0];
    c12[1] = S[1];
    int i12 = stoi(c12);

    string c34;
    c34[0] = S[2];
    c34[1] = S[3];
    int i34 = stoi(c34);

    if (1 <= i12 && i12 <= 12) {
        if (1 <= i34 && i34 <= 12) {
            cout << "AMBIGUOUS" << "\n";
        } else {
            cout << "MMYY" << "\n";
        }
    } else {
        if (1 <= i34 && i34 <= 12) {
            cout << "YYMM" << "\n";
        } else {
            cout << "NA" << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
main(){
	int a,b=0,c=0;for(int i=0;i<3;i++){cin>>a;if(a==5)b++;else if(a==7)c++;}
	if(b==2&&c==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
n=input()

hon = ['2', '4', '5', '7', '9']
pon = ['0', '1', '6', '8']
bon = ['3']


if n[-1] in hon:
    print('hon')
elif n[-1] in pon:
    print('pon')
elif n[-1] in bon:
    print('bon')


Measured memory_bytes: 9108
#include <stdio.h>
int main(void){
    int W, H, x, y, r;
    scanf("%d",&W);
    scanf("%d",&H);
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&r);
    if(x - r>=0 && x + r <=W){
        if(y - r>=0 && y + r <=H) {
        printf("Yes\n");
        }
        else{
        printf("No\n");
        }
    }
    else{
        printf("No\n");
    }
   return 0;  
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#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 bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, 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 pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

signed main(){
    int N; cin>>N;
  vec A(N); REP(i,N) cin>>A[i];
  int ans = 0;
  REP(i,N){
    ans += A[i];
    ans --;
  }
  Out(ans);
}




Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int N = Integer.parseInt(sc.next());
        int D = Integer.parseInt(sc.next());
        int X = Integer.parseInt(sc.next());
        
        int ans = 0;
        for(int i=0; i<N; i++){
            int A = Integer.parseInt(sc.next());
            int day = 1;
            
            do{
                ans++;
                day += A;
            }while(day <= D);
        }
        
        System.out.println(ans + X);
    }
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, d;
    cin >> n >> d;
    vector<vi> x(n, vi(d));
    rep(i, n) rep(j, d) cin >> x[i][j];
    int ans = 0;
    rep(i, n) rep(j, i) {
        int sq = 0;
        rep(k, d) {
            int s1 = x[i][k] - x[j][k];
            sq += s1 * s1;
        }
        for (int k=1; k*k<=16000; ++k) {
            if (sq == k * k) ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n, h, w = map(int, input().split())
a_list = []
b_list = []

for i in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
count = 0
for i in range(n):
    a = a_list[i]
    b = b_list[i]

    if a >= h and b >= w:
        count += 1
print(count)



Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int n,i;
	int a[3];
	scanf("%d",&n);
	for(i=0;i<n;i++){
	scanf("%d %d %d",&a[0],&a[1],&a[2]);
		if(a[0]*a[0]==a[1]*a[1]+a[2]*a[2] || a[1]*a[1]==a[0]*a[0]+a[2]*a[2] || a[2]*a[2]==a[0]*a[0]+a[1]*a[1]){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1008
#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {
    cout << 1;
  } else if (a != b && b != c && c != a) {
    cout << 3;
  } else {
    cout << 2;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3160
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

//lli gcd(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    if(x%y==0){
//        return y;
//    }
//    else{
//        return gcd(y,x%y);
//    }
//}
//
//lli lcm(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    return x*y/gcd(x,y);
//}

int main(){
    lli k,a,b,ans;
    cin>>k>>a>>b;
    if((b-a<=2)||(k<a)){
        ans=k+1;
    }
    else{
        k=k-a+1;
        lli def=b-a;
        ans=a;
        ans+=def*(k/2);
        if(k%2==1){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val ss = readLine()!!.split(" ")[0]
    val s = ss.toCharArray()
    val sLen = s.size
    val rlArray = Array(sLen) { 0 }
    val roopArray = Array(sLen) { sLen+1 }.toMutableList()
    for (i in 0 until sLen) {
        if (s[i] == 'R') {
            if (s[i + 1] == 'L') {
                rlArray[i] = 1
                rlArray[i + 1] = 1
                roopArray[i] = i
            }
        }
    }
    roopArray.removeAll { it == sLen+1 }
    for (i in 0 until sLen) {
        if (rlArray[i] == 0) {
            if (s[i] == 'R') {
                val x = myBinary(i, roopArray)
                if ((x - i) % 2 == 0){
                    rlArray[x]++
                } else {
                    rlArray[x + 1]++
                }
            } else {
                val x = myBinaryLeft(i, roopArray)
                if ((i - x) % 2 == 0){
                    rlArray[x]++
                } else {
                    rlArray[x + 1]++
                }
            }
        }
    }
    for (i in 0 until sLen){
        print(" ${rlArray[i]}")
    }
}

fun myBinary(key: Int, useList: MutableList<Int>): Int {
    val indexSize = useList.size
    var right = indexSize - 1
    var left = 0
    var mid = (right + left) / 2
    var a = right - left
    var flag = 0
    if (key < useList[left]) flag = 1
    if (indexSize == 2 && key < useList[left]) right = left


    while (a > 1){
        if (flag == 1){
            right = left
            break
        } else if (key >= useList[mid]) {
            left = mid
        } else {
            right = mid
        }
        a = right - left
        mid = (right + left) / 2
    }
    return useList[right]
}

fun myBinaryLeft(key: Int, useList: MutableList<Int>): Int {
    val indexSize = useList.size
    var right = indexSize - 1
    var left = 0
    var mid = (right + left) / 2
    var a = right - left
    var flag = 0
    if (key > useList[right]) flag = 1
    if (indexSize == 2 && key > useList[right]) left = right

    while (a > 1){
        if (flag == 1){
            left = right
            break
        } else if (key >= useList[mid]) {
            left = mid
        } else {
            right = mid
        }
        a = right - left
        mid = (right + left) / 2
    }
    return useList[left]
}

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


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

#define ketasitei setprecision(15) //15桁表示



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

	ll n;
	cin >> n;
	vector<ll> p(n), q(n), x(n);
	rep(i, n)
	{
		x[i] = i + 1;
		cin >> p[i];
	}
	rep(i, n)
	{
		cin >> q[i];
	}

	ll a = -1, b = -1;
	for (int i = 0; i < 100000; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (p[j] == x[j])
			{
				if (j == n - 1)
					a = i;
			}
			else break;
		}
		for (int j = 0; j < n; j++)
		{
			if (q[j] == x[j])
			{
				if (j == n - 1)
					b = i;
			}
			else break;
		}
		if (a != -1 && b != -1)
			break;

		next_permutation(x.begin(), x.end());
	}
	cout << abs(a - b) << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	string A, B; cin >> A >> B;
	int ans = 0;
	F0R(i, sz(A)) if (A[i] == B[i]) ans++;
	cout << ans << endl;
	
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();		//数字列
		
		ArrayList<Integer>a= new ArrayList<>();
		
		for(int i=0;i<n;i++) {
			a.add(sc.nextInt());
		}
		ArrayList<Integer>b=new ArrayList<>(a);
		Collections.sort(b,Collections.reverseOrder());
		int max=Collections.max(b);
		
		for(int i=0;i<n;i++) {
			if(max==a.get(i)) {
				System.out.println(b.get(1));
			}else {
				System.out.println(max);
			}
		}
		sc.close();
	}
}


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

int main(void) {
  int L, R = 0;
  
  cin >> L >> R;
  
  int i, j = 0;

  int L_ = L % 2019;
  int R_ = R % 2019;
  int L__ = L / 2019;
  int R__ = R / 2019;
  
  if(L_ == 0 || R_ == 0)
  {
    cout << 0 << endl;
    return 0;
  }  
  
  int m_ = 2018;
  int R___ = R_;
  if(R__ - L__ > 0) R___ = R_ + 2019;
  for(i=L_;i<=R___-1;i++) {
   for(j=L_+1;j<=R___;j++) {
     m_ = min(m_, (i*j) % 2019);  
   }
  }
  
  cout << m_ << endl;
  
  return 0; 
}

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

int main() {
  int n; cin >> n;
  vector<string> blue_words(n);
  for (int i = 0; i < n; i++) {
    cin >> blue_words.at(i);
  }
  
  int m; cin >> m;
  vector<string> red_words(m);
  for (int i = 0; i < m; i++) {
    cin >> red_words.at(i);
  }
  
  int max_point = 0;
  for (int i = 0; i < blue_words.size(); i++) {
    string keyword = blue_words.at(i);
    int point = 0;
    for (int j = 0; j < blue_words.size(); j++) {
      point += (blue_words.at(j) == keyword);
    }
    for (int j = 0; j < red_words.size(); j++) {
      point -= (red_words.at(j) == keyword);
    }
    
    if (point > max_point) {
      max_point = point;
    }
  }
  
  cout << max_point << endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#define md double
#define LL long long
using namespace std;
const int N=1<<20|1;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
inline LL gL() {
	LL w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
LL e[N],sum[N],tag[N],now[N];
int dep[N];
int main()
{
	int n=gi(),Q=gi(),i,k,t,ed,siz,L,R,l,r,H=1,mid;LL q,suf,to;
	for (siz=1;siz<n+1;siz=siz<<1|1) H++;
	for (dep[1]=H,i=2;i<=(siz<<1|1);i++) dep[i]=dep[i>>1]-1;
	e[siz+1]=3e13;
#define lc (k<<1)
#define rc (lc|1)
#define pushdown tag[lc]=tag[rc]=e[lc]=e[rc]=tag[k],sum[lc]=sum[rc]=tag[k]<<dep[lc],tag[k]=0
#define update e[k]=e[rc],sum[k]=sum[lc]+sum[rc]
#define modify(k,to) tag[k]=e[k]=(to),sum[k]=(to)<<dep[k]
	while (Q--) {
		L=siz+1,R=siz+(ed=gi()+1)+1;q=gL();
		for (i=H;i;i--) {
			if (tag[k=L>>i]) pushdown;
			if ((R>>i)!=k&&tag[k=R>>i]) pushdown;
		}
		for (l=L,now[r=R]=0;l^r^1;l>>=1,r>>=1) {
			if (~l&1) now[l^1]=sum[l^1],now[l>>1]=now[l]+now[l^1]; else now[l>>1]=now[l];
			if (r&1) now[r^1]=sum[r^1],now[r>>1]=now[r^1]+now[r]; else now[r>>1]=now[r];
		}
		now[l>>1]=now[l]+now[r];
		for (k=l;(k>>=1)>1;) now[k>>1]=now[k];
		suf=0;
		for (k=l>>1,l=1,r=1<<dep[k];k<=siz;) {
			if (tag[k]) pushdown;
			if (ed<=(mid=(l+r)>>1)) k<<=1,r=mid;
			else k=k<<1|(mid=(l+r)>>1,q<=e[lc]*(ed-mid)-(r<=ed?sum[rc]:now[rc])-suf?(l=mid+1,1):(suf+=r<=ed?sum[rc]:now[rc],r=mid,0));
		}
		suf+=sum[k];
		to=(q-(e[i]*(ed-l+1)-suf))/(ed-l+1);
		q-=to*(ed-l+1)-suf;t=--k;
		l=k,r=t+q+1;
		for (i=H;i;i--) {
			if (tag[k=l>>i]) pushdown;
			if ((r>>i)!=k&&tag[k=r>>i]) pushdown;
		}
		for (;l^r^1;) {
			if (~l&1) modify(l^1,to+1);
			if (r&1) modify(r^1,to+1);
			k=l>>=1;update;
			k=r>>=1;update;
		}
		while (k=(l>>=1)) update;
		l=t+q,r=siz+ed+1;
		for (i=H;i;i--) {
			if (tag[k=l>>i]) pushdown;
			if ((r>>i)!=k&&tag[k=r>>i]) pushdown;
		}
		for (;l^r^1;) {
			if (~l&1) modify(l^1,to);
			if (r&1) modify(r^1,to);
			k=l>>=1;update;
			k=r>>=1;update;
		}
		while (k=(l>>=1)) update;
	}
	for (k=1;k<=siz;k++) if (tag[k]) pushdown;
	for (k=1;k<=n;k++) printf("%lld\n",e[k+siz+1]);
	return 0;
}


Measured memory_bytes: 10880
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		int count=0;
		
		for(int i=1;i<=a;i++) {
			for(int k=1;k<=b;k++) {
				
				int x=k%10;
				int y=(k-x)/10;
				
						
				if(x>=2 && y>=2 && x*y==i) {
					count++;
				}	
				
			}
			
		}
		
		
		System.out.println(count);
		


		
		
		

	}

}


Measured memory_bytes: 35652
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;

namespace AOJ
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }


        //15.3 関節点(Articlulation Point)
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var VE = Sarray();
            var V = VE[0];
            var E = VE[1];
            var G = new List<long>[V];
            for (var i = 0; i < V; ++i) G[i] = new List<long>();
            for (var i = 0; i < E; ++i)
            {
                var st = Sarray();
                G[st[0]].Add(st[1]);
                G[st[1]].Add(st[0]);
            }
            art_points(G);
        }
        public static void art_points(List<long>[] g)
        {
            var n = g.Length;
            var visited = new bool[n];
            var prenum = new int[n];
            var lowest = new int[n];
            var parent = new int[n];
            Action<int, int> dfs = null;
            int timer = 0;
            dfs = (current, prev) =>
              {
                  prenum[current] = lowest[current] = timer;
                  ++timer;
                  visited[current] = true;
                  foreach (var next in g[current])
                  {
                      if (!visited[next])
                      {
                          parent[next] = current;
                          dfs((int)next, current);
                          lowest[current] = Math.Min(lowest[current], lowest[next]);
                      }
                      else if (next != prev)
                      {
                          lowest[current] = Math.Min(lowest[current], prenum[next]);
                      }
                  }
              };
            dfs(0, -1);
            int np = 0;
            var ans = new HashSet<int>();
            for (int i = 1; i < n; ++i)
            {
                var p = parent[i];
                if (p == 0)
                    ++np;
                else if (prenum[p] <= lowest[i])
                    ans.Add(p);
            }
            if (1 < np) ans.Add(0);
            var ansl = ans.ToList();
            ansl.Sort();
            foreach (var a in ansl)
                WriteLine(a);
        }
    }
}


Measured memory_bytes: 24796
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int N = 210;
int n, vis[N], ans = 0, mx;
vector<int> e[N];
char s[N];

template<typename T> void gi(T &x) {
	x = 0; register char c = getchar(), pre = 0;
	for(; c < '0' || c > '9'; pre = c, c = getchar());
	for(; c >= '0' && c <= '9'; c = getchar()) x = x * 10ll + (c ^ 48);
	if(pre == '-') x = -x;
}
void dfs(int u, int ff) {
	vis[u] = vis[ff] + 1; for(auto v : e[u]) if(!vis[v]) dfs(v, u);
}
bool check() {
	dfs(1, 0);
	rep(i, 1, n) for(auto v : e[i]) if(abs(vis[v] - vis[i]) % 2 == 0) return 1;
	return 0;
}
void bfs(int u) {
	vis[u] = 1; queue<int> q; q.push(u);
	for(; !q.empty();) {
		u = q.front(), q.pop(), mx = max(mx, vis[u]);
		for(auto v : e[u]) if(!vis[v]) vis[v] = vis[u] + 1, q.push(v);
	}
}
int main() {
	gi(n);
	rep(i, 1, n) {
		scanf("%s", s + 1);
		rep(j, 1, n) if(s[j] == '1') e[i].pb(j);
	}
	if(check()) { puts("-1"); return 0; }
	rep(i, 1, n) {
		rep(j, 1, n) vis[j] = 0; mx = 0;
		bfs(i), ans = max(ans, mx);
//		printf(">>> %d : %d\n", i, mx);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<queue>
#define x first
#define y second
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int h,w,k;
pair<int,int> p[12];
bool t[1010][1010],vis[1010][1010];
queue<pair<int,pair<int,int> > >Q;
int main(){
	cin>>h>>w>>k;
	rep(i,0,h)rep(j,0,w){
		t[i][j]=true;
		char z;cin>>z;
		if(z=='X')t[i][j]=0;
		if(z=='S')p[0]=make_pair(i,j);
		if(z>'0'&&z<='9')p[z-'0']=make_pair(i,j);
	}
	int a=0;
	rep(r,0,k){
		Q.push(make_pair(0,p[r]));
		rep(i,0,h)rep(j,0,w)vis[i][j]=0;vis[p[r].x][p[r].y]=1;
		while(1){
			int L=Q.front().x,Y=Q.front().y.x,X=Q.front().y.y;
			if(Y==p[r+1].x&&X==p[r+1].y){
				a+=L;
				break;
			}
			int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
			rep(i,0,4){
				int f=Y+dy[i],g=X+dx[i];
				if(f>=0&&f<h&&g>=0&&g<w){
					if(t[f][g]==1&&vis[f][g]==0){
						vis[f][g]=1;
						Q.push(make_pair(L+1,make_pair(f,g)));
					}
				}
			}
			Q.pop();
		}
		while(!Q.empty())Q.pop();
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 4968
from sys import stdin


def main():
    M, D = [int(x) for x in stdin.readline().rstrip().split()]

    sum = 0

    for d in range(11, D+1):
        d_10, d_1 = str(d)

        if int(d_10) > 1 and int(d_1) > 1:
            if M >= int(d_10) * int(d_1):
                sum += 1

    print(sum)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M, X = list(map(int, sys.stdin.readline().split()))
    LINES = list(map(int, sys.stdin.readline().split()))
    s = [i for i in LINES if i > 0 and i < X]
    l = [i for i in LINES if i > X and i < N + 1]
    print(min(len(s), len(l)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    if(S=="ABC"):
        print("ARC")
    else:
        print("ABC")
if __name__ == '__main__':
    main()

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int n,x,p=0;
    cin >> n >> x;
    vector<int>sq(n);
    rep(i, n)cin >> sq[i];
    vector<int>point;
    point.push_back(0);
    for (int i = 0; i < n; i++) {
        p = point[i] + sq[i];
        if (p <= x)point.push_back(p);
        else break;

    }
    cout << point.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll dp[1000001]={0},coin[101]={0};
int main()
{
    fast;
    ll n;
    cin>>n;
    ll h[100001]={0},s=INT_MAX,i,j;
    for(i=0;i<n;i++)
    {
        cin>>h[i];
    }
    dp[0]=0;
    for(i=1;i<n;i++)
    {
        dp[i]=INT_MAX;
        for(j=1;j<=2;j++)
        {
            if((i-j)>=0)
            {
                s=abs(h[i]-h[i-j]);
                dp[i]=min(dp[i],dp[i-j]+s);
            }
        }
        //cout<<dp[i]<<endl;
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int a,b;
    cin>>a>>b;
    if(b==1) cout<<0<<endl;
    else{
        int cnt = 0;
        int now = 1;
        now = a;
        cnt++;
        while(now<b){
            now+=a-1;
            cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 256