akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N := sc.nextInt()
	A := sc.nextIntSlice(N)
	count := make(map[int]int)
	for i := 0; i < N; i++ {
		count[A[i]]++
	}
	keys := []int{}
	for k, _ := range count {
		keys = append(keys, k)
	}
	sort.Ints(keys)
	l := 0
	r := len(keys) - 1
	//fmt.Fprintln(wtr, keys)
	//fmt.Fprintln(wtr, count)
	for {
		for l < r && count[keys[l]] == 1 {
			l++
		}
		for l < r && count[keys[r]] == 1 {
			r--
		}
		if l == r {
			break
		}
		lc := count[keys[l]]
		rc := count[keys[r]]
		mi := min(lc-1, rc-1)
		count[keys[l]] -= mi
		count[keys[r]] -= mi
	}
	ans := 0
	for _, c := range count {
		if c > 0 {
			ans++
		}
	}
	if count[keys[l]] > 1 && count[keys[l]]%2 == 0 {
		ans--
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 9856
import numpy as np
n,m,x = map(int,input().split())
c = []
for i in range(n):
  a = [int(i) for i in input().split()]
  c.append(a)
  
c = np.array(c)
ans = float('inf')
for i in range(1,2**n):
  chk = [0]*m
  cost = 0
  for j in range(n):
    if (i>>j)&1 == 1:
      cost += c[j][0]
      chk += c[j][1:]
  if min(chk) >= x:
    ans = min(ans,cost)
  
if ans == float('inf'):
  ans = -1
print(ans)

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

int main() {
    int N, K, con = 1;
    cin >> N >> K;
    for(int i=0; i<N; i++){
        if(con*2 >= con + K){
            con +=K;
        }
        else con *=2;
    }
    cout << con <<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3 1 4");
            //3
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3 3 33");
            //2
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        Console.WriteLine(wkArr.Distinct().Count());
    }
}


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

using namespace std;

float calc(int T,int x){
    return T-x*0.006;
}

int main(){
int N,T,A;
vector<float> H;
cin>>N;
cin>>T>>A;
int tmp;
int idx;
for(int i=0;i<N;i++){
    cin>>tmp;
    H.push_back(abs(calc(T,tmp)-A));
}

vector<float>::iterator minIt= min_element(H.begin(),H.end());
idx = distance(H.begin(),minIt);

cout<<idx+1;
//system("pause");
return 0;
}

Measured memory_bytes: 256
# if 0
15分ほど時間がかかった。
そこまで難しくはなかった。
# endif

#include <iostream>
using namespace std;

int V, E, R, S[500010], T[500010], D[500010]; // 問題で与えられる入力
int C[100010]; // 各頂点までの最短距離の上限
 // 無限を表す定数を全頂点をたどる最大超に設定
const int Inf = 10000*100000+100;

int main() {
  cin >> V >> E >> R;
  for (int i=0; i<E; ++i)
    cin >> S[i] >> T[i] >> D[i]; // 各辺を入力
  for (int i=0; i<V; i++) {
    if (i == R) {
      C[i] = 0;
    } else {
      C[i] = Inf;
    }
  }

  for (int t=0; t<V; ++t) { // V 回繰り返す
    bool update = false;
    for (int i=0; i<E; ++i) {
      int s = S[i], t = T[i], d = D[i]; // i 番目の辺の s,t,d に対して
      if (C[s] < Inf && C[t] > C[s] + d) { // 辺 s,t で緩和できるなら
        C[t] = C[s] + d;
        update = true; // 更新が起こったことを記録
      }
    } 
    if (!update) break; // 辺を一巡して更新がなければ打ち切って良い
  }
  for (int i=0; i<V; i++) {
    if (C[i] == Inf) {
      cout << "INF" << endl;
    } else {
     cout << C[i] << endl; 
    }
  }
}


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

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int > vi;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
 
#define ALL(x) (x).begin(), (x).end()
#define RESET(x) memset((x), 0, sizeof (x))
#define FOR(i, b, e) for ( int i = (b); i < (e); ++i)
#define RE(i, n) FOR(i, 0, (n))
#define FOREACH(i, x, y) for ( int i = (x); i <= (y); ++i)
#define two(X) (1<<(X))//NOTES:two(
#define contain(S,X) (((S)&two(X))!=0)//NOTES:contain(
#define chkmin(X, Y) (X) = min((X), (Y))
#define chkmax(X, Y) (X) = max((X), (Y))
#define sqr(X) ((X) * (X))
#define MP(x, y) make_pair((x), (y))
 
