akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N, M;
	bool ans = false;
	cin >> N >> M;
	vector<vector<int>> E(N + 1);
	for (int i = 1; i <= M; i++) {
		int a, b;
		cin >> a >> b;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	for (int L : E.at(1)) {
        for (int i = 0; i < E[L].size(); i++) {
            if (E[L][i] == N) {
                ans = true;
            }
        }
    }
	cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}

Measured memory_bytes: 12528
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int, int>;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2], R[MAX/2+2];
int cnt;

void merge(int A[], int n, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) L[i] = A[left+i];
    for (int i = 0; i < n2; i++) R[i] = A[mid+i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
        }
    }
}

void mergeSort(int A[], int n, int left, int right) {
    if (left+1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main() {
    int A[MAX], n, i;
    cnt = 0;

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

    mergeSort(A, n, 0, n);

    for (i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;

    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 6980
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define all(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x,y)* mod_pow(kai(y,y), mod - 2, mod) % mod;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	int s = n / (a + b);
	int ans = 0;
	ans += s * a;
	ans += min(a, n % (a + b));
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 1; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;

ll n, ans;

int main() {
  cin >> n;
  n++;
  ans = 0;
  rep (i, n) {
    if (!(i % 3 == 0 || i % 5 == 0)) ans += i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
package main

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

var nmax = int(2*1e5 + 1)
var mod = 998244353
var fac = make([]int, nmax)
var inv = make([]int, nmax)
var finv = make([]int, nmax)

func initComb() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	for i := 2; i < nmax; 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
	}
}

func powMod(x, i int) int {
	if i == 0 {
		return 1
	}

	y := 1
	if i%2 != 0 {
		y = x
		i--
	}

	t := powMod(x, i/2)
	return y * t % mod * t % mod
}

func main() {
	n, m, k := readInt(), readInt(), readInt()

	initComb()

	ans := 0
	for i := 0; i <= k; i++ {
		ans += m * powMod(m-1, n-i-1) % mod * fac[n-1] % mod * finv[n-i-1] % mod * finv[i] % mod
		ans %= mod
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

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

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 6676
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

	int n,count=0;
	cin >> n;
	int tmp = n;
	for(int i = 0; i < 10; i++){
		count += n%10;
		n = n/10;
	}
	 if(tmp % count == 0){
	 	cout << "Yes" << endl;
	 }
	 else{
	 	cout << "No" <<endl;
	 }

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){
  int n,max=0,mlen=0,sums=0;
  cin >> n;
  int l[n];
  for(int i=0;i<n;i++){
    cin >> l[i];
    if(l[i] > max){
      max = l[i];
      mlen = i;
    }
  }
  for(int i=0;i<n;i++){
    if(i != mlen){
      sums += l[i];
    }
  }
  if(max < sums){
    cout << "Yes";
  }else{
    cout << "No";
  }
}


Measured memory_bytes: 256
import java.util.Scanner;


class Main
{ 
	int st[]; 
	int minVal(int x, int y) { 
		return (x < y) ? x : y; 
	} 

	 
	int getMid(int s, int e) { 
		return s + (e - s) / 2; 
	} 

	
	int RMQUtil(int ss, int se, int qs, int qe, int index) 
	{ 
		 
		if (qs <= ss && qe >= se) 
			return st[index]; 

		
		if (se < qs || ss > qe) 
			return Integer.MAX_VALUE; 

		 
		int mid = getMid(ss, se); 
		return minVal(RMQUtil(ss, mid, qs, qe, 2 * index + 1), 
				RMQUtil(mid + 1, se, qs, qe, 2 * index + 2)); 
	} 

	
	int RMQ(int n, int qs, int qe) 
	{ 
		
		if (qs < 0 || qe > n - 1 || qs > qe) { 
			System.out.println("Invalid Input"); 
			return -1; 
		} 

		return RMQUtil(0, n - 1, qs, qe, 0); 
	} 

	
	int constructSTUtil(int arr[], int ss, int se, int si) 
	{ 
		
		if (ss == se) { 
			st[si] = arr[ss]; 
			return arr[ss]; 
		} 

		
		int mid = getMid(ss, se); 
		st[si] = minVal(constructSTUtil(arr, ss, mid, si * 2 + 1), 
				constructSTUtil(arr, mid + 1, se, si * 2 + 2)); 
		return st[si]; 
	} 

	
	void constructST(int arr[], int n) 
	{ 
		 
		int x = (int) (Math.ceil(Math.log(n) / Math.log(2))); 

		
		int max_size = 2 * (int) Math.pow(2, x) - 1; 
		st = new int[max_size]; 

		 
		constructSTUtil(arr, 0, n - 1, 0); 
	} 

	 
	public static void main(String args[]) 
	{ 
		
		
		Scanner sc = new Scanner(System.in);
		String N = sc.next(); 
		String slide = sc.next();
		Main tree = new Main();
		int arr[] = new int[Integer.parseInt(N)];
		for(int i=0; i<Integer.parseInt(N); i++)
		{
			arr[i] = Integer.parseInt(sc.next());
		}
		
		tree.constructST(arr, Integer.parseInt(N));
		
		for(int i=0;i<=Integer.parseInt(N) - Integer.parseInt(slide);i++) {
			int result=tree.RMQ(Integer.parseInt(N), i, i+Integer.parseInt(slide)-1);
			if(i != (Integer.parseInt(N) - Integer.parseInt(slide))){
					System.out.print(result+" ");
				}else{
					System.out.println(result);
				}
		}
	} 
} 
 






Measured memory_bytes: 180508
fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let a: Vec<usize> = (0..n).map(|_| sc.read()).collect();
    let sum = a.iter().sum::<usize>();
    let unit = (n + 1) * n / 2;
    if sum % unit != 0 {
        println!("NO");
        return;
    }

    let turns = sum / unit;
    let mut b: Vec<i64> = vec![0; n];
    for i in 0..n {
        b[i] = a[(i + 1) % n] as i64 - a[i] as i64 - turns as i64;
    }

    for &b in &b {
        if b > 0 || (-b) % (n as i64) != 0 {
            println!("NO");
            return;
        }
    }
    println!("YES");
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner { ptr: 0, length: 0, buf: vec![0; 1024], small_cache: vec![0; 1024] }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool { b == b'\n' || b == b'\r' || b == b'\t' || b == b' ' }

    fn read<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug, {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)]).parse().unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}



Measured memory_bytes: 6524
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
    int c = 0;

    if (s[0] == 'o') c += 1;
    if (s[1] == 'o') c += 1;
    if (s[2] == 'o') c += 1;

    int n = 700 + 100 * c;

    cout << n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define array_input int n;cin>>n;int a[n+1],i;for(i=1;i<=n;i++){cin>>a[i];}
#define array_output for(i=1;i<=n;i++){cout<<a[i]<<" ";}cout<<endl;
#define INF 2147483647
#define long_INF 18446744073709551615
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
const double pi=acos(-1);
const double eps=1e-6;

void read(int &x)
{
    x=0;
	char c=getchar();
    while(c<'0' || c>'9')c=getchar();
    while(c>='0' && c<='9')
	{
        x=x*10+c-'0';
        c=getchar();
    }
}

void write(int x)
{
    if(x==0)
	{
		putchar(48);
		return;
	}
    int len=0,dg[20];
    while(x>0)
	{
		dg[++len]=x%10;
		x/=10;
	}
    for(int i=len;i>=1;i--)
	{
		putchar(dg[i]+48);
	}
}

int main()
{
	int a,b,x;
	cin>>a>>b>>x;
	if (a+b>=x && a<=x)
	{
		cout<<"YES"<<endl;
	}
	else
	{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  ll t=1;
  while(t--)
  {
    ll n;
    cin>>n;
    vector<pair<ll,ll>> v;
    ll x,y;
    REP(i,n)
    {
        cin>>x>>y;
        v.push_back({y,x});
    }
    sort(v.begin(),v.end());
    int time=0;
    for(auto i:v)
    {
        if(i.second + time > i.first)
        return cout<<"No",0;
        time+=i.second;
    }
    cout<<"Yes\n";
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

Measured memory_bytes: 7432
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }


ll c[4]; int want;

void run() {
	REP(i,4) scanf("%lld",&c[i]); scanf("%d",&want);
	FOR(i,1,4) c[i]=min(2*c[i-1],c[i]);
	ll ret=(want/2)*c[3]+(want%2)*c[2];
	printf("%lld\n",ret);
}

int main() {
	run();
	return 0;
}


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

int main(){
    double r;
    cin>>r;
    double area, cir;
    double pi=3.141592653589;
    area=pi*r*r;
    cir=2*pi*r;
    printf("%.5lf\n", area);
    cout<<" ";
    printf("%.5lf\n", cir);
}


Measured memory_bytes: 3204
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<limits.h>
#include<float.h>

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}


int main(){
	int n, m;
	int *x, *x_diff;
	int sum=0;
	scanf("%d%d\n", &n, &m);
	if(n>=m){
		printf("0\n");
		return 0;
	}
	x = (int*)malloc(sizeof(int) * m);
	x_diff = (int*)malloc(sizeof(int) * (m-1));
	for(int i=0; i<m; i++){
		scanf("%d", &x[i]);
	}
	qsort(x, m, sizeof(int), asc);
	for(int i=0; i<m-1; i++){
		x_diff[i] = x[i+1] - x[i];
	}
	qsort(x_diff, m-1, sizeof(int), asc);
	for(int i=0; i<m-n; i++){
		sum += x_diff[i];
	}
	printf("%d", sum);
	free(x);
	free(x_diff);
	return 0;
}

Measured memory_bytes: 1396
#include<stdio.h>
int main() {
	int a,b,r=1;
	scanf("%d%d",&a,&b);
	int j=a;
	while(j--) {
		if(r*2<=r+b)
			r*=2;
		else
			r+=b;
	}
	printf("%d",r);
	return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"os"
	"sort"
)

// {{{
// source: https://github.com/raahii/algo
func MaxInts(nums ...int) int {
	var maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxVal = e
		}
	}
	return maxVal
}

func MaxIntsWithIdx(nums ...int) (int, int) {
	var maxIdx, maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxIdx = i
			maxVal = e
		}
	}
	return maxVal, maxIdx
}

