akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<numeric>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define ceil(a,b) (((a)+(b)-1)/(b))
#define yn(i) ((i)?"Yes":"No")
#define chmin(a,b) (a>(b)?a=(b),1:0)
#define abs(n) max((n),-(n))
#define dist(a,b) max((a)-(b),(b)-(a))
#define chmax(a,b) (a<(b)?a=(b),1:0)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000000
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}




string key="keyence";

void add(char m,string s,set<string> st){
  int n=s.size();
  rep(i,n){
    if(s[i]!=m) continue;
    string t;
    repa(j,i,n){
      t.push_back(s[j]);
      st.insert(t);
    }
  }
}

int main(){
  li a,b,c; cin >>a;
  print(a*(a-1)/2);
}





Measured memory_bytes: 3632
#include<iostream>
using namespace std;
typedef long long ll;
int digitSum(ll x){
int ret=0;
while(x>0){
ret+=x%10;
x/=10;
}
return ret;
}
int main(){
int a,n,m;
cin >>a>>n>>m;
int ans=0;
for(int i=1;;i++){
ll tmp=1;
for(int j=0;j<n;j++){
tmp*=(i+a);
}
if(tmp>m)break;
if(digitSum(tmp)==i)ans++;
}cout<<ans<<endl;
return 0;
//jikkenn
}


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

#define maxn 200005
typedef long long ll;
typedef double db;

int n, k;
int a[maxn];
int b[maxn];
int cnt = 0;

