akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 200005
  #define INF 1000000000000
  #define eps 1e-6


int32_t main()
{


    int n;
    cin >> n;
    cout << n/2 + bool(n%2);
    
    return 0;
}

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

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

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

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

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

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

fn main() {
    input!{
        A: usize,
        B: usize,
    }
    let mut A = A - 1;
    let mut B = B;

    let le = match A%4 {
        0 => A,
        1 => 1,
        2 => A+1,
        3 => 0,
        _ => 0,
    };
    let re = match B%4 {
        0 => B,
        1 => 1,
        2 => B+1,
        3 => 0,
        _ => 0,
    };

    println!("{}",re ^ le);
}



Measured memory_bytes: 4352
sx, sy, tx, ty = map(int,input().split())
dx = tx-sx
dy = ty-sy
ans = "R"*dx + "U"*dy + "L"*dx + "D"*(dy+1) + "R"*(dx+1) + "U"*(dy+1) + "LU" + "L"*(dx+1) + "D"*(dy+1) + "R"

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define fi first
#define se second
#define endl "\n"
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define go_t int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // order_of_key
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf = 0x3f3f3f3f3f3f3f3fll;//4x10e18
const int maxx = 3000000 , mod = 1000000007;
#define PI 3.14159265
ll dp[1005][1005];
int main()
{
    fastio;
    int h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++)
        cin>>s[i];
    dp[0][0] = 1;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(i==0 && j==0)continue;
            if(j!=0 && s[i][j]=='.')
            {
                dp[i][j]+=dp[i][j-1];
            }
            if(i!=0 && s[i][j]=='.')
            {
                dp[i][j]+=dp[i-1][j];
            }
            dp[i][j]%=mod;
        }
    }
    cout<<dp[h-1][w-1]<<endl;
    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    if (s == "SUN")
    {
        cout << 7 << endl;
    }
    else if (s == "MON")
    {
        cout << 6 << endl;
    }
    else if (s == "TUE")
    {
        cout << 5 << endl;
    }
    else if (s == "WED")
    {
        cout << 4 << endl;
    }
    else if (s == "THU")
    {
        cout << 3 << endl;
    }
    else if (s == "FRI")
    {
        cout << 2 << endl;
    }
    else if (s == "SAT")
    {
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int, int> P;

/*
  UnionFind Tree
*/
class UnionFind {
  private: 
    vector<int> par;
    vector<int> rank;
    vector<int> cnt;
  
  public:
    UnionFind(int n);
    int find(int x);
    void unite(int x, int y);
    bool same(int x, int y);
    int count(int x);
    void printStatus();
};

UnionFind::UnionFind(int n) {
  for (int i = 0; i < n; i++) {
    par.push_back(i);
    rank.push_back(0);
    cnt.push_back(1);
  }
}
int UnionFind::find(int x) {
  if (par[x] == x) return x;
  else return par[x] = find(par[x]);
}
void UnionFind::unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (rank[x] < rank[y]) {
      cnt[y] += cnt[x];
      par[x] = y;
  } else {
    cnt[x] += cnt[y];
    par[y] = x;
    if (rank[x] == rank[y]) rank[x]++;
  }
}
bool UnionFind::same(int x, int y) {
  return find(x) == find(y);
}
int UnionFind::count(int x) {
    return cnt[find(x)];
}
void UnionFind::printStatus() {
    printf("----------------\n");
    for (int i = 0; i < par.size(); i++) {
        printf("[node %d]: parent = %d, rank = %d, count = %d\n", i, par[i], rank[i], cnt[i]);
    }
}

int main() {
    int N, M;
    scanf("%d %d", &N, &M);
    int A[M], B[M];
    int delta[M];
    for (int i = 0; i < M; i++) {
        scanf("%d %d", &A[i], &B[i]);
        A[i]--;
        B[i]--;
        delta[i] = 0;
    }
    UnionFind tree(N);

    for (int i = M - 1; i >= 0; i--) {
        delta[i] = tree.same(A[i], B[i]) ? 0 : tree.count(A[i]) * tree.count(B[i]);
        tree.unite(A[i], B[i]);
        // tree.printStatus();

    }
    long int sum = 0;
    for (int i = 0; i < M; i++) {
        sum += delta[i];
        printf("%ld\n", sum);
    }

    return 0;
}

Measured memory_bytes: 3948
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;



