akhauriyash/Code-Regression huggingface dataset:
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007


template <class T>
void print(vector<T> arr)
{
	cout << "start printing the vector\n";
	for (auto u : arr)
		cout << u << " ";
	cout << "\n";
}

template <class T>
void print_mat(vector<vector<T>> a)
{
	cout << "start printing the matrix\n";
	for (auto v : a)
	{
		for (auto e : v)
		{
			cout << e << " ";
		}
		cout << "\n";
	}
}

/******************************************
* NUMBER THEORY ;) *
******************************************/



ll powermod(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}
ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i)
			res = (res * i) % mod;
		n /= mod;
	}
	res %= mod;
	return res;
}



void solve()
{
	ll n, k;
	cin >> n >> k;
	vll arr(n);
	for (ll i = 0; i < n; i++)
		cin >> arr[i];
	for (ll i = k; i < n; i++)
	{
		if (arr[i] > arr[i - k])
		{
			cout << "Yes\n";
		}
		else
		{
			cout << "No\n";
		}
	}

}

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// ll t;
	// cin >> t;
	// while (t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 4780
n = int(input())
a_L = list(map(int,input().split()))


if len(a_L) == 1:
    print(0)
    exit()

ans = 0
for i in range(0,len(a_L)-1):
    if a_L[i] > a_L[i+1]:
        ans += abs(a_L[i+1] - a_L[i])
        a_L[i+1] = a_L[i]


if a_L[-2] > a_L[-1]:
    ans += abs(a_L[-1]-a_L[-2])
print(ans)

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

bool prime(int n){
  if(n==1) return false;
  if(n==2) return true;
  if(n%2==0) return false;
  
  double s=sqrt(n);
  if(n%2==1){
    for(int i=3;i<=s;i++){
      if(n%i==0) return false;
    }
  }
  return true;
}

int main(){
  int X;
  cin>>X;
  while(1){
    if(prime(X)) break;
    else X++;
  }
  cout<<X<<endl;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let X: usize = read();
    let Y: usize = read();
    let A: usize = read();
    let B: usize = read();
    let C: usize = read();
    let mut As: Vec<usize> = (0..A).map(|_| read()).collect();
    As.sort();
    As.reverse();
    let mut Bs: Vec<usize> = (0..B).map(|_| read()).collect();
    Bs.sort();
    Bs.reverse();
    let Cs: Vec<usize> = (0..C).map(|_| read()).collect();
    let mut all: Vec<usize> = Cs;
    all.extend_from_slice(&As[0..X]);
    all.extend_from_slice(&Bs[0..Y]);
    all.sort();
    all.reverse();
    let ans: usize = all[0..X + Y].iter().sum();
    println!("{}", ans)
}


Measured memory_bytes: 7012
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>
 
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cassert>
 
using namespace std;
 
#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)
 
#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
	int N;
	cin >> N;
	vector<int> A(N), B;
	rep(i,N) cin >> A[i];
	sort(all(A));

	for(int i = 0; i+1 < N;) {
		if(A[i] == A[i+1]) {
			B.push_back(A[i]);
			i += 2;
		}
		else {
			i += 1;
		}
	}

	if(B.size() < 2)
		cout << 0 << endl;
	else {
		reverse(all(B));
		cout << (ll)B[0] * B[1] << endl;
	}
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    ll m1, d1, m2, d2;
    cin>>m1>>d1>>m2>>d2;
    if(d1+1 != d2){
        print(1);
    }
    else print(0);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        
    
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scanner()
	t := Scanner()
	if len(t) == len(s)+1 && t[:len(t)-1] == s {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 1760
#include <stdio.h>

int main(void) {
    int i, max, j, x, y, n;
    int a1, b1, a2, b2;
    scanf("%d%d%d",&x, &y, &n);
    while(n) {
        max = 0;
        for(i = 1; i < n; i++ ) {
            a1 = i * (100 + x) / 100;
            a2 = i * (100 + y) / 100;
            for(j = 1; j < n; j++ ) {
                b1 = j * (100 + x) / 100;
                b2 = j * (100 + y) / 100;
                if(a1 + b1 == n) {
                    if(max < a2 + b2) {
                        max = a2 + b2;
                    }
                }
            }
        }
        printf("%d\n",max);
        scanf("%d%d%d",&x ,&y, &n);
    }
    return 0;
}

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

using namespace std;
 
void Display(int num, int time) {
	string res = "";
	string s = to_string(num);

	for (int i = 0; i < time; i++) {
		res += s;
	}
	cout << res << endl;
}

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

	if (a > b) {
		Display(b, a);
	} else {
		Display(a, b);
	}

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int main(){

	string a;
	
	while(getline(cin,a)){
		if(a=="END OF INPUT")
			break;
		else{
		int k=0;
		for(int i=0;i<a.size();i++){
			if(a[i]==' '){
				cout<<k;
				k=0;
			}
			else
				k++;
			
				
		}
		cout<<k<<endl;
		}
	}
	
}

Measured memory_bytes: 1184
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    long long  N;
    cin>>N;
    int M;
    M=sqrt(N);
    for(int i=M;i>=1;i--)
    if(N%i==0){cout<<i-2+(N/i)<<endl;break;}

}


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

