akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AizuRPN solver = new AizuRPN();
        solver.solve(1, in, out);
        out.close();
    }

    static class AizuRPN {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            final String s = in.nextLine().trim();

            AizuRPN.Stack st = new AizuRPN.Stack(1000);
            String[] input = s.split(" ");

            for (String x : input) {
                if (x.equals("+")) {
                    long b = Long.parseLong(st.pop());
                    long a = Long.parseLong(st.pop());

                    st.push(String.valueOf(a + b));
                } else if (x.equals("-")) {
                    long b = Long.parseLong(st.pop());
                    long a = Long.parseLong(st.pop());

                    st.push(String.valueOf(a - b));
                } else if (x.equals("*")) {
                    long b = Long.parseLong(st.pop());
                    long a = Long.parseLong(st.pop());

                    st.push(String.valueOf(a * b));
                } else {
                    st.push(x);
                }
            }

            out.printf("%s\n", st.pop());
        }

        static class Stack {
            private String[] a;
            private int top;

            public Stack(final int n) {
                a = new String[n];
                top = -1;
            }

            public boolean isEmpty() {
                return top == -1;
            }

            public void push(String c) {
                a[++top] = c;
            }

            public String pop() {
                if (isEmpty()) {
                    throw new IllegalStateException("empty stack");
                }

                return a[top--];
            }

        }

    }
}




Measured memory_bytes: 26512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int32_t main()
{
	string o,e;
	cin>>o>>e;
	int n=o.length()+e.length();
	string ans="";
	for(int i=0;i<n;i++)
	{
		if(i&1)
		{
			ans+=e[i/2];
		}
		else ans+=o[i/2];
	}
		cout<<ans;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
#define endl cout << "\n"
typedef long long ll;
int main(){
    // ios::sync_with_stdio(false);
    // cin.tie(NULL);
    map<int, int> m;
    vector<int> v;
    int t, a;
    cin >> t;
    int b=t-1;
    while(b--){
    	cin >> a;
    	m[a]++;
    }

    for(int i=1; i<=t; ++i){
    	cout << m[i] << "\n";
    }
    
    bye;
}

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

class Program
{
    public struct Restrant 
    {
        public string name;
        public int score;
        public int id;
    }
    static void Main(string[] args)
    {

        int N = int.Parse(Console.ReadLine());
        List<Restrant> list = new List<Restrant>();
        for (int i = 0; i < N; i++)
        {
            string[] input = Console.ReadLine().Split(' ');
            Restrant line = new Restrant();
            line.name = input[0];
            line.score = int.Parse(input[1]);
            line.id = i + 1;
            list.Add(line);
        }
        var ans = list.OrderBy(x => x.name).ThenByDescending(x => x.score);
        foreach(var sm in ans)
        {
            Console.WriteLine(sm.id);
        }
    }
 }

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

int main() {
    int a, b;
    cin >> a >> b;
    int list[13] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1};
    int anum, bnum;
    for (int i = 0; i < 13; i++) {
        if (a == list[i]) {
            anum = i;
        }
        if (b == list[i]) {
            bnum = i;
        }
    }
    if (anum < bnum) {
        cout << "Bob";
    } else if (anum > bnum) {
        cout << "Alice";
    } else {
        cout << "Draw";
    }

        return 0;
}

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

int main(){
  int n;
  cin >> n;
  int a = 0, b = 0, c = 0, d = 0;
  for(int i = 0; i < n; i++){
    string k;
    cin >> k;
    if(k.at(0) == 'A'){
      a++;
    }
    else if(k.at(0) == 'W'){
      b++;
    }
    else if(k.at(0) == 'T'){
      c++;
    }
    else{
      d++;
    }
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}





Measured memory_bytes: 3628
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            String strSplit[] = br.readLine().split(" ");
            int H = Integer.parseInt(strSplit[0]);
            int W = Integer.parseInt(strSplit[1]);
            char HW[][] = new char[H][W];
            int xNESW[] = {0, 1, 1 ,1 ,0 ,-1, -1, -1};
            int yNESW[] = {-1, -1, 0, 1, 1, 1, 0, -1};
            
            for(int i=0; i<H; i++){
                String str = br.readLine();
                for(int j=0; j<W; j++){
                    HW[i][j] = str.charAt(j);
                }
            }
            
            /*for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                    System.out.print(HW[i][j]);
                }
                System.out.println();
            }*/
            
            
            for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                    int count = 0;
                    
                    if(HW[i][j] == '.'){
                        for(int k=0; k<8; k++){
                            if((i+yNESW[k]) >= 0 && (i+yNESW[k])<H && (j+xNESW[k])>=0 && (j+xNESW[k])<W && HW[i+yNESW[k]][j+xNESW[k]] == '#'){
                                if(HW[i][j] == '.'){
                                    HW[i][j] = '1';
                                }else{
                                    HW[i][j]++;
                                }
                                count++;
                            }
                        }
                        
                        if(count == 0){
                            HW[i][j] = '0';
                        }
                    }
                }
            }
            
            for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                    System.out.print(HW[i][j]);
                }
                System.out.println();
            }
            
        }catch(Exception e){
            
        }
    }
}

