akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

int main()
{
  int n;
  int m;
  int a, b, c;
  string s, t;
  int ans = 700;

  cin >> s;
  for ( int i = 0; i < s.size(); i++) {
    if (s[i] == 'o' ) {
      ans += 100;
    }
  }

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  int N;
  cin >> N;
  auto A = vector<ll>(N);
  REP(i, N) cin >> A[i];

  dump(A);
  ll sum = 0;
  if(A[0] >= 1) {
    cout << -1 << endl;
    return 0;
  }
  REPS(i, 1, N) {
    if(A[i] - A[i - 1] >= 2) {
      cout << -1 << endl;
      return 0;
    }

    if(A[i] <= A[i - 1]) {
      sum += A[i - 1];
    }
  }
  sum += A[N - 1];
  cout << sum << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int n;
  cin >> n;
  vi x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  vi idx(n);
  rep(i, n) idx[i] = i;

  double ans = 0;
  int cnt = 0;
  do{
    rep(i, n-1){
      ans += sqrt(pow(x[idx[i]] - x[idx[i+1]], 2) + pow(y[idx[i]] - y[idx[i+1]], 2));
    }
    cnt++;
  }while(next_permutation(idx.begin(), idx.end()));
  ans = ans / cnt;
  printf("%.10f", ans);
  return 0;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define INFTY 2000000000

//0で区切られたブロックがいくつあるか数える
int count_block(int* h, int N){
    int ans;
    if(h[1]==0){
        ans=0;
    }
    else{
        ans=1;
    }

    for(int i=2;i<=N;i++){
        if(h[i-1]==0&&h[i]!=0){
            ans++;
        }
    }

    return ans;
}

int main(void){
    int N;
    scanf("%d",&N);

    int* h;
    NEW(h,N+1);
    //h[1]~h[N]に格納
    for(int i=1;i<=N;i++){
        scanf("%d",&h[i]);
    }

    int ans=0;
    while(1){
        int c=count_block(h,N);
        if(c==0){
            break;
        }
        else{
            ans+=c;
            for(int i=1;i<=N;i++){
                if(h[i]>0){
                    h[i]--;
                }
            }
        }
    }

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

    return 0;
    
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
 
int main() {
  string s, t;
  cin >> s;
  int num = s.size() / 2;
  
  int count = 0;
  t = s;
  reverse(t.begin(), t.end());
  
  rep(i, num) {
    if (s[i] != t[i]) count++;
  }
  
  cout << count << endl;
}


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

int main() {
	int n;
	string k;
	cin >> n >> k;
	int s[100];
	for (int i = 0; i < n; i++)
		s[i] = k[i] - 97;
	int max = 0;
	int countf = 0, countb = 0, count = 0;
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < 26; j++) {
			for (int k = 0; k < i; k++)
				if (s[k] == j)
					countf++;
			for (int k = i; k < n; k++)
				if (s[k] == j)
					countb++;
			if (countf > 0 && countb > 0)
				count++;
			countf = 0;
			countb = 0;
		}
		if (max < count)
			max = count;
		count = 0;
	}
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int n;
    cin>>n;
    vi l(n);
    FOR(i,0,n){
        cin>>l[i];
    }
    int c=0;
    FOR(i,0,n){
        FOR(j,i+1,n){
            FOR(k,j+1,n){
                if(l[i]==l[j]||l[j]==l[k]||l[k]==l[i])continue;
                if(l[i]+l[j]>l[k]&&l[i]+l[k]>l[j]&&l[j]+l[k]>l[i])c++;
            }
        }
    }
    cout<<c;
}


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

