akhauriyash/Code-Regression huggingface dataset:
#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 <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    ll n; cin >> n;
    ll a[100010];
    rep(i,0,n) cin >> a[i];

    ll ans = a[0] - 1, k = 2;
    a[0] = 1;
    rep(i,1,n) {
        // cout << "ans: " << ans << ", k: " << k << endl;
        if(a[i] > k) {
            ll t = ceil(a[i] / (double) k) - 1;
            ans += t;
            a[i] -= k * t;
            // if(k == a[i]) --a[i];
        }
        else if(a[i] == k) k++;
    }

    // rep(i,0,n) printf("a[%d] = %lld\n", i, a[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a-b == b-c)
	{
    	cout << "YES" << endl;
    	return 0;
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
module Main where
import Control.Applicative ((<$>))

main = do
  (a:b:_) <- (map (\x -> read x :: Int)) <$> words <$> getLine
  putStrLn $ solve a b


solve :: Int -> Int -> String
solve a b
  | (a == b) = "a == b"
  | (a < b) =  "a < b"
  | (a > b) =  "a > b"

Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <cmath>

int countBit(int readVal){
    if(0 == readVal){
        return 0;
    }else{
        return readVal % 2 + countBit(readVal / 2);
    }
}

int main(){
    int n;
    std::cin >> n;

    std::vector<int> a(n);
    std::vector<std::vector<int>> x(n), y(n);
    for(int i = 0; i < n; ++i){
        std::cin >> a.at(i);
        for(int j = 0; j < a.at(i); ++j){
            int val1, val2;
            std::cin >> val1 >> val2;
            x.at(i).push_back(val1 - 1);
            y.at(i).push_back(val2);
        }
    }

    int ans = 0;
    for(int bits = 0; bits < (1 << n); ++bits){
        bool flg = true;
        for(int i = 0; i < n; ++i){
            if(((bits >> i) & 1)){
                int j = 0;
                while(flg && j < a.at(i)){
                    flg = !(((bits >> x.at(i).at(j)) & 1) ^ y.at(i).at(j++));
                }
            }
        }
        
        if(flg){
            ans = std::max(ans, countBit(bits));
        }
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int h,w;
  cin>>h>>w;
  char r[555][555],b[555][555];
  fill_n(*r,555*555,'.');
  fill_n(*b,555*555,'.');
  
  for(int i=0;i<h;i++){
    r[i][0]='#';
    b[i][w-1]='#';
    for(int j=1;j<w-1;j++){
	 if(i%2){
	   b[i][j]='#';
	 }else{
	   r[i][j]='#';
	 }
    }
  }

  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++){
	 char a;
	 cin>>a;
	 if(a=='#'){
	   if(i%2){
		r[i][j]='#';
	   }else{
		b[i][j]='#';
	   }
	 }
    }
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
	 cout<<r[i][j];
    }
    cout<<endl;
  }
  cout<<endl;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
	 cout<<b[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
int H[6000],P[6000],a[6000];
int n;
long long dp[6000];
int compare(int k1,int k2){
	return H[k1]+P[k1]<H[k2]+P[k2];
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&H[i],&P[i]);
	long long now=0;
	for (int i=1;i<=n;i++) a[i]=i;
	sort(a+1,a+n+1,compare);
	memset(dp,0x3f,sizeof dp); dp[0]=0;
	for (int i=1;i<=n;i++)
		for (int j=n;j>=0;j--)
			if (dp[j]<=H[a[i]]) dp[j+1]=min(dp[j+1],dp[j]+P[a[i]]);
	int ans=0;
	for (int i=1;i<=n;i++) if (dp[i]<1e18) ans=i;
	cout<<ans<<endl;
}

Measured memory_bytes: 384
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#pragma GCC optimize("Os")
#pragma GCC target("avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("Os")
*/
#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld; 

#define X first
#define Y second
#define MP make_pair

using namespace std;
    
const ll N = 2e5 + 123, D = 1e7 + 123;
const ll mod = 1e9 + 7;
const ll INF = 1e18 + 7;

int n;
ll C, st[N], h[N], K[N], B[N], f[N];
ll dp[N];

