akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
using namespace std;
#define MAX 111
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int n,a[MAX],mx;
int vis[MAX];
void Out(){puts("Impossible");exit(0);}
int main()
{
	n=read();
	for(int i=1;i<=n;++i)mx=max(mx,a[i]=read());
	for(int i=1;i<=n;++i)vis[a[i]]++;
	if(mx&1)
	{
		for(int i=mx-mx/2;i<=mx;++i)if((vis[i]-=2)<0)Out();
		for(int i=mx-mx/2;i;--i)if(vis[i])Out();
	}
	else
	{
		if(!vis[mx/2])Out();vis[mx/2]-=1;
		for(int i=mx/2+1;i<=mx;++i)if((vis[i]-=2)<0)Out();
		for(int i=mx/2;i;--i)if(vis[i])Out();
	}
	puts("Possible");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;

int main() {
  int N,k,pairs=0; cin >> N;
  vector<int> rabbits;
  for(int i=0;i<N;i++) {
    cin>>k; rabbits.push_back(k);
  }
  for(int i=0;i<N;i++) {
    int like = rabbits[i];
    if(i+1 == rabbits[like-1]) pairs++;
  }
  cout << pairs/2 << endl;
}


Measured memory_bytes: 892
package main

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

func main() {
	N := ReadInt()
	L := ReadInts(N)
	sort.Ints(L)
	c := 0
	for i := 0; i < N-2; i++ {
		for j := i + 1; j < N-1; j++ {
			for k := j + 1; k < N; k++ {
				if L[i] == L[j] || L[j] == L[k] {
					continue
				}
				if L[k] < L[i]+L[j] {
					c++
				}
			}
		}
	}
	fmt.Println(c)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1844
N, K = map(int, input().split())
MOD = 10 ** 9 + 7
lst = [0] + [pow(K // d, N, MOD) for d in range(1, K + 1)]

for d in range(K, 0, -1):
    lst[d] -= sum(lst[d * i] for i in range(2, K // d + 1))

ans = 0
for i, x in enumerate(lst):
    ans = (ans + i * x) % MOD
print(ans)


Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
long long mod=1000000007;
long long dp[100009];
bool q[100009];

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> a(M);
  for(int i=0;i<M;i++)cin >> a[i];
  for(int i=1;i<=N;i++)q[i]=true;
  for(int i=0;i<M;i++)q[a[i]]=false;
  dp[0]=1;
  if(q[1])dp[1]=1;
  for(int i=2;i<=N;i++){
    if(!q[i])continue;
    dp[i]=(dp[i-2]+dp[i-1])%mod;
  }
  cout << dp[N] << endl;
}

Measured memory_bytes: 1280
n,m=map(int,input().split())
h=list(map(int,input().split()))
mi=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    mi[a].append(h[b])
    mi[b].append(h[a])
ans=0
for i in range(n):
    if len(mi[i])==0:
        ans+=1
    else:
        if h[i]>max(mi[i]):ans+=1

print(ans)

Measured memory_bytes: 23120
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
#define ms(a) memset(a,0,sizeof(a))
#define N


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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a>0&&b>0){
    cout<<"Positive"<<endl;
  }
  else if(a<0&&b<0){
    if((a+b)%2==0){
      cout<<"Negative"<<endl;
    }
    else{
      cout<<"Positive"<<endl;
    }
  }
  else{
    cout<<"Zero"<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define PP pair<P,P>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	random_device rnd;
	mt19937_64 mt64(rnd());
	uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n;
vector<int>a(222222), b(222222);
int x(int y) {
	return (y + n) % n;
}
int f(vector<int>&v) {
	queue<int>que;
	rep(i, n) {
		if (v[x(i - 1)] + v[x(i + 1)] < v[i]) {
			que.push(i);
		}
	}
	int res = 0;
	while (!que.empty()) {
		int i = que.front(); que.pop();
		if (v[i] % (v[x(i - 1)] + v[x(i + 1)]) == 0) {
			int memo= v[i] / (v[x(i - 1)] + v[x(i + 1)]) - 1;
			res += memo;
			v[i] -= (v[x(i - 1)] + v[x(i + 1)]) * memo;
		}
		else {
			res += v[i] / (v[x(i - 1)] + v[x(i + 1)]);
			v[i] %= v[x(i - 1)] + v[x(i + 1)];
		}
		if (v[x(i - 1)] > v[i] + v[x(i - 2)])que.push(x(i - 1));
		if (v[x(i + 1)] > v[i] + v[x(i + 2)])que.push(x(i + 1));
	}
	return res;
}
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	int an1 = f(a), an2 = f(b);
	rep(i, n) {
		if (a[i] != b[i]) {
			cout << -1 << endl; return 0;
		}
	}
	cout << an2 - an1 << endl;
}

Measured memory_bytes: 4584
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


template <typename T>
std::vector<T> divisibles(T n) {
  std::vector<T> a;

  for (T i = 1, r; i * i <= n; i ++)
    if (n % i == 0) {
      a.push_back(i);

      if ((r = n / i) != i)
        a.push_back(r);
    }

  std::sort(ALL(a));

  return a;
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int A, B, K;

  std::cin >> A >> B >> K;

  std::vector<int> a(divisibles(A)), b(divisibles(B)), c;

  std::set_intersection(ALL(a), ALL(b), std::back_inserter(c));

  std::cout << c[c.size() - K] << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
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() {
  int N, A, B;
  cin >> N >> A >> B;
  int i, j;
  i = min(A, B);
  j = max(A+B-N, 0);
  cout << i << " " << j << endl;
}

Measured memory_bytes: 256
import sys

n,m = map(int,input().split())
data = [input() for _ in range(m)]

# 重複している組み合わせを消す。
data2 = list(set(data))

# 数値に変換
data3 = [list(map(int,x.split())) for x in data2]

#pdb.set_trace()

# 一桁目を0に指定していたら-1を出力
# 矛盾しているケースは-1を出力
temp = []
for x in data3:
    temp.append(x[0])

if len(temp) > len(list(set(temp))):
    print(-1)
    sys.exit()

answer = [1,]+[0,]*(n-1)

for x in data3:
    answer[x[0]-1] = x[1]

if n == 1 and m == 0:
    print(0)
elif answer[0] == 0 and len(answer) != 1:
    print(-1)
else:
    print(''.join([str(x) for x in answer]))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define init ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
using namespace std;
//  =========     /\       /|    |====/|
//      |        /  \       |    |   / |
//      |       /____\      |    |  /  |
//      |      /      \     |    | /   |
//  ========= /        \  =====  |/====|  
//  code

typedef long long int ll;
int main(){
    init;
    ll N,W,i,j,k,l;
    cin>>N>>W;
    ll w[N+1],v[N+1];
    for(i=1,k=0;i<=N;i++){
        cin>>w[i]>>v[i];
        k += v[i];
    }
    ll dp[N+1][k + 1];
    for(i=0;i<=N;i++){
        for(j=0;j<=k;j++){
            if(j == 0)
                dp[i][j] = 0;
            else
                dp[i][j] = 1e18;
        }
    }

    for(i=1;i<=N;i++){
        for(j=1;j<=k;j++){
            if(j >= v[i]){
                dp[i][j] = min(dp[i-1][j - v[i]] + w[i] , dp[i-1][j]);
            }
            else dp[i][j] = dp[i-1][j];
        }
    }
    j = 0;
    for(i=1;i<=k;i++)
        if(dp[N][i] <= W)
            j = i;
    cout<<j<<endl;
    return 0;
}

Measured memory_bytes: 79232
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        // heights.length本の花の高さ(最初の値は0)
        int heights[] = new int[scan.nextInt()];
        for(int i = 0; i < heights.length; i++) {
            heights[i] = 0;
        }

        // heights.length本の花の高さの目標値(初期値は標準入力から受け取る)
        int heightTargets[] = new int[heights.length];
        for(int i = 0; i < heightTargets.length; i++) {
            heightTargets[i] = scan.nextInt();
        }

        // 水やりの最小値を出力する
        System.out.println(minWarteringCount(heights, heightTargets));

        scan.close();
        return;
    }

    // 花の高さの配列h[]が全てht[]になるまでの最小の水やり回数を求めるメソッド
    public static int minWarteringCount(int h[], int ht[]) {
        int result = 0, hMin, htMin;

        // h[]とht[]の最小値をそれぞれ見つける
        hMin = h[0];
        htMin = ht[0];
        for(int i = 1; i < h.length; i++) {
            if(h[i] < hMin) {
                hMin = h[i];
            }

            if(ht[i] < htMin) {
                htMin = ht[i];
            }
        }

        // ht[]の最小値とh[]の最小値の差だけhの各要素とresultの値を増やす
        for(int i = 0; i < h.length; i++) {
            h[i] += htMin - hMin;
        }
        result += htMin - hMin;

        // まだ目標値を満たしていない部分について、そのうち連続している部分ごとにこのメソッドを呼び出し、resultの値を増やす
        int k = 0;
        while(k < h.length) {
            // h[k]がまだ目標値ht[k]に達していないときの処理
            if(h[k] < ht[k]) {
                int start = k; //部分の先頭の番号
                int end = k; //部分の末尾の番号

                // 末尾を探す
                while(end + 1 < h.length && h[end + 1] < ht[end + 1]) {
                    end++;
                }

                // hとhtの添字startからendの部分について新しく配列を作り、このメソッドを呼び出す
                int h2[] = new int[end - start + 1];
                int ht2[] = new int[end - start + 1];
                for(int i = 0; i < h2.length; i++) {
                    h2[i] = h[start + i];
                    ht2[i] = ht[start + i];
                }
                result += minWarteringCount(h2, ht2);

                // ここで扱った部分だけkの値を増やし、end+1番目の要素の検査に移る
                k += end - start;
            }

            // kをインクリメントし、次の要素の検査に移る
            k++;
        }

        return result;
    }
}

Measured memory_bytes: 35732
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
# b, c =
# a = int(input())
n = str(input())
#target_list = [int(i) for i in input().split()]

# 判定
if len(list(set(n)))==2:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
main(){
long long i,j,k,l,m,n;
while(cin>>l>>m>>n){
     k=m-l;
k++;
  if(n*2>=k){
    for(i=l;i<=m;i++)cout<<i<<endl;
  }
  else{
    for(i=l;i<l+n;i++) cout<<i<<endl;
    
    for(i=(m-n)+1;i<=m;i++)cout<<i<<endl;

  }
} return 0;

}


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

int main(){
    int n;
    cin >> n;
    map<string, int> s;
    rep(i,n){
        string tmp;
        cin >> tmp;
        s[tmp]++;
    }
    cout << s.size() << endl;

}

Measured memory_bytes: 19260
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;

void chmax(ll& x, ll y) {
    if (x < y) x = y;
}

const ll MOD = 1000000007;
//const ll MOD = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        return mint(*this) /= a;
    }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

    ll n; cin >> n;

    vector<ll> d(n), c(n);
    REP(i, n) cin >> d[i] >> c[i];

    ll D = 0, S = 0;
    REP(i, n) {
        D += c[i];
        S += d[i] * c[i];
    }

    print((D - 1) + (S - 1) / 9);
}


Measured memory_bytes: 6296
N = int(input())
H = list(map(int, input().split()))
count = 0
Ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count = count + 1
    if count > Ans:
      Ans = count
  else:
    count = 0

print(Ans)

Measured memory_bytes: 14252
while number = gets.to_i
  break if number == 0

  a = gets.split.map(&:to_i).each_with_object(Hash.new(0)) { |o, h| h[o] += 1 }
  b = a.sort_by { |k, v| -v }
  if b[0][1] > number / 2
    puts b[0][0]
  else
    puts 'NO COLOR'
  end
end

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

bool judge_num(int output, vector<int> D, int K){
    int A = output;
    while(A > 0){
        int n = A % 10;
        for(int i = 0; i < K; i++){
            if(n == D.at(i)){
                return true;
            }
        }
        A = A / 10;
    }
    return false;
}

int iroha(int N, vector<int> D, int K){
    int output = N;
    while(judge_num(output, D, K)){
        output++;
    }
    return output;
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> D(K);
    for(int i = 0; i < K; i++){
        cin >> D.at(i);
    }

    int minimum = iroha(N, D, K);

    cout << minimum << endl;
    return 0;
}

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

using namespace std;

int main(){

  string num;

  while(cin >> num){

    int proof=0;

    if((num.at(0)==num.at(1))&&(num.at(1)==num.at(2)) && (num.at(2)==num.at(3))) proof=1;

    else if((num.at(0)==num.at(1))&&(num.at(1)==num.at(2)))proof=1;

    else if((num.at(1)==num.at(2))&&(num.at(2)==num.at(3)))proof=1;

    if(proof==1) cout << "Yes" <<endl;
    else cout << "No" <<endl;
  }

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var s string
	fmt.Scan(&s)

	var max, cnt float64
	for _, c := range s {
		if c == 'A' || c == 'C' || c == 'G' || c == 'T' {
			cnt++
		} else {
			cnt = 0
		}
		max = math.Max(max, cnt)
	}

	fmt.Print(max)
}


Measured memory_bytes: 512
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
int main() {
	int n, k;cin >> n >> k;vector<ld> p(n), q(n + 1);q[0] = 0;
	ld ans = 0;
	rep(i, n) {
		cin >> p[i];
		q[i + 1] = q[i] + (p[i] + 1) / 2;
	}
	rep(i, n - k + 1) {
		ans = max(q[i + k] - q[i], ans);
	}
	cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using namespace std;

using ll=long long;

using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;
using vs=vector<string>;

int main() {
  int N; cin >>N;
  vll X(N);
  rep(i,0,N) {cin >>X[i];}
  vll Y(N);
  Y=X;
  sort(all(Y));
  int m=N/2;
  int mida=Y[m-1];
  int midb=Y[m];
  rep(i,0,N) {
    if (X[i]<=mida) {
      cout <<midb <<endl;
    } else {
      cout <<mida <<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 6432
from collections import deque

n,x,y = map(int,input().split())

adj = [[] for i in range(n)]

adj[x-1].append(y-1)
adj[y-1].append(x-1)

for i in range(n-1):
    adj[i].append(i+1) 
    adj[i+1].append(i)
        
ans = [0 for _ in range(n)]

def bfs(start):
    inf = 1001001001
    q = deque()
    q.append(start)
    dist = [inf]*n
    dist[start] = 0
    
    while q:
        v = q.popleft()

        for i in adj[v]:
            if dist[i] == inf:
                dist[i] = dist[v] + 1
                q.append(i)

    for i in range(n):
        ans[dist[i]] += 1

for i in range(n):
    bfs(i)

for i in range(1,n):
    print(ans[i]//2)

Measured memory_bytes: 47324
#include <bits/stdc++.h>
using namespace std;
int main() 
{
  int N;
  long long int L0 = 2;
  long long int L1 = 1;
  long long int ans;  
  cin >> N;
  for (int i; i < N - 1; i++)
  {
    ans = L1 + L0;
    L0 = L1;
    L1 = ans;
  }
  if (N == 0)
  {
    ans = 2;
  }
  else if (N == 1)
  {
    ans = 1;
  }
  cout << ans << endl;
}


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

int main() {
    vector<int> bingo_card(9);
    for (int i = 0; i < 9; i++) {
        cin >> bingo_card.at(i);
    }

    int a;
    cin >> a;
    //ここでビンゴの穴を開ける。開けたところは０。
    vector<int> data(a);
    for (int i = 0; i < a ; i++) {
        cin >> data.at(i);
        for (int j = 0; j < 9 ; ++j) {
            if (data.at(i) == bingo_card.at(j)) {
                bingo_card.at(j) = 0;
            }
        }
    }
    //ここで揃っているか確認

    if (bingo_card.at(0) == bingo_card.at(1) && bingo_card.at(1) == bingo_card.at(2)) {
        cout << "Yes" << endl;
    }
    else if (bingo_card.at(3) == bingo_card.at(4) && bingo_card.at(3) == bingo_card.at(5)) {
        cout << "Yes" << endl;
    }
    else if (bingo_card.at(6) == bingo_card.at(7) && bingo_card.at(6) == bingo_card.at(8)) {
        cout << "Yes" << endl;
    }
    else if (bingo_card.at(0) == bingo_card.at(3) && bingo_card.at(0) == bingo_card.at(6)) {
        cout << "Yes" << endl;
    }
    else if (bingo_card.at(1) == bingo_card.at(4) && bingo_card.at(1) == bingo_card.at(7)) {
        cout << "Yes" << endl;
    }
    else if (bingo_card.at(2) == bingo_card.at(5) && bingo_card.at(2) == bingo_card.at(8)) {
        cout << "Yes" << endl;
    }
    else if (bingo_card.at(0) == bingo_card.at(4) && bingo_card.at(0) == bingo_card.at(8)) {
        cout << "Yes" << endl;
    }
    else if (bingo_card.at(2) == bingo_card.at(4) && bingo_card.at(2) == bingo_card.at(6)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

}


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


void solve(long long A, long long B, long long K){
    int g = __gcd(A, B);
    vector <int> a;
    for (int i = 1; i <= g; i++) {
        if (g % i == 0) {
            a.push_back(i);
        }
    }
    cout << a[a.size() - K] << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long K;
    scanf("%lld",&K);
    solve(A, B, K);
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    ($ttype:ty) => {
        {
            let mut input = String::new();
            let _= std::io::stdin().read_line(&mut input);
            input.trim().parse::<$ttype>().unwrap()
        }
    };

    ($($ttype:ty),*) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let mut iter = input.trim().split_whitespace();
            (
                $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*
            )
        }
    };

    ($ttype:ty; $x:expr) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let v: Vec<$ttype> = input
                .trim()
                .split_whitespace()
                .map(|x| x.parse().unwrap())
                .collect();
            v
        }
    };

    ($ttype:ty; $x:expr; $y:expr) => {
        {
            use std::io::BufRead;
            let mut matrix = Vec::with_capacity($y);
            for _ in 0..$y {
                let mut input = String::new();
                let stdin = std::io::stdin();
                let _ = stdin.lock().read_line(&mut input);
                let v: Vec<$ttype> = input
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse().unwrap())
                    .collect();
                matrix.push(v);
            }
            matrix
        }
    };
}

use std::collections::HashMap;

fn main() {
    let _n = input!(usize);
    let a_lst = input!(i64; n);
    let mut map: HashMap<i64, i64> = HashMap::new();

    for a in a_lst.iter() {
        if map.contains_key(a) {
            if let Some(x) = map.get_mut(a) {
                *x += 1;
            }
        } else {
            map.insert(*a, 1);
        }
    }

    let mut long_1st: i64 = 0;
    let mut long_2nd: i64 = 0;
    for (&key, &value) in map.iter() {
        if value >= 2 {
            if value / 2 < 1 {
                break;
            }
            if value / 2 > 1 {
                if key > long_1st {
                    long_2nd = long_1st;
                    long_1st = key;
                } else if key > long_2nd {
                    long_2nd = key;
                }
            }
            if key > long_1st {
                long_2nd = long_1st;
                long_1st = key;
            } else if key > long_2nd {
                long_2nd = key;
            }
        }
    }
    println!("{}", long_1st * long_2nd);
}


Measured memory_bytes: 12540
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
m = map(int,read().split())
AB = zip(m,m)

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

dist = [-1] * (N+1)
stack = [1]
dist[1] = 0
while stack:
    v = stack.pop()
    for w in graph[v]:
        if dist[w] == -1:
            dist[w] = dist[v] + 1
            stack.append(w)

ev = [i for i,x in enumerate(dist) if x % 2 == 0 and i > 0]
od = [i for i,x in enumerate(dist) if x % 2 == 1 and i > 0]

def make_perm(N, ev, od, x0, x1, x2, y0, y1, y2):
    assert len(ev) == x0 + x1 + x2
    assert len(od) == y0 + y1 + y2
    P = [0] * (N+1)
    for i in ev:
        if x0:
            P[i] = (x0 + y0) * 3
            x0 -= 1
            continue
        if x1:
            P[i] = (x1 + y1) * 3 - 2
            x1 -= 1
            continue
        if x2:
            P[i] = (x2 + y2) * 3 - 1
            x2 -= 1
            continue
    for i in od:
        if y0:
            P[i] = (x0 + y0) * 3
            y0 -= 1
            continue
        if y1:
            P[i] = (x1 + y1) * 3 - 2
            y1 -= 1
            continue
        if y2:
            P[i] = (x2 + y2) * 3 - 1
            y2 -= 1
            continue
    return P[1:]

def solve(N, ev, od):
    x0 = N // 3
    x1 = (N+2) // 3
    x2 = (N+1) // 3
    perm = [0] * (N+1)
    LE = len(ev)
    LO = len(od)
    if LE <= x0:
        return make_perm(N, ev, od, LE, 0, 0, x0-LE, x1, x2)
    if LO <= x0:
        return make_perm(N, ev, od, x0-LO, x1, x2, LO, 0, 0)
    if LE == x1:
        return make_perm(N, ev, od, 0, x1, 0, x0, 0, x2)
    if LO == x1:
        return make_perm(N, ev, od, x0, 0, x2, 0, x1, 0)
    # どちらも x1 よりたくさんある
    return make_perm(N, ev, od, LE-x1, x1, 0, LO-x2, 0, x2)

P = solve(N, ev, od)
print(' '.join(map(str, P)))

Measured memory_bytes: 73480
#!python3.4.3

k = int(input())

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[k-1])  


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>
const int N = 2e5 + 10;

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string s;
    int k;
    cin >> s >> k;
    set<string> st;
    int n = sz(s);
    for(int t = 1; t <= 5; t++) {
        for(int i = 0; i < n - t + 1; i++) {
            st.insert(s.substr(i, t));
        }
    }
    vector<string> v;
    for(auto &el : st) {
        v.push_back(el);
    }
    cout << v[k - 1] << "\n";
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int in;
	ll ans = 1;
	cin >> in;
	range(i, 1, in + 1) {
		ans *= i;
		ans %= MOD;
	}
	cout << ans << endl;
}

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


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			int k = sc.nextInt();
			int m = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			ArrayList<Integer> list = new ArrayList<>();
			
			for(int i = 0; i < n; i++){
				list.add(i + 1);
			}
			
			int current = m - 1;
			
			while(list.size() > 1){
//				System.out.println("remove "+list.get(current));
				list.remove(current);
				
				current = (current + k - 1)%list.size();
//				System.out.println("next index is "+current);
			}
			
			System.out.println(list.get(0));
		}
	}

}