int main(){
  int n;
  cin >> n;
  int cnt = 0;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    while(a % 2 == 0){
      a /= 2;
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>

int main() {
  int N, K;
  std::string S;
  scanf("%d %d", &N, &K);
  std::cin >> S;
  int chg = 0;
  for (int i = 0; i < S.size()-1; ++i) {
    if (S[i] != S[i+1]) ++chg;
  }
  while (K > 0 && chg > 0) {
    switch(chg) {
    case 1: --chg;    break;
    default: chg -= 2; break;
    }
    --K;
  }
  printf("%d\n", S.size() - (chg + 1));
  return 0;
}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
            string N = Input.ScanStr();
          bool b = false;
          b |= N[0] == 'a';
          b |= N[0] == 'i';
          b |= N[0] == 'u';
          b |= N[0] == 'e';
          b |= N[0] == 'o';
          
          Console.WriteLine(b ? "vowel" : "consonant");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

const static ll MOD = 1000000007;
string K;
ll D;
ll dp[10005][2][2][105];

ll solve(int i, int j, int k, int l){
  if(dp[i][j][k][l] >= 0) return dp[i][j][k][l];
  if(i == 0){
    if(j==0){
      ll ret = 0;
      rep(ii,10){
        if(k == 1 && ii == 0) continue;
        if(ii%D == l) ret++;
      }
      return dp[i][j][k][l] = ret;
    } else {
      ll ret = 0;
      rep(ii,(int)(K[K.size()-1-i]-'0')+1){
        if(k == 1 && ii == 0) continue;
        if(ii%D == l) ret++;
      }
      return dp[i][j][k][l] = ret;
    }
  }
  
  if(j == 0){
    ll ret = 0;
    if(k == 1){
      rep(ii,10){
        if(ii == 0) ret += solve(i-1,0,1,(100*D+l-ii)%D);
        else ret += solve(i-1,0,0,(100*D+l-ii)%D);
        ret %= MOD;        
      }
    }else{
      rep(ii,10){
        ret += solve(i-1,0,0,(100*D+l-ii)%D);
        ret %= MOD;        
      }      
    }
    return dp[i][j][k][l] = ret;      
  }else{
    ll ret = 0;
    if(k == 1){
      rep(ii,(int)(K[K.size()-1-i]-'0')+1){
        if(ii == 0){
          if(ii == (int)(K[K.size()-1-i]-'0')) ret += solve(i-1,1,1,(100*D+l-ii)%D);
          else ret += solve(i-1,0,1,(100*D+l-ii)%D);
        }else{
          if(ii == (int)(K[K.size()-1-i]-'0')) ret += solve(i-1,1,0,(100*D+l-ii)%D);
          else ret += solve(i-1,0,0,(100*D+l-ii)%D);
        }
        ret %= MOD;
      }
    }else{
      rep(ii,(int)(K[K.size()-1-i]-'0')+1){
        if(ii == (int)(K[K.size()-1-i]-'0')) ret += solve(i-1,1,0,(100*D+l-ii)%D);
        else ret += solve(i-1,0,0,(100*D+l-ii)%D);
        ret %= MOD;
      }
    }
    return dp[i][j][k][l] = ret;
  }
}

int main(){
  cin >> K;
  cin >> D;

  rep(i,10005) rep(j,2) rep(k,2) rep(l,105) dp[i][j][k][l] = -1;
  
  cout << solve(K.size()-1,1,1,0) << endl;
  
  return 0;
}


Measured memory_bytes: 33920
if __name__ ==  "__main__":
    food_data = []
    n, m = map(int, input().split())
    for i in range(n):
        food_row = list(map(int, input().split()))
        food_row.pop(0)
        food_data.append(food_row)

    result = 0
    first_food_row = food_data[0]
    rest_food_rows = food_data[1:]

    for food in first_food_row:
        flag = False
        for food_row in rest_food_rows:
            if not food in food_row:
                flag = True
                break
            
        if flag:
            continue

        result += 1 

    print(result)

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  int x1, x2, x3, x4, y1, y2, y3, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  int dx = x2 - x1, dy = y2 - y1;
  x3 = x2 - dy;
  y3 = y2 + dx;
  x4 = x1 - dy;
  y4 = y1 + dx;
  printf("%d %d %d %d\n", x3, y3, x4, y4);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> u(n, vector<int>(m));
    vector<int> cost(n);
    for (int i = 0; i < n; i++) {
        cin >> cost.at(i);
        for (int j = 0; j < m; j++) {
            cin >> u.at(i).at(j);
        }
    }

    int ans = 10000000;
    for (int bit = 0; bit < (1 << n); ++bit) {
        vector<int> z(m);
        int t=0;
        for (int i = 0; i < n; ++i) {
            if (bit & (1 << i)) {
                for (int j = 0; j < m; j++) {
                    z.at(j) += u.at(i).at(j);
                    
                }
                t += cost.at(i);
            }
        }
        int mm = 0;
        for (int i = 0; i < m; ++i) {
            if (x > z.at(i))mm = 1;
        }
        if (mm == 0)ans = min(t, ans);
    }
    if (ans == 10000000)ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int num = Integer.parseInt(str[2]);

        System.out.println(Function(start,end,num));
        sc.close();
    }

    public static int Function(int start, int end, int num){
        int ans = 0;
        for(;start <= end; ){
            if( num%start == 0 ) ans++;
            start++;
        }
        return ans;
    }

}