func MinInts(nums ...int) int {
	var minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minVal = e
		}
	}
	return minVal
}

func MinIntsWithIdx(nums ...int) (int, int) {
	var minIdx, minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minIdx = i
			minVal = e
		}
	}
	return minVal, minIdx
}

func SumInts(nums []int) int {
	s := 0
	for _, v := range nums {
		s += v
	}
	return s
}

func SumInts2d(mat [][]int) int {
	s := 0
	for _, nums := range mat {
		for _, v := range nums {
			s += v
		}
	}
	return s
}

func ReverseInts(nums []int) []int {
	rnums := make([]int, len(nums))
	for i := 0; i < len(nums); i++ {
		rnums[len(nums)-1-i] = nums[i]
	}
	return rnums
}

func ExtendInts(nums1 []int, nums2 []int) []int {
	for _, v := range nums2 {
		nums1 = append(nums1, v)
	}
	return nums1
}

func Ints2d(n_rows, n_cols int) [][]int {
	ints := make([][]int, n_rows)
	for i := 0; i < n_rows; i++ {
		ints[i] = make([]int, n_cols)
	}
	return ints
}

func StrInts2d(mat [][]int) string {
	str := ""
	for i := 0; i < len(mat); i++ {
		str += fmt.Sprintf("[%d", mat[i][0])
		for j := 1; j < len(mat[0]); j++ {
			str += fmt.Sprintf(" %d", mat[i][j])
		}
		str += "]"
		if i != len(mat)-1 {
			str += "\n"
		}
	}
	return str
}