Measured memory_bytes: 44244
import java.io.*;
import java.util.*;

class Main {
    
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        String s = sc.next();

        if (s.equals("Sunny")){
            System.out.println("Cloudy");
        }else if (s.equals("Cloudy")){
            System.out.println("Rainy");
        }else{
            System.out.println("Sunny");
        }

    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21200
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
#define M 1000000007

int p[105];

int main(void){
	int n,a,b;cin>>n>>a>>b;
	int c1=0,c2=0,c3=0,p;
	for(int i=0;i<n;i++){
		cin>>p;
		if(p>b)c3++;
		else if(p>a)c2++;
		else c1++;
	}
	cout<<min(c1,min(c2,c3))<<endl;
	
	return 0;
}


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

using namespace std;
template<typename T, typename U> void amin(T &x, U y) { if(x > y) x = y; }
template<typename T, typename U> void amax(T &x, U y) { if(x < y) x = y; }
typedef long long ll;
const int MAX_N = 2000;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
	ll N, x, cost[MAX_N], cmin[MAX_N], ans = INFL;
	cin >> N >> x;
	for(int i=0;i<N;i++) {
		cin >> cost[i];
		cmin[i] = cost[i];
	}

	for(int i=0;i<N;i++) {
		ll sum = 0;
		for(int j=0;j<N;j++) {
			amin(cmin[j], cost[(j+N-i) % N]);
			sum += cmin[j];
		}
		amin(ans, sum+x*i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll A, B, C, K; cin >> A >> B >> C >> K;
    if(K & 1) {
        cout << B - A << endl;
    } else {
        cout << A - B << endl;
    }
	return 0;
}

Measured memory_bytes: 256
/* Includes */
#include <stdio.h>

/* Defines */

/* Variables */
char list_dictionary[2][26] = {{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'},
                            {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}};
char list_word[1200];
int list_counter[26];

/* Prototypes */
int Output();

/* Main */
int main()
{
    for (int i = 0; i < 1200; i++) {
        scanf("%c", &list_word[i]);

        if ((list_word[i - 1] == '\n') && (list_word[i] == '\n')) {
            break;
        }
        else {
            /* NOP */
        }
    }
    
    //scanf("%[^\n]", &list_word);
    
    for (int i = 0; i < 1200; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 26; k++) {
                if (list_word[i] == list_dictionary[j][k]) {
                    list_counter[k]++;
                    break;
                }
                else {
                    /* NOP */
                }
            }
        }
    }

    Output();

}

/*Sub*/
int Output(){
    for (int i = 0; i < 26; i++) {
        printf("%c : %d\n", list_dictionary[0][i], list_counter[i]);
    }
}


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

template<typename T>
struct Dinic{
    //辺
    struct edge
    {
        //行先と逆辺、revはid参照されているので、
        //追加された順に1,2,3,...となっている
        int to,rev;
        //cap は capacityの略
        T cap;
        edge(int to,T cap,int rev):to(to),cap(cap),rev(rev){};
    };
 