Measured memory_bytes: 33300
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <regex>
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
typedef long long ll;
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    regex re("A[a-z][a-z]*C[a-z]*[a-z]");
    if (regex_match(s, re) == 1)
    {
        cout << "AC" << endl;
    }
    else
    {
        cout << "WA" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
if m != 0:
  a = [list(map(int,input().split())) for raw in range(m)]
  b = sorted(a)
  ans = 0
  if int((b[0])[0]) != 1:
    ans += 10**(n-1)
  t = 0
  u = -1
  che = 0
  for hoge in b:
    x = hoge[0]
    y = hoge[1]
    if x == 1 and y == 0:
      if n != 1:
        che += 1
    if x != t:
      ans += y*(10**(n-x))
    if x == t and y != u:
      che +=1
    t = x
    u = y
  if che == 0 and ans !=0:
    print(ans)
  elif che == 0 and n == 1:
    print(0)
  else:
    print(-1)
else:
  if n == 1:
    print(0)
  else:
    print(10**(n-1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define sci1(a) scanf("%d",&a)
#define sci2(a,b) scanf("%d %d",&a,&b)
#define sci3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define scs(s) scanf("%s",s)
#ifndef GET_MACRO

#define GET_MACRO(__1,__2,__3,NAME,...) NAME

#endif // GET_MACRO

#define sci(...) GET_MACRO(__VA_ARGS__,sci3,sci2,sci1)(__VA_ARGS__)

int main(){
    int n,k,x;
    sci(n,k);
    x=n-(k-1);
    if(k==1)x=1;
    printf("%d\n",x-1);
    return 0;
}


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

int main() {
  int x[5];
  for (int i = 0; i < 5; i++) x[i]=i+1;
  int y[5];
  for (int i = 0; i < 5; i++) {
    cin >> y[i];
    if (y[i]==0) {
      cout << x[i] << endl;
      break;
    }
  }
}

Measured memory_bytes: 3632
import java.util.*;
public class Main{

     public static void main(String []args){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        if(n==1)
            System.out.println("Hello World");
        else{
          int a=sc.nextInt(),b=sc.nextInt();
          System.out.println(a+b);
        }
     }
}

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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}

int n;
int dp[12000];
int main() {
    cin >> n;
    dp[0] = 1;
    int s = 0;
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        for (int j = s; j >= 0; --j) {
            if (dp[j])
                dp[j + k] = 1;
        }
        s += k;
    }
    int ans = 0;
    for (int i = 0; i <= s; ++i)
        if (i % 10 != 0 && dp[i])
            ans = i;
    cout << ans << "\n";
    return 0;
}




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

int main(){
    long int N,A,B,C,D,E;
    cin>>N>>A>>B>>C>>D>>E;
    long int nef=min({A,B,C,D,E});
    long int t=(N-1)/nef+5;
    cout<<t;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define ms(a,b) memset(a,b,sizeof(a));
#define mp make_pair
#define pb push_back
typedef  unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1e6+1;
using namespace std;
const ll mod = 1e9+7;
char _;
ll N, D, dp[10100][110][2][2]; string s;
// dp holds position, previous sum % MOD, lmt,
ll solve (ll pos,ll prevsum,  bool lmt, bool zero){
    ll ret = dp[pos][prevsum][lmt][zero];
    if (ret!= -1) return ret;
    if(pos == s.size()) return (prevsum%D==0);
    int v = s[pos] - '0', bound = lmt? v : 9; ret = 0;
    for(int i = (zero && pos == s.size()-1); i <= bound; ++i){
        ret += solve(pos+1, (prevsum+i)%D, lmt && i == v, zero && i == 0);
        ret %= mod;
    }
    return dp[pos][prevsum][lmt][zero] = ret;
}
int main()
{
    ms(dp, -1);
    cin>>s;
    cin>>D;
    cout<<solve(0,0,1,1)<<endl;
    return 0;
}


Measured memory_bytes: 39416
import java.io.*;

public class Main{

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] alfa = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
                        'n','o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
        int[] counter = new int[26];
        String str;

        while((str = br.readLine()) != null){

            //?°????????????±?????????????§£
            str = str.toLowerCase();
            char[] strArray = str.toCharArray();

            for(int i=0; i<strArray.length; i++){
                for(int k=0; k<26; k++){
                    if(alfa[k] == strArray[i]) counter[k]++;
                }
            }
        }
        //??????
        for(int i=0; i<26; i++){
            System.out.println(alfa[i] +" : "+ counter[i]);
        }
    }   
}

Measured memory_bytes: 24244
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for(auto i=0; i<(n); i++)
#define repd(i,n) for(auto i=(n)-1; i>=0; i--)
#define repf(i,a,b) for(auto i=(a); i<=(b); i++)
#define repe(i,l) for(auto i: l)
#define mem(x,val) memset((x),(val),sizeof(x));
#define rite(x) freopen(x,"w+",stdout);
#define read(x) freopen(x,"rt",stdin);
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define pb push_back
#define clr clear()
#define INF ((int)0x3f3f3f3f)
#define ins insert
#define xx first
#define yy second
#define eps 1e-9
#define endl '\n'
#define _ ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.precision(10);cout<<fixed;
template<class T> T abs(T x) { return x > 0 ? x : -x; }
template<class T> T mini(T x, T y) { return x <  y? x : y; }
template<class T> T maxi(T x, T y) { return x <  y? y : x; }
template<class T> T gcd(T a, T b) { return a%b? gcd(b, a%b) : b; }
typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef long long ll;
typedef unsigned long long ull;