func MemsetInts1d(nums []int, val int) {
	for i := range nums {
		nums[i] = val
	}
}

func MemsetInts2d(nums [][]int, val int) {
	for i := range nums {
		for j := range nums[i] {
			nums[i][j] = val
		}
	}
}

func ContainsInt(nums []int, num int) bool {
	sort.Ints(nums)

	s, e := 0, len(nums)
	for {
		if s >= e {
			break
		}

		m := (e + s) / 2
		if nums[m] == num {
			return true
		} else if num > nums[m] {
			s = m + 1
		} else {
			e = m
		}
	}

	return false
}

func ReadInt(f *os.File) int {
	var n int
	fmt.Fscanf(f, "%d", &n)
	return n
}

func ReadInts(f *os.File, n int) []int {
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%d", &nums[i])
	}
	return nums
}

func ScanInts(f *os.File, vars ...*int) {
	for i := 0; i < len(vars); i++ {
		fmt.Fscanf(f, "%d", vars[i])
	}
}

func ReadLine(f *os.File) string {
	var str string
	fmt.Fscanf(f, "%s", &str)

	return str
}

func ReadLines(f *os.File, n int) []string {
	lines := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%s", &lines[i])
	}

	return lines
}

func ReadWords(f *os.File, n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%s", &strs[i])
	}
	return strs
}