void CHT(){
	int pos = 1;
	int sz = 1;
	st[1] = 1;
	f[1] = -INF;
	K[1] = -2 * h[1], B[1] = h[1] * h[1] + C;
	for(int i = 2;i <= n;i++){
		pos = upper_bound(f + 1, f + sz + 1, h[i]) - f - 1;
		int j = st[pos];
		dp[i] = K[j] * h[i] + B[j] + h[i] * h[i];
		//cerr << i << " " << j << "\n";
		if(i < n){
			ll mK = -2 * h[i], mB = h[i] * h[i] + C + dp[i];
			while(sz){	
				int j = st[sz];
				ll nK = K[j], nB = B[j];
				ll x = (nB - mB) / (mK - nK);
				//cerr << nK << " " << mK << " " << nB << " " << mB << " " << i << "\n";
				if((nB - mB) % (mK - nK) != 0){
					if(x > 0){
						x += 1;
					}
					else{
						x += 1;
					}
				}
		//		if(i == 9){
		//			cerr << x << "\n";
		//		}
				if(x >= f[sz]){
					f[sz + 1] = x;
					break;
				}
				sz -= 1;
			}	
			sz += 1;
			st[sz] = i; 
			K[i] = mK, B[i] = mB;
		}
		//cerr << i << " " << j << " " << K[i] << " " << B[i] << " " << sz << " " << f[sz] << "\n";
		//cerr << dp[i] << "\n";
	}
}

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    
	cin >> n >> C;
	for(int i = 1;i <= n;i++){
		cin >> h[i];
	}    

	CHT();
    
    cout << dp[n];
	return 0;
}
     

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
#define LEN(x) ll(x.length()) //lengthをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

#include <iostream>
using namespace std;

long long modPow(long long x, long long a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    long long t = modPow(x, a / 2);
    return (t * t) % MOD;
}

long long modInv(long long x) {
    return modPow(x, MOD - 2);
}

long long modPerm(long long n, long long k) {
    long long ret = 1;
    for (long long i = 0; i < k; i++) {
        ret = (ret * (n - i)) % MOD;
    }
    return ret;
}

int main(){
    ll s;
    cin >> s;
    ll sep = s / 3, rem = s, ans = 0;
    REP(i, sep){
        ll temp = 1;
        rem -= 3;
        temp *= modPerm(i + rem, i + rem);
        temp %= MOD;
        temp *= modInv(modPerm(i, i));
        temp %= MOD;
        temp *= modInv(modPerm(rem, rem));
        temp %= MOD;
        ans += temp;
        ans %= MOD;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main() {
	int N, T, A[1000], B[1000];
	cin >> N >> T ;
	for (int i = 0; i < 1000;i++) {
		A[i] = 0;
		B[i] = 0;
	}
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
	}
	int ans =100000;
	for (int i = 0; i < N; i++) {
		if (B[i] <= T) {
			ans = min(ans, A[i]);
		}
	}
	if (ans == 100000) {
		cout << "TLE" << endl;
	}
	else {
		cout << ans << endl;
	}

}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ATakAndHotelsABCEdit solver = new ATakAndHotelsABCEdit();
        solver.solve(1, in, out);
        out.close();
    }

    static class ATakAndHotelsABCEdit {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            long x = in.nextInt();
            int y = in.nextInt();
            out.println(Math.min(k, n) * x + (Math.max(n - k, 0)) * y);
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 21460
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
  char mojiretsu[11];
  char hi[] = "hi";
  int i, j, flag=1, k;
  scanf("%s", mojiretsu);

  for(i=0; i < strlen(mojiretsu); i++){
    if(mojiretsu[i] == hi[0]){
      if(i == (strlen(mojiretsu)-strlen(hi)+1)){
        flag = 0;
      }else{
        for(j=i+1, k=1; j < strlen(mojiretsu); j++, k++){
          if(hi[k] == '\0')break;
          if(mojiretsu[j] != hi[k]){
            flag = 0;
            break;
          }else{
            i++;
          }
        }
      }

    }else{
      flag = 0;
      break;
    }
  }

  if(flag == 1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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() {
    cin.tie(nullptr) ;
    ios::sync_with_stdio(false) ;

    long double d, t, s;
    cin >> d >> t >> s;
    if(d/s <= t){
        cout << "Yes\n";
    }else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 3740
#!/usr/bin/env python3
N = int(input())
ab = [[0, 0] for _ in range(N)]
for i in range(N):
    ab[i] = list(map(int, input().split()))
ab.sort(key=lambda x:x[0])

ans = ab[0][0]
for i in range(N)[1::]:
    ans += min(ab[i][0] - ab[i-1][0], ab[i-1][1] - ab[i][1])
ans += ab[-1][1]

print(ans)


Measured memory_bytes: 29096
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] k = line.split(" ");
		Double[] v = new Double[k.length];
		for (int i = 0; i < v.length; i++) {
			v[i] = Double.parseDouble(k[i]);
		}
		Double a = Math.abs(v[2] - v[0]);
		Double b = Math.abs(v[3] - v[1]);
		Double val = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
		BigDecimal big = new BigDecimal(val);
		big.setScale(5, BigDecimal.ROUND_DOWN);
		System.out.println(big);
	}
}