    const T INF;
 
    //グラフと探索済みかの配列
    vector<vector<edge>> graph;
    vector<int> iter,level;
 
    Dinic(int n):INF(numeric_limits<T>::max()){
        graph.resize(n);
    }
 
    void add_edge(int from, int to, T cap){
        //from ~ toにcapの辺を通す
        graph[from].emplace_back(to,cap,int(graph[to].size()));
        //to~from　に0容量の辺を通す
        graph[to].emplace_back(from,0,int(graph[from].size())-1);
    }
 
    //容量がある条件で最短距離の検索
    bool bfs(int s, int t){
        level.assign(graph.size(),-1);
        queue<int> que;
        level[s] = 0;
        que.push(s);
 
        while(!que.empty() and level[t] == -1){
            int p = que.front();
            que.pop();
 
            for(auto &e : graph[p]){
                if(e.cap > 0 and level[e.to] == -1){
                    que.push(e.to);
                    level[e.to] = level[p] + 1;
                }
            }
        }
 
        return level[t] != -1;
 
    }
 
    //ただのdfs探索
    //これは一本のパスについてflowを返していく
    T dfs(int v, const int t, T flow){
        //終了地点にきたらflowを返す
        if(v == t) return flow;
        for(int &i = iter[v]; i < graph[v].size(); i++){
            //流す余地があって未探索
            auto &e = graph[v][i];
            if(e.cap > 0 and (level[v] < level[e.to])){
                //このノード以降のフローを求める
                T d = dfs(e.to,t,min(flow,e.cap));
                if(d > 0){
                    e.cap -= d;
                    graph[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        //ここにたどり着くのは増加パスがない時
        return 0;
    }
 
    T max_flow(int s,int t){
        T flow = 0;
        //
        //cout << " bfs?" << " " << bfs(s,t) << endl;
        while(bfs(s,t)){
            //探索回数のリセット
            iter.assign(graph.size(),0);
            
            T f = 0;
            //dfsで見つかる限りflowを追加
            
            while((f = dfs(s,t,INF)) > 0){
                
                flow += f;
            }
            
        }
        return flow;
    }
};
int main(){
    ll n;
    cin>>n;
    Dinic<ll> din(2*n+2);
    vector<pair<ll,ll>> red(n),blue(n);
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        red[i]=make_pair(a, b);
    }
    rep(i,n){
        ll c,d;
        cin>>c>>d;
        blue[i]=make_pair(c, d);
    }
    rep(i,n){
        rep(j,n){
            if(red[i].first<blue[j].first && red[i].second<blue[j].second){
                din.add_edge(i, n+j, 1);
            }
        }
    }
    rep(i,n){
        din.add_edge(2*n, i, 1);
        din.add_edge(n+i, 2*n+1, 1);
    }
    cout<<din.max_flow(2*n, 2*n+1)<<endl;
}


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

struct data{
	vector<int> child;
	int val;
};

data tr[200010];

void gogogo(int x,int v){
	tr[x].val += v;
	v = tr[x].val;
	for(int i=0;i<tr[x].child.size();i++)
		gogogo(tr[x].child[i],v);
}

main(){
	int n,t,a,b;
	cin>>n>>t;
	for(int i=1;i<n;i++){
		cin>>a>>b;
		tr[a].child.push_back(b);
	} 
	while(t--){
		cin>>a>>b;
		tr[a].val += b;
	}
	gogogo(1,0);
	for(int i=1;i<=n;i++)
		cout<<tr[i].val<<" ";
} 

Measured memory_bytes: 24320
void main()
{
    import std.algorithm, std.array, std.stdio, std.string, std.conv;
    readln;
    auto yum = readln.chomp.split.to!(int[]);
    auto sum1 = yum.sum;
    auto sum2 = yum.map!(_=>_*_).sum;
    ((sum1*sum1 - sum2)/2).writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	vector<int> arr(26, 0);
	string s;
	cin >> s;

	for(int i = 0; i < s.length(); i++) {
		arr[s[i] - 'a']++;
	}

	int flag = 0;
	for(int i = 0; i < 26; i++) {
		if(1 < arr[i]) {
			flag = 1;
		}
	}
	if(flag) {
		cout << "no" << endl;
	} else {
		cout << "yes" << endl;
	}

	return 0;
}

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

int main()
{
    int n,x;
    cin >> n >> x;
    int w[n];
    int i;
    for(i = 0;i < n;i++){
        cin >> w[i];
    }
    int a[n];
    for(i = 0;i < n;i++){
        a[i] = w[i] - x;
        if(a[i] < 0){
            a[i] = -a[i];
        }
    }
    int min = a[0];
    for(i = 1;i < n;i++){
        if(min > a[i]){
            min = a[i];
        }
    }
    while(1){
        for(i = 0;i < n;i++){
            if(a[i] % min != 0){
                min--;
                break;
            }
        }
        if(i == n){
            break;
        }
    }
    
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int n,k;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",s);
    int count=0;
    int i;
    for(i=0;i<n;i++)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
            {
                count++;
                i=i+2;
            }
    }
    printf("%d",count);
    return 0;
}


Measured memory_bytes: 128
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N, K;
	int[] A;
	boolean isFinal = false;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		K = Integer.parseInt(tokens[1]);
		tokens = in.readLine().split(" ");
		A = new int[N];
		for (int i = 0; i < N; ++i) {
			A[i] = Integer.parseInt(tokens[i]);
		}
	}

