akhauriyash/Code-Regression huggingface dataset:
# 3.4.3

import re
from collections import deque
from functools import reduce
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep
from queue import PriorityQueue
from sys import stdin


def rline() -> str:
    return stdin.readline().strip()


def rlines(hint: int = 1):
    ret = ['' for i in range(hint)]
    for i in range(hint):
        ret[i] = rline()
    return ret


def htokens(hint: int = 1):
    lns = rlines(hint)
    ret = list(map(lambda ln: ln.split(), lns))
    # if return value has one and only one element(list),
    if hint == 1:
        # then add an empty list.
        ret.append([])
    return ret


def vtokens(hint: int = 1):
    m, _ = htokens()
    wint = len(m)
    ret = [[None] * hint for i in range(wint)]
    for y in range(hint):
        if y != 0:
            m, _ = htokens()
        # convert horizontal to vertical
        x = 0
        for v in m:
            ret[x][y] = v
            x += 1
    # if return value has one and only one element(list),
    if wint == 1:
        # then add an empty list.
        ret.append([])
    return ret


def rint(radix: int = 10) -> int:
    return int(rline(), radix)


def hints(hint: int = 1, radix: int = 10):
    ret = htokens(hint)
    for i in range(len(ret)):
        ret[i] = list(map(lambda v: int(v, radix), ret[i]))
    return ret


def vints(hint: int = 1, radix: int = 10):
    ret = vtokens(hint)
    for i in range(len(ret)):
        ret[i] = list(map(lambda v: int(v, radix), ret[i]))
    return ret


def mat(hint: int, wint: int):
    return [[None]*wint for i in range(hint)]


def filllist(lst, value: int) -> None:
    # destructive.
    for i in range(len(lst)):
        lst[i] = value


def isprime(n: int) -> bool:
    if n <= 1:
        return False
    if n in (2, 3, 5):
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    lst = int(n**0.5)
    f = 5
    while f <= lst:
        if n % f == 0:
            return False
        if n % (f + 2) == 0:
            return False
        f += 6
    return True


def strmat(matrix, lnsep: str = linesep, fieldsep: str = ' ') -> str:
    return lnsep.join(map(lambda row: fieldsep.join(map(str, row)), matrix))


def strbool(boolval: int) -> str:
    return ['No', 'Yes'][boolval]