Measured memory_bytes: 26196
// https://atcoder.jp/contests/abc115/tasks/abc115_d

fun main() {
    abc115d()
}

fun abc115d() {
    val (n, x) = readLine()!!.split(" ").map { it.toLong() }
    val ni = n.toInt()
    val level = LongArray(n.toInt() + 1)
    val patty = LongArray(n.toInt() + 1)
//    var base = 2L
//    for (i in 0..n.toInt()) {
//        base *= 2L
//        level[i] = base - 3
//        patty[i] = if (i == 0) {
//            1L
//        } else {
//            level[i - 1] + 2
//        }
//    }
    level[0] = 1L
    patty[0] = 1L
    for (i in 1..ni) {
        level[i] = level[i - 1] * 2 + 3
        patty[i] = patty[i - 1] * 2 + 1
    }
    // 具体的に求めていったら、バーガーの長さはn^(n+2) - 3、そのうちパティの数は2^(n+1)-1になる
    // （1つ前のバーガーレベルの長さに2を加えた数でもある）
    // 見つけたのは完全に偶然、なんか2の累乗に似てるなぁというだけ
    // 漸化式とかで求めたわけではない、求め方わからんし・・・
    // パティは必ず奇数になる
    // あとはを半分半分していけば、計算でパティの枚数を求めることも可能ではなかろうか
    // （2分探索ちっくに中央より食べる数が大きいなら、中央までに存在するパティが食べれるよねっていう話）
    var count = 0L
    var i = ni
    var half = 0L
    var eat = x
    if (eat >= level[i] - 1) {
        // 端っこはB確定なので、それを覗いた数より大きいならすべてのパティを食べられる
        println(patty[ni])
        return
    }
    while (i > 0 && eat > 0) {
        half = level[i] / 2 + 1
        if (eat >= level[i]) {
            count += patty[i]
            eat = 0L
            break
        }
        if (eat == half) {
            // 中央パティに到達する数だけ食べられるなら1つ前のレベルのパティと中央のパティが食べられる
            count += patty[i - 1] + 1
            eat = 0L
            break
        }
        if (eat > half) {
            count += patty[i - 1] + 1
            // 中央から半分食べたあまりが持ち越される分
            eat -= half
        } else {
            // 中央まで満たないのであれば、1つ前のレベルで判定する、
            // その際このレベルで付け足された3つのBPB分食べれる数から取り除く
            eat -= 1
        }
        i--
        
    }
    // 最後に1個残る可能性があり、その場合パティのみ（レベル0が残る）なので残ったeatを足す
    count += eat
    println(count)
}


Measured memory_bytes: 36308
#include <iostream>

using namespace std;

int main()
{
	int N, M, A[20][20], B[20], C, SUM[20] = {0}, counter;
	counter = 0;
	cin >> N >> M >> C;
	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}
	for (int n = 0; n < N; n++){
		for (int i = 0; i < M; i++) {
			cin >> A[n][i];
		}
	}
///////////////////////////////////////////////////////
	for (int n = 0; n < N; n++) {
		for (int i = 0; i < M; i++) {
			SUM[n] += A[n][i]*B[i];
		}
	}
	for (int n = 0; n < N; n++) {
		if (SUM[n]+ C > 0)counter++;
	}
	cout << counter;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long 
#define mp make_pair
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0) 
#define sz(a) (a).size()
#define triple pair<pill, ll>
#define pinode pair<node*, node*>
#define quadra pair<pill, pill>
using namespace std;

/*
 tips :
 Sqrt opt
 Binary search
 Try to find the easiest solution
 Recursiya
 FUCK YOU pishi kod akuratnee daun yobani
 sdohni v adu nahui blyat' y ub'uy tebya
 esli ti blyad' budesh pisat' kod gryaznim
 to ya tebya v rot viebu
*/

const ll N = 2e5 + 10;
const ll big = 1e18;
const ll shift = 1000;
const ll block = 500;
const long long mod = 1e9 + 7;

int main() {	
	ll x;
	cin >> x;
	cout << (x ^ 1);

}             

/*

*/          

Measured memory_bytes: 3592
import scala.io.StdIn._
import scala.collection._

object Main {

  class Sieve(val n: Int){
    private[this] val top = (n - 3) / 2 + 1
    private[this] val sqrtLimit = (Math.sqrt(n).toInt - 3) / 2

    private[this] val cmpsts = new Array[Int]((top >>> 5) + 1)
    def isPrime(ci: Int): Boolean = (cmpsts(ci >>> 5) & (1 << (ci & 31))) == 0
    def notPrime(ci: Int): Unit = cmpsts(ci >>> 5) |= 1 << (ci & 31)