Measured memory_bytes: 26484
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
 
N=II()
H=LI()

ans=0
tmp=0
current=H[0]

for i in range(1,N):
    if current >= H[i]:
        tmp+=1
    else:
        ans=max(ans,tmp)
        tmp=0
    current=H[i]

print(max(ans,tmp))

Measured memory_bytes: 16256
#include <iostream>

using namespace std;

int main() {
  // 初期化
  int n;
  cin >> n;
  int m[110][110];
  int p[110];
  for (int i = 1; i <= n; i++) {
    cin >> p[i-1] >> p[i];
  }
  for (int i = 1; i <= n; i++) {
    m[i][i] = 0;
  }
  for (int l = 2; l <= n; l++) {
    for (int i = 1; i <= n - l + 1; i++) {
      int j = i + l - 1;
      m[i][j] = (1<<21);
      for (int k = i; k <= j-1; k++) {
        m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
      }
    }
  }
  cout << m[1][n] << endl;
}



Measured memory_bytes: 3128
class MatrixExponentiation(var vec: LongArray, var matrix: Array<LongArray>, var k: Int) {

    private val mod: Long = 1_000_000_007

    public fun matrixPow(): Unit {
        k -= 1
        while (k > 0) {
            if (k % 2 == 1) {
                vec = matrixExp()
            }
            matrix = updateMatrix()
            k /= 2
        }
    }

    private fun matrixExp(): LongArray {
        val size = vec.size
        var ret = LongArray(size) // initialize
        for (i in 0 until size) {
            for (j in 0 until size) {
                ret[i] += (matrix[i][j] * vec[j]) % mod
            }
            ret[i] %= mod
        }
        return ret
    }

    private fun updateMatrix(): Array<LongArray> {
        val size = matrix.size
        var ret = Array(size) { LongArray(size) } // initialize
        for (i in 0 until size) {
            for (j in 0 until size) {
                for (k in 0 until size) {
                    ret[i][j] += (matrix[i][k] * matrix[k][j]) % mod
                }
                ret[i][j] %= mod
            }
        }
        return ret
    }

    private fun printMatrix(matrix: Array<LongArray>): Unit {
        print("[")
        for (i in matrix.indices) {
            if (i == 0) print("[") else print(" [")
            for (j in matrix.indices) {
                print(matrix[i][j])
                if (j != matrix.size - 1) print(", ")
            }
            if (i != matrix.size - 1) {
                println("],")
            } else {
                print("]")
            }
        }
        println("]")
    }
}

public fun readln() = readLine()!!
public fun readlnByte() = readln().toByte()
public fun readlnShort() = readln().toShort()
public fun readlnInt() = readln().toInt()

fun main() {
    val s = readlnInt()
    val vec = longArrayOf(0, 0, 1)
    val matrix = arrayOf( longArrayOf(1, 0, 1), longArrayOf(1, 0, 0), longArrayOf(0, 1, 0) )
    val me = MatrixExponentiation(vec, matrix, s)
    me.matrixPow()
    println(me.vec[1])
}