def solve() -> None:
    # read here
    n = rint()
    ss = rlines(n)

    # solve here
    dict = {}
    for s in ss:
        k = ''.join(sorted(list(s)))
        if not k in dict.keys():
            dict[k] = 0
        dict[k] += 1

    # 2-combination of x.
    ans = sum(map(lambda x: 0 if x == 1 else x*(x-1)//2, dict.values()))

    # print here
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 26100
N,Q=map(int,input().split())
S=input()
l=[0]*Q
r=[0]*Q
for i in range(Q):
  l[i],r[i]=map(int,input().split())
counter=[0]*N
for i in range(N-1):
  if S[i]=="A":
    counter[i]=counter[i-1]+(S[i+1]=="C")
  else:counter[i]=counter[i-1]
for j in range(Q):
  print(counter[r[j]-2]-counter[l[j]-2])

Measured memory_bytes: 14128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s,t;
int main()
{
	cin>>s>>t;
	for(int i=0;i<s.size();i++)
	if(s[i]!=t[i])
	{
		cout<<"No";
		return 0;
	}
	cout<<"Yes";
    return 0;
}

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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define INF 1e9
// constexpr ll INF = 1LL << 60;

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  REP(i, N){
    cin >> S[i];
  }
  int ans = 0;
  vector<string> T(N, string(N, 'a'));
  REP(k, N){
    REP(i, N){
      REP(j, N){
        int y = i, x = (j+k)%N;
        T[y][x] = S[i][j];
      }
    }
    bool isSym = true;
    REP(i, N){
      REP(j, N){
        if(T[i][j] != T[j][i]){
          isSym = false;
        }
      }
    }
    if(isSym){
      ans += N;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int c1,c5,c10,c50,c100,c500;
	scanf("%d",&c1);
	c1=c1*1;
	scanf("%d",&c5);
	c5=c5*5;
	scanf("%d",&c10);
	c10=c10*10;
	scanf("%d",&c50);
	c50=c50*50;
	scanf("%d",&c100);
	c100=c100*100;
	scanf("%d",&c500);
	c500=c500*500;
	
		if (c1+c5+c10+c50+c100+c500 >= 1000) {
			printf("%d\n",1);
		}
		else if(c1+c5+c10+c50+c100+c500 < 1000) {
			printf("%d\n",0);
	}
	return 0;
}

Measured memory_bytes: 1028
import heapq
import math

n, m = map(int, input().split())
goods = list(map(lambda x: int(x) * -1, input().split()))
heapq.heapify(goods)
for i in range(m):
    the_most_expensive = heapq.heappop(goods)
    heapq.heappush(goods, math.ceil(the_most_expensive / 2))

print(sum(goods) * -1)


Measured memory_bytes: 14532
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,a,b,c;
    scanf("%d",&n);
    a=n%10;
    n/=10;
    b=n%10;
    n/=10;
    c=n%10;
    n/=10;
    if((a==b&&b==c)||(b==c&&c==n))
        printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int N = s.size();
  string ans;
  ans = "";
  for (int i = 0; i < N; i++) {
    int n = ans.size();
    if (s.at(i) == '0') {
      ans = ans + '0';
    }
    else if (s.at(i) == '1') {
      ans = ans + '1';
    }
    else if (s.at(i) == 'B' && ans != "") {
      ans.erase(n - 1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int a,b[100000],max=0,min=1000000000;
    cin>>a;
    for(int i=0;i<a;i++){
        cin>>b[i];
        if(b[i]>max){
            max=b[i];
        }
        if(min>b[i] ){
            min=b[i];
        }
    }
    cout<<max-min;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
using namespace std;
int a[100005];
bool comp (int x,int y) {
	if (x>y) return true; else return false;
}
int main ( ) {
	int n,i,t;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1,comp);
	for (i=1;i<n;i++) {
		if (a[i]==a[i+1]) break;
	}
	if (i==n) {puts("0");return 0;}
	t=a[i];
	i+=2;
	for (;i<n;i++) {
		if (a[i]==a[i+1]) break;
	}
	if (i==n) {puts("0");return 0;}
	cout<<(long long)t*(long long)a[i]<<endl;
	return 0;
}
/*
Sample Input 1
6
3 1 2 4 2 1
Sample Output 1
2

Sample Input 2
4
1 2 3 4
Sample Output 2
0

Sample Input 3
10
3 3 3 3 4 4 4 5 5 5
Sample Output 3
20
*/

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

int main() {
  int l;
  cin >> l;
  int r;
  cin >> r;
  int d;
  cin >> d;
  int c = 0;
  
  int i = 0;
  while (i <= r){
    if (i >= l){
      c = c + 1;
    }
    i = i + d;
  }
  
  cout << c;
	return 0;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

// 1indexed2dimention[]
class imos2d{
    public:
    vector<vector<ll> >t, v;
    ll h, w, flg;
    imos2d(ll H = 0, ll W = 0){
        flg = 0;
        h = H + 10;
        w = W + 10;
        v = vector<vector<ll> >(h, vector<ll>(w, 0));
        t = vector<vector<ll> >(h, vector<ll>(w, 0));
    }
    void add(ll x, ll y, ll val){
        flg = 0;
        t[y][x] += val;
    }
    void make(){
        flg = 1;
        for(ll y = 1; y < h; y++){
            for(ll x = 1; x < w; x++){
                v[y][x] = t[y][x] + v[y][x - 1];
            }
        }
        for(ll x = 1; x < w; x++){
            for(ll y = 1; y < h; y++){
                v[y][x] += v[y - 1][x];
            }
        }
    }
    ll sum(ll x1, ll y1, ll x2, ll y2){
        if(!flg)make();
        return v[y2][x2] + v[y1 - 1][x1 - 1] - v[y2][x1 - 1] - v[y1 - 1][x2];
    }
};


class bit2d{
    public:
    vector<vector<ll> >v;
    ll h, w;
    bit2d(ll H = 0, ll W = 0){
        h = H + 5;
        w = W + 5;
        v = vector<vector<ll> >(h + 5, vector<ll>(w + 5, 0));
    }
    void add(ll x, ll y, ll val){
        for(ll yy = y; yy <= h; yy += yy & -yy){
            for(ll xx = x; xx <= w; xx += xx & -xx){
                v[yy][xx] += val;
            }
        }
    }
    ll sum_of_1_to_idx(ll x, ll y){
        if(x <= 0 || y <= 0)return 0;
        if(x > w || y > h)return 0;
        ll s = 0;
        for(ll yy = y; yy > 0; yy -= yy & -yy){
            for(ll xx = x; xx > 0; xx -= xx & -xx){
                s += v[yy][xx];
            }
        }
        return s;
    }
    ll sum(ll x1, ll y1, ll x2, ll y2){
        ll s = 0;
        s += sum_of_1_to_idx(x2, y2);
        s -= sum_of_1_to_idx(x2, y1 - 1);
        s -= sum_of_1_to_idx(x1 - 1, y2);
        s += sum_of_1_to_idx(x1 - 1, y1 - 1);
        return s;
    }
};

int main(){
    
    ll N;
    cin >> N;
    bit2d data(2000, 2000);
    vector<ll>v(2010);
    for(ll i = 1; i <= N; i++){
        ll x;
        cin >> x;
        data.add(i, x, 1);
        v[i] = x;
    }
    ll ans = 0;
    for(ll i = 1; i <= N; i++){
        for(ll j = i + 1; j < N; j++){
            ll a = v[i], b = v[j];
            ll mn = max(a - b, b - a) + 1;
            ll mx = a + b - 1;
            ans += data.sum(j + 1, mn, N, mx);
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 33920
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%lf",&n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%lf ",n)
#define dprin(n) printf("%lf\n",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;
 
void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

int main()
{ int c0=0,c1=0,c2=0,c3=0;
	tc{
	      
	      
	      string s;
	      cin>>s;
	      if(s=="AC")
	      c0++;
	      if(s=="WA")
	      c1++;
	      if(s=="TLE")
	      c2++;
	      if(s=="RE")
	      c3++;
	}
	cout<<"AC "<<"x "<<c0<<endl;
	cout<<"WA "<<"x "<<c1<<endl;
	cout<<"TLE "<<"x "<<c2<<endl;
	cout<<"RE "<<"x "<<c3<<endl;
return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
 
using namespace std;
 
int countOnbit(int x) {
    if (x == 0)
        return 0;
 
    return countOnbit(x >> 1) + (x & 1);
}
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N + 1);
    vector<vector<int>> x(N + 1);  // 指定した番号
    vector<vector<int>> y(N + 1);  // 正直者であるか否か
 
    for (int i = 1; i <= N; i++) {
        cin >> A.at(i);
        for (int j = 1; j <= A.at(i); j++) {
          	int a, b; cin >> a >> b;
			x[i].push_back(a);
			y[i].push_back(b);
        }
    }
 
    // 考え方メモ
    // 正直者か不親切な人かのパターンをビットで全て表す
    // ある人kが正直者でかつ証言に矛盾がない時、のビットの1を数える
    // ある人kが正直者である -> 右から(k - 1)番目のビットが1である
    // 矛盾がない時 -> 指定した番号のビット桁の数字が、パターンと等しい時
 
    int maxCount = 0;
    for (int bits = 1; bits < (1 << N); bits++) {
        bool isOk = true;
        for (int i = 1; i <= N; i++) {                // 人
            if (bits & (1 << (i - 1))) {              // ある人kが正直者である
                for (int j = 0; j < A.at(i); j++) {  // 証言
                    if (y.at(i).at(j) == 1) {
                        if (!((bits >> (x.at(i).at(j) - 1)) & 1)) isOk = false;
                    } else {
                        if ((bits >> (x.at(i).at(j) - 1)) & 1) isOk = false;
                    }
                }
            }
        }
        if (isOk) maxCount = max(maxCount, countOnbit(bits));
    }
 
    cout << maxCount << endl;
 
    return 0;
}

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

#define scanll(a) scanf("%lld",&a)
#define printll(a) printf("%lld\n",a)


int main()
{
    ll a,b,p,q,r;
    cin>>a>>b;
    p=a+b;
    q=a-b;
    r=a*b;
    ll ans =max(p,max(q,r));
    cout<<ans<<endl;

}



Measured memory_bytes: 256
#F
import bisect
import sys

sys.setrecursionlimit(202020)

inf = float("inf")
N = int(input())
A = list(map(int,input().split()))

on = [[] for _ in range(N)]
for _ in range(N-1):
    u,v = map(int,input().split())
    on[u-1].append(v-1)
    on[v-1].append(u-1)
    
    

DP = [inf]*(N+1)
stack = []
ans = [-1]*N
seen = [False]*N

#DFS
def dfs(gragh, v): #v = start
    """
    global A
    global DP
    global ans
    global stack 
    global seen
    """
    
    seen[v] = True
    ind = bisect.bisect_left(DP,A[v])
    mae = DP[ind]
    DP[ind] = A[v]
    stack.append([ind,mae])
    
    ans[v] = bisect.bisect_left(DP,inf)
    
    for next_v in gragh[v]:
        if seen[next_v]: 
            continue
        
        dfs(gragh,next_v)
        
    ind,mae = stack.pop()
    DP[ind] = mae
    
    return



dfs(on,0)
for a in ans:
    print(a)



Measured memory_bytes: 242644
N, M = map(int, input().split())
path = [[float("inf")]*N for i in range(N)]
ans = [[[float("inf")]]*N for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    path[a-1][b-1] = c
    path[b-1][a-1] = c
    ans[a-1][b-1] = [i]
    ans[b-1][a-1] = [i]
for i in range(N):
    path[i][i] = 0
for k in range(N):
    for i in range(N):
        for j in range(N):
            if path[i][k]+path[k][j] < path[i][j]:
                path[i][j] = path[i][k]+path[k][j]
                ans[i][j] = ans[i][k]+ans[k][j]
total = set()
for i in range(N):
    for j in range(N):
        p = set(ans[i][j])
        total = total|p
print(M-len(set(total))+1)
        


Measured memory_bytes: 48988
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=998244353;
typedef long long ll;
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n,a[303],sum;
int dp[303][303*303],_[303*303];
void add(int &x,int y){
	x=(x+y)%mod;
}
void sub(int &x,int y){
	x=(x-y+mod)%mod;
}
int calc(int n,int m){
	ll ans=1;
	for(int i=m+1;i<=n;i++)ans=(ans*i)%mod;
	for(int i=1;i<=m;i++)ans=ans*modpow(i,mod-2)%mod;
	return ans;
}
signed main(){
	cin>>n;for(int i=1;i<=n;i++)cin>>a[i],sum+=a[i];
	dp[0][0]=1;_[0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=90000;j++){
			//dp[i][j]->dp[i+1][j+a[i]]
			if(j+a[i+1]<=90000)add(dp[i+1][j+a[i+1]],dp[i][j]);
			add(dp[i+1][j],dp[i][j]*2);
		}
		for(int j=90000;j>=a[i+1];j--)(_[j]+=_[j-a[i+1]])%=mod;
	}
	int ans=modpow(3,n);
	for(int i=(sum+1)/2;i<=sum;i++){
		sub(ans,dp[n][i]*3);
	}
	if(sum%2==0)if(dp[n][sum>>1])add(ans,3*_[sum>>1]);
	cout<<ans<<endl;
	return 0;
}

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

#define INF 1e9
using namespace std;

long long N;

//cur:現在の値
//use:7,5,3のうちどれを使ったか
//counter:答え
void dfs(long long cur, int use, long long &counter) {
    if (cur > N) {
        return;
    }

    if (use == 0b111) {
        //7,5,3全てを使ったので、答えをインクリメント
        ++counter;
    }

    //7を加える
    dfs(10 * cur + 7, use | 0b100, counter);

    //5を加える
    dfs(10 * cur + 5, use | 0b010, counter);

    //3を加える
    dfs(10 * cur + 3, use | 0b001, counter);
}

int main() {
    cin >> N;

    long long ans = 0;

    //深さ優先探索
    dfs(0, 0b000, ans);

    cout << ans << endl;
}

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    int ans = min(9,max(n,0))+min(900,max(n-99,0))+min(90000,max(n-9999,0));
    cout << ans << endl;
}


Measured memory_bytes: 3560
#include <stdio.h>


int main()
{
	int n, x, max;
	int a, b, c;
	int ans;

	while (1) {
		scanf("%d%d", &n, &x);
		if (n == 0 && x == 0) break;

		ans = 0;
		max = x; if (max > n) max = n;
		for (a = 1; a <= max; a++) {
			for (b = a + 1; b <= max; b++) {
				c = x - a - b;
				if (c > b && c <= n) ans++;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}



  

 





Measured memory_bytes: 2044
/*************************************************************************
	> File Name: 3.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/7/13 13:53:12
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
const int maxx=2e5+10;
int n;
LL a[maxx],b[maxx];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int n=read();
	LL x=0;
	For(i,1,n){
		a[i]=read();
		if(i&1) x+=a[i];
		else x-=a[i];
	}
	b[1]=x;
	For(i,1,n-1)
		b[i+1]=2*a[i]-b[i];
	For(i,1,n) printf("%lld ",b[i]);
	return 0;
}


Measured memory_bytes: 5336
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
int main(){  
    long long int a;
    cin>>a;

    if(1<=a && a<=9) cout<<a;
    else if(10<=a && a<=99) cout<<"9";
    else if(100<=a && a<=999) cout<<9+a-99;
    else if(1000<=a&&a<=9999) cout<<999-100+10;
    else if(10000<=a &&a<=99999) cout<<9+999-100+1+a-10000+1;
    else if(a==100000) cout<<9+999-100+1+99999-10000+1;
    cout<<endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::Ordering;

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get {
    ([$t: ty]) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let x = get!(usize);
    let mut t = 100;
    for i in 0.. {
        t = (t as f64 * 101.0 / 100.0) as usize;
        if t >= x {
            println!("{}", i + 1);
            return;
        }
    }
}


Measured memory_bytes: 2272
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>

using namespace std;


const int MOD=1000000007;

int main(int argc, char**argv){
    // int a, b, c, d, e;
    // int k;
    // cin >> a;
    // cin >> b;
    // cin >> c;
    // cin >> d;
    // cin >> e;
    // cin >> k;
    int a[5];
    int k;

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


    for (int i=0; i<5; i++){
      for (int j=0; j<5; j++){
        if (abs(a[i]-a[j]) > k){
          cout << ":(" << endl;
          return 0;
        }
      }
    }

    cout << "Yay!" << endl;

    // cout << a << endl;
    // cout << b << endl;

    // cout << "Test program for dbg" << endl;
    // int a[100];
    //
    // rep (i, 1000){
    //     cout << a[i] << endl;
    // }


	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string input=Console.ReadLine();
            int n = int.Parse(input);
            int[] b = new int[n];
            int count;
            count=0;



            bool[] d = new bool[100000000 + 1];
            int c = 100000000;

            for (int i = 2; i <= c; i++)
            {
                if (d[i] == false)
                {
                    for (int j = 2; i * j <= 100000000; j++)
                    {
                        d[i * j] = true;
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
              
                    string a = Console.ReadLine();
                    b[i] = int.Parse(a);

                if (d[b[i]] == false)
                {
                    count = count + 1;
                }
            }

            Console.WriteLine(count);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 103908
#include <iostream>
#include <vector>

#define P 1000000007
#define N_MAX 30

using namespace std;

long inv[N_MAX],fac[N_MAX],finv[N_MAX];

long comb(long n, long r){
  long ans = 1;
  for(int i = 0; i < r; i++){
    ans = (ans*(n-i)%P)%P;
  }
  ans = (ans*finv[r])%P;
  return ans;
}

void make(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=P-inv[P%i]*(P/i)%P;
        fac[i]=fac[i-1]*(long) i%P;
        finv[i]=finv[i-1]*inv[i]%P;
    }
}

int main()
{
  int N, M;
  int p[40000];
  int c[40000];
  int ptr = 0;
  int p_count = 0;
  long ans = 1;
  make();
  cin >> N >> M;
  int M_org = M;
  for(int i = 2; i*i <= M_org; i++){
    if(M%i == 0){
      p[ptr] = i;
      c[ptr] = 0;
      while(M%i == 0){
        M = M/i;
        c[ptr]++;
      }
      ptr++;
      p_count++;
    }
  }
  
if(M != 1){
  c[ptr] = 1;
  p_count++;
}

  for(int i = 0; i < p_count; i++){
    //cout << N+c[i]-1 << ' ' << N-1 << endl;
    ans = (ans*comb(N+c[i]-1, c[i]))%P;
    
    //cout << comb(N+c[i]-1, N-1) << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N;
  cin >> N;
  if (N % 2 != 0) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  ll factor = 2 * 5;
  while (factor <= N) {
    ans += N / factor;
    factor *= 5;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long count = 0;

        for(int i=1;i<=N;i++){
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 35772
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const ull BASE = 19260817;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
const double PI = acos(-1);
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

int n, k, ans = INT_MAX;
int a[N];

int main() {
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    std::sort(a + 1, a + n + 1);
    for (int l = 1, r = k; r <= n; l++, r++) {
        ans = std::min(ans, a[r] - a[l]);
    }
    printf("%d\n", ans);
    return 0;
}

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

int N, W, r, w[105], v[105], mem[105][100005];

int dp(int n, int k) {
	if (k < 0) return 1e15;
	if (n == 0) return (k == 0 ? 0 : 1e15);
	if (mem[n][k] != -1) return mem[n][k];
	return mem[n][k] = min(dp(n - 1, k - v[n]) + w[n], dp(n - 1, k));
}

main() {
	memset(mem, -1, sizeof mem);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> W;
	for (int i = 1; i <= N; i++) cin >> w[i] >> v[i];
	for (int i = 1; i <= 100000; i++)
		if (dp(N, i) <= W) r = max(r, i);
	cout << r << '\n';
}


Measured memory_bytes: 82432
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
	ll n,in;
	cin>>n;
	ll arr[n],brr[n],crr[n-1];
	for(ll i=0;i<n;i++)
	{
		cin>>in;
		arr[i]=in-1;
		
	}
	for(ll i=0;i<n;i++)
	{
		cin>>brr[i];
	}
	for(ll i=0;i<n-1;i++)
	{
		cin>>crr[i];
	}
	ll sum=0,pr=arr[0];
	for(ll i=0;i<n;i++)
	{
		sum=sum+brr[arr[i]];
		if(i!=0 && pr<n-1)
		{
			if(pr==arr[i]-1)
			{
			sum=sum+crr[pr];
			}
		}
		pr=arr[i];
	}
	cout<<sum;
	return 0;
}

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

#define rep(a,b) for(int a = 0;a < n;a++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int n = 10 * b + c;
	if (n % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, K;
vector<ll> V;
ll val;
ll arr[100005];
ll minHeight = 1e9;

ll compG(int a, int b) {
	return a > b;
}

int main() {
	scanf("%lld %lld", &N, &K);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &val);
		V.push_back(val);
	}
	sort(V.begin(), V.end(), compG);
	// for(int i = 0; i < V.size(); i++) {
	// 	cout << V[i] << " ";
	// }
	// printf("\n");
	for(int i = 0; i <= N - K; i++) {
		if(V[i] - V[i + K - 1] < minHeight) {
			minHeight = V[i] - V[i + K - 1];
		}
	}
	printf("%lld\n", minHeight);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 1400
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

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


int main()
{
	int X, A;
	cin >> X >> A;

	if (X < A)cout << 0 << endl;
	else cout << 10 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 998244353
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
template< int char_size >
struct TrieNode {
  int nxt[char_size];

  int exist;
  vector< int > accept;

  TrieNode() : exist(0) {
    memset(nxt, -1, sizeof(nxt));
  }
};

template< int char_size, int margin >
struct Trie {
  using Node = TrieNode< char_size >;

  vector< Node > nodes;
  int root;

  Trie() : root(0) {
    nodes.push_back(Node());
  }

  void update_direct(int node, int id) {
    nodes[node].accept.push_back(id);
  }

  void update_child(int node, int child, int id) {
    ++nodes[node].exist;
  }

  void add(const string &str, int str_index, int node_index, int id) {
    if(str_index == str.size()) {
      update_direct(node_index, id);
    } else {
      const int c = str[str_index] - margin;
      if(nodes[node_index].nxt[c] == -1) {
        nodes[node_index].nxt[c] = (int) nodes.size();
        nodes.push_back(Node());
      }
      add(str, str_index + 1, nodes[node_index].nxt[c], id);
      update_child(node_index, nodes[node_index].nxt[c], id);
    }
  }

  void add(const string &str, int id) {
    add(str, 0, 0, id);
  }

  void add(const string &str) {
    add(str, nodes[0].exist);
  }

  void query(const string &str, const function< void(int) > &f, int str_index, int node_index) {
    for(auto &idx : nodes[node_index].accept) f(idx);
    if(str_index == str.size()) {
      return;
    } else {
      const int c = str[str_index] - margin;
      if(nodes[node_index].nxt[c] == -1) return;
      query(str, f, str_index + 1, nodes[node_index].nxt[c]);
    }
  }

  void query(const string &str, const function< void(int) > &f) {
    query(str, f, 0, 0);
  }

  int count() const {
    return (nodes[0].exist);
  }

  int size() const {
    return ((int) nodes.size());
  }
};

signed main(){
	Trie< 2, '0' > trie;
	int n,l;
	vector<string> st;
	cin>>n>>l;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		st.pb(s);
		trie.add(s);
	}
	
	queue< pair<int,int> > que;
	que.push( mp(0,0) );
	vector<int> vec;
	while(!que.empty()){
		pair<int,int> P = que.front(); que.pop();
		int dep = P.first;
		int idx = P.second;
		if( idx == -1 ){
			vec.pb(l-dep+1);
		}
		else if( trie.nodes[idx].exist > 0 ){
			for(int i=0;i<2;i++){
				que.push( mp( dep+1, trie.nodes[idx].nxt[i] ) );
			}
		}
	}
	int gr = 0;
	for(int i=0;i<vec.size();i++){
		//cout<<vec[i]<<" "; cout<<endl;
		int tmp = 1;
		while(vec[i] % 2 == 0 ){
			tmp *= 2;
			vec[i] /= 2;
		}
		gr = gr ^ tmp;
	}
	if( gr == 0 ){
		cout<<"Bob"<<endl;
		return 0;
	}
	else{
		cout<<"Alice"<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 10672
#include<cstdio>

int main(){
	char s[101],a[30];
	for(int i=0;i<30;i++) a[i] = 0;
	scanf("%s",s);
	for(int i=0;s[i]!='\0';i++) a[s[i]-'a']++;
	for(int i=0;i<30;i++){
		if(a[i]%2==1){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 2e5 + 17;

int n;
int a[maxn];

bool read()
{
	if (scanf("%d", &n) != 1)
		return false;

	forn (i, n)
		scanf("%d", a + i);

	return true;
}

bool check(vector<int> a)
{
	forn (i, size(a) - 1)
		if (1ll * a[i] * a[i + 1] % 4 != 0)
			return false;

	return true;
}

void solve()
{
	vector<int> v, v2, v4;

	forn (i, n)
		if (a[i] % 4 == 0)
			v4.push_back(a[i]);
		else if (a[i] % 2 == 0)
			v2.push_back(a[i]);
		else
			v.push_back(a[i]);

	vector<int> kek;

	for (; !v.empty() || !v4.empty(); )
	{
		if (!v.empty())
			kek.push_back(v.back()), v.pop_back();

		if (!v4.empty())
			kek.push_back(v4.back()), v4.pop_back();
	}

	while (!v2.empty())
		kek.push_back(v2.back()), v2.pop_back();

	if (check(kek))
		printf("Yes\n");
	else
		printf("No\n");
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif

	while (read())
		solve();

	return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

template<class T>
struct Vec2
{
	Vec2(){}
	Vec2(T _x, T _y) : x(_x), y(_y) {}

	Vec2 operator+(const Vec2& rhs) const { return Vec2(x + rhs.x, y + rhs.y); }
	Vec2 operator-(const Vec2& rhs) const { return Vec2(x - rhs.x, y - rhs.y); }
	Vec2 operator*(T s) const { return Vec2(x*s, y*s); }
	T dot(const Vec2& rhs) const { return x*rhs.x + y*rhs.y; }
	T cross(const Vec2& rhs) const { return x*rhs.y - y*rhs.x; }
	double length() const { return sqrt(1.0*x*x + 1.0*y*y); }
	bool operator<(const Vec2& rhs) const
	{
		if (x != rhs.x) return x < rhs.x;
		return y < rhs.y;
	}

	T x;
	T y;
};

int main()
{
	typedef Vec2<double> Vec2;

	double x1, y1, r1, x2, y2, r2;
	cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
	Vec2 C1(x1, y1), C2(x2, y2);
	Vec2 D = C2 - C1;
	double dc = D.length();
	D = D*(1.0 / dc);
	double t = acos((dc*dc + r1*r1 - r2*r2) / (2 * dc*r1));
	Vec2 m = D*r1*cos(t) + C1;
	double h = dc * r1 * sin(t) / dc;
	Vec2 int1 = m + Vec2(D.y, -D.x) * h;
	Vec2 int2 = m + Vec2(-D.y, D.x) * h;
	if (int2 < int1) {
		swap(int1, int2);
	}
	printf("%.10lf %.10lf %.10lf %.10lf\n", int1.x, int1.y, int2.x, int2.y);
	return 0;
}


Measured memory_bytes: 3520
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int t = sc.nextInt();

		for (int i = 1; i < n+1; i++) {
			if (i * x >= n) {
				System.out.println(t * i);
				break;
			}
		}

		sc.close();
	}

}

Measured memory_bytes: 36068
//B Resistors in Parallel
#include <bits/stdc++.h>
using namespace std;

int  main()
{
  int n;
  double x=0;
  cin>>n;
  vector<double> a(n);
  vector<double> b(n);
  for(int i=0;i<n;i++)
  {
    cin>>a.at(i);
    b.at(i)=1/(a.at(i));
    x=x+b.at(i);
  }
  cout<<1/x<<endl;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    double sr;
    long long int lr;
    cin >> lr >> sr;

    cout << (long long int)(double(lr%1000) * sr)+(lr/1000)*((long long int)(sr*1000)) << endl;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    int cnt=0;
    int pass=0;
    for(int i=0; i<N; i++){
        if(pass<A+B){
            if(S[i]=='c') cout << "No" << endl;
            if(S[i]=='b'){
                cnt++;
                if(cnt<=B){
                    pass++;
                    cout << "Yes" << endl;
                }else{
                    cout << "No" << endl;
                }
            }
            if(S[i]=='a'){
                pass++;
                cout << "Yes" << endl;
            }
        }else cout << "No" << endl;
    }
}

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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
#define fir first
#define sec second

const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second > b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n, m;
int A[100010];

P bc[100010]; //bc.fir is B[i], bc.sec is C[i];

void solve() {
	sort(A, A + n);
	sort(bc, bc + m, cmp);

	int i = 0, j = 0;
	while (i < n && j < m && A[i] < bc[j].sec) {
		A[i++] = bc[j].sec;
		bc[j].fir--;
		if (bc[j].fir == 0) j++;
	}

	ll ans = 0;
	for (int i = 0; i < n; i++) ans += A[i];
	printf("%lld\n", ans);
}

int main(void){
	cin>>n>>m;
	for (int i = 0; i < n; i++) cin>>A[i];
	for (int i = 0; i < m; i++) cin>>bc[i].fir>>bc[i].sec;

	solve();
	
	return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner a = new Scanner (System.in);
		
		int t;
		
		while (true){
			int x = a.nextInt();
			int y = a.nextInt();
			
			if (x + y == 0){
				break;
			}
			if (x > y){
				t = x;
				x = y;
				y = t;
			}
			
			System.out.println(x + " " + y);
		}
	}
}

Measured memory_bytes: 27184
import java.util.*;
public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
      
      //入力
      long A =sc.nextLong();
      long B =sc.nextLong();
      long too =0; //余り
      
      //計算用
      long a = A;
      long b = B;
      
      //ユークリッドの互除法利用
      //Aが大きいときの最大公約数を求める
      if(A>B){
        	while(b!=0){
        		too = (a%b);
        		a = b;
        		b =too;
        }
        //最小公倍数を求める(lcm=(A*B)/gcd)
       	System.out.println((A*B)/a); 
      }
      
      //Bが大きいときの最大公約数を求める
      else if(B>A){
          	while(a!=0){
      			too = (b%a);
      			b = a;
     			a =too;
          }
        //最小公倍数を求める
       	System.out.println((B*A)/b); 
      }
    }
}

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

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    REP(i, N)cin >> d[i];

    sort(ALL(d));

    int ans = d[N / 2] - d[N / 2 - 1];
    cout << ans << endl;
    return 0;
}

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

int main () {
  string s;
  cin >> s;
  
  bool check = true;
  if (s.at(0) != 'A') check = false;
  int C_count = 0;
  for (int i = 2; i < s.size()-1;i++){
    if (s.at(i) == 'C') C_count ++;
  }
  if (C_count != 1) check = false;
  for (int i = 1; i < s.size();i++){
    if ((s.at(i) != 'C') && (s.at(i) >='A') && (s.at(i) <= 'Z')) check = false;
  }
  if (check) cout << "AC" << endl;
  else cout << "WA" << endl;
}

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

int main() {
  char in_data[3];
  int count = 0;
  
  cin >> in_data;
  for(int i = 0; i < 3; i++) {
    if(in_data[i] == '1') {
      count++;
    }
  }
  
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 256
using System;


namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int n = int.Parse(s);

            for (int i = 1; i <= n; i++)
            {
                
                if (i % 3 == 0 || i.ToString().IndexOf("3") !=-1)
                {
                    Console.Write(" "+i);
                }

            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    long long int a[n+1];
    long long int b[n];
    for(int i=0;i<n+1;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>b[i];
    }
    long long int count=0;
    for(int i=0;i<n;i++)
    {
        if(b[i]>=a[i])
        {
            count+=a[i];
            int temp=b[i]-a[i];
            if(temp>=a[i+1])
            {
                count=count+a[i+1];
                a[i+1]=0;

            } else
            {
                a[i+1]=a[i+1]-temp;
                count=count+temp;
            }
        } else
        {
            count=count+b[i];
        }
    }
    cout<<count;

}

Measured memory_bytes: 1792
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int N = scan.nextInt();
      	int X = scan.nextInt();
      	int[] m = new int[N];
      	int sum = 0;
      	for (int i = 0; i < N; i++){
        	m[i] = scan.nextInt();
        }
      	for (int i = 0; i < N; i++){
        	sum = sum + m[i] ;
        }
      	int min = m[0];
      	for (int i = 0; i < N; i++){
        	if(min > m[i]){
            	min = m[i];
            }
        }
      	int rest = X - sum;
      	int counter = N;
      	while(rest >= min){
        	rest = rest - min;
            counter++;
        }
      	System.out.print(counter);
    }
}

Measured memory_bytes: 23124
s = input()
n = len(s)

if s != s[::-1]:
    print('No')
    exit()

s2 = s[:int((n-1)/2)]
if s2 != s2[::-1]:
    print('No')
    exit()

s3 = s[int((n+3)/2-1):]
if s3 != s3[::-1]:
    print('No')
    exit()

print('Yes')


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

using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int> p(N);
    for(int i=0;i<N;i++){
        cin>>p[i];
    }
    sort(p.begin(),p.end(),greater<int>());

    int sum=p[0]/2;
    for(int i=1;i<N;i++){
        sum+=p[i];
    }
    cout<<sum;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
 int N;
 scanf("%d",&N);
 int L[N],max=0,sum=0;

 for(int i=0;i<N;i++){
  scanf("%d",&L[i]);
  
  if(L[i]>max) {
   sum += max;
   max = L[i];
  }
  else sum += L[i];
  //printf("L[%d]:%d\nsum:%d\nmax:%d",i,L[i],sum,max);
 }

 if(sum>max) printf("Yes");
 else printf("No");

 return 0;
}

Measured memory_bytes: 128
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read


#n,a = [int(i) for i in read().split()]

s = input()
s = s.replace("hi","X")
if len(set(s)) == 1 and s[0]=="X":
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#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<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
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 REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000007 ;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int n,i,j;cin>>n;
	static int dp[1<<18][51]={};
	int A[18];
	int B[18];
	for(i=0;i<n;i++){cin>>A[i];}
	for(i=0;i<n;i++){cin>>B[i];}
	dp[0][0]=-mod;
	for(int bi=0;bi<(1<<n);bi++){
		int u=0;//使ったカード
		for(i=0;i<n;i++){if(bi&(1<<i)){u++;}}
		int F=0;
		for(j=0;j<50;j++){chmin(dp[bi][j+1],dp[bi][j]);}
		for(i=0;i<n;i++){
			//使用するカード
			if(bi&(1<<i)){continue;}
			int s=((i+u)%2==0?A[i]:B[i]);
			chmin(dp[bi+(1<<i)][s],dp[bi][s]+F);
			F++;
		}
	}
	dp[(1<<n)-1][50]+=mod;
	if(dp[(1<<n)-1][50]==mod){dp[(1<<n)-1][50]=-1;}
	cout<<dp[(1<<n)-1][50]<<endl;
}

Measured memory_bytes: 52480
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int ll,rr,l,r,x,y,sa;
  x=10000000;
  cin>>ll>>rr;
  sa=rr-ll;
  l=ll%2019;
  r=rr%2019;

  if(l<r&&sa<2019){
    for(int i=l; i<r; i++){
      for(int j=i+1; j<r+1; j++){
        y=(i*j)%2019;
        x=min(x,y);
      }
    }
    cout<<x;
  }
    else{
    r=0;
    cout<<r;
  }
}
    
   

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

#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);

/////////////////////////////////////////////

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

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

////////////////////////////////

void solve(){

	int n , k;
	cin>>n>>k;
	vector<int> a(n);
	int sum = 0;
	for(int i = 0 ; i < n ; ++i)
		cin>>a[i] , sum+=a[i];

	vector<int> fact;
	fact.pb(sum);
	for(int i = 2 ; i*i <= sum ; ++i){

		if(sum%i==0){

			fact.pb(i);

			if(i!=sum/i)
				fact.pb(sum/i);
		}
	}

	int ans = 1; // worst case;

	for(int it : fact){

		int tot = 0;
		int used = 0;
		vector<int> v;
		for(int i = 0 ; i < n ; ++i){

			int val = a[i]%it;

			tot+=(it -val);
			v.pb(val);
		}

		sort(v.begin(),v.end());


		for(int vals : v){

			used+=vals;
			tot-=(it-vals);

			if(used==tot && used <= k)
				ans = max(ans , it);
		}


	}

	cout<<ans<<endl;
}

signed main(int argc , char *argv[]){
	fast;
	
	int t = 1;
	// cin>>t;
	while(t--)
		solve();

}

Measured memory_bytes: 256
#include<iostream>
#define rep0(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;

const int LIMIT = 2001, MOD = 1e9 + 7;
int N, K;
int64_t C[LIMIT][LIMIT];

int main() {
    cin >> N >> K;
    rep0(i, LIMIT) {
        C[i][0] = 1;
        rep1(j, i) {
            C[i][j] = (C[i-1][j] + C[i-1][j-1]) % MOD;
        }
    }
    rep1(i, K) {
        cout << (C[N-K+1][i] * C[K-1][i-1]) % MOD << endl;
    }
}

Measured memory_bytes: 30080
#include<stdio.h>

int main()
{
  int i,j,S[10000],T[10000],n,q,count=0;

  scanf("%d",&n);
  for(i=0; i<n; i++) scanf("%d",&S[i]);

  scanf("%d",&q);
  for(i=0; i<q; i++) scanf("%d",&T[i]);

  for(i=0; i<q; i++)
    {
      for(j=0; j<n; j++)
	{
	  if(S[j]==T[i])
	    {
	      count++;
	      break;
	    }
	}
    }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2048