#define MOD ((int)1e9 + 7)
#define MAX 1000007

int main() {_
	//Solution
	#ifdef LOCAL
		// read("arc097_a.in");
		// rite("arc097_a.out");
	#endif
	
	
	st s;
	int k;
	cin >> s >> k;
	int n = s.length();
	vs subs;
	msi m; 
	
	int pre = 0;
	rep(i, n){
		st sub = "";
		repf(j, i, mini(n-1, i+k)){
			sub += s[j];
			if(!m[sub] && sub != ""){
				subs.pb(sub);
			}
			m[sub] = 1;
		}
	}

	sort(all(subs));
	// int sz = sz(subs);
	// rep(i, sz) cout << subs[i] << " \n"[i==sz-1];
	cout << subs[k-1] << endl;
	
	
	
	
	
	
	
	
	#ifdef LOCAL
		//cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << endl;
	#endif
   	
	return 0;
}


/*

	g++-6 -std=c++11 arc097_a.cpp -o arc097_a -DLOCAL && ./arc097_a


*/






Measured memory_bytes: 2684
#include <cstdio>
#include <queue>
#include <cstdlib>
#include <cstring> 
#define Max(A, B) A > B ? A : B 
#define Reg register
namespace Quick_In {
    char b[1<<15],*s = b,*t = b;
    #define GetC() (s == t && (t = (s = b) + fread(b, 1, 1 << 15, stdin), s == t) ? 0 : *s++)
    int Read() {
        Reg char C; Reg int A;
        while(C = GetC(),(C < '0' || C > '9'));
        A = C - '0';
        while(C = GetC(),C >= '0' && C <= '9')  A = (A << 3) + (A << 1) + C - '0';
        return A;
    }
}
using namespace Quick_In;
typedef long long LL;
std::queue<LL> Queue;
const LL MaxN = 1e6 + 10;
const LL Inf = 214748364;
LL N, K, M, X, Y;
LL Dis[MaxN * 2];
struct Edge {
    LL To, Next, Val;
}Road[MaxN];
LL Cnt = 0, Last[MaxN];
void Add(LL U, LL V, LL Val) {
    Road[++Cnt] = (Edge){V, Last[U], Val}, Last[U] = Cnt;
}
bool InQueue[MaxN];
LL Count[MaxN];
LL Spfa(int Now) {
    for(LL i = 0; i < MaxN; i++) Dis[i] = Inf, InQueue[i] = false;
    Queue.push(Now); InQueue[Now] = 1; Dis[Now] = 0;
    while(!Queue.empty()) {
        LL Top = Queue.front(); 
        for(LL i = Last[Top]; i; i = Road[i].Next) {
            LL To = Road[i].To;
            if(Dis[Top] + Road[i].Val < Dis[To]) {
                Dis[To] = Dis[Top] + Road[i].Val;
                if(!InQueue[To]) {                 
                    Queue.push(To);
                    InQueue[To] = true;
                } 
            }
        }
		Queue.pop(); InQueue[Top] = false; 
    }	
}
int main() {
    //N = Read(); 
	scanf("%lld", &N);
    for(int i = 0; i < N; i++)  
			Add(i, (i + 1) % N, 1),
			Add(i, (i * 10) % N, 0); 
	Spfa(1);
	printf("%lld", Dis[0] + 1); 
} 

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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    string s; cin>>s;
    int n=sz(s);

    int gn=0, pn=0, res=0;
    while(gn+pn<n){
        if(gn==pn){
            if(s[gn+pn]=='p')res--;
            gn++;
        }else if(gn>pn){
            if(s[gn+pn]=='g')res++;
            pn++;
        }
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

typedef struct {
  char suit;
  int num;
  int idx;
} Card;

void BubbleSort(Card C[], int N){
Card tmp;
  int stable;
  int i, j;
  for(i = 0; i < N-1; ++i) {
    for(j = N-1; j > i; --j) {
      if(C[j].num < C[j-1].num) {
        tmp = C[j];
        C[j] = C[j-1];
        C[j-1] = tmp;
      }
       }
  }
  stable = 1;
  for(i = 0; i < N; ++i) {
    printf("%c%d%c", C[i].suit, C[i].num, " \n"[i==N-1]);
    if(i > 0 && C[i].num == C[i-1].num && C[i].idx < C[i-1].idx) stable = 0;
  }
  puts((stable ? "Stable" : "Not stable"));
}
void SelectionSort(Card C[], int N){
     Card tmp;
    int minj;
    int stable;
    int i, j;
    for(i = 0; i < N; ++i) {
      minj = i;
      for(j = i; j < N; ++j) {
        if(C[j].num < C[minj].num) minj = j;
      }
      tmp = C[i];
      C[i] = C[minj];
      C[minj] = tmp;
    }
    stable = 1;
    for(i = 0; i < N; ++i) {
      printf("%c%d%c", C[i].suit, C[i].num, " \n"[i==N-1]);
      if(i > 0 && C[i].num == C[i-1].num && C[i].idx < C[i-1].idx) stable = 0;
    }
    puts((stable ? "Stable" : "Not stable"));
}

int main() {
  int N;
  Card C1[36], C2[36];
  int i;

  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    scanf(" %c%d", &C1[i].suit, &C1[i].num);
    C1[i].idx = i;
    C2[i] = C1[i];
  }

  BubbleSort(C1, N);
  SelectionSort(C2, N);

  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n, k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for(int i = 0; i < k; i++) {
		int add[n + 1] = {0};
		for(int j = 0; j < n; j++) {
			add[max(0LL, j - a[j])]++;
			add[min(n, j + a[j] + 1)]--;
		}
		bool done = (add[0] == n);
		for(int j = 1; j < n; j++) {
			add[j] += add[j - 1];
			if(add[j] != n) {
				done = 0;
			}
		}
		for(int j = 0; j < n; j++) {
			a[j] = add[j];
		}
		if(done) {
			break;
		}
	}
	for(int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}

	return 0;
}