func Pow(a, n int) int {
	c := 1
	for i := 0; i < n; i++ {
		c *= a
	}
	return c
}

func Abs(n int) int {
	if n < 0 {
		return -n
	}

	return n
}

// }}}

func main() {
	var H, W int
	fmt.Scan(&H, &W)

	var h, w int
	fmt.Scan(&h, &w)

	fmt.Println((H - h) * (W - w))
}

Measured memory_bytes: 512
N = int(input())
S = [input() for i in range(N)]

ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    if S[i] == "AC":
        ac += 1
    elif S[i] == "WA":
        wa += 1
    elif S[i] == "TLE":
        tle += 1
    else:
        re += 1

print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

Measured memory_bytes: 16228
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool solve(){
  ll n;cin>>n;
  multiset<ll>problems;
  rep(i,n){
    ll d;cin>>d;
    problems.insert(d);
  }

  ll m;cin>>m;
  rep(i,m){
    ll d;
    cin>>d;
    if(problems.find(d)==problems.end()){
      cout<<"NO"<<endl;
      return false;
    }
    problems.erase(problems.find(d));
  }
  cout<<"YES"<<endl;

  return false;
}


signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M,T;
    cin >> N >> M >> T;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    int ans = 0;
    ans += A[0]-M;
    for(int i=0; i<N-1; i++){
        ans += max(0,A[i+1]-A[i]-2*M);
    }
    ans += max(0,T-A[N-1]-M);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pi 3.14159265358979
 
 
int main()
{
    int r,n,xl,xr,h;
    while(1==1)
    {
        scanf("%d %d\n",&r,&n);
        if(r==0)break;
        int hei[50]={};
        REP(i,n)
        {
            scanf("%d %d %d\n",&xl,&xr,&h);
            for(int j=xl+25;j<xr+25;j++)if(hei[j]<h)hei[j]=h;
        }
        double min=810;
        double dlen;
        REP(i,r)
        {
            dlen=hei[25+i];
            dlen+=r-sqrt(r*r-i*i);
            if(min>dlen)min=dlen;
        }
        REP(i,r)
        {
            dlen=hei[25-i-1];
            dlen+=r-sqrt(r*r-i*i);
            if(min>dlen)min=dlen;
        }
        printf("%f\n",min);
    }
    return 0;
}


Measured memory_bytes: 3204
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

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

struct Card {
    char suit;
    int num;
    Card(char s, int n) : suit(s), num(n) {}
    bool operator==(const Card& other) const { return suit == other.suit && num == other.num; }
};

void read_problem(vector<Card>& ary)
{
    int n;
    scanf("%d\n", &n);

    ary.reserve(n);
    REP(i, n) {
        char suit;
        int num;
        scanf("%c %d\n", &suit, &num);
        ary.emplace_back(suit, num);
    }
}

int part(vector<Card>& ary, int p, int r)
{
    Card pivot = ary[r];

    int i = p; // pivot ??\??????????´?????????\??????
    FOR(j, p, r) {
        if(ary[j].num <= pivot.num) {
            swap(ary[i], ary[j]);
            ++i;
        }
    }
    swap(ary[i], ary[r]);

    return i;
}

void quicksort(vector<Card>& ary, int p, int r)
{
    if(p < r) {
        int q = part(ary, p, r);
        quicksort(ary, p,   q-1);
        quicksort(ary, q+1, r);
    }
}

void merge(vector<Card>& ary, int start, int mid, int end)
{
    vector<Card> l(ary.begin()+start, ary.begin()+mid);
    vector<Card> r(ary.begin()+mid,   ary.begin()+end);
    int n1 = l.size();
    int n2 = r.size();

    int i = 0;
    int j = 0;
    FOR(k, start, end) {
        if(i == n1) {
            ary[k] = r[j++];
        }
        else if(j == n2) {
            ary[k] = l[i++];
        }
        else if(l[i].num <= r[j].num) {
            ary[k] = l[i++];
        }
        else {
            ary[k] = r[j++];
        }
    }
}

