akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define MOD 1000000007
#define EPS (1e-10)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

ll kosuu(ll s, ll g, ll b, ll mod = 0) {
	ll d = g / b - s / b;
	if (mod == 0)return d;
	if (g%mod == 0)d--;
	if (s%mod == b - 1)d++;
	return d;
}
int main() {
	ll n, k; scanf("%lld%lld", &n, &k);
	ll i = 9;
	for (;; i++) {
		if (i % 7 == 1)continue;
		if (i % 7 == 0)continue;
		if (i - 7 - 1 <= 0)continue;
		if (i + 7 + 1 >= n * 7)continue;
		ll sum = 0;
		sum += i;
		sum += i + 7 + 1;
		sum += i + 7;
		sum += i + 7 - 1;
		sum += i + 1;
		sum += i - 1;
		sum += i - 7 + 1;
		sum += i - 7;
		sum += i - 7 - 1;
		if (sum % 11 == k) {
			break;
		}
	}
	ll cnt = 0;
	for (ll k = i; k <= n * 7 - 7; k += 11) {
		if (k % 7 == 0 || k % 7 == 1)continue;
		cnt++;
	}
	printf("%lld\n", cnt);
}

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

int main() {
	ll num;
	cin >> num;
	ll ans = num;
	for (ll i = 1; i*i <= num; i++) {
		if (num % i != 0) {
			continue;
		}
		ll b = num / i;
		ans = min(ans, i + b - 2);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define itc ll t;cin>>t;while(t--)
#define otc ll t=1;while(t--)
#define PI 3.141592653589793238
//ang=(PI*ang)/180.0 in radian
#define ll long long int
#define ld long double
#define pb push_back
#define gcd(a,b) __gcd(a,b)
#define fi first
#define se second
#define ull unsigned long long int
#define memset(arr) memset(arr, 0, sizeof(arr));
bool sortinrev(const pair<ll, ll> &a, const pair<ll, ll> &b)
{return (a.fi > b.fi);}//sort by first in descending order
bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b)
{ return (a.se < b.se); }//sort by second in ascending order
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
ll ar[100005][5];
ll dp[100005][5];
ll n;
ll solve(ll i, ll j)
{
	ll maxi = 0;
	if (i > n)
		return 0;

	if (dp[i][j] != -1)
		return dp[i][j];

	if (j == 0) // first row
	{
		dp[i][1] = ar[i][1] + solve(i + 1, 1);
		dp[i][2] = ar[i][2] + solve(i + 1, 2);
		dp[i][3] = ar[i][3] + solve(i + 1, 3);

		return max(dp[i][1], max(dp[i][2], dp[i][3]));
	}

	if (j == 1) //1st column can't be taken from its row
	{
		maxi = max(maxi, ar[i][2] + solve(i + 1, 2));
		maxi = max(maxi, ar[i][3] + solve(i + 1, 3));
	}
	else if (j == 2) //2nd column can't be taken from its row
	{
		maxi = max(maxi, ar[i][1] + solve(i + 1, 1));
		maxi = max(maxi, ar[i][3] + solve(i + 1, 3));
	}
	else if (j == 3) //3rd column can't be taken from its row
	{
		maxi = max(maxi, ar[i][1] + solve(i + 1, 1));
		maxi = max(maxi, ar[i][2] + solve(i + 1, 2));
	}
	return dp[i][j] = maxi;
}
int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	cin >> n;
	for (ll i = 1; i <= n; i++)
		for (ll j = 1; j <= 3; j++)
		{cin >> ar[i][j];}

	for (int i = 0; i <= 100004; i++)
		for (int j = 0; j <= 4; j++)
			dp[i][j] = -1;

	cout << solve(1, 0) << endl;
	return 0;
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=1e9+7;
char s[10][10];
int r[10],c[10];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w,k;
    cin>>h>>w>>k;
    int row=(1<<h)-1;
    int col=(1<<w)-1;
    int ans=0;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            cin>>s[i][j];
        }
    }
    for(int i=0;i<=row;i++)
    {
        for(int j=0;j<=col;j++)
        {
            memset(c,0,sizeof(c));
            memset(r,0,sizeof(r));
            for(int x=0;x<=6;x++)
            {
                if((i>>x)&1)
                    r[x+1]=1;
            }
            for(int x=0;x<=6;x++)
            {
                if((j>>x)&1)
                    c[x+1]=1;
            }
            int temp=0;
            for(int x=1;x<=h;x++)
            {
                for(int y=1;y<=w;y++)
                {
                    if(r[x]||c[y])
                        continue;
                    if(s[x][y]=='#')
                        temp++;
                }
            }
            if(temp==k)
                ans++;
        }
    }
    cout<<ans<<'\n';









}


Measured memory_bytes: 3616
H, W = [int(_) for _ in input().split()]