void solve();
int judge(char, char, char);
void answer(int);
int line[8][3] = { {0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6} };
int result;
string board;

int main() {
    while (getline(cin, board)) {
        solve();
    }
    return 0;
}

void solve() {
    for (int i = 0; i < 8; i++) {
        result = judge(board[line[i][0]], board[line[i][1]], board[line[i][2]]);
        if (result) {
            answer(result);
            return;
        }
    }
    cout << "d" << endl;
    return;
}

int judge(char a, char b, char c) {
    if (a == 'o' && b == 'o' && c == 'o')return 2;
    if (a == 'x' && b == 'x' && c == 'x')return 1;
    return 0;
}

void answer(int result) {
    if (result == 2) cout << "o" << endl;
    if (result == 1) cout << "x" << endl;
    return;
}

Measured memory_bytes: 3132
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<cmath>
#include<algorithm>
using namespace std;
 
int n,k;
int ans[300011];
int main()
{
    int i,j;
    int xx;
    cin>>k>>n;
    
    if(k%2==0)
    {
        ans[1]=k/2;
        for(i=2;i<=n;i++)
        {
            ans[i]=k;
        }
    }
    else
    {
        xx=n/2;
        for(i=1;i<=n;i++)
        {
            ans[i]=k/2+1;
        }
        
        
        int u=n;
        for(i=1;i<=xx;i++)
        {
            //cout<<u<<"uuu"<<endl;
            ans[u]--;
            if(ans[u]>0)
            {
                 for(j=u+1;j<=n;j++)
                 {
                     ans[j]=k;
                 }
                 u=n;
            }
            else
            {
                u--;
            }
        }
    }
    
    
    for(i=1;i<=n;i++)
    {
         if(ans[i]>0)
         {
             if(i>1)
             {
                 cout<<' ';
             }
             cout<<ans[i];
         }
         else
         {
            break;
         }
    }
    cout<<endl;
    
    return 0;
}


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

int main() {
    vector<int> a(3);
    for (int i = 0; i < a.size(); i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << a[0] + a[1] << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,n,j;
	double a;
	vector<double> x;
	cin>>n;
	for(i=0;i<n;i++)
	{
       double tp1;
       cin>>tp1;
       x.push_back(tp1);
    }
    

    sort(x.begin(),x.end());
    for(i=0;i<n;i++)
    
   
    
	a = ((double)x[n-1] + (double)x[n-2])/((double)x[1] - (double)x[0]);
    for(i=0;i<3;i++)
    {
       for(j=0;j<3-i;j++)
      {
		 for(int k=0;k<n-2;k++)
		{
			if(k+1==n-1-i||k+2==n-1-i||k+1==n-2-i-j||k+2==n-2-i-j)
			continue;
			double b = (x[n-i-1] + x[n-2-j-i])/(x[k+2] - x[k+1]);
			if(b>a)
               
			    a = b;
			
			
		
		}	
	 }
	}
	 printf("%f\n",a);
	return 0;
}



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

public class Program
{
    public static void Main(string[] args)
    {
        var vals = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        Console.WriteLine(Lcm(vals[0], vals[1]));
    }

    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }

    public static long Gcd(long a, long b)
    {
        if (a < b)
        {
            return Gcd(b, a);
        }
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }
}

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