void mergesort(vector<Card>& ary, int start, int end)
{
    if(end - start >= 2) {
        int mid = (start + end) / 2;
        mergesort(ary, start, mid);
        mergesort(ary, mid,   end);
        merge(ary, start, mid, end);
    }
}

int main()
{
    vector<Card> ary;
    read_problem(ary);
    int n = ary.size();

    vector<Card> ary_stable(ary);
    quicksort(ary, 0, n-1);
    mergesort(ary_stable, 0, n);
    bool stable = ary == ary_stable;

    puts(stable ? "Stable" : "Not stable");
    REP(i, n) {
        printf("%c %d\n", ary[i].suit, ary[i].num);
    }

    return 0;
}

Measured memory_bytes: 4600
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int a, b;

int main(){
	cin >> a >> b;
	if (a < b){
		for (int i = 0; i < b; i++){
			cout << a;
		}
	}
	else{
		for (int i = 0; i < a; i++){
			cout << b;
		}
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main(void) {
	int n;
	int arr[200002];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}

	sort(arr, arr + n);
	
	int er = 0;
	for (int i = 0; i < n-1; i++) {
		if (arr[i] == arr[i + 1]) {
			er = 1;
			break;
		}
	}

	if (er) printf("NO");
	else printf("YES");
	return 0;
}

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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
def check(num):
  if num%2==1:
    if (num+1)/2%2==0:
      return 0
    else:
      return 1
  else:
    if num/2%2==0:
      return num
    else:
      return 1 ^ num

a = []
a = input().split(" ")
n = int(a[0])
m = int(a[1])
x = check(n-1) ^ check(m)
print(x)

Measured memory_bytes: 3060
# 0028
array = []
while True:
    try:
        a = input()
        array.append(int(a))
    except EOFError: break
s = set(array)
mx = max(sorted(s, reverse=True), key = array.count)
for a in sorted(s, key = array.count, reverse=True):
    print(a)
    if a == mx: break

Measured memory_bytes: 7612
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string s;
	cin>>n;
	vector<string>v;
	for(int i=0;i<n;i++)
	{
		cin>>s;
		v.push_back(s);
	}
	vector<string>temp=v;
	sort(temp.begin(),temp.end());
	temp.erase(unique(temp.begin(),temp.end()),temp.end());
	if(temp.size()!=v.size())
	{
	cout<<"No"<<endl;
	return 0;
	}
	for(int i=0;i<n-1;i++)
	{
		if(v[i].back()==v[i+1].front())
		continue;
		else
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
cout<<"Yes"<<endl;
return 0;
}


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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;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;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S=in<string>();
    ll K;K=0;
    map<string,bool> mp;
    string val;val="";    
    string val_;val_="";
    REP(i,S.size()){
        val=val+S[i];
        if(val!=val_){
            K++;
            val_=val;
            val="";
        }
    }
    print(K);
    return 0;
}


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

using namespace std;

#define INP "solve"
#define OUT "solve"

const int QQ = 3e5 + 10;
const int maxN = 1e6 + 10;
const int maxM = 3e5 + 10;
const long long oo = 1e15;
const int module = 1e9 + 7;
const long double du = 1e-9;

void doc() {
    freopen(INP ".inp","r",stdin);
    freopen(OUT ".out","w",stdout);
}

void add(int &a, int b) {
    a += b;
    if (a >= module) a -= module;
}
void solve() {
    int n;
    cin >> n;
    int a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) cin >> a[i][j];
    }
    int MaskN = 1 << n;
    int F[MaskN];
    memset(F, 0, sizeof(F));
    vector <int> adj[n + 1];
    for (int i = 1; i < MaskN; i++) {
        int SL = __builtin_popcount(i);
        adj[SL].push_back(i);
    }
    F[0] = 1;
    for (int i = 0; i < n; i++) {
        for (int mask : adj[i + 1]) {
            for (int j = 0; j < n; j++) {
                if (a[i][j]) {
                    int pre_mask = mask ^ (1 << j);
                    add(F[mask], F[pre_mask]);
                }
            }
        }
    }
    cout << F[MaskN - 1];
}
int main(int argc,char *argv[]) {
    //srand(time(nullptr));
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    ///doc();
    solve();
}