	int[] update(int[] A) {
		int[] B = new int[N];
		Arrays.fill(B, 0);
		for (int i = 0; i < N; ++i) {
			int l = Math.max(i - A[i], 0);
			int r = Math.min(i + A[i], N - 1);
			B[l]++;
			if (r + 1 < N) {
				B[r + 1]--;
			}
		}
		for (int i = 1; i < N; ++i) {
			B[i] += B[i - 1];
		}
		return B;
	}

	void calc() {
		for (int i = 0; i < Math.min(K,  100); ++i) {
			A = update(A);
		}
	}

	void showResult() {
		System.out.print(A[0]);
		for (int i = 1; i < N; ++i) {
			System.out.print(" " + A[i]);
		}
		System.out.println("");
	}
}

Measured memory_bytes: 68380
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	cin>>n; 
  float p=0;
	float arr[n];
	for(i=0; i<n; i++)
	cin>>arr[i];
  
	 sort(arr, arr +n);
    float s=arr[0];
	   for(i=1; i<n; i++)
   { s=(s+arr[i])/2;
  
} 
cout<<s;
   } 

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

typedef long long ll;

int MOD=1000000007;


int main() {
  int A,B;
  cin >> A >> B;
  for(ll i=1; i<=1009; i++) {
    ll ans1 = (double)i*0.08;
    ll ans2 = (double)i*0.1;
    if (ans1==A && ans2==B) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimization ("O2")
#pragma GCC target("popcnt")
#pragma GCC target ("avx2")
using namespace std;

int main(){
    int n,inc,dec;
    cin >> n >> inc >> dec;
    int v;
    bool f = false;
    for(v = 0 ; v <= n ; v += 1){
        if(v + (n-v+inc-1)/inc == dec && (n-v >= inc|| inc == 1)){
            f = true;
            break;
        }
    }
    if(!f){
        cout << -1 << endl;
        return 0;
    }
    int ans[n+1];
    for(int i = n , j = 1 ; j <= v ; j += 1 , i -= 1){
        ans[j] = i;
    }
    int curr = 1;
    for(int j = 1 ; j <= n ; j += 1){
        for(int i = max(n-(inc*j)+1,v+1) ; i <= n-(inc*(j-1)) ; i += 1){
            ans[i] = curr;
            curr += 1;
        }
        if(n-(inc*j)+1 <= v){
            break;
        }
    }
    for(int i = 1 ; i <= n ; i += 1){
        cout << ans[i] << " ";
    }cout << endl;
    /*int dp[n+1],inc2=1,dec2=1;
    for(int i = 1 ; i <= n ; i += 1){
        dp[i] = 1;
        for(int j = 1 ; j < i ; j += 1){
            if(ans[j] < ans[i]){
                dp[i] = max(dp[i],dp[j]+1);
                inc2 = max(inc2,dp[i]);
            }
        }
    }
    for(int i = 1 ; i <= n ; i += 1){
        dp[i] = 1;
        for(int j = 1 ; j < i ; j += 1){
            if(ans[j] > ans[i]){
                dp[i] = max(dp[i],dp[j]+1);
                dec2 = max(dec2,dp[i]);
            }
        }
    }
    if(inc2 == inc && dec2 == dec){
        cout << 1 << endl;
        return 0;
    }
    assert(false);*/
}

Measured memory_bytes: 3328
def prod(a,b,c,m):
  ans=c
  for i in range(m):
    ans+=a[i]*b[i]
  return ans
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  if prod(a[i],b,c,m)>0:
    ans+=1
print(ans)

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

int main()
{

        int Q, H, S, D;
        cin >> Q >> H >> S >> D;
        int N;
        cin >> N;
        int n = N * 1;

        int q_min = Q;
        int h_min = std::min(Q*2, H);
        int s_min = std::min(Q*4, H*2);
        s_min = std::min(S, s_min);
        int d_min = std::min(D, Q*8);
        d_min = std::min(d_min, H*4);
        d_min = std::min(d_min, S*2);

        long long ans = 0;

        long long  dd = n/2;
        long long dda = n %2 ;
        long long  ss = dda / 1;
        long long ssa = dda % 1;
        ans = dd * d_min + (ss * s_min);
        cout << ans << endl;
}


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

str = "abcdefghijklmnopqrstuvwxyz"
rewsna = ""
while N > 0:
    rewsna += str[N%26-1]
    x = N%26
    if x == 0:
        N = (N-1)//26
    else:
        N = (N-x)//26

ans = ""

for i in range(len(rewsna)):
    ans += rewsna[len(rewsna)-i-1]

print(ans)

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

int main()
{
    int N;
    cin >> N;
    vector<int> L(N);
    for (int i = 0; i < N; i++)
    {
        cin >> L.at(i);
    }

    sort(L.begin(), L.end());
    int res = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int l = j + 1;
            int r = lower_bound(L.begin(), L.end(), L.at(i) + L.at(j)) - L.begin();
            res += max(0, r - l);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3552
const processData = (lines) => {
    const [n, m] = lines[0].split(' ').map( x => +x)
    let friendships = {}
    for (let i=0; i<m; i++) {
        const f = lines[i+1].split(' ').map(x => +x)
        if (!friendships[f[0]]) {
            friendships[f[0]] = {}
        }
        if (!friendships[f[1]]) {
            friendships[f[1]] = {}
        }
        friendships[f[0]][f[1]] = true
        friendships[f[1]][f[0]] = true
    }

    let maxCount = 1
    let visited = new Set()
    for (let p in friendships) {
        if (!visited.has(p)) {
            let count = 0
            let stack = [p]
            let cur = 0
            while (cur < stack.length) {
                count++
                let item = stack[cur]
                visited.add(item)
                cur++
                for (let p in friendships[item]) {
                    if (!visited.has(p)) {
                        visited.add(p)
                        stack.push(p)
                    }
                }
            }
            maxCount = Math.max(maxCount, count)
        }
    }

    console.log(maxCount)
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    processData(lines)
})


Measured memory_bytes: 163720
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

int n;
string shop;
vector<string> kanban;

int maime;

bool dfs(int j, int l, int kankaku)//jが看板の文字目の添字lが次出てきてほしい店の添字
{
	if(l == shop.size()) return true;
	for (int k = 0; j + k < kanban[maime].size(); k++)
	{
		if(kanban[maime][j + k] == shop[l])
		{
			if(kankaku == -1 || (kankaku == k))
				if(dfs(j + k + 1, l + 1, (l == 0 ? -1 : k)))
					return true;
		}
	}
	return false;
}

int main(void)
{
	cin >> n;
	kanban.resize(n);
	cin >> shop;
	maime = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> kanban[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		maime = i;
		if(dfs(0, 0, -1))
			ans++;
	}
	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

ll n;
ll x[500005];
ll i,j;
ll ans;
ll num;
ll a,b;


int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x[i];
		if(x[i] % 2 == 0)a++;
		if(x[i] % 2 == 1)b++;
	}
	if(a == 0 || b == 0){
		cout << 0 << endl;
		return 0;
	}
	if(b%2==1){
		cout << n-1 << endl;
	}else{
		cout << n-2 << endl;
	}
	return 0;
}




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

#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A,*B;
  int C[VMAX+1];
  int n,i,j;

  scanf("%d",&n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

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

  for(i=0; i < VMAX+1; i++){
    C[i] =  0;
  }

  for(j=1; j < n+1; j++){
    C[A[j]]++;
  }

  for(i=1; i < VMAX+1; i++){
    C[i] = C[i] + C[i-1];
  }

  for(j=n; j > 0; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  for(i=1; i < n+1; i++){
    printf("%d",B[i]);
    if(i != n){
      printf(" ");
    }
  }
  printf("\n");
  
  return 0;
}



Measured memory_bytes: 9624
#include<stdio.h>

int main()
{
   char a[120][120];
   int n,m;
   scanf("%d%d",&n,&m);
   for(int i=1;i<=n;i++)
       scanf("%s",&a[i]);
   for(int i=1;i<=2*n;i++)
   {
       printf("%s\n",a[(i+1)/2]);
   }
    return 0;
}


Measured memory_bytes: 128