const int LOGN = 22;
const ll INF = (1 << 30) + 10;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-12;

const long long maxn = 1e5 + 100;
const ll maxm = (ll) 1e6;

int main() {
#ifndef ONLINE_JUDGE
 //   freopen("in.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int n;
    while (cin >> n) {
        vi a(n);
        RE(i, n) cin >> a[i];
        vi b(n + 1, -1);
        int ans = 0;
        RE(i, n) {
            int x = a[i];
            if (b[x - 1] == -1) {
                b[x] = 1;
                chkmax(ans, b[x]);
                continue;
            }
            b[x] = b[x - 1] + 1;
            chkmax(ans, b[x]);
        }
        cout << n - ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1920
#include<stdio.h>
#define N 44


int f[N];

/*フィボナッチ数列*/
int fibo(int i){

  if(f[i] == NULL){
    /*0のときと1のとき1*/
     if(i==0 || i==1) f[i]=1;

     else{
       f[i]=fibo(i-1)+fibo(i-2);

     }

   }

   return f[i];
 }


 int main(void){

   int n;

   scanf("%d",&n);

   printf("%d\n",fibo(n));

   return 0;

}

Measured memory_bytes: 596
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n;i++)cin>>a.at(i);
int now=a.at(0);
int cnt=0,ans=0;
for(int i=1;i<n;i++){
  //  cout<<now<<" "<<a.at(i)<<endl;
   // cout<<cnt<<endl;
    if(now>=a.at(i))cnt++;
    else {ans=max(ans,cnt);cnt=0;}
    now=a.at(i);
}
ans=max(ans,cnt);
cout<<ans<<endl;
}


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

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

		if (a >= 0 && a <= 100 && b >= 0 && b <= 100 && c >= 0 && c<= 100)
			break;
	}

	
	if( a < b && b < c)
		cout << "Yes" << endl;
	else
		cout << "No" <<endl;

	return 0;
}

Measured memory_bytes: 1160
S = input().rstrip()
R = "RUD"
L = "LUD"
r = 0
l = 0

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i] in R:
      #print("ok")
      r += 1
    else:
      print("No")
      break
  elif (i % 2) == 1:
    if S[i] in L:
      #print("OK")
      l += 1
    else:
      print("No")
      break
      
  if (r + l) == len(S):
    print("Yes")

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  rep(i, h) rep(j, w) cin >> a.at(i).at(j);
  // 行、列ごとの . の数
  vector<int> hh(h, 0);
  vector<int> ww(w, 0);
  rep(i, h) {
    rep(j, w) {
      if (a.at(i).at(j) == '.') {
        hh[i]++;
        ww[j]++;
      }
    }
  }
  rep(i, h) {
    if (hh.at(i) == w) {
      continue;
    }
    rep(j, w) {
      if (ww.at(j) == h) {
        continue;
      }
      cout << a.at(i).at(j);
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <set>

using namespace std;

int main()
{
    int am[26], n;
    string s;
    memset(am, 63, sizeof am);
    cin >> n;
    while (n--)
    {
        cin >> s;
        for (int c = 0; c < 26; ++c)
            am[c] = min(am[c] + 0ul, multiset<char>(s.begin(), s.end()).count(c + 'a'));
    }
    for (int c = 0; c < 26; ++c)
        cout << string(am[c], c + 'a');
    return 0;
}


Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    const n = chunk.toString();
    const r = n.split("\n");
    r.forEach(x => st(x));
});

function st(men){
    const r = men.split(" ").map(x=>Number(x));
    const hiku = r[1]-2;
    var naka = "";
    var moji = "";
    var hiki = r[0]-2;
    for(var i = 0; i<r[1]; i++){
        if(r[i] != 0 && r[i+1] != 0){
            moji += "#";
        }
    }
    if(moji!=""){
        console.log(`${moji}`);
    }
    for(var i = 0; i < hiki; i++){
        for(var d = 0; d<hiku; d++){
            naka += ".";
        }
        console.log(`#${naka}#`);
        var naka = "";
    }
    if(moji!=""){
        console.log(`${moji}`);
        console.log("");
    }
}




Measured memory_bytes: 18788
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n;
  cin >> n;
  vector<int> a(n+1),b(n);
  rep(i,n+1) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll cnt = 0;
  rep(i,n){
    if(a[i] <= b[i]){
      b[i] -= a[i]; cnt += a[i]; a[i] = 0;
      if(a[i+1] <= b[i]){
        b[i] -= a[i+1]; cnt += a[i+1]; a[i+1] = 0;
      }else{
        a[i+1] -= b[i]; cnt += b[i]; b[i] = 0;
      }
    }else{
      a[i] -= b[i]; cnt += b[i]; b[i] = 0;
    }
  }
  
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 1024
//import java.io.File;
import java.util.Scanner;
import java.util.ArrayList;

