akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

struct Card{ char suit, value; };

bool operator==(const Card& lhs, const Card& rhs)
{
	return lhs.suit == rhs.suit && lhs.value == rhs.value;
}

void print(Card A[], int N){
	rep(i, N){
		if (i > 0) printf(" ");
		cout << A[i].suit << A[i].value;
	}
	printf("\n");
}

void selectionSort(Card A[], int N){
	int count = 0;
	rep(i, N){
		int minj = i;
		FOR(j, i, N){
			if (A[j].value < A[minj].value)
				minj = j;
		}
		if (i != minj){
			swap(A[i], A[minj]);
			count++;
		}
	}
}

void bubbleSort(Card A[], int N){
	int count = 0;

	bool flag = true;
	while (flag){
		flag = false;
		for (int i = N - 1; i >= 1; i--){
			if (A[i].value < A[i - 1].value){
				swap(A[i], A[i - 1]);
				flag = true;
				count++;
			}
		}
	}
}


bool isStable(Card in[], Card out[], int N){

	FOR(i1, 0, N)
	FOR(i2, i1 + 1, N)
	FOR(o1, 0, N)
	FOR(o2, o1 + 1, N){
		if (in[i1].value == in[i2].value && in[i1] == out[o2] && in[i2] == out[o1])
			return false;
	}
	return true;
}

int main() {

	int N;
	cin >> N;

	const int MAX_N = 10000;
	Card A[MAX_N];

	rep(i, N){ cin >> A[i].suit >> A[i].value; }

	Card C1[MAX_N];
	Card C2[MAX_N];

	rep(i, N){ C1[i] = A[i]; C2[i] = A[i]; }

	bubbleSort(C1, N);
	selectionSort(C2, N);

	print(C1, N);
	cout << (isStable(A, C1, N) ? "Stable" : "Not stable") << endl;
	print(C2, N);
	cout << (isStable(A, C2, N) ? "Stable" : "Not stable") << endl;
}

Measured memory_bytes: 3056
import numpy as np

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

A=np.array(b)
c=A.argsort()

time=0

for i in range(n):
    time=time+a[c[i]]
    if time>b[c[i]]:
        print('No')
        break
    if i==n-1 and time<=b[c[i]]:
        print('Yes')

Measured memory_bytes: 29496
#coding:utf-8

N = int(input())
p = []
max_val = -1
for i in range(N):
    p_i = int(input())
    p.append(p_i)
    max_val = max(max_val, p_i)

s = 0
flag = 0
for p_i in p:
    if p_i == max_val and flag==0:
        s += p_i * 0.5
        flag = 1
    else:
        s += p_i
print(int(s))
        


Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 0) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N;
  std::cin >> N;
  ll n = N;

  ll sum = 0LL;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }

  bool judge = N % sum == 0;
  if (judge) print("Yes");
  else print("No");

  return 0;
}


Measured memory_bytes: 256
/**
*    author:  Dooloper
*    created: 17.09.2020 18:17:42
**/

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <functional>
#include <cassert>

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define PI 3.14159265358979323846264338327950L

