akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringJoiner;

public class Main {
	private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public static void main(String[] args) throws Exception {
		int n = Integer.parseInt(br.readLine());
		int[] array = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		
		boolean flag = false;
		int counter = 0;
		do{
			flag = false;
			for(int i = n - 1; 1 <= i; i--){
				if(array[i] < array[i-1]){
					int v = array[i-1];
					array[i-1] = array[i];
					array[i] = v;
					flag = true;
					counter++;
				}
			}
		}while(flag);
		
		StringJoiner sj = new StringJoiner(" ");
		Arrays.stream(array).forEach(i -> sj.add(String.valueOf(i)));
		System.out.println(sj);
		System.out.println(counter);
	}
}



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

int main() {
  int A;
  int B;
  int C;
  cin >> A;
  cin >> B;
  cin >> C;
  int seged=0;
  if(A>B && A>C){
    seged+=A*10;
   seged+=B+C;
    
  }else if(B>C){
    seged+=B*10;
    seged+=A+C;
  }else{
    seged+=C*10;
    seged+=A+B;
  }
  cout << seged;
  	return 0;
    
}


Measured memory_bytes: 3600
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

struct data{
  int a;
  long long total;
};

int main(){
  int i,j,n,c,a,yen,ko,f,f2;
  data d[4000];
  while(1){
    cin >> n;
    if(n == 0) break;
    c = 0;
    for(i=0;i<n;i++){
      cin >> a >> yen >> ko;
      f = 1;
      for(j=0;j<c;j++){
	if(a == d[j].a){
	  d[j].total += (long long) yen * ko;
	  f = 0;
	  break;
	}
      }
      if(f){
	d[c].a = a;
	d[c].total = (long long)yen * ko;
	c++;
      }
    }

    f2 = 1;
    for(i=0;i<c;i++){
      if(d[i].total >= 1000000){
	cout << d[i].a << endl;
	f2 = 0;
      }
    }
    if(f2) cout << "NA" << endl;

  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  bool findc=false, findf=false;
  for(int i=0;i<S.size();++i) {
    if(findc) {
      if(S[i]=='F') findf = true;
    }
    else {
      if(S[i]=='C') findc = true;
    }
  }
  if(findf) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}



Measured memory_bytes: 3608
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())

ans = [0] * (N + 1)

def f(n):
    l = round(math.sqrt(n)) + 1
    for x in range(1, l):
        for y in range(1, l):
            for z in range(1, l):
                val = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if val <= N:
                    ans[val] += 1
f(N)

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

Measured memory_bytes: 9764
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  int a[3][3];
  rep(i, 3) rep(j, 3) cin >> a[i][j];
  bool used[3][3] = {};
  int n;
  cin >> n;
  rep(qi, n)
  {
    int b;
    cin >> b;
    rep(i, 3) rep(j, 3)
    {
      if (a[i][j] == b)
        used[i][j] = true;
    }
  }

  rep(i, 3)
  {
    bool bingo = true;
    rep(j, 3)
    {
      if (!used[i][j])
        bingo = false;
    }
    if (bingo)
    {
      Yes(true);
      return 0;
    }
  }

  rep(j, 3)
  {
    bool bingo = true;
    rep(i, 3)
    {
      if (!used[i][j])
        bingo = false;
    }
    if (bingo)
    {
      Yes(true);
      return 0;
    }
  }

  if ((used[0][0] && used[1][1] && used[2][2]) || (used[2][0] && used[1][1] && used[0][2]))
  {
    Yes(true);
    return 0;
  }

  Yes(false);

  return 0;
}


Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g;
    cin>>a>>b>>c;
    sum=a+b+c;
    maxi=max(max(a,b),c);
    cout<<sum-maxi<<endl;
    return 0;
}


Measured memory_bytes: 3580
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func vi(n int, args ...int) []int {
	res := make([]int, n)
	if len(args) == 0 {
		return res
	}
	v := args[0]
	if v == 0 {
		return res
	}
	for i := 0; i < n; i++ {
		res[i] = v
	}
	return res
}