    private def innerLoop(j: Int, p: Int): Unit = {
      notPrime(j)
      if(j + p <= top)innerLoop(j + p, p)
    }

    private def loop(i: Int): Unit = {
      val p = 2 * i + 3
      if(isPrime(i))innerLoop((p * p - 3) / 2, p)
      if(i < sqrtLimit)loop(i + 1)
    }

    private def next(i: Int): Int = if((i > top) || isPrime(i)) 2 * i + 3 else next(i + 1)

    def exec: Iterator[Int] = {
      loop(0)
      if(n==2)Iterator.single(2)
      else Iterator.single(2) ++ Iterator.iterate(3)(p => next((p - 1) / 2)).takeWhile(_ <= n)
    }
  }

  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       if(n<2) println(0)
       else println(new Sieve(n).exec.size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit = loop(readLine)
}

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

int main(){
  stack<int> num;
  string str;

  while(cin >> str){
    if(str == "+" || str == "-" || str == "*"){
      int x = num.top();
      num.pop();
      int y=num.top();
      num.pop();

      if(str=="+"){
	num.push(x+y);
      }
      else if(str=="-"){
	num.push(y-x);
      }
      else if(str=="*"){
	num.push(x*y);
      }
      
    }
    else{
      num.push(atoi(str.c_str()));
    }
  }

  cout << num.top() << endl;

  return 0;
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

string s, t;

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

  cin >> s >> t;

  ll slen = s.size();
  ll tlen = t.size();

  vector<vector<ll>> v(26);
  for (int i = 0; i < slen; i++) {
    v[s[i] - 'a'].push_back(i);
  }
  for (int i = 0; i < slen; i++) {
    v[s[i] - 'a'].push_back(i + slen);
  }

  ll ans = 0;
  ll prev = 0;
  for (int i = 0; i < tlen; i++) {
    int c = t[i] - 'a';
    if (v[c].size() <= 0) {
      cout << -1 << ln;
      return 0;
    } else {
      auto &v2 = v[c];
      prev = *lower_bound(all(v2), prev) + 1;
      if (prev >= slen) {
        prev -= slen;
        ans += slen;
      }
    }
  }

  ans += prev;

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 2756
def main():
	N, K = map(int, input().split())
	dp = [0 for _ in range(K+1)]

	if K > N:
		for i in range(1, N+1):
			dp[i] = 1
	else:
		for i in range(1, K):
			dp[i] = 1
		dp[K] += (N-K+1)
	ans = dp[K]
	for i in range(1, min(N+1, K)):
		cur = i
		this_p = dp[i]
		while cur < K:
			this_p *= 0.5
			cur *= 2
		ans += this_p
	print(ans/N)

if __name__ == '__main__':
	main()

Measured memory_bytes: 3864
s = sorted(input())
t = sorted(input())
t.sort(reverse=True)

n = min(len(s),len(t))
A = "No"
if s[0:n] == t[0:n] and len(s)<len(t):
  print("Yes")
  exit()
for i in range(n):
  if s[i] < t[i]:
    print("Yes")
    exit()
  
print(A)

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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	int ans[n]={};
	for (int i = n-1; i >= 0; --i)
	{
		int d=i+i+1,r=0;
		while (d<n)
		{
			r+=ans[d];
			d+=i+1;
		}
		if (r%2!=a[i])
		{
			ans[i]=1;
		}
	}
	int m=0;
	for (int i = 0; i < n; ++i)
	{
		if (ans[i]==1)
		{
			++m;
		}
	}
	cout<<m<<endl;
	int f=0;
	for (int i = 0; i < n; ++i)
	{
		if (ans[i]==1)
		{
			if (f==0)
			{
				cout<<i+1;
				f=1;
			}
			else
			{
				cout<<" "<<i+1;
			}
		}
	}
	if (f==1)
	{
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" \
                              << "\n";

int main()
{
    int n;
    ll ans=0;
    cin >> n;

    for (int i = 1; i <= n;i++)
    {
        if(i%3!=0&&i%5!=0)
            ans += i;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3624
n, m = map(int, input().split())
d = 10**9 + 7

def factorial(x):
    global d
    ret = 1
    while True:
        ret *= x
        ret %= d
        if x == 1:
            break
        x -= 1
    return ret

if abs(n-m) > 1:
    print(0)
else:
    if abs(n-m) == 1:
        factor = 1
    else:
        factor = 2
    ans = (factor * factorial(n) * factorial(m))%d
    print(ans)
    


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
 	int n, k;	cin >> n >> k;
	vector<int> h(n);	rep(i,n) cin >> h.at(i);
  	int cnt = 0;
  	rep(i,n){
    	if(h.at(i) >= k) cnt++;
    }
  	cout << cnt << endl;
}

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

int main(){
    int a,b;
    while(cin>>a>>b,a||b){
        int dp[18][18]={},n,x,y,dx[2]={0,1},dy[2]={1,0};
        bool stage[18][18]={};
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>x>>y;
            stage[y][x]=true;
        }
        dp[1][1]=1;
        for(int i=1;i<=b;i++){
            for(int j=1;j<=a;j++){
                //printf("%d ",dp[i][j]);
                for(int k=0;k<2;k++){
                    if(stage[i+dy[k]][j+dx[k]]) continue;
                    dp[i+dy[k]][j+dx[k]] += dp[i][j];
                }
            }
            //puts("");
        }
        printf("%d\n",dp[b][a]);
    }
    return 0;
}

Measured memory_bytes: 1144
#include <cstdio>

char a[] = {'a','e','i','o','u'};
char c;

int main(){
    scanf("%c", &c);


    bool f = false;
    for(int i = 0; i < 5; i++)
    if(a[i] == c) f = true;

    if(f) printf("vowel\n");
    else printf("consonant\n");

    return 0;
}


Measured memory_bytes: 128
N = int(input())
abc = [list(map(int,input().split())) for _ in range(N)]

dp = [[0,0,0] for _ in range(N)]
dp[0] = abc[0]
for i in range(1,N):
  for j in range(3):
    dp[i][j] = abc[i][j] + max(vv for k,vv in enumerate(dp[i-1]) if k != j)

print(max(dp[-1]))

Measured memory_bytes: 47384
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    A = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    B = [int(input()) for _ in range(N)]

    for b in B:
        for i, a in enumerate(A):
            for j, aa in enumerate(a):
                if b == aa:
                    A[i][j] = 0

    ans = 'No'
    for i in range(3):
        if A[i][0] == A[i][1] == A[i][2]:
            ans = 'Yes'
    for i in range(3):
        if A[0][i] == A[1][i] == A[2][i]:
            ans = 'Yes'
    if A[0][0] == A[1][1] == A[2][2]:
            ans = 'Yes'
    if A[0][2] == A[1][1] == A[2][0]:
            ans = 'Yes'

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <utility>
 
using namespace std;
vector<int> vec;
 
int main()
{
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//freopen("input.in", "r", stdin);
	long long n, a, b;
	scanf("%lld %lld %lld", &n, &a, &b);
	if(a+b > n+1 || a*b < n) printf("-1\n");
	else if(b == 1 && a == n)
	{
		for(int i = 1;  i <= n; i++)
		{
			printf("%d", i);
			if(i < n) printf(" ");
		} printf("\n");
	}
	else if(a == 1 && b == n)
	{
		for(int i = n;  i >= 1; i--)
		{
			printf("%d", i);
			if(i > 1) printf(" ");
		} printf("\n");
	}
	else
	{  
		for(int j = b; j >= 1; j--)
			vec.push_back(j);
		int kill = n-a+1, curr = b*2;
		for(int i = n-a+2; i <= n; i++)
		{
			vec.push_back(i);
			for(int j = max(2*b-kill,1LL); j <= b-1 && kill > b; j++)
			{
				vec.push_back(curr-j);
				kill--;
			}
			curr += b-1;
		}
 
		for(int i = 0; i < vec.size(); i++)
		{
			printf("%d", vec[i]);
			if(i == vec.size()-1) printf("\n");
			else printf(" ");
		}
	}
}

Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
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; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int n, m; cin >> n;
    std::map<std::string, int> s;
    rep(i, n)
    {
        string d; cin >> d;
        s[d]++;
    }
    cin >> m;
    rep(i, m)
    {
        string d; cin >> d;
        s[d]--;
    }

    int ans = 0;
    for (auto it : s)
    {
        ans = max(ans, it.second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int N, M;
  double sum = 0;
  int A[110];
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum += A[i];
  }
  sort(A, A+N, greater<int>());
  if (A[M-1] >= (sum / (4*M))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
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);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int[] a = new int[n];
            int cntodd = 0;
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
                if (a[i] % 2 != 0) cntodd++;
            }
            boolean ok = true;
            if (cntodd % 2 != 0) ok = false;
            out.println(ok ? "YES" : "NO");

        }

    }
}