int main() {
  string s;
  cin >> s;
  vector<int> a(2, 0);

  if (s.at(0) == '0') {
    if (s.at(1) == '0') a.at(0) = 1;
    else a.at(0) = 2;
  }
  else if (s.at(0) == '1') {
    if (s.at(1) == '0' || s.at(1) == '1' || s.at(1) == '2') a.at(0) = 2;
    else a.at(0) = 1;
  }
  else a.at(0) = 1;

  if (s.at(2) == '0') {
    if (s.at(3) == '0') a.at(1) = 1;
    else a.at(1) = 2;
  }
  else if (s.at(2) == '1') {
    if (s.at(3) == '0' || s.at(3) == '1' || s.at(3) == '2') a.at(1) = 2;
    else a.at(1) = 1;
  }

  else a.at(1) = 1;
  if (a.at(0) == 2 && a.at(1) == 2) cout << "AMBIGUOUS" << endl;
  else if (a.at(0) == 1 && a.at(1) == 1) cout << "NA" << endl;
  else if (a.at(0) == 2) cout << "MMYY" << endl;
  else cout << "YYMM" << endl;
}

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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int perf = -1;
  for (int i = 2; i < X; i++) {
    int num = i * i;
    while (num <= X) {
      perf = std::max(perf, num);
      num *= i;
    }
  }
  if (perf == -1) perf = 1;

  cout << perf << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N;
  cin >> N;
  vector<pair<ll, ll>> Pi(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> Pi.at(i).first;
    Pi.at(i).second = i + 1;
  }
  sort(Pi.begin(), Pi.end(), greater<pair<ll, ll>>());

  ll ans = 0;
  multiset<ll> st = {0, 0, N + 1, N + 1};
  for (ll i = 0; i < N; i++)
  {
    ll p = Pi.at(i).first;
    ll c = Pi.at(i).second;
    st.emplace(c);
    auto it = st.lower_bound(c);
    it--;
    ll l1 = *it;
    it--;
    ll l0 = *it;
    it++, it++;
    it++;
    ll r0 = *it;
    it++;
    ll r1 = *it;

    ll tmp = p * ((l1 - l0) * (r0 - c) + (c - l1) * (r1 - r0));
    ans += tmp;
  }
  cout << ans << endl;
}

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

using namespace std;

const int N = 1000006;
bool p[N];
vector <int> a;

int main() {
    for (int i = 2; i <= sqrt(N); i++) {
        if (!p[i]) {
            for (int j = i * i; j < N; j += i) {
                p[j] = true;
            }
            
        }
    }
  for (int i = 2; i < N; i++) {
    if (!p[i]) {
      a.emplace_back(i);
    }
  }
    long long A, B;
    cin >> A >> B;
    int res = 0;
    for (auto x: a) {
        if (A % x == 0) {
            res += (B % x == 0);
            while (A % x == 0) {
                A /= x;
            }
        }

    }
    if (A > 1 && B % A == 0) res++;
    cout << res + 1;
	return 0;
}


Measured memory_bytes: 1916
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    vi v;
    int x;
    for(int i = 0; i < n; i++){
        cin >> x;
        v.pb(x);
    }
    vi a;
    int cnt = 0;
    for(int i = 1; i < v.size(); i++){
        if(v[i-1]>=v[i]) cnt++;
        else{
            if(cnt!=0) a.pb(cnt);
            cnt = 0;
        }
        if(cnt!=0) a.pb(cnt);
    }
    sort(all(a));
    if(a.size()!=0) cout << a[a.size()-1];
    else cout << 0;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

int main()
{
    string s, t;
    cin >> s >> t;
    bool ok = true;
    for (size_t i = 0; i < s.size(); i++)
    {
        ok &= s[i] == t[i];
    }
    

    string ans = ok ? "Yes" : "No";
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
import numpy as np

book_number, algorithm_number, target = map(int, input().split())
price_array = []
book_array = []

for i in range(book_number):
    tmp = list(map(int, input().split()))
    price_array.append(tmp[0])
    book_array.append(tmp[1:len(tmp)])
ans_array = []
for i in range(1, 2**book_number):
    price_bags = []
    book_bags = []
    for j in range(book_number):
        if((i >> j) & 1):
            price_bags.append(price_array[j])
            book_bags.append(np.array(book_array[j]))

    if all(num >= target for num in sum(book_bags)):
        ans_array.append(sum(price_bags))

if len(ans_array) == 0:
    print(-1)
else:
    print(min(ans_array))


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N,M;
  cin>>N>>M;
  vector<bool>ok(N,true);
  for(int i=0;i<M;i++){
    int a;
    cin>>a;
    ok[a]=false;
  }
  vector<ll>dp(N+1,0);
  dp[0]=1;
  for(int i=0;i<N;i++){
    if(i+1<=N&&ok[i+1])dp[i+1]=(dp[i+1]+dp[i])%MOD;
    if(i+2<=N&&ok[i+2])dp[i+2]=(dp[i+2]+dp[i])%MOD;
  }
  cout<<dp[N]<<endl;
  return 0;
}


Measured memory_bytes: 1024
n, m = [int(i) for i in input().split()]
matrix = [map(int, input().split()) for _ in range(n)]
vector = [int(input()) for _ in range(m)]

ans = [0] * n