public class Main{
  public static void main(String[] args) throws Exception {
    //Scanner scan = new Scanner(new File("in.txt"));
    Scanner scan = new Scanner(System.in);

    int input1 = scan.nextInt();

    for(int caves = 0; caves < input1; caves++) {
      int input2 = scan.nextInt();
      int input3 = scan.nextInt();

      ArrayList<Room> room = new ArrayList<>();

      int nowX = 0;
      int nowY = 0;
      while(!(input2 == 0 && input3 == 0)) {
        nowX += input2;
        nowY += input3;
        boolean flag = true;
        for(int i = 0; i < room.size(); i++) {
          Room r = room.get(i);
          if(nowX==r.x && nowY==r.y) {
            flag = false;
            break;
          }
        }
        if(flag) {
          room.add(new Room(nowX,nowY));
        }

        input2 = scan.nextInt();
        input3 = scan.nextInt();
      }

      int max = 0;
      int maxX = 0;
      int maxY = 0;
      for(int i = 0; i < room.size(); i++) {
        Room r = room.get(i);
        int length = r.x*r.x+r.y*r.y;
        if(max<length) {
          max = length;
          maxX = r.x;
          maxY = r.y;
        }else if(max == length) {
          if(maxX < r.x) {
            max = length;
            maxX = r.x;
            maxY = r.y;
          }
        }
      }

      System.out.println(maxX+" "+maxY);
    }
  }
}

class Room{
  int x,y;
  Room(int _x, int _y) {
    x = _x;
    y = _y;
  }
}

Measured memory_bytes: 33948
def opposite(col):
    if col == "B":
        return "W"
    elif col == "W":
        return "B"
    else:
        print("error")

board = list(input())
board_l = board[:]
board_r = board[:]
left_side = board_l[0]
right_side = board_r[-1]
s = len(board)
counter_l = 0
counter_r = 0
i = 0
fin_flag = False
while fin_flag == False:
    if board_l[i] == left_side:
        pass

    else:
        counter_l += 1
        left_side = board_l[i]
        # #just for fun.
        # for j in range(i):
        #     board_l[j] = left_side

    if board_r[-i-1] == right_side:
        pass

    else:
        counter_r += 1
        right_side = board_r[-i-1]
    #     #just for fun
    #     print("-i-1",-i-1)
    #     for j in range(1,abs(-i-1)):
    #         board_r[-j] = right_side

    # print("board_l",board_l)
    # print("board_r",board_r)
    if i == s-1:
        if counter_l > counter_r:
            print(counter_l)
        else:
            print(counter_r)
        fin_flag = True
    i += 1


Measured memory_bytes: 51568
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int a, b, c; cin>>a>>b>>c;
    if(a < c && c < b) cout << "Yes" << endl;
    else if(b < c && c < a) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;


double calStandardDeviation(const vector<double> &pts)
{
    double sum = 0;
    for(const auto& x : pts)
    {
        sum += x;
    }
    double ave = sum / pts.size();

    sum = 0;
    for(const auto& x : pts)
    {
        sum += pow(x - ave, 2);
    }

    return sqrt(sum / pts.size());

}

int main()
{
    double n;
    vector<double> vec;

    while(true)
    {
        cin >> n;
        if(n==0){ break; }

        vec.clear();
        for(int i = 0; i< n; i++)
        {
            double tmp;
            cin >> tmp;
            vec.push_back(tmp);
        }
        cout << fixed << setprecision(8);
        cout << calStandardDeviation(vec) << endl;

    }

    return 0;
}

Measured memory_bytes: 3232
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a%b)

n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_new = [abs(i-x) for i in x_list]
if n == 1:
    print(x_new[0])
    exit()
ans = x_new[0]
for i in range(n-1):
    ans = gcd(ans,x_new[i+1])