Measured memory_bytes: 50456
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> broken(n+1);
  rep(i,m) {
    int a;
    cin >> a;
    broken[a] = 1;
  }
  vector<int> dp(n+2);
  const int mod = 1000000007;
  dp[n] = 1;
  for (int i = n-1; i >= 0; i--) {
    if (broken[i]) {
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i+1] + dp[i+2]) % mod;
  }
  cout << dp[0] << endl;
  return 0;
}    

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

int main(){
    long long x;
    cin >> x;
    // x /= 100;
    int year = 1;
    long long yokin = 100LL;
    while (1){
        yokin = (long long)(yokin * 1.01);
        if (yokin >= x){
            cout << year << endl;
            break;
        }
        year ++;
    }
}

Measured memory_bytes: 3568
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, s[100];//入力
	int i = 0, j = 0, d = 0, kari = 0, min = 100, old = 0, flag = 0; //内部で使用;
	int ans = 0; //出力

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


	//↑ここまで入力パート
	rep(i, n) {
		kari += s[i];
		if (s[i] < min and s[i] % 10 != 0) min = s[i];
	}
	if (kari % 10 != 0) ans = kari;
	else if (min != 100) ans = kari - min;
	else ans = 0;

	cout << ans << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
int main()
{
ios_base::sync_with_stdio(false);
int a,b;
cin>>a>>b;
if(a>8||b>8)
cout<<":(";
else
cout<<"Yay!";
}