public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		Map<Integer,Long> map=new TreeMap<Integer,Long>();

		int N = sc.nextInt();
		Long K = sc.nextLong();

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

			int A = sc.nextInt();
			Long B = sc.nextLong();

			if(map.containsKey(A)) {
				map.put(A, map.get(A)+B);
			}else {
				map.put(A, B);
			}

		}

		Long cnt=0l;
		for(Entry<Integer, Long> E:map.entrySet()) {

			cnt+=E.getValue();

			if(cnt>=K) {
				System.out.println(E.getKey());
				return;
			}

		}

	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

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

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Measured memory_bytes: 94560
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	sc.close();
    	int X = N%10;
    	if(X == 2 || X == 4 || X == 5 || X == 7 || X == 9){
    		System.out.println("hon");
    	}else if(X == 3){
    		System.out.println("bon");
    	}else{
    		System.out.println("pon");
    	}
    }
}

Measured memory_bytes: 35740
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repl(i,n) for(int64_t i=0;i<(int64_t)(n);i++)
#define MAX_N 10000000
#define ll int64_t
#define all(v) (v).begin(),(v).end()
using namespace std;

int main() {
    int n,k; cin>>n>>k;
    vector<ll> h(n);
    rep(i,n) cin>>h[i];

    sort(all(h));

    ll minh=10000000000;
    rep(i,n-k+1) {
        ll a=h[i+k-1]-h[i];
        minh=min(a,minh);
    }
    cout<<minh<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.io.*;

class Main{
	public static void main(String args[]){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String input="";
			try{
				input = reader.readLine();
			}catch(IOException e){
				
			}
			if(input==null){
				break;
			}
			
			String array[] = input.split(" ");
			int a = Integer.parseInt(array[0]);
			int b = Integer.parseInt(array[1]);
			int num = a+b;
			int cou=0;
			while(num>0){
				num/=10;
				cou++;	
			}
			System.out.println(cou);
		}
	}
}

Measured memory_bytes: 17000
ABC = list(map(int, input().split()))
ABC.sort(reverse=True)
max_val = ABC[0]
second_max_val = ABC[1]
ans = max_val - second_max_val
min_val = ABC[2] + ans
diff = max_val - min_val
if diff % 2 == 0:
    ans += diff // 2
else:
    ans += diff // 2 + 2
print(ans)


Measured memory_bytes: 3060
S = input()
T = input()

k = "abcdefghijklmnopqrstuvwxyz"
D_S = dict((c, []) for c in k)
D_T = dict((c, []) for c in k)

for i in range(len(S)):
    D_S[S[i]].append(i)
    D_T[T[i]].append(i)

for v_s in D_S.values():
    if v_s in D_T.values():
        continue
    print("No")
    break
else:
    print("Yes")