print(ans)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define f(i,p,q) for(int i=p;i<q;i++)
using namespace std;
typedef long long ll;
long long int ar[64];
int main()
{//freopen("in.txt","r",stdin);
 //freopen("out.txt","w",stdout);
  long long  int n,k;cin>>n>>k;
  long long  int t; int l=0;
	long long  int m=n;
	vector<long long int>v;
   for(int i=0;i<n;i++)
   {  long long int x;cin>>x;
      v.push_back(x);
     t=x;
  long long int index=0;
   	 while(t!=0)
   	 {   
		if((t&1)==1)
   	      ar[index]++;
   	 	index++;
        t=t>>1;
		}
   }
  long long  int ans=0;
  
  
   for(int i=40;i>=0;i--)
   { long long int u=(1ll<<i);
      if(m-ar[i]>ar[i]&&(ans+u<=k))
          ans=ans+u;
   	  
   	   //cout<<i<<" "<<ar[i]<<"  "<<ans<<"\n";
   }  
  
 
  long long  int res=0;
   for(int i=0;i<m;i++)
     res+=ans^v[i];
      cout<<res;
}


Measured memory_bytes: 1400
n = int(input())
arr = list(map(int,input().split()))
flg = 0
arr2 = [arr[0]]
for i in range(1,n):
	if arr[i] > arr2[i-1]:
		arr2.append(arr[i]-1)
	else:
		arr2.append(arr[i])

for j in range(n-1):
	if arr2[j] > arr2[j+1]:
		flg = 1

if flg == 0:
	print("Yes")
else:
	print("No")
			
		


	




	
	
	

Measured memory_bytes: 14396
// Need to git gud and reach 1900+
#include <bits/stdc++.h>
using namespace std;

#define ok puts("ok")
#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define pi pair < int, int >

const int N = 1e5 + 7;
const int INF = 1e9 + 7;

string s1, s2;

main(){ // If you don't know what to do, check the text box at the bottom
    cin >> s1 >> s2;
    int c = 0;
    for (int i = 0; i < 3; i++){
        if (s1[i] == s2[i])
            c++;
    }
    cout << c << endl;
}

/*
    Totally not inspired by BenQ's template
    Things you should do:
    1. Look for stupid typos in code e.g 1 instead of -1 etc
    2. Check if there is no infinite loops
    3. "Measure twice, cut once"
    4. Stay focused
*/


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
from operator import itemgetter

def main():
    N = int(input())
    lr = []
    for _ in range(N):
        p,l = map(int,input().split())
        lr.append((p-l,p+l))
        
    lr.sort(key = itemgetter(1,0))
    now = -10**10
    count = 0
    for i in range(N):
        if now <= lr[i][0]:
            count += 1
            now = lr[i][1]
        
    print(count)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 24548
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <functional>
#include <utility>
#include <cstring>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

const double g = 9.8;
const double eps = 1e-10;
const int maxn = 500;

int n, v, x, y;
int l[maxn], b[maxn], r[maxn], t[maxn];

double cal(double vy, double t)
{
    return vy * t - g * t * t / 2;
}

int cmp(double lb, double ub, double a)
{
    return a < lb + eps ? -1 : a > ub - eps ? 1 : 0;
}

bool check(double qx, double qy)
{
    double a = g * g / 4, B = g * qy - v * v, c = qx * qx + qy * qy;
    double d = B * B - 4 * a * c;
    if(d < 0 && d > -eps) d = 0;
    if(d < 0) return false;
    for(int D = -1; D <= 1; D += 2)
    {
        double t2 = (-B + D * sqrt(d)) / (2 * a);
        if(t2 <= 0) continue;
        double T = sqrt(t2);
        double vx = qx / T, vy = (qy + g * T * T / 2) / T;
        double yt = cal(vy, x / vx);
        if(yt < y - eps) continue;

        bool ok = true;
        for(int i = 0; i < n; i++)
        {
            if(l[i] >= x) continue;
            if(r[i] == x && y <= t[i] && b[i] <= yt)
                ok = false;
            int yl = cmp(1.0 * b[i], 1.0 * t[i], 1.0 * cal(vy, l[i]/ vx));
            int yr = cmp(1.0 * b[i], 1.0 * t[i], 1.0 * cal(vy, r[i]/ vx));
            int xh = cmp(1.0 * l[i], 1.0 * r[i], 1.0 * vx * (vy / g));
            int yh = cmp(1.0 * b[i], 1.0 * t[i], 1.0 * cal(vy , vy / g));
            if(xh == 0 && yh >= 0 && yl < 0) ok = false;
            if(yl * yr <= 0) ok = false;
        }
        if(ok) return true;
    }
    return false;
}

void solve()
{
    for(int i = 0; i < n; i++)
    {
        r[i] = min(r[i], x);
    }
    bool ok = check(x, y);
    for(int i = 0; i < n; i++)
    {
        ok |= check(l[i], t[i]);
        ok |= check(r[i], t[i]);
    }
    puts(ok ? "Yes" : "No");
}