int main()
{
    cin.tie(0);
    string S, T;
    cin >> S >> T;

    int currentMin = 100000;
    for (int i = 0; i < S.size() - T.size() + 1; i++)
    {
        int cnt = 0;
        for (int j = 0; j < T.size(); j++)
        {
            if(S[i+j] != T[j])
                cnt++;
        }
        currentMin = min(cnt, currentMin);
    }
    cout<<currentMin <<endl;

    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> Q;

int main() {
	int m, t, p, r;

	while (cin >> m >> t >> p >> r) {
		if (m == 0 && t == 0 && p == 0 && r == 0) {
			break;
		}

		vector<Q> krank(t);

		for (int i = 0; i < t; i++) {
			krank[i] = Q(0, P(0, i + 1));
		}

		vector< vector<int> > wa(t, vector<int>(p, 0));

		int mm, tt, pp, jj;

		for (int i = 0; i < r; i++) {
			cin >> mm >> tt >> pp >> jj;
			if (jj == 0) {
				krank[tt - 1].first++;
				(krank[tt - 1].second).first -= mm;
				(krank[tt - 1].second).first -= 20 * wa[tt - 1][pp - 1];
			}
			else {
				wa[tt - 1][pp - 1]++;
			}
		}

		sort(krank.begin(), krank.end(), greater<Q>());

		cout << (krank[0].second).second;
		for (int i = 1; i < t; i++) {
			if (krank[i].first == krank[i - 1].first) {
				if ((krank[i].second).first == (krank[i - 1].second).first) {
					cout << '=' << (krank[i].second).second;
				}
				else {
					cout << ',' << (krank[i].second).second;
				}
			}
			else {
				cout << ',' << (krank[i].second).second;
			}
		}
		cout << endl;

	}

	return 0;
}


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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(auto&& i : a){
        cin >> i;
    }
    int ans = 1e9 + 7;
    for(int i = 0; i + k <= n; i++){
        if(a[i + k - 1] <= 0){
            ans = min(ans, abs(a[i]));
        }else if(0 <= a[i]){
            ans = min(ans, a[i + k - 1]);
        }else{
            ans = min(ans, min(-a[i], a[i + k - 1]) * 2 + max(-a[i], a[i + k - 1]));
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 640
N, Ma, Mb = map(int, input().split())
L = [[float("inf")]*410 for i in range(410)]
P = [[0, 0]]
L[0][0] = 0

for i in range(N):
    a, b, c = map(int, input().split())
    OldP = P.copy()
    Lsub = [L[p[0]][p[1]] for p in OldP]
    for xp, p in enumerate(OldP):
        if L[p[0]+a][p[1]+b] == float("inf"):
            P.append([p[0]+a, p[1]+b])
        L[p[0]+a][p[1]+b] = min(L[p[0]+a][p[1]+b], Lsub[xp]+c)
g = [Ma, Mb]
ans = float("inf")
while g[0]<410 and g[1]<410:
    ans = min(ans, L[g[0]][g[1]])
    g[0] += Ma
    g[1] += Mb
print(ans if ans != float("inf") else -1)


Measured memory_bytes: 8280
S = list(input()) #YYMM 1905  MMYY 0519
i1 = int(''.join(S[:2]))
i2 = int(''.join(S[2:]))
if (i1 >0) and (i1 < 13 ):#i1 MMYY or YYMM
    if ( i2 > 0) and ( i2 < 13):#i2 MMYY or YYMM
        print('AMBIGUOUS')
    else:#MMYY
        print('MMYY')

else:#i1 YYMM or YYYY
    if ( i2 > 0) and ( i2 < 13):
        print('YYMM')
    else:
        print('NA')

Measured memory_bytes: 3060
/*
    @uthor: Amit Kumar
    user --> CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"\Case #"<<x<<"\:"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

ll odd_digits(int n) 
{ 
    if (n < 10) 
        return n; 
    else if (n / 10 < 10) 
        return 9; 
    else if (n / 100 < 10) 
        return 9 + n - 99; 
    else if (n / 1000 < 10) 
        return 9 + 900; 
    else if (n / 10000 < 10) 
        return 909 + n - 9999; 
    else
        return 90909; 
} 


void virus(){
        ll num;
        cin>>num;
        cout<<odd_digits(num);
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t=1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(x) for x in input().split()]
n1 = 0
n2 = 0
n4 = 0

for a in A:
  if a&1:
    n1 += 1
  elif a%4==0:
    n4 += 1
  else:
    n2 += 1

 
bl = True
# n1 <= n4なら、141414と並べてあとは適当
if n1 > n4:
  #1414...141のときだけ
  if not(n1 == n4 + 1 and n2 == 0):
    bl = False

answer = 'Yes' if bl else 'No'
print(answer)


Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <cstdlib>
typedef long long ll;
#define fi first
#define se second
 
using namespace std;
 
int main(){
 
    int a,b,c;
    cin >> a >> b >> c;

    ll n = 100000000;
    ll ans = 0;
    for(ll i=0;i<n;i++){
        if(a%2 || (b%2 || c%2)){
            cout << ans;
            return 0;
        }
        int aa,bb,cc;
        aa = b/2 + c/2;
        bb = a/2 + c/2;
        cc = a/2 + b/2;
        a = aa;
        b = bb;
        c = cc;
      	ans++;
    }
    cout << -1;
    return 0;
}

Measured memory_bytes: 256
import math
from collections import defaultdict
from bisect import bisect_right

def trial_division(n):
    factor = defaultdict(int)
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            factor[num] += 1
    factor[n] += 1
    return factor


n = int(input())
r = trial_division(n)
check = [i for i in range(1, 101)]
for i in range(len(check)-1):
    check[i+1] += check[i]

ans = 0
for k, v in r.items():
    if k == 1:
        continue

    ans += bisect_right(check, v)

print(ans)




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

int main()
{
    uint32_t N;
    cin >> N;

    map<string, uint32_t> map;
    while (true)
    {
        if (N == 0)
        {
            break;
        }
        
        string s;
        cin >> s;

        map[s] = map[s] + 1;

        N = N - 1;
    }

    for (string s: {"AC", "WA", "TLE", "RE"})
    {
        cout << s << " x " << map[s] << endl;
    }
}

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

int main()
{
    int n;
    vector<int> car;
    while (cin >> n) {
        if (n) {
            car.push_back(n);
        }
        else {
            cout << car.back() << endl;
            car.pop_back();
        }
    }
    return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;

typedef long long int ll;
 
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 

 
const ll N = 100005;
const ll mod = 998244353;
const long long int inf = 10e17;
#define pp pair<ll,ll>

typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
 
const ld pi = 3.14159265359;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

 
void fastIO(void);
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);

ll p[N],q[N],r[N];

int main()
{
	ll x,y,a,b,c;
	priority_queue<pp> pq;
	cin>>x>>y>>a>>b>>c;
	ll n = x+y;
	ll t;
	rep(i,a){
		cin>>t;
		pq.push({t,1});
	}
	rep(i,b){
		cin>>t;
		pq.push({t,2});
	}
	rep(i,c){
		cin>>t;
		pq.push({t,3});
	}
	ll sum = 0;
	while(n!=0){
		a = pq.top().first;
		b = pq.top().second;
		pq.pop();
		if(b==1){
			if(x!=0){
				x--;
				n--;
				sum+=a;
			}
			continue;
		}
		if(b==2){
			if(y!=0){
				y--;
				n--;
				sum+=a;
			}
			continue;
		}
		if(b==3){
			n--;
			sum+=a;
			continue;
		}
	}
	cout<<sum<<endl;
}

	


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}

Measured memory_bytes: 10348
S = list(raw_input())
T = list(raw_input())
# print(S, len(S), len(set(S)))
# print(T, len(T), len(set(T)))

corr = {}
for i, s in enumerate(S):
    if s in corr.keys() and corr[s] != T[i]:
        print("No")
        exit(0)
    corr[s] = T[i]

corr = {}
for i, t in enumerate(T):
    if t in corr.keys() and corr[t] != S[i]:
        print("No")
        exit(0)
    corr[t] = S[i]

print("Yes")


Measured memory_bytes: 5924
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    char c;cin>>c;
    cout<<((c=='a'||c=='i'||c=='u'||c=='o'||c=='e')?"vowel":"consonant")<<endl;return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;



int main() {
	int A;
	int B;
	cin >> A;
	cin >> B;

	if (1 <= A && A<= 9 && 1 <= B && B<= 9) { cout <<A*B; }
	else { cout << -1; }

	system("PAUSE");
}


Measured memory_bytes: 504
#include <stdio.h>
#include <string.h>
int main(){
  int i=0,j=0;
  char s[110],k[]="keyence";
  scanf("%s",s);
  int l=strlen(s);
  while(i<7&&s[i]==k[i])i++;
  while(j<7&&s[l-1-j]==k[6-j])j++;
  if(i+j>=7) puts("YES");
  else puts("NO");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
map < int , int > a;
int main() {
    int n, ans = 0; scanf("%d", &n);
    for (int t; n--;)
        scanf("%d", &t), ++a[t];
    for (map < int , int > :: iterator it = a.begin(); it != a.end(); ++it) {
        if (it->second < it->first) ans += it->second;
        else if (it->second > it->first) ans += it->second - it->first;
    } printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int sum=0;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  int k=0;
  int ans=sum;
  for(int i=0;i<n;i++){
    sum-=a[i];
    k+=a[i];
    if(abs(sum-k)<ans){ans=abs(sum-k);}
  }
  cout<<ans;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String mozi = scan.next();
		char[] c = mozi.toCharArray();

		for(char c1:c) {
			c1++;
			System.out.println(c1);
		}

		scan.close();

	}

}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  int ans;
  int mx = 0;
  REP(i,n){
    int a,b; cin >> a >> b;
    if(mx < a){
      mx = a;
      ans = a + b;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int x, r, m = 100;
  scanf("%d", &x);
  r = x % 100;
  for(int i = 0; i * 5 <= r; i++)
    for(int j = 0; i * 5 + j * 4 <= r; j++)
      for(int k = 0; i * 5 + j * 4 + k * 3 <= r; k++)
        for(int l = 0; i * 5 + j * 4 + k * 3 + l * 2 <= r; l++)
          m = min(m, r - (i * 4 + j * 3 + k * 2 + l));
  printf("%d\n", m <= x / 100);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <queue>
#include <vector>
using namespace std;

int main(void) {
  int i, n, m, a, b;
  scanf("%d%d", &n, &m);
  queue<int> q, qt;
  bool flg[n];
  for(i = 0; i < n; ++i) flg[i] = true;
  char s[n + 10];
  scanf("%s", s);
  int an[n], bn[n];
  vector<int> vec[n];
  for(i = 0; i < n; ++i) an[i] = bn[i] = 0;
  for(i = 0; i < m; ++i) {
    scanf("%d%d", &a, &b);
    a--, b--;
    vec[a].push_back(b);
    if(a != b) vec[b].push_back(a);
    if(s[a] == 'A') an[b]++;
    else bn[b]++;
    if(a != b) {
      if(s[b] == 'A') an[a]++;
      else bn[a]++;
    }
  }
  for(i = 0; i < n; ++i) if(!an[i] || !bn[i]) q.push(i), flg[i] = false;
  while(!q.empty()) {
    while(!q.empty()) {
      int t = q.front();
      q.pop();
      for(i = 0; i < vec[t].size(); ++i) if(flg[vec[t][i]]) {
         if(s[t] == 'A') an[vec[t][i]]--;
         else bn[vec[t][i]]--;
         if(!an[vec[t][i]] || !bn[vec[t][i]]) flg[vec[t][i]] = false, qt.push(vec[t][i]);
      }
    }
    while(!qt.empty()) q.push(qt.front()), qt.pop();
  }
  for(i = 0; i < n; ++i) if(flg[i]) {
    printf("Yes");
    return 0;
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 12288
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;cin>>n>>k;
    vector<ll> a(n), csum(n+1,0);
    map<ll,ll> count;
    rep(i,n){
        cin>>a[i];
        a[i] = (a[i]-1) % k;
    }
    rep(i,n) {
        csum[i+1] = (csum[i] + a[i]) % k;
    }
    ll res = 0;
    rep(i,n) {
        if (i>=k-1){
            count[csum[i+1-k]]--;
        }
        res += count[csum[i+1]];
        count[csum[i+1]]++;
        if (csum[i+1]==0) {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 15872
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const int MOD = 1e9+7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

int main()
{
    int n;
    string s[3];

    cin >> n;
    rep(i, 3) cin >> s[i];

    int ans = 0;
    rep(i, n) {
        int cnt = 0;
        set<char> st;
        rep(j, 3) st.insert(s[j][i]);
        
        ans += st.size() - 1;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

/**
 * Created by Admin on 2017-08-13.
 */

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        char[] tablice = input.next().toCharArray();
        boolean[] tablica = new boolean[26];
        for (int i = 0; i < tablice.length; ++i) {
            char x = tablice[i];
            tablica[x - 'a'] = true;
        }

        for (int i = 0; i < 26; ++i) {
            if (tablica[i] == false) {
                System.out.println((char) (i + 'a'));
                
                return;

            }

        }
        System.out.println("None");
    }
    
}






Measured memory_bytes: 25556
a = [int(input()) for x in range(5)]
sum = 0
b = []
for i in range(5):
    if a[i]%10 == 0:
        sum += a[i]
    else:
        c = a[i] + (10 -a[i]%10)
        sum += c
        b.append(a[i]%10)
if b != []:
    b.sort()
    sum -= 10 - b[0]
print(sum)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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 int MAX_N=1e5+10;

int N;
vector<vector<int>> G(MAX_N);
vector<int> grundy(MAX_N,0);

void dfs(int v,int p){
    for (auto nv:G[v]){
        if (nv==p) continue;
        dfs(nv,v);
        grundy[v]^=grundy[nv]+1;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    rep(i,N-1){
        int x,y; cin >> x >> y; --x,--y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    dfs(0,-1);
    if (grundy[0]!=0) cout << "Alice" << endl;
    else cout << "Bob" << endl;
}

Measured memory_bytes: 12416
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
//スタート点,頂点数、辺を渡して、最短経路の配列を返す
std::vector<LL> dijkstra(int s,int N,vector<vector<Edge>> Edges){
    vector<LL> d;
    priority_queue<pair<int,int> ,vector<pair<int,int>>,greater<pair<int,int>>> que;
    REP(a,N+10){
        d.push_back(LINF);
    }
    d[s]=0;
    que.push(make_pair(0,s));
    while(!que.empty()){
        pair<int,int> p = que.top();que.pop();
        int v = p.second;
        if(d[v]<p.first)continue;
        for(int  i = 0;i < Edges.at(v).size();i++){
            Edge e = Edges.at(v).at(i);
            if(d.at(e.to)>d.at(v)+e.value){
                d.at(e.to)=d.at(v)+e.value;
                que.push(make_pair(d.at(e.to),e.to));
            }
        }
    }
    return d;
}

int main(){
    CIN(N);CIN(M);CIN(R);
    V<LL> vec;
    REP(a,R){
        CIN(b);
        vec.pb(b);
    }
    vector<vector<Edge>> Edges(N+10);
    REP(a,M){
        CIN(b);CIN(c);CIN(d);
        Edge e(b,c,d);
        Edge f(c,b,d);
        Edges.at(b).push_back(e);
        Edges.at(c).push_back(f);
    }
    LL mass[N+10][N+10];
    for(int a = 1;a <= N;a++){
        V<LL> v = dijkstra(a,N,Edges);
        for(int b = 1;b <= N;b++){
            mass[a][b]=v.at(b);
        }
    }
    LL ans = LINF;
    sort(ALL(vec));
    do{
        int s = vec.front();
        FOREACH(a,vec){
           // cout<<a<<" ";
        }
       // cout<<endl;
        LL mos = 0;
        for(int a = 0;a < R;a++){
            mos+=mass[vec.at(a)][s];
            s=vec.at(a);
        }
        ans = min(mos,ans);
    }while(next_permutation(ALL(vec)));
    COUT(ans);
    return 0;
}


Measured memory_bytes: 1752
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int A=sc.nextInt(),B=sc.nextInt();
	 if(A+B>=A-B&&A-B>=A*B) {
		 System.out.println(A+B);
	 }else if(A+B>=A*B&&A*B>=A-B) {
		 System.out.println(A+B);
	 }else if(A-B>=A+B&&A+B>=A*B) {
		 System.out.println(A-B);
	 }else if(A-B>=A*B&&A*B>=A+B) {
		 System.out.println(A-B);
	 }else if(A*B>=A+B&&A+B>=A-B) {
		 System.out.println(A*B);
	 }else if(A*B>=A-B&&A-B>=A+B) {
		 System.out.println(A*B);
	 }
	 
	 
	
	 
	 
	 
 }
	


}



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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

int gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}