Measured memory_bytes: 6784
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

bool backpack01(vector<int>& arr, int target) {
    int s = accumulate(arr.begin(), arr.end(), 0);
    if (target > s) return false;
    vector<bool> dp(s+1, false);
    dp[0] = true;
    for(int num: arr) {
        for(int i = s; i >= 0; i--) {
            if (i - num >= 0)
                dp[i] = dp[i] | dp[i-num];
        }
    }
    return dp[target];
}
int main() {
    int x, y;
    string s;
    cin >> s >> x >> y;
    int cnt = 0, axis = 0;

    unordered_map<int, vector<int>> cmd;
    char pre = '@';
    for(char c: s) {
        if (c == 'T') {
            if (pre == 'F' || pre == '@') {
                cmd[axis%2].push_back(cnt);

            }
            axis += 1;
            cnt = 0;
        } else {
            cnt += 1;
        }
        pre = c;
    }
    if (s.back() == 'F')
        cmd[axis%2].push_back(cnt);
    /*
    for(int i = 0; i < cmd[0].size(); i++)
        cout << cmd[0][i] << " ";
    cout << "ker" << endl; */
    vector<int> cmd_x;
    for(int i = 0; i < cmd[0].size(); i++) {
        if (i == 0)
            x -= cmd[0][i];
        else
            cmd_x.push_back(cmd[0][i]);
    }
    x = abs(x);
    y = abs(y);
    int sum_x = accumulate(cmd_x.begin(), cmd_x.end(), 0);
    int sum_y = accumulate(cmd[1].begin(), cmd[1].end(), 0);
    // cout << x << " " << sum_x << endl;
    // cout << y << " " << sum_y << endl;
    if (sum_x < x || sum_y < y) {
        cout << "No" << endl;
    } else if ((sum_x - x) % 2 == 1 || (sum_y - y) % 2 == 1) {
        cout << "No" << endl;
    } else {
        if (backpack01(cmd_x, (sum_x - x)/2) && backpack01(cmd[1], (sum_y - y)/2))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    // pos - neg == target
    // sum(pos, neg) - target = neg*2
    return 0;
}




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

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var nx = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = nx[0];
            var x = nx[1];
            var m = new List<int>();

            for(int i = 0; i < n; i++)
            {
                m.Add(int.Parse(Console.ReadLine()));
            }

            x -= m.Sum();
            var ans = n;

            while(x > 0)
            {
                if (x - m.Min() >= 0)
                {
                    x -= m.Min();
                    ans++;
                }
                else
                {
                    break;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 36108
#include <stdio.h>
#include <stdlib.h>

#define l 100
#define INFTY (1<<21)
#define max 100000

int n , m[l][l];
int d[l];

int head,tail;
int q[max];

void initialize()
{
	head = tail = 0;
}

int isEmpty()
{
	if(head == tail)
	{
		return 1;
	}
	else{
		return 0;
	}
}

int isFull()
{
	if(head == (tail + 1) % max)
	{
		return 1;
	}
	else{
		return 0;
	}
}

void enqueue(int x)
{
	if(isFull() == 1)
	{
		fprintf(stderr,"エラー");
	}
	else{
		q[tail] = x;
		if(tail + 1 == max)
		{
			tail = 0;
		}
		else{
			tail++;
		}
	}
}

int dequeue()
{
	int x;
	if(isEmpty() == 1)
	{
		fprintf(stderr,"エラー");
		exit(0);
	}
	else{
		x = q[head];
		if(head + 1 == max)
		{
			head = 0;
		}
		else{
			head++;
		}
		return x;
	}
}

void bfs(int s)
{
	enqueue(s);
	for(int i= 0; i <n; i++)
	{
		d[i] = INFTY;
	}
	d[s] = 0;
	int u;
	while(!isEmpty())
	{
		u = dequeue();
		for( int v = 0; v < n; v++)
		{
			if(m[u][v] == 0){continue;}
			if(d[v] != INFTY){continue;}
			d[v] = d[u] + 1;
			enqueue(v);
		}
	}
	for(int i = 0; i < n; i++)
	{
		printf("%d ",i+1);
		if(d[i] == INFTY) printf("-1\n");
		else printf("%d\n",d[i]);
	}
}

int main()
{
	int u, k,v;
	scanf("%d",&n);
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			m[i][j] = 0;
		}
	}
	for( int i = 0; i < n; i++)
	{
		scanf("%d",&u);
		scanf("%d",&k);
		u--;
		for(int j = 0; j < k; j++)
		{
			scanf("%d",&v);
			v--;
			m[u][v] = 1;
		}
	}
	bfs(0);
	return 0;
}



Measured memory_bytes: 2104
h, w, k = map(int, input().split())
s = [input() for i in range(h)]

ret = 10 ** 18
for bit_state in range(1 << (h - 1)):
    memo = {}
    pos = 0
    res = 0
    for i in range(h - 1):
        memo[i] = pos
        if bit_state & (1 << i):
            pos += 1
    memo[h - 1] = pos
    len_m = (pos + 1)
    ans = [0] * len_m
    
    flag = False
    for j in range(w):
        tmp = [0] * len_m
        for i in range(h):
            if s[i][j] == "1":
                tmp[memo[i]] += 1
        for i in range(len_m):
            if tmp[i] > k:
                flag = True
        for i in range(len_m):
            if tmp[i] + ans[i] > k:
                res += 1
                for i in range(len_m):
                    ans[i] = tmp[i]
                break
        else:
            for i in range(len_m):
                ans[i] += tmp[i]
    if not flag:
        ret = min(ret, res + len_m - 1)
print(ret)

Measured memory_bytes: 47580
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		long X = Long.valueOf(s.next());
		long K = Long.valueOf(s.next());
		long D = Long.valueOf(s.next());

		if(X < 0) {
			X = X * -1;
		}

		if(X/D >= K) {
			System.out.println(X - K * D);
			return;
		}

		long d = X / D;

		// 奇数
		if(d % 2 == 1) {
			// 奇数
			if(K % 2 == 1) {
				System.out.println(X % D);
				return;
			// 偶数
			}else {
				System.out.println(D - (X % D));
				return;
			}
		}else {
			// 奇数
			if(K % 2 == 1) {
				System.out.println(D - (X % D));
				return;
				// 偶数
			}else {
				System.out.println(X % D);
				return;
			}
		}
	}
}