S = [input() for _ in range(H)]

INF = 10 ** 5
dp = [[INF] * (W + 1) for _ in range(H + 1)]
dp[0][0] = int(S[0][0] == '#')

for i in range(H):
    for j in range(W):

        # 横移動
        if j == 0:
            v1 = INF
        else:
            v1 = int(S[i][j - 1] == '.' and S[i][j] == '#') + dp[i][j - 1]

        # 縦移動
        if i == 0:
            v2 = INF
        else:
            v2 = int(S[i - 1][j] == '.' and S[i][j] == '#') + dp[i - 1][j]

        dp[i][j] = min(v1, v2, dp[i][j])
ans = dp[H - 1][W - 1]
print(ans)


Measured memory_bytes: 44144
#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() {
    string s;
    bool ans = false;
    cin >> s;
    map<char, int>mp;
    for (auto ss : s)mp[ss]++;
    auto p = mp.begin();
    if (mp.size() == 2 && (*p).second == 2 && (*(++p)).second == 2)ans = true;

    if (ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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[] A = new int[N];
      	int[] delta = new int[N + 1];//up or down from yesterday
      	delta [0] = 0;
      	delta [N] = 0;//最終日には株を0にしたい
      	for (int i=0; i<N; i++) {
          	A[i] = Integer.parseInt(sc.next());
          	if (i > 0) {
            	if (A[i] >= A[i - 1]) {
                	delta[i] = 1;
                } else {delta[i] = 0;}
            }
        }
      
      	long keep = 0;
      	long money = 1000;
      	for (int i = 0; i < N; i++) {
        	if ((delta[i]==0) && (delta[i+1]==1)) {
            	keep += money / ((long) A[i]);
              	money %= (long) A[i];
            } else if ((delta[i]==1) && (delta[i+1]==0)) {
            	money += keep * ((long) A[i]);
              	keep = 0;
            }
        }
      
      	System.out.println(money);
      
	}
}

Measured memory_bytes: 35652
#include<iostream>
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
typedef long int li;