int n, m, q;
vector<int> a,b,c,d;
int ans = 0;
vector<int> A(110, 1);

void dfs(int k){
  if (k == n+1){
    int now=0;
    REP(i, q){
      if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }
  else{
    for (int i=A[k]; i<=m; i++){
      A[k+1] = i;
      dfs(k+1);
    }
    }
  }


int main(void){
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  REP(i, q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U & u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U & u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,M;
	cin >> N;
	vector<string> U(N);
	REP(i, N) {
		cin >> U[i];
	}
	cin >> M;
	bool lock = true;
	REP(i, M) {
		string T;
		cin >> T;
		if (find(ALL(U), T) != U.end()) {
			if (lock) {
				cout << "Opened by " << T << endl;
				lock = false;
			}
			else {
				cout << "Closed by " << T << endl;
				lock = true;
			}
		}
		else {
			cout << "Unknown " << T << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3244
N = int(input())
a = list(map(int, input().split()))
a.sort()
A = max(a)
b = [0]*A
for i in range(N):
  if b[a[i]-1] == 0:
    for j in range(a[i], A+1, a[i]):
      b[j-1] += 1
  elif b[a[i]-1] == 1:
      b[a[i]-1] += 1
n = 0      
for i in range(N):
  if b[a[i]-1] == 1:
    n += 1
print(n)

Measured memory_bytes: 33340
n = input()
list = list(map(int, input().split()))

count = 0
can = True
while can:
  for i in range(0, int(n)):
    a = list[i]
    if a % 2 == 0:
      list[i] = a / 2
    else:
      can = False
  if can == True:
    count += 1
print(count)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int a,b;
    cin >> a >> b;
    if(a+b>9){
        put("error");
    }else{
        put(a+b);
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  char s[15],t[15],u[15];
  int a,b;
  
  scanf("%s",s);
  scanf("%s",t);
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%s",u);
  
  if(strcmp(s,u)==0)
    a--;
  else if(strcmp(t,u)==0)
    b--;
  
  printf("%d %d\n",a,b);
  
  return 0;
}

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

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

    static class Bouquet {
        public static long MOD = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();

            long result = modSub(modPow(2, n, MOD), 1, MOD);
            result = modSub(result, com(n, a, MOD), MOD);
            result = modSub(result, com(n, b, MOD), MOD);
            out.println(result % MOD);
        }

        static long modSub(long x, long n, long mod) {
            long v = x - n;
            if (v < 0) {
                v += mod;
            }
            return v % mod;
        }

        static long modPow(long x, long n, long mod) {
            if (n == 0) {
                return 1;
            }
            long result = modPow(x, n / 2, mod);

            if (n % 2 == 0) {
                return (result * result) % mod;
            }
            return (((result * result) % mod) * x) % mod;
        }

        static long modInv(long a, long mod) {
            return modPow(a, mod - 2, mod);
        }

        static long modDiv(long a, long b, long mod) {
            return a * modInv(b, mod) % mod;
        }

        static long com(long n, long k, long mod) {

            long a = 1, b = 1;
            for (int i = 0; i < k; i++) {
                a = a * (n - i) % mod;
                b = b * (i + 1) % mod;
            }
            return modDiv(a, b, mod);
        }

    }
}



Measured memory_bytes: 35788
n = int(input())
a = list(map(int, input().split()))
d = {}
e = 0
for ai in a:
  s = ai // 400
  if s > 7:
    e += 1
  else:
    if s in d:
      d[s] += 1
    else:
      d[s] = 1
print(max(1, len(d)), len(d) + e)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
    
   int n;
   cin>>n;
   int a[100002];
   int sum=0;
   int SUM;
   int temp;

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


   for(int i=1;i<n+2;i++){
      sum+=abs(a[i]-a[i-1]);
   }
   for(int i=1;i<n+1;i++){
       SUM = sum-((abs(a[i+1]-a[i])+abs(a[i]-a[i-1]))-(abs(a[i+1]-a[i-1])));
       cout<<SUM<<endl;
   }
   return 0;

}

Measured memory_bytes: 1664
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n;
int a[200005];
int b[200005];

bool C(int v){
	for(int i=0;i<n*2-1;i++){
		if(a[i]<v){
			b[i]=0;
		}else{
			b[i]=1;
		}
	}
	vector<PP> vec;
	int cnt=1;
	for(int i=1;i<n*2-1;i++){
		if(b[i-1]==b[i])cnt++;
		else{
			if(cnt>=2){
				vec.push_back(PP(i-1,P(b[i-1],cnt)));
				cnt=1;
			}
		}
	}
	if(cnt>=2){
		vec.push_back(PP(n*2-2,P(b[n*2-2],cnt)));
	}
	if(vec.size()==0){
		int c=n-1;
		return (((c+b[n-1])%2)==1);
	}
	cnt=1;
	bool flag2=false;
	for(int i=1;i<n*2-1;i++){
		if(b[i-1]!=b[i]){
			cnt++;
		}else{
			if(!flag2 && cnt>=2){
				vec[0].second.second+=cnt-1;
			}
			if(flag2 && cnt>=3){
				int l=lower_bound(vec.begin(),vec.end(),PP(i,P(0,0)))-vec.begin();
				if(cnt%2==0){
					vec[l-1].second.second+=(cnt-2)/2;
					vec[l].second.second+=(cnt-2)/2;
				}else{
					vec[l-1].second.second+=cnt-2;
				}
			}
			flag2=true;
			cnt=1;
		}
	}
	int now=0;
	for(int i=0;i<vec.size();i++){
		now+=vec[i].second.second;
		if(now>=n)return (vec[i].second.first==1);
	}
	return false;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n*2-1;i++){
		scanf("%d",&a[i]);
		a[i]--;
	}
	int l=0,r=2*n-1;
	while(l+1<r){
		int mid=(l+r)/2;
		if(C(mid))l=mid;
		else r=mid;
	}
	printf("%d\n",l+1);
	return 0;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m,i,j,k,l;
    scanf("%lld",&n);
    m=n;
    n*=100;
    n/=108;
    j=n+1;
    k=j;
  //  printf("%lld %lld",j,n);
    j*=108;
    j/=100;
    l=n;
    n*=108;
    n/=100;
    if(j!=m && n!=m)
        printf(":(");
    else{
        if(n==m)
        printf("%lld",l);
    else
        printf("%lld",k);
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

struct aa {
	int to;
	int time;
};
class Compare {
public:
	//keiroが昇順に並ぶ
	bool operator()(const aa&l, const aa&r) {
		return l.time> r.time;
	}
};

int main() {
	int N, M, S, T; cin >> N >> M >> S >> T;
	S--; T--;
	vector<vector<int>>edges(N);
	for (int i = 0; i < M; ++i) {
		int f, t; cin >> f >> t;
		f--; t--;
		edges[f].push_back(t);
		edges[t].push_back(f);
	}

	vector<int>starttimes(N, 999499);
	vector<long long int >starttimenum(1100000);
	{
		priority_queue<aa, vector<aa>, Compare>que;
		que.push(aa{ S,0 });
		while (!que.empty()) {
			aa atop(que.top());
			que.pop();
			starttimes[atop.to] = atop.time;
			for (auto i : edges[atop.to]) {
				if (starttimes[i] > atop.time + 1) {
					starttimes[i] = atop.time + 1;
					que.push(aa{ i,atop.time + 1 });
				}
			}
		}
		for (int i = 0; i < starttimes.size(); ++i) {
			starttimenum[starttimes[i]]++;
		}
	}
	vector<int>goaltimes(N, 999499);
	vector<long long int >goaltimenum(1100000);
	{
		priority_queue<aa, vector<aa>, Compare>que;
		que.push(aa{ T,0 });
		while (!que.empty()) {
			aa atop(que.top());
			que.pop();
			goaltimes[atop.to] = atop.time;
			for (auto i : edges[atop.to]) {
				if (goaltimes[i] > atop.time + 1) {
					goaltimes[i] = atop.time + 1;
					que.push(aa{ i,atop.time + 1 });
				}
			}
		}
		for (int i = 0; i < goaltimes.size(); ++i) {
			goaltimenum[goaltimes[i]]++;
		}
	}

	int fintime = starttimes[T];

	long long int ans = 0;
	for (int i = 0; i < fintime-1; ++i) {
		ans += starttimenum[i] * goaltimenum[fintime-i-2];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 27916
using System;

namespace abc101A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int A = 0;
            string temp;
            for(int i = 0; i < 4; i++)
            {
                temp = S.Substring(i, 1);
                if (temp == "+")
                    A += 1;
                else
                    A -= 1;
            }
            Console.WriteLine(A);
        }
    }
}


Measured memory_bytes: 11092
// abc093-b
object Main extends App {
  val Array(a,b,k) = io.StdIn.readLine.split(" ").map(_.toInt)

  val l1 = (a to b).take(k)
  val l2 = (a to b).takeRight(k)
  val result = (l1 ++ l2).distinct
  result foreach println
}

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

using namespace std;
using ll = long long;


int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int cur = 100000000;
    int cnt = 0;

    for(int i = 0; i < n; i++) {
        if(a[i] <= cur) {
            cur = a[i];
            cnt++;
        }
    }
    cout << cnt << endl;
}

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


struct union_find {
    vector<ll> par;
    vector<ll> rank;
    vector<ll> count;

    union_find(ll n) : par(n, 0), rank(n, 0), count(n, 1) {
        for(ll i = 0; i < n; ++i){ par.at(i) = i; }
    }

    ll find(ll x){
        if(par.at(x) == x){
            return x;
        }else{
            return par.at(x) = find(par.at(x));
        }
    }

    void unite(ll x, ll y){
        x = find(x);
        y = find(y);
        if(x == y){ return; }
        if(rank.at(x) < rank.at(y)){
            par.at(x) = y;
        }else{
            par.at(y) = x;
            if(rank.at(x) == rank.at(y)){
                rank.at(x)++;
            }
        }

        ll new_count = count.at(x) + count.at(y);
        count.at(find(x)) = new_count;
    }

    bool same(ll x, ll y){
        return find(x) == find(y);
    }

    ll size(ll x){
        return count.at(find(x));
    }
};


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

    union_find uf(n);
    vector<ll> fnum(n, 0);
    REP(i, m){
        ll ai, bi;
        cin >> ai >> bi;
        ai--; bi--;
        uf.unite(ai, bi);
        fnum.at(ai)++;
        fnum.at(bi)++;
    }
    vector<ll> ans(n);
    REP(i, n){
        ans.at(i) = uf.size(i) - fnum.at(i) - 1;
    }
    REP(i, k){
        ll ci, di;
        cin >> ci >> di;
        ci--; di--;
        if(uf.same(ci, di)){
            ans.at(ci)--;
            ans.at(di)--;
        }
    }
    REP(i, n){
        cout << ans.at(i);
        if(i + 1 < n){
            cout << ' ';
        }else{
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4736
n=input()
for t in xrange(n):
	a=map(int,raw_input().split())
	pos=range(1,11)
	for i in xrange(len(a)):
		pos[a[i]-1]=i
	left=right=-1
	for i in xrange(len(pos)):
		if(left<pos[i]):
			left=pos[i]
		elif(right<pos[i]):
			right=pos[i]
		else:
			print "NO"
			break
	else:
		print "YES"

Measured memory_bytes: 6236
/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;
int main(){
long long x, a = 100;
cin >> x;
int sum = 0;
while(a < x){
	long long s = a * 1 / 100;
	a += s;
	sum++;
}
cout << sum;
return 0;
}

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

int main()
{
    size_t N;
    cin >> N;

    vector<long long> A(N + 1);
    for (long long &a : A)
    {
        cin >> a;
    }

    vector<long long> dp(N + 1, 0);
    dp[N] = A[N];
    vector<long long> limit(N + 1, 0);
    limit[0] = 1 - A[0];
    if (limit[0] < 0)
    {
        cout << -1 << endl;
        return 0;
    }
    for (size_t i = 1; i <= N; i++)
    {
        limit[i] = min(2 * limit[i - 1] - A[i], (long long)1e17);
        if (limit[i] < 0)
        {
            cout << -1 << endl;
            return 0;
        }
    }

    long long ans = dp[N];
    for (size_t i = N - 1; i < N; i--)
    {
        long long target = dp[i + 1];
        if (2 * limit[i] < target)
        {
            cout << -1 << endl;
            return 0;
        }
        dp[i] = min(target, limit[i]) + A[i];
        ans += dp[i];
    }
    cout << ans << endl;
}


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

template<typename T> struct Mod {
  vector<T> fact, factInv;
  Mod() {}
  Mod(T n, T p = 1e9 + 7) : fact(n + 1), factInv(n + 1) {
    fact[0] = 1;
    for (T i = 1; i < n + 1; ++i) fact[i] = fact[i - 1] * i % p;
    for (T i = 0; i < n + 1; ++i) factInv[i] = modPow(fact[i], p - 2, p);
  }
  T extGcd(T a, T b, T& x, T& y) {
    T d = a;
    if (b) {
      d = extGcd(b, a % b, y, x);
      y -= (a / b) * x;
    } else {
      x = 1, y = 0;
    }
    return d;
  }
  T modInv(T a, T m) {
    T x, y;
    extGcd(a, m, x, y);
    return (m + x % m) % m;
  }
  T modFact(T n, T p, T& e) {
    e = 0;
    if (!n) return 1;
    T res = modFact(n / p, p, e);
    e += n / p;
    T s = (n / p % 2) ? p - fact[n % p] : fact[n % p];
    return res * s % p;
  }
  T modComb(T n, T k, T p) {
    if (n < 0 || k < 0 || n < k) return 0;
    T e1, e2, e3;
    T a1 = modFact(n, p, e1);
    T a2 = modFact(k, p, e2);
    T a3 = modFact(n - k, p, e3);
    if (e1 > e2 + e3) return 0;
    return a1 * modInverse(a2 * a3 % p, p) % p;
  }
};

int main() {
  int a, b; cin >> a >> b;
  Mod<int> md;
  int x, y;
  md.extGcd(a, b, x, y);
  cout << x << ' ' << y << endl;
  return 0;
}



Measured memory_bytes: 3108
#include<cstdio>
#include<algorithm>
#define LL long long 
using namespace std;
LL a[200010],t1,t2,t3,t4,t,ans;
int n,l,r;
void pan(LL x,LL y,LL x1,LL y1)
{
	if (x<y) swap(x,y);
	if (x1<y1) swap(x1,y1);
	t=min(t,max(max(x-y,x1-y1),max(abs(x-y1),abs(x1-y))));
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		a[i]=a[i-1]+a[i];
	}
	l=1;
	r=3;
	ans=10000000000000000;
	for (int i=2;i<=n-2;i++)
	{
		while ((a[i]-a[l+1])>=a[l+1]&&l<i) l++;
		if (r<=i) r=i+1;
		while ((a[r+1]-a[i])<=a[n]-a[r+1]&&r<n) r++; 
		t1=a[i]-a[l];
		t2=a[l];
		t3=a[n]-a[r];
		t4=a[r]-a[i];
		t=100000000000000000;
		pan(t1,t2,t3,t4);
		if (l<i-1) pan(t2+a[l+1]-a[l],t1-(a[l+1]-a[l]),t3,t4);
		if (l<i-1&&r<n-1) pan(t2+a[l+1]-a[l],t1-(a[l+1]-a[l]),t4+a[r+1]-a[r],t3-(a[r+1]-a[r]));
		if (r<n-1) pan(t1,t2,t4+a[r+1]-a[r],t3-(a[r+1]-a[r]));
		ans=min(ans,t);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1664