Measured memory_bytes: 35612
n = int(input())
s = input()

def acceptable(ary):
    flag = True
    if ary[0]:
        if s[0] == 'o':
            flag = ary[1] == ary[-1]
        else:
            flag = ary[1] != ary[-1]
    else:
        if s[0] == 'x':
            flag = ary[1] == ary[-1]
        else:
            flag = ary[1] != ary[-1]
    if ary[-1]:
        if s[-1] == 'o':
            flag = flag and ary[0] == ary[-2]
        else:
            flag = flag and ary[0] != ary[-2]
    else:
        if s[-1] == 'x':
            flag = flag and ary[0] == ary[-2]
        else:
            flag = flag and ary[0] != ary[-2]
    return flag

def solve(ary):
    for i in range(1, n-1):
        if ary[i]:
            if s[i] == 'o':
                ary.append(ary[i-1])
            else:
                ary.append(not ary[i-1])
        else:
            if s[i] == 'x':
                ary.append(ary[i-1])
            else:
                ary.append(not ary[i-1])
    return ary

def print_ans(ans):
    print(''.join(['S' if a else 'W' for a in ans]))

for t in ([True, True], [True, False], [False, True], [False, False]):
    ans = solve(t)
    if acceptable(ans):
        print_ans(ans)
        exit()
print(-1)


Measured memory_bytes: 7284
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;

typedef long long ll;