int main()
{
    while(~scanf("%d%d%d%d", &n, &v, &x, &y))
    {
        for(int i = 0; i < n; i++)
        {
            scanf("%d%d%d%d", &l[i], &b[i], &r[i], &t[i]);
        }
        solve();
    }
    return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
int main(){
	cin >> N;
	vector<int> a(N);
	for(int i=0;i<N;i++){
		cin >> a[i];
		a[i]--;
	}
	vector<int> ans;
	for(int i=0;i<N;i++){
		int idx = -1;
		for(int j=a.size()-1;j>=0;j--){
			if(a[j]==j){
				idx = j;
				break;
			}
		}
		if(idx==-1){
			cout << -1 << endl;
			return 0;
		}
		a.erase(a.begin()+idx);
		ans.pb(idx+1);
	}
	reverse(all(ans));
	for(int i=0;i<ans.size();i++){
		cout << ans[i] << endl;
	}
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    string s;
    int n;
    cin >> n >> s;
    rep(i, s.size()) {
        s[i] = ((s[i] + n) <= 'Z') ? char(s[i] + n) : char('A' + (n - ('Z' - s[i]) - 1));
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N, K;
    string S;
    cin >> N >> K >> S;
    S[K-1] = tolower(S[K-1]);
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 2e5 + 5;
 
int n;
int a[N], ans[N];
map<int, int> f;
vector<int> v;
 
int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		f[a[i]]++;
	}
	if(f.count(0) && f[0] == n)
	{
		cout << "Yes";
		return 0;
	}
	if(f.size() > 3)
	{
		cout << "No";
		exit(0);
	}
	if(n % 3 != 0)
	{
		if(f[0] != n)
			cout << "No";
		else
			cout << "Yes";
		return 0;
	}
	int answer = 0;
	for(int i = 1; i <= n; i++)
		answer ^= a[i];
	if(!answer)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	
	int x = a * b;
	if (x % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
}

Measured memory_bytes: 256
S = input()

max_ss = 0
current_size = 0

for i in range(0,len(S)):
  
  if S[i] in ['A','G','C','T']:
    current_size += 1
    
  else:
    max_ss=max(max_ss,current_size)
    current_size=0

max_ss=max(max_ss,current_size)

print(max_ss)

Measured memory_bytes: 3060
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c = s.charAt(0);
        if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
            System.out.println("vowel");
        } else {
            System.out.println("consonant");
        }
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) ((int)(a).size())
typedef long long int64;
int main(){
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false),cout.tie(0),cin.tie(0);
  string s;cin>>s;
  int ans=0,cur=0;
  for(int i=0;i<3;++i){
    if(s[i]=='R')cur++;
    else cur=0;
    ans=max(cur,ans);
  }
  cout<<ans<<'\n';
  
  return 0;
}
//2020.08.15 20:00:42


Measured memory_bytes: 3648
// 2020-08-24 21:07:14
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, ll>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  int n, a, b;
  cin >> n >> a >> b;
  vector<ll> v(n);
  rep(i, n) cin >> v[i];
  sort(RALL(v));
  int mc = 0;
  ll mv = 0;
  ll last = 1e18;
  auto update = [&](int c, ll w) {
    if(mv * c < w * mc) {
      mc = c;
      mv = w;
      return true;
    }
    return false;
  };
  {
    ll cur = 0;
    rep(i, a) cur += v[i];
    mc = a;
    mv = cur;
    last = v[a-1];
    REP(i, a, b) {
      cur += v[i];
      if(update(i+1, cur)) last = v[i];
    }
    ld ans = ld(mv) / ld(mc);
    cout << fixed << setprecision(6) << ans << '\n';
  }
  if(v[0] == last) {
    ll cnt = 0;
    rep(i, n) cnt += (v[i] == last);
    ll ans = 0, now = 1;
    REPC(i, 1, b) {
      now = now * (cnt-i+1) / i;
      if(a <= i) ans += now;
    }
    cout << ans << '\n';
  } else {
    ll rem = a, cnt = 0;
    rep(i, n) {
      if(v[i] > last) rem--;
      else if(v[i] == last) cnt++;
      else break;
    }
    ll ans = 1;
    REPC(i, 1, rem) ans = ans * (cnt-i+1) / i;
    cout << ans << '\n';
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3848
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        A: u64,
        B: u64,
    }

    if A == B {
        println!("{}", A);
        return
    }

    if A+1 == B {
        println!("{}", A ^ B);
        return
    }

    if A+2 == B {
        println!("{}", A ^ (A+1) ^ B);
        return
    }

    let ra = A % 2;
    let rb = B % 2; 
    
    let output = match (ra, rb) {
        (0, 1) => cm(A, B),
        (0, 0) => cm(A, B-1) ^ B,
        (1, 1) => A ^ cm(A+1, B),
        (1, 0) => A ^ cm(A+1, B-1) ^ B,
        _ => panic!()
    };


    println!("{}", output);
}