Measured memory_bytes: 20032
#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define FF first
#define SS second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repr for(i=n-1;i>=0;i--)
#define PLL pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define LP lower_bound
#define UP upper_bound
#define MP make_pair
#define rep1 for(i=1;i<=n;i++)
#define VLL vector<ll>
#define ef else if
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define UMP unordered_map
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll myXOR(unsigned long long int x, unsigned long long int y)
{
    return (x|y)&(~x|~y);
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
int main()
{
    fastio
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r, t,u,w,x,y,z;
    string str, ss, str1;
    /*
    **  author : mahiman12
    **  created : 2020-05-03 17:56 
    */
    cin>>x;
    map<ll,pair<ll,ll>>mp;
    // mp[0]=MP(0,0);
    // mp[1]=MP(1,0);
    rep(i,1,1001)
    {
        a = pow(i,5);
        mp[a] = make_pair(a,0);
        rep(j,1,i)
        {
            b = pow(j,5);
            // cout<<a<<" "<<b<<endl;
            mp[a-b] = make_pair(i,j);
            mp[a+b] = make_pair(i,-j);
        }
    }
    // for(auto &)
    auto it = mp.find(x);
    PLL pp = it->second;
    cout<<pp.first<<" "<<pp.second;
}

Measured memory_bytes: 66592
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
    ll n;
    cin >> n;
    ll res = 0, p, prev = 0;
    REP(i, n){
        cin >> p;
        if(p == i + 1 && !prev){
            res++;
            prev = 1;
        }
        else prev = 0;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]
 
use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;
 
use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;

    input!{
        n: usize,
        a_vec: [usize; n],
    }

    let mut min = a_vec[0];
    let mut cnt = 0;
    for a in a_vec.into_iter() {
        if a < min {
            cnt += min - a;
        } else {
            min = a;
        }
    }
    println!("{}", cnt)
}

fn main() {
    solve();
}


Measured memory_bytes: 5504
package main

import (
	"fmt"
)

func main() {
	var k, s, cnt int
	fmt.Scan(&k, &s)

	for x := 0; x <= k; x++ {
		for y := 0; y <= k; y++ {
			z := s - x - y
			if 0 <= z && z <= k {
				cnt++
			}
		}
	}

	fmt.Println(cnt)
}

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

int main()
{
 int count=0;
 string signal;
 cin>>signal;
 for(int i=0;i<4;++i){
  if(signal[i]=='+')count+=1;
  if(signal[i]=='-')count-=1;
}
 cout<<count<<endl;
}


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



int main () {
	string s;
	int x=0,max=0,l;

	cin >> l;
	cin >> s;

	for(int i=0;i<l;i++){
		if(s[i]=='I'){
			x++;
		}else{
			x--;
		}
		if(x > max){
			max = x;
		}

	}

	cout << max << endl;


    return 0;
}




Measured memory_bytes: 256
n, l = map(int, input().split())

eats = 999
is_minus = False

for i in range(n):
    azi = l + (i + 1) - 1

    if eats > abs(azi):
        eats = abs(azi)
        is_minus = True if azi < 0 else False


w = eats if is_minus == False else eats * -1

print(sum([l + (e + 1) - 1 for e in range(n)]) - w)



Measured memory_bytes: 3060
//DoomsDay861.

#include<bits/stdc++.h>
#include<time.h>
#define ll long long
#define testcase ll t;cin>>t;while(t--)
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
using namespace std::chrono;
//freopen("in.txt","r",stdin);
//freopen("output.ans","w",stdout);
// auto start = high_resolution_clock::now(); 
ll n;
cin >> n;
string s;
cin >> s;
ll count =0;
for(ll i =0;i<n;i++)
{
	if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
	count++;
}
cout << count <<endl;
//	auto stop = high_resolution_clock::now(); 
//    auto duration = duration_cast<seconds>(stop - start); 
//cout << "Time taken by function: "
//         << duration.count() << "seconds" << endl; 
  
    return 0; 
} 


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#define MOD 1000000007LL
using namespace std;

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a * b, c * d) << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import  math
from heapq import *
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N,K=nm()
R,S,P=nm()
d={'r':P,'s':R,'p':S}
T=list(ns())

