akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main()
{
    ll d, g;
    cin >> d >> g;
    ll p[d];
    ll c[d];
    for (ll i = 0; i < d; i++)
    {
        cin >> p[i] >> c[i];
    }
    ll ans = infll;
    for (ll bit = 0; bit < (1 << d); bit++)
    {
        ll cnt = 0;
        ll sum = 0;
        ll rest = -100000000000;
        for (ll i = 0; i < d; i++)
        {
            if (bit & (1 << i))
            {
                cnt += p[i];
                sum += p[i] * (i + 1) * 100;
                sum += c[i];
            }
            else
            {
                chmax(rest, i);
            }
        }
        if (sum >= g)
        {
            chmin(ans, cnt);
        }
        else if (rest >= 0)
        {
            if (sum + p[rest] * (rest + 1) * 100 > g)
            {
                cnt += amarinasi(g - sum, (rest + 1) * 100);
                chmin(ans, cnt);
            }
        }
    }
    cout << ans << endl;
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int main()
{
    int D, T,S;
    cin >> D >> T >> S;
    if((double)D/S<=T){
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3612
#include <cstdio>

using namespace std;
typedef long long llong;

#define MAX
const llong mod = 1000000000 + 7;

int main()
{
  llong X;
  scanf("%lld", &X);
  llong gold1, gold2;

  gold1 = X / 500;
  gold2 = (X - 500 * gold1) / 5;

  printf("%lld", 1000 * gold1 + 5 * gold2);

  return 0;
}

Measured memory_bytes: 1708
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

int main()
{
    int a, b;
    cin >> a >> b;

    if (b == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    int ans = 1;
    int num = a;
    while (num < b)
    {
        num += (a - 1);
        ans++;
    }
    
    cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    int a[n];
    for (auto &x : a) cin >> x;
    int cnt = 0;
    sort(a, a + n);
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            for (int k = j + 1; k < n; ++k) {
                if (a[i] != a[j] && a[j] != a[k] && a[k] != a[i]) {
                    if (a[i] + a[j] > a[k]) cnt++;
                }
            }
        }
    }

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

Measured memory_bytes: 3640
#include<stdio.h>

static const int MAX = 500;
static const int INFTY = (1<<21);

int main(void){
    int n, i, j, e, sum;
    int u,m;
    /*your code*/
    int M[MAX][MAX];
    int d[MAX];
    int key[MAX],PI[MAX];
  scanf("%d", &n);

  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      scanf("%d", &e);
      M[i][j] = (e==-1)?INFTY:e;
    }
  }

  /*your code*/
    for(i=0;i<n;i++){
        PI[i]=-1;
        key[i]=INFTY;
        d[i]=0;
    }
    
    
    
    key[0]=0;
    
    while(1){
        u=-1;
        m=INFTY;
        
        for(i=0;i<n;i++){
            if(m>key[i] && (d[i]==0)){
                u=i;
                m=key[i];
            }
        }
        
        
        
        
        if(u==-1)break;
        d[u]=1;
        
        
        
        for(i=0;i<n;i++){
            if(key[i]>=M[u][i] && (d[i]==0)){
                PI[i]=u;
                key[i]=M[u][i];
            }
            
        }
        
        //d[b]=1;
        
    }
    
    
    
    

  sum = 0;

  for ( i = 0; i < n; i++ ){
    if ( PI[i] != -1 ) sum += M[i][PI[i]];
  }

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

  return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  int nokori;
  int kekka = 0;
  for(int i = 0;i <= N/4;i++){
    nokori = N - 4*i;
    if(nokori % 7 == 0){
      kekka++;
    }
  }
  
  if(kekka != 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
   

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

int n, k;
int main() {
    cin >> n >> k;
    double ans = 0;
    for(int i=1; i<=n; i++) {
        if(i>=k) ans += 1.0/n;
        else {
            int c=1;
            while(i*c<k) {
                c<<=1;
            }
            ans += ((double)1.0/n)*((double)1.0/c);
        }
    }

    cout << setprecision(12) << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <map>

struct UnionFind
{
    std::vector<int> parent; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int n) : parent(n)
    {
        //最初は全てが根であるとして初期化
        for (int i = 0; i < n; i++)
        {
            parent[i] = i;
        }
    }

    // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    int root(int x)
    {
        if (parent[x] == x)
        {
            return x;
        }
        return parent[x] = root(parent[x]);
    }

    // xとyの木を併合
    void unite(int x, int y)
    {
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry)
            return;      //xとyの根が同じ(=同じ木にある)時はそのまま
        parent[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    // 2つのデータx, yが属する木が同じならtrueを返す
    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

namespace std
{
    template <>
    class hash<std::pair<int, int>>
    {
    public:
        size_t operator()(const std::pair<int, int> &x) const
        {
            return hash<int>()(x.first) ^ hash<int>()(x.second);
        }
    };
} // namespace std

int main()
{
    int n, k, l;
    std::cin >> n >> k >> l;

    UnionFind u1(n), u2(n);
    for (int i = 0; i < k; ++i)
    {
        int a, b;
        std::cin >> a >> b;
        --a;
        --b;

        u1.unite(a, b);
    }
    for (int i = 0; i < l; ++i)
    {
        int a, b;
        std::cin >> a >> b;
        --a;
        --b;

        u2.unite(a, b);
    }

    std::map<std::pair<int, int>, int> counter;
    for (int i = 0; i < n; ++i)
    {
        const int index1 = u1.root(i), index2 = u2.root(i);
        const auto p = std::make_pair(index1, index2);
        ++counter[p];
    }

    for (int i = 0; i < n; ++i)
    {
        const int index1 = u1.root(i), index2 = u2.root(i);
        const auto p = std::make_pair(index1, index2);

        std::cout << counter[p];
        if (i == n - 1)
        {
            std::cout << std::endl;
        }
        else
        {
            std::cout << ' ';
        }
    }

    return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
  int N; cin >> N;
  string S; cin >> S;
  for (auto& c : S) {
    int num = c - 'A';
    num  = (num + N) % 26;
    c = num + 'A';
  }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = []
a.append(list(map(int, input().split(" "))))
a.append(list(map(int, input().split(" "))))

dp = [[0] * n for _ in range(2)]
dp[0][0] = a[0][0]
dp[1][0] = dp[0][0] + a[1][0]
for idx in range(1, n):
    dp[0][idx] = dp[0][idx-1] + a[0][idx]

for idx in range(1, n):
    dp[1][idx] = max(dp[0][idx], dp[1][idx-1]) + a[1][idx]

print(dp[1][n-1])

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;

typedef long long ll;
typedef pair<ll ,ll> P;
const ll mod = 1e9+7;
const long double EPS = 0.0000000001;

int n;
int main(){
    cin >> n;
    string s = to_string(n);
    if (s[0] == '7' or s[1] == '7' or s[2] == '7')cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3664
N = int(input())

def Prime_Factorize(n):
    primes = []
    while n%2 == 0:
        n//=2
        primes.append(2)
    f = 3
    while f*f <= n:
        if n%f == 0:
            n//=f
            primes.append(f)
        else:
            f += 2
    if n != 1:
        primes.append(n)
    return primes

Primes = Prime_Factorize(N)
cnt = 0
for p in Primes:
    e = 1
    z = p
    while (N%z == 0) and (N >= z):
        N //= z
        e += 1 
        z = p**e
        cnt += 1
    while N%p == 0:
        N //= p
print(cnt)

Measured memory_bytes: 9176
n, a, b = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod) :
    ans1 = 1
    ans2 = 1
    for i in range(r) :
        ans1 = (ans1 * (n-i)) % mod
        ans2 = (ans2 * (i+1)) % mod
    return ans1 * pow(ans2, mod-2, mod)

ans = pow(2, n, mod) - comb(n, a, mod) - comb(n, b, mod) - 1
print(ans%mod)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
  int A, B, C;
  
  cin >> A >> B >> C;
  
  if (A == B) {
    if (B == C) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  } else if (B == C) {
    if (C == A) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  } else if (C == A) {
    if (A == B) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for(int i = 0; i < S.size(); i++) {
    for(int j = 0; j < 26; j++) {
      if(S.at(i) ==s.at(j)) {
        if(j + N > 25) {cout << s.at(j + N - 26);}
        else {cout << s.at(j + N);}
      }
    }
  }
  cout << endl;
}

Measured memory_bytes: 3600
#include<stdio.h>

int main(){
    int a, b, c, d;
    scanf("%d %d %d", &a, &b, &c);
    
    if(a > b){
        d = a;
        a = b;
        b = d;
    }
    if(b > c){
        d = b;
        b = c;
        c = d;
    }
    if(a > b){
        d = a;
        a = b;
        b = d;
    }
    printf("%d %d %d\n", a, b, c);
}


Measured memory_bytes: 2696
n=int(input())
dp=[[0 for i in range(10)] for i in range(10)]
def iandj(n):
  j=n%10
  while n>=10:
    n//=10
  i=n
  return i,j
for k in range(1,n+1):
  i,j=iandj(k)
  dp[i][j]+=1
ans=0
for i in range(1,10):
  for j in range(1,10):
  	ans += dp[i][j]*dp[j][i]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n;
int a[200005];
int ha1(int i,int j,int x)
{
	return a[i]>x&&a[j]>x;
}
int ha2(int i,int j,int x)
{
	return a[i]<=x&&a[j]<=x;
}
int haha(int x)
{
	for(int i=0;i<n;i++)
	{
		if(ha1(n+i,n+i+1,x)||ha1(n-i,n-i-1,x))//判断大的
			return 0;
		if(ha2(n+i,n+i+1,x)||ha2(n-i,n-i-1,x))
			return 1;
	}
	return ha2(1,1,x);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n*2-1;i++)
		scanf("%d",&a[i]);
	int l=1,r=2*n-1;
	while(l<r)
	{
		int mid=(l+r)>>1;
		if(haha(mid))
			r=mid;
		else
			l=mid+1;
	}
	printf("%d\n",r);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
using namespace std;
 
int main(){
    int N;
    cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++)cin>>a.at(i);

    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int Alice=0,Bob=0;
    for(int i=0;i<N;i++){
        if(i%2==0)Alice+=a.at(i);
        else Bob+=a.at(i);
    }
    cout<<Alice-Bob<<endl;
}

Measured memory_bytes: 256
import heapq

def main():
    q = []
    while(True):
        cmd = map(str,raw_input().split())
        if cmd[0] == "insert":
            heapq.heappush(q,-int(cmd[1]))
        elif cmd[0] == "extract":
            print -heapq.heappop(q)
        else:
            break

if __name__ == "__main__":
    main()

Measured memory_bytes: 38144
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >>n;
    int a=n%10;
    n/=10;
    int b=n%10;
    n/=10;
    int c=n%10;
    if(a==7 || b==7 || c==7)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
#define N 100
#define INF 1000000
#define origin 0
#define discover 1
#define death 2
void dijkstra(void);
int n,A[N][N];
int main(){
  int i,j,u,k,c,v;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j]=INF;
      }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
  for(j=0;j<k;j++){
    scanf("%d %d",&v,&c);
    A[u][v]=c;
  }
}
  dijkstra(); 
  return 0;
}

void dijkstra(){
  int mincost,i,u,x;
  int a[N],condition[N];
  for(i=0;i<n;i++){
    a[i]=INF;
    condition[i]=origin;
}
  a[0]=0;
  condition[0]=discover;
  while(1){
    mincost=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(mincost>a[i]&&condition[i]!=death){
	u=i;
	mincost=a[i];
      }
    }
    if(u==-1)
      break;
    condition[u]=death;
    for(x=0;x<n;x++){
      if(condition[x]!=death&&A[u][x]!=INF){
	if(a[x]>a[u]+A[u][x]){
	  a[x]=a[u]+A[u][x];
	  condition[x]=discover;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d ",i);
    if(a[i]==INF)
      printf("-1");
    else
      printf("%d",a[i]);
  printf("\n");
  }
}



Measured memory_bytes: 2052
#include<stdio.h>

void
print_array(int *a, int n)
{
    int i;

    for (i = 0; i < n; i++) {
        printf("%d", a[i]);
        if (i != (n - 1))
            printf(" ");
    }
    printf("\n");
}

int
main()
{
    int A[100];
    int n, i, j;
    int v;

    scanf("%d", &n);

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

    print_array(A, n);

    for (i = 1; i < n; i++) {
        v = A[i];
        j = i - 1;
        while ((j >= 0) && (A[j] > v)) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        print_array(A, n);
    }

    return 0;
}


Measured memory_bytes: 2092
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  int max_h = 0;
   
  rep(i, N){
    cin >> a[i];
    max_h = max(max_h, a[i]);
  }

  // 繰り返して伸ばす
  bool flag = true;
  int min_a;
  int ans = 0;
  while(flag){
    rep(i, N) {
      min_a = max_h;
      if(a[i] > 0){
        int k = N;
        for(int j = i; j < N; j++){
          if (a[j] == 0) {
            k = j;
            break;
          }
          min_a = min(min_a, a[j]);
        }
        // 足りない部分を足していく
        for(int l = i; l < k; l++) {
          a[l] -= min_a;
        }
        ans += min_a;
        i = -1;
      }
     
    }
    if (min_a == max_h) {
        flag = false;
        break;
    }
  }
  
  cout << ans << endl;

}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.length()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	int a,b;
	cin >> a >> b;
	if(a%500<=b) cout << "Yes" << endl;
	else cout << "No" << endl; 
}


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

char a[100],b[100];

int main()
{
    cin>>a>>b;
    int n1=strlen(a);
    int n2=strlen(b);
    for(int i=0; i<max(n1,n2); i++)
    {
        cout<<a[i];
        if(i<=n2-1) cout<<b[i];	
    }
    puts("");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
using namespace std;

int main()
{
    int num, d;
    cin >> num >> d;
    array<array<int,21>,21> v;
    int ans = 0;

    for(int i=0;i<num;i++){
        for(int j=0;j<d;j++){
            cin >> v[i][j];
        }
    }
    for(int i=0;i<num-1;i++){
        for(int j=i+1;j<num;j++){
            double s=0;
            for(int k=0;k<d;k++){
                s += (v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
            }
            s = sqrt(s);
            if(ceil(s)==floor(s)){
                ans ++;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
import math
N = input()
n = int(N)
lst = list(N)
if len(lst)==1:
    print(int(lst[0]))
elif (n+1)%(10**(len(lst)-1)) == 0:
    print(int(lst[0])+9*(len(lst)-1))
else:
    print((int(lst[0])-1) + 9*(len(lst)-1))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = 1 << 29;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const int MAX_V = 500;
// const ll mod = 998244353;
const ll MAX = 2100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }




void solve() {
    ll x;
    cin>>x;
    cout<<1-x<<endl;
}




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


    ll t=1;
    
    // cin>>t;

    rep(i,t){
        solve(); 
    }

    return 0;
}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Main {
	static PrintWriter out = new PrintWriter(System.out); 

	public static void main(String[] args)throws Exception {
		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
			
			int n = Integer.parseInt(br.readLine());
			
			Map<String,Integer> map = new HashMap<>();
			int max = 0,tmp = 0;
			for(int i = 0; i < n; i++) {
				String s =  br.readLine(); 
				
				if(map.containsKey(s)) {
					tmp = map.get(s)+1;
					map.put(s,tmp);
					max = Math.max(tmp, max);
				}else {
					map.put(s,1);
					max = Math.max(max, 1);
				}

				
			}
			
			List<String> list = new ArrayList<>();
			for(String key: map.keySet()) {
				if(map.get(key)==max) {
					list.add(key);
				}
			}
			
			Collections.sort(list);
			
			for(String a: list) {
				System.out.println(a);
			}
			
		}		
		
		
	}

}


Measured memory_bytes: 65256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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()
{
  ll N;
  cin >> N;
  VEC(ll,A,N);
  ll right = 0;
  ll sum = 0;
  ll xorsum = 0;
  ll ans = 0;
  REP(left,N){
    while(right<N&&sum+A[right]==(xorsum^A[right])){
      sum+=A[right];
      xorsum=(xorsum^A[right]);
      right++;
    }
    ans+=right-left;
    if(right==left){
      right++;
    }else{
      sum-=A[left];
      xorsum=(xorsum^A[left]);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 4836
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;

char arr[200000+10];

int main() {
    scanf("%s", arr);
    int len = strlen(arr);
    for(int i = 0;i < len;i ++) {
        if(arr[i] != '?') printf("%c", arr[i]);
        else printf("D");
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
using namespace std;
int a[110],ans;
int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;++i)cin>>a[i];
    for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)if(i!=j)ans=max(ans,abs(a[i]-a[j]));
    cout<<ans;
}

Measured memory_bytes: 256
n, k = map( int, input().split() )
p = list( map( int, input().split() ) )

maxs = target = sum( p[ : k ] )
for i in range( 1, n - k + 1 ):
  target += - p[ i - 1 ]  + p[ i + k - 1 ]
  maxs = max( maxs, target )
ans = ( maxs + k ) / 2 # 各々の期待値は( p + 1 ) /2で求まるから
print( ans )

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

int solve(int a,int c){
    if(a%2 == 0 && a != 0){
        a /= 2; c++; solve (a,c);
    }
    else return c;
}

int main() {
    int N; cin >> N;
    int sum = 0,ans = 1;
        for(int i=1;i<=N;i++){
      if (sum < solve(i,0)){
           ans = i; sum = solve(i,0);
      }
      
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back
const long long INF = 1LL << 60;


int main() {
  int N;
  cin >> N;
  vector<vector<ll> > h(N, vector<ll>(3));
  vector<vector<ll> > dp(N+1, vector<ll>(3, 0));

  rep(i, N){
    cin >> h[i][0] >> h[i][1] >> h[i][2];
  }

  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;
  for(int i = 0; i < N; i++){
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
          if (j == k) continue;
          dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + h[i][k]);
      }
    }
  }
  
  cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << endl;

}


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


typedef long long ll;

int main()
{
   ll n,a,b;
   cin>>n>>a>>b;
   if(n==1){
    if(a==b){
        cout<<1;
        return 0;
    }
    else{
        cout<<0;
        return 0;
    }

   }
   if(a>b){
    cout<<0;
    return 0;
   }
   cout<<n*b-2*b-a*n+2*a+1;


}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<sstream>
#include<random>

//by Skeef79

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define what_is(x) cout<<#x<<" is "<<x<<en;

using namespace std;

const int INF = 2000000000;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];
}

void solve()
{
	int a, b;
	cin >> a >> b;
	for (int i = 1; i <= 1000000; i++)
	{
		ld x = (ld)i;
		int t1 = (int)floor(x*0.08);
		int t2 = (int)floor(x*0.1);
		if (t1 == a && t2 == b)
		{
			cout << i;
			return;
		}
	}
	cout << -1;
}

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

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int tst = 1;
	//cin >> tst;
	while (tst--)
		solve();

}

Measured memory_bytes: 888
#include <cstdio>
#include <string>
using namespace std;
const string t="CODEFESTIVAL2016";
char s[22];
int r;
int main() {
  scanf("%s",s);
  for (int i=0; s[i]; i++) if (s[i]!=t[i]) r++;
  printf("%d\n",r);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mst(a,b) memset(a,b,sizeof(a))
#define lowbit(x) ((x)&(-x))
#define X first
#define Y second
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
typedef long long LL;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 100000+10;
const int maxm = 200000+10;
const int mod = 1e9+7;
const double eps = 1e-9;
struct Edge{
    int u,v,w;
    Edge(){}
    bool operator < (const Edge &rhs){
        return w<rhs.w;
    }
}edge[maxn<<1];
pii x[maxn],y[maxn];
int fa[maxn];
int Find(int u){
    return u==fa[u]?u:fa[u]=Find(fa[u]);
}
int main() {
#ifdef local
    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n; cin>>n;
    for (int i=0;i<n;i++){
        cin>>x[i].X>>y[i].X;
        x[i].Y=y[i].Y=i;
        fa[i]=i;
    }
    sort(x,x+n);
    sort(y,y+n);
    int tot=0;
    for (int i=1;i<n;i++){
        edge[tot].u=x[i-1].Y; edge[tot].v=x[i].Y; edge[tot++].w=x[i].X-x[i-1].X;
        edge[tot].u=y[i-1].Y; edge[tot].v=y[i].Y; edge[tot++].w=y[i].X-y[i-1].X;
    }
    sort(edge,edge+tot);
    int ans=0;
    for (int i=0;i<tot;i++){
        int u=Find(edge[i].u),v=Find(edge[i].v);
        if (u!=v){
            ans+=edge[i].w;
            fa[u]=v;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 4608
n, m, l = gets.split.map(&:to_i)

a = Array.new(n){Array.new(m, 0)}
b = Array.new(m){Array.new(l, 0)}

n.times do |i|
  a[i] = gets.split.map(&:to_i)
end

m.times do |i|
  b[i] = gets.split.map(&:to_i)
end

n.times do |i|
  str = ""
  l.times do |j|  
    c = 0
    m.times do |k|
      c += a[i][k] * b[k][j]
    end
    str += "#{c} "
  end
  puts str.rstrip
end

Measured memory_bytes: 13404
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(),(x).end()

int main () {
  int n, k;

  cin >> n >> k;
  int colors = k;

  REP(i, (n - 1)) {
    colors *= (k - 1);
  }

  cout << colors << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
using ll = long long;
using P = pair<int,int>;

int main(void) {
  int n, a , b;
  cin >> n >> a >> b;

  if (n==1){
    cout << "Hello World" << endl;
  }
  else {
    cout << a+b << endl;
  }
  return 0;
}

Measured memory_bytes: 256
N , Y = map(int, input().split())

sum = 0
for x in range(N+1):
    for y in range(N+1-x):
        z = N - x - y
        if z >= 0:
            sum = x * 10000 + y * 5000 + z * 1000
        if sum == Y:
            print(x, y, z, sep=' ')
            exit()

print(-1, -1, -1, sep=' ')
 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[200005];
int32_t main(){
	int n,t;cin>>n>>t;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>ar[i];
	}
	int last=ar[1];
	int cur=ar[1]+t;
	for(int i=2;i<=n;i++){
		if(cur<ar[i]){
			ans += cur-last;
			cur = ar[i]+t;
			last = ar[i];
		}
		else{
			cur=ar[i]+t;
		}
	}
	ans += cur-last;
	cout<<ans;
}


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

signed main() {
    int n, k; cin>>n>>k;
    int a[n]; for(auto &i : a)  cin>>i;
    int lo = 0, hi = 1e9 +1, mid;
    
    while(hi-lo > 1) {
        int cnt = 0;
        mid = (lo+hi)>>1;
        for(int i = 0; i < n; i++)  if(a[i] > mid)  cnt += a[i]/mid;
        if(cnt<=k)  hi = mid;
        else    lo = mid;
    }
    cout<<hi;
}

Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
queue<vector<int>> calc(ll n,ll m){
    queue<vector<int>> que;
    For(i,1,m+1) que.push({i});
    while(que.front().size()<n){
        vector<int> vec=que.front();
        que.pop();
        int M=vec[vec.size()-1];
        For(i,M,m+1){
            vector<int> vec2(vec.size());
            copy(ALL(vec),vec2.begin());
            vec2.push_back(i);
            que.push(vec2);
        }
    }
    return que;
}
void Main(){
    ll n;cin>>n;
    ll m;cin>>m;
    ll q;cin>>q;
    vector<int> a(q),b(q),c(q),d(q);
    For(i,0,q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    queue<vector<int>> que=calc(n,m);
    while(!que.empty()){
        vector<int> vec=que.front();
        que.pop();
        ll score=0;
        For(i,0,q){
            if(vec[b[i]]-vec[a[i]]==c[i]) score+=d[i];
        }
        ans=max(ans,score);
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            var digits = new List<long>();
            while (N > 0)
            {
                N -= 1;
                digits.Add(N % 26);
                N /= 26;
            }
            digits.Reverse();
            for (int i = 0; i < digits.Count; i++)
            {
                Console.Write((char)(digits[i] + 'a'));
            }
        }
    }
}


Measured memory_bytes: 27824
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); ++i)
int N;
string S[100100];

int main()
{
    cin >> N;
    rep(i, N)
    {
        cin >> S[i];
    }

    string check[4] = {"AC", "WA", "TLE", "RE"};
    int count[4] = {0, 0, 0, 0};
    rep(i, N)
    {
        rep(j, 4)
        {
            if (S[i] == check[j])
                count[j]++;
        }
    }

    rep(i, 4)
    {
        cout << check[i] << " x " << count[i] << endl;
    }
}


Measured memory_bytes: 6712
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x,cnt=0;
	scanf("%d",&x);
	int tmp=x;
	int w=0;
	while(tmp){
		tmp/=10;
		w++;
	}
	if(w&1){
		cnt+=x-(int)pow(10,w-1)+1;
		w--;
	}
	
	while(w){
		if(w&1){
			cnt+=(int)pow(10,w)-(int)pow(10,w-1);
		}
		w--;
	}
	printf("%d\n",cnt);
	return 0;
}


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

int main(){
long long n;
cin >> n;
long long ans = n;
for (long long i=1;i<=1000000;i++){
  if (n%i == 0){
    long long p = (i-1) + (n/i -1);
    if(ans > p) ans = p;
  }
}
cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar

using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
const int N= (int) 2e5+10;
int b[N],a[N],n;
void input()
{
    cin>>n;
    up(i,1,n) cin>>a[i];

}

void solve()
{
	if (n==1)
	{
		cout<<a[1]; return;
	}
    int top= n-1, bot= 0;
    up(i,1,n)
    {
    	if (i%2==1)
		{
			top= (top+1) %n;
			b[top]= a[i];
		}
    	else
		{
			bot= (bot-1+n)% n;
			b[bot]= a[i];
		}

    }
    if (n%2==1)
	{
		down(i,top,0) cout<<b[i]<<" ";
		down(i,n-1,bot) cout<<b[i]<<" ";
	}
	else
	{
        up(i,bot,n-1) cout<<b[i]<<" ";
        up(i,0,top) cout<<b[i]<< " ";
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// scanf phai bo
    #define TASK "tmp"
   // freopen(TASK".inp","r",stdin);
   // freopen(TASK".out","w",stdout);

    input();
    solve();

    return 0;
}


Measured memory_bytes: 3712
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Set<String> set = new HashSet<>();
		for(int i = 0;i < N;i++){
			set.add(sc.next());
		}
		System.out.println(set.size());
	}
}

Measured memory_bytes: 66256
n = int( raw_input( ) )
minv = int( raw_input( ) )
maxv = 0 - 1000000000
 
for j in range( n-1 ):
  num = int( raw_input( ) )  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
 
print maxv

Measured memory_bytes: 12692
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>


void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}

int gcd(int a,int b){
  if(a<b){
    swap(&a,&b);
  }

  if(b==0){
    return a;
  }

  int r=a%b;
  while(r!=0){
    a = b;
    b = r;
    r = (a%b);
  }

  return b;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}


int modpow(int a,int n,int mod){
  int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


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

int main(void){
  int r,g,b;
  scanf("%d%d%d",&r,&g,&b);

  int k;
  scanf("%d",&k);

  int cnt=0;
  while(r>=g){
    g*=2;
    cnt++;
  }

  while(g>=b){
    b*=2;
    cnt++;
  }

  //r<g<b
  if(cnt<=k){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 1564
import sys
input = sys.stdin.readline

N=int(input())
B=sorted([list(map(int,input().split())) for i in range(N)],key=lambda x:x[0]+x[1])
#W+Sの順にソートすると無駄がない。

DP=[0]*(10**4+2)
#重さの合計がWのときの価値。
#W=10**4+1ならそれ以上更新されないので、W>=10**4+1以上のものはそこに置く

for w,s,v in B:
    
    if 10**4+1-w<=s:
        x=max(DP[10**4+1-w:s+1])+v
        if DP[-1]<x:
            DP[-1]=x

    if 10**4-w<s:
        for i in range(10**4-w,-1,-1):
            if DP[i+w]<DP[i]+v:
                DP[i+w]=DP[i]+v

    else:
        for i in range(s,-1,-1):
            if DP[i+w]<DP[i]+v:
                DP[i+w]=DP[i]+v        

print(max(DP))

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> A(N);
  int num;
  map<int,int> ball;
  for(int i=0;i<N;i++){
    cin>>num;
    A[num-1]++;
    ball[num]=A[num-1];
  }
  
  //cout<<ball.size()<<endl;
  sort(A.begin(),A.end());
  
  int kind=0;
  int ans=0;
  int cnt=0;
  while(K<ball.size()-kind){
    if(A[cnt]>0){
      ans+=A[cnt];
      kind++;
    }
    
    cnt++;
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 10368
#ライブラリの読み込み
import math

#入力値の格納
n,k = map(int, input().split())

#n進数への変換定義
def convert(x,y):
    if int(x/y):
        return convert(int(x/y),y) + str(x%y)
    return str(x%y)

#n進数へ変換し長さを算出
text = len(convert(n,k))

#結果を表示
print(text)


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

int main(){
  int N;
  cin >> N;
  vector<tuple<string, int, int>> restaurant(N);
  for(int i=0; i<N; i++){
    string place;
    int point;
    cin >> place >> point;
    restaurant[i]=make_tuple(place, point*(-1), i+1);
  }
  
  sort(restaurant.begin(), restaurant.end());
  for(int i=0; i<N; i++){
    string place;
    int point;
    int ans;
    tie(place, point, ans)=restaurant[i];
    cout << ans <<endl;
  }
}

Measured memory_bytes: 256
S = input()

ans = "AC"

if S[0] != "A" :
    ans = "WA"

if S[2:-1].count("C") != 1 :
    ans = "WA"

T = S[1:].replace("C","c",1)

if not T.islower() :
    ans = "WA"

print(ans)


Measured memory_bytes: 2940
#                         author:  kagemeka 
#                         created: 2019-11-09 16:39:51(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from external libraries
# import scipy.special   
# import scipy.misc      
# import numpy as np 

def main():
    n, i = (int(x) for x in sys.stdin.readline().split())
    j = n - i + 1
    print(j)


if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 2940
#include <vector>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>

using namespace std;

#define x first
#define y second
#define ll long long
#define ld long double
#define pii pair<int,int>
#define wh(x) (x).begin(),(x).end()
#define ri(x) int x;cin>>x;
#define rii(x,y) int x,y;cin>>x>>y;
#define rl(x) ll x;cin>>x;
#define rv(v) for(auto&_cinv:v) cin>>_cinv;
#define wv(v) for(auto&_coutv:v) cout << _coutv << ' '; cout << endl;
#define ev(v) for(auto&_cerrv:v) cerr << _cerrv << ' '; cerr << endl;
#define MOD 1000000007

namespace std { 
template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}};
}
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

typedef pair<pii,pii> C;

C norm(C c) {
    return min(min(C{{c.x.y, c.y.x}, {c.y.y, c.x.x}}, C{{c.y.y,c.x.x},{c.x.y,c.y.x}}), min(c, {c.y,c.x}));
}

int get(const C&c, int i) {
    switch((i+4)%4) {
        case 0: return c.x.x;
        case 1: return c.x.y;
        case 2: return c.y.x;
        case 3: return c.y.y;
    }
}

int rot(const C&c) {
    if (c.x == c.y) {
        if (c.x.x == c.x.y) return 4;
        else return 2;
    } else return 1;
}

void write(const C&c) {
    cout << c.x.x << ' ' << c.x.y << ' ' << c.y.x << ' ' << c.y.y;
}


int main(int,char**) {
    ios_base::sync_with_stdio(false);

    int N; cin >> N;

    map<C, int> P;
    map<C, int> R;
    vector<C> Q;
    for (int i = 0; i < N; i++) {
        int a,b,c,d; cin >> a >> b >> c >> d;
        C x{{a,b},{c,d}};
        x = norm(x);
        P[x] += 1;
        R[x] = rot(x);
        Q.push_back(x);

        //write(x); cout << endl;
    }

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        C &p = Q[i];
        for (int j = i+1; j < N; j++) {
            C &q = Q[j];
            for (int k = 0; k < 4; k++) {
                C u[4];
                ll cur = 1;
                for (int l = 0; l < 4; l++) {
                    u[l] = norm({{get(p,l+1),get(p,l)},{get(q,k-l),get(q,k-l-1)}});
                    int opts = P[u[l]];
                    //if (i == 2 && j == 5) { write(u[l]); cout << '=' << opts << endl; } 
                    if (u[l] == p) --opts;
                    if (u[l] == q) --opts;
                    for (int m = 0; m < l; m++) if (u[l] == u[m]) --opts;
                    if (opts <= 0) {
                        cur = 0;
                    } else {
                        cur *= opts*R[u[l]];
                    }
                }
                //if (cur != 0) {
                //    cout << i << ' ' << j << endl;
                //}
                ans += cur;
            }
        }
    }

    cout << ans/3 << endl;
}


Measured memory_bytes: 80128
include Math
loop do
  xs = gets.split.map(&:to_f)
  break if xs.all? {|x| x == -1 }
  u, v = xs.each_slice(2).map {|a, b|
    z = sin(2*PI*a/360)
    k = cos(2*PI*a/360)
    x = k*cos(2*PI*b/360)
    y = k*sin(2*PI*b/360)
    [x, y, z]
  }
  t = acos(1 - 0.5 * u.zip(v).map {|a, b| (a - b)**2 }.reduce(0, :+))
  p (t * 6378.1).round
end

Measured memory_bytes: 9060
import sys
table={}
def memorize(f):
    global table
    def func(*args):
        if not args in table:
            table[args]=f(*args)
        return table[args]
    return func
@memorize
def dfs(a,b):
    if a==0:return 1
    elif b==0 or a < 0:return 0
    return sum([dfs(a-i,b-1) for i in xrange(10)])
for i in sys.stdin.readlines():
    print dfs(int(i.strip()),4)

Measured memory_bytes: 5068
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int N,count=0;
	cin >> N;
	vector<int> a(N);
	for (int i = 1;i <= N;i++) {
		cin >> a[i];
		if (a[i] % 2 == 1 && i % 2 == 1)count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(ll &a,ll b){
	a = min(a,b);
}

int main(){
	int n; cin >> n;
	int arr[n][3] = {};

	rep(i,n){
		rep(j,3){
			cin >> arr[i][j];
		}
	}

	vector<vector<int>> dp(n,vector<int> (3));

	dp[0][0] = arr[0][0];
	dp[0][1] = arr[0][1];
	dp[0][2] = arr[0][2];

	for(int i=1; i<n;i++){
		for(int j = 0; j<3 ; j++){
			if(j==0){
				dp[i][j] = arr[i][j] + max(dp[i-1][1],dp[i-1][2]);
			}else if(j ==1){
				dp[i][j] = arr[i][j] + max(dp[i-1][0],dp[i-1][2]);
			}else{
				dp[i][j] = arr[i][j] + max(dp[i-1][1],dp[i-1][0]);
			}
		}
	}

	int ans=INT_MIN;
	for(int i=0;i<3;i++){
		self_max(ans,dp[n-1][i]);
	}

	cout << ans << endl;
	return 0;
}




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

using namespace std;
const int MAX = 51;

int n,k;
vector<int> Bad[MAX];
vector<int> S[MAX];
bool fine[MAX];

void solve(){
  
  fill(fine,fine+MAX,true);

  for(int i = 0; i < k; i++)
    for(int j = 0; j < S[i].size(); j++){
      int I = S[i][j];
      for(int m = 0; m < Bad[I].size(); m++)
	if(binary_search(S[i].begin(),S[i].end(),Bad[I][m])) fine[I] = false;
    }
  
  int ans = 0;

  for(int i = 1; i <= n; i++)
    if(!fine[i]) ans++;

  cout << ans << endl;
}


int main(){
  cin >> n >> k;

  for(int i = 0; i < k; i++){
    int num;
    cin >> num;
    while(num--){
      int name;
      cin >> name;
      S[i].push_back(name);
    }
    sort(S[i].begin(),S[i].end());
  }

  int R;
  cin >> R;
  while(R--){
    int a,b;
    cin >> a >> b;
    Bad[a].push_back(b);
    Bad[b].push_back(a);
  }

  solve();
  return 0;
}

Measured memory_bytes: 1244