akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val d = sc.nextInt()
    val c = Array(26) { sc.nextInt() }
    val s = Array(d) { Array(26) { sc.nextInt() } }
    val last = Array(26) { -1 }
    var score = 0L
    for (i in 0 until d) {
        val arr = Array(26) { 0 }
        for (t in 0 until 26) {
            arr[t] += s[i][t]
            for (j in 0 until 26) {
                if (j == t) continue
                arr[t] -= c[j] * (i - last[j])
            }
        }
        val max = arr.max()!!
        for (t in 0 until 26) {
            if (arr[t] == max) {
                println(t + 1)
                last[t] = i
                break
            }
        }
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 44772
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	const pi = 3.14159265359
	sc.Split(bufio.ScanWords)
	//sc.Buffer(nil, 100000000)
	r := nextFloat64()
	fmt.Println(2 * r * pi)
}


Measured memory_bytes: 1772
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        int[] scores = new int[n];
        
        for(int i = 0; i < n; i++) {
            scores[i] = sc.nextInt();
        }

        for(int gakki = k + 1; gakki <= n; gakki++) {
            if(scores[gakki - k - 1] < scores[gakki - 1]) System.out.println("Yes");
            else System.out.println("No");
        }
    }
}

Measured memory_bytes: 60424
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> *i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int q;
    cin>>q;
    while(q--) {
        string x,y;
        cin>>x>>y;
        int n=SZ(x),m=SZ(y);
        vector<vector<int>> dp(n+1,vector<int>(m+1,0));
        REP(i,n) {
            REP(j,m) {
                if(x[i]==y[j]) {
                    dp[i+1][j+1]=dp[i][j]+1;
                } else {
                    dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
                }
            }
        }
        cout<<dp[n][m]<<endl;
    }
    return 0;
}

Measured memory_bytes: 10728
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(LL, a, b, c);
	LL x = c - a - b;
	OUT(x > 0 && 4 * a * b < x * x ? "Yes" : "No");
}


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

using namespace std;

bool IsSquare(int x) {
  const auto n = static_cast<int>(sqrt(x));
  return n * n == x;
}

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

  string a, b;
  cin >> a >> b;
  a.append(b);

  if (IsSquare(stoi(a))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

int N;

signed main()
{
    cin >> N;

    vi A(N);

    vi X(N);

    int S=0;

    rep(i,N)
    {
        cin >> A[i];
        S+=A[i];
    }

    X[0]=S;

    for(int i=1;i<N-1;i++)
    {
        if(i%2)X[0]-=2*A[i];
    }

    for(int i=1;i<N;i++)
    {
        X[i]=2*A[i-1]-X[i-1];
    }

    rep(i,N)
    {
        cout << X[i];
        if(i!=N-1)cout <<" ";
        else cout << endl; 
    }



    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <cstring>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int, PII> PPII;
typedef pair<int, PPII> PPPII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int nJ[1001][1001] = {}, nO[1001][1001] = {}, nI[1001][1001] = {};
int main(void){
	int n, m, k;
	cin >> m >> n >> k;
	REP(i, m){
		string s;
		cin >> s;
		REP(j, s.size()){
			if(j > 0){
				nJ[j][i] += nJ[j-1][i];
				nO[j][i] += nO[j-1][i];
				nI[j][i] += nI[j-1][i];
			}
			if(i > 0){
				nJ[j][i] += nJ[j][i-1];
				nO[j][i] += nO[j][i-1];
				nI[j][i] += nI[j][i-1];
			}
			if(i > 0 && j > 0){
				nJ[j][i] -= nJ[j-1][i-1];
				nO[j][i] -= nO[j-1][i-1];
				nI[j][i] -= nI[j-1][i-1];
			}
			if(s[j] == 'J') nJ[j][i]++;
			if(s[j] == 'O') nO[j][i]++;
			if(s[j] == 'I') nI[j][i]++;
		}
	}
	REP(i, k){
		int a, b, c, d;
		cin >> b >> a >> d >> c;
		a--;
		b--;
		c--;
		d--;
		int J = nJ[c][d];
		int O = nO[c][d];
		int I = nI[c][d];
		if(a > 0){
			J -= nJ[a-1][d];
			O -= nO[a-1][d];
			I -= nI[a-1][d];
		}
		if(b > 0){
			J -= nJ[c][b-1];
			O -= nO[c][b-1];
			I -= nI[c][b-1];
		}
		if(a > 0 && b > 0){
			J += nJ[a-1][b-1];
			O += nO[a-1][b-1];
			I += nI[a-1][b-1];
		}
		cout << J << " " << O << " " << I << endl;
	}
}

Measured memory_bytes: 14880
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    X,=pin()


    #解が存在することが証明されているので、探索を行う
    for a in range(1000):
        cond=0        
        if a**5==X:print(a,0);break
        #search B for B**5==t
        A=a
        if A**5<X:#Bは負！
            t=X-A**5
            cond=1#後で負にする
            r=A+1 #rはBのかりの最大値
        elif A**5>X:
            t=(A**5)-X
            r=100+A+1
        #search B for B**5==t
        #print(a,t,cond,"K")
        for b in range(r):                
            #print(b**5,t)
            if b**5==t:
                #print("yeah")
                B=b
                if cond==1:B*=(-1)
                print(A,B)
                return
                
#%%submit!
resolve()

Measured memory_bytes: 63512
using System;

namespace ABC130
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            double W = double.Parse(input[0]);
            double H = double.Parse(input[1]);
            double x = double.Parse(input[2]);
            double y = double.Parse(input[3]);

            if ((W % 2) == 0 && (H % 2) == 0)
            {
                if (x == (W / 2) && y == (H / 2))
                {
                    Console.Write((W * H) / 2);
                    Console.Write(' ');
                    Console.WriteLine(1);
                    return;
                }
            }

            Console.Write((W * H) / 2);
            Console.Write(' ');
            Console.WriteLine(0);
        }
    }
}