int main(void) {
	ll N;
	stringstream ss;
	int ans;

	cin >> N;
	ans = 100;
	for (ll A = 1; A * A <= N; ++A) {
		if (N % A != 0)
			continue;
		ll B = N / A;
		ll num = max(A, B);
		
		ss.str("");
		ss.clear();
		ss << num;
		string str = ss.str();
		ans = min(ans, (int)str.length());
	}

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


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


using namespace std;
double pi=3.14159265358979323846264338;


inline void ex(){cout<<"Yes"<<endl;exit(0);}
long long a,b,c,d;
const long long N=1000000007;

long long n;
long long arr[4];
long long arr2[2][4];
int main(){
	
	int cnt=0;
	cin>>n;
	for(long long i=0;i<n;i++){
		cin>>a>>b;
		if(a==b)cnt++;
		else cnt=0;
		if(cnt==3)ex();
	}
	cout<<"No"<<endl;
	return 0;
			
}

Measured memory_bytes: 3616
#include<stdio.h>
 
int main(void){
 
int H,W,x,y;
 
while(1){
 
scanf("%d %d",&H,&W);
 
if(H == 0 && W ==0)
break;
for(y=0; y<H;y++){
for(x=0; x<W; x++){
 
printf("#");
 
}
 
printf("\n");
 
}
printf("\n");
}
return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  vector<pair<long long,long long>>P(N);

  for (int i = 0; i < N; i++) { 
    cin >> P.at(i).second >> P.at(i).first;
  }
  sort(P.begin(), P.end());
  
  long long time = 0;
  for (int i = 0; i < N; i++) { 
    if (time + P.at(i).second > P.at(i).first){
      cout << "No" << endl;
      return 0;
    }
    time += P.at(i).second;
  }
  cout << "Yes" << endl;
}
  
      
    

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

int main()
{
  int64_t a, b;
  cin >> a >> b;
  if ((a - b) % 2 != 0)
  {
    cout << "IMPOSSIBLE" << endl;
  }
  else
  {
    cout << abs(a - (a - b) / 2) << endl;
  }
}

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

int main(){
    
    int h, w;
    cin >> h >> w;
    while (h!=0 || w!=0){
        for (int i=0;i<h;i++){
            for (int j=0;j<w;j++){
                if (i==0 || i==h-1)cout << "#";
                else if(j==0 || j==w-1)cout << "#";
                else cout << ".";
            }
            cout << "\n";
        }
        cout << endl;
        cin >> h >> w;
    }
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
#define prep(i,n) for(int64_t i=1;i <= (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  fspcnt = 0;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int a,b;
  cin >> a >> b;
  int cnt = 0;
  for(int i=a;i <= b;i++){
    string s = to_string(i);
    string t = to_string(i);
    reverse(t.begin(),t.end());
    if(t == s){
      cnt++;
    }
  }
  cout << cnt << endl;
      
    
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    final double EPS = 1.0e-10;
    final int INF = 1 << 22;
    int m;
    int n;
    int bs[];

    void run() {
        Scanner sc = new Scanner(System.in);
        while (true) {
            m = sc.nextInt();
            n = sc.nextInt();
            if ((n | m) == 0)
                break;
            bs = new int[n];
            int max = 0;
            for (int i = 0; i < n; i++) {
                bs[i] = sc.nextInt();
                max = Math.max(bs[i], max);
            }
            int lb = max;
            int ub = INF;
            while (ub - lb > 1) {
                int mid = (lb + ub) / 2;
                if (c(mid)) {
                    ub = mid;
                } else {
                    lb = mid;
                }
            }
            System.out.println(lb);
        }
    }

    boolean c(int w) {
        int num = 1;
        int st = 0;
        for (int i = 0; i < n; i++) {
            if (st + bs[i] >= w) {
                num++;
                st = bs[i];
                if (num > m)
                    return false;
            } else {
                st += bs[i];
            }
        }
        return true;
    }

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

Measured memory_bytes: 12000
#include<stdio.h>
#define INF 200000
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int prim();
int n,M[N][N];

int main(){
  int i,j,e;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      M[i][j] = (e == -1) ? INF : e;
    }
  }

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

  return 0;
}