Measured memory_bytes: 14256
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define pb push_back
#define sx 200007
int main()
{
    map<string,int> m;
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC"<<" "<<"x"<<" "<<m["AC"]<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<m["WA"]<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<m["TLE"]<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<m["RE"]<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
//要復習
void Y(){
    cout << "Yes" << endl;
}
void N(){
    cout << "No" << endl;
}
int main(){
    int t;
    cin >> t;
    while(t--){
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        if(a < b or d < b){
            N();
            continue;
        }
        if(c >= b-1){
            Y();
            continue;
        }
        //B<=A,B<=D,C<B
        ll g = __gcd(b,d);
        ll ma = b-g+a%g;
        if(ma > c){
            N();
        }else{
            Y();
        }
    }
}

Measured memory_bytes: 256
//ITP1_8 Ring
 
#include<iostream>
#include<string.h>
#include<stdio.h>
 
using namespace std;
 
int main(){
    string s, ss, p;
    cin >> s;
    cin >> p;
    ss = s + s;  //??????????????£???
//  cout << s.length();
    int flag;
    for(int i = 0; i < s.length(); i++){  //?????????s?????????????????????
        flag = 1;
//      cout << "i:" << i << endl;
        for(int j = 0; j < p.length(); j++){
//          cout << "j:" << j << endl;
//          cout << "ss:" << ss[i+j] << endl;
//          cout << "p:" << p[j] << endl;
            if(ss[i + j] != p[j]){
//              cout << "!!!" << endl;
                flag = 0;
                break;
            }
        }
        if(flag == 1) break;
    }
    if(flag == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL D;
    cin>>D;
    LL c[26];
    LL mem[26];
    for(int i=0;i<26;i++){
        mem[i]=0;
    }
    for(int i=0;i<26;i++){
        cin>>c[i];
    }
    LL ans[D];
    for(int i=0;i<D;i++){
        LL rem=D-i;
        vector<P> v;
        for(int j=0;j<26;j++){
            LL x;
            cin>>x;
            P p;
            p.first=x+(i-mem[j]+1)*rem*c[j];
            p.second=j;
            v.push_back(p);
        }
        sort(v.begin(),v.end());
        P p=v.back();
        ans[i]=p.second;
        mem[p.second]=i+1;
    }

    for(int i=0;i<D;i++){
        cout<<ans[i]+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	int n,k;
	cin>>n>>k;
	vector<int>a(n);
	vector<vector<int>>imos(50,vector<int>(n+2,0));
	rep(i,n){
		cin>>a[i];
		int mi=max(i-a[i],0);
		int ma=min(n-1,i+a[i]);
		imos[0][mi]++;
		imos[0][ma+1]--;
		
	}
	int cur=0;
	rep(j,min(k,50)){
		cur=0;
		bool fin=true;
		rep(i,n){
			cur+=imos[j][i];
			a[i]=cur;
			int mi=max(i-a[i],0);
			int ma=min(n-1,i+a[i]);
			imos[j+1][mi]++;
			imos[j+1][ma+1]--;
			if(a[i]!=n){
				fin=false;
			}
		}
		if(fin){
			rep(i,n){
				cout<<n;
				cout<<((i!=n-1)?" ":"\n");
			}
			return ;
		}
	}
	rep(i,n){
		cout<<a[i];
		cout<<((i!=n-1)?" ":"\n");
	}
}

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


Measured memory_bytes: 44064
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

long long int solve(long long int n){
	if(n==2){return 3;}
	else if(n==4||n==6||n==9||n==11){return 2;}
	else{return 1;}
}

int main() {
	long long int n=0,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>str>>str2;
	if(str==str2){cout<<"H";}
	else{cout<<"D";}



	cout<<endl;
} 


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

int main()
{
	int a, b, c, ans = 0, cnt = 1;
	cin >> a >> b >> c;
	int a2 = a;
	while (c + 0.5 > a2){
		ans += b;
		cnt++;
		a2 = a * cnt;
	}
	cout << ans << endl;
}

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

#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(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

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

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

bool dpx[16001][8000];
bool dpy[16001][8000];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s;
	cin >> s;
	int x, y;
	cin >> x >> y;
	bool fst = s[0] == 'F';
	bool is_x = true;
	vi xs, ys;
	int c = 0;
	REP(i, s.size()) {
		if (s[i] == 'F') c++;
		else {
			(is_x ? xs : ys).push_back(c);
			is_x = !is_x;
			c = 0;
		}
	}
	(is_x ? xs : ys).push_back(c);

	auto dp = dpx + 8000;
	dp[xs[0]][0] = true;
	if (!fst) dp[-xs[0]][0] = true;
	REP1(i, (int)xs.size() - 1) {
		REP(j, 16001) {
			if (dpx[j][i - 1]) {
				dpx[j + xs[i]][i] = true;
				dpx[j - xs[i]][i] = true;
			}
		}
	}


	if ((ys.size()) == 0) {
		if (y) goto YES;
		else {
			if (xs[0] == x)cout << "Yes\n";
			else cout << "No\n";
			return 0;
		}
	}


	dp = dpy + 8000;
	dp[ys[0]][0] = true;
	dp[-ys[0]][0] = true;
	REP1(i, (int)ys.size() - 1) {
		REP(j, 16001) {
			if (dpy[j][i - 1]) {
				dpy[j + ys[i]][i] = true;
				dpy[j - ys[i]][i] = true;
			}
		}
	}
	if (dpx[x + 8000][xs.size() - 1] && dpy[y + 8000][ys.size() - 1]) cout << "Yes\n";
	else cout << "No\n";

	return 0;

YES:;
	if (dpx[x + 8000][xs.size() - 1]) cout << "Yes\n";
	else cout << "No\n";


	return 0;
}


Measured memory_bytes: 127232
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

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

prev = -1
ans = 0
for a, b in ab:
    if a <= prev < b:
        continue
    else:
        ans += 1
        prev = b - 1

print(ans)


Measured memory_bytes: 29084
#include<stdio.h>
int n,x;
int kin;
int i,j;
int dp[1000050],flg[1000050];
int main(void){
	scanf("%d %d",&n,&x);
	for(i=1;i<=1000000;i++){
		flg[i]=1;
	}
	for(i=2;i*i<=1000000;i++){
		if(flg[i]==1){
			for(j=2;j*i<=1000000;j++){
				flg[i*j]=0;
			}
		}
	}
	while(n!=0 && x!=0){
		for(j=1;j<=x;j++){
			dp[j]=-1;
		}
		dp[0]=0;
		for(i=0;i<n;i++){
			scanf("%d",&kin);
			for(j=0;j<=x;j++){
				if(dp[j]!=-1 && j+kin<=x){
					dp[j+kin]=1;
				}
			}
		}
		int max=0;
		for(i=0;i<=x;i++){
			if(dp[i]==1 && flg[i]==1){
				max=i;
			}
		}
		if(max==0){
			printf("NA\n");
		}
		else {
			printf("%d\n",max);
		}
		scanf("%d %d",&n,&x);
	}
	return 0;
}

Measured memory_bytes: 8852
Uses sysutils;
var
	n,l,i,j:Longint;
	s:array[1..100]of String[100];
	t:String[100];
begin
	readln(n,l);
	for i:=1 to n do begin
		readln(s[i]);
	end;
	for i:=1 to n do begin
		for j:=i+1 to n do begin
			if AnsiCompareStr(s[i],s[j])>0 then begin
				t:=s[i];
				s[i]:=s[j];
				s[j]:=t;
			end;
		end;
	end;
	for i:=1 to n do write(s[i]);
end.

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);   
	ll n,a[200009],m,k;
	string s;
	cin>>n;
	m=n%1000;
	if(m==0)
		cout<<m<<endl;
	else
		cout<<ll(1000-m)<<endl;
	return 0;
}