Measured memory_bytes: 13140
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

signed main() {
    int N, K; cin >> N >> K;
    int ans = 1;
    for(int i=0; i<N; i++) {
        (ans *= K) %= MOD;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n,m,q;
int a[55],b[55],c[55],d[55];
long long mx=0;
void dfs(vector<int> v){
	if(v.size()==n+1){
		long long cnt=0;
		for(int i=0;i<q;i++){
			if(v[b[i]]-v[a[i]]==c[i]){
				cnt+=d[i];
			}
		}
		mx=max(mx,cnt);
		return ;
	}
	for(int i=v[v.size()-1];i<=m;i++){
		v.push_back(i);
		dfs(v);
		v.erase(v.begin()+v.size()-1);
	}
}
int main(){
	cin>>n>>m>>q;
	vector<int> v;
	for(int i=0;i<q;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	}
	vector<int> vvvvv;
	vvvvv.push_back(1);
	dfs(vvvvv);
	cout<<mx<<endl;
	return 0;
}

Measured memory_bytes: 3600
#include<iostream>
using namespace std;
int main()
{

    int h,a;
    cin>>h>>a;
    int z=0;
    int i=1;
    int k=0;
    while(k>=0)
    {
        z=a*i;
        k=h-z;
        if(k<=0)
            break;
        i++;


    }

    cout<<i;
}


Measured memory_bytes: 256
/*
  
  Author: Arnab Sinha
	
  ███████╗██╗  ██╗███████╗██████╗         ██╗      ██████╗  ██████╗██╗  ██╗███████╗██████╗  █████╗  █████╗ 
  ██╔════╝██║  ██║██╔════╝██╔══██╗        ██║     ██╔═══██╗██╔════╝██║ ██╔╝██╔════╝██╔══██╗██╔══██╗██╔══██╗
  ███████╗███████║█████╗  ██████╔╝        ██║     ██║   ██║██║     █████╔╝ █████╗  ██║  ██║╚██████║╚██████║
  ╚════ █║██╔══██║██╔══╝  ██╔══██╗        ██║     ██║   ██║██║     ██╔═██╗ ██╔══╝  ██║  ██║ ╚═══██║ ╚═══██║
  ███████║██║  ██║███████╗██║  ██║███████╗███████╗╚██████╔╝╚██████╗██║  ██╗███████╗██████╔╝ █████╔╝ █████╔╝
  ╚══════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝╚══════╝╚═════╝  ╚════╝  ╚════╝                                                                                                        
*/

#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define li long long int
#define ld long long double
#define all(v) v.begin(),v.end()
#define sort(a) sort(all(a))
#define rev(a) reverse(all(a))
#define pb push_back
#define INF 1e18+10
#define MINF -1e18-10
#define rep(i,a,b) for(li i=a;i<b;i++)
#define vli vector<li>
#define MAXN 1e5+10
const li mod = 1e9+7;
using namespace std;

li power(li a, li b) { a%=mod; li ret = 1; while(b){ if(b&1) ret*=a; a*=a;; if(ret>=mod) ret%=mod; if(a>=mod) a%=mod; b>>=1; } return ret; }

template <class T> void read(T& x){
	cin>>x;
}

template <class T, class... U> void read(T& x, U&... u){
	read(x);
	read(u...);
}

template <class A> void read(vector<A>& v){
	for(auto &it:v)
		read(it);
}

template <class A> void print(A x){
	cout<<x;
}

template <class A> void printl(A x){
	cout<<x<<endl;
}

template <class A> void print(vector<A>& v)
{
	for(auto &it:v){
		print(it);
		cout<<' ';
	}
	cout<<'\n';
}

void solve()
{
	li d,t,s;
	cin>>d>>t>>s;

	if(((double)d/s)<=t)
		cout<<"Yes\n";
	else
		cout<<"No\n";

}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

	IOS;

	solve();
	return 0;
}

Measured memory_bytes: 3656
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    input! {
       N: usize,
       mut K:usize,
       a:[Usize1;N],
    }

    let mut g = vec![vec![0; N]; 62];
    for i in 0..N {
        g[0][i] = a[i];
    }
    for i in 0..61 {
        for j in 0..N {
            g[i + 1][j] = g[i][g[i][j]];
        }
    }
    let mut ans: usize = 0;
    for i in (0..61).rev() {
        let step = 1 << i;
        if step <= K {
            K -= step;
            ans = g[i][ans];
        }
    }

    echo!(ans + 1);
}