Measured memory_bytes: 256
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);

	void solve(){
		int n=gInt();
		long[]a=new long[n+1];
		for(int i:rep(1,n))
			a[i]=gInt();

		long res=0;
		int r=0,xor=0;
		for(int l:rep(1,n)){
			while(r<n&&(xor&a[r+1])==0){
				++r;
				xor^=a[r];
			}
			res+=r-l+1;
			xor^=a[l];
		}
		System.out.println(res);
	}

	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}
class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}

	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}

}

Measured memory_bytes: 61420
/*  ex9_2
    takafumi_ueki */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 100001
//リストのノードの定義
typedef struct node{
    char elem;
    struct node *next;
}node;
//プロトタイプ宣言
void push(node **first, char elem);
char pop(node **first);

int main(void){
    char cubes[SIZE],top;
    int i,num;
    int count = 0;
    //リストの先頭が指す先
    node *first = NULL;
    //cubeの状態を入力する
    scanf("%s",cubes);
    num = strlen(cubes);
    //状態の読み込み
    for(int i=0; i<num; i++)
        //空であればpushする。
        //追加予定の要素が先頭の要素と同じであればスタックにノードを追加する
        if(first == NULL || first->elem == cubes[i]){
            push(&first, cubes[i]);
        }
        //異なっている場合はスタックの先頭ノードを取り出す
        else if(first->elem != cubes[i]){
            top = pop(&first);
            count += 2;
        }
    //結果を出力する
    printf("%d\n", count);
    return 0;
}
//スタックにデータを追加する
void push(node **first, char elem){
    //領域の確保
    node *new = calloc(1, sizeof(node));
    if (new == NULL){
        exit(1);
    }
    //新しいデータの要素がelemで、それに続くものはfirst
    new->elem = elem;
    new->next = *first;
    //新しいノードが一番目に
    *first = new;
}
//スタックからデータを取り出す
char pop(node **first){
    char elem;
    node *tmp = *first;
    //空ならエラー
    if (tmp == NULL){
        exit(1);
    }
    //elemを次のノードに移動
    elem = tmp->elem;
    *first = tmp->next;
    //メモリを解放する
    free(tmp);
    return elem;
}

Measured memory_bytes: 4948
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define MAX 100000
#define NIL -1
 
typedef struct search{
  struct search *right;
  struct search *left;
  struct search *p;
  int key;
 
}search;
 
void insert(int);
void  inorderTreeWalk(search *x);
void Puriorder(search *x);
search *find(search *x, int k);
search *T,*B;
 
int main(){
  int i,v,k;
  char a[32];
 
  T = NULL;
 
  scanf("%d",&v);
  for ( i = 0;i < v;i++){
    scanf("%s",a);
    if(strcmp(a,"find")==0){
       scanf("%d",&k);
       B = find (T,k);
       if(B != NULL){
	 printf("yes\n");
       }else{
	 printf("no\n");
       }
  }else if(strcmp(a,"insert")==0){
      scanf("%d",&k);
      insert(k);
    }
    else if(strcmp(a,"print")==0){
      inorderTreeWalk(T);
      printf("\n");
      Puriorder(T);
      printf("\n");
    }
 
  }
  return 0;
}
 
 
//??????
void  inorderTreeWalk(search *x){
  if(x !=NULL){
    inorderTreeWalk(x->left);
    printf(" %d",x->key);
    inorderTreeWalk(x->right);
  }
}
 