ans=0
for i in range(K):
    cur=i
    pre=''
    while(cur<N):
        if(pre!=T[cur]):
            ans+=d[T[cur]]
            pre=T[cur]
        else:
            pre=''
        cur+=K

print(ans)
    


Measured memory_bytes: 6128
def solve(s, k):
    # 2^5000兆 >> 10^18 なので、sのk文字目までに1以外の数字xがあれば、k番目はxになる
    for i in range(min(k, len(s))):
        if s[i] != '1':
            return int(s[i])
    else:
        return 1

_s = input()
_k = int(input())
print(solve(_s, _k))

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する


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

    int N;

    cin >> N;

    bool flag = false;
    for(int i = 0; i < 100; ++i){
        for(int j = 0; j < 100; ++j){
            if(i * 4 + j * 7 == N) flag = true;
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i=a; i<(b); i++)

int a, b, c, k;

void solve(){
    while(k){
        if (b <= a){
            b *= 2;
        }
        else if (c <= b) {
            c *= 2;
        }
        if (c > b && b > a){
            cout << "Yes\n";
            return;
        }
        k--;
    }
    cout << "No\n";
}


int main(){
   	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> a >> b >> c;
    cin >> k;
    solve();
	return 0;
}
// C>B B>A   

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
  string A;
  cin >> A;
  if (A=="a"||A=="e"||A== "i"||A== "o"||A== "u") {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 9;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 1e5 + 5, SGM = 2;

int nxt[N][SGM], deg[N], lvl[N], sz;

void add(string &t) {
	int now = 0, h = 0;
	for (char c : t) {
		if (!nxt[now][c - '0']) nxt[now][c - '0'] = ++sz, deg[now]++;
		now = nxt[now][c - '0'];
		lvl[now] = ++h;
	}
}

int main() {
 
	sync;

	int n; cin >> n;
	ll l; cin >> l;
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		add(s);
	}
	ll G = 0;
	for (int i = 0; i <= sz; i++) {
		if (deg[i] != 1) continue;
		ll x = l - lvl[i];
		G ^= x & -x;
	}
	cout << (G == 0 ? "Bob" : "Alice") << endl;

	return 0;
}


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

// g++ -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -o 

int main(){
 ll n;
 cin>>n;
 ll k=7;
 ll ans=1;
 if(n%2==0 || n%5==0){
  cout<<"-1\n";
  return 0;
 }
 while(k%n){
  k*=10;
  k+=7;
  k%=n;
  ans++;
 }
 cout<<ans<<"\n";
 return 0;
}


Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<vector>
using lint=int64_t;
using namespace std;

lint N,Q;
vector<vector<lint>> edges;
lint qus[200010];
lint ans[200010];

void dfs(int cur,int prev,int sum)
{
	sum+=qus[cur];
	ans[cur]+=sum;

	for(auto&& i:edges[cur])
	{
		if(i==prev)
			continue;

		dfs(i,cur,sum);
	}
	return;
}

int main()
{
	cin >> N >> Q;
	edges.resize(N);

	for(int i=0;i<N-1;i++)
	{
		lint a,b;
		cin >> a >> b;
		a--;
		b--;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	for(int i=0;i<Q;i++)
	{
		lint p,x;
		cin >> p >> x;
		qus[p-1]+=x;
	}

	dfs(0,-1,0);
	for(int i=0;i<N;i++)
	{
		cout << ans[i];
		if(i==N-1)cout << endl;
		else cout << " ";
	}
	return 0;
}



Measured memory_bytes: 25600
#include <stdio.h>
#include <stdlib.h>
#define INFTY 1000000001
#define true 1
#define false 0
typedef struct{
  char kind;
  int num;
} card;
int isStable(card *, card *); /*出力が安定であるか判定する関数*/
void merge(card *, int, int, int);
void mergeSort(card *, int, int);
int partition(card *, int, int);
void quicksort(card *, int, int);
int n;

int main()
{
  int i;
  card A[100000], in_copy[100000];
  
  scanf("%d",&n);

  for(i = 0 ; i < n ; i++) scanf(" %c %d",&A[i].kind,&A[i].num);

  for(i = 0 ; i < n ; i++) in_copy[i] = A[i];
  
  quicksort(A, 0, n-1);
  /*安定なソートであるバブルソートより高速なマージソートを判定用の比較
  に使用する。*/
  mergeSort(in_copy, 0, n);

  if(isStable(A, in_copy) == true) printf("Stable\n");
  else if(isStable(A, in_copy) == false) printf("Not stable\n");

  for(i = 0 ; i < n ; i++) printf("%c %d\n",A[i].kind,A[i].num);

  return 0;
}

int partition(card *A, int p, int r)
{
  int x, i, j;
  card for_change;
  
  x = A[r].num;
  i = p - 1;

  for(j = p ; j < r ; j++){
    if(A[j].num <= x){
      i++;
      for_change = A[i];
      A[i] = A[j];
      A[j] = for_change; }
  }

  for_change = A[i+1];
  A[i+1] = A[r];
  A[r] = for_change;

  return ++i;
}

void quicksort(card *A, int p, int r)
{
  int q;
  
  if( p < r){
    q = partition(A, p , r);
    quicksort(A, p, q-1);
    quicksort(A, q+1, r); }

}

int isStable(card *in, card *out)
{
  int i;

  for(i = 0 ; i < n ; i++){
    if(in[i].kind != out[i].kind) return false; }

    return true;  
} 

void merge(card *A, int left , int mid, int right)
{
  int n1, n2, i, j, k;
  card *L, *R;
  n1 = mid - left;
  n2 = right - mid;

  L = (card *)malloc((n1 + 1) * sizeof(card));
  R = (card *)malloc((n2 + 1) * sizeof(card));

  for(i = 0 ; i < n1 ; i++) L[i] = A[left+i];
  for(i = 0 ; i < n2 ; i++) R[i] = A[mid+i];

  L[n1].num = INFTY;
  R[n2].num = INFTY;

  i = 0;
  j = 0;

  for(k = left ; k < right ; k++){
    if(L[i].num <= R[j].num){
      A[k] = L[i];
      i++; }
    else{
      A[k] = R[j];
      j++; }
  }

  free(L);
  free(R);
  
}

void mergeSort(card *A, int left, int right)
{
  int mid;

  if(left + 1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right); }

}


Measured memory_bytes: 3728
// 解説前
#include <iostream>

int solve_B() {
  int A, B;
  std::cin >> A >> B;

  // n * (A - 1) + 1 >= B
  // ⇒ n >= (B - 1) / (A - 1)
  // ⇒ n = (B - 1 + A - 1 - 1) / (A - 1)
  std::cout << ((B + A - 3) / (A - 1));

  return 0;
}

int main() { return solve_B(); }


Measured memory_bytes: 256
import Data.List
import Control.Monad

main = do
  n <- readLn :: IO Int
  s <- map length . group . sort . fil . map head <$> replicateM n getLine
  let s' = take 5 $ s ++ [0, 0, 0, 0, 0]
      p = nub $ permutations [0, 0, 1, 1, 1]
  print $ sum $ map (solve s') p

solve :: [Int] -> [Int] -> Int
solve []     []     = 1
solve (x:xs) (y:ys) =
  if y == 1
    then x * (solve xs ys)
    else solve xs ys

fil :: String -> String
fil [] = []
fil (s:ss) = if elem s "MARCH"
               then s : fil ss
               else fil ss


Measured memory_bytes: 48508
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0 ; i < (n); ++i)
using namespace std ;
typedef long long ll ;
const int mod=1000000007 ;

void solve(){

	string s ;
	cin>>s ;

	string temp="" ;

	for(int i=0;i<(int)s.length();i=i+2){
		temp=temp+s[i] ;
	}
	
	cout<<temp ;
}


int main(){

		int y ;

		y=1 ;
		//cin>>y ;

		while(y--){
 
			solve() ;

		}

}

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

using namespace std;

int main(){
    int n; cin >> n;
    vector<double> v(n);

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

    sort(v.begin(), v.end());
    for(int i = 0; i < n-1; i++){
        v[i+1] = (v[i] + v[i+1]) / 2.0;
    }

    cout << v[n-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	long T, A;
	cin >> N;
	cin >> T >> A;
	for (int i = 1; i < N; i++) {
		long Ti, Ai;
		cin >> Ti >> Ai;
		long k = max((T + Ti - 1) / Ti, (A + Ai - 1) / Ai);
		T = k * Ti;
		A = k * Ai;
	}
	cout << T + A << endl;
	return 0;
}

Measured memory_bytes: 256