int main(){
  if(df) printf("*debug mode*\n");
  int n,f=1; cin >>n;
  string s; cin >>s;
  if(n%2){
    cout << "No";
    return 0;
  }
  n/=2;
  rep(i,n){
    if(s.at(i)!=s.at(i+n)){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}

/// confirm df==0 ///


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	string s,t;
	cin >> s >> t;
	int cnt=0,min=99999;
	for(int i=0;i<s.length()-t.length()+1;i++){
		int cnt=0;
		for(int j=0;j<t.length();j++)
			if(s[i+j]!=t[j]) cnt++;
		if(cnt<min) min=cnt;
	}
	cout << min << '\n';	
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
//#include <map>
#include <iomanip>
#include <vector>

using namespace std;



int main()
{
	double x, h, ans;
	
	cout << fixed << setprecision(6);
	while (cin >> x >> h)
	{
		if (x == 0 && h == 0) break;
		ans = 2*x*sqrt(h*h+x*x/4) + x*x;
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1276
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<cmath>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

P C[100000];
ll sum[100000];

int main(){
  int H,W,D,temp;
  cin>>H>>W>>D;

  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin>>temp;

      C[temp]=P(i,j);
    }
  }

  for(int i=1;i<=D;i++){
    for(int j=1;i+j*D<=H*W;j++){
       sum[i+j*D]+=sum[i+(j-1)*D]+abs(C[i+j*D].first-C[i+(j-1)*D].first)+abs(C[i+j*D].second-C[i+(j-1)*D].second);
    }
  }
  int Q,l,r;
  cin>>Q;
  //cout<<sum[8]<<endl;
  //cout<<sum[6]<<endl;  
  //cout<<sum[4]<<endl;
  for(int i=0;i<Q;i++){
    cin>>l>>r;
    cout<<sum[r]-sum[l]<<endl;
  }
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define for(i,a,b) for(int i=a;i<b;i++)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
 
int main() {
  ll n,m,x,y;
  ci(n>>m>>x>>y);
  vec a(n),b(m);
  for(i,0,n)
    ci(a[i]);
  for(i,0,m)
    ci(b[i]);
  sort(a,a);
  sort(b,b);
  if(a[n-1]<b[0]&&x<b[0]&&a[n-1]<y)
    co("No War");
  else
    co("War");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int w = sc.nextInt();
		String result = "unsafe";
		if(s > w)  result = "safe";
		System.out.println(result);

	}

}


Measured memory_bytes: 35792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
using namespace std;
const long long MAXN=200001;
bool check[MAXN];
long long arr[MAXN];
long long sum[MAXN]={0,};
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    memset(check,0,sizeof(check));
    sort(arr+1,arr+n+1);
    int ret=0;
    for(int i=1;i<=n;i++){
        sum[i]=sum[i-1]+arr[i];
    }
    check[n]=1;
    for(int i=n-1;i>=1;i--){
        if(check[i+1] && 2*sum[i]>=arr[i+1]){
            check[i]=1;
        }
    }
    for(int i=1;i<=n;i++){
        if(check[i])ret++;
    }
    cout<<ret;
    return 0;
}

Measured memory_bytes: 2176
import collections

n = int(input())

# 75 = 3*5*5 or 3*25 or 5*15 or 75
seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

d = collections.defaultdict(lambda: 0)

def bunkai(n):
    if n == 1:
        return 0
    else:
        for i in seed_primes:
            if n % i == 0:
                d[i] += 1
                return bunkai(n//i)


for i in range(1, n+1):
    bunkai(i)

tot = 0
s = 0
dd = collections.defaultdict(lambda: 0)
for v in d.values():
    if v >= 74:
        dd[74] += 1
        s += 1
    elif v >= 24:
        dd[24] += 1
        s += 1
    elif v >= 14:
        dd[14] += 1
        s += 1
    elif v >= 4:
        dd[4] += 1
        s += 1
    elif v >= 2:
        dd[2] += 1
        s += 1


#74
tot += dd[74]
#24*2
tot += (dd[74]+dd[24])*(s-1)
#14*4
tot += (dd[74]+dd[24]+dd[14])*(s-dd[2]-1)
#4*4*2
tot += int((dd[74]+dd[24]+dd[14]+dd[4])*(dd[74]+dd[24]+dd[14]+dd[4]-1)*(s-2)/2)

print(tot)

Measured memory_bytes: 3316
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
const long long int mod=1e9+7;
typedef long long ll;

ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

bool issq(int n){
    int i=1;
    while(i*i<=n){
        if(i*i==n){
            return true;
        }
        i++;
    }
    return false;
}
int main(){
    int K;
    cin >>K;
    int ans=(K/2)*((K+1)/2);
    
    cout <<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
# include "iostream"
# include "cstdio"
# include "cstring" 

using namespace std;

const int maxm=100+10; 
bool  
	f[maxm],
	q[maxm]; 

int main(){
	int n,
		now,
		ans;
	register int i,j;
	char s[maxm]; 
	scanf("%d",&n);
	cin>>s; 
	for(i=0;i<n;i++){
		f[s[i]-'a']=true; 
		memset(q,0,sizeof(q));
		for(j=i+1;j<n;j++){
			q[s[j]-'a']=true;  
		}
		now=0;
		for(j=0;j<26;j++){
			if(q[j] && f[j]){
				now++; 
			} 
		} 
		ans=max(ans,now); 
	}
	printf("%d",ans); 
	return 0; 
} 

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

int main(void){
  int n, i, min, cnt;
  vector<int> p;
  cin >> n;
  p.resize(n);
  for(i=0;i<n;i++){
    cin >> p[i];
  }

  min = 1e9;
  cnt = 0;
  for(i=0;i<n;i++){
    if(min>p[i]){
      cnt++;
      min = p[i];
    }
  }

  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 1024
N=int(input())
h={}
A=list(map(int, input().split()))

for i in range(len(A)):
  value=A[i]

  if value in h:
    h[value] += 1
  else:
    h[value] = 1
  if h[value] > 1:
    print('NO')
    exit(0)
print('YES')


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

using namespace std;
typedef long long int ll;
ll N1097 = 1000000007LL;


ll dp[200000][200];
void dgb_array(ll width, ll height){
    for(ll h=0;h<height;h++){
        for(ll w=0;w<width;w++){
            printf("%lld ", dp[h][w]);
        }
        printf("\n");
    }
}

int main(){
    int N;
    ll W;
    cin >> N >> W;
    ll w[101], v[101];
    for(int i=1;i<=N;i++){
        scanf("%lld", &w[i]);
        scanf("%lld", &v[i]);
    }
    for(int val=1;val<=N*1000;val++){
        dp[val][0] = 1LL<<50;
        for(int i=1;i<=N;i++){
            dp[val][i] = dp[val][i-1];
            if(val-v[i]>=0){
                dp[val][i] = min(dp[val][i], dp[val-v[i]][i-1]+w[i]);
            }
        }
    }
    ll ans;
    for(int val=1;val<=N*1000;val++){
        if(dp[val][N]<=W){
            ans = val;
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 157952
#include<bits/stdc++.h>
#define pb push_back
#define pp pop_back()
#define mp make_pair
#define fr first
#define sc second
#define sz size()
#define smin(x,y) ((x)=min((x),(y)))
#define smax(x,y) ((x)=max((x),(y)))
#define all(x) x.begin(),x.end()
#define CS ios_base::sync_with_stdio(false);
#define show(x) cerr << #x << " is " << x <<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi; 

ll n,m;

bool check(ll val){
	ll p=n,q=m;
	if(p<val){
		q -= (val-p)*2ll;
		p = val;
	}
	if( q >= val*2ll) return 1;
	return 0;
}

int32_t main()
{
	cin>>n>>m;
 	ll l=0;
	ll r=n+(m/2ll);	
	while(r-l>1){
		ll mid = (l+r)/2ll;
//		cout << l << ' '<<r<<endl;
		if(check(mid)) l=mid;
		else r=mid;
//		int u; cin>>u;
	}
	return cout<<l<<endl,0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;


 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

void Solve();

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


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 

void Solve(){
  comuse;
  ll n;
  st s;
    cin>>n>>s;
  vll A(26);
  FOR(i,0,n){
    ll a=s[i]-'a';
    A[a]++;
  }

  ll ans=1;
  FOR(i,0,26){
    ans*=(A[i]+1);
    ans%=MOD;
  }

  ans+=MOD-1;
  ans%=MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 12496
#include <stdio.h>

int main(void)
{
	int n, m, x, y, k;
	int box[2000];
	int box2[2000];
	
	while (1) {
		scanf("%d %d", &n, &m);
		if (n == 0 && m == 0) {
			break;
		}
		for (x = 0; x < 2000; x++) {
			box[x] = 0;
			box2[x] = 0;
		}
		for (x = 0; x < n; x++) {
			for (y = 0; y < m; y++) {
				scanf("%d", &k);
				box[y] += k;
				box2[y] += k;
			}
		}
		
		for (x = 0; x < m; x++) {
			for (y = 0; y < m; y++) {
				if (box[x] > box[y]) {
					k = box[y];
					box[y] = box[x];
					box[x] = k;
				}
			}
		}
		for (x = 0; x < m; x++) {
			for (y = 0; y < m; y++) {
				if (box[x] == box2[y]) {
					(x == (m - 1)) ? printf("%d", y + 1) : printf("%d ", y + 1);
					box2[y] = -1;
					break;
				}
			}
		}
		printf("\n");
	}
	
	return (0);
}

Measured memory_bytes: 616
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"
#include "cmath"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<ll> > mat;

int main()
{
  ll n;
  cin >> n;
  if (n % 2 != 0)
  {
    cout << 0 << "\n";
  }
  else
  {
    n /= 2;
    ll ans = 0;
    while (n > 0)
    {
      n /= 5;
      ans += n;
    }
    cout << ans << "\n";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    for (auto &i : a) cin >> i;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += a[i] * a[j];
        }
    }
    cout << ans << '\n';
}


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

int main(){
    int N; cin >> N;
    vector<long long> A(N), B(N);
    ll sum = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        sum += A[i];
 //       SUM[i] = sum;
    }
    B[0] = sum;
    //cout << sum << endl;
    for(int i = 1; i < N; i += 2){
        B[0] -= 2 * A[i];
    }
    for(int i = 1; i < N; i++){
        B[i] = 2 * A[i-1] - B[i-1];
    }
    for(int i = 0; i < N; i++){
        cout << B[i];
        if(i != N - 1) cout << " ";
        else cout << endl;
    }
}

Measured memory_bytes: 2944
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <regex>



using ull = unsigned long long;
using ll = long long;

using namespace std;




int main() {
   

	int k, a, b;
	cin >> k >> a >> b;

	int n = a / k, m = b / k;

	for (int i = n; i <= m; i++)
	{
		if (a <= k * i &&   k * i <= b) {
			cout << "OK";
			return 0;
		}
	}

	cout << "NG";
	
	return 0;
	
}

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

int main(){
    int r;
    cin >> r;
    if(r < 1200){
        cout << "ABC" << endl;
    } else if(r >= 1200 && r < 2800){
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}


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

#define sz(x) (int)(x.size())
#define FOR(i,L,R) for(int i = L; i <= R; i++)
#define int long long

const int N = 2e5 + 2, inf = 1e18;

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

    int n, ans = inf, sum = 0, pref = 0;
    cin >> n;

    std::vector<int> a(n);
    for(auto &x : a) cin >> x, sum += x;

    for (int i = 0; i < n - 1; i++) {
        pref += a[i];
        sum -= a[i];
        ans = min(ans, abs(pref - sum));
    }

    cout << ans;
}   


Measured memory_bytes: 4732
import java.util.ArrayList;
import java.util.Scanner;


public class Main{

	Scanner sc=new Scanner(System.in);
	static final int upperlimit=2*123456;
	
	private void cal(){
		
		ArrayList<Integer> primes=new ArrayList<Integer>();
		
		primes.add(2);

		for(int i=3;i<Main.upperlimit;i+=2){
			for(int j=0;j<primes.size();j++){
				if(i%primes.get(j)==0)
					break;
				if(j==primes.size()-1)
					primes.add(i);
			}
		}
	
		
		
		while(true){
			int n=sc.nextInt();
			int count=0;
			
			if(n==0)
				break;
			
			for(int i=0;i<primes.size();i++){
				int prime=primes.get(i);
				if(prime>2*n)
					break;
				else if(prime<=n)
					continue;
				else count++;
				
			}
			System.out.println(count);
						
		}
		
		
	}
	
	public static void main(String[] argv){
		new Main().cal();
	}
	
}

Measured memory_bytes: 13000
#include <stdio.h>

int main(void){

   int a, b;

   scanf("%d %d", &a, &b);

   if ( a == b){
      printf("a == b\n");
   }else if (a > b){
      printf("a > b\n");
   }else{
      printf("a < b\n");
   }

   return 0;
}



Measured memory_bytes: 2136
#include <iostream>
#include <vector>
using namespace std;
const long long mod=1e9+7;
int main(){
	long long n,k,i,j;
	cin >> n >> k;

	vector< vector<long long> > v(2001);
	for(i=0; i<v.size(); i++){
		vector<long long> vv(2001,0);
		vv[0]=1;
		vv[i]=1;
		v[i]=vv;
	}
	for(i=1; i<v.size(); i++){
		for(j=1; j<i; j++){
			v[i][j]=(v[i-1][j-1]+v[i-1][j])%mod;
		}
	}

	for(i=1; i<=k; i++){
		long long ans;
		ans=v[k-1][i-1]*v[n-k+1][i];
		ans%=mod;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 31616
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
using namespace std;

int main(){
	int l[10],v[2];
	char s[11];
	while(cin >> l[0] >> s[0] >> l[1] >> s[1] >> l[2] >> s[2] >> l[3] >> s[3] >> l[4] >> s[4] >> l[5] >> s[5] >> l[6] >> s[6] >> l[7] >> s[7] >> l[8] >> s[8] >> l[9] >> s[9] >> v[0] >> s[10] >> v[1]){
		int total = 0;
		for(int i = 0; i < 10; i++)total += l[i];
		double meet = (double) v[0] * total / (v[0] + v[1]);
		total = 0;
		for(int i = 0; i < 10; i++){
			total += l[i];
			if(( total - l[i] < meet ) && ( meet <= total ))cout << i + 1 << endl;
		}
	}
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, U, V, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N >> C;
    vector<pair<ll, ll>> r(N + 1), l(N + 1);
    REP(i, N) {
        cin >> X >> V;
        r[i + 1] = {X, V};
    }
    l = r;
    l.push_back(pi(0, 0));
    reverse(ALL(l));
    l.pop_back();
    REP(i, N) {
        l[i + 1].first = C - l[i + 1].first;
    }
    vector<int> rmr(N + 1), rml(N + 1);
    int sumr = 0, suml = 0;
    REP(i, N) {
        sumr += r[i + 1].second;
        suml += l[i + 1].second;
        rmr[i + 1] = max(rmr[i], sumr - r[i + 1].first);
        rml[i + 1] = max(rml[i], suml - l[i + 1].first);
    }
    dump(rmr, rml);
    REP(i, N + 1) {
        int tmpr = rmr[i] + rml[N - i] - r[i].first;
        int tmpl = rmr[N - i] + rml[i] - l[i].first;
        dump(i, tmpr);
        ans = max(ans, max(tmpr, tmpl));
    }
    cout << ans << endl;
}

Measured memory_bytes: 7976
n,m,k = (int(num) for num in input().split())
f_l = [0] * n
b_l = [[] for _ in range(n)]
par = [i for i in range(n)]
rank = [0] * n
size = [1] * n

def find(x):
    if par[x] == x:
        return x
    else:
        return find(par[x])
        
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    elif rank[x] < rank[y]:
        par[x] = y
        size[y] += size[x]
    else:
        par[y] = x
        size[x] += size[y]
        if rank[x] == rank[y]:
            rank[x] += 1
    return
            
def isSame(x,y):
    return find(x) == find(y)

for _ in range(m):
    a,b = (int(num) for num in input().split())
    a -= 1
    b -= 1
    f_l[a] += 1
    f_l[b] += 1
    unite(a,b)
    #print("par:  ", par)
    #print("rank: ", rank)
    
for _ in range(k):
    a,b = (int(num) for num in input().split())
    a -= 1
    b -= 1
    b_l[a].append(b)
    b_l[b].append(a)
    
ans = ""

for i in range(n):
    ans_num = size[find(i)] - f_l[i] -1
    for num in b_l[i]:
        if isSame(i,num):
            ans_num -= 1
    ans_num = max(ans_num,0)
    ans += str(ans_num) + " "
    
print(ans)

Measured memory_bytes: 28812
#include <bits/stdc++.h>
#include <iostream>
// #include <iomanip>

using namespace std;

int main() {
  long long l, r;
  cin >> l >> r;

  long long answer = 2019;
  long long el = min(r, l + 2019);
  for (long long i = l; i <= el; i++) {
    for (long long j = i + 1; j <= el; j++) {
      answer = min(answer, i * j % 2019);
    }
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N;
	scanf("%d", &N);
	int dptable[N + 1];
	fill_n(dptable, N + 1, 0);
	for (int i = 1; i <= N; ++i) {
		for (int j = i; j <= N; j += i) ++dptable[j];
	}
	long long ans = 0;
	for (long long i = 1; i <= N; ++i) ans += i * dptable[i];
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 40784
H, W = map(int, input().split())
pos = 0
for _ in range(H):
    row = input()
    for c in row[:pos]:
        if c == '#':
            print('Impossible')
            exit()
    for i in range(pos, W):
        if row[i] == '#':
            pos = i
        else:
            break
    for c in row[pos + 1:]:
        if c == '#':
            print('Impossible')
            exit()
if pos + 1 == W:
    print('Possible')
else:
    print('Impossible')

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

#define forn(x,n,s) for(int i = x; i < n; i += s )
#define forr(x,n,s) for(int i = x; i>=n; i -= s)
#define PI 3.14159265358979323846264338327950L
#define MOD 1e9+7

using namespace std;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  #ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
  #endif
} 
#define MAX 1000001
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int seive[MAX];
void seive_h(){
    for(int i= 2; i < MAX; i++) seive[i] = i;
    for(int i = 4; i < MAX; i+=2) seive[i] = 2;
    for(int i = 3; i*i < MAX; i++){
        if(seive[i]==i){
            for(int j = i*i ; j < MAX; j += i){
                if(seive[j]==j) seive[j] = i;
            }
        }
    }
}

int main(){
    go(); 

    // code here
    seive_h();
    int n;cin>>n;
    int arr[n];
    for(int i = 0; i < n; i++) cin>>arr[i];
    map<int,int> mp;
    int flag = 0;
    for(int x:arr){
        set<int> st;
        int num = x;
        while(num!=1){
            st.insert(seive[num]);
            num = num / seive[num];
        }
        for(int ni:st) mp[ni]++;
    }
    
    for(auto node:mp){
        if(node.second>1){
            flag = 1;
            break;
        }
    }
    if(flag==0) cout<<"pairwise coprime";
    else{
        int g = 0;
        for(int x:arr) g = gcd(x,g);
        if(g==1) cout<<"setwise coprime";
        else cout<<"not coprime";
    }
} 









Measured memory_bytes: 15156
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
 	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,K;
int a[MAXN],g;
int gcd(int a,int b) {
    return b == 0 ? a : gcd(b,a % b);
}
void Solve() {
    read(N);read(K);
    for(int i = 1 ; i <= N ; ++i) {
	read(a[i]);
	g = gcd(a[i],g);
    }
    for(int i = 1 ; i <= N ; ++i) {
	if(a[i] >= K && (a[i] - K) % g == 0) {
	    puts("POSSIBLE");
	    return;
	} 
    }
    puts("IMPOSSIBLE");
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n, m;
    cin >> n >> m;


    vector<int> h(n);
    rep(i, n){
        cin >> h[i];
    }

    vector<bool> ans(n, true);
    rep(i, m){
        int a, b; cin >> a >> b;
        a--; b--;
        if (h[a] <= h[b]) ans[a] = false;
        if (h[b] <= h[a]) ans[b] = false;
    }



    int cnt = 0;
    rep(i, n){
        if(ans[i]) cnt++;
    }

    cout << cnt << endl;


}





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

int main(){
	int i,n,x,t;
	cin >> n>>x>>t;
	

	if(n%x==0)
		cout << n/x*t <<endl;
	else
		cout << (n/x+1)*t <<endl;

	return 0;
}

Measured memory_bytes: 3592
from collections import deque

N, M = map(int, input().split())
ans = 0
roads = [list(map(int, input().split())) for _ in range(M)]
for i in range(M):
  G = [[]*N for _ in range(N)]
  for j in range(M):
    if j == i:
      continue
    a, b = roads[j]
    G[a-1].append(b-1)
    G[b-1].append(a-1)
  
  stack = deque([0])
  visited = [False] * N
  visited[0] = True
  while stack:
    now = stack.pop()
    for nxt in G[now]:
      if visited[nxt]:
        continue
      visited[nxt] = True
      stack.append(nxt)
      
  for f in visited:
    if not f:
      ans += 1
      break
      
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>
#include <chrono>

using namespace std;
using ll=long long int;

const uint64_t rndbase = 128 + chrono::steady_clock::now().time_since_epoch().count() % 100000;
struct RollingHash {
    using ull = uint64_t;
    static const ull mod = (1LL << 61) - 1;
    vector<ull> hash, power;

    ull mul(ull a, ull b) {
        const ull mask31 = (1LL << 31) - 1;
        const ull mask30 = (1LL << 30) - 1;
        ull ah = a >> 31, al = a & mask31;
        ull bh = b >> 31, bl = b & mask31;
        ull t = ah * bl + al * bh;
        ull th = t >> 30, tl = t & mask30;
        ull ret = (ah * bh << 1) + th + (tl << 31) + al * bl;

        ret = (ret >> 61) + (ret & mod);
        if (ret >= mod) ret -= mod;
        return ret;
    }

    RollingHash(string &s, ull base = rndbase) {
        int n = s.size();
        power.resize(n+1);
        hash.resize(n+1);
        power[0] = 1; hash[0] = 0;
        for (int i = 0; i < n; i++) {
            power[i+1] = mul(power[i], base);
            hash[i+1] = mul(hash[i], base) + s[i];
            if (hash[i+1] >= mod) hash[i+1] -= mod;
        }
    }

    ull get(int l, int r) {
        ull ret = hash[r] + mod - mul(hash[l], power[r - l]);
        if (ret >= mod) ret -= mod;
        return ret;
    }
};

int main() {
    int n;
    cin >> n;
    string s; 
    cin >> s;

    int ans = 0;
    RollingHash rh(s);
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            while (ans < j-i && j+ans < n) {
                int l = ans+1;
                if (rh.get(i, i+l) != rh.get(j, j+l)) break;
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列以外を出力する
    void write(){

    }
    template<typename First, typename... Rest>
    void write(First first, Rest... rest){
        cout << first << " ";
        write(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    string S;
    io.read(S);
    int ans = 0;
    int len = 0;
    for(int i = 0; i < S.size(); i++){
        switch(S[i]){
            case 'A':
            case 'C':
            case 'G':
            case 'T':
            len++;
            break;
            default:
            ans = max(ans, len);
            len = 0;
            break;
        }
    }
    ans = max(ans, len);
    io.write(ans);
    return 0;
}

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

#define SWAP(type,a,b){type t=a;a=b;b=t;}

int main() {
	int N;
	int count=0;
	cin>>N;
	int A[N];
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	
	for(int i=0;i<N;i++){
		int mini=i;
		for(int j=i;j<N;j++){
			if(A[j]<A[mini]){
				mini=j;
			}
		}
		if(i!=mini){
			SWAP(int,A[i],A[mini]);
			count++;	
		}
	}
	cout<<A[0];
	for(int i=1;i<N;i++){
	cout<<" "<<A[i];
	}
	cout<<"\n"<<count<<endl;
	return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Marks | diff Marks.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Marks.cpp && ./a.out

/*

 7/25/2020

 5:13-

 */

const int MAX_N=1e6+1;
LL A[MAX_N];
int N,K;

void solve() {
  FOR(i,K,N) {
    bool res=A[i]>A[i-K];
    cout<<(res?"Yes":"No")<<endl;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N>>K;
  REP(i,N) cin>>A[i];
  solve();

  return 0;
}


Measured memory_bytes: 5212
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n,bbq[201],tot=0;
	cin>>n;
	for (int i=1;i<=2*n;i++)
		cin>>bbq[i];
	sort(bbq+1,bbq+2*n+1);
	for (int i=1;i<=2*n;i+=2)
		tot+=min(bbq[i],bbq[i+1]);
	cout<<tot<<endl;
	return 0;
}

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

#define N 10001

int main(){
  int loop;
  int Counter[N];
  short *Before,*After;
  int i;

  
  scanf("%d",&loop);
  
  Before=malloc(sizeof(short)*loop+1);
  After=malloc(sizeof(short)*loop+1);
  
  for(i=0;i<N+1;i++){
    Counter[i]=0;
  }

  for(i=1;i<loop+1;i++){
    scanf(" %hu",&Before[i]);
    Counter[Before[i]]++;
  }
  
  for(i=1;i<N+1;i++){
    Counter[i]=Counter[i]+Counter[i-1];
  }

  for(i=loop;i>=1;i--){
    After[Counter[Before[i]]]=Before[i];
    Counter[Before[i]]--;
  }

  for(i=1;i<loop;i++){
    printf("%d ",After[i]);
  }

  printf("%d\n",After[loop]);
  
  return 0;
}




Measured memory_bytes: 9564
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let S: String = sc.get();
    let T: String = sc.get();
    println!("{}{}", T, S);
}


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

int main(void){
  ll n,k; cin >> n >> k;
  vector<pair<int,int>> p(n);

  //  k--;

  int a,b;
  rep(i,n){
    cin >> a;
    cin >> b;
    p[i] = make_pair(a,b);
  }
  sort(p.begin(),p.end());

  long long count = 0;
  rep(i,n){
    count += p[i].second;
    if(count>=k){
      cout << p[i].first << endl;
      break;
    }
  }  
  
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	char s[100];
	scanf("%s",s);
	int l=strlen(s);
	long long ans=0;
	for(int i=0;i<(1<<l-1);i++){
		long long now=0,tmp=s[0]-'0';
		for(int j=0;j<l-1;j++){
			if(i&(1<<j)){
				now+=tmp;
				tmp=0;
			}
			else tmp*=10;
			tmp+=s[j+1]-'0';
		}
		now+=tmp;
		ans+=now;
	}
	printf("%lld\n",ans);
	return 0;
}

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

struct ball {
	char c;
	int i;
};

int main() {
	int n;
	cin >> n;
	vector<ball> a(2*n+1);
	vector<int> p0(n+1), p1(n+1);
	for (int i = 1; i <= 2*n; i++) {
		cin >> a[i].c >> a[i].i;
		if (a[i].c == 'W') p0[a[i].i] = i;
		else p1[a[i].i] = i;
	}
	
	vector<vector<int>> cw(2*n+1, vector<int>(n+1));
	vector<vector<int>> cb(2*n+1, vector<int>(n+1));
	for (int i = 1; i <= 2*n; i++) {
		for (int j = 0; j <= n; j++) {
			cw[i][j] = cw[i-1][j] + (a[i-1].i > j && a[i-1].c == 'W');
			cb[i][j] = cb[i-1][j] + (a[i-1].i > j && a[i-1].c == 'B');
		}
	}
	
	vector<vector<int>> dp(n+1, vector<int>(n+1, 1e9));
	dp[0][0] = 0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if (i == 0 && j == 0) continue;
			int x = p0[i], y = p1[j];
			if (i) dp[i][j] = min(dp[i][j], dp[i-1][j] + cw[x][i] + cb[x][j]);
			if (j) dp[i][j] = min(dp[i][j], dp[i][j-1] + cw[y][i] + cb[y][j]);
		}
	}
	
	cout << dp[n][n] << endl;
}

Measured memory_bytes: 81912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
   ll sum=0;
   ll n;
   cin>>n;
   for (ll i=1;i<=n;i++){
    if (i%3==0||i%5==0){
        continue;
    }
    sum+=i;
   }
   cout<<sum;
return 0;
}


Measured memory_bytes: 3636
'use strict'

const main = (INPUT) => {
  const AAry = INPUT.split('\n')[1].split(' ')
  AAry.sort((a, b) => a - b)
  console.log(AAry[AAry.length - 1] - AAry[0])
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 29680
#include<stdio.h>
#include<stdlib.h>

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}

int main()
{
	int i, n, m, ans = 0;
    
	scanf("%d %d", &n, &m);
	
	int x[m], diff[m - 1];
	
	for(i = 0; i < m; i++){
		scanf("%d", &x[i]);
	}
	
	qsort(x, m, sizeof(int), cmp);
	
	for(i = 0; i < m - 1; i++){
		diff[i] = abs(x[i + 1] - x[i]);
	}
	
	qsort(diff, m - 1, sizeof(int), cmp);
	
	for(i = 0; i < m - n; i++){
		ans += diff[i];
	}
	
	printf("%d", ans);
	
	return 0;
}

Measured memory_bytes: 1396
#include<stdio.h>
#include<algorithm>



int main(void){
  int N=0;
  int X[200005];
  int Y[200005];
  int i=0;
  
  scanf("%d",&N);
  for(i=0;i<=N-1;i++){
    scanf("%d",&X[i]);
    Y[i]=X[i];
  }
  
  std::sort(X,X+N);
  
  for(i=0;i<=N-1;i++){
    if(Y[i]>=X[N/2]){printf("%d\n",X[N/2-1]);}
    else{printf("%d\n",X[N/2]);}
  }
  


}



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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int a, b;
    cin >> a >> b;
    cout << max(0, a - 2 * b) << endl;

    return 0;
}


Measured memory_bytes: 256
import Control.Monad

readWords = map read . words <$> getLine

solve :: [Int] -> [(Int -> Bool)] -> [Int]
solve inData conditions
 | null conditions  = inData
 | otherwise        = solve newInData (tail conditions)
   where newInData = filter (head conditions) inData

main = do
 [n,m]    <- readWords :: IO [Int]
 inputStr <- replicateM m readWords
 let conditions = map (\[s,c] x -> (x `div` (10^(n-s))) `mod` 10 == c) inputStr
 print $ (\x -> if null x then -1 else minimum x) $ solve (if n == 1 then [0..9] else [10^(n-1)..((10^n) - 1)]) conditions


Measured memory_bytes: 3912