void Puriorder(search *x){
  if(x !=NULL){ 
    printf(" %d",x->key);
    Puriorder(x->left);
    Puriorder(x->right);
  }
}
 
 
 
 
 
 
 
void insert(int key){
  search *x,*y,*z;
  y = NULL; // x ??????
  x = T;
  z = (search *)malloc(sizeof(search));
  z->key = key;
  z->right = NULL;
  z->left = NULL;
  z->p = NULL;
  while (x != NULL){
    y = x; // ???????¨????
    if (z->key < x->key)
      x = x->left; // ?????????????§????
    else
      x = x->right; // ?????????????§????
  }
  z->p = y;
 
  if( y == NULL){ // T ???????????´???
    T = z;
  }
  else if (z->key < y->key)
    y->left = z; // z ??? y ?????????????????????
  else
    y->right = z; // z ??? y ?????????????????????
}

search *find(search *x , int k){
  while (x != NULL && k != x -> key){
    if(k < x -> key){
      x = x->left;
    }else{
      x = x->right;
    }
  
  }
  return x;
  
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> dp(n + 1, 0), dpz(n + 1, 0);
    rep(i, n) {
        dp[i + 1] = dp[i] + a[i];
        dpz[i + 1] = dpz[i] + ((a[i] > 0) ? a[i] : 0);
    }
    ll ans = 0;
    rep(i, n - k + 1) {
        ll val = dp[i + k] - dp[i];
        ll lsum = dpz[i];
        ll rsum = dpz[n] - dpz[i + k];
        ans = max(ans, val + lsum + rsum);
        ans = max(ans, lsum + rsum);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func main() {
	INF := int(math.Pow10(11))
	A := nextInt()
	B := nextInt()
	Q := nextInt()
	s := make([]int, A+2)
	s[0], s[A+1] = -INF, INF
	for i := 1; i <= A; i++ {
		s[i] = nextInt()

	}

	t := make([]int, B+2)
	t[0], t[B+1] = -INF, INF
	for i := 1; i <= B; i++ {
		t[i] = nextInt()
	}

	for i := 0; i < Q; i++ {
		x := nextInt()
		b, d := sort.SearchInts(s, x), sort.SearchInts(t, x)
		res := INF
		for _, S := range []int{s[b-1], s[b]} {
			for _, T := range []int{t[d-1], t[d]} {
				d1, d2 := abs(S-x)+abs(T-S), abs(T-x)+abs(S-T)
				res = min(res, min(d1, d2))
			}
		}

		fmt.Println(res)
	}
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


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

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

using ll = long long;

ll memo[200100]={0};

int main() {
  ll N;
  cin >> N;
  vector<ll> v(N);
  for(ll i = 0LL; i < N; i++) {
    cin >> v.at(i);
    memo[v.at(i)]++;
  }
  ll cnt = 0LL;
  for(ll i = 0; i < 200100LL;i++) {
    cnt += (memo[i] - 1) * memo[i] / 2;
  }
  for(ll i = 0LL; i < N; i++) {
    ll n = memo[v.at(i)];
    cout << cnt - n + 1 << endl;
  }
}

Measured memory_bytes: 4736
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int D = scan.nextInt();

		while(A > 0 && C > 0){
				if(A > 0){
					C = C - B;
				}
				if(C > 0){
					A = A - D;
				}
			}

		if(A <= 0){
			System.out.println("No");
		}else if(C <= 0){
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 35712
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        int n = Integer.parseInt(stdin.readLine());
        char[][] s = new char[n][n];
        for (int i = 0; i < n; i++) s[i] = stdin.readLine().toCharArray();

        int a = 0;
        int c = 0;
        for (int b = 0; b < n; b++) {
            char[][] t = new char[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    t[(i + a) % n][(j + b) % n] = s[i][j];
                }
            }
            if (ok(n, t)) c++;
        }

        stdout.println(c * n);
    }

    private boolean ok(int n, char[][] s) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (s[i][j] != s[j][i]) return false;
            }
        }
        return true;
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}

