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

ll gcd(ll a, ll b){
  if(b == 0){
    return a;
  }
  else{
    return gcd(b,(a%b));
  }
}
ll lcm(ll a,ll b){
  return a/gcd(a,b)*b;
}

int main(){
  int n;
  string s;
  cin>>n>>s;
  string p="0123456789";
  int ans=0;
  int q=0;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      for(int k=0;k<10;k++){
        for(int l=0;l<s.size();l++){
          if(q==0&&s.at(l)==p.at(i)){
            q++;
            continue;
          }
          if(q==1&&s.at(l)==p.at(j)){
            q++;
            continue;
          }
          if(q==2&&s.at(l)==p.at(k)){
            q++;
            continue;
          }
        }
        if(q==3){
          ans++;
        }
        q=0;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int count,n;
		while(true){
			n=sc.nextInt();
			count=0;
			if(n==0) break;
			while(4<n){
				n/=5;
				count+=n;
			}
			System.out.println(count);
		}
	}
}

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

int main()
{
  string s;cin>>s;
  int ans=0,n=s.size();
     stack<char>st;
   for(int i=0;i<n;i++)
   {
       if(st.empty()) st.push(s[i]);
       else{
          if(st.top()!=s[i]){
          ans++; st.pop();
          }
          else st.push(s[i]);
       }
   }

  cout<<ans*2<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int maxn = 412;
string s[maxn];
int h, w, dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
bool vis[maxn][maxn];

void dfs(int x, int y, int &cnt_w, int &cnt_b){
	if(vis[x][y]) return;
	vis[x][y] = true;
	if(s[x][y] == '#') cnt_w ++;
	else cnt_b++;
	rep(i,0,4){
		int xx = x + dx[i], yy = y + dy[i];
		if(xx < h && xx >=0 && yy < w && yy >= 0 && s[x][y] != s[xx][yy]) dfs(xx, yy, cnt_w, cnt_b);
	}
}

int main() {
#ifdef LOCAL_DEFINE
    freopen("test.in","r",stdin);
#else
    cin.sync_with_stdio(0); cin.tie(0);
#endif
	cin >> h >> w;
	rep(i,0,h) cin >> s[i];
	ll ans = 0;
	rep(i,0,h){
		rep(j,0,w){
			if(!vis[i][j]){
				int cnt_w = 0, cnt_b = 0;
				dfs(i, j, cnt_w, cnt_b);
				ans += 1ll * cnt_w * cnt_b;
			}
		}
	}
	cout << ans << '\n';
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * (double) clock() / CLOCKS_PER_SEC << " s.\n";
#endif
}


Measured memory_bytes: 18048
n,m,x,y=map(int,input().split())
x_=list(map(int,input().split()))
y_=list(map(int,input().split()))
x_.append(x)
y_.append(y)

if min(y_)>max(x_):
            print('No War')
else:
            print('War')
            
            


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

int main(){
    string S, T;
    cin >> S >> T;

    int n = S.size();
    bool ans = false;
    for (int j=0; j<n; j++){
        string rot;
        for (int i=0; i<(n-1); i++){
            rot += S.at(i+1);
            }
        rot += S.at(0);
        if (rot == T) {
            ans = true;
            break;
        }
        S = rot;
    }

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

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin>> n;
	int sum = 0;
	rep1(i, n + 1) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum+=i;
		}
	}
	print(sum);
}

Measured memory_bytes: 3600
#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector<lint> a(n), b(n);
  rep(i,0,n) {
    lint x, y; std::cin >> x >> y;
    a.at(i) = x;
    b.at(i) = y;
  }
  debug(a,b);

  if (a==b) {
    std::cout << 0 << std::endl;
    return 0;
  }

  lint sum = std::accumulate(all(a),0ll);
  lint rest = sum;
  rep(i,0,n) {
    lint x = a.at(i), y = b.at(i);
    if (x > y) cmn(rest,y);
  }
  lint ans = sum - rest;
  std::cout << ans << std::endl;
  return 0;
}

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