Measured memory_bytes: 34428
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(200020), B(200020), A1(200020, 0), B1(200020, 0);

    // 入力と累積和の計算
    rep(0, i, N)
    {
        cin >> A.at(i);
        A1.at(i + 1) = A1.at(i) + A.at(i);
    }

    rep(0, i, M)
    {
        cin >> B.at(i);
        B1.at(i + 1) = B1.at(i) + B.at(i);
    }

    ll ans = 0, itr = M;
    for (ll i = 0; i <= N; i++)
    {
        // Aの机で読む本の数を決め打ち
        ll t = K - A1.at(i);

        // 時間が足りない、かつA1は単調増加列なのでbreak
        if (t < 0)
        {
            break;
        }

        for (ll j = itr; j >= 0; j--)
        {
            // 時間が足りない、かつB1は単調増加列なのでbreak
            // tは単調減少なのでこれ以降のtでj以上を見るのは無駄
            if (t >= B1.at(j))
            {
                itr = j;
                ans = max(ans, i + j);
                break;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 9584
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;
ll const MOD = 1e9+7;
ll k;

ll calcMinus(vector<ll> plus, vector<ll> minus) {
  sort(plus.begin(), plus.end());
  sort(minus.begin(), minus.end(), greater<ll>());

  ll ans = 1;

  rep(i, k) {
    ans = ans * minus[i] % MOD;
    if (ans < 0) ans += MOD;
  }
  return ans;
}

ll calcPlus(vector<ll> plus, vector<ll> minus) {
  sort(plus.begin(), plus.end(), greater<ll>());
  sort(minus.begin(), minus.end());

  ll ans = 1;
  ll indexP = 0;
  ll indexM = 0;

  rep(i, k) {
    if (i == 0 && k > ll(minus.size()) && k % 2 == 1) {
      ans = ans * plus[indexP] % MOD;
      indexP++;
      continue;
    }

    if (k-i < 2 || ll(minus.size()) - indexM < 2) {
      ans = ans * plus[indexP] % MOD;
      indexP++;
      continue;
    }
/*
    if (ll(plus.size()) - indexP == 2 && k % 2 == 1) {
      ans = ans * plus[indexP] % MOD;
      indexP++;
      continue;
    }
    */

    if (ll(plus.size()) - indexP < 2) {
      ans = ans * minus[indexM] % MOD * minus[indexM + 1] % MOD;
      indexM += 2;
      i += 1;
      continue;
    }

    if (plus[indexP] * plus[indexP + 1] >= minus[indexM] * minus[indexM + 1]) {
      ans = ans * plus[indexP] % MOD * plus[indexP + 1] % MOD;
      indexP += 2;
      i += 1;
      continue;
    } else {
      ans = ans * minus[indexM] % MOD * minus[indexM + 1] % MOD;
      indexM += 2;
      i += 1;
      continue;
    }

  }
  return ans;
}

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

  vector<ll> plus, minus;

  rep(i, n) {
    ll a;
    cin >> a;
    if (a >= 0) plus.push_back(a);
    else minus.push_back(a);
  }

  ll ans = 1;

  if (k == n) {
    rep(i, ll(plus.size())) ans = ans * plus[i] % MOD;
    rep(i, ll(minus.size())) ans = ans * minus[i] % MOD;
    if (ans < 0) ans = ans + MOD;
  } else if (ll(plus.size() == 0) && k % 2 == 1) {
    ans = calcMinus(plus, minus);
  } else {
    ans = calcPlus(plus, minus);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6480
#include <bits/stdc++.h>
	using namespace std;
	#define mod 1000000007
	#define ll long long
	#define ld long double
	#define pii pair<int,int>
	#define fi first
	#define se second
	#define mex 1000005
	#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	//vector<int> adj[mex];
	//a+b=a^b+2*(a&b)

	// FIRST THINK, THEN CODE
	// DO NOT JUMP BETWEEN PROBLEMS
	#define int long long 

	int bpow(int a, int b, int c){
		int r=1;
		while(b){
			if(b&1)
			 r=(r*a)%c;
			a=(a*a)%c;
			b=b/2;
		}
		return r;
	} 
	signed main(){
		fast
		int n;
		cin>>n;
		if(n==2)
		 cout<<-1;
		else{
			 int i=0;
			 int cc=0;
			 
			 for(;i<=n;i++){
				 int yy=bpow(10,i,n);
				 yy=(yy*7)%n;
				 cc=(cc+yy)%n;
				 if(cc==0)
				  break;
			 }
			 if(cc==0)
			 cout<<i+1<<endl;
			 else
			  cout<<-1<<endl;
		 }
	}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int h = scanner.nextInt(), w = scanner.nextInt();
		char[][] input = new char[h][w];
		for (int i = 0; i < h; i++) {
			char[] c = scanner.next().toCharArray();
			for (int j = 0; j < c.length; j++) {
				input[i][j] = c[j];
			}
		}
		
		
		char[][] picture = new char[h+2][w+2];
		for (int i = 0; i < h+2; i++) {
			for (int j = 0; j < w+2; j++) {
				picture[i][j] = '#';
			}
		}
		
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				picture[i+1][j+1] = input[i][j];
			}
		}
		
		

		
		for (int i = 0; i < h+2; i++) {
			String string = new String(picture[i]);
			System.out.println(string);
		}
		
		scanner.close();
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main(void) {
  int N;
  int *A;
  scanf("%d", &N);
  A = (int*)malloc(sizeof(int) * N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }

  long long cnt = 0;
  int cur = 0;
  for (int i = N-1; i >= 0; i--) {
    if (cur-1 == A[i]) {
    } else if (cur <= A[i]) {
      cnt += A[i];
    } else {
      puts("-1");
      return 0;
    }
    cur = A[i];
  }
  if (cur > 0) puts("-1");
  else printf("%lld\n", cnt);

  return 0;
}

Measured memory_bytes: 896
A, B, C = gets.split.map(&:to_i)

i = 1
h = {}
flag = false
while 1
  y = A * i % B
  break if h.has_key?(y)
  h[y] = 1 
  if y == C
    flag = true 
    break 
  end
  i += 1
end
puts flag ? "YES" : "NO"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
//#include<iostream>
//#include<vector>
//#include<map>
//#include<math.h>
//#include<algorithm>

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define rrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    string s;
    cin >> s;

    if(s.back() == 's') {
        s += "es";
    } else {
        s += "s";
    }
    cout << s << endl;
    return 0;
} /*atcoder*/


Measured memory_bytes: 3596
import scala.io.Source

object Main extends App {
  Source.stdin.getLines.toList.map(_.split(" ")).takeWhile(_(1) != "?")
    .map { x => (x(0).toInt, x(1), x(2).toInt) }
    .map { x => if (x._2 == "+") x._1 + x._3
                else if (x._2 == "-") x._1 - x._3
                else if (x._2 == "*") x._1 * x._3
                else if (x._2 == "/") x._1 / x._3 }
    .map(println)
}

Measured memory_bytes: 44120
//(bool) ? (if true) : (if false)
//63LL - __builtin_clzll(n)
//(x&-x)
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define fst first
#define snd second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pf push_front
#define sz size()
#define FORN(i,j,n) for(long long i=j; i<(long long)n;i++) 
#define FOR(i,n) FORN(i,0,n)
#define FORIT(i,x) for( auto i = x.begin() ; i != x.end() ; i++ )
#define LIM 262150
#define ones(x) __builtin_popcount(x)
#define trace(x)    cerr << #x << ": " << x << endl;
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
using namespace std;
 
typedef long long ll ;
typedef unsigned long long ull ;
typedef vector <int> vi;
typedef vector <long long> vll;
typedef pair <int,int> ii;
typedef vector <string> vs;
typedef vector <ii> vii;
const ll MAX = 1e5+5;
string s,t;
int ans = 1e5;
int main() {
	fastio;
	cin >> s >> t;
	FOR(i,s.sz-t.sz+1){
		int a = 0;
		FORN(j,i,i+t.sz){
			if(s[j] != t[j-i]) a++;
		}
		ans = min (ans,a);
	}
	cout<< ans << '\n';
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        S[i] = s;
    }
    sort(S.begin(), S.end());

    long long res = 0, cnt = 0;
    string pre;
    for (int i = 0; i < N; i++) {
        if (S[i] == pre) {
            cnt++;
        } else {
            res += cnt * (cnt - 1) / 2;
            cnt = 1;
        }
        pre = S[i];
    }
    res += cnt * (cnt - 1) / 2;

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

tuple<vector<int>, vector<vector<int>>> input(const int D)
{
  vector<int> c(26);
  for (int i = 0; i < 26; ++i)
    cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  for (int i = 0; i < D; ++i)
  {
    for (int j = 0; j < 26; ++j)
      cin >> s[i][j];
  }
  return forward_as_tuple(c, s);
}

int calculate(const int d, const int t, const vector<int> &c, const vector<vector<int>> &s, vector<int> &last)
{
  int sum = s[d - 1][t];
  int tmp = last[t];
  last[t] = d;
  for (int j = 0; j < 26; ++j)
  {
    sum -= c[j] * (d - last[j]);
  }
  last[t] = tmp;
  return sum;
}

int main()
{
  // input
  int D;
  cin >> D;
  auto tmp = input(D);
  auto c = get<0>(tmp);
  auto s = get<1>(tmp);

  int sum = 0;
  vector<int> last(26, 0), t;
  for (int d = 1; d <= D; ++d)
  {
    int val = 0, itr = 0, pre = -1;
    for (int j = 0; j < 26; ++j)
    {
      int tmp = calculate(d, j, c, s, last);
      if (val < tmp)
      {
        if (pre >= 0)
        {
          last[itr] = pre;
        }
        itr = j;
        pre = last[itr];
        last[itr] = d;
        val = tmp;
      }
    }
    t.push_back(itr + 1);
    sum += val;
  }

  for (int i = 0; i < D; ++i)
    cout << t[i] << endl;

  // cerr << sum << endl;

  return 0;
}

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

int main() {
    int n;cin>>n;
    string s;cin>>s;
    if(n%2!=0){
        cout<<"No"<<endl;
        return 0;
        }
    else{
        rep(i,n/2){
            if(s[i] != s[i+n/2]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}

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

/*
各要素は親の値を持っておけばいい

*/


int main(void){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a<c){
        a = c;
    }
    if(d<b){
        b=d;
    }
    if(b-a>0){
    printf("%d\n",b-a);
    }
    else{
        printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x[] = new int[n];
		int tmp[] = new int[n];
		for (int i = 0; i < n; ++i) {
			x[i] = sc.nextInt();
			tmp[i] = x[i];
		}
		sc.close();
		Arrays.sort(tmp);
		int s = n / 2;
		int ans = 0;
		for (int i = 0; i < n; ++i) {
			if (tmp[s - 1] < x[i])
				ans = tmp[s - 1];
			else
				ans = tmp[s];
			System.out.println(ans);
		}
	}

}


Measured memory_bytes: 88684
#include <bits/stdc++.h>
using namespace std ;
char ch[100];
int n,temp,x,y,z;
int main(){
	temp=0;
	cin>>n;
	
	for(int i=0;i<n;i++){
		cin>>ch[i];
	}
	
	for(int i=2;i<n;i++){
		if(ch[i]=='C' and ch[i-1]=='B' and ch[i-2]=='A'){
			
			temp++;
		}
	}
	cout<<temp<<endl;
}

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

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
//#define end endl
//#define endl() end()
#define f first
#define s second
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> ii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

#define MAX (1<<20)

ll v[MAX];
ll foi[MAX];
ll qdo[MAX];
ll qv[MAX];

int main(){ _
	char end = '\n';
	ll n, k;

	cin >> n >> k;

	for (int i=0; i<n; i++)
		cin >> v[i];

	for (int i=0; i<n; i++)
	{
		qdo[i] = -1;
	}

	ll at = 0;
	ll tempo = -1;
	for (int i=0; i<=n; i++)
	{
		//cout << "at=" << at+1 << endl;
		if (qdo[at] !=-1)
		{
			tempo = i;
			break;
		}
		qdo[at] = i;
		qv[i] = at;
		at = v[at]-1;
	}
	assert(tempo!=-1);

	ll per = tempo - qdo[at];
	//cout << "per=" << per << endl;

	if (k < tempo)
	{
		cout << qv[k]+1 << endl;
	}
	else
		cout << qv[(k-qdo[at])%per+qdo[at]]+1 << endl;


	exit(0);
}


Measured memory_bytes: 8252
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<int[][]> list = new ArrayList<int[][]>();
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int[][] xy = new int[a][2];
			for (int j = 0; j < a; j++) {
				xy[j][0] = sc.nextInt();
				xy[j][1] = sc.nextInt();
			}
			list.add(xy);
		}
		sc.close();

		int max = 0;
		for (int i = 0; i < (int) Math.pow(2, n); i++) {
			boolean[] p = new boolean[n];
			for (int j = 0; j < n; j++) {
				p[j] = (i % (int) Math.pow(2, j + 1)) / (int) Math.pow(2, j) > 0;
			}
			if (check(p, list)) {
				max = (int) Math.max(max, IntStream.range(0, n).filter(j -> p[j]).count());
			}
		}

		System.out.println(max);
	}

	public static boolean check(boolean[] p, List<int[][]> list) {
		for (int i = 0; i < p.length; i++) {
			if (!p[i]) {
				continue;
			}
			for (int j = 0; j < list.get(i).length; j++) {
				int x = list.get(i)[j][0];
				int y = list.get(i)[j][1];
				if (p[x - 1] != (y == 1)) {
					return false;
				}
			}
		}

		return true;
	}
}