Measured memory_bytes: 48280
#include <bits/stdc++.h>
#define pq priority_queue
#define P pair<int, int>
#define P2 pair<int, P>
#define P3 pair<int, P2>
using namespace std;
typedef long long ll; typedef long double ld;
constexpr long long gcd(long long a, long long b){return b ? gcd(b, a % b) : a;}
constexpr long long lcm(long long a, long long b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int mod_pow(long long x, long long n, const int mod){long long ret=1;while(n){if(n&1)(ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}
template<int n> struct Prime{bool arr[n+1];constexpr bool operator[](int k){return arr[k];}constexpr Prime():arr(){for(int i=2;i<n;i++){arr[i]=true;for(int j=2;j*j<=i;j++){if(!(i%j))arr[i]=false;}}}};
template<int n> struct Factorial{long long arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=mod_pow(arr[i+1],MOD-2,MOD);}}};
constexpr Factorial<10> fact;
constexpr Prime<10> prime;
constexpr int comb(int a, int b){long long pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b];return pos * pot % MOD * por % MOD;}
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr int sqrtN = 512, logN = 32;
constexpr ld PI = abs(acos(-1));
constexpr ll LINF=1e18;

int main(){
	int n; cin >> n; int a[100010], b[100010];
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) cin >> b[i];
	
	ll ret = 1;
	for(int i = 1; i < n - 1; i++){ 
		if(a[i - 1] != a[i]){
			if(a[i] > b[i]) ret = 0;
			continue;
		}
		if(b[i + 1] != b[i]){
			if(b[i] > a[i]) ret = 0;
			continue;
		}
		(ret *= min(a[i], b[i])) %= MOD;
	}
	
	if(a[n - 1] != b[0]) ret = 0;
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
#include<map>
#include<set>
#include<utility>
#include<tuple>
using namespace std;
int myeval(string s) {
	int a = (int)s[0] - '0';
	int b = (int)s[2] - '0';
	int c = (int)s[4] - '0';
	int d = (int)s[6] - '0';
	int sum = a;
	if (s[1] == '+') sum += b;
	else sum -= b;
	if (s[3] == '+') sum += c;
	else sum -= c;
	if (s[5] == '+') sum += d;
	else sum -= d;
	return sum;
}
bool dfs(string abcd, string op, string &res) {
	string orig = res + op + abcd[0];
	res = orig;
	if (abcd.size() == 1) {
		int e = myeval(res);
		return e == 7 ;
	}
	else {
		string sub(abcd.begin() + 1, abcd.end());
		if(dfs(sub, "+", res)) return true;
		res = orig;
		return dfs(sub, "-", res);
	}
}

int main() {
	string s;
	cin >> s;
	string res(s.begin(), s.begin()+1);
	string ans;
	if (dfs(string(s.begin()+1, s.end()), "+", res)) ans = res;
	else
	{
		res = string(s.begin(), s.begin() + 1);
		if (dfs(string(s.begin()+1, s.end()), "-", res))ans = res;
	}
	cout << res + "=7"<<endl;
	return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline bool isp(int n) {
	if(n<2)return false;
	if(n==2)return true;
	for (int i=2; i<sqrt(n)+1; i++)if(n%i==0)return false;
	return true;
}
int main(){
	int x;
	cin>>x;
	for(register int i=x;;++i){
		if(isp(i)){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
} 

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, k = rli()
    if k == 1:
        print(0)
    else:
        print(n-k)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();

		boolean[][] card_52;
		card_52 = new boolean[4][13];

		for (int i = 0; i < n; i++) {
			String SHCD = scan.next();
			int num1_13 = scan.nextInt();

			if (SHCD.equals("S")) {
				card_52[0][num1_13 - 1] = true;

			} else if (SHCD.equals("H")) {
				card_52[1][num1_13 - 1] = true;

			} else if (SHCD.equals("C")) {
				card_52[2][num1_13 - 1] = true;

			} else if (SHCD.equals("D")) {
				card_52[3][num1_13 - 1] = true;

			}

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 13; j++) {
				if (i == 0) {
					if (card_52[0][j] == false) {
						System.out.println("S" + " " + (j + 1));
					}

				}
				if (i == 1) {
					if (card_52[1][j] == false) {
						System.out.println("H" + " " + (j + 1));
					}

				}
				if (i == 2) {
					if (card_52[2][j] == false) {
						System.out.println("C" + " " + (j + 1));
					}

				}
				if (i == 3) {
					if (card_52[3][j] == false) {
						System.out.println("D" + " " + (j + 1));
					}

				}

			}

		}

	}

}

Measured memory_bytes: 26288