int prim(){
  int i,j,u,v,min;
  int d[N],p[N],color[N];
  
  for(i=0;i<n;i++){
    d[i]=INF;
    p[i]=-1;
    color[i]=WHITE;
  }

  d[0]=0;
  
  while(1){
    min=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(min>d[i] && color[i] != BLACK){
	u=i;
	min=d[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v] != INF){
	if(d[v]>M[u][v]){
	  d[v]=M[u][v];
	  p[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  int sum =0 ;
  for(i=0;i<n;i++){
    if(p[i]!=-1)sum+=M[i][p[i]];
  }
  
  return sum;
}

Measured memory_bytes: 636
#include<iostream>
#include <iomanip>
#include <algorithm> 
#include<vector>
#include<cmath>

using namespace std; 



long long fastPowMod(int m, int n,int mod){
    if(n==0){
        return 1;
    }

    long long res = fastPowMod(m,n/2,mod);
    if(n%2==1){
        res = (((res * res)%mod) * m)%mod;
    }else{
        res = (((res * res)%mod))%mod;
    }
    return res;
}

long long reverceModulo(int n,int mod){
    long long res = fastPowMod(n,mod-2,mod);
    return res;
}

int binomialCoefficientModulo(int n,int r,int mod){
    long long res = 1;
    for(int i=0;i<r;i++){
        res = ((n-i)* res ) % mod; 
    }
    for(int i=0;i<r;i++){
        res = (res * reverceModulo(r-i,mod))% mod;
    }
    return res;
}

int main(){
    int n,a,b;
    int BIGN = 1000000007;
    cin >> n >> a >> b;

    long long res = (((fastPowMod(2,n,BIGN) - 1 + BIGN - binomialCoefficientModulo(n,a,BIGN))) +BIGN - binomialCoefficientModulo(n,b,BIGN))%BIGN;
    if(res<0){
        res = res + BIGN;
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  string s;
  cin >> s;

  map<char, int> mp;
  rep(i,s.size()) {
    mp[s[i]] += 1;
  }

  int a,b,c,t,p;
  a = mp['a'];
  b = mp['b'];
  c = mp['c'];

  t = min({a,b,c});
  p = max({a,b,c});

  if (abs(t-p) < 2) {
    cout << "YES"<< endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 512
n = gets.to_i
if n < 10
  puts (1..n).size
elsif n < 100
  puts 9
elsif n < 1000
  puts (1..n).size - 90
elsif n < 10000
  puts 909
elsif n < 100000
  puts (1..n).size - 9090
elsif n = 100000
  puts 90909
end


Measured memory_bytes: 3836
#include<cstdio>
#include<cstring>

int main() {
	char x[1000];
	
	while(1){
		scanf("%s", x);
		if (x[0] == '0') break;
		
		int i = 0; int sum = 0;
		while (x[i]) {
			sum += (x[i] - '0');
			i++;
		}
		printf("%d\n", sum);
	}

	return 0;
}



Measured memory_bytes: 2736
// https://arc087.contest.atcoder.jp/tasks/arc087_a
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100000
vector <ll> arr(N+5);

int main() {
	ll i,j,n,ans;
        ans = 0;
	cin >> n;
	map<ll,int> mp;
	for(i=0; i<n; i++){
		cin >> j;
		mp[j]++;
	}
	
	for(auto itr=mp.begin(); itr!=mp.end(); itr++){
		if(itr->second >= itr->first){
			ans += itr->second - itr->first;
		}
		else{
			ans += itr->second;
		}
	}
	cout << ans;
	return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 4009;



int n, k;

int b[maxn][maxn], w[maxn][maxn];


int getb(int r1, int c1, int r2, int c2) {
    r2--;c2--;
    int res = 0;
    res += b[r2][c2];
    if (r1) res -= b[r1-1][c2];
    if (c1) res -= b[r2][c1-1];
    if (r1&&c1) res += b[r1-1][c1-1];
    return res;
}


int getw(int r1, int c1, int r2, int c2) {
    r2--;c2--;
    int res = 0;
    res += w[r2][c2];
    if (r1) res -= w[r1-1][c2];
    if (c1) res -= w[r2][c1-1];
    if (r1&&c1) res += w[r1-1][c1-1];
    return res;
}

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

    cin>>n>>k;
    for (int i=0; i<n; i++) {
	char c;
	int x,y; cin>>x>>y>>c;
	x %= (2*k);
	y %= (2*k);
	if (c == 'B') {
	    b[x][y]++;
	    b[x+2*k][y]++;
	    b[x][y+2*k]++;
	    b[x+2*k][y+2*k]++;
	}
	if (c == 'W') {
	    w[x][y]++;
	    w[x+2*k][y]++;
	    w[x][y+2*k]++;
	    w[x+2*k][y+2*k]++;
	}
    }

    for (int i=0; i<maxn; i++) {
	for (int j=0; j<maxn; j++) {
	    if (i) b[i][j]+=b[i-1][j];
	    if (j) b[i][j]+=b[i][j-1];
	    if (i && j) b[i][j]-=b[i-1][j-1];
	}
    }

    for (int i=0; i<maxn; i++) {
	for (int j=0; j<maxn; j++) {
	    if (i) w[i][j]+=w[i-1][j];
	    if (j) w[i][j]+=w[i][j-1];
	    if (i && j) w[i][j]-=w[i-1][j-1];
	}
    }



    int res = 0;

    for (int i=0; i<2*k; i++) {
	for (int j=0; j<2*k; j++) {
	    int cur = 0;
	    cur += getb(i,j,i+k,j+k);
	    cur += getb(i+k,j+k,i+2*k,j+2*k);
	    cur += getw(i,j+k,i+k,j+2*k);
	    cur += getw(i+k,j,i+2*k,j+k);

	    res = max(res, cur);
	}
    }

    cout<<res<<endl;
  

    return 0;
}


Measured memory_bytes: 125824
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int textSize = sc.nextInt();
        String text = sc.next();
        if (textSize % 2 == 0) {
            String first = text.substring(0, textSize / 2);
            String second = text.substring(textSize / 2);
            if (first.equals(second)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 21844
<?php
fscanf(STDIN,"%d",$n);
$apre=array(0);
$apost=explode(" ", rtrim(fgets(STDIN)));
$a=array_merge($apre,$apost);
$a[$n+1]=0;
$sum=0;
for ($i=0; $i <sizeof($a)-1; $i++)
	$sum+=abs($a[$i+1]-$a[$i]);

for ($i=0; $i < $n; $i++)
	echo($sum-abs($a[$i+1]-$a[$i])-abs($a[$i+2]-$a[$i+1])+abs($a[$i+2]-$a[$i]) . "\n");

Measured memory_bytes: 18164
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <limits>
#include <random>
#include <utility>
#include <vector>

namespace procon {
  class UnionFind {
  private:
    struct nodeinfo {
      int par;
      int rank;
      nodeinfo(int par) : par(par), rank(0) {}
    };
    std::vector<nodeinfo> node;

  public:
    UnionFind(int n) : node() {
      node.reserve(n);
      for (int i = 0; i < n; ++i) {
	node.push_back(nodeinfo(i));
      }
    }
    int root(int x) {
      if (node[x].par == x) {
	return x;
      }
      return node[x].par = root(node[x].par);
    }
    void unite(int x, int y) {
      x = root(x);
      y = root(y);
      if (x == y) {
	return;
      }
      if (node[x].rank < node[y].rank) {
	node[x].par = y;
      } else {
	node[y].par = x;
	if (node[x].rank == node[y].rank) {
	  ++node[x].rank;
	}
      }
    }
    bool is_same_set(int x, int y) { return root(x) == root(y); }
  };
}

int main(void) {
  int log_size;
  int n_query;
  int seed;
  std::cin >> log_size >> n_query >> seed;

  assert(0 <= log_size && log_size <= 30);
  assert(0 <= n_query);

  const int size = 1 << log_size;
  const int mask = size - 1;
  uint64_t res = 123456789;

  std::mt19937 mt(seed);
  procon::UnionFind uf(size);
  while (n_query--) {
    const int com = mt() & 1;
    const int x = mt() & mask;
    const int y = mt() & mask;
    if (com) {
      res = res * 17 + (uf.is_same_set(x, y) ? 1 : 0);
    } else {
      uf.unite(x, y);
    }
  }
  std::cout << res << std::endl;
  return 0;
}



Measured memory_bytes: 35576
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""

import queue

def main():
    N, M = map(int, input().split())

    connedted_room_list = [ [] for i in range(N)] # ここでNとMを書き間違えていた。
    for i in range(M):
        A, B = map(int, input().split())
        connedted_room_list[A-1].append(B-1)
        connedted_room_list[B-1].append(A-1)

    answer_list = [ -1 for i in range(N)]
    answer_list[0] = 0

    next_rooms_queue = queue.Queue()
    next_rooms_queue.put(0)
    now_room = int()
    while not next_rooms_queue.empty():
        now_room = next_rooms_queue.get()
        for i in connedted_room_list[now_room]:
            if answer_list[i] == -1:
                answer_list[i] = now_room
                next_rooms_queue.put(i)

    
    is_escapable = True
    '''
    for i in range(1, N):
        if answer_list[i] == -1:
            is_escapable = False
            break
    '''

    if is_escapable:
        print("Yes")
        for i in range(1, N):
            print(answer_list[i]+1)
    else:
        print("No")

if __name__ == "__main__":
    main()




Measured memory_bytes: 34668
#include <iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;

    if((c>a&&c<b)||((a==b)&&(b==c))){
        cout<<"Yes"<<endl;
    }else {
        cout<<"No"<<endl;


    }


  return 0;


}


Measured memory_bytes: 256
import heapq
INF = 10**9

n = int(input())
edge = [[] for _ in range(n)]

class Dijkstra:
    def __init__(self, adj):
        self.adj = adj
        self.num = len(adj)
        self.dist = [INF] * self.num
        self.prev = [INF] * self.num
        self.q = []

    def reset(self):
        self.dist = [INF] * self.num
        self.prev = [INF] * self.num
        self.q = []

    def calc(self, start):
        self.dist[start] = 0
        heapq.heappush(self.q, (0, start))
        while len(self.q) != 0:
            prov_cost, src = heapq.heappop(self.q)
            if self.dist[src] < prov_cost:
                continue
            for dest in self.adj[src]:
                cost = 1
                if self.dist[dest] > self.dist[src] + cost:
                    self.dist[dest] = self.dist[src] + cost
                    heapq.heappush(self.q, (self.dist[dest], dest))
                    self.prev[dest] = src
        return self.dist 

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    a -= 1; b -= 1
    edge[a].append(b)
    edge[b].append(a)

dij = Dijkstra(edge)
dist = dij.calc(0)
left = dist.index(max(dist))
dij.reset()
dist = dij.calc(left)
diam = max(dist)
if diam % 3 == 1:
    print("Second")
else:
    print("First")

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // 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 all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  int N; cin >> N;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
  }
  int ans = 0;
  rep(i, N-1) {
    if(A[i+1] < A[i]){
      ans += (A[i] - A[i+1]);
      A[i+1] = A[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4760
#include <cstdio>
#include <iostream>
using namespace std;
static const int MAX_N = 101;
static const int MAX_W = 10001;
int n, W;
int v[MAX_N], w[MAX_N], m[MAX_N];
int dp[MAX_W];
int deq[MAX_W], deqv[MAX_W];

void solve() {
    for (int i = 0; i < n; i++) {
        for (int a = 0; a < w[i]; a++) {
            int s = 0, t = 0;
            for (int j = 0; j * w[i] + a <= W; j++) {
                int val = dp[j * w[i] + a] - j * v[i];
                while (s < t && deqv[t-1] <= val) t--;
                deq[t] = j;
                deqv[t++] = val;
                dp[j * w[i] + a] = deqv[s] + j * v[i];
                if (deq[s] == j - m[i]) s++;
            }
        }
    }
    printf("%d\n", dp[W]);
}

int main() {
    scanf("%d %d", &n, &W);
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &v[i], &w[i], &m[i]);
    }

    //fill(deq, deq+W+1, 0);
    //fill(deqv, deqv+W+1, 0);
    solve();
    return 0;
}



Measured memory_bytes: 3348
n,a,b=map(int,raw_input().split())
s=raw_input()
c=0
d=0
for i in xrange(n):
    if s[i]=="a":
        if c<a+b:
            print "Yes"
            c+=1
        else: print "No"
    elif s[i]=="b":
        if c<a+b and d<b:
            print "Yes"
            c+=1
            d+=1
        else: print "No"
    else: print "No"

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

int findSumOfDigits(int n) {
    int sum = 0;
    while(n > 0) {
        sum += n % 10;
        n /= 10;
    }

    return sum;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int total = 0;     //答え

    for(int i = 1; i <= n; i++) {
        int sum = findSumOfDigits(i);
        if(a <= sum && sum <= b) {
            total += i;
        }
    }
    
    cout << total << endl;

    return 0;
}

Measured memory_bytes: 256