for i in range(n):
    res = 0
    for a, b in zip(matrix[i], vector):
        res += a * b
    ans[i] = res

print(*ans, sep="\n")



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

int main() {
	int a, b, s;
	cin >> a >> b;
	int i = 0;
	for (s = a;s <= b;s++) {
		int t = s % 10, u = s / 10000, p = s / 10 % 10, q = s / 1000 % 10;
		if (t == u && p == q)i++;
	}
	cout << i << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int main()
{
	int p[128], n;
	cin >> n;
	int m = n * (n - 1) / 2;

	CLEAR(p, 0);
	while (m--)
	{
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		--a, --b;
		if (c > d)
			p[a] += 3;
		else if (c == d)
			++p[a], ++p[b];
		else
			p[b] += 3;
	}

	int rank[128];
	for (int r = 1; r <= n; )
	{
		int maxi = *max_element(p, p + n);
		int teams = 0;
		for (int i = 0; i < n; ++i)
		{
			if (maxi == p[i])
			{
				rank[i] = r;
				p[i] = -1;
				++teams;
			}
		}
		r += teams;
	}
	for (int i = 0; i < n; ++i)
		cout << rank[i] << endl;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
    int N;
    int H[110];
    
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> H[i];
    
    int wall = H[0];
    int count = 0;
    for(int i = 0; i < N; ++i){
        if(wall <= H[i]){
            wall = H[i];
            ++count;
        }
    }
    
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int main()
{
	int a,b=0,c;
	cin >> a;// b >> c;
	for (int i = 1; i <= a; i++)b += i;
	cout <<b<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)
#define fb(i, a, b) for(int i = (a), _b = (b); i >= _b; i--)
#define pb push_back

typedef long long ll;
using namespace std;
typedef vector <int> vi;

int N;
const int Mx = 20005;
int p[Mx], a[Mx], b[Mx];

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    ff(i, 1, N) cin >> p[i];
    ff(i, 1, N) a[i] = i * Mx, b[i] = (N + 1 - i) * Mx;
    ff(i, 1, N) b[p[i]] += i;
    ff(i, 1, N) cout << a[i] << " "; cout << endl;
    ff(i, 1, N) cout << b[i] << " "; cout << endl;
    return 0;
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
const int MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
struct edge { int v, w; };

template <class Monoid>
struct segtree {
	using T = typename Monoid::T;
	int N;
	vector<T> a;
	segtree(const vector<T> &a0) {
		for (N = 1; N < a0.size(); N<<=1);
		a.resize(N<<1);
		copy(a0.begin(), a0.end(), a.begin() + N);
		for (int i = N - 1; i; i--)
			a[i] = Monoid::op(a[i<<1], a[i<<1 | 1]);
	}
	segtree(int N, const T &x = Monoid::id()) :
		segtree(vector<T>(N, x)) {}
	T get(int l, int r) {
		T xl = Monoid::id(), xr = Monoid::id();
		for (l += N, r += N; l < r; l>>=1, r>>=1) {
			if (l & 1) xl = Monoid::op(xl, a[l++]);
			if (r & 1) xr = Monoid::op(a[--r], xr);
		}
		return Monoid::op(xl, xr);
	}
	void set(int i, const T &x) {
		a[i += N] = x;
		while (i>>=1) a[i] = Monoid::op(a[i<<1], a[i<<1 | 1]);
	}
};

struct monoid {
	using T = int;
	static T id() { return 0; }
	static T op(const T &l, const T &r) {
		return max(l, r);
	}
};

int main() {
	int xs, ys, xt, yt;
	cin >> xs >> ys >> xt >> yt;
	int N; cin >> N;
	vector<int> x(N), y(N);
	rep(i, N) scanf("%d%d", &x[i], &y[i]);
	if (xs > xt) {
		xs *= -1, xt *= -1;
		rep(i, N) x[i] *= -1;
	}
	if (ys > yt) {
		ys *= -1, yt *= -1;
		rep(i, N) y[i] *= -1;
	}
	vector<i_i> xy;
	rep(i, N)
		if (xs <= x[i] && x[i] <= xt && ys <= y[i] && y[i] <= yt)
			xy.pb(i_i(x[i], y[i]));
	sort(xy.begin(), xy.end());
	vector<int> z;
	for (i_i p: xy) z.pb(p.second);
	N = z.size();
	vector<int> Z = z;
	sort(Z.begin(), Z.end());
	rep(i, N) z[i] = lower_bound(Z.begin(), Z.end(), z[i]) - Z.begin();
	segtree<monoid> st(N);
	int ma = 0;
	rep(i, N) {
		int k = st.get(0, z[i]) + 1;
		st.set(z[i], k);
		ma = max(ma, k);
	}
	double ans = (xt - xs + yt - ys) * 100.0;
	if (ma == min(xt - xs, yt - ys) + 1) {
		ans += (ma - 1) * 20 * (M_PI/4 - 1);
		ans += 20 * (M_PI/2 - 1);
	}
	else ans += ma * 20 * (M_PI/4 - 1);
	printf("%.15f\n", ans);
}


Measured memory_bytes: 8048
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum(Node x){
  while(x->left!=NIL)
    x =x->left;
    return x;
}
 
Node treeMaximum(Node x){
  while(x->right != NIL)
    x = x->right;
    return x;
}
 
Node treeSearch(Node u, int k){
  while(u!=NIL && k!=u->key){
 
  if(k < u->key) u=u->left;
 
  else u=u->right;
  }
  return u;
   
}
 
Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
 
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL || z->right==NIL) y = z;
  else y = treeSuccessor(z);
 
  if(y->left != NIL) x=y->left;
  else x = y->right;
 
  if(x!=NIL) x->parent = y->parent;
  if(y->parent==NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right =x;
   
  if(y!= z) z->key = y->key;
  free(y);
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x!=NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y==NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}
 
void inorder(Node u){
  if(u == NIL)return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
   
}
void preorder(Node u){
  if(u ==NIL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
   
}
 
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}


Measured memory_bytes: 20452
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  int a[3][3];
  string ans = "No";
  for(int i = 0;i<3;i++){
    for(int j = 0;j<3;j++){
        cin >> a[i][j];
    }
  }
  cin >> n;
  for(int k = 0;k<n;k++){
    cin >> x;
    for(int i = 0;i<3;i++){
    	for(int j = 0;j<3;j++){
     	   if(x == a[i][j]){
             a[i][j] = 0;
           }
        }
    }
  }
  for(int i = 0;i<3;i++){
    if(0 == a[i][0] &&0 == a[i][1] &&0 == a[i][2])ans = "Yes";
  }
  for(int i = 0;i<3;i++){
    if(0 == a[0][i] &&0 == a[1][i] &&0 == a[2][i])ans = "Yes";
  }
  if(0 == a[0][0] &&0 == a[1][1] &&0 == a[2][2])ans = "Yes";
  if(0 == a[0][2] &&0 == a[1][1] &&0 == a[2][0])ans = "Yes";
  cout << ans << endl;
}