Measured memory_bytes: 3636
use proconio::input;

fn main() {
    input! {
        n:usize,
        a:[[usize; n-1]; n]
    }
    let mut cur = vec![0; n];
    let mut updated = true;
    let mut date = 0;
    while updated {
        date += 1;
        updated = false;
        let mut used = vec![false; n];
        for i in 0..n {
            if used[i] {
                continue;
            }
            if cur[i] >= n - 1 {
                continue;
            }
            let j = a[i][cur[i]] - 1;
            if used[j] {
                continue;
            }
            if cur[j] >= n - 1 {
                continue;
            }
            if a[j][cur[j]] - 1 != i {
                continue;
            }
            cur[i] += 1;
            cur[j] += 1;
            used[i] = true;
            used[j] = true;
            updated = true;
        }
    }
    if cur.iter().any(|x| *x != n - 1) {
        println!("-1");
    } else {
        println!("{}", date - 1);
    }
}


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

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b == 0) return b;
  else gcd(b, a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

struct UnionFind {
  vi par; //par[i] : iの親番号（例）par[3] = 2 : 3の親は2

  UnionFind(int N) : par(N) { //最初は全てが根として初期化
    rep(i,N) par[i] = i;
  }

  int root(int x){ //データxが属する木の根を再帰で得る : root(x) = {xの木の根}
    if(par[x] == x)return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){ //xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if(rx == ry)return; //xとyの根が同じ
    par[rx] = ry; //xとyの根が同じでない時、xの根rxをyの根にryにつける。
  }

  bool same(int x, int y){//2つのデータx，yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main(){

  int n,r;

  while(cin >> n, n){
    cin >> r;
    vi v(n,0);
    vi copy(n,0);
    rep(i,n) v[i] = n - i;

    int p , c;
    rep(i , r){
      vi v2;
      cin >> p >> c;
      int pos = p - 1;

      for(int j = pos ; j < pos + c ; j++){
        v2.pb(v[j]);
        v[j] = 0;
      }

      rep(j,v2.size())
        copy[j] = v2[j];

      for(int j = v2.size();j < n; j++){
        rep(k,n){
          if(v[k] != 0){
            copy[j] = v[k];
            v[k] = 0;
            break;
          }
        }
      }

      rep(j,n)
        v[j] = copy[j];

    }
     cout << v[0] << endl;
  }

  return 0;

}



Measured memory_bytes: 3112
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	String s;
	int i1, i2;
	void intersection(String s1, String s2) {
		if (i1 == s1.length()) return;
		if (s1.charAt(i1) == s2.charAt(i2)) {
			s += s1.charAt(i1);
			i1++; i2++;
			intersection(s1, s2);
		} else {
			if (s1.charAt(i1) == '(') {
				int count = 1;
				i1++;
				while (count > 0) {
					if (s1.charAt(i1) == '(') count++;
					else if (s1.charAt(i1) == ')') count--;
					i1++;
				}
			}
			if (s2.charAt(i2) == '(') {
				int count = 1;
				i2++;
				while (count > 0) {
					if (s2.charAt(i2) == '(') count++;
					else if (s2.charAt(i2) == ')') count--;
					i2++;
				}
			}
			intersection(s1, s2);
		}
	}
	
	void union(String s1, String s2) {
		if (i1 == s1.length()) return;
		if (s1.charAt(i1) == s2.charAt(i2)) {
			s += s1.charAt(i1);
			i1++; i2++;
			union(s1, s2);
		} else {
			if (s1.charAt(i1) == '(') {
				int count = 1;
				s += '(';
				i1++;
				while (count > 0) {
					s += s1.charAt(i1);
					if (s1.charAt(i1) == '(') count++;
					else if (s1.charAt(i1) == ')') count--;
					i1++;
				}
			}
			if (s2.charAt(i2) == '(') {
				int count = 1;
				s += '(';
				i2++;
				while (count > 0) {
					s += s2.charAt(i2);
					if (s2.charAt(i2) == '(') count++;
					else if (s2.charAt(i2) == ')') count--;
					i2++;
				}
			}
			union(s1, s2);
		}
	}
	
	void run() {
		while (sc.hasNext()) {
			char c = sc.next().charAt(0);
			String s1 = sc.next(), s2 = sc.next();
			s = "";
			i1 = i2 = 0;
			if (c == 'i') {
				intersection(s1, s2);
			} else {
				union(s1, s2);
			}
			out.println(s);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

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

int main(void)
{
	int N, A, B;
	cin >> N >> A >> B;

	int total = 0;
	for (int i = A; i <= N; i++) {
		int sum = 0;
		int num = i;
		while (num) {
			int dig = num % 10;
			sum += dig;
			num /= 10;
		}
		if (sum >= A && sum <= B) total += i;
	}
	cout << total << endl;
	return 0;
}

Measured memory_bytes: 256
#!/bin/python3
s=list(input())
t=list(input())

lens=len(s)
lent=len(t)

for i in reversed(range(lens-lent+1)):
  x=s[i:i+lent]
  ans=s
  flag=True
  #print("x",x,len(x))
  for j in range(lent):
    if x[j]!=t[j] and x[j]!="?":
      flag=False
      break
    #if x[j]=="?":
    #  #tと同じ部分
    #  #print("i",i,"j",j)
    #  ans[i+j]=t[j]
  if flag:
    #tより前の部分
    #ans[:i]=["a" if a=="?" else a for a in ans[:i]]
    #tより後ろの部分
    #if i+lent<=lens:
    #  ans[i+lent:lens]=["a" if a=="?" else a for a in ans[i+lent:lens]]
    ans=["a" if a=="?" else a for a in ans[:i]]+\
    	t+["a" if a=="?" else a for a in ans[i+lent:]]
    print("".join(ans))
    exit()
print("UNRESTORABLE")
#print("ans",ans)



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

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

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

int main() {
  vector<vector<int>> c(3);
  rep(i, c.size()) {
    c[i].resize(3);

    rep(j, c[i].size()) {
      cin >> c[i][j];
    }
  }

  bool same = true;
  rep(i, c.size() - 1) {
    rep(j, c[i].size() - 1) {
      if (c[i+1][j] - c[i][j] != c[i+1][j+1] - c[i][j+1]) {
        same = false;
        break;
      } else if (c[i][j] - c[i][j+1] != c[i+1][j] - c[i+1][j+1]) {
        same = false;
        break;
      }
    }
  }

  if (same) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


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

int main() {

  while( true ) {

    long long int n, t, l, b;
    cin >> n >> t >> l >> b;
    if ( n == 0 ) break;

    long long int m[110] = {};
    for ( long long int i = 0; i < l; i++ ) {
      long long int in;
      cin >> in;
      m[in] = 1;
    }
    for ( long long int i = 0; i < b; i++ ) {
      long long int in;
      cin >> in;
      m[in] = 2;
    }

    long double d[110][110] = {};
    d[0][0] = 1.00;

    for ( long long int i = 0; i < t; i++ ) {
      for ( long long int j = 0; j < n; j++ ) {
	for ( long long int k = 1; k <= 6; k++ ) {

	  long long int p = j + k;
	  if ( p > n ) p = n - ( p - n );
	  if ( m[p] == 0 ) {
	    d[i+1][p] += d[i][j] / 6;
	  }else if ( m[p] == 1 ) {
	    d[i+2][p] += d[i][j] / 6;
	  }else if ( m[p] == 2 ) {
	    d[i+1][0] += d[i][j] / 6;
	  }


	}
      }
    }

    long double ans = 0.0;

    for ( long long int i = 0; i <= t; i++ ) {
      ans += d[i][n];
    }

    cout << fixed << setprecision( 10 ) << ans << endl;

  }

  return 0;

}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int ll
//#define endl '\n'

int n,x;

int32_t main()
{
    IOS
    cin>>n;
    int maxx=-2,ans=0;
    for (int i=1;i<=n;i++)
    {
        cin>>x;
        if (x>=maxx) ans++;
        maxx=max(maxx,x);
    }
    cout<<ans<<endl;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc095() {
	ll a, b, c, x, y;
	ll ans = 0;

	cin >> a >> b >> c >> x >> y;

	ll ab = min(x, y);

	if (a + b > 2 * c) {
		ans += 2 * c * ab;
	}
	else {
		ans += (a + b) * ab;
	}

	if (x > y) {
		if (a > 2 * c) {
			ans += 2 * c * (x - y);
		}
		else {
			ans += a * (x - y);
		}
	}
	else {
		if (b > 2 * c) {
			ans += 2 * c * (y - x);
		}
		else {
			ans += b * (y - x);
		}
	}

	cout << ans << "\n";
}

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

	solve_abc095();

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    char ch;
    int counter[26];
    for(int c = 0; c < 26; c++){
        counter[c] = 0;
    }
    
    while(scanf("%c", &ch) != EOF){
        
        if('a' <= ch && ch <= 'z'){
            int num = ch  - 'a';
            counter[num]++;
        } else if('A' <= ch && ch <= 'Z'){
            int NUM = ch - 'A';
            counter[NUM]++;
        }
        
    }
    
    for(int i = 0; i < 26; i++){
        printf("%c : %d\n", i+'a', counter[i]);
    }
    
    return 0;
}



Measured memory_bytes: 3196
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int min=Integer.MAX_VALUE;
        int[][] p=new int[n][2];
        for(int i=0;i<n;i++) {
            p[i][0]=sc.nextInt();
            p[i][1]=sc.nextInt();
        }
        Arrays.sort(p, new Comparator<int[]>() {
            public int compare(int[] a, int[] b) {
                return a[0]-b[0];
            }
        });
        for(int i=1;i<n;i++) {
            min=Math.min(min, (p[i][0]-p[i-1][0])*(p[i][0]-p[i-1][0])+(p[i][1]-p[i-1][1])*(p[i][1]-p[i-1][1]));
        }
        Arrays.sort(p, new Comparator<int[]>() {
            public int compare(int[] a, int[] b) {
                return a[1]-b[1];
            }
        });
        for(int i=1;i<n;i++) {
            min=Math.min(min, (p[i][0]-p[i-1][0])*(p[i][0]-p[i-1][0])+(p[i][1]-p[i-1][1])*(p[i][1]-p[i-1][1]));
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 286696
h,w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
ans = [-1 for i in range(h*w)]
count = 0
for i,x in enumerate(a):
    for j in range(x):
        ans[count] = i+1
        count += 1

for i in range(h):
    if i%2 == 0:
        print(*ans[w*i:w*(i+1)])
    else:
        print(*ans[w *i:w * (i + 1)][::-1])

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

typedef long long ll;
int main() {
    int a,b;cin>>a>>b;
    for(int k=b*10;k<b*10+10;k++){
        if(int(k*0.08)==a&&int(k*0.1)==b) {cout<<k<<endl;return 0;}
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <set>
#include <bitset>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define FORR(i,a,b) for(ll i=a-1;i>=(ll)(b);i--)

#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める

#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)

#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define popcount __builtin_popcount
#define LIST(a, x) memset(a, x, sizeof(a))

char _find(int *arr, int size, int key) {
    int low = -1;
    int high = size;
    int ans = -1;
    while(low+1 < high) {
        int mid = (low + high)/2;
        if(arr[mid] == key) {
            ans = mid; break;
        } else if(arr[mid] > key) {
            high = mid;
        } else {
            low = mid;
        }
    }
    if(arr[low] == key || arr[high] == key) return 1;
    return (!(ans==-1));
}

int main(void){
    ll n, m, ans=0;
    ll i, j, k;

    cin >> n;
    int s[n];
    FOR(i, 0, n) cin >> s[i];
    n = unique(s, s+n) - s;

    cin >> m;
    ll t;
    FOR(i, 0, m){
        cin >> t;
        ans += _find(s, n, t);
    }

    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 3464
#include <stdio.h>
#include <math.h>

long long a, b, c;
double x;
double the;

int main(void)
{
	scanf("%lld %lld %lld", &a, &b, &c);
	
	if((double)c / (double)a > double(a) * double(b) / 2)
	{
		c *= 2;
		
		double y = double(c) / (double)a / (double)a - (double)b;
		y = (double)b - y;
		
		the = atan2((double)a, y);
		the *= 180;
		the /= 3.1415926535897932384626433832795;
		
		printf("%.11f", 90 - the);
	}
	
	else
	{
		c *= 2;
	
		the = atan2((double)a * (double)b * (double)b, (double)c);
		the *= 180;
		the /= 3.1415926535897932384626433832795;
		
		printf("%.11f", the);
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int N = S.size();
    int ans = 0;
    for(int i=0;i<N/2;i++){
        ans += (S[i]!=S[N-i-1]);
    }
    cout << ans << endl;
}

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

#define DEBUG

#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

//#define int long long
typedef long long ll;
//constexpr int INF = 1e9;
//constexpr int MOD = 1000000007;

decltype(1) main() {
    //cin.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (!(i % 3 == 0 || i % 5 == 0 || i % 15 == 0)) {
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

def doubling(MAX, A):
    """ ダブリング """

    N = len(A)
    nxt = list2d(MAX, N, -1)
    sm = list2d(MAX, N, 0)
    for i, a in enumerate(A):
        nxt[0][i] = a
        sm[0][i] = a
    for k in range(1, MAX):
        for i in range(N):
            nxt[k][i] = nxt[k-1][nxt[k-1][i]]
            sm[k][i] = sm[k-1][i] + sm[k-1][nxt[k-1][i]]
    return (nxt, sm)

N, X, M = MAP()

MAX = 40
A = [0] * M
for i in range(M):
    A[i] = pow(i, 2, M)
nxt, sm = doubling(MAX, A)

cur = X
ans = X
N -= 1
for k in range(MAX-1, -1, -1):
    if N >> k & 1:
        ans += sm[k][cur]
        cur = nxt[k][cur]
print(ans)


Measured memory_bytes: 171196
import java.util.*;

public class Main {
    //-------------------------------------------------------------//
    public static final void main(String[] args) {
        new Main().solve();
    }
    //-------------------------------------------------------------//
    private final Scanner sc = new Scanner(System.in);

    void solve() {
        sc.next();
        String s = sc.next();
        int l = 0;
        int r = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '(') l++;
            else r++;
            if (r > l) {
                s = "(" + s;
                i++;
                l++;
            }
        }
        l = r = 0;
        for (int i = s.length() - 1; i >= 0; i--) {
            if (s.charAt(i) == ')') r++;
            else l++;
            if (l > r) {
                s = s + ")";
                r++;
            }
        }
        System.out.println(s);
    }
}

Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);

		while (true) {
			int n = s.nextInt();
			if (n == 0)
				break;

			int ans = 0;
			int count = 0;

			for (int i = 1; i < n; i++) {
				for (int j = i; j < n; j++) {
					ans += j;
					if (ans == n)
						count++;
					if (ans >= n)
						break;
				}
				ans = 0;
			}
			System.out.println(count);
		}
		s.close();
	}
}

Measured memory_bytes: 19996
#include <stdio.h>
 
struct pair {
  int x;
  int ar;
};
int top_stack1 = 0, top_stack2 = 0;
int stack1[20000];
struct pair stack2[20000];
  
void push_stack1(int x) {
  stack1[top_stack1] = x;
  top_stack1++;
}
 
void push_stack2(int j, int a) {
  stack2[top_stack2].x = j;
  stack2[top_stack2].ar = a;
  top_stack2++;
}
 
int pop_stack1(void) {
  int r = 0;
 
  top_stack1--;
   
  if(top_stack1 < 0) {
    top_stack1 = 0;
    return 0;
  }
  r = stack1[top_stack1];
  return r;
 
}
 
struct pair pop_stack2(void) {
  struct pair s;
 
  top_stack2--;
   
  if(top_stack2 < 0) {
    top_stack2 = 0;
    return;
  }
  s = stack2[top_stack2];
  return s;
 
}
int main() {
  int i, j;
  int sum = 0, a;
  struct pair c;
  char input[20000];
 

  scanf("%s", input);

  for (i = 0; input[i] != '\0'; i++) {
    if(input[i] == '\\') push_stack1(i);
    else if((input[i] == '/') && (top_stack1 > 0)) {
      j = pop_stack1();
      sum += i - j;
      a = i - j;
      while ((top_stack2 > 0) && stack2[top_stack2 - 1].x > j) {
        a += stack2[top_stack2 - 1].ar ;
        c = pop_stack2();
      }
      push_stack2(j, a);
    }
  }

  printf("%d\n", sum);
  printf("%d", top_stack2);
  for(i = 0; i < top_stack2; i++) {
    if(i < top_stack2) printf(" ");
    printf("%d", stack2[i].ar);
  }
  printf("\n");
 
 
  return 0;
}

Measured memory_bytes: 640
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int mod = 998244353;
        int N = in.i();
        int K = in.i();

        int[] LR = new int[K * 2];
        for (int i = 0; i < LR.length; ) {
            LR[i++] = in.i();
            LR[i++] = in.i();
        }

        long[] dp = new long[N + 1];
        dp[1] = 1;

        long[] sum = new long[N + 2];
        sum[2] = 1;

        for (int i = 2; i <= N; i++) {
            for (int j = 0; j < LR.length; ) {
                int r = i - LR[j++];
                int l = i - LR[j++];
                if (r < 1) continue;
                if (l < 1) l = 1;
                dp[i] = (dp[i] + sum[r + 1] - sum[l]) % mod;
            }
            sum[i + 1] = (sum[i] + dp[i]) % mod;
        }
        
        out.println((dp[N] + mod) % mod);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 36356
//Jai Sai Ram 
// Please help me in every situation 
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n"
ll P=1e9+7;
vector<ll> adj[100001];
ll a[100001],b[100001];
void solve()
{
    ll i,j,k,l,m,n,o,p,q,r,t;
    cin>>k;
    string ans="";
    for(i=0;i<k;i++)
    {
        ans+="ACL";
    }
    cout<<ans<<endl;
}
int main()
{
    ll t=1;
    ios_base::sync_with_stdio(false);
    cin.tie(0);

   //cin>>t;
   ll i=1;
    while(t--)
    {
      
        solve();
        i++;
    }
    return 0;
}


Measured memory_bytes: 6016
c=0
array=[]
while s=gets
    array<<s.split(",").map(&:to_i)
    c+=1
end
sum=[]
sum[0]=[array[0][0]]
for i in 1..c do
    sum[i]=[]
    if i<=c/2
        for j in 0..i
            x=0;y=0
            x=sum[i-1][j-1] if (j-1>=0)
            y=sum[i-1][j] if (j<i)
            sum[i][j]=([x,y].max)+array[i][j]
        end
    else
        for j in 0..c-1-i do
            x=sum[i-1][j+1]
            y=sum[i-1][j]
            sum[i][j]=([x,y].max)+array[i][j]
        end
    end
end

puts sum[c-1]

Measured memory_bytes: 6112
n,m = map(int,input().split())
li = list(map(int,input().split()))
tmp_li = []
for _ in range(m):
    b,c = map(int,input().split())
    tmp_li.append([c,b])
tmp_li.sort(reverse=True)
#print(tmp_li)
count = 0
for t in tmp_li:
    li += [t[0]]*t[1]
    if len(li)>=2*n:
        break
li.sort(reverse=True)
print(sum(li[:n]))

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

template <typename InputIterator>
typename InputIterator::value_type
summation(InputIterator first, InputIterator last) {
  using T = typename InputIterator::value_type;
  T *p = new T();
  const auto sum = std::accumulate(first, last, *p);
  delete p;
  return sum;
}
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  std::string s1, s2, s3;
  std::cin >> s1 >> s2 >> s3;

  std::cout << static_cast<char>('A' - 'a' + s1.front())
  << static_cast<char>('A' - 'a' + s2.front())
  << static_cast<char>('A' - 'a' + s3.front()) << std::endl;
  return 0;
}

Measured memory_bytes: 256
def foo(n):
    if n == 0:
        return "0"
    else:
        res = ""
        while n != 0:
            r = n % (-2)
            n = n // (-2)
            if r < 0:
                n += 1
                r += 2
            res += str(r)
    return "".join(reversed(res))


n = int(input())
print(foo(n))


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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;

void solve() {
	int n;
	cin >> n;
	int d = n%10;
	if(d==3){
		cout << "bon" << endl;
	}else if(d==0 || d==1 || d==6 || d==8){
		cout << "pon" << endl;
	}else{
		cout << "hon" << endl;
	}
}

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

Measured memory_bytes: 3616
K=int(input())
S=input()
M=len(S)
N=K+M
mod=10**9+7
ans=pow(26,N,mod)
class Data():
    def __init__(self):
        self.power=1
        self.rev=1     
class Combi():
    def __init__(self,N,mod):
        self.lists=[Data() for _ in range(N+1)]
        self.mod=mod  
        for i in range(2,N+1):
            self.lists[i].power=((self.lists[i-1].power)*i)%self.mod
        self.lists[N].rev=pow(self.lists[N].power,self.mod-2,self.mod)
        for j in range(N,0,-1):
            self.lists[j-1].rev=((self.lists[j].rev)*j)%self.mod

    def combi(self,K,R):
        if K<R:
            return 0
        else:
            return ((self.lists[K].power)*(self.lists[K-R].rev)*(self.lists[R].rev))%self.mod
        
c=Combi(2*10**6,mod)
for i in range(M):
    ans-=c.combi(N,i)*pow(25,N-i,mod)
    ans%=mod
print(ans%mod)


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

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

int main() {
  ll n,k = 0;
  cin >> n;
  n++;
  while(n/10>0) {
    n/=10;
    k++;
  }
  cout<< n + 9*k -1;
}

Measured memory_bytes: 256