func vvi(n int, args ...int) [][]int {
	res := make([][]int, n)
	m := n
	if len(args) > 0 {
		m = args[0]
	}
	v := 0
	if len(args) > 1 {
		v = args[1]
	}
	for i := 0; i < n; i++ {
		res[i] = vi(m, v)
	}
	return res
}

func main() {
	defer stdout.Flush()

	// readString() string
	// readInt() int
	// readIntSlice(n int) []int
	// readLengthAndSlice() []int

	a := readInt()
	b := readInt()
	c := readInt()
	x := readInt()
	y := readInt()

	ans := a*x + b*y
	max := x
	if y > max {
		max = y
	}
	for i := 1; i <= max; i++ {
		an := x - i
		if an < 0 {
			an = 0
		}
		bn := y - i
		if bn < 0 {
			bn = 0
		}
		cn := i * 2

		tmp := a*an + b*bn + c*cn
		if tmp < ans {
			ans = tmp
		}
	}
	println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1e9 + 7;

const int N = 3000;
ld dp[N][N];

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

	int n;
	cin >> n;

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		double p;
		cin >> p;
		for (int j = 0; j < i; ++j) {
			dp[i][j] += (1 - p) * dp[i-1][j];
			dp[i][j+1] += p * dp[i-1][j];
		}
	}
	ld res = 0;
	for (int j = (n+1) / 2; j <= n; ++j) {
		res += dp[n][j];
	}
	cout << fixed << setprecision(20) << res << '\n';
}


Measured memory_bytes: 139008
import sys
input = sys.stdin.buffer.readline

N, Q = map(int, input().split())
C = list(map(lambda x: int(x) - 1, input().split()))

query = []

for i in range(Q):
    l, r, = map(int, input().split())
    query.append((l - 1, r, i))

query.sort(key = lambda x: x[1])

rt = 0
L = [None for _ in range(N)]
res = [0 for _ in range(Q)]
bit = [0 for _ in range(N + 1)]

for l, r, id in query:
    while rt < r:
        if L[C[rt]] is not None:
            idx = L[C[rt]] + 1
            while idx <= N:
                bit[idx] -= 1
                idx += idx & -idx
        L[C[rt]] = rt
        idx = rt + 1
        while idx <= N:
            bit[idx] += 1
            idx += idx & -idx
        rt += 1
    sr = 0
    sl = 0
    idx = r
    while idx:
        sr += bit[idx]
        idx -= idx & -idx
    idx = l
    while idx:
        sl += bit[idx]
        idx -= idx & -idx
    res[id] = sr - sl

print('\n'.join(map(str, res)))

Measured memory_bytes: 232972
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto n = readln.chomp.to!int;
  auto a = readln.chomp.split.to!(long[]);

  auto lsum = a[0];
  auto rsum = a.sum - lsum;
  auto res = abs(lsum - rsum).to!long;
  foreach (i; 1..n-1) {
    lsum += a[i];
    rsum -= a[i];
    auto d = abs(lsum - rsum).to!long;
    if (d < res) {
      res = d;
    }
  }
  res.writeln;
}