Measured memory_bytes: 256
exp  = input().split()
stk = []

for i in exp :
    if i in ('+', '-', '*') :
        num1 = stk.pop()
        num2 = stk.pop()
        
        if i == '+' :
            stk.append(str(int(num1) + int(num2)))
        elif i == '-' :
            stk.append(str(int(num2) - int(num1)))
        else :
            stk.append(str(int(num2) * int(num1)))            
    else :
        stk.append(i)
        
print(stk.pop())


Measured memory_bytes: 5600
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
    ll N;   cin >> N;
    ll *g = new ll[N+1];

    for (int i = 2; i <= N; i++) {
        int k = i;
        for (int j = 2; j <= N; j++) {
            while (k % j == 0) {
                k /= j;
                g[j]++;
            }
        }
    }

    ll inf = 1000000007;
    ll ans = 1;

    for (int i = 2; i <= N; i++) {
        ans *= g[i]+1;
        ans %= inf;
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  ll ans=0;
  int n; cin >> n;
  REP(i,n+1) {
    if (i%3==0 || i%5==0) continue;
    ans+=i;
  }
  COUT(ans);
  return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)


void solve() {
}

int main() {
    string abc;
    bool isabc[3] = {false, false, false};
    cin >> abc;
    REP(i, 3) {
        switch (abc[i]) {
            case 'a':
                isabc[0] = true;
                break;
            case 'b':
                isabc[1] = true;
                break;
            case 'c':
                isabc[2] = true;
                break;
            default:
                break;
        }
    }
    REP(i, 3) {
        if (!isabc[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>

using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  if (A >= 13)
    cout << B << endl;
  else if (6 <= A && A <= 12)
    cout << B/2 << endl;
  else
    cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;

const double PI = 3.141592653589793;
const ll mod = 1e9 + 7;

int main() {
	// fios;
	ll n, k;
	cin >> n >> k;

	ll ans = 0;
	while(k <= n+1) {
		ans = (ans + k*(n-k+1) + 1) % mod;
		k++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cstdio>
using namespace std;
const int N=100005;
int a[N],b[N],c[N*2],fa[N];
bool u[N];
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int main(){
	int n,m=0;
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),a[0]^=a[i];
	for (int i=1;i<=n;i++) scanf("%d",&b[i]),b[0]^=b[i];
	for (int i=1;i<=n;i++)
		if (a[i]!=b[i]) a[++m]=a[i],b[m]=b[i];
	n=m;
	for (int i=0;i<=n;i++) c[i]=a[i],c[n+1+i]=b[i];
	sort(c,c+n+1);
	sort(c+n+1,c+n+n+2);
	for (int i=0;i<=n;i++)
		if (c[i]!=c[n+1+i]){
			printf("-1\n");
			return 0;
		}
	m=unique(c,c+n+1)-c-1;
	for (int i=0;i<=m;i++) fa[i]=i;
	for (int i=0;i<=n;i++){
		a[i]=lower_bound(c,c+m+1,a[i])-c;
		b[i]=lower_bound(c,c+m+1,b[i])-c;
		fa[find(a[i])]=find(b[i]);
	}
	int ans=n;
	for (int i=0;i<=m;i++)
		if (find(i)==i) ans++;
	printf("%d\n",ans-1);
}

Measured memory_bytes: 3712
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num1 = scan.nextInt();
        int num2 = scan.nextInt();  
        if (num1 <= num2) {
            System.out.println("unsafe");
        }
        else {
            System.out.println("safe");
        }
        scan.close();
    }
}

Measured memory_bytes: 35736
import java.io.*;
import java.util.*;
import java.util.stream.*;

class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int m = saori.saori_hayami();
		int[] a = new int[n];
		double sum = 0;
		for(int i = 0;i < n;i++){
			a[i] = saori.saori_hayami();
			sum += a[i];
		}
		//System.out.println(sum);
		double num2 = sum/(4*m);

		Arrays.sort(a);
		int ans = 0;
		for(int i = n-1;i >= 0;i--){
			
			if(num2 <= a[i]){
				ans++;
			}
		}
		
		if(ans >= m){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23252
s=input()
a=True
if s[0]!='A':
#Sの先頭の文字は大文字の A である。
    a=False

s2=s[2:-1]
if s2.count('C')!=1:
#Sの先頭から3文字目と末尾から2文字目の間（両端含む）に
# 大文字の C がちょうど1個含まれる
    a=False

s3=s.replace('C','c',1)
s3=s3.replace('A','a',1)
if s3.islower()==False:
#以上の A, C を除くSのすべての文字は小文字
    a=False

if a==True:
    print('AC')
else:
    print('WA')

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

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  
  int sum = 0;
  for(int i = 1; i <= n; i++){
    int tmp = i;
    int tmpSum = 0;
    while(tmp>0){
      tmpSum += tmp%10;
      tmp /= 10;
    }
    if(a<=tmpSum && tmpSum<=b) sum += i;
  }
  cout << sum << endl;
}

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

using namespace std;

int getScore[100000];

void hawawa()
{
	int h, w, d;
	pair<int, int> score[90000];

	cin >> h >> w >> d;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int num;
			cin >> num;
			num--;
			score[num] = make_pair(i, j);
		}
	}
	
	for (int i = d; i <= h * w; i++) {
		getScore[i] = getScore[i - d] + abs(score[i].first - score[i - d].first) + abs(score[i].second - score[i - d].second);
	}
	
	int q;
	cin >> q;
	while (q--) {
		int l, r;
		cin >> l >> r;
		cout << getScore[r - 1] - getScore[l - 1] << "\n";
	}
}

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


Measured memory_bytes: 2176
s = input()
da = 'abcdefghijklmnopqrstuvwxyz'
flag = True
for i in da:
  for j in s:
    if j == i:
      flag = False
  if flag:
    print(i)
    flag = False
    break
  else:
    flag = True
if flag:
  print('None')


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

#define gc() getchar()

#define ri register int 

#define ll long long

using std::cout;
using std::bitset;


inline int read()
{
	int ret=0;char ch=gc();
	while(!isdigit(ch))ch=gc();
	while(isdigit(ch))
	{
		ret=ret*10+ch-'0';
		ch=gc();
	}
	return ret;
}

const int MOD=1e9+7;

inline ll pm(ll a,ll x)
{
	ll ret=1;
	while(x)
	{
		if(x&1)ret=ret*a%MOD;
		a=a*a%MOD;
		x>>=1;
	}
	return ret;
}

int n,x,y,z,S,ac;
int h[1<<17];

int f[41][1<<17];
inline void add(int &x,int y){x=(x+y)%MOD;}
inline void shift(int i,int j)
{
	for(ri k=1,jj;k<=10;++k)
	{
		jj=j+(1<<h[j]+k-1);
		while(jj>S)
		{
			while(!(jj&1))jj>>=1;
			jj>>=1;
		}
		if((jj&ac)!=ac)add(f[i+1][jj],f[i][j]);
	}
}

int main()
{
//	freopen("in.in","r",stdin);
	
	n=read();
	x=read();
	y=read();
	z=read();
	
	S=(1<<x+y+z)-1;
	for(ri i=1;i<=S;++i)
		h[i]=h[i>>1]+1;
	
	ac+=1<<x-1;
	ac+=1<<h[ac]+y-1;
	ac+=1<<h[ac]+z-1;
	
	f[0][0]=1;
	for(ri i=0;i<n;++i)
		for(ri j=0;j<=S;++j)if(f[i][j])
			shift(i,j);
	
	ri ans=0;
	for(ri j=0;j<=S;++j)
		add(ans,f[n][j]);
	printf("%d\n",(pm(10,n)-ans+MOD)%MOD);
	
	return 0;
}

Measured memory_bytes: 22904
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>

using namespace std;

#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main() {
    long double L;
    cin >> L;
    L /= 3;
    printf("%Lf\n", L * L * L);

    return 0;
}

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

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
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 << "\t|";
    __f(comma + 1, args...);
}