multiset<int> s;

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

	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		if (!b[a[i]])
			cnt++;

		b[a[i]]++;
	}

	if (cnt <= k) {
		cout << 0;
		return 0;
	}

	for (int i = 0; i < maxn; ++i) {
		if (b[i])
			s.insert(b[i]);
	}

	int ans = 0;
	multiset<int>::iterator iter = s.begin();
	for (int i = 0; i < cnt - k; iter++, i++) {
		ans += *iter;
	}

	cout << ans;

	return 0;
}


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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int n; cin >> n;
    vector<string> s(n);
    for(int i=0; i<n; i++) cin >> s[i];

    auto tmp = s;
    sort(tmp.begin(), tmp.end());
    tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());

    string ans = "Yes";
    if(tmp.size()!=n) ans = "No";

    for(int i=0; i<s.size()-1; i++){
        int end = s[i].length();
        if(s[i][end-1]!=s[i+1][0]){
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.0001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(full(a), greater<int>());
	cout << a[0] << " ";
	for (int i = 1; i < n; i++) {
		if (a[i] < a[0] / 2) {
			if (i == 1 || a[0] / 2 - a[i] < a[i - 1] - a[0] / 2) {
				cout << a[i] << endl;
			}
			else {
				cout << a[i - 1] << endl;
			}
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 768
using System;
using System.Numerics;

namespace d
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = BigInteger.Parse(_[0]);
            var b = BigInteger.Parse(_[1]);
            var n = BigInteger.Parse(_[2]);

            var x = b > n ? n : b - 1;
            var ans = (a * x / b) - (a * (x / b));
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27936
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    print(3*n**2)
    return

#B
def B():
    n,d = LI()
    f = [1]*(n+2*d+2)
    ans = 0
    for i in range(n):
        if f[i]:
            for j in range(i,i+2*d+1):
                f[j] = 0
            ans += 1
    print(ans)
    return

#C
def C():
    n = I()
    a = IR(n)
    mi = max(a)
    if a.count(mi) > 1:
        for i in range(n):
            print(mi)
    else:
        b = [a[i] for i in range(n)]
        b.sort()
        b = b[::-1]
        for i in range(n):
            if mi != a[i]:
                print(mi)
            else:
                print(b[1])

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 66908
#今Xにいる、K回 D移動する
[X, K, D] = [int(i) for i in input().split()]
#正負で答え変化しないので、正に変える
X = abs(X)
if X - K*D > 0:
#原点に到達しないとき
    print(X-K*D)
#原点に到達するとき
else:
    #往復始める正の位置を求める
    time = int(X/D)
    start = X - D * time
    #残り移動回数を計算
    time_re = K - time
    #残り回数の偶奇で場合分け
    if time_re % 2 == 0:
        print(start)
    else:
        print(abs(start-D))

Measured memory_bytes: 8972
#include <iostream>

using namespace std;

int main(){
  string s;
  long long ans = 0,cnt = 0,flag = 0;
  cin >> s;
  int i = 0;
  for(int i = 0;i < s.size();i ++) {
		if(s[i] == 'A') cnt++;
		else if(s[i] == 'B' && s[i + 1] == 'C') ans += cnt,i ++;
		else cnt = 0;
	}
  cout << ans;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end());
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)

const int MOD = 1e9 + 7;
const int inv2 = 5e8 + 4;
const int maxn = 112345;

int fac[maxn * 2], ifac[maxn * 2];

inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}

inline int mul(int a, int b) {
  return ll(a) * b % MOD;
}

int C(int n, int m) {
  if (m < 0 || m > n) return 0;
  return mul(mul(fac[n], ifac[m]), ifac[n - m]);
}

int pow_mod(int a, int k) {
  int ret = 1;
  while (k) {
    if (k & 1) ret = mul(ret, a);
    a = mul(a, a);
    k >>= 1;
  }
  return ret;
}

int inv(int a) {
  return pow_mod(a, MOD - 2);
}

int b, w, dp[maxn * 2][2];

int main() {
  scanf("%d%d", &b, &w);
  fac[0] = 1;
  FOR(i, 1, b + w) fac[i] = mul(fac[i - 1], i);
  REP(i, b + w + 1) ifac[i] = inv(fac[i]);
  FOR(i, 1, b + w) {
    dp[i][0] = add(mul(C(i - 1, i - b), pow_mod(inv2, i)), dp[i - 1][0]);
    dp[i][1] = add(mul(C(i - 1, i - w), pow_mod(inv2, i)), dp[i - 1][1]);
    int rem = add(add(1, MOD - dp[i - 1][0]), MOD - dp[i - 1][1]);
    printf("%d\n", add(mul(rem, inv2), dp[i - 1][1]));
  }
}


Measured memory_bytes: 5376
import java.util.Scanner;

public class Main{
	public static void main(String[] args)throws Exception {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int num = -1+str.length();
		String result = "x";
		for(int i = 0;i < num;i++) {
			result += "x";
		}

		System.out.println(result);
		scan.close();
	}
}

Measured memory_bytes: 26956
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli inf = 1e18;

int main(){
    int n,m;
    lli l;
    cin >> n >> m >> l;
    vector<int> k(n);
    for(int i=0; i<n; i++){
        cin >> k[i];
    }
    sort(k.begin(), k.end());
    vector<lli> s(m+1);
    for(int i=0; i<m; i++){
        cin >> s[i+1];
        s[i+1] += s[i];
    }

    vector<vector<lli>> dp(n, vector<lli>(n, inf));
    dp[0][1] = (s[k[1]]-s[k[0]-1])/l;
    for(int i=1; i<n-1; i++){ //last
        for(int j=0; j<i; j++){ //opp
            dp[i+1][j] = min(dp[i+1][j], dp[i][j] +(s[k[i+1]]-s[k[i]-1])/l);
            dp[i][i+1] = min(dp[i][i+1], dp[i][j] +(s[k[i+1]]-s[k[j]-1])/l);
            dp[i+1][i] = min(dp[i+1][i], dp[j][i] +(s[k[i+1]]-s[k[j]-1])/l);
            dp[j][i+1] = min(dp[j][i+1], dp[j][i] +(s[k[i+1]]-s[k[i]-1])/l);
            /*
            dp[i][j] -> dp[i+1][j], dp[i][i+1];
            dp[j][i] -> dp[i+1][i], dp[j][i+1];
            */
        }
    }
    lli ans = inf;
    for(int i=0; i<n-1; i++){
        ans = min(ans, dp[i][n-1] +(s[k[n-1]]-s[k[i]-1])/l);
        ans = min(ans, dp[n-1][i] +(s[k[n-1]]-s[k[i]-1])/l);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35084
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
typedef pair<string,string> P;
typedef pair<P,string> PP;
vector<PP> pd,res;
int n,m;

bool check(string a,string b){
	if(a.size()!=b.size())return false;
	for(int i=0;i<a.size();i++){
		if(a[i]=='?' || b[i]=='?')continue;
		if(a[i]!=b[i])return false;
	}
	return true;
}

int main(void){
	while(1){
		scanf("%d %d",&n,&m);
		if(n+m==0)break;
		pd.clear();
		res.clear();
		for(int i=0;i<n;i++){
			string str[3];
			cin >> str[0] >> str[1] >> str[2];
			pd.push_back(PP(P(str[1],str[2]),str[0]));
		}
		for(int i=0;i<m;i++){
			string str[3];
			cin >> str[0] >> str[1] >> str[2];
			bool flag=false;
			for(int j=0;j<pd.size();j++){
				if(check(str[0],pd[j].first.first) && check(str[1],pd[j].first.second)){
					if(pd[j].second=="permit")flag=true;
					else flag=false;
				}
			}
			if(flag){
				res.push_back(PP(P(str[0],str[1]),str[2]));
			}
		}
		printf("%d\n",res.size());
		for(int i=0;i<res.size();i++){
			cout << res[i].first.first << " " << res[i].first.second << " " << res[i].second << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1508
import java.util.Scanner;

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

        final int N = Integer.parseInt(scanner.next());
        scanner.nextLine();// To get rid of new line
        final String A1 = scanner.nextLine();
        final String A2 = scanner.nextLine();

        String[] A1Array = A1.split(" ");
        String[] A2Array = A2.split(" ");

        int[][] AIJ = new int[2][N];

        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < N; j++) {
                if (i == 0) {
                    AIJ[0][j] = Integer.parseInt(A1Array[j]);
                } else {
                    AIJ[1][j] = Integer.parseInt(A2Array[j]);
                }
            }
        }

        int result = 0;

        for (int i = 0; i < N; i++) {
            int I = 0;
            int sum = 0;
            for (int j = 0; j < N; j++) {
                if (j == i) {
                    sum += AIJ[0][j];
                    I = 1;
                }
                sum += AIJ[I][j];

            }
            if (result < sum) {
                result = sum;
            }
        }
        System.out.println(result);
    }
}

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

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

    int A, B;
    cin >> A >> B;

    if (A <= 8 && B <= 8) {
        cout << "Yay!\n";
    }
    else
    {
        cout << ":(\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,j,sum(0),ans(-1);
  cin >> n >> m;
  for(int i = 0;i<m;i++){
    cin >> j;
    sum += j;
  }
  sum = n - sum;
  if(sum >= 0){
    ans = sum;
  }
  cout << ans << endl;
}

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

constexpr static int MAXN = 1e6;
constexpr static int MOD = 1e9 + 7;

using namespace std;

int n;
int a[MAXN];

int64_t solve() {
    int64_t r = 1;
    int val = n - 1;
    for (int i = 0; i < n; i++) {
        if (a[i] != val)
            return 0;
        if (i % 2 == 1) {
            r = (r * 2) % MOD;
            val -= 2;
        }
    }
    return r;
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    sort(a, a + n);
    reverse(a, a + n);
    printf("%lld\n", solve());
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
const ll MOD = 998244353;
ll modex(ll a, ll p, ll m = MOD) {
	if (!p) return 1;
	if (p & 1) return a * modex(a, p - 1, m) % m;
	ll v = modex(a, p >> 1, m);
	return v * v % m;
}
void sub(ll& x, ll y) {
	x -= y;
	if (x < 0) x += MOD;
}
int main() {
	int n;
	scanf("%d", &n);
	const int MX = 1e6;
	vector<ll> num(MX + 1), sum(MX + 1), sumsq(MX + 1), F(MX + 1);
	for (int i = 0; i < n; ++i) {
		int a;
		scanf("%d", &a);
		++num[a];
	}
	for (int d = 1; d <= MX; ++d)
		for (int x = d; x <= MX; x += d) {
			sum[d] += num[x] * x;
			sum[d] %= MOD;
			sumsq[d] += num[x] * x * x;
			sumsq[d] %= MOD;
		}
	ll inv2 = (MOD + 1) >> 1;
	ll ans = 0;
	for (int i = MX; i >= 1; --i) {
		F[i] = (sum[i] * sum[i] - sumsq[i]) % MOD * inv2 % MOD;
		for (int j = i + i; j <= MX; j += i)
			sub(F[i], F[j]);
		ans = (ans + F[i] * modex(i, MOD - 2)) % MOD;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 33536
use proconio::marker::{Bytes, Chars};
use proconio::{fastout, input};
use std::collections::*;

#[fastout]
fn main() {
    input! {
        mut s: Chars,
        k: i64,
    }

    if s.iter().collect::<HashSet<_>>().len() == 1 {
        println!("{}", s.len() as i64 * k / 2);
        return;
    }

    let mut v = Vec::new();
    let mut now = s[0];
    let mut count = 1;
    for i in 1..s.len() {
        if now == s[i] {
            count += 1;
        } else {
            v.push(count);
            count = 1;
            now = s[i];
        }
    }
    v.push(count);

    let mut ans = v.iter().map(|x| x / 2).sum::<i64>() * k;
    if s[0] == s[s.len() - 1] {
        ans -= (v[0] / 2 + v[v.len() - 1] / 2 - (v[0] + v[v.len() - 1]) / 2) * (k - 1);
    }
    println!("{}", ans);
}


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

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


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

using namespace std;

#define INF 1000007
#define MOD 998244353
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}
signed main()
{
    int N;
    cin >> N;
    vector<int> D;
    int A[N + 1];
    fill(A, A + N + 1, 0);
    int ans = 1;
    rep(i, N)
    {
        int a;
        cin >> a;
        D.push_back(a);
    }
    if (D[0] != 0)
    {
        cout << "0" << endl;
        return 0;
    }
    sort(D.begin(), D.end());
    if (D[1] == 0)
    {
        cout << "0" << endl;
        return 0;
    }
    for (int i = 0; i < N; i++)
    {
        A[D[i]]++;
    }
    for (int i = 1; i <= N; i++)
    {
        ans = (ans * mpow(A[i - 1], A[i], MOD)) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2168
using System;
class c
{
    static void Main()
    {
        var inp = Console.ReadLine();
        int s = 0;
        for (int i = 0; i < inp.Length; i++)
        {
            if (inp[i] == 'S') s++;
            else if (s > 0) s--;
        }
        Console.WriteLine(2 * s);
    }
}

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

const int mod = 1000000007;
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 {
    mint res(*this);
    return res/=a;
  }

  // combination
  mint choose(int n, int a) {
      mint x = 1, y = 1;
      rep(i,a) {
          x *= n-i;
          y *= i+1;
      }
      return x / y;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

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

  combination Comb(n);

  for(int i = 1; i <= k; ++i) {
    mint ans = Comb(n-k+1,i) * Comb(k-1,i-1);
    cout << ans.x << endl;
  }
  
  return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int n, x, t;
	int kai;
	scanf("%d", &n);
	scanf("%d", &x);
	scanf("%d", &t);
	kai = n%x == 0 ? n/x : n/x+1;
	printf("%d\n", kai*t);
	return 0;
}


Measured memory_bytes: 1712
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int ac=0;
    int wa=0;
    int tle=0;
    int re=0;
    string s;
    while(n--)
    {
        cin>>s;
        if(s=="AC")
        {
            ac++;
        }
        else if(s=="TLE")
        {
            tle++;
        }
        else if(s=="WA")
        {
            wa++;
        }
        else 
        {
            re++;
        }
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return 0;
}

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



int main() {
  double r;
  cin >> r;
  cout << 2*M_PI*r << endl;
  
}



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

int main() {
  int N;
  int i=0;
  int count=0;
  cin >> N ;
  while(i<N){
    int l,r;
    cin >> l >> r ;
	count+=r-l+1;
    i++;
  }
  cout << count <<endl;
  // ここにプログラムを追記
}



Measured memory_bytes: 256
n,m,xx,yy = gets.split.map{|x| x.to_i}
x = gets.split.map{|x| x.to_i}
y = gets.split.map{|x| x.to_i}
x << xx
y << yy
if x.max  < y.min
  print 'No War'
else
  print 'War'
end


Measured memory_bytes: 1788
#include <iostream>

using namespace std;

int main(){
	int IN[3];
	int count5=0,count7=0;
	int i;
	cin>>IN[0]>>IN[1]>>IN[2];

	for(i=0;i<3;i++){
		if(IN[i] == 5){
			count5++;
		}else if( IN[i] ==7 ){
			count7++;
		}else{
			cout<<"NO"<<endl;
			return 0;
		}
	}

	if(count5 != 2){
		cout<<"NO"<<endl;
	}else if(count7 != 1){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 
ll a[200005],inv[200005],sm[200005];
vector<ll>c[2050];
int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	string s;
	cin >> s;
	ll md=673;
	for(i=0;i<sz(s);i++)
	{
		x=s[i]-'0';
		if(i)
			a[i]=((a[i-1]*10)%md+x)%md;
		else
			a[i]=x;
	}

	x=0;
	for(i=0;i<sz(s);i++)
	{
		x+=(s[i]-'0');
		x%=3;
		sm[i]=x;
		// cout<<sm[i]<<" ";
	}
	// cout<<endl;

	y=1;
	for(i=0;i<=200000;i++)
		inv[i]=power(y,md-2,md),y*=10,y%=md;

	for(i=0;i<sz(s);i++)
	{
		a[i]=(a[i]*inv[i])%md;
		c[a[i]].pb(i);
	}
		
	ll ans=0;	
	for(i=0;i<=2019;i++)
	{
		if(i==0)
		{
			ll r0=1,r2=0,r1=0;
			for(j=0;j<sz(c[i]);j++)
			{
				x=c[i][j];
				if(sm[x]==0)
				{
					ans+=r0;
				}
				if(sm[x]==1)
				{
					ans+=r1;	
				}
				if(sm[x]==2)
				{
					ans+=r2;
				}
				if(sm[x]==0)r0++;
				if(sm[x]==1)r1++;
				if(sm[x]==2)r2++;
			}
		}
		else
		{
			ll r0=0,r1=0,r2=0;
			for(j=0;j<sz(c[i]);j++)
			{
				x=c[i][j];

				if(sm[x]==0)
				{
					ans+=r0;
				}
				if(sm[x]==1)
				{
					ans+=r1;	
				}
				if(sm[x]==2)
				{
					ans+=r2;
				}
				if(sm[x]==0)r0++;
				if(sm[x]==1)r1++;
				if(sm[x]==2)r2++;
			}	
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 11192
#    !/usr/bin/env python3
#    encoding: UTF-8
#    Modified: <15/Jun/2019 05:31:28 PM>


#    ✪ H4WK3yE乡
#    Mohd. Farhan Tahir
#    Indian Institute Of Information Technology (IIIT), Gwalior


import sys
import os
from io import IOBase, BytesIO


def main():
    n, k = get_ints()
    if k==1:
        print(0)
        return
    left = n - k
    print(left)


BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill():
            pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill()
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        py2 = round(0.5)
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode("ascii"))
            self.read = lambda: self.buffer.read().decode("ascii")
            self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return map(int, sys.stdin.readline().split())


def input(): return sys.stdin.readline().strip()


if __name__ == "__main__":
    main()


Measured memory_bytes: 3444
/*input
9
1 4 1 4 2 1 3 5 6
3
0 9 1
1 6 1
3 7 5
*/
macro_rules! input_vec {
    () => {
        input!()
            .split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };
    ($delimiter:expr) => {
        input!()
            .split($delimiter)
            .map(|x| x.parse().unwrap())
            .collect()
    };
}

macro_rules! input {
    () => {{
        let mut return_ = format!("");
        std::io::stdin().read_line(&mut return_).ok();
        return_.pop();
        return_
    }};
}

fn main() {
    input!();
    let v: Vec<i32> = input_vec!();
    let s_n = input!().parse().unwrap();
    let mut q: Vec<i32>;
    for _ in 0..s_n {
        q = input_vec!();
        println!(
            "{}",
            &v[q[0] as usize..q[1] as usize]
                .iter()
                .fold(0, |x, y| if *y == q[2] { x + 1 } else { x })
        );
    }
}



Measured memory_bytes: 5040
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,K;
  int ans=0;
  cin>>N>>K;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    int p;
    cin>>p;
    vec.at(i) = p;
  }
  sort(vec.begin(), vec.end()); 
  for(int i=0; i<K; i++){
    ans +=vec.at(i);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3608
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanText() (read string){
    sc.Scan()
	read = sc.Text()
	return
}

func scanInt() (read int64){
    sc.Scan()

    read, err := strconv.ParseInt(sc.Text(), 10, 64)
    if err != nil{
        fmt.Println(err)
    }
    return
}

// func scanFloat() float64{
//     sc.Scan()
//     a, err := strconv.ParseFloat(sc.Text(), 64)

//     if err != nil{
//         fmt.Println(err)
//     }
//     return a
// }

// func scanTextSilice(n int) []string{
//     a := make([]string, n)
//     for i:=0; i<n; i++{
//         a[i] = scanText()
//     }
//     return a
// }

// func scanIntSlice(n int) []int{
//     a := make([]int, n)
//     for i:=0; i<n; i++{
//         a[i] = scanInt()
//     }
//     return
// }

// func scanFloatSlice(n int) []float64{
//     a := make([]float64, n)
//     for i:=0; i<n; i++{
//         a[i] = scanFloat()
//     }
//     return a
// }

// func abs(a int) int{
//     if a > 0{
//         return a
//     }
//     return -a
// }

// func gcd(a, b int) int{
//     if b == 0{
//         return a
//     }
//     return gcd(b, a%b)
// }

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
	INF            = 1e8
)


func main(){
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
    sc.Split(bufio.ScanWords)
	_, a, b := scanInt(), scanInt(), scanInt()
	s := scanText()

	var all int64 =0
	var overseas int64 = 0
	for _, q:= range s{
		if q == 'c'{
			fmt.Println("No")
		}else if q == 'a'{
			if all < a+b{
				all++
				fmt.Println("Yes")
			}else{
				fmt.Println("No")
			}
		}else if q == 'b'{
			if all < a+b && overseas < b{
				all++
				overseas++
				fmt.Println("Yes")
			}else{
				fmt.Println("No")
			}
		}
	}	
	return
}

Measured memory_bytes: 2220
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

table = [0] * (N + 1)
"""
for i in range(N):
  ok = 0
  ng = 10 ** 9
  while ng - ok > 1:
    m = (ok + ng) // 2
    if m * 2 - 1 <= a[i]: ok = m
    else: ng = m
  table[i + 1] = max(table[i], i - min(i, ok))
"""
for i in range(N - 1):
  ok = 0
  ng = 10 ** 9
  while ng - ok > 1:
    m = (ok + ng) // 2
    if m * 2 + 1 <= a[i]: ok = m
    else: ng = m
  table[i + 1] = max(table[i], i - ok)

res = 1
"""
if a[0] == 1 and (a[1] == 2):
  res = 2
  table = table[1: ]
  N -= 1
  for i in range(N + 1): table[i] = max(0, table[i] - 1)
"""
t = [0] * (N + 2)
for i in range(1, N + 1): t[table[i]] += 1

#print(t, table)
for i in range(N + 1):
  if t[i] <= 0: break
  t[i + 1] += t[i] - 1
  res *= t[i]
  res %= mod
print(res)

Measured memory_bytes: 58864
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> L(n);
  for (int i = 0; i < n; i++) {
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int64_t ans = 0;
  for (int i = 0; i < n; i++) {
    const int a = L[i];
    for (int j = i + 1; j < n; j++) {
      const int b = L[j];
      for (int k = j + 1; k < n; k++) {
        if (L[k] >= a + b) continue;
        const int c = L[k];
        if (a < b + c && b < c + a) ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int N=0,count=0,max=0;
    scanf("%d",&N);
    int A[N][2];//X,Y
    for(int i=0;i<N;i++){
        scanf("%d",&A[i][0]);
    }
    for(int i=0;i<N;i++){
        scanf("%d",&A[i][1]);
    }
    for(int i=0;i<N;i++){
        count=0;
        for(int k=0;k<=i;k++){
            count+=A[k][0];
        }
        for(int j=i;j<N;j++){
            count+=A[j][1];
        }
        if(max<count){
            max=count;
        }
    }
    
    printf("%d\n",max);
    
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n;

  cin >> n;

  set<string> ss;

  string prev;
  while(n--){
    string w;
    cin >> w;

    if (ss.find(w) != ss.end()) {
      puts("No");
      return 0;
    }

    if (prev.size() && prev[prev.size()-1] != w[0]) {
      puts("No");
      return 0;
    }

    ss.insert(w);
    prev = w;
  }

  puts("Yes");

  return 0;
}


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

char getGrade(int m, int f, int r){
	int sum = m+f;
	char grade;
	if(m==-1 || f==-1){
	grade='F';
	}else if(80<=sum){
	grade='A';
	}else if(65<=sum&&sum<80){
	grade='B';
	}else if(50<=sum&&sum<65){
	grade='C';
	}else if(30<=sum&&sum<65){
	if(50<=r) grade='C';
	else grade='D';
	}else if(sum<30){
	grade='F';
	}
	return grade;
	}
	
int main(){
	int m,f,r;
	while(1){
	cin>>m>>f>>r;
	if(m==-1&&f==-1&&r==-1) break;
	cout<<getGrade(m,f,r)<<endl;
	}
	return 0;
	}
	

Measured memory_bytes: 1152
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ans=0;
    for(ll i=0;i<=100;i++){
        if(a<=i && i<b && c<=i && i<d) ans++;
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int mod = 1000000007;



int main(){
    string s; cin >> s;
    vector<ll> dp(13);
    dp[0] = 1;

    
    for(int i = 0; i < s.size(); i++){
        vector<ll> nextdp(13);
        char c = s[i];
        if(c == '?'){
            for(int k = 0; k <= 9; k++){
                //c=0~9
                for(int j = 0; j <= 12; j++){
                    nextdp[(j * 10 + k) % 13] += dp[j];
                    nextdp[(j * 10 + k) % 13] %= mod;
                }
            }
        } else {
            int k = (int)(s[i] - '0');
            for(int j = 0; j <= 12; j++){
                nextdp[(j * 10 + k) % 13] += dp[j];
                nextdp[(j * 10 + k) % 13] %= mod;
            }
        }
        swap(dp,nextdp);
    }
    cout << dp[5] << endl;
    return 0;
}

Measured memory_bytes: 512
fn main() {
    let n = read::<i32>();

    let mut t0 = 0;
    let mut x0 = 0;
    let mut y0 = 0;

    for _ in 0..n {
        let (t1, (x1, y1)) = read_tuple();

        let dist = (x1 - x0).abs() + (y1 - y0).abs();
        if  dist > t1 - t0 || dist % 2 != (t1 - t0) % 2 {
            println!("No");
            return
        }

        t0 = t1;
        x0 = x1;
        y0 = y1;
    }

    println!("Yes");
}

fn read_tuple() -> (i32, (i32, i32)) {
    let v = read_vec::<i32>();
    (v[0], (v[1], v[2]))
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	D = inputInt()
	C = inputList()
	S = []
	ans = []
	for i in range(D):
		s = inputList()
		S.append(s)

	minC = min(C)
	minCn = 0
	for i,val in enumerate(C):
		if val == minC:
			minCn = i

	for i,val in enumerate(S):
		tmp = max(val)
		for j,vol in enumerate(val):
			if tmp == vol:
				ans.append(1)
				break

	for i in range(D):
		print(ans[i])

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 78564
// Vicfred
// https://atcoder.jp/contests/abc175/tasks/abc175_a
// implementation
import std.stdio;
import std.string;

void main() {
    string S = readln.strip;
    if(S.count("RRR") == 1) {
        3.writeln;
        return;
    } else if(S.count("RR") == 1) {
        2.writeln;
        return;
    } else if(S.count("R") >= 1) {
        1.writeln;
        return;
    } else {
        0.writeln;
    }
}



Measured memory_bytes: 2596
import heapq
inf=10**9


def dijkstra():
    V,E,r=map(int,input().split())
    color=["white" for _ in range(V)]
    D=[inf for _ in range(V)]
    M=[[] for _ in range(V)]

    D[r]=0
    color[r]="gray"
    queue=[[0,r]]
    heapq.heapify(queue)

    for i in range(E):
        s,t,d=map(int,input().split())
        M[s].append([d,t])

    while len(queue)!=0:
        u=heapq.heappop(queue)[1]
        if color[u]=="black":continue
        color[u]="black"

        V=[[i,j] for i,j in M[u] if color[j]!="black"]
        if len(V)>0:
            for i,j in V:
                if D[u]+i<D[j]:
                    D[j]=D[u]+i
                    color[j]="gray"
                    heapq.heappush(queue,[D[j],j])

    return D


D=dijkstra()
for i in D:
    if i==inf:print("INF")
    else:print(i)


Measured memory_bytes: 98760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b;
    int i=0;
    cin>>a>>b;
    if(a<b){
        while(i<b){
        cout<<a;
        i++;
        }
    }
    else{
        while(i<a){
        cout<<b;
        i++;
        }
    }
    cout<<endl;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s, t;
    cin >> s;
    cin >> t;

    int count = 0;
    if (s[0] == t[0]) count++;
    if (s[1] == t[1]) count++;
    if (s[2] == t[2]) count++;

    cout << count << '\n';

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = Long.parseLong(sc.nextLine());
        String[] arrays = sc.nextLine().split(" ");
        sc.close();

        int count = 0;
        long tmpMax = Long.parseLong(arrays[0]);

        for (int i = 0; i < N; i++) {
            long Pi = Long.parseLong(arrays[i]);
            if (tmpMax >= Pi) {
                count++;
                tmpMax = Pi;
            } else {
                continue;
            }
        }

        System.out.println(count);

    }

}

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


int main(){
    int n;
    cin >>n;
    double ans;
    if(n%2==0){
        ans=0.5;
    }else{
        double k=(double)n;
        ans=(double)((n/2)+1.0)/k;
    }

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

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

int getMaxOverlapedNum(int start[], int end[],int n){
    int maxOverlap = 0,currentOverlap = 0,i = 0,j = 0;
    sort(start,start + n);
    sort(end,end + n);
    
    while(i < n && j < n){
        if(start[i] < end[j]){
            currentOverlap++;
            maxOverlap = max(maxOverlap, currentOverlap);
            i++;
        }
        else{
            currentOverlap--;
            j++;
        }
    }
    return maxOverlap;
}

int main(){
    int n,t;
    scanf("%d %d",&n,&t);
    int begin[n],end[n];

    for(int i = 0;i < n;i++){
        scanf("%d %d",&begin[i],&end[i]);
    }
    printf("%d\n",getMaxOverlapedNum(begin,end,n));
}



Measured memory_bytes: 3556
def d(n):
    x = 0
    for i in range(1, n + 1):
        if n % i == 0:
            x += 1
    return x
N = int(input())
ans = 0
for i in range(1, N + 1):
    if i % 2 == 1 and d(i) == 8:
        ans += 1

print(ans)

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

i = 1
ans = 0
red = []
for a in A:
    if a == i:
        red += [i]
        i += 1
    else:
        ans += 1
if not ans == len(A):
    print(ans)
else:
    print(-1)

Measured memory_bytes: 32260
[N, K] = [int(x) for x in input().split()]
d = []
A = []
for i in range(K):
	d.append(int(input()))
	A.append([int(x) for x in input().split()])
loop = 0
count = 0
for i in range(N):
	bool = 0
	for j in range(K):
		for k in range(d[j]):
			if A[j][k] == i+1:
				bool = 1
#			print([i,j,k,bool])
	if bool == 0:
		count = count + 1
print(count)

Measured memory_bytes: 9280
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) //[l, r)
#define rep(i,n) REP(i,0,n)           //[0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showslr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl //[l, r)

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

void _DEBUG(){cerr<<endl;}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<",";_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<endl;out(b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int n;
int a,b;

signed main(){
    io();

    in(n);
    if(n==1){
        puts("Hello World");
    }else{
        in(a,b);
        out(a+b);
    }

    return 0;
}


Measured memory_bytes: 632
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define ALL(x) x.begin(), x.end()
#define INF (1001000000)
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i:c)
#define EXIST(cs,v) (find(ALL(cs),(v))!=cs.end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define UNIQ(c) (c).erase(unique((c).begin(),(c).end()), (c).end());
#define P(p) cout<<(p)<<endl;

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

    int n;
    cin >> n;

    map<string, int> words;
    string input;
    char last_char;
    cin >> input;
    words[input]++;
    last_char = input.back();
    REP(i, n - 1) {
        cin >> input;
        if (words[input] != 0 || last_char != input.front()) {
            P("No");
            return 0;
        }
        words[input]++;
        last_char = input.back();
    }
    P("Yes");

    return 0;
}


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

#pragma GCC optimize ("-O3", "unroll-loops")

using namespace std;

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

  size_t n;
  cin >> n;
  vector<unsigned> av(n);
  vector<unsigned> bv(n);
  for ( size_t i = 0; i < n; ++i ) cin >> av[i];
  for ( size_t i = 0; i < n; ++i ) cin >> bv[i];

  const size_t block_size = 8192;

  unsigned ret = 0;
  for ( size_t i = 0; i < n; i += block_size ) {
    size_t i_max = min(n, i + block_size);
    size_t j = 0;
    for ( ; j + 3 < n; j += 4 ) {
      for ( size_t ii = i; ii < i_max; ++ii ) {
        ret ^= av[j] + bv[ii];
        ret ^= av[j + 1] + bv[ii];
        ret ^= av[j + 2] + bv[ii];
        ret ^= av[j + 3] + bv[ii];
      }
    }
    for ( ; j < n; ++j ) {
      for ( size_t ii = i; ii < i_max; ++ii ) {
        ret ^= av[j] + bv[ii];
      }
    }
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long a, b, n;
    cin >> a >> b >> n;

    if (n / b == 0)
    {
        long j = n % b;
        long intermediate = a * j;
        long answer = intermediate / b;
        cout << answer << endl;
    }
    else
    {
        long j = b - 1;
        long intermediate = a * j;
        long answer = intermediate / b;
        cout << answer << endl;
    }
}

Measured memory_bytes: 3592
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static int testN = 3;
	static long mod = 1000000007;
	//static long mod =998244353; 
	static System.IO.StringReader sr;
		static void Main(string[] args) {
			char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";

		int res = 0;

		int val = int.Parse(Console.ReadLine());


		res += (val / 500)*1000;
		val = val % 500;
		res += (val / 5)*5;


			Console.WriteLine(res);
			return;

		
	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
#define vi vector<int>
#define vb vector<bool>
#define lli long long int
#define vvi vector<vector<int>>
#define loop(n) for (int i = 0; i < n; i++)
using namespace std;

auto SpeedUp = []() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();

bool cantriangle(long a, long b, long c)
{
    if (a == b || a == c || b == c)
        return false;
    lli sum1 = a + b;
    if (sum1 <= c)
        return false;

    lli sum2 = c + b;
    if (sum2 <= a)
        return false;

    lli sum3 = a + c;
    if (sum3 <= b)
        return false;
    return true;
}

int solve()
{
    int n;
    cin >> n;
    vi arr(n, 0);
    loop(n) cin >> arr[i];
    int count = 0;
    for (int i = 0; i < n - 2; i++)
    {
        for (int j = i + 1; j < n - 1; j++)
            for (int k = j + 1; k < n; k++)
                if (cantriangle(arr[i], arr[j], arr[k]))
                {
                    // cout << i << j << k << endl;
                    count++;
                }
    }
    return count;
}

int main()
{

    cout << solve() << '\n';
    return 0;
}

Measured memory_bytes: 3576