Measured memory_bytes: 11524
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int N, A, B;
string S;
int inner, outer;
int main() {
    cin >> N >> A >> B;
    cin >> S;
    rep(i, S.size()) {
        if (S[i] == 'a') {
            if (inner + outer < A + B) {
                cout << "Yes" << endl;
                inner++;
            } else {
                cout << "No" << endl;
            }
        } else if (S[i] == 'b') {
            if (inner + outer < A + B && outer + 1 <= B) {
                cout << "Yes" << endl;
                outer++;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}


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

using namespace std;

int main() {
  long long n, m;
  cin >> n >> m;
  if (n > m) {
    swap(n, m);
  }
  long long ans = 0;
  if (n == 1) {
    if (m == 1) {
      ans = 1;
    }
    else {
      ans = m - 2;
    }
  }
  else {
    ans = (n - 2) * (m - 2);
  }
  cout << ans << '\n';
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] t = new int[N+1];
		int[] x = new int[N+1];
		int[] y = new int[N+1];
		t[0] = 0;
		x[0] = 0;
		y[0] = 0;
		
		
		for(int i = 1 ; i < N+1 ; i++){
			t[i] = scan.nextInt();
			x[i] = scan.nextInt();
			y[i] = scan.nextInt();
		}	
		
		int distance = 0;
		
		for(int i = 0 ; i < N ; i++){ 
			distance = Math.abs(x[i]-x[i+1]) + Math.abs(y[i]-y[i+1]);
			if (distance > t[i+1] -t[i]){
				System.out.println("No");
				return;
			}
			if ( (distance-(t[i+1]-t[i]))%2 != 0){
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
		
		
	}
}

Measured memory_bytes: 90300
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
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; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(20)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    long N, A, B;
    cin >> N >> A >> B;
    if(A + B - 1 > N || A * B < N){
        cout << -1 << endl;
        return 0;
    }
    long block_counts[A];
    for(int i = 0; i < A; i++){
        block_counts[i] = 1;
    }
    N -= A;
    for(int i = 0; N > 0; i++){
        block_counts[i] += min(B - 1, N);
        N -= B - 1;
    }
    long now = 1;
    vector<long> ans;
    for(int i = 0; i < A; i++){
        for(long j = block_counts[i] - 1; j >= 0; j--){
            ans.push_back(j + now);
        }
        now += block_counts[i];
    }
    array_output(all(ans));
}


Measured memory_bytes: 11116
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

def main():
  n, x, y = map(int, input().split())
  m = [0]*n
  for i in range(1,n):
    for j in range(i+1, n+1):
      d = min(j-i, abs(x-i)+abs(y-j)+1, abs(x-j)+abs(y-i)+1)
      m[d] +=1
  for i in range(1,n):
    print(m[i])

if __name__ == '__main__':
  main()

Measured memory_bytes: 5504
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[100005];

llint gcd(llint a, llint b)
{
	if(b == 0) return a;
	return gcd(b, a%b);
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	llint ans = 0;
	for(int i = 1; i <= n; i++) ans = gcd(ans, a[i]);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
from itertools import combinations
N, X, Y = map(int, input().split())

result = [0]*N
for i, j in combinations(range(1, N+1), 2):
    mins = min([j-i, abs(Y-j)+abs(X-i)+1])
    result[mins] += 1
    
for i in range(1, N):
    print(result[i])

Measured memory_bytes: 3444
n, m = map(int, input().split())
p = list(map(lambda x: int(x) - 1, input().split()))
xy = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]

parents = [i for i in range(n)]
ranks = [0 for _ in range(n)]


def root(x):
    return x if x == parents[x] else root(parents[x])


def is_same(x, y):
    return root(x) == root(y)


def unite(x, y):
    x, y = root(x), root(y)
    if x == y:
        return
    if ranks[x] < ranks[y]:
        parents[x] = y
        if ranks[x] == ranks[y]:
            ranks[y] += 1
    else:
        parents[y] = x
        if ranks[x] == ranks[y]:
            ranks[x] += 1


for x_, y_ in xy:
    unite(x_, y_)

cnt = sum((1 if is_same(i, p_) else 0) for i, p_ in enumerate(p))
print(cnt)


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

ll m = 1e9+7;

int main() {
	string s; cin>>s;
	vector<ll> ABC(s.size()+1), AB(s.size()+1), A(s.size()+1);
	ll qmarks=1;

	for (ll i=0; i<s.size(); i++) {
		A[i+1] = A[i];
		AB[i+1] = AB[i];
		ABC[i+1] = ABC[i];
		if (s[i]=='A')
			A[i+1] = (A[i]%m + qmarks%m)%m;
		if (s[i]=='B')
			AB[i+1] = (AB[i]%m + A[i]%m)%m;
		if (s[i]=='C')
			ABC[i+1] = (ABC[i]%m + AB[i]%m)%m;
		if (s[i]=='?') {
			A[i+1] = ((A[i]*3)%m + qmarks%m)%m;
			AB[i+1] = ((AB[i]*3)%m + A[i]%m)%m; 
			ABC[i+1] = ((ABC[i]*3)%m + AB[i]%m)%m;
			qmarks = (qmarks*3)%m;
		}
	}
	
	cout << ABC.back() << endl;

	return 0;
}


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

int main(){
    char v1[100],v2[100],v3[100];
    scanf("%s %s %s",v1,v2,v3);
    int val1,val2,val3;
    val1=strlen(v1)-1;
    val2=strlen(v2)-1;
    
    if(v1[val1]==v2[0] && v2[val2]==v3[0])
        printf("YES\n");
    else
        printf("NO\n");


    return 0;
}


Measured memory_bytes: 128
l = input().split()
N = int(l[0])
A = int(l[1])
B = int(l[2])
C = int(l[3])
D = int(l[4])
l = input().split()
S = l[0]

# print(N, A, B, C, D, S)

def blocked(path):
    return '##' in path

def find_path(A, B, C, D, S):
    s_path = S[A:C]
    f_path = S[B:D]
    if blocked(s_path) or blocked(f_path):
        return False
    return True

def solve(A, B, C, D, S):
    if not find_path(A, B, C, D, S):
        return False
    begin = B - 2
    if S[D - 2] == '#':
        if '...' in S[begin:D - 2]:
            return True
        else:
            return False
    else:
        path = S[begin:C]
        if '...' in path:
            return True
    return False

ret = True
if C < D:
    ret = find_path(A, B, C, D, S)
else:
    ret = solve(A, B, C, D, S)

if ret:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 41328
from operator import itemgetter

n = int(input())
SPs = [list(input().split()) for i in range(n)]
for i in range(n):
    SPs[i][1] = int(SPs[i][1])
    SPs[i].append(i)

SPs.sort(key=itemgetter(1), reverse=True)
SPs.sort(key=itemgetter(0))

for i in range(n):
    print(SPs[i][2] + 1)


Measured memory_bytes: 3060
#include <stdio.h>          // printf(), getc()
#include <ctype.h>          // isdigit()

#define MAX_N 100000
#define swap(x, y) { card_t t = x; x = y; y = t; }

typedef struct card_tbl
{
	char mark;
	int val;
	int seq;
} card_t;

card_t l[MAX_N / 2 + 2], r[MAX_N / 2 + 2];

int
partition(card_t a[], int p, int r)
{
	int j;

	int x = a[r].val;
	int i = p - 1;
	for (j = p; j < r; ++j)
	{
		if (a[j].val <= x)
		{
			i++;
			swap(a[i], a[j]);
		}
	}

	swap(a[i + 1], a[r]);
	return i + 1;
}

void
quicksort(card_t a[], int p, int r)
{
	if (p < r)
	{
		int q = partition(a, p, r);
		quicksort(a, p, q - 1);
		quicksort(a, q + 1, r);
	}
}

int
main(int argc, char** argv)
{
	card_t a[MAX_N];
	int n, m;
	int i;
	int c;

	c = getc(stdin);
	n = 0;
	while (isdigit(c))
	{
		n = n * 10 + c - '0';
		c = getc(stdin);
	}

	for (i = 0; i < n; ++i)
	{
		while (c == ' ' || c == '\n')
			c = getc(stdin);

		a[i].mark = c;
		c = getc(stdin);
		while (c == ' ')
			c = getc(stdin);

		m = 0;
		while (isdigit(c))
		{
			m = m * 10 + c - '0';
			c = getc(stdin);
		}

		a[i].val = m;
		a[i].seq = i;
	}

	quicksort(a, 0, n - 1);

	for (i = 0; i < n - 1; ++i)
	{
		if (a[i].val == a[i + 1].val && a[i].seq > a[i + 1].seq)
			break;
	}

	if (i >= n - 1)
		printf("Stable\n");
	else
		printf("Not stable\n");

	for (i = 0; i < n; ++i)
		printf("%c %d\n", a[i].mark, a[i].val);

	return 0;
}

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

int main(){
  int N;
  cin >> N;

  int i, l;
  int L[N];
  while(cin >> l)
  {
    L[i] = l;
    i++;
  }
  
  int ans = 0;
  for(int l = 0; l < N; l++)
  {
    for(int m = 0; m < N; m++)
    {
      for(int n = 0; n < N; n++)
      {
        if(l >= m || m >= n)
        {
          continue;
        }
        int a = L[l];
        int b = L[m];
        int c = L[n];
        if(a!=b && b!=c && c!=a && a+b>c && b+c>a && c+a>b)
        {
          ans++;
        }
      }
    }
  }
  
  cout << ans << endl;
}

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

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(n);
  for (auto &e : a) {
    cin >> e;
  }
  set<int> s;
  for (auto e : a) {
    s.insert(e);
  }

  int m = *rbegin(s) - *begin(s);
  for (auto x : s) {
    vector<vector<int>> v(1);
    for (auto e : a) {
      if (e < x) {
        if (v.back().size()) {
          v.push_back(vector<int>());
        }
      } else {
        v.back().push_back(e);
      }
    }
    vector<int> r;
    for (auto &e : v) {
      sort(begin(e), end(e));
      for (int i = 0; i < (int)e.size() - (k - 1); i++) {
        r.push_back(e[i]);
      }
    }
    if (r.size() >= q) {
      sort(begin(r), end(r));
      m = min(m, r[q - 1] - r[0]);
    }
  }
  cout << m << endl;
  return 0;
}


Measured memory_bytes: 384
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;

ll ans, aa, b, c, d, n, a[N], par[N];
int main(){
	IOS;
	cin >> n;
	ans = INF;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++){
		par[i] = par[i - 1] + a[i];
	}
	for (int i = 2; i <= n - 2; i++){
		ll l = 1, r = i;
		aa = a[1], b = par[i] - a[1];
		//cout << i << '\n';
  		while (r - l > 1){
			ll mid = (l + r) / 2;
			//cout << mid << ' ';
			if (abs(par[mid] - par[i] + par[mid]) < abs(aa - b)){
				aa = par[mid], b = par[i] - par[mid]; 
				//cout << "BOZ\n";
			}
			if (par[mid] > par[i] - par[mid]){
				r = mid;
			}else{
				l = mid;
			}
			
		}
		c = a[i + 1], d = par[n] - par[i + 1];
		l = i + 1, r = n;
		//cout << endl;
		//cout << i << ' ' << aa << ' ' << b << ' ' << c << ' ' << d << '\n'; 
 		while (r - l > 1){
			ll mid = (l + r) / 2;
			if (abs(par[mid] - par[i] - (par[n] - par[mid])) < abs(c - d)){
				c = par[mid] - par[i], d = par[n] - par[mid];
			}
			if (par[mid] - par[i] > (par[n] - par[mid])) r = mid;
			else l = mid;
		}
  		ans = min(ans, max({aa, b, c, d}) - min({aa, b, c, d}));
		
	}
	cout << ans;
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




Measured memory_bytes: 3328
require "pp"
n = gets.to_i
data_col1 = gets.split(" ").map{|nn|nn.to_i}
data_col2 = gets.split(" ").map{|nn|nn.to_i}
datas = [data_col1, data_col2]

dp = [[],[],[]]
dp[0] = Array.new(n+10, 0)
dp[1] = Array.new(n+10, 0)
dp[2] = Array.new(n+10, 0)
dp[0][0] = datas[0][0]
for k in 1..(n-1) do
  dp[0][k] += dp[0][k-1] + datas[0][k]
end

for k in 0..(n-1) do
  if k == 0
    dp[1][0] = dp[0][0] + datas[1][0]
  else
    dp[1][k] = [dp[0][k], dp[1][k-1]].max + datas[1][k]
  end
end

puts dp[1][n-1].to_s

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

typedef pair<int, int> pii;
typedef pair<short, short> pss;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N, M;
ll ans;

int main() {
	cin >> N >> M;
	ans = M * 1900 + (N-M) * 100;
	rep(i, M) ans *= 2;
	cout << ans << endl;
	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

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

    string sa, sb;
    rep(i, a) sa += to_string(b);
    rep(i, b) sb += to_string(a);
    if(sa < sb){
        OP(sa);
    }else{
        OP(sb);
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
a = []
dp = []

#l <= x < rまでの行列せきの最小値
def rec(l, r):
	if dp[l][r] != -1:
		return dp[l][r]
	if l+1 == r:
		dp[l][r] = 0
		return dp[l][r]
	if l+2 == r:
		dp[l][r] = a[l][0] * a[l][1] * a[l+1][1]
		return dp[l][r]

	m = 100000000
	for i in range(l+1, r):
		m = min(m, rec(l, i) + rec(i, r) + a[l][0] * a[i][0] * a[r-1][1])
	dp[l][r] = m
	return dp[l][r]

def main():
	global a, dp
	n = int(input().strip())
	for i in range(n):
		a.append(tuple(map(int, input().strip().split())))
	dp = [[-1] * (n+1) for _ in range(n)]
	print(rec(0, n))

if __name__ == '__main__':
	main()



Measured memory_bytes: 5736
import math

while True:
    n = int(input())
    if n == 0:
        break
    else:
        slst = list(map(int, input().split()))
        mean = sum(slst)/n
        v = sum([(s-mean)**2 for s in slst])/n
        std = math.sqrt(v)
        print(f"{std:.5f}")



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

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int M = nextInt();
		int K = nextInt();

		int[][] b = new int[N][M];
		for(int i=0;i<b.length;i++){
			Arrays.fill(b[i], 1);
		}

		for(int i=0;i<=N;i++){
			for(int k=0;k<=M;k++){
				if(K==(M*i+N*k-2*i*k)){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");

	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 24276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }

const int maxn = 2e5 + 7;

vector<ll> v(maxn);
vector<ll> mostposs(maxn);

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int n;
    cin >> n;

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

    if (n == 0) {
        if (v[0] != 1) out(-1);
        out(1);
    }

    // ll activep = 1LL;
    // for (int i = 0; i <= n; i++) {
    //     if (v[i] > activep) out(-1);
    //     activep -= v[i];
    //     activep *= 2LL;
    // }

    if (v[0] > 0) {
        out(-1);
    }

    for (int i = n; i >= 0; i--) {
        mostposs[i] = v[i] + mostposs[i+1];
    }

    ll activep = 1LL;
    ll ans = 1LL;
    for (int i = 1; i <= n; i++) {
        activep *= 2LL;
        if (v[i] > activep) out(-1);
        ans += v[i]; // add leaves
        activep -= v[i]; // minus leaves bc they can't be parents to next level
        activep = min(mostposs[i+1],activep); // bound # of node that will be parents to next level
        ans += activep; // add parents of this level
    }
    
    out(ans);
    
    return 0;
}


Measured memory_bytes: 6288
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, l;
	cin >> n >> l;
	int sum = 0;

	int ei1333 = l;
	for (int i = 1; i <= n; i++) {
		sum += l + i - 1;

		if (abs(ei1333) > abs(l + i - 1)) {
			ei1333 = l + i - 1;
		}
	}

	cout << sum - ei1333 << endl;
	return 0;
}


Measured memory_bytes: 892
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  cout << a*(a-1)/2+b*(b-1)/2;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 384
void main() {
	auto ip = readAs!(int[]), X = ip[0], Y = ip[1];
	auto k = (X + Y) / 3;
	if((X + Y) % 3 != 0) {
		writeln(0);
		return;
	}
	new COM(max(X, Y) + 1, 1000000007).nCr(k, X-k).writeln;
}

class COM {
	long[] fact, finv, inv;
	private ulong MAX;
	private ulong MOD;

	this(ulong MAX, ulong MOD) {
		this.MAX = MAX;
		this.MOD = MOD;
		fact = new long[](MAX);
		finv = new long[](MAX);
		inv = new long[](MAX);

		// initialize the arrays
		fact[0] = fact[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		foreach(i; 2..MAX) {
			fact[i] = fact[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}

	ulong nCr(long n, long k) {
		if(n < k) return 0;
		if(n < 0 || k < 0) return 0;
		assert(n < MAX && k < MAX);
		return fact[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}
	ulong factorial(long n) {
		return fact[n];
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 27900
// コッホ曲線
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

struct Point{
    double x, y;
};

void Koch(int n, Point a, Point b) {
    if (n == 0) return;

    Point s, t, u;

    double th = 60.0 * (M_PI / 180.0);

    s.x = (a.x * 2.0 + b.x * 1.0) / 3.0;
    s.y = (a.y * 2.0 + b.y * 1.0) / 3.0;
    t.x = (a.x * 1.0 + b.x * 2.0) / 3.0;
    t.y = (a.y * 1.0 + b.y * 2.0) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    Koch(n - 1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    Koch(n - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    Koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    Koch(n - 1, t, b);
}

int main() {
    int n;
    Point a, b;

    cin >> n;

    a.x = 0.0;
    a.y = 0.0;
    b.x = 100.0;
    b.y = 0.0;

    printf("%.8f %.8f\n", a.x, a.y);
    Koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}


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

typedef long long LL;  
using namespace std;

#define fillchar(a, x) memset(a, x, sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'

const LL M = (LL)1e9+7;


int main()
{
	LL n;

	LL q,h,s,d;
	cin >> q >> h >> s >> d;
	cin >> n;

	h = min(2*q,h);
	s = min(2*h,s);
	d = min(d,s*2);

	LL ans = 0;
	cin >> n;

	ans += ((n/2)*d);	
	n %= 2;

	ans += n*s;

	cout << ans << endl;

}

Measured memory_bytes: 256
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;


public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
    public final static int MAX = (int)1e5;
  // static Scanner sc = new Scanner(System.in);
   static List<Integer>[] edge;
	public static void main(String[] args) {
	   
	 FastReader sc = new FastReader();
	int a = sc.nextInt();
	String s = sc.next();
	if(a>=3200) out.println(s);
	else out.println("red");
		out.close();
	}
	
	
}


Measured memory_bytes: 21204
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;

vector<int> sieve(int n) {
	vector<int> res(1, 2);
	vector<bool> prime(n, true);
	for(int i = 3; i < n; i += 2) {
		if(prime[i]) {
			res.push_back(i);
			for(int j = i * 3; j < n; j += i * 2)
				prime[j] = false;
		}
	}

	return res;
}

int main() {
	vector<int> prime = sieve(51000);

	for(int n; scanf("%d", &n) == 1;) {
		int idx = lower_bound(prime.begin(), prime.end(), n) - prime.begin();
		if(prime[idx] == n)
			printf("%d %d\n", prime[idx - 1], prime[idx + 1]);
		else
			printf("%d %d\n", prime[idx - 1], prime[idx]);
	}

	return EXIT_SUCCESS;
}

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

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

    // vector<int> a(n);
    // for (int i = 0; i < n; ++i) cin >> a[i];

    cout << (n - 1 + (k - 1) - 1) / (k - 1) << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::stdin;
fn get_string() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

macro_rules! input {
    ($single:ty) => ( get_string().parse::<$single>().ok().unwrap() );
    ($($plural:ty),+) => ({
        let line = get_string();
        let mut iter = line.split_whitespace();
        ($(iter.next().unwrap().parse::<$plural>().ok().unwrap()),+)
    });
    ($single:ty; $times:expr) => ( (0..$times).map(|_| input!($single)).collect::<Vec<$single>>() );
    ($($plural:ty),+; $times:expr) => ( (0..$times).map(|_| input!($($plural),+)).collect::<Vec<($($plural),+)>>() );
}

#[allow(dead_code)]
fn get_value<T: std::str::FromStr>() -> T {
    get_string().parse().ok().unwrap()
}
#[allow(dead_code)]
fn get_values_for<T: std::str::FromStr>(times: u64) -> Vec<T> {
    (0..times).map(|_| get_value()).collect()
}
#[allow(dead_code)]
fn get_vector<T: std::str::FromStr>() -> Vec<T> {
    get_string()
        .split_whitespace()
        .map(|v| v.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn get_vectors_for<T: std::str::FromStr>(times: u64) -> Vec<Vec<T>> {
    (0..times).map(|_| get_vector()).collect()
}

fn main() {
    let (d, mut n) = input!(u32, u32);
    if n == 100 {
        n = 101;
    }
    println!("{}", (100_u32.pow(d)) * n);
}


Measured memory_bytes: 4352
N = int(input())
H = map(int, input().split())
cnt = 0
ans = 0
prev = 0
for i,h in enumerate(H):
    if i==0:
        pass
    else:
        if prev>=h:
            cnt += 1
            if ans<cnt:
                ans = cnt
        else:
            cnt = 0
    prev = h
print(ans)

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n; cin >> n;
  int cnt = 0;
  bool f = false;
  for(int i = 0; i < n; ++i){
    int x,y; cin >> x >> y;
    if(x == y)cnt++;
    else cnt = 0;
    if(cnt == 3)f = true;
  }
  cout << (f ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int d,s,t;
    cin>>d>>t>>s;
    int re=ceil(d*1.0/t);
    if(re<=s){
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<int>>arr;
vector<int>vis;


int dfs(int n,int a)
{
    if(vis[n]==1)
    {
        return 0;
    }
    vis[n]=1;
    a++;
    for(int i=0;i<arr[n].size();i++)
    {
        a+=dfs(arr[n][i],0);
    }
    return a;
}

int main()
{
    int n,m;
    cin>>n>>m;
    arr.resize(n+1,vector<int>());
    vis.resize(n+1,0);
    while(m--)
    {
        int x,y;
        cin>>x>>y;
        arr[x].push_back(y);
        arr[y].push_back(x);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        int res=dfs(i,0);
        ans=max(ans,res);

    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 24368
#include <bits/stdc++.h>
using namespace std;
int k;
int main() {
    scanf("%d", &k);
    if (k <= 500) {
        printf("%d\n", k);
        for (int i = 1; i <= k; ++i, puts(""))
            for (int j = 1; j <= k; ++j) printf("%d ", i);
        return 0;
    }

    int n = ((k + 3) / 4) << 1, t;
    printf("%d\n", n);
    for (int i = 1; i <= n; ++i, puts(""))
        for (int j = 1; j <= n; ++j) {
            t = (i + j) % n + (i & 1 ? 0 : n) + 1;
            printf("%d ", t -= t > k ? n : 0);
        }

    return 0;
}

Measured memory_bytes: 1152
def powmod(n: int, p: int, M: int) -> int:
    ans = 1
    for _ in range(p):
        ans *= n
        ans %= M
    return ans

def solve():
    N = int(input())

    distances = list(map(int, input().split()))

    node = [0] * N

    for distance in distances:
        node[distance] += 1

    ans = 1
    MOD = 998244353

    if distances[0] != 0 or node[0] != 1:
        print(0)
    else:
        previous = node[1]
        for i in range(2,N):
            now = node[i]
            ans = ans * powmod(previous, now, MOD) % MOD
            previous = now
        print(ans)
    
solve()

Measured memory_bytes: 14396
a,b,c,k = map(int,input().split())
if k%2 == 0:
    if abs(a-b)>10**18:
        print("Unfair")
    else:
        print(a-b)
else:
    if abs(b-a)>10**18:
        print("Unfair")
    else:
        print(b-a)

Measured memory_bytes: 9168
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

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

    sort(m.begin(), m.end());

    int count = 0;
    for (int i = 0; i < n; ++i) {
        x -= m[i];
        ++count;
    }
    count += x / m[0];
    cout << count << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    int G = 1;
    for (int d = 1; d * d <= M; ++d)
    {
        if (M % d == 0 && d <= M / N)
        {
            if (d >= N) // M / d <= M / N
            {
                G = max(G, M / d);
            }
            else
            {
                G = max(G, d);
            }
        }
    }
    cout << G << endl;
    return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
#include  <sstream>
#include  <bitset>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };


int main()
{
	int n;
	cin >> n;
	if (n >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v;
    for(int i = 2; i <= n; i++){
        v.push_back(i);
    }
    int field[10][10];
    for(int i = 0; i <= 9; i++){
        for(int j = 0; j <= 9; j++){
            field[i][j] = 0;
        }
    }
    for(int i = 0; i < m; i++){
        int in1, in2;
        cin >> in1 >> in2;
        field[in1][in2] = 1;
        field[in2][in1] = 1;
    }
    int ans = 0;
    do{
        bool flag = true;
        if(field[1][v[0]] == 0){
            continue;
        }
        for(int i = 0; i <= n - 3; i++){
            if(field[v[i]][v[i + 1]] == 0){
                flag = false;
            }
        }
        if(flag == true){
            ans++;
        }
    } while(next_permutation(v.begin(), v.end()));
    cout << ans << endl;
        return 0;
}

Measured memory_bytes: 256