int main(void){
  char S[11];
  cin>>S;
  int year,month,day;
  sscanf((const char*)S,"%d/%d/%d",&year,&month,&day);
  if(month<=4){
    cout<<"Heisei";
  }
  else{
    cout<<"TBD";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	int p;
	int cnt;
	int max = 0;
	int valL[128],valR[128];
	char s[103];

	scanf("%d",&n);
	scanf("%s",s);

	for (int p = 1; p < strlen(s) - 1; ++p)
	{
		for (int k = 'A'; k <= 'z'; ++k){
			valL[k] = 0;
			valR[k] = 0;
		}	
		for (int i = 0; i < strlen(s); ++i)
		{
			if(i < p) ++valL[(int)s[i]];
			else  ++valR[(int)s[i]];
		}

		cnt = 0;
		for (int k = 'A'; k <= 'z'; ++k)
		{
			if(valL[k] && valR[k])	++cnt;
		}
		if(max < cnt)	max = cnt;
	}
	printf("%d\n", max);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define MAX 100

int main(){
  int N;
  cin>>N;
  vector<ll> T(N),A(N);
  ll voteT=0,voteA=0;
  for(int i=0;i<N;i++){
    cin>>T.at(i)>>A.at(i);
  }
  voteT=T.at(0);
  voteA=A.at(0);
  for(int i=1;i<N;i++){
    ll x=max((voteT-1)/T.at(i)+1,(voteA-1)/A.at(i)+1);
    voteT=T.at(i)*x;
    voteA=A.at(i)*x;
  }
  cout<<voteT+voteA<<endl;
}


Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	var ans, now int
	l := -1
	for r := 0; r < n; r++ {
		for r-l > 0 && now&aa[r] > 0 {
			l++
			now = now ^ aa[l]
		}
		ans += r - l
		now = now | aa[r]
	}
	fmt.Fprintln(writer, ans)
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
ll gcd(ll a,ll b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
ll lcm(ll a,ll b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}









int main() {
 int n;
 cin >> n;
 long double x[n+1];
 string u[n+1];
 long double ans = 0;
 rep (i,n){
   cin >> x[i] >> u[i];
   if (u[i]=="JPY"){
     ans+=x[i];
   }
   if (u[i]=="BTC"){
     ans+=x[i]*380000.0;
   }
 }
 cout << fixed << setprecision(10) << ans << endl;


}


Measured memory_bytes: 3756
import sys
sys.setrecursionlimit(10000)

def get_two_int():
    two_int = input().split()
    for i in range(2):
        two_int[i] = int(two_int[i])
    return two_int

def get_data_list():
    data_list = input().split()
    for i, v in enumerate(data_list):
        data_list[i] = int(v)
    # print("data_list", data_list) # debug
    return data_list


def make_map(width, height):
    map_list = [[0] * (width + 2) for x in range(height + 2)] # まわりを0で囲む
    # print("map_list", map_list) # debug pprint?
    for h in range(1, height + 1):
        line_list = get_data_list()
        for w in range(1, width + 1):
            map_list[h][w] = line_list[w-1] # 汚い
    #print("map_list", map_list) # debug
    return map_list

def count_island(width, height, map_list):
    count = 0
    checked_set = set()
    for h in range(1, height + 1):
        for w in range(1, width + 1):
            if map_list[h][w] == 1 and ((h, w) not in checked_set):
                map_list, checked_set = check_around(h, w, map_list, checked_set)
                count += 1
    # print("checked_set", checked_set) # debug
    return count

def check_around(h, w, map_list, checked_set):
    # print((h, w)) #debug
    checked_set.add((h, w))
    # print("map_list", map_list) # debug
    for i in range(h - 1, h + 2): # まわりを全てチェック、大枠のまわりを0で余分に囲っているので無問題
        for j in range(w - 1, w + 2):
            if map_list[i][j] == 1 and (i, j) not in checked_set:
                    map_list, checked_set = check_around(i, j, map_list, checked_set)
    return map_list, checked_set


if __name__ == "__main__":
    while True:
        width, height = get_two_int()
        if width == 0:
            break
        # print("width", width) # debug
        # print("height", height) # debug
        map_list = make_map(width, height)
        # print("map_list", map_list) # debug 
        count = count_island(width, height, map_list)
        print(count)



Measured memory_bytes: 8476
from fractions import gcd

def lcm(x, y):
    return ((x * y) // gcd(x, y))


A, B, C, D = map(int, input().split())

# 変数C の倍数が A, B 区間内に存在しうる数
Ccount = (B // C) - ((A - 1) // C)

# 変数D の倍数が A, B 区間内に存在しうる数
Dcount = (B // D) - ((A - 1) // D)

# 変数C, D の最小公倍数が A, B 区間内に存在しうる数
CDcross = (B // lcm(C, D)) - ((A - 1) // lcm(C, D))

# Cが存在しうる数と Dが存在しうる数を引き、重複する（＝最小公倍数）数は引きすぎなので戻す
print((B-A+1) - ((Ccount + Dcount - CDcross)))

Measured memory_bytes: 5076
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int W = scan.nextInt();
        int H = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int r = scan.nextInt();
        
        if(x-r<0 || x+r>W || y-r<0 || y+r>H) System.out.println("No");
        else System.out.println("Yes");
    }
}


Measured memory_bytes: 26264
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long n;
    cin>>n;
    long long t=n;
    int a=0;
    for(long long i=26;t>=0;i*=26){
        t-=i;
        a++;
        if(t<=0){
            t+=i;
            break;
        }
    }
    t--;
    int arr[100]={};
    for(int i=0;i<a;i++,t/=26){
        arr[i]=t%26;
    }
    for(int i=a-1;i>=0;i--){
        cout<<char('a'+arr[i]);
    }
    cout<<'\n';

return 0;
}


//      *   *  *****  *   *  *   *   ****  ****    ****     **  ***
//     *   *  *      **  *  *   *  *      *   *  *        * *  *  *
//    *****  *****  * * *  *   *  *      ****   *       *  *    *
//   *   *      *  *  **  *   *  *      *  *   *       *****  *
//  *   *  *****  *   *   ***    ****  *   *    ****     *   ****

//     ****  *   *  *   *   ***   *   *  *****  *   *
//    *     *   *  *   *  *   *  *   *  *      *   *
//    ***  *****  *   *  *****  * * *  ****   *   *
//      *   *    *   *  *   *  * * *  *      *   *
//  ****   *     ***   *   *   * *   *****   ***


Measured memory_bytes: 3572
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int A, B;
    io.read(A, B);
    if(B % A == 0) cout << A + B;
    else cout << B - A;
    return 0;
}

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

int main()
{
    long long int n, m, l, i, j, k;
    cin >> n >> m >> l;
    vector<vector<long long int>> vec(n, vector<long long int>(m));
    vector<vector<long long int>> vec2(m, vector<long long int>(l));
    vector<vector<long long int>> ans_vec(n, vector<long long int>(l));

    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            cin >> vec[i][j];
        }
    }

    for (i = 0; i < m; i++) {
        for (j = 0; j < l; j++) {
            cin >> vec2[i][j];
        }
    }

    for (i = 0; i < n; i++) {
        for (j = 0; j < l; j++) {
            for (k = 0; k < m; k++) {
                ans_vec[i][j] += vec[i][k] * vec2[k][j];
            }
            if (j == l - 1) {
                cout << ans_vec[i][j];
            }
            else {
                cout << ans_vec[i][j] << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3260
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    N, T = map(int, input().split())
    push = list(map(int, input().split())) + [INF]

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

    print(ans)


sol()

Measured memory_bytes: 25528
#include<iostream>
#include<cmath>

int main()
{
	int n;
	double debt;
	while (std::cin >> n)
	{
		debt = 100000;
		for (int i = 0; i < n; ++i)
		{
			debt += debt / 20;
			debt /= 1000;
			debt = std::ceil(debt);
			debt *= 1000;
		}
		std::cout << static_cast<long>(debt) << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1164
use std::cmp::max as max;
use std::cmp::min as min;

use itertools::Itertools;

fn build(buildings: &Vec<i64>, build_ups: &Vec<usize>) -> i64 {
    let mut highest = buildings[0] - 1;
    let mut costs = 0;

    for i in 0..buildings.len() {
        let cost = if build_ups.contains(&i) {
            max(0, highest + 1 - buildings[i])
        } else {
            0
        };
        costs += cost;
        highest = max(highest, buildings[i] + cost);
    }
    costs
}

fn solve(buildings: Vec<i64>, n: usize, k: usize) -> i64 {
    let mut result = std::i64::MAX;

    for build_ups in (0..n).combinations(k) {
        result = min(build(&buildings, &build_ups), result)
    }

    result
}

fn main() {
    let (n, k) = read_tup2();
    let buildings = read_vec();

    println!("{}", solve(buildings, n, k));
}

// utils

fn read_tup2<T: std::str::FromStr + Copy>() -> (T, T) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v = s.trim().split_whitespace()
        .map(|c| c.parse().ok().unwrap())
        .collect::<Vec<T>>();
    (v[0], v[1])
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|c| c.parse().ok().unwrap())
        .collect()
}


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

int main() {
    //input
    int n,h;
    cin >> n;
    int m = 0;
    int count=0;
    for(int i=0;i<n;i++){
        cin >> h;
        if(m<=h){
            count++;
            m = h;
        }
    }
    cout << count;

    return 0;
}

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

int main(){
  int n,k;
  cin>>n>>k;
  
  int cnt=0;
  
  while(k<=n){
    n/=k;
    cnt++;
  }
  cout<<cnt+1<<endl;
  return 0;
}

Measured memory_bytes: 3588
if __name__ == '__main__':
	N, X, Y = map(int, input().split())

	ans = [0] * (N - 1)

	for i in range(1,N):
		for j in range(i+1,N+1):
			l1 = abs(j-i)
			l2 = abs(X-i) + 1 + abs(j-Y)
			lm = min(l1,l2)
			ans[lm - 1] += 1

	for k in range(N-1):
		print(ans[k])

Measured memory_bytes: 3444
n=input()
m=list(n)
l=[int(i) for i in m]
l.reverse()
l.append(0)
k=l
ans=0
for i in range(len(l)):
  if k[i]<5:
    ans+=k[i]
  elif k[i]==5:
    if k[i+1]>=5:
      k[i+1]+=1
    ans+=5
  else:
    ans+=10-k[i]
    k[i+1]+=1
print(ans)

Measured memory_bytes: 22080
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#define LL long long

using namespace std;

const LL MOD = 998244353ll, maxn = 3e5 + 5;
LL N, A, B, K, ans;
LL fac[maxn], inv[maxn], ifac[maxn];

LL C(LL n, LL m) {
    return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;
}

int main() {
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    scanf("%lld%lld%lld%lld", &N, &A, &B, &K);
    if (!K) { printf("1\n"); return 0; }
    inv[1] = fac[0] = fac[1] = ifac[0] = ifac[1] = 1;
    for (int i = 2; i <= N; i++) {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
        ifac[i] = ifac[i-1] * inv[i] % MOD;
    }
    for (int i = 0; i <= N && i <= K / A; i++) 
        if ((K - i * A) % B == 0 && (K - i * A) / B <= N) 
            ans += C(N, i) * C(N, (K-i*A)/B) % MOD,
            ans %= MOD;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 7296
n = int(input())
l = [list(input().split()) for _ in range(n)]
for i in range(n):
    l[i].append(i + 1)
l = sorted(
    l,
    key=lambda x: (x[0], -int(x[1]))
)
for i in range(n):
    print(l[i][2])

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
    public static void main(String[] arg){
        int x, y, box;
        Scanner scan = new Scanner(System.in);
        for(;;){
        	x = scan.nextInt();
        	y = scan.nextInt();
            if(x == 0 && y == 0) break;
            if(x <= y){
                System.out.println(x +" "+ y);
            }else{
                System.out.println(y +" "+ x);
            }

        }
        scan.close();
    }
}


Measured memory_bytes: 36332
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();

		String[] Ws = W.split(" ");
		int[] A ={Integer.parseInt(Ws[0]),Integer.parseInt(Ws[1]),Integer.parseInt(Ws[2])};

		String ans = "bust";
		if(A[0]+A[1]+A[2] >=22){
			ans = "bust";
		}else{
			ans = "win";
		}


		System.out.println(ans);



	}


}


Measured memory_bytes: 20948
#include <iostream>

using namespace std;


int main() {


    int r, g, b;

    cin >> r >> g >> b;

    if ((r * 100 + g * 10 + b) % 4 == 0) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n;
string s, t;
int ans;
int j;

signed main() {
	cin >> n >> s >> t;
	int i = 0;
	if (s[0] == t[0]) {
		i = 1;
		ans = 3;
		j = 0;
	}
	else {
		i = 2;
		ans = 6;
		j = 1;
	}
	while (i < n) {
		if (s[i] == t[i]) {
			if (!j)ans *= 2;
			j = 0;
			i++;
		}
		else {
			if (j)ans *= 3;
			else ans *= 2;
			j = 1;
			i += 2;
		}
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX_N  800

int solve(int n, int parent[], int d[])
{
  static int degree[MAX_N];
  static int dist[MAX_N][MAX_N];
  int total;
  int pendant;
  int maxDist;
  int i, s, t;

  /* ?????????????¬???°????¨???? */
  for (i = 0; i < n; i++) { degree[i] = 0; }
  for (i = 1; i < n; i++) {
    degree[parent[i]]++;
    degree[i]++;
  }

  /* ??¨?????????total??¨, ?¬???°1??????????????\?¶????????????????pendant????¨???? */
  total   = 0;
  pendant = 0;
  for (i = 1; i < n; i++) {
    total += d[i];
    if (degree[i] <= 1 || degree[parent[i]] <= 1) {
      pendant += d[i];
    }
  }

  /* i??????j?????§????????¢dist[i][j]????¨???? (i >= j????????????????¨????) */
  maxDist = 0;
  for (s = 0; s < n; s++) {
    int p = parent[s];
    for (t = 0; t < s; t++) {
      /*
       * s??????t?????§????????¢ = s??????p?????§????????¢ + p??????t?????§????????¢.
       * s??????p?????§????????¢ = d[s].
       * p < s??????t < s????????§, dist[p][t]?????????dist[t][p]?????????????¨??????????
       */
      int dpt = (p > t ? dist[p][t] : dist[t][p]); /* p??????t?????§????????¢ */
      dist[s][t] = d[s] + dpt;
      if (degree[s] <= 1 || degree[t] <= 1) continue;
      if (maxDist < dist[s][t]) { /* ?¬???°2??\???????????????????????§?????¢ */
          maxDist = dist[s][t];
      }
    }
  }

  /*
   * (?§??????????????????????)?????????????????????????????? = total (??????????????????????????¢???).
   * ??????????\????????§??????????s, ???????????????t??¨????????¨, 
   *   s, t????¬???°2??\????????????????????????????????°??????.
   *   s??????t?????§?????????????????? (maxDist) ???????????????1?????????.
   *   ?¬???°1??????????????\?¶?????????? (pendant) ????????????????????????.
   *   ????????\????????? (total - pendant - maxDist) ???????????????2?????????(??????).
   */
  return total + maxDist + 2 * (total - pendant - maxDist);
}

int main()
{
  static int parent[MAX_N]; /* parent island */
  static int d     [MAX_N]; /* distance to the parent */
  int n, p, i;
  for (;;) {
    scanf("%d", &n);  /* num of islands */
    if (n == 0) break;
    for (i = 1; i < n; i++) {
      scanf("%d", &p);
      parent[i] = p - 1;  /* parent (0..n-1) of i */
    }
    for (i = 1; i < n; i++) {
      scanf("%d", &d[i]); /* distance to the parent */
    }
    printf("%d\n", solve(n, parent, d));
  }
  return 0;
}

Measured memory_bytes: 3108
{-# LANGUAGE BangPatterns #-}
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import Control.Monad
import Data.Char
import qualified Data.Vector.Unboxed as VU

solve :: Int -> VU.Vector Int -> VU.Vector Bool
solve !k !as =
    VU.constructN (k+1) $ 
        \ !vec ->
            let
                !i = VU.length vec
            in
                not $ VU.and $ VU.map (\a -> vec VU.! (i-a)) $ VU.takeWhile (<=i) as

main = do
    [n,k] <- map read . words <$> getLine :: IO [Int]
    as <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    putStrLn $ if (solve k as) VU.! k then "First" else "Second"

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 1000000007
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; }

int main(){
    string L;cin>>L;
    ll dp[100005][2];//i桁目まで見ている　smaller?  のときの

    rep(i,100005) dp[i][true]=dp[i][false]=0;
    dp[0][false]=1;

    rep(i,L.size()){
        //小さいことは確定しているから、(0,0),(1,0),(0,1)のいずれでもいい
        dp[i+1][true]+=3*dp[i][true];
        dp[i+1][true]%=mod;
        
        if(L[i]=='1'){
            //一致((0,1),(1,0))
            dp[i+1][false]+=2*dp[i][false];
            dp[i+1][false]%=mod;
            //不一致((0,0))
            dp[i+1][true]+=dp[i][false];
            dp[i+1][true]%=mod;
        }else{
            //(0,0)のみ
            dp[i+1][false]+=dp[i][false];
            dp[i+1][false]%=mod;
        }
    }

    cout<<(dp[L.size()][true]+dp[L.size()][false])%mod<<endl;

    return 0;
}

Measured memory_bytes: 5244
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int32_t main()
{
    FIO
    int x; cin>>x;
    int ans;
    if(x>=1800) ans=1;
    else if(x>=1600) ans=2;
    else if(x>=1400) ans=3;
    else if(x>=1200) ans=4;
    else if(x>=1000) ans=5;
    else if(x>=800) ans=6;
    else if(x>=600) ans=7;
    else ans=8;
    cout<<ans<<"\n";
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

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

using namespace std;

int64_t INF = 1'000'000'000'000'000'000;

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

    vector<int> X(M);
    for(int i=0;i<M;i++)    cin >> X[i];

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

    vector<int> distance(M);
    for (int i = 0; i < M - 1; i++) {
        distance[i] = X[i + 1] - X[i];
    }
    sort(distance.begin(), distance.end());
    int64_t ans=0;
    for(int i=0;i<M-N+1;i++){
        ans += distance[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;

double log(double base, double value) {
	return std::log2(value) / std::log2(base);
}


void init() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
}

void calc() {

	Int N; std::cin >> N;
	std::vector<Int> x(N);
	Int min = INF, max = -INF;
	rep(i, N) {
		std::cin >> x[i];
		min = std::min(min, x[i]);
		max = std::max(max, x[i]);
	}
	Int ans = INF;
	for (Int i = min; i <= max; ++i) {
		Int res = 0;
		rep(j, N)res += pow(x[j] - i, 2);
		ans = std::min(ans, res);
	}

	std::cout << ans;

}


int main() {

	init();
	calc();

	return 0;
}

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

map <string, int> ma;

int main() {
	int T;
	string a, b;
	cin >> T;
	cin >> a;
	ma[a] = 1;
	T--;
	while (T--) {
		cin >> b;
		if (ma.count(b) > 0 || a[a.length()-1] != b[0]) {
			cout << "No\n";
			return 0;
		}
		ma[b] = 1;
		a = b;
	}
	cout << "Yes\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  int dx=x2-x1;
  int dy=y2-y1;
  int x3,y3,x4,y4;
  x3=x2-dy;
  x4=x3-dx;
  y3=y2+dx;
  y4=y3-dy;
  cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int n; cin >> n;
    vint a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    sort(all(a));
    sort(rall(b));
    if (n&1) {
        int l = a[n/2]; int r = b[n/2];
        cout << r-l+1 << endl;
    } else {
        int l = a[n/2-1]+a[n/2];
        int r = b[n/2-1]+b[n/2];
        cout << r-l+1 << endl;
    }
}

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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    long long N; cin >> N;
    long long A,B; cin >> A >> B;
    if((B-A)%2==0){
        cout << (B-A)/2 << endl;
    }else{
        long long ans=(B-A-1)/2+min(A-1,N-B)+1;
        cout << ans << endl;
    }
}



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

il = y // 10000
jl = y // 5000

for i in range(il+1):
    for j in range(jl+1):
        k = n - (i + j)
        if y == i*10000+j*5000+k*1000 and k >= 0:
            print(i, j, k)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 40300
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cassert>
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int A[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	sort(A,A+n);
	int to=0;
	for(int i=0;i<n;i++)
	{
		int sz=n-i;
		while(to<sz&&A[to]<=i) to++;
		if(to>=sz) to=sz;
		if(to<sz)
		{
			if(to+1==sz)
			{
				if((A[to]-i)%2==1)
				{
					puts("Second");
					return 0;
				}
			}
			else if(A[to]==i+1&&A[sz-2]==i+1)
			{
				if((sz-to)%2==1&&(A[sz-1]-i)%2==1)
				{
					puts("Second");
					return 0;
				}
			}
		}
	}
	puts("First");
	return 0;
}


Measured memory_bytes: 512
//ProblemB.cpp

#include <iostream>

static std::istream & ip = std::cin;
static std::ostream & op = std::cout;

#if OJ_MYPC
#include <ojio.h>
#endif

#ifndef OPENOJIO
#define OPENOJIO
#endif

#if 1 || DEFINE
/***************************************************************/
typedef unsigned long long u64;
typedef long long s64;

typedef unsigned uint;

#define ABS(x) ((x) > 0 ? (x) : -(x))

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define MIN3(x, y, z) MIN(x, MIN(y, z))
#define MAX3(x, y, z) MAX(x, MAX(y, z))

#define FillZero(arr) memset(arr, 0, sizeof(arr));

/***************************************************************/
#endif //1 || DEFINE

#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>

//001
//op << setfill('0') << setw(3) << setiosflags(ios::right) << 1;

//op << fixed << setprecision(20);

using namespace std;

//ProblemB.cpp

struct Num
{
	s64 value;
	int id;

	bool operator<(const Num& b) const {
		return id < b.id;
	}
};

int main(int argc, char* argv[])
{
	OPENOJIO;

	vector<Num> nums;
	int n;

	ip >> n;
	nums.resize(n);
	for (int i = 0; i < n; ++i) {
		ip >> nums[i].value;
		nums[i].id = i;
	}

	sort(nums.begin(), nums.end(), [](const Num& a, const Num& b) -> bool { return a.value < b.value; });

	s64 rst = 0;
	set<Num> s;

	for (auto num : nums) {
		auto it = s.insert(num).first;

		s64 v = it->value;
		int i = it->id;
		int inext = n, ipre = -1;

		if (it != s.begin()) {
			auto itt = it; --itt;
			ipre = itt->id;
		}
		{
			auto itt = it; ++itt;
			if (itt != s.end()) {
				inext = itt->id;
			}
		}

		rst += v * (inext - i) * (i - ipre);
	}

	op << rst << endl;

	return 0;
}
/***************************************************************/


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

int main(){
    string s;
    cin >> s;
    int j = 1;
    rep(i,3){
        if(s[i]==s[i+1]){
            j = 0;
            break;
        }
        else{
            j = 1;
        }
    }
    if(j == 0) cout << "Bad" << endl;
    else cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(void){
    int N;
    char *str;
    int *count;
    int min;
    scanf("%d",&N);
    min=N;
    str=(char *)malloc(sizeof(char)*N);
    count=(int *)malloc(sizeof(int)*N);
    scanf("%s",str);
    //printf("%s\n",str);

    for(int i=0;i<N;i++) count[i]=0;

    for(int i=1;i<N;i++){
        if(str[i]=='E') count[0]++;
    }
    for(int i=1;i<N;i++){
        if(str[i-1]=='W' && str[i]=='E'){
            count[i]=count[i-1];
        }
        else if(str[i-1]=='E' && str[i]=='E'){
            count[i]=count[i-1]-1;
        }
        else if(str[i-1]=='W' && str[i]=='W'){
            count[i]=count[i-1]+1;
        }
        else if(str[i-1]=='E' && str[i]=='W'){
            count[i]=count[i-1];
        }
    }

    for(int i=0;i<N;i++){
        if(min>count[i]) min=count[i];
    }
    printf("%d\n",min);
    
    return 0;
}

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

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

int sumArray(int *ary , int num) {
  int sum = 0;
  rep(i, num+1) sum += ary[i];
  return sum;
}

int main() {
  int N, a1[110], a2[110];
  cin >> N;
  rep(i, N) cin >> a1[i];
  rep(i, N) cin >> a2[i];

  int result = 0;
  rep(i, N) {
    int sum = 0;
    sum = sumArray(a1, i) + (sumArray(a2, N-1) - sumArray(a2, i) + a2[i]);
    if (result < sum) result = sum;
  }

  cout << result << endl;
  return 0;
}


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

class D
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var k = h[1];
		var s = Console.ReadLine().GroupBySeq(x => x).ToArray();

		var c0 = s.Where(g => g.Key == '0').Select(g => g.Count()).ToList();
		var c1 = s.Where(g => g.Key == '1').Select(g => g.Count()).ToList();
		if (s[0].Key == '0') c1.Insert(0, 0);
		if (s.Last().Key == '0') c1.Add(0);

		int M = c0.Take(k).Sum() + c1.Take(k + 1).Sum(), t = M;
		for (int l = 0, r = k; r < c0.Count; l++, r++)
			M = Math.Max(M, t += c0[r] + c1[r + 1] - c0[l] - c1[l]);
		Console.WriteLine(M);
	}
}

static class GE
{
	public static IEnumerable<IGrouping<TK, TS>> GroupBySeq<TS, TK>(this IEnumerable<TS> source, Func<TS, TK> toKey)
	{
		var c = EqualityComparer<TK>.Default;
		var k = default(TK);
		var l = new List<TS>();

		foreach (var o in source)
		{
			var kt = toKey(o);
			if (!c.Equals(kt, k))
			{
				if (l.Count > 0) yield return new G<TK, TS>(k, l.ToArray());
				k = kt;
				l.Clear();
			}
			l.Add(o);
		}
		if (l.Count > 0) yield return new G<TK, TS>(k, l.ToArray());
	}

	class G<TK, TE> : IGrouping<TK, TE>
	{
		public TK Key { get; }
		IEnumerable<TE> Values;
		public G(TK key, TE[] values) { Key = key; Values = values; }

		public IEnumerator<TE> GetEnumerator() => Values.GetEnumerator();
		IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
	}
}


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

int a,b,c;

int qr()
{
    int s=0,f=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=(s<<3)+(s<<1)+(ch^48);ch=getchar();}
    return s*f;
}

int main()
{
    cin>>a>>b>>c;
    if(a==b&&a!=c)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    if(a==c&&b!=c)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    if(c==b&&a!=c)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static int MOD = 1000000007;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		sc.nextLine();
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int[] t = new int[m];
		for (int i = 0; i < m; i++) {
			t[i] = sc.nextInt();
		}

		long[][] sum = new long[s.length + 1][t.length + 1];

		for (int i = 1; i <= s.length; i++) {
			for (int j = 1; j <= t.length; j++) {
				if (s[i - 1] == t[j - 1]) {
					sum[i][j] = sum[i - 1][j] + sum[i][j - 1] + 1;
				} else {
					sum[i][j] = (sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1]) + MOD;
				}

				sum[i][j] %= MOD;
			}
		}

		System.out.println(sum[s.length][t.length] + 1);
	}
}


Measured memory_bytes: 84608
N = str(input())
t = len(N)
bi_li =[]
li_formula = []
total = 0

for i in range(2**(t-1)):
    temp =[0 for _ in range(t-1)]
    for p in range(t-1):
        if ((i >> p) & 1):
            temp[p] =1
    bi_li.append(temp)

for k in bi_li:
    formula =""
    for j in range(t+len(k)):
        if j%2==0:
            formula+=N[int(j/2)]
        else:
            if k[j//2] == 1:
                formula+="+"
    li_formula.append(formula)

for l in li_formula:
    total += eval(l)
print(total)

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

int main() {
  int n, ans = 0;

  cin >> n;

  for (int i = 1; i <= n; i++) {
    int tmp = i, cnt = 0;
    while (tmp > 0) {
      cnt++;
      tmp /= 10;
    }
    if (cnt % 2 != 0) ans++;
  }

  cout << ans;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair 
#define pb push_back 
#define fi first
#define se second
#define MOD 1000000007
#define DOMOD(d) if ((d) >= MOD) d %= MOD;
#define DONEGMOD(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
 
#define inp(a) scanf("%d", &a)
#define inp2(a,b) scanf("%d %d", &a, &b)
#define inp3(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define inp4(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
 
#define inpl(a) scanf("%lld", &a)
#define inpl2(a,b) scanf("%lld %lld", &a, &b)
#define inpl3(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define inpl4(a,b,c,d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i=a;i<b;i++)
#define mset(a,val) memset(a,val,sizeof(a))
#define printv(v) for (int i=0;i<(int) v.size(); i++) cout<<v[i]<<" " 
#define MAX 100005
using namespace std ;
typedef long long int ll ;
typedef pair<int,int> pii ;
typedef pair<long long , long long > pll ;
typedef pair<int,pii> pipi ;
typedef pair<int,pair<int,string>> piis ;
typedef pair<ll,string> pls ;
typedef pair<ll,pll> plpl ;



int main()
{
	#ifdef DIRI
		//freopen("inp.txt","r",stdin) ;
	#endif
	
	time_t start = clock() ;
	
	int n ; cin>>n ;
	
	int arr[n+1] ;
	
	vector<int> v ; v.pb(-1) ;
	
	for (int i=1;i<=n;i++)
	{
		cin>>arr[i] ;
		v.pb(arr[i]) ;
	}
	
	sort(all(v)) ;
	
	map<int,int> d ;
	
	for (int i=1;i<(int) v.size() ; i++)
	{
		d[v[i]] = i ;
	}
	
	int pos, pos2 ;
	
	for (int i=1;i<=n;i++)
	{
		pos = d[arr[i]] ;
		pos2 = (n/2) ;
		
		if (pos > pos2)
		{
			cout<<v[pos2]<<endl ;
		}else 
		{
			cout<<v[pos2 + 1]<<endl ;
		}
		
	}
		
	time_t end = clock() ;
	
	double tt = (end - start) / CLOCKS_PER_SEC ;
	cerr<<fixed<<setprecision(5)<<tt<<endl ;
	
    return 0 ;
}


Measured memory_bytes: 12916
import sys
sys.setrecursionlimit(10 ** 8)
n, q = map(int, input().split())
g = [[] for _ in range(n)]
value = [0] * n
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
for _ in range(q):
    p, x = map(int, input().split())
    value[p-1] += x

seen = [False] * n
def dfs(v):
    seen[v] = True
    for nv in g[v]:
        if seen[nv]:
            continue
        value[nv] += value[v]
        dfs(nv)
dfs(0)
print(*value)

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

int main(){
  int n; cin>>n;
  vector<vector<int>> a(2,vector<int>(n));
  
  for(int i=0;i<n;i++)cin>>a[0][i];
  for(int i=0;i<n;i++)cin>>a[1][i];
  
  int ans=0;
  for(int i=0;i<n;i++){
    int candies=0;
    for(int j=0;j<=i;j++)candies+=a[0][j];
    for(int k=i;k<n;k++)candies+=a[1][k];
    ans=max(ans,candies);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)
using III = tuple<int,int,int>;
using VIII = vector<III>;
using II = pair<int,int>;
using VII = vector<II>;
using VVII = vector<VII>;

// DFS 深さ優先探索
// 閉路なしのときに使う
// 閉路ありはダイクストラ
#define V_MAX 100000
vi visited(V_MAX+1);
vl dist(V_MAX+1);
// void dfs(TREE &T, int p, ll w){
void dfs(VVII &T, int p, ll w){
	if(visited[p]) return;
	visited[p] = true;
	dist[p] = w;
	for(auto cw:T[p]){
		int np,nw; tie(np,nw) = cw;
		// printf("%d %d %d %d\n",p,np,w,nw);//
		dfs(T, np, w+nw);
	}
}

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

	if(M==0){
		puts("Yes");
		return 0;
	}

	VVII V(N+1);
	int l,r,d;
	int mini = INT_MAX;
	int maxi = 0;
	rp(i,0,M){
		cin>>l>>r>>d;
		V[l].emplace_back(r,d);
		V[r].emplace_back(l,-d);
		mini = min({mini,l});
		maxi = max({maxi,r});
	}

	// rp(l,mini,maxi+1){cout<<l<<") ";for(auto ii:V[l]){tie(r,d)=ii;cout<<r<<"("<<d<<") ";}puts("");}//

	// dfs(V,l,0);
	// rp(i,0,N+1){printf("%4d ",i);}puts("");///
	// rp(i,0,N+1){printf("%4d ",dist[i]);}puts("");///

	rp(l,mini,maxi+1){
		dfs(V,l,0);
		for(auto rd:V[l]){
			tie(r,d)=rd;
			if(abs(d)!=abs(dist[r]-dist[l])){
				puts("No");
				return false;
			}
		}
	}
	puts("Yes");
}


Measured memory_bytes: 12800