fn cm(a: u64, b: u64) -> u64 {
    ((b + 1 - a) / 2) % 2
}


Measured memory_bytes: 4352
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, K) = Slice2<long>();
            var _ = ReadLine();
            WriteLine(1 + (N - 2) / (K - 1));
        }
 
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

using namespace std;

int main () {
	long long x, k, d; cin >> x >> k >> d;
	x = abs(x);
	long long t = k - x / d;
	if (t <= 0) {
		x -= k * d;
		t = 0;
	} else x -= x / d * d;
	if (t & 1) cout << abs (x - d) << endl;
	else cout << x << endl;

	return 0;
}

Measured memory_bytes: 3632
import java.util.*;

class Main {
    private static Scanner sc;

    public static void main(final String[] args) {
        sc = new Scanner(System.in);
        String N = sc.next(),ans;
        int comp;
        N = N.substring(N.length()-1);
        comp = Integer.valueOf(N);
        if(comp == 3){
            ans = "bon";
        }else if(comp <= 1 || comp == 6 || comp == 8){
            ans = "pon";
        }else{
            ans = "hon";
        }
        System.out.println(ans);
    }
}








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

#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 5e5 + 5;
char check[3] = {'R', 'G', 'B'};
unordered_map<char, ll> mem;
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (fopen("VLJUM.INP", "r")){
                freopen("VLJUM.INP", "r", stdin);
                freopen("VLJUM.OUT", "w", stdout);
        }
        ll n;
        string s;
        cin >> n >> s;
        s = " " + s;
        ll ans = 0;
        for (int i = 1; i <= n; i++){
                for (int j = i + 1; j <= n; j++){
                        if (s[i] != s[j]){
                                for (int k = 0; k < 3; k++){
                                        if (check[k] != s[i] && check[k] != s[j]){
                                                ans += mem[check[k]];
                                                if ((i - (j - i)) > 0) {
                                                        ans -= (check[k] == s[i - (j - i)]);
                                                }
                                        }
                                }
                        }
                }
                mem[s[i]]++;
        }
        cout << ans;
}
/*
*/


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    long long int a,b,n;
    cin>>n>>a>>b;
    if(a>b || (n==1 && a<b)){
        printf("0\n");
    }else if(a==b || n==1 || n==2){
        printf("1\n");
    }else{
        printf("%lld\n",(b-a)*(n-2)+1);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=100000+100;

int n,m;
ll ans,x,d[maxn],p[30];
priority_queue<ll> Q;

//d(j):在购买第i个item时，使用了j张代金券花费的最小金钱 
//x/2^y>=1;x>=2^y;y<=log x +1;
//对于一种物品，它可能会生成log x种价格，需要处理的所有价格为nlog maxa;
//dp复杂度为nmlog maxa,超时
//考虑贪心，首先对a进行升序排序，对于全部的item，对最大的用优惠券一定要好于对最小的用优惠券
//因此，对区间(n-m+1,n) 使用优惠券，每使用一张优惠券，左+1；区间表示为[l,n]; 
int main(){
	scanf("%d%d",&n,&m);
	ans=0;
	for(int i=0;i<n;i++){
		scanf("%lld",&x);
		Q.push(x);
	}
	for(int i=0;i<m;i++){
		x=Q.top();Q.pop();
		Q.push(x>>1);
	}
	while(!Q.empty()){
		x=Q.top();Q.pop();
		ans+=x;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 1400
protocol InitFromString {
    init?(_ str: String)
}
 
extension Int: InitFromString {}
extension Int8: InitFromString {}
extension Int16: InitFromString {}
extension Int32: InitFromString {}
extension Int64: InitFromString {}
extension String: InitFromString {}

func input<T: InitFromString>() -> [T] {
    readLine()!.split(separator: " ").map(String.init).compactMap(T.init)
}

func main(){
    let nm: [Int] = input()
    let n = nm[0]
    let _ = nm[1]
    let A: [Int] = input()
    let total: Int = A.reduce(0, +)

    let ans: Int
    if total > n {
        ans = -1
    } else {
        ans = n - total
    }

    print(ans)

}

main()

Measured memory_bytes: 8044
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

#define rep(i,n) for(int i=0; i<int(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int num[10], used[10], ans;

void check(int a) {
	if (a == 9) {
		int res1 = 100 * num[3] + 10 * (num[1] + num[4]) + (num[0] + num[2] + num[5]);
		int res2 = 100 * num[6] + 10 * num[7] + num[8];
		if (res1 == res2)ans++;
	}
	else if (num[a] != -1)check(a + 1);
	else {
		for (int i = 1; i <= 9; i++) {
			if (used[i] == 1)continue;
			used[i] = 1;
			num[a] = i;
			check(a + 1);
			used[i] = 0;
			num[a] = -1;
		}
	}
}

int main() {
	for (int i = 0; i < 9; i++)
		cin >> num[i];

	for (int i = 0; i < 9; i++) {
		if (num[i] != -1)
			used[num[i]] = 1;
	}
	check(0);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3096
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		ArrayList<Integer> hight = new ArrayList<Integer>();

		for (int i = 0; i < 10; i++) {

			hight.add(input());

		}

		Collections.sort(hight);

		System.out.println(hight.get(9));
		System.out.println(hight.get(8));
		System.out.println(hight.get(7));

		close();

	}

	public static int input() {

		return scanner.nextInt();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}

Measured memory_bytes: 26192
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

const int maxn = 2000 + 10;
int fac[maxn], invfac[maxn];

#define MOD 1000000007
long long qpow(long long a, long long b){
    long long s = 1;
    while (b > 0) {
        if (b & 1)s = s * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return s;
}
void init() {
    int n = maxn - 1;
    fac[0] = 1;
    for (int i = 1; i <= n; ++i)
        fac[i] = 1ll * fac[i - 1] * i % MOD;
    invfac[n] = qpow(fac[n], MOD - 2);
    for (int i = n - 1; i >= 0; --i) {
        invfac[i] = 1ll * invfac[i + 1] * (i + 1) % MOD;
    }
}
long long comb(int n, int m) {
    if (n < m) return 0;
    return 1ll * fac[n] * invfac[m] % MOD * invfac[n - m] % MOD;
}
long long comb_rep(int n, int m){ //重複組み合わせ
    return comb(n+m-1, m);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  init();
  ll s; cin >> s;
  ll ans = 0;
  for(int i = 1; i <= s/3 ; i++){
    ll n = s - i*3 + 1;
    ll r = i - 1;
    ans += comb_rep(n, r);
    ans %= MOD;
  }
  cout << ans << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
typedef vector<long long> poly;
long long mod;
long long powmod(long long px, long long py, long long pmod){
	if(py == 0) return 1;
	if(py % 2 == 0) return powmod((px * px) % pmod, py / 2, pmod);
	else return (px * powmod(px, py - 1, pmod)) % pmod;
} 
const long long c_max = 10000003;
long long fac[c_max], finv[c_max], inv[c_max];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < mod; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
long long COM(long long comn, long long comk){
    if (comn < comk) return 0;
    if (comn < 0 || comk < 0) return 0;
    if (comn >= c_max){
        long long cret = finv[comk];
        for (long long i = 0; i < comk; i++) cret = (cret * (comn - i)) % mod;
        return cret;
    }
    return fac[comn] * (finv[comk] * finv[comn - comk] % mod) % mod;
}
poly poly_plus(poly a, poly b){
    ll as, bs;
    as = a.size(); bs = b.size();
    poly c(max(as, bs));
    rep(i,0,as-1) c[i] = a[i];
    rep(i,0,bs-1) c[i] = (c[i] + b[i]) % mod;
    return c;
}

poly poly_minus(poly a, poly b){
    ll as, bs;
    as = a.size(); bs = b.size();
    poly c(max(as, bs));
    rep(i,0,as-1) c[i] = a[i];
    rep(i,0,bs-1) c[i] = (c[i] + mod - b[i]) % mod;
    return c;
}

poly poly_mul(poly a, poly b){
    ll as, bs;
    as = a.size(); bs = b.size();
    poly c(min(as+bs-1, mod), 0);
    rep(i,0,as-1){
        rep(j,0,bs-1){
            c[(i+j)%mod] = (c[(i+j)%mod] + a[i] * b[j] % mod) % mod;
        }
    }
    return c;
}

poly poly_pow(poly a, ll x){
    if(x == 0){
        poly c; c.push_back(1);
        return c;
    }
    if(x % 2 == 1) return poly_mul(poly_pow(a, x-1), a);
    else return poly_mul(poly_pow(a, x/2), poly_pow(a, x/2));
}

int main(){
    cin >> mod;
    COMinit();
    ll aa,m,po[3000][3000];
    ll ans[3005]={0};
    rep(i,0,mod-1){
        ll mp=1;
        po[i][0]=1;
        rep(j,1,mod-1){
            mp=(mp*i)%mod;
            po[i][j]=mp;
        }
    }
    rep(i,0,mod-1){
        cin >> aa;
        if(aa==1){
            ll mm=1;
            m=(mod-i)%mod;
            rep(j,0,mod-1){
                mm=po[m][mod-1-j];
                mm=mm*COM(mod-1,j)%mod;
                ans[j]=(ans[j]-mm+mod)%mod;
            }
            ans[0]=(ans[0]+1)%mod;
        }
    }
    rep(i,0,mod-1) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 74880
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define index Index
#define Line pll
typedef long long LL;
int main(){
    int n;
    scanf("%d",&n);
    int a[200005];
    LL pre[200005];
    LL preans[200005];
    LL suf[200005];
    LL sufans[200005];
    pre[0]=preans[0]=0;
    for(int i=1;i<=n;i++)
    scanf("%d",&a[i]);
    for(int i=1;i<=n;i++){
        pre[i]=pre[i-1]+a[i];
        if(a[i]==0){
            preans[i]=preans[i-1]+2;
        }
        else{
            preans[i]=preans[i-1]+(a[i]&1);
        }
        preans[i]=min(preans[i],pre[i]);
      //  printf("%d ",preans[i]);
    }
   // printf("\n");
    suf[n+1]=sufans[n+1]=0;
    int tot=0;
    LL Min=0;
    LL ans=pre[n];
    for(int i=n;i>=1;i--){
        suf[i]=suf[i+1]+a[i];
        if(a[i]==0){
            sufans[i]=sufans[i+1]+2;
        }
        else{
            sufans[i]=sufans[i+1]+(a[i]&1);
        }
        sufans[i]=min(sufans[i],suf[i]);
        if(a[i]&1);
        else tot++;
        Min=min(Min,sufans[i]-tot);
        //printf("%d ")
        ans=min(ans,preans[i-1]+Min+tot);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 7296
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <chrono>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
#define itn int
#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define matrix vector<vector<ll>>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end())
#define mn(v) min_element(v.begin(), v.end())
#define dig(c) (c >=' 0' && c <= '9') ? 1 : 0
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); i++) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); i++) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); i++) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; i++){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000000000 + 228;
const ld PI = acos(-1.0);
const int mod7 = 1000000000 + 7;
const int mod9 = 1000000000 + 9;
const int MAXN = 200005;
const ld EPS = 1e-10;
const int N = 300228;
ll hp = 29;
signed main()
{
	fastio();
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << a * b - c * b - d * a + c * d;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

ll modp(ll n) {
	ll tmp = n % mop2;
	if (tmp < 0) {
		tmp += mop2;
	}
	return tmp;
}

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	vector<vector<ll>> dp;
	dp.resize(c+1);
	for (ll i = 0; i < c + 1; i++) {
		dp[i].resize(d + 1);
	}
	/*for (ll i = 0; i <= c; i++) {
		for (ll j = 0; j <= d; j++) {
			if (i < a || j < b) {
				dp[i][j] = -1;
			}
		}
	}*/
	dp[a][b] = 1;
	for (ll i = a + 1; i <= c; i++) {
		dp[i][b] = dp[i - 1][b] * b;
		dp[i][b] = modp(dp[i][b]);
	}
	for (ll j = b + 1; j <= d; j++) {
		dp[a][j] = dp[a][j - 1] * a;
		dp[a][j] = modp(dp[a][j]);
	}
	for (ll i = a + 1; i <= c; i++) {
		for (ll j = b + 1; j <= d; j++) {
			dp[i][j] = modp(dp[i][j - 1] * (i - 1)) + modp(dp[i - 1][j] * (j - 1)) + modp(dp[i][j - 1] + dp[i - 1][j]) - modp(dp[i - 1][j - 1] * (i - 1)*(j - 1));
			dp[i][j] = modp(dp[i][j]);
		}
	}
	cout << dp[c][d] << endl;
}


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

int main(){
	long long unsigned int a, b, gcd, lcm, x, y, r;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

Measured memory_bytes: 1152