akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

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

    do{
        c -= b;
        if(c > 0) a -= d;
        //cout << "a=" << a << ", c=" << c << endl;
    }while(a > 0 && c > 0);

    if(a <= 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 3520
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())

cnt = [0] * pow(10, 5)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            acc = x * x + y * y + z * z + x * y + y * z + x * z
            if acc > 10000:
                continue
            cnt[acc] += 1

for i in range(1, N + 1):
    print(cnt[i])


Measured memory_bytes: 27868
#include <iostream>

using namespace std;

int main(void)
{
	int n, x, cnt;

	while (cin >> n >> x, n | x)
	{
		cnt = 0;

		for (int i=1; i<=n; i++)
			for (int j=i+1; j<=n; j++)
				for (int k=j+1; k<=n; k++)
					if (i + j + k == x) cnt++;

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  if (a == b) cout << c << endl;
  else if (b == c) cout << a << endl;
  else cout << b << endl;


  
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  vector<long long> Asum(N);
  for (int i=0; i<N; i++){
    if (i==0) Asum[i] = A[i];
    else Asum[i] = Asum[i-1] + A[i];
  }
  long long ans = 1000000000000000;
  int left = 0;
  int right = 2;
  for (int i=1; i<N-2; i++){
    long long P,Q,R,S;
    while(left<i-1){
      if (abs(Asum[i]-2*Asum[left+1]) < abs(Asum[i]-2*Asum[left])) left++;
      else break;
    }
    while(right<N-1){
      if (abs(Asum[N-1]-2*Asum[right+1]+Asum[i]) < abs(Asum[N-1]-2*Asum[right]+Asum[i])) right++;
      else break;
    }
    P = Asum[left];
    Q = Asum[i] - Asum[left];
    R = Asum[right] - Asum[i];
    S = Asum[N-1] - Asum[right];
    ans = min(ans, max(max(P,Q),max(R,S))-min(min(P,Q),min(R,S)));
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
h, w = 1, 1
dataset = []
while not(h == w == 0):
    h, w = map(int, input().split())
    dataset.append([h, w])
for n, data in enumerate(dataset):
    h, w = data[0], data[1]
    for i in range(h):
        for j in range(w):
            if  i > 0 \
                and i < h - 1 \
                and j > 0 \
                and j < w - 1:
                print(".", end="")
            else:
                print("#", end="")
        print("")
    if n!=len(dataset)-1:
        print("")


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

using namespace std;

#define S second
#define F first

typedef long long ll;

const int maxn = 2e5+10;
const int mod = 1e9+7;

int n;
ll seg[4*maxn], la[4*maxn];

void shift(int v)
{
    seg[v] += la[v];
    if(2*v+1 < 4*maxn)
    {
        la[2*v] += la[v];
        la[2*v+1] += la[v];
    }
    la[v] = 0;
}

void up(int l, int r, ll val, int v = 1, int tl = 0, int tr = n-1)
{
    shift(v);
    if(l > r) return;
    if(tl == l && tr == r)
    {
        la[v] += val;
        shift(v);
        return;
    }

    int tm = (tl + tr) >> 1;
    up(l, min(tm,r), val, 2*v, tl, tm);
    up(max(tm+1,l), r, val, 2*v+1, tm+1, tr);

    seg[v] = max(seg[2*v], seg[2*v+1]);
}

ll qu(int l, int r, int v = 1, int tl = 0, int tr = n-1)
{
    shift(v);
    if(l > r) return 0;
    if(tl == l &&  tr == r) return seg[v];

    int tm = (tl + tr) >> 1;
    return max(qu(l, min(tm,r), 2*v, tl, tm),
               qu(max(tm+1,l), r, 2*v+1, tm+1, tr));
}

int m;
ll dp[maxn];
ll s[maxn];
vector<pair<int,ll>> L[maxn];

int main()
{
    cin>> n >> m;
    for(int i = 1; i <= m; i++)
    {
        int l, r, val; cin>> l >> r >> val;
        L[r].push_back({l,val});
    }

    for(int i = 1; i <= n; i++)
    {
        for(auto l : L[i])
            up(l.F-1, i-1, l.S);
        dp[i] = qu(0,i-1);
        dp[i] = max(dp[i],0ll);
        if(i == n)
            return cout<< dp[i], 0;
        up(i,i,dp[i]);
    }
}





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

int n,m,l=1;
vector<int> v[100000],p,q;
bool d[100000];

void f(int a, int b){
    d[a]=true;
    for(int i=0;i<v[a].size();i++){
        if(!d[v[a][i]]){
            l++;
            if(b==0){
                p.push_back(v[a][i]);
            }else{
                q.push_back(v[a][i]);
            }
            f(v[a][i], b);
            break;
        }
    }
}

int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    fill(d, d+n, false);
    p.push_back(0);
    f(0, 0);
    f(0, 1);
    cout<<l<<endl;
    for(int i=p.size()-1;i>=0;i--){
        cout<<p[i]+1;
        if(i>0)cout<<" ";
    }
    for(int i=0;i<q.size();i++){
        cout<<" "<<q[i]+1;
    }
    cout<<endl;
}


Measured memory_bytes: 6904
#include <stdio.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

const static int MAX = 1e5;
const static int INF = 1e5;
int n, m, L[MAX], R[MAX], maxl, minr, ans;

int main() {
    scanf("%d %d", &n, &m);
    maxl = 1;
    minr = INF;
    
    for ( int i = 0; i < m; i++ ) {
        scanf("%d %d", &L[i], &R[i]);
        maxl = max(maxl, L[i]);
        minr = min(minr, R[i]);
    }

    ans = max(minr - maxl + 1, 0);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vpl vector<pair<long long,long long>>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
const long double pi = 3.1415926535897932;
#define pb push_back
#define mp make_pair
#define mt make_tuple

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll H,N;
    cin>>H>>N;
    vvl dp(N+1,vl(H,INF));//最小コスト
    vl A(N);
    vl B(N);
    rep(i,N)cin>>A[i]>>B[i];
    rep(i,N){
        rep(j,H){
            chmin(dp[i+1][j],dp[i][j]);
            if(j+1<=A[i]){
                chmin(dp[i+1][j],B[i]);
            }else{
                chmin(dp[i+1][j],dp[i+1][j-A[i]]+B[i]);
            }
        }
    }
    cout<<dp[N][H-1]<<endl;
}

Measured memory_bytes: 78592
// for debug https://atcoder.jp/contests/abc146/submissions/11441946

import java.io.*
import java.util.*

val pw = PrintWriter(System.out)
const val MOD = 1000000007L
const val INF = 2147483647
const val LINF = 9223372036854775807L

fun main(args: Array<String>) {
    solve()
    pw.flush()
}

fun solve() {
    val (n, m) = nextIntList()
    val s = next()
    var ng = StringBuilder("")
    repeat(m){
        ng.append("1")
    }
    if(s.contains(ng)){
        println(-1)
        return
    }

    var now = n
    val ans:Deque<Int> = ArrayDeque()
    while(now != 0){

        if(now <= m){
            ans.push(now)
            break
        }
        for(i in m downTo 1){
            val next = now - i
            if(s[next] == '0'){
                ans.push(i)
                now = next
                break
            }
        }
    }

    println(ans.joinToString(" "))
}


fun println(v: String) {
    pw.println(v)
}

fun print(v: String) {
    pw.print(v)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ").toMutableList()
fun nextIntList(index: Int = 0) = next().split(" ").map { it.toInt() + index }.toMutableList()
fun nextLongList(index: Long = 0L) = next().split(" ").map { it.toLong() + index }.toMutableList()
fun nextDoubleList() = next().split(" ").map { it.toDouble() }.toMutableList()

fun ary(n: Int, init: String = "") = Array(n) { init }
fun intAry(n: Int, init: Int = 0) = IntArray(n) { init }
fun longAry(n: Int, init: Long = 0L) = LongArray(n) { init }
fun doubleAry(n: Int, init: Double = 0.0) = DoubleArray(n) { init }
fun ary2(n: Int, m: Int, init: String = "") = Array(n) { Array(m) { init } }
fun intAry2(n: Int, m: Int, init: Int = 0) = Array(n) { IntArray(m) { init } }
fun longAry2(n: Int, m: Int, init: Long = 0) = Array(n) { LongArray(m) { init } }
fun doubleAry2(n: Int, m: Int, init: Double = 0.0) = Array(n) { DoubleArray(m) { init } }
fun ary3(n: Int, m: Int, k: Int, init: String = "") = Array(n) { Array(m) { Array(k) { init } } }
fun intAry3(n: Int, m: Int, k: Int, init: Int = 0) = Array(n) { Array(m) { IntArray(k) { init } } }
fun longAry3(n: Int, m: Int, k: Int, init: Long = 0L) = Array(n) { Array(m) { LongArray(k) { init } } }
fun doubleAry3(n: Int, m: Int, k: Int, init: Double = 0.0) = Array(n) { Array(m) { DoubleArray(k) { init } } }

fun abs(n: Int): Int = Math.abs(n)
fun abs(n: Long): Long = Math.abs(n)
fun abs(n: Double): Double = Math.abs(n)
fun max(a: Int = -INF, b: Int = -INF, c: Int = -INF, d: Int = -INF, e: Int = -INF): Int = listOf(a, b, c, d, e).max()!!
fun max(a: Long = -LINF, b: Long = -LINF, c: Long = -LINF, d: Long = -LINF, e: Long = -LINF): Long =
    listOf(a, b, c, d, e).max()!!.toLong()

fun min(a: Int = INF, b: Int = INF, c: Int = INF, d: Int = INF, e: Int = INF): Int = listOf(a, b, c, d, e).min()!!
fun min(a: Long = LINF, b: Long = LINF, c: Long = LINF, d: Long = LINF, e: Long = LINF): Long =
    listOf(a, b, c, d, e).min()!!.toLong()


Measured memory_bytes: 41348
'use strict';
function Main(inputs) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  const input = inputs.split("\n");
  const n = input[0];
  const s = input[1].split(' ')[0];
  const t = input[1].split(' ')[1];
  let result = '';

  for(let i = 0; i < n; i++){
    result += s[i] + t[i];
  }
  console.log(result);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.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; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//---------------from here-----------------

int main(){
    int n; cin>>n;
    vector<int> a(n);
    vector<vector<pair<int,int>>> test(n,vector<pair<int,int>>(15));
    rep(i,n){
        cin>>a[i];
        rep(j,a[i]){
            cin>>test[i][j].first>>test[i][j].second;
        }
    }

    int ans=0;
    for(int bit=0; bit<(1<<n);++bit){
        bool ok=true;
        rep(i,n){
            if((bit & (1<<i))==0) continue;
            rep(j,a[i]){
                if(__builtin_popcount(bit & (1<<(test[i][j].first -1))) == test[i][j].second){
                    continue;
                }else{
                    ok=false;
                    break;
                }
            }
            if(ok==false) break;
        }
        if(ok){
            ans=max(ans, __builtin_popcount(bit));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
ans = "YES"
dc = Counter(d)
tc = Counter(t)
for k,v in tc.items():
    if dc[k]<v:
        ans = "NO"
print(ans)

Measured memory_bytes: 57152
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>

std::vector<long long> enum_divisors(long long N) {
    std::vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            if (N/i != i) res.push_back(N/i);
        }
    }
    std::sort(res.begin(), res.end());
    return res;
}

std::vector<std::pair<long long, long long> > prime_factorize(long long N) {
    std::vector<std::pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;

        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }

    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(void){
    long long N;
    std::cin >> N;
    int cnt=0;

    const auto &res = prime_factorize(N);
    long long pre = 0;

    for (auto p : res) {
        int e=1;
        for (int i = 1; i <= p.second; i+=e){
            e++;
            cnt++;
            //std::cout << p.first << " " << p.second << " " << e << " " << i << " " << cnt << std::endl;
        }
    }

    std::cout << cnt << std::endl;

    return 0;
}

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

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s[5];
    cin>>s[1]>>s[2]>>s[3];
    int now=1,score[5]={};
    int asize=s[1].size(),bsize=s[2].size(),csize=s[3].size();

    while(true){

	if(score[1]==asize+1){
	    cout<<'A'<<'\n';
	    break;
	}
	if(score[2]==bsize+1){
	    cout<<'B'<<'\n';
	    break;
	}
	if(score[3]==csize+1){
	    cout<<'C'<<'\n';
	    break;
	}

	score[now]++;
	if(s[now][score[now]-1]=='a'){
	    now=1;
	}
	else if(s[now][score[now]-1]=='b'){
	    now=2;
	}
	else{
	    now=3;
	}
    }
    return 0;
}

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

int main(){
	int mayors[50]{0};
	vector<int> ansvec;

	for(;;){
		int n, p;
		cin >> n >> p;
		if (n == 0) break;

		for (int i = 0; i < n; i++) mayors[i] = 0;
		int bowlp = p;
		int turn = 0;
		for(;;){
			if (bowlp == 1 && mayors[turn] == p - 1) break;
			else if (bowlp == 0){
				bowlp += mayors[turn];
				mayors[turn] = 0;
			}
			else{
				mayors[turn]++;
				bowlp--;
			}

			if (turn == n - 1) turn = 0;
			else turn++;
		}
		ansvec.push_back(turn);
	}

	for (int ans : ansvec){
		cout << ans << "\n";
	}
	cout << flush;
	return 0;
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef long long ll;

const int MOD = 1000000007;

void solve() {
  int a, b;
  cin >> a >> b;
  string A, B;
  for (int i = 0; i < a; i++) {
    B += (char)(b + '0');
  }
  for (int i = 0; i < b; i++) {
    A += (char)(a + '0');
  }
  string ans = A < B ? A : B;
  cout << ans << endl;
}

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

  solve();

  return 0;
}


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

int N,M,x,y,pt,v[100005],red[100005];
int main()
{
  cin >> N >> M;
  for(int i=0;i<=N;i++)
    v[i] = 1;red[1] = 1;
  
  for(int i=0;i<M;i++)
    {
      cin >> x >> y;
      v[x]--,v[y]++;
      
      if(red[x])red[y]=1;
      if(!v[x])red[x]=0;
    }
  
  for(int i=1;i<=N;i++)
    if(red[i] && v[i])pt++;
  
  cout << pt << '\n';
}


Measured memory_bytes: 1024
// ABC159 B

#include <iostream>
#include <string>

using namespace std;

int main(){
    string str;
    cin >> str;
    int len = str.size();
    for(int i=0; i<len; i++){
        if(str.at(i) != str.at(len-1-i)){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i=0; i<(len-1)/2; i++){
        if(str.at(i) != str.at((len-1)/2 - 1 - i)){
            cout << "No" << endl;
            return 0;
        }
    }

    for(int i=0; i< (len-1)/2; i++){
        if(str.at((len+3)/2-1+i) != str.at(len-1-i)){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int N;
    cin>>N;
    string s;
    map<string,int> dic;

    for(int i = 0;i < N;i++) {
        cin>>s;
        dic[s]++;
    }

    cout<<dic.size()<<endl;

    return 0;
}





Measured memory_bytes: 18836
#include<iostream>
using namespace std;
#define MAX_N 200010

int main() {
    int n;
    int a[MAX_N];
    long long dic[MAX_N]= {};

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

    long long sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += dic[i] * (dic[i] - 1) / 2;
    }

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

Measured memory_bytes: 5864
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(const auto& x : c )cout << x << " "; cout << "\n";
#define ol(c, s, e) for(int pos=s; pos<e; pos++)cout << c[pos] << " ";cout <<"\n";
#define PI acos(-1LL)



#ifndef CF
string to_string(const string& s){
    return '"' + s + '"';
}
string to_string(const char* s) {
    return to_string((string) s);
}
string to_string(bool b) {
    return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v){
    bool first = true;
    string res = "{";
    for(const auto& x: v){
        if(!first) res+=", ";
        first = false;
        res+=to_string(x);
    }
    res+="}";
    return res;
}
void bug() { cerr << endl; }
template<typename Head, typename... Tail>
void bug(Head H, Tail... T) {
    cerr << " " << to_string(H);
    bug(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__);
#endif


const int M = 1000000007;
const int N = 2e6 + 5;
const long long INF = 2e18 + 12;


void solve(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int &x: v) cin >> x;
    int money = 1000;
    for(int i=0; i<n-1; i++){
        int stocks = money/v[i];
        money+=stocks*max(v[i+1] - v[i], 0LL);
    }
    cout << money << endl;
}

signed main(){
    FAST
    clock_t start;
    double duration;
    start = clock();

    int tc = 1;
//    TODO: check for tc
//    cin >> tc;
    for (int t = 1; t <= tc; t++) {
  //      cout << "Case #" << t << ": ";
        solve();
    }
#ifndef LOCAL
    duration = (clock() - start) / (double) CLOCKS_PER_SEC;
    cerr <<"\nTotal time elapsed: "<< duration <<"sec\n";
#endif
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

tuple<int64, int64> BinarySearch(function<bool(int64)> is_upper_fn, int64 l, int64 u) {
  while (u - l >= 2) {
    int64 m = (l + u) / 2;
    if (is_upper_fn(m)) u = m; else l = m;
  }
  return make_tuple(l, u);
}

int64 DivFloor(int64 x, int64 y) {
  int sign = 1;
  if (x < 0) sign *= -1;
  if (y < 0) sign *= -1;

  if (sign == 1) {
    return abs(x) / abs(y);
  } else {
    return -((abs(x) + abs(y) - 1) / abs(y));
  }
}

int64 DivCeil(int64 x, int64 y) {
  int sign = 1;
  if (x < 0) sign *= -1;
  if (y < 0) sign *= -1;

  if (sign == 1) {
    return (abs(x) + abs(y) - 1) / abs(y);
  } else {
    return -(abs(x) / abs(y));
  }
}

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

  int n;
  cin >> n;
  int64 k;
  cin >> k;
  vector<int64> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  sort(xs.begin(), xs.end());

  auto is_upper_fn = [&](int64 v) -> bool {
    int64 count = 0;
    for (int64 x : xs) {
      if (x == 0) {
        if (v >= 0) count += n;
      } else if (x > 0) {
        int c = distance(xs.begin(), upper_bound(xs.begin(), xs.end(), DivFloor(v, x)));
        // cout << DivFloor(v, x) << " " << c << endl;
        count += c;
      } else {
        int c = distance(lower_bound(xs.begin(), xs.end(), DivCeil(v, x)), xs.end());
        // cout << DivCeil(v, x) << " " << c << endl;
        count += c;
      }
    }

    for (int64 x : xs) {
      if (x * x <= v) {
        count--;
      }
    }

    count /= 2;

    // cout << "v: " << v << " count: " << count << endl;
    return count >= k;
  };

  int64 l, u;
  tie(l, u) = BinarySearch(is_upper_fn, -2E18, 2E18);
  // tie(l, u) = BinarySearch(is_upper_fn, -100, 100);
  cout << u << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;

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

	if((b - a) % 2==0){
		cout << "Alice" << endl;
	} else{
		cout << "Borys" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	int x, y;
	cin >> x >> y;
	int group[]{ 0,1,3,1,2,1,2,1,1,2,1,2,1 };
	if (group[x] == group[y]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pi 3.14159265  //35897932384626433
#define MOD 1000000007
#define all(s) s.begin(),s.end()
#define mp make_pair
#define vc vector<int>
#define vp vector<pair<ll,ll> >
#define sec second
#define sz(x) (int)((x).size())
#define timesaver ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
const int N =  2e6 + 9;
ll gcd(ll a, ll b){ if(a==0) return b; else return gcd(b%a,a);}
ll power(ll base,ll exp,ll mod=MOD) {ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}

ll a[N];
ll dp[N];
int main()
{
 ll n, sum = 0, mn = 1e18;
 cin >> n;
 for (int i = 1; i <= n; ++i)
 {
   /* code */
  cin >> a[i];
  dp[i] = a[i] + dp[i - 1];
  sum += a[i];
 }
 for (int i = 1; i < n; ++i)
 {
   /* code */
  mn = min(mn, abs(dp[i] - (sum - dp[i])));
 }
 cout << mn;
}

Measured memory_bytes: 5888
using System;
class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine();
        
      var ret = 0;
      switch (input)
      {
        case "SUN":
          ret = 7;
          break;
        case "MON":
          ret = 6;
          break;
        case "TUE":
          ret = 5;
          break;
        case "WED":
          ret = 4;
          break;
        case "THU":
          ret = 3;
          break;
        case "FRI":
          ret = 2;
          break;
        case "SAT":
          ret = 1;
          break;
      }
        
        //出力
        Console.WriteLine(ret);
    }
}

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

using namespace std;

using ll = long long;

const long long MOD = 1e9 + 7;
const int INF = 1e9 + 7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    bool easy = true;
    char odd[3] = {'R', 'U', 'D'};
    char even[3] = {'L', 'U', 'D'};
    for (int i = 0; i < (int)S.size(); ++i) {
        if (i % 2 == 1) {
            bool ok = false;
            for (int j = 0; j < 3; ++j) {
                if (S[i] == even[j]) ok = true;
            }
            if (!ok) {
                easy = false;
                break;
            }
        }
        else {
            bool ok = false;
            for (int j = 0; j < 3; ++j) {
                if (S[i] == odd[j]) ok = true;
            }
            if (!ok) {
                easy = false;
                break;
            }
        }
    }
    if (easy) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int a, b, c;
  cin >> a >> b >> c;
  if (a+b+c >= 22) cout <<"bust" << endl;
  else cout <<"win" << endl;
}


Measured memory_bytes: 256
#include<iostream>
    #include<vector>
    #include<math.h>
    #include<bits/stdc++.h>
    #include<sstream>
     
    using namespace std;
     
    int main()
    {
        int s, x, i = 2;
        vector<int> nums;
        vector<int>::iterator it;
        //bool yes = true;

        cin >> s;
        
        nums.push_back(s);

        while(true)
        {
            if(s%2==0)
            {
                x = s/2;
            }

            else
            {
                x = s*3 + 1;
            }
            

            it = find(nums.begin(),nums.end(),x);

            if(it == nums.end())
            {
                nums.push_back(x);
                i++;
                s = x;
            }

            else
            {
                cout << i;
                exit(0);
            }
            
        }
    } 

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string S = Console.ReadLine();
		string T = Console.ReadLine();
		string ans = "Yes";
		for(var i=0;i<S.Length;i++){
			if(S.Substring(i,1)!=T.Substring(i,1)){
				ans = "No";
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 17320
def my_print(str, a, b):
  print(str[a:b + 1])
  return str

def my_replace(str, a, b, p):
  return str[:a] + p + str[b + 1:]

def my_reverse(str, a, b):
  r_str = str[a:b + 1][::-1]
  return str[:a] + r_str + str[b + 1:]

str = input()

for i in range(int(input())):
  cmd, *args = input().split(' ')
  args = [int(i) for i in args[0:2]] + args[2:]
  str = globals()['my_' + cmd](str, *args)


Measured memory_bytes: 5616
#include <iostream>
#include <string>
#include <sstream>
#include <vector>

std::vector<int> split(const std::string &s) {
  std::stringstream ss(s);
  std::vector<int> ret;
  std::string item;
  while (std::getline(ss, item, ' ')) {
    if (!item.empty()) {
      ret.push_back(std::stoi(item));
    }
  }
  return ret;
}

int main(void) {
  int n;
  int m;
  int c;
  std::string s;
  getline(std::cin, s);
  std::vector<int> nmc = split(s);
  getline(std::cin, s);
  std::vector<int> b = split(s);
  int result = 0;
  for (int i = 0; i < nmc[0]; i++) {
    getline(std::cin, s);
    std::vector<int> a = split(s);
    int score = nmc[2];
    for (int j = 0; j < nmc[1]; ++j) {
      score += a[j] * b[j];
    }
    if (score > 0) {
      result += 1;
    }
  }
  std::cout << result << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
 int n,i,j,k;
 int A[10];
 int B[10];
 int C[10];
 int topB,topC;
 int a;
 scanf("%d",&n);

for(a=0;a<n;a++){


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


  for(i=0;i<1024;i++)
  {
    j=i;
    topB=0;
    topC=0;

    for(k=0;k<10;k++)
    {
      if(j&1 == 1)
      {
        B[topB]=A[k];
        if(topB > 0 && B[topB] < B[topB-1])break;
        topB++;
      }
      else
      {
        C[topC]=A[k];
        if(topC > 0 && C[topC] < C[topC-1])break;
        topC++;
      }
      j=j>>1;
    }

    if(topB+topC==10){printf("YES\n");break;}
  }

  if(i==1024)printf("NO\n");
}
return 0;
}


Measured memory_bytes: 2028
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    l = [x for x in range(h)]
    for y in l:
        if y == l[0]:
            print('#' * w)
        elif y != max(l):
            print('#' + '.' * (w - 2) + '#')
        elif y == max(l):
            print('#' * w)
    print()


Measured memory_bytes: 5624
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
using ll = long long;

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

	int N;
	cin >> N;
	vector<int> A(N), B(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	B[0] = A[0];
	for (int i = 1; i < N; i++) {
		B[i] = max(A[i], B[i - 1]);
	}

	ll ans = 0;
	for (int i = 1; i < N; i++) {
		int d;
		if ((d = B[i - 1] - A[i]) > 0) {
			ans += d;
		}
	}

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


Measured memory_bytes: 4752
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			int[] student = new int[2];
			for(int i = 0 ;i < 8;i++){
				if(i /4 == 0)
					student[0] +=scan.nextInt();
				else
					student[1] += scan.nextInt();
			}
			System.out.println(Math.max(student[0], student[1]));
		}finally{
			if(scan !=null) scan.close();
		}
	}
}

Measured memory_bytes: 17164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
    double r;
    cin >> r;
    cout << fixed << setprecision(6) << M_PI * r * r << " " 
    << fixed << setprecision(6) << 2 * M_PI * r << endl;

    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {
    int N;
    cin >> N;
    vi A(N),B(N),C(N-1);
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];
    REP(i,N-1) cin >> C[i];

    int ans = 0;

    FOR(i,0,N){
        ans += B[A[i]-1];
        if(i!=N-1&&A[i+1]-A[i]==1) ans += C[A[i]-1];
    }


    cout << ans << endl;
}



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

using LL = long long;
using LD = long double;
 
LL mod = 10e9+7;

int main()
{
	LL n;
	cin >> n;
	LL cnt = 0;

	LL cx = n-1, tak = 0;

	for (LL i = 2; i*i <= n; ++i) {
		if (n % i == 0) {
			LL f1 = i, f2 = n/i;
			LL x1 = n, x2 = n;

			while (x1 % f1 == 0) {
				x1 /= f1;
			}

			if (x1 % f1 == 1) {
				cnt++;
				if (f1 == cx) {
					tak = 1;
				}
			}

			while (x2 % f2 == 0) {
				x2 /= f2;
			}
			if (x2 % f2 == 0) {
				cnt++;
				if (f2 == cx) {
					tak = 1;
				}
			}
		}
	}

	n--;

	for (LL i = 2; i*i <= n; ++i) {
		if (n%i == 0) {
			cnt += 2;
			if (i == n/i) {
				cnt--;
			}
			if (i == cx || n/i == cx) {
				tak = 1;
			}
		}
	}
	if (!tak) {
		cnt++;
	}
	cnt++;

	if (n == 1) {
		cout << 1 << "\n";
	}
	else {
		cout << cnt << "\n";
	}
}

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

s = [False] * n

for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        s[j - 1] = True

ans = 0
for t in s:
    if t == False:
        ans += 1

print(ans)

Measured memory_bytes: 9188
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,ll>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=1e5+5;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline ll read(){
	ll x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
int n,Q;ll stk[MAXN],top,cnt[MAXN],p[MAXN];
void dfs(ll len,ll val){
	int pos=upper_bound(stk+1,stk+top+1,len)-stk-1;
	if(pos)cnt[pos]+=val*(len/stk[pos]),dfs(len%stk[pos],val);else p[1]+=val,p[len+1]-=val;
}
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read(),Q=read(),stk[top=1]=n;
	Rep(i,1,Q){
		ll x=read();
		for(;stk[top]>x;)top--;stk[++top]=x;
	}cnt[top]=1;
	Red(i,top,2){
		ll l=stk[i]%stk[i-1],v=stk[i]/stk[i-1];
		cnt[i-1]+=v*cnt[i],dfs(l,cnt[i]),cnt[i]=0;
	}p[1]+=cnt[1],p[stk[1]+1]-=cnt[1];
	Rep(i,1,n)p[i]+=p[i-1],cout<<p[i]<<'\n';
	return 0;
}




Measured memory_bytes: 5932
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  VI ds(4);
  REP(i,0,3) {
    int a, b;
    cin >> a >> b;
    ds[a-1]++;
    ds[b-1]++;
  }
  bool ans = true;
  FOR(d,ds) {
    if (d != 1 && d != 2) {
      ans = false;
    }
  }
  cout << (ans ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <time.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P  = pair<ll,ll>;
using vi = vector<ll>;
using vv = vector<vi>;
const ll INF = 1001001001;
const ll NUM = 1<<10;

//(開始, 今)を管理
//例:
//(0,0), (1,1), (2,2), (3,3), (4,4), (5,5)
//壁(1,2)   .      .(該当領域)
//(0,0), (1,3), (2,3), (3,3), (4,4), (5,5) ->(1,3),(2,3)は消す
//(0,0),               (3,3), (4,4), (5,5)
//壁(2,3)                 .(該当領域)
//(0,0),               (3,4), (4,4), (5,5) ->(3,4)は消す
//(0,0),                      (4,4), (5,5)
//
//・順序集合(map)を使う: map[今]=開始の最大値
//・ans = min(今-開始), multisetで管理
//・該当領域+1の範囲で開始が一番右のものだけ残す
//・それ以外はansからもmapからも消す

//

int main(){
    int h,w;
    cin >> h >> w;
    map<int,int> s;
    multiset<int> m;
    rep(i,w)s[i] = i;
    rep(i,w)m.insert(0);
    
    rep(i,h){
        int l,r;
        cin>>l>>r;
        --l;
        
        auto itr = s.lower_bound(l);
        int maxstart= -1;
        while(itr!=s.end() && itr->first<=r){
            maxstart= max(maxstart, itr->second);
            int c = itr->first - itr->second;
            m.erase(m.find(c));
            s.erase(itr++);
            //itr=s.erase(itr);//これでもいい
            //s.erase(*itr); itr++;//これはだめ
        }
        if(r<w && maxstart != -1){
            s[r] = maxstart;
            m.insert(r-maxstart);
        }
        int ans = -1;
        if(!m.empty())
            ans = *m.begin() + (i+1);
        cout<<ans<<endl;
    }
    return 0;
}

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

using Graph = vector<vector<int>>;

int main(){
    int n,m;
    cin >> n>>m;
    Graph G(n);
    vector<int>dist(n,-1);
    queue<int>que;
    rep(i,m){
        int a,b;
        cin >> a>>b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }
    
    int ans=0;
    dist[0] = 0;
    que.push(0);
    
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        
        for(int nv:G[v]){
            if(dist[nv]!=-1) continue;
            //if(nv<i)continue;
            dist[nv] = v;
            ans++;
            //if(nv>i)ans[dist[nv]]++;
            que.push(nv);
        }
    }
    
    if(ans>=n-1){
        cout <<"Yes"<<endl;
        for(int i=1;i<n;i++)
        cout<<dist[i]+1<<endl;
    }
    else
        cout<<"No"<<endl;
    
}




Measured memory_bytes: 10220
#include <stdio.h>

int main(void) {
	double bmi;
	int id;
	double weight,height;
	while(scanf("%d,%lf,%lf",&id,&weight,&height)==3) {
		bmi=weight/height/height;
		if(bmi>=25)printf("%d\n",id);
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>
#define BUFSIZE 1000000007
typedef long long ll;
int N,K;
ll rem=0;

ll Sum(ll num){
    ll sum1,sum2 = 0;
    if(num == N+2)
        return 0;
    sum1 = num*(num-1)/2;
    sum2 = num*(2*(N-num+1)+(num-1))/2;
    rem += sum2 - sum1 + 1;
    rem %= BUFSIZE;
    Sum(num+1);
    return 0;
}

int main(void){
    scanf("%d",&N);
    scanf("%d",&K);
    Sum(K);
    printf("%lld",rem % BUFSIZE);
}


Measured memory_bytes: 4796
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,K,R,S,P; cin>>N>>K>>R>>S>>P;
    string T; cin>>T;
    ll ans=0;
    rep(i,N){
        if(i-K>=0 and T[i-K]==T[i]) {T[i]='#'; continue;}
        if(T[i]=='r') ans+=P;
        if(T[i]=='s') ans+=R;
        if(T[i]=='p') ans+=S;
    }
    cout<< ans <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 512
S = input()

count = 0
if S in ['A','C','G','T']:
    count = 1
for i in range(len(S)):
    for j in range(i+1,len(S)+1):
        ans = S[i]+S[i+1:j]
        if ans.count('A')+ans.count('C')+ans.count('G')+ans.count('T') == len(ans):
            count = max(len(ans),count)


print(count)

Measured memory_bytes: 9032
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k;
    string s;
    cin>>n>>k;
    cin>>s;
    
    vector<int> on,ze;
    char m=s[0];
    int num_m=0;
    if(s[0]=='0') on.push_back(0);
    for(int i=0;i<n;i++){
        if(s[i]==m) {
            num_m++;
        } else {
            if(m=='0') ze.push_back(num_m);
            else on.push_back(num_m);
            m=s[i];
            num_m=1;
        }
        if(i==n-1) {
            if(m=='0') ze.push_back(num_m);
            else on.push_back(num_m);
        }
    }
    if(on.size()==ze.size()) on.push_back(0);
    int ans=0;
    if(on.size()<=k+1) k=on.size()-1;
    for(int i=0;i<on.size()-k;i++){
        int ansd=0;
        for(int j=0;j<k+1;j++){
            ansd+=on.at(i+j);
        }
        for(int j=0;j<k;j++){
            ansd+=ze.at(i+j);
        }
        ans=max(ansd,ans);
    }
    
    
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from collections import Counter
from math import factorial

N, A, B = inpl()
V = sorted(inpl(), reverse=True)
C = Counter(V)

S = [sum(V[:i]) / i for i in range(1, N+1)]
M = max(S[A-1:B])
print(M)
T = [M==s if (A-1<=i)*(i<B) else False for i, s in enumerate(S)]

res = 0
for i in range(N):
    if T[i]:
        x, y = V.count(V[i]), V[:i+1].count(V[i])
        res += factorial(x) // factorial(y) // factorial(x-y)
print(res)

Measured memory_bytes: 3316
S = input()
S = S[::-1]
#print(S)

mod = 10**9+7

table = [1,10,9,12,3,4]
#for i in range(1,len(S)+1):
#	tblpow.append(10*tblpow[i-1]%13)

dp = [0]*13
dp[0] = 1
for i in range(len(S)-1,-1,-1):
	ch = int(S[i]) if S[i]!='?' else -1
	temp = [0]*13
	for d in range(10):
		if ch!=-1 and ch!=d:
			continue
		for m in range(13):
			temp[(d*table[i%6]+m)%13] += dp[m]
	for m in range(13):
		temp[m] %= mod
	dp = temp
print(dp[5])


Measured memory_bytes: 44012
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    string str;
    int k;
    cin >> str >> k;
    REP(i, str.length()){
        if(str[i] > 'a' && 'z' - str[i] + 1 <= k){
            k -= 'z' - str[i] + 1;
            str[i] = 'a';
        }
    }
    if(k >= 26){
        k = k % 26;
    }
    if(k != 0){
        str[str.length() - 1] += k;
    }
    cout << str << endl;
}

Measured memory_bytes: 512