Measured memory_bytes: 101992
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n;
Vi p;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n;
	p.resize(n);
	rep(i,n){
		cin>>p[i];
	}
	ll ans = 0;
	priority_queue< ll ,vector<ll>,greater<ll>> pq;
	rep(i,n){
		pq.push(p[i]);
		if(pq.top()>=p[i])ans++;
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 3956
N, K = map(int, input().split())
H = list(map(int, input().split()))

# print(H)
# print(H)

if N <= K:
    print(0)
else:
    H = sorted(H, reverse=True)
    # for _ in range(K):
    #     if len(H) == 0:
    #         break
    #     H.pop(0)
    
    # print(H)
    
    result = 0
    for i in range(K, N):
        result += H[i]

    print(result)

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

int int_sort(const void*, const void*);

int main(void){
	int i;
	int hight[10];

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

	qsort(hight, (size_t)10, sizeof(hight[0]), int_sort);

	for(i = 0; i < 3; i++){
		printf("%d\n", hight[9-i]);
	}

	return 0;
}

int int_sort(const void *x, const void *y){
	if(*(int*)x < *(int*)y){
		return -1;
	}else if(*(int*)x == *(int*)y){
		return 0;
	}
	return 1;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>

const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    int A,B;
    int ans=-1;
    cin>>A>>B;
    for(int i=1;i<=1000;i++){
        if((int)floor(0.08*i)==A && (int)floor(0.1*i)==B){
            ans=i;break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#B - Between a and b ...
import math
a,b,x = map(int, input().split())

if a==b:
    if a%x==0:
        print(1)
    else:
        print(0)
else:
    """
    min_dev = 0
    for i in range(a,b+1):
        if i%x==0:
            min_dev = i
            break
    """
    if a==0:
        min_dev=0
    else:
        min_dev = math.ceil(a/x)

    """
    max_dev = 0
    for i in range(a,b+1)[::-1]:
        if i%x==0:
            max_dev = i
            break
    """
    max_dev = int(b//x)
    print(max_dev-min_dev+1)


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
    double r;
    cin >> r;

    double area = M_PI * r * r;
    double circle = 2.0 * M_PI * r;

    cout << setprecision(6) << fixed << area << " " << setprecision(6) << fixed << circle << endl;

    return 0;
}


Measured memory_bytes: 3264
n = int(input())
a = list(map(int, input().split()))
b = a[:: -1]
pre = [0] * n
suf = [0] * n
pre[0] = a[0]
for i in range(1, n):
    pre[i] = pre[i - 1] + a[i]
suf[0] = b[0]
for i in range(1, n):
    suf[i] = suf[i - 1] + b[i]

ans = float("inf")
for i in range(n - 1):
    ans = min(ans, abs(pre[i] - suf[n - i - 2]))

print(ans)

Measured memory_bytes: 30200
N = int(input())
happy = [[int(n) for n in input().split()] for _ in range(N)]
dp = [[0 for _ in range(3)] for _ in range(N + 1)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if not j == k:
                dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + happy[i][k])

print(max(dp[N]))


Measured memory_bytes: 76760
#include <iostream>

using namespace std;

const int Nmax = 1e3 + 5,MOD = 1e9 + 7;
char a[Nmax][Nmax];
int N,M;
int dp[Nmax][Nmax];


int main() {
    cin >> N >> M;
    for(int i = 1; i <= N; ++i)
        for(int j = 1; j <= M; ++j)
            cin >> a[i][j];
    dp[1][1] = 1;
    for(int i = 1; i <= N; ++i)
        for(int j = 1; j <= M; ++j)
            if(a[i][j] == '#')
                dp[i][j] = 0;
            else
                dp[i][j] += (dp[i - 1][j] + dp[i][j - 1]) % MOD;
    cout << dp[N][M];
    return 0;
}


Measured memory_bytes: 5120
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

// Union-Find 木 (Verified: AtCoder Typical Contest 001 B)
struct UnionFind {
private:
    const int n;
    int __size;
    vector<int> uf;
public:
    // 初期化 UnionFind uni(n) のように宣言すれば良い
    UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
    // find (木の根を求める)
    int find(int x) {return (uf[x] < 0) ? x : uf[x] = find(uf[x]);}
    // x と y が同じ集合に属するかどうか
    bool same(int x, int y) {return find(x) == find(y);}
    // x が属する集合の要素数
    int size(int x) {return -uf[find(x)];}
    // 集合はいくつあるか
    int size()      {return __size;}
    // x と y の属する集合を併合
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return;
        __size--;
        if(uf[y] < uf[x]) swap(x, y);
        uf[x] += uf[y]; uf[y] = x;
    }
};

const int MAXA = 100010;
vector<int> a[MAXA], b[MAXA];
int main() {
    int N; cin >> N;
    for(int i=0; i<N; i++) {
        int x, y; cin >> x >> y;
        a[x].push_back(y);
        b[y].push_back(x);
    }
    UnionFind uf(MAXA);
    int64 ans = 0;
    for(int i=0; i<MAXA; i++) {
        for(size_t j=0; j+1<b[i].size(); j++) {
            int u = b[i][j], v = b[i][j+1];
            uf.unite(u, v);
        }
    }

    vector< set<int> > rec(MAXA);
    for(int i=0; i<MAXA; i++) {
        int x = uf.find(i);
        for(auto e : a[i]) rec[x].insert(e);
    }

    for(int i=0; i<MAXA; i++) {
        int64 sz = uf.size(i);
        ans += sz * rec[i].size();
    }
    cout << ans - N << endl;
    return 0;
}


Measured memory_bytes: 15488
import bisect

N, M = map(int, input().rstrip().split())
S = input()[::-1]

m = []
for i, s in enumerate(S):
    if s == '0':
        m.append(i)

cur = 0
output = []
while True:
    i = bisect.bisect_right(m, cur + M)
    
    if i >= len(m):
        output.append(m[i-1] - cur)
        print(' '.join(list(map(str, output[::-1]))))
        break
    elif m[i-1] == cur:
        print(-1)
        break
    
    output.append(m[i-1] - cur)
    cur = m[i-1]
    

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

template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}

int pw(int n,int k){
  assert(k>=0);
  int res=1;
  while(k){
    if(k&1)res*=n;
    n*=n;
    k>>=1;
  }
  return res;
}

signed main(){
  int n,k;cin>>n>>k;
  cout<<k*pw(k-1,n-1)<<endl;
}


Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
d = {}
for w in s:
  if w not in d:
    d[w] = 0
  d[w] += 1
d2 = sorted(d.items(), key=lambda x:x[1], reverse=True)
maxcnts = [w[0] for w in d2 if w[1] == d2[0][1]]
maxcnts.sort()
for ans in maxcnts:
  print(ans)

Measured memory_bytes: 49976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

void solve() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  cin >> a;
  vector<int> d(n + 1);
  rep3(i, 1, n + 1) d[i] = d[i - 1] + a[i - 1];
  int sum = 0;
  rep(i, n + 1) if (d[i] <= x) sum++;
  cout << sum << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
#include <numeric>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }




int main(int argc, char* argv[])
{
	for (;;) {
		int N;
		cin >> N;
		if (cin.fail()) break;

		int a4 = 0, a2 = 0, aN = 0, a;
		for (int i = 0; i < N; i++) {
			cin >> a;
			if (a % 4 == 0) a4++;
			else if (a % 2 == 0) a2++;
			else aN++;
		}

		if (a2 > 0) {
			cout << (a4 >= aN ? "Yes" : "No") << endl;
		} else {
			cout << (a4 >= aN - 1 ? "Yes" : "No") << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <set>
#include <iomanip>
#include <vector>
#include <queue>
#include <numeric>
//#include <bits/stdc++.h>

using namespace std;
const int INF = 1 << 30;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int ans=0;
    for(int i = 0 ; i < n ;++i)
    {
        int x ,y;
        cin>>x>>y;
        ans+=(y-x+1);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

n, a, b = read_int()
M = pow(10, 9) + 7
sys.setrecursionlimit(300000)
comk = [1 for _ in range(b + 2)]
def solve():
    ans = (pow(2, n, M) - 1) - kai(n, 0, a) * pow(kai(a, 0, a), M - 2, M) - kai(n, 0, b) * pow(kai(b, 0, b), M - 2, M)
    return ans % M

def kai(n, i, m):
    if i == m:
        return 1
    return (n * kai(n - 1, i + 1, m)) % M

if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 183544
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
//#include<map>
using namespace std;
typedef long long int llint;
typedef int beet;
#define ween tuple
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define izryt bool
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=1000000007;
const llint big=1e9+1e8;
const llint red=0xE869120;
const llint pro=1002001;

int main(void){
	string s,t,ans;
	cin>>s>>t;
	for(int i=0;i<t.size();i++){
		ans.pub(s[i]);ans.pub(t[i]);
	}
	if(s.size()>t.size()){ans.pub(s.back());}
	cout<<ans<<endl;
	
	return 0;
}



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

int main() {
  char s[105];
  gets(s);
  int n = strlen(s);
  for (int i = 0; i < n; i++) {
    if (i%2==0) {
      if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D') continue;

      printf("No\n");
      return 0;
    }else {
      if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D') continue;

      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
    #include <fstream>
    #include <iomanip>
    #include <iostream>
    #include <map>
    #include <math.h>
    #include <set>
    #include <stdio.h>
    #include <string>
    #include <utility>
    #include <vector>
     
    using namespace std;
     
    int main() {
      int n;
      cin >> n;
      vector<long long> act[3];
      act[0].resize(n);
      act[1].resize(n);
      act[2].resize(n);
      for (int i = 0; i < n; i++)
        cin >> act[0][i] >> act[1][i] >> act[2][i];
     
      long long dp[n + 1][3];
      dp[0][0] = dp[0][1] = dp[0][2] = 0;
      for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 3; j++) {
          dp[i][j] = 0;
          for (int k = 0; k < 3; k++) {
            if (j == k)
              continue;
            dp[i][j] = max(dp[i][j], dp[i - 1][k] + act[j][i - 1]);
          }
        }
      }
      cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
      return 0;
    }

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

#define ALL(v) v.begin(), v.end()

using namespace std;
int main() {

	int a, b, c;
	cin >> a >> b >> c;

	bool OK = false;

	for (int i = 1; i < b; i++)
	{
		if (a * i % b == c) OK = true;
	}

	if (OK) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#define INF 2147483647

using namespace std;



int main()
{
	string str, tmp, res, p;
	int len, q, a, b;

	cin >> str;
	cin >> len;

	for (int i = 0; i < len; i++) {
		cin >> res;
		if(res == "print") {
			cin >> a >> b;
			for (int j = a; j <= b; j++)
				cout << str[j];
			cout << endl;
		}
		
		if(res == "reverse") {
			cin >> a >> b;
			tmp = str;
			for (int j = a; j <= b; j++)
				str[j] = tmp[(b + a) - j];
		}

		if(res == "replace") {
			cin >> a >> b >> p;
			str.replace(a, b - a + 1, p);
		}

	}

	return (0);
}

Measured memory_bytes: 1220
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double ld;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)


int main() {
    ll A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;

    ll ans1 = 0;
    ll x = min(X,Y);
    x *= 2;
    rep(i,x){
        ans1 += C;
    }

    if(X != Y){
        if(X > Y){
            rep(i,X-Y){
                ans1 += A;
            }
        }else if (Y > X){
            rep(i,Y-X){
                ans1 += B;
            }
        }
    }
    // cout << ans1 << endl;

    ll ans2 = 0;
    ans2 += A*X;
    ans2 += B*Y;
    // cout << ans2 << endl;


    ll ans3 = 0;
    ll y = max(X,Y);
    y *= 2;
    rep(i,y){
        ans3 += C;
    }
    // cout << ans3 << endl;

    cout << min(min(ans1,ans2),ans3) << endl;



}




Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
  
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();
        sc.close();
        if ((-100 <= x && x <= 100) && (-100 <= y && y <= 100) && (0 < W && W <= 100) && (0 < H && H <= 100) && (0 < r && r <= 100)){
        	if (0 < x + r  && x + r <= W && 0 < y + r && y + r <= H) {
        		System.out.println("Yes");
        		}else{
        			System.out.println("No");
        			}
        	}
    }
}


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

int main() {
    long long N;
    cin >> N;
    long long A=0,B=0,C=0,D=0;
    for (int i=1 ; i<N+1 ; i++)
        A+=i;
    B=(3*(N/3-1)+6)*(N/3)/2;
    C=(5*(N/5-1)+10)*(N/5)/2;
    D=(15*(N/15-1)+30)*(N/15)/2;
    cout << A-B-C+D << endl;
}



Measured memory_bytes: 3672
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n << endl;
  } else {
    cout << n * 2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,k;
    cin >> n >> k;
    if(k > (n-1)*(n-2)/2) {
        cout << -1 << endl;
        return 0;
    }
    vp ans;
    rep(i,n-1) ans.eb(i+1,n);
    int l = 1,r = 2;
    while(k < (n-1)*(n-2)/2) {
        ans.eb(l,r);
        if(r < n-1) r++;
        else r = ++l + 1;
        k++;
    }
    cout << ans.size() << "\n";
    for(auto p : ans) cout << p.first << " " << p.second << "\n";
}


Measured memory_bytes: 384
S = [input() for _ in range(3)]
a = 0
b = 0
c = 0
turn = "a"
while True:
    if turn == "a":
        if len(S[0])-1 < a:
            print("A")
            break
        turn = S[0][a]
        a += 1
    elif turn == "b":
        if len(S[1])-1 < b:
            print("B")
            break
        turn = S[1][b]
        b += 1
    else:
        if len(S[2])-1 < c:
            print("C")
            break
        turn = S[2][c]
        c += 1


Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());


int main(){
    string s;
    cin>>s;
    int n=(int)s.size();
    if( (n%2==0 && s[0]==s[n-1]) || (n%2==1 && s[0]!=s[n-1]) ){
        cout<<"First"<<endl;
    }else cout<<"Second"<<endl;
}


Measured memory_bytes: 512
n = gets.to_s.to_i
a = gets.to_s.split

if a.include?('0')
  puts 0
  exit
end

a.map!{|e|e.to_i}
ans = 1
inf = 10 ** 18
a.each do |t|
  ans *= t
  if ans > inf
    puts "-1"
    exit
  end
end

puts ans

Measured memory_bytes: 20872
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		int X = int.Parse(str[1]);
		int M = int.Parse(str[2]);
		long[]D = new long[M];
		int[]T = new int[M];
		long[]A = new long[M];
		long ans = 0;
		for(var i=0;i<M;i++){
			T[i] = -1;
		}
		long a = X;
		D[X] = X;
		T[X] = 0;
		A[X] = X;
		ans += X;
		for(var i=1;i<M;i++){
			if(N==1){
				break;
			}
			a = a * a % M;
			ans += a;
			//Console.Error.WriteLine(a+" "+ans);
			if(i+1>=N){
				break;
			}
			if(T[a] == -1){
				D[a] = a;
				T[a] = i;
				A[a] = ans;
			} else {
              	Console.Error.WriteLine(a+" "+ans);
				long T1 = (N-i-1)/(i-T[a]);
              	Console.Error.WriteLine(i+" "+T1+" "+T[a]);
				ans += T1 * (ans - A[a]);
				long i2 = i + (N-i-1)/(i-T[a])*(i-T[a]);
             	Console.Error.WriteLine(i2+" "+(N-i-1)+" "+(i-T[a])+" "+T1);
				for(long j=i2+1;j<N;j++){
					a = a * a % M;
					ans += a;
				}
				break;
			}
			if(i+1>=N){
				break;
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 19036
#include<stdio.h>
int main (void)
{
    int n;
    scanf("%d",&n);
    int b=n%10;
    if (b==3)printf("bon");
    else if(b==0||b==1||b==6||b==8)printf("pon");
    else printf("hon");
    
return 0;
}

Measured memory_bytes: 1728
#解説解答
s = input()
n = len(s)
here = n
t = ''
while here > 0:
  try:
    if s[here-1:here] == 'm':
      t = 'dream' + t
      here -= 5
    elif s[here-1:here] == 'e':
      t = 'erase' + t
      here -= 5
    elif s[here-3:here] == 'mer':
      t = 'dreamer' + t
      here -= 7
    elif s[here-3:here] == 'ser':
      t = 'eraser' + t
      here -= 6
    else:
      break
  except:
    break
if s == t:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int K;
    cin >> K;
    
    int num = 0;
    for (int i=0; i<10000000; i++){
        num = num * 10 + 7;
        num %= K;
        
        if(num) continue;
        cout << i + 1 << endl;
        return 0;
    }
    
    cout << -1 << endl;
}


Measured memory_bytes: 3612
/*input
5 10
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=1e6+1;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a);
        if(res>1e10) return 1e11;
        a=(a*a);
        b>>=1;
    }
    return res;
}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>9 or b>9) cout<<-1;
    else cout<<a*b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  int N; cin >> N;
  int odd = 0;
  rep(i, N) {
    int A; cin >> A;
    if(A%2) ++odd;
  }
  printf("%s\n", odd%2?"NO":"YES");
}


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

cum = [[0]*(N) for i in range(N)]
for i in range(N):
  c = 0
  for j in range(i, N):
    c += A[j]
    cum[i][j] = c

dp = [[0]*N for i in range(N)]

for n in range(1, N+1):
  for i in range(N-n):
    j = i + n
    min_cost = 0
    for k in range(i, j):
      if min_cost == 0:
        min_cost = dp[i][k] + dp[k+1][j]
      else:
        min_cost = min(min_cost, dp[i][k]+dp[k+1][j])
    
    dp[i][j] = min_cost + cum[i][j]

print(dp[0][N-1])

Measured memory_bytes: 44908
#include<iostream>
using namespace std;
int main(){
	char a[4];
	for (int i = 0; i < 4; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 4; i++) {
		if (i == 0)continue;
		if (a[i - 1] == a[i]) {
			cout << "Bad";
			return 0;
		}

	}
	cout << "Good";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


using namespace std;

const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;


#define DEBUG

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

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


int a[10010][10010], b[1000];
int dp[10010][3];
 
int A[2*100000+100];

int main()
{
    ll N; cin >> N;
    rep(i,N){
        A[i] = 0;
    }
    for(ll i = 2; i <= N; i++){
        ll B;
        cin >> B;
        A[B] += 1;
    }

    for(int i = 1; i <= N; i++){
        cout << A[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4404