#define print(x) for(auto it : x) cout<< it << " "; cout << endl;
typedef long long ll;
typedef unsigned long long ull;

const int MOD = 1e9 + 7;
ll mod(ll a) {
    return (ll) (a % MOD + MOD) % MOD;
}

ll mul(ll a, ll b) {
    return (ll) mod(mod(a) * mod(b));
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<ll>pos;
    vector<ll>neg;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(x>0)
            pos.push_back(x);
        else
            neg.push_back(x);
    }
    ll ans=1;
    if((int)pos.size()){
        if(k%2){
            sort(pos.begin(),pos.end());
            ans=mul(ans,pos.back());
            pos.pop_back();
            --k;
        }
        vector<ll>ok;
        sort(pos.begin(),pos.end(),greater<>());
        sort(neg.begin(),neg.end());
        for(int i=0;i+1<(int)pos.size();i+=2)
            ok.push_back(pos[i]*pos[i+1]);
        for(int i=0;i+1<(int)neg.size();i+=2)
            ok.push_back(neg[i]*neg[i+1]);
        if((int)pos.size()%2 && (int)neg.size()%2)
            ok.push_back(pos.back()*neg.back());
        sort(ok.begin(),ok.end(),greater<>());
        for(int i=0;i<(k/2);i++)
            ans=mul(ans,ok[i]);
        cout<<ans;
    }
    else{
        sort(neg.begin(),neg.end());
        if(k%2)
            reverse(neg.begin(),neg.end());
        for(int i=0;i<k;i++)
            ans=mul(ans,neg[i]);
        cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 6492
import sys
m, d = map(int, input().split())

if d < 22:
    print(0)
    sys.exit(0)

res = 0
for i in range(1, m+1):
    for j in range(22, d+1):
        if j//10 > 1 and j%10 >1:
            if (j//10) * (j%10) == i:
                res += 1
print(res)

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    ll x, y;
    cin >> x >> y;

    int cnt = 0;
    while (x <= y)
    {
        x *= 2;
        cnt++;
    }
    OP(cnt);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define per(i,b,a) for(int i=b; i>=a; i--)
#define pb push_back
#define fi first
#define se second
using namespace std ;
typedef pair<int, int> pi ;
typedef vector<pair<int,int> > vpi ;
typedef vector<int> vi ;
typedef long long ll ;
const int mod = 998244353 ;
const int inf = 1e9 + 5;
ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
const int maxn = 3e3 + 5 ;
int n ;
double p[maxn] ;
double dp[maxn][maxn] ;
int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cin >> n ;
    rep(i,0,n-1)
    {
        cin >> p[i] ;
    }
    dp[0][1] = p[0] ;
    dp[0][0] = 1 - p[0] ;
    rep(i,1,n-1)
    {
        rep(j,0,n)
        {
            if(j > 0)
              dp[i][j] += p[i]*dp[i-1][j-1] ;
            dp[i][j] += (1 - p[i])*dp[i-1][j] ;
        }
    }
    double res = 0.0 ;
    rep(i,(n+1)/2,n)
    {
        res += dp[n-1][i] ;
    }
    cout << fixed << setprecision(10) ;
    cout << res << "\n" ;
    return 0 ;
}


Measured memory_bytes: 70656
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

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

    int ans = 0;
    if(K == 1) ans = 0;
    else ans = N - K;
    cout << ans << endl;

    return 0;
}

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

    # 始点と終点を追加
    A = [0] + A
    A = A + [0]
    cum_map = dict()

    cum_map[(0, 0)] = 0
    for k in range(1, N + 1):
        cum_map[(0, k)] = cum_map[(0, k - 1)] + abs(A[k] - A[k - 1])

    for i in range(1, N + 1):
        if i == 1:
            d = abs(A[i + 1] - A[0]) + cum_map[(0, N)] - cum_map[
                (0, i + 1)] + abs(A[N] - A[0])
        elif i == N:
            d = abs(A[N - 1] - A[0]) + cum_map[(0, N - 1)]
        else:
            d = cum_map[(0, i - 1)] + abs(A[N] - A[0]) \
                + abs(A[i + 1] - A[i - 1]) \
                + (cum_map[(0, N)] - cum_map[(0, i + 1)])
        print(d)