Measured memory_bytes: 35844
// https://atcoder.jp/contests/abc173/tasks/abc173_f

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 1
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 2*1e5;

ll N;
vector<int> u;
vector<int> v;

int main() {
  cin >> N;
  u = vector<int>(N-1);
  v = vector<int>(N-1);
  REP(i, N-1) cin >> u[i] >> v[i];

  ll ans = (N * N * N + N * N * 3 + N * 2) / 6;
  REP(i, N - 1) {
    ll a = min(u[i], v[i]);
    ll b = max(u[i], v[i]);
    ans -= a * (N - b + 1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4764
#include<stdio.h>
int main()
{
    int n,d,c,x;
    scanf("%d %d",&n,&d);
    c=(d*2)+1;
    x=n/c;
    if(n%c==0){
        printf("%d\n",x);
    }
    else{
    printf("%d\n",x+1);
    }
    return 0;
}



Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main()
{
	long long int a, b, x, save_a, save_b;
	cin >> a >> b >> x;
	save_a = a / x;
	if( a % x != 0 )
		save_a++;
	save_b = b / x;
	if( save_a > save_b )
		cout << 0;
	else
		cout << save_b - save_a + 1;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.buffer.readline

n = int(input())
H = list(map(int, input().split()))
A = list(map(int, input().split()))
P = []
for i in range(n):
    P.append((H[i], A[i], i))
P.sort()


class SegmentTree:
    ele = 0

    func = max

    # SEG木は1-index
    # Aに関しては0-index

    def __init__(self, n):  # Aは0-idx
        self.n = n
        self.num = 2 ** ((self.n - 1).bit_length())
        self.SEG = [self.ele] * (2 * self.num)

    def search(self, idx):
        return self.SEG[idx + self.num]

    def initialize(self, A):
        for i in range(self.n):
            self.SEG[i + self.num] = A[i]
        for i in range(self.num - 1, 0, -1):
            self.SEG[i] = self.func(self.SEG[2 * i], self.SEG[2 * i + 1])

    def update(self, idx, val):
        idx += self.num
        self.SEG[idx] = val
        idx //= 2
        while idx:
            self.SEG[idx] = self.func(self.SEG[2 * idx], self.SEG[2 * idx + 1])
            idx //= 2

    # def delay(self,):

    def query(self, left, right):
        # maspy式。開区間のママ処理する
        # left, rightで値を分けているのは交換法則不成立のときのため
        # 開区間→Rが奇数→右端が偶数→1ずらしてから計算
        # 　下から上への遷移は2で割る
        # juppy氏は閉区間に直していた
        resleft = self.ele
        resright = self.ele
        left += self.num
        right += self.num
        while right - left > 0:
            if left % 2 == 1:
                resleft = self.func(resleft, self.SEG[left])
                left += 1
            if right % 2 == 1:
                right -= 1
                resright = self.func(resright, self.SEG[right])
            left //= 2
            right //= 2
        return self.func(resleft, resright)


ST = SegmentTree(n)
ans = 0
for h, a, i in P:
    h -= 1
    temp = ST.query(0, i) + a
    ST.update(i, temp)
    ans = max(temp, ans)
print(ans)


Measured memory_bytes: 101304
import sys
from itertools import combinations_with_replacement

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


def main():
    N, M, Q = map(int, input().split())
    abcd = []
    for _ in range(Q):
        a, b, c, d = map(int, input().split())
        a -= 1
        b -= 1
        abcd.append((a, b, c, d))

    combs = combinations_with_replacement(range(1, M + 1), N)
    ans = 0
    for A in combs:
        tmp = 0
        for a, b, c, d in abcd:
            if A[b] - A[a] == c:
                tmp += d

        if tmp > ans:
            ans = tmp

    print(ans)


if __name__ == "__main__":
    main()


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };


vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

void solve() {
  ll N; cin >> N;
  auto lv = divisor(N);
  
  ll res=INF;
  rep(i, lv.size()){
    res = min(res, lv[i]+N/lv[i]-2);
  }
  
  cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include <iostream>
#include<stdlib.h>
//#include <algorithm>
#include <limits>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
int main(void){
	ll a,b;
  cin >> a >> b;
  ll lmax = llMAX*(-1);
  lmax = max(a+b,lmax);
  lmax=max(a-b,lmax);
  lmax=max(a*b,lmax);
  cout << lmax;
	return 0;
}

Measured memory_bytes: 256
mod = 998244353
n = int(input())
s = input()
counter = {"R": 0, "G": 0, "B": 0}
ans = 1
for i in range(3 * n):
    x, y, z = sorted(counter.values())
    counter[s[i]] += 1
    if z < counter[s[i]] and y < counter[s[i]]:
        pass
    elif z < counter[s[i]] or y < counter[s[i]]:
        ans *= z - y
    else:
        ans *= y - x
    ans %= mod
for i in range(n):
    ans *= i + 1
    ans %= mod
print(ans)

Measured memory_bytes: 9688
#include<iostream>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n; i++)
#define MAX 1001

void solve(int c, int a, int n){
  int maxp = 0;

  for ( int i = 0; i < MAX; i++ ){
    for ( int j = 0; j < MAX; j++ ){
      if ( (i+2*j <= c && i+j <= a && i <= n) ){
	maxp = max(maxp, i+j+ (c - (i+2*j))/3);
      }
    }
  }

  cout << maxp << endl;
}

main(){
  int c, a, n, q;
  cin >> q;
  for ( int i = 0; i < q; i++ ){
    cin >> c >> a >> n;
    solve(c, a, n);
  }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define ll long long

ll solve(ll k)
{
  if (k % 4 == 0) return k;
  if (k % 4 == 1) return 1;
  if (k % 4 == 2) {
    if (k % 2) return k - 1;
    else return k + 1;
  }
  else return 0;
}

int main(void)
{
  ll a, b;
  cin >> a >> b;
  cout << (solve(a - 1) ^ solve(b)) << endl;
  return 0;
}



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

int main() {
  int N,K;
  cin >> N >> K;
 
  
  int d;
  vector<vector<int>> data(K, vector<int>(d));
  vector<int>A(N,0);

  for (int i = 0; i < K; i++) {
    cin >> d;
      for (int j = 0; j < d; j++) {
        cin >> data.at(i).at(j);
          for (int k = 1; k < N+1; k++) {
            if (data.at(i).at(j) == k){
              A.at(k-1)++;
            }
          }     
      }
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (A.at(i) == 0){
      count++;
    }
  }
  cout << count << endl;
}
  
 
    
  
  

Measured memory_bytes: 16100
b = int(input())
n = []
ans = -2**100

for i in range(b):
    a = int(input())
    n.append(a)
minn = n[0]

for i in range(1,b):
    ans = max(ans, n[i]-minn)  
    minn = min(minn, n[i])     
print(ans)



Measured memory_bytes: 13588
n=int(input())
p=list(map(int, input().split()))
ans=list(range(1,n+1))

ans_mix=[]
is_possible = False

if p==ans:
    is_possible = True

for i in range(0, n-1):
    for j in range(1, n):
        a=ans.copy()
        tmp=a[i]
        a[i]=a[j]
        a[j]=tmp
        if a==p:
            is_possible = True

if is_possible:
    print('YES')
else:
    print('NO')



Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
int main(void){

    int n;
    cin >> n;
    
    vector<int> v(n);
    vector<int> c(n);
    
    for(int i=0; i<n; i++) cin >> v[i];
    for(int i=0; i<n; i++) cin >> c[i];
    
    int result = 0;
    for(int i=0; i<n; i++) {
        if(v[i] - c[i] >= 0) result += v[i] - c[i];
    }
    
    cout << result << endl;

    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;


//複数のソート
void sort2vectors(vector<int> &av, vector<int> &bv)
{
        int n = av.size();
        vector<int> p(n), av2(n), bv2(n);
        iota(p.begin(), p.end(), 0);
        sort(p.begin(), p.end(), [&](int a, int b) { return av[a] < av[b]; });
        for (int i = 0; i < n; i++) {
                av2[i] = av[p[i]];
                bv2[i] = bv[p[i]];
        }
        av = av2;
        bv = bv2;
}


int gcd(int a, int b)
{
    int c;
    if (a < b) {
        a+=b; b=a-b; a-=b;
    }
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int isPrime(int x){
  int i;
  if(x < 2) return 0;
  else if(x == 2) return 1;
  if( x%2 == 0) return 0;
  for(i = 3; i*i <= 2; i += 2){
    if(x%i == 0) return 0;
  }
  return 1;
}


const int pmax = 10000000;
bool isPrime_table[pmax];
//constがないと配列宣言できない

void eratos(void){
  int i, j;
  double sqrtmax=sqrt(pmax);

  REP(k, pmax) isPrime_table[k] = true; /* Initialization */

  /* Sieve process  */
  isPrime_table[0] = false;
  isPrime_table[1] = false;
          /* 0 and 1 are not prime. */
  for (i=2; i <= sqrtmax; i++){
    if (isPrime_table[i]==true){   /* i is prime. */
      for (j=i; i*j<pmax; j++){
        isPrime_table[i*j] = false; /* multiples of i are not prime. */
      }
    }
  }
}

//漸化式敵に記述も可能
//abs(dx[i]+dy[j])==1で四方
int dx[3]={-1, 0, 1};
int dy[3]={-1, 0, 1};
int W0, H0;
int  masu0[100][100]={0};
int cnt0;

int dfs(int a, int b){
  masu0[a][b] = 2;
  REP(i, 3)REP(j, 3){
    a = a+dx[i];
    b = b+dy[j];
    if(masu0[a][b]== 1 && a >= 0 && a < W0 && b >= 0 && b < H0){
    dfs(a, b);
  }
  }
  return 1;
}

//文字列取り出し　str.substr(i, 5)
//文字数字変換 stoi, stod とto_string
//初期化memset
//複数配列のソート
//dp
const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
const long long int MOD = 1000000007;

int main(void){

  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  cout << N*(N+1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256