Measured memory_bytes: 29160
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;


void main()
{
  auto s = readln.chomp;
  if (s.length % 2) s.length -= 1;
  else s.length -= 2;
  while (s[0..s.length/2] != s[s.length/2..$]) {
    s.length -= 2;
  }
  writeln(s.length);
}


Measured memory_bytes: 256
s = list(input())
k = int(input())

n = len(s)
su = 0
res = "0"
t = 0
for i in range(n):
    if s[i] == "1":
        t += 1
        if t == k:
            res = "1"
            break
    else:
        res = s[i]
        break
print(res)

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

int main() {
	int N , K , min = 1 , cnt = 0;
	cin >> N;
	cin >> K;
	while(1){
		if(cnt == N){
			break;
		}
		if(min * 2 <= min + K){
			min *= 2;
			cnt++;
		}
		else{
			break;
		}
	}  
	while(1){
		if(cnt == N){
			break;
		}
		min += K;
		cnt++;
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
import fileinput as fi
if __name__ == "__main__":
    for line in  fi.input():
        a,b,c,d,e,f = list(map(int,line.strip().split()))
        x1 = (c*e -b*f)
        x2= (a*e - b*d)
        if x2< 0:
            x1 = -x1
            x2= -x2
        y1 = (c*d - a*f)
        y2= (b*d - a*e)
        if y2 <0:
            y1= -y1
            y2 = -y2
        print("%.3f %.3f" % (x1/x2,y1/y2))

Measured memory_bytes: 7580
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main()
{
    char x, y;
    cin >> x >> y;
    if (x < y) cout << "<" << endl;
    else if (x == y) cout << "=" << endl;
    else cout << ">" << endl;
}

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

int main()
{
    int height, width;
    string line;

    cin >> height >> width;
    cin.ignore();

    char maze[height][width];

    for (int i = 0; i < height; i++)
    {
        getline(cin, line);
        // cout << "a" << '\n';
        for (int j = 0; j < width; j++)
        {
            maze[i][j] = line[j];
        }
    }

    for (int i = 0; i < height; i++)
    {
        string tmp = "";
        for (int j = 0; j < width; j++)
        {
            // cout << maze[i][j];
            tmp += maze[i][j];
        }
        // cout << endl;
        cout << tmp << '\n';
        cout << tmp << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long w = long.Parse(input[1]);
    long[,] vertexes = new long[n,2];//ここに受け取る
    long[,,] dp = new long[n+1,n+1,3*n+1];//dp[見た数、とった数、超過の重さ] = 価値の最大値
    long answer = 0;
    for(long i = 0; i < n; i++)
    {
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);//１行ごとに受け取る
      vertexes[i,0] = nums[0];
      vertexes[i,1] = nums[1];
    }

    for(int i = 1; i <= n; i++)
    {
      for(int j = 0; j <= n; j++)
      {
        for(int k = 0; k <= 3*n; k++)
        {
          dp[i,j,k] = dp[i-1,j,k];//取らない場合
          if(j-1 >= 0 && k-(vertexes[i-1,0]-vertexes[0,0]) >= 0)
          {
            dp[i,j,k] = 
              Math.Max(dp[i,j,k],dp[i-1,j-1,k-(vertexes[i-1,0]-vertexes[0,0])] + vertexes[i-1,1]);
          }
        }
      }
    }
    
    for(int i = 0; i <= n; i++)
    {
      for(int j = 0; j <= n; j++)
      {
        for(int k = 0; k <= 3*n; k++)
        {
          if(vertexes[0,0]*j + k <= w)
            answer = Math.Max(dp[i,j,k], answer);
        }
      }
    }
    
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 34656