akhauriyash/Code-Regression huggingface dataset:
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

const int MAXN = 100010;
ll p[MAXN], y[MAXN];
vector<ll> pref[MAXN];


//idxがグループによって異なる → いくつかの配列に分ける
//sort済み配列として、lower_bound(begin, end, value)-begin ... その値のidxがわかる

//AC

int
main(void){
  int n, m;
  cin >> n >> m;
  REP(i, m){
    cin >> p[i] >> y[i];
    p[i]--;
    pref[p[i]].push_back(y[i]);
  }

  REP(i, n) sort(pref[i].begin(), pref[i].end());

  //1-indexed: + 1
  REP(i, m) printf("%06d%06d\n", p[i]+1, lower_bound(pref[p[i]].begin(), pref[p[i]].end(), y[i])-pref[p[i]].begin()+1);
  
}



Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
     
int main() {
    string   S;
    cin >> S;

    string m = S.substr(5,2);
    if (m == "01"){
      cout << "Heisei" << endl;
     }
  	else if (m == "02"){
      cout << "Heisei" << endl;
     }
  	else if (m == "03"){
      cout << "Heisei" << endl;
     }
  	else if (m == "04"){
      cout << "Heisei" << endl;
     }
    else {
      cout << "TBD" << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;
    
    void calc()
    {
        cin = new Scanner();
        long[] l = new long[100];
        l[0] = 2;
        l[1] = 1;
        for (int i = 2; i < 100; i++)
        {
            l[i] = l[i - 1] + l[i - 2];
        }
        Console.WriteLine(l[cin.nextInt()]);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int a, b;
  cin >> a >> b;

  if(b % a == 0){
    cout << (a + b) << endl;
  }
  else{
    cout << (b - a) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <utility>
#include <stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define YES(b) std::cout<< (b ? "YES" : "NO")
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, l, a[8] = {};
	cin >> n >> m >> l;
	a[n]++;
	a[m]++;
	a[l]++;
	YES(a[5] == 2 && a[7] == 1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a, b, c;
  cin >> a >> b >> c;

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

  return 0;
}

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

int main(){
	int N,K;
	cin>>N>>K;
	double ans = 0;
	for(int i=1;i<=N;++i){
		if(i<K){
			ans += ((double)1/N)*pow((double)0.5,ceil(log2((double)K/i)));
		}
		else{
			ans += (double)1/N;
		}
	}
	cout<<setprecision(10)<<ans<<endl;
}


Measured memory_bytes: 512
N = int(input())
A = [0] + [int(x) for x in input().split()] + [0]

cnt = 0
for i in range(N+1):
    cnt += abs(A[i+1]-A[i])
for j in range(1, N+1):
    print(cnt - (abs(A[j]-A[j-1]) + abs(A[j+1]-A[j])) + abs(A[j+1]-A[j-1]))
    

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

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if (x - r < 0 || x + r > W || y - r < 0 || y + r > H)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3120
package main

import (
	"fmt"
	"regexp"
	"strings"
    "strconv"
)

func main() {
	var n, k int
	fmt.Scanf("%d %d", &n, &k)
	hate_nums := make([]string, k)
	for i := 0; i < k; i++ {
		fmt.Scan(&hate_nums[i])
	}
	hate_num_joins := strings.Join(hate_nums, "|")
	re := regexp.MustCompile("(" + hate_num_joins + ")")
	answer := n
	for {
        if re.MatchString(strconv.Itoa(answer)) {
			answer += 1
		} else {
			break
		}
	}
	fmt.Print(answer)
}



Measured memory_bytes: 2476
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, p; cin >> n >> p;
	string s; cin >> s;
	if (p == 2 || p == 5) {
		long long ans = 0;
		for (int i = 0; i < n; ++i)
			if ((s[i] - '0') % p == 0) ans += i + 1;
		cout << ans << endl;
		return 0;
	}
	vector<int> mul(n);
	mul[0] = 1;
	for (int i = 1; i < n; ++i) mul[i] = mul[i - 1] * 10 % p;
	vector<int> dp(n + 1);
	dp[n] = 0;
	for (int i = n - 1; i >= 0; --i)
		dp[i] = (dp[i + 1] + (s[i] - '0') * mul[n - i - 1]) % p;
	vector<int> m(p + 1);
	long long ans = 0;
	for (int i = n; i >= 0; --i) {
		ans += m[dp[i]];
		++m[dp[i]];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2180
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void) {
  long long int n, max = 0, sum = 0, i;
  scanf("%lld", &n);

  for (i = 0; i < n; i++) {
    long long int a;
    scanf(" %lld", &a);
    if (a > max) {
      max = a;
    }

    sum += max - a;
  }

  printf("%lld\n", sum);
  return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    vector<int> b(m);
    int ans=0;
    for(int i=0; i<m; i++)cin>>b[i];
    for(int i=0; i<n; i++){
        int sum=c;
        for(int j=0; j<m; j++){
            int a;
            cin>>a;
            sum+=b[j]*a;
        }
        if(sum>0)ans++;
    }
    cout<<ans;
    return 0;
}

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

int w, h, dp[101][101][4];

int main(){
    while(scanf("%d%d", &w, &h), w||h){
        for(int x = 0; x < h; x++){
            for(int y = 0; y < w; y++){
                fill(dp[x][y], dp[x][y]+4, 0);
            }
        }
        dp[0][0][0] = 0;
        dp[0][0][1] = 0;
        dp[0][0][2] = 1;
        dp[0][0][3] = 1;
        for(int x = 0; x < h; x++){
            for(int y = 0; y < w; y++){
                for(int z = 0; z < 4; z++){
                    dp[x][y][z] %= 100000;
                }
                dp[x+1][y][0] += dp[x][y][0] + dp[x][y][2];
                dp[x][y+1][1] += dp[x][y][1] + dp[x][y][3];
                dp[x][y+1][3] += dp[x][y][0];
                dp[x+1][y][2] += dp[x][y][1];
            }
        }
        for(int x = 0; x < h; x++){
            for(int y = 0;y < w; y++){
            }
        }
        int ans = 0;
        for(int z = 0; z < 4; z++){
            ans += dp[h-1][w-1][z];
        }
        printf("%d\n", ans%100000);
    }
    return 0;
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li n;

    cin>>n;

    li tp=n%10;

    if(tp==3)
    {
        cout<<"bon";
    }   
    else if(tp==0 || tp==1 || tp==6 || tp==8)
    {
        cout<<"pon";
    }
    else
        cout<<"hon";

    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define su(x) scanf("%u",&x)
#define sl(x) scanf("%ld",&x)
#define sli(x) scanf("%lld",&x)
#define slii(x,y) scanf("%lld %lld",&x,&y)
#define sliii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define slu(x) scanf("%llu",&x)
#define sf(x) scanf("%f",&x)
#define slf(x) scanf("%lf",&x)
#define slff(x,y) scanf("%lf %lf",&x,&y)
#define slfff(x,y,z) scanf("%lf %lf %lf",&x,&y,&z)
#define sc(x) scanf("%c",&x)
#define ss(x) scanf("%s",x)
#define pf printf
#define fpf fprintf
#define pb push_back
#define f(i,x,y,z) for(int i=x;i<y;i=i+z)
#define f1(i,x,y,z) for(int i=x;i>y;i=i-z)
#define MAX (int)(1e9)
#define pi 2*acos(0)
#define mp make_pair
#define M 1000000007
#define xx first
#define yy second
#define N (int)(1e4 + 5)
#define vc vector
#define pq priority_queue
#define Q queue
#define E 100005
#define logn 16

using namespace std;

typedef long long int ll;



int main()
{
   long long int a, b, c, k;
   scanf("%lld %lld %lld %lld",&a,&b,&c,&k);
   if(k%2==0) printf("%lld\n",a-b);
   else printf("%lld\n",b-a);
   return 0;
}


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

#define all_of(x) std::begin(x), std::end(x)
#ifdef _GLIBCXX_DEBUG
    #define debug(x) cerr << #x << ": " << x << endl
#else
    #define debug(x) 
#endif

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(const auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}
template<typename T>
istream& operator >> (istream& in, vector<T>& v) {
    for(auto& x : v) {
        in >> x;
    }
    return in;
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

struct range_tree {
    int rt[1000000];
    range_tree(int N) {
        for(int n = 1; n < 1000000; ++n) {
            rt[n] = N;
        }
    }
    void propagate(int n) {
        if(rt[n] >= 0) {
            rt[2 * n] = min(rt[2 * n], rt[n]);
            rt[2 * n + 1] = min(rt[2 * n + 1], rt[n]);
            rt[n] = -1;
        }
    }
    int query(int w, int n = 1, int l = 0, int r = 1 << 18) {
        if(l + 1 == r) {
            return rt[n];
        }
        propagate(n);
        if(w < (l + r) / 2) {
            return query(w, 2 * n, l, (l + r) / 2);
        } else {
            return query(w, 2 * n + 1, (l + r) / 2, r);
        }
    }
    void update(int b, int e, int q, int n = 1, int l = 0, int r = 1 << 18) {
        if(b <= l and r <= e) {
            rt[n] = min(rt[n], q);
            return;
        }
        if(e <= l or r <= b) {
            return;
        }
        propagate(n);
        update(b, e, q, 2 * n, l, (l + r) / 2);
        update(b, e, q, 2 * n + 1, (l + r) / 2, r);
    }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int N, Q;
    cin >> N >> Q;
    range_tree hor(N - 2), ver(N - 2);
    LL ans = LL(N - 2) * LL(N - 2);
    while(Q--) {
        int k, x;
        cin >> k >> x;
        if(k == 1) {
            auto y = hor.query(x);
            ans -= y;
            ver.update(2, 2 + y, x - 2);
        } else {
            auto y = ver.query(x);
            ans -= y;
            hor.update(2, 2 + y, x - 2);
        }
    }
    cout << ans << "\n";
    
    
    return 0;
}


Measured memory_bytes: 11464
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n, a[200005], r, b[200005];
int main() {
    ll sum = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
            cin >> a[i];
            b[i]= a[i] - i;
    }
    sort(b + 1, b + 1 + n);
    r = b[(n+1) / 2] ;
    //ll sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += abs(b[i] - r);
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 3328
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::cerr;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::stack;
using std::priority_queue;
using std::pair;
using std::make_pair;

using std::min;
using std::max;
using std::sort;
using std::abs;

using std::fixed;
using std::setprecision;
using std::setw;

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 314;

int main() {
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 888
#ifdef _MSC_VER
#  define _CRT_SECURE_NO_WARNINGS
#  define _USE_MATH_DEFINES
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double;
using u32 = unsigned int; using u64 = unsigned long long int; using str = string;
template <typename T> using vec = vector<T>; void in() { }
template <typename T, typename...TS> void in(T &&x, TS &&...xs) { cin >> x; in(move(xs)...); }
template <typename T> void out(T &&x) { cout << x << "\n"; }
template <typename T, typename...TS> void out(T &&x, TS &&...xs) { cout << x << " "; out(move(xs)...); }
#define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__)
#define get(t) []{ t x; cin >> x; return x; }()
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define even(x) ((abs(x) & 1) == 0)
#define odd(x) ((abs(x) & 1) == 1)
#define bit(x, i) (((x) >> i) & 1)
#define append emplace_back
#define bisect_left lower_bound
#define bisect_right upper_bound
#define bound(a, x, b) (a <= x && x <= b)
const i64 MOD = 1000000007ll;
const f64 EPS = 1e-10;

void solve() {
    indef(i32, n);
    out(pow(2, floor(log2(n))));
}

i32 main()
{
    ios::sync_with_stdio(false);

#ifdef _MSC_VER
    /**
    ifstream fin("input.txt"); cin.rdbuf(fin.rdbuf()); assert(fin);
    ofstream fout("output.txt"); cout.rdbuf(fout.rdbuf()); assert(fout);
    /**/
#endif

    //cout << fixed << setprecision(9);
    solve();
    return 0;
}

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

int n, m, k;

int main() {
	cin >> n >> m >> k;
	
	int i;
	
	for (i = 0; i <= n; i++) {
		int ans = i * m;
		int plus = n - 2 * i;
		
		if (ans == k) break;
		if (plus < 0) {
			if (ans > k && (ans - k) % (-plus) == 0 && (ans - k) / (-plus) <= m) break;
		}
		if (plus > 0) {
			if (ans < k && (k - ans) % plus == 0 && (k - ans) / plus <= m) break;
		}
	}
	
	if (i <= n) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

#define ll long long
#define f first
#define s second

int main() {
    int a[3], b, c;
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << abs(a[0] - a[1]) + abs(a[1] - a[2]) << endl;
    //cout << min(abs(a - b) + abs(b - c), min(abs(a - c) + abs(c - b),  abs(b - a) + abs(a - c)));
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;

public class Main {

  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] head1 = br.readLine().split(" ");
    String[] head2 = br.readLine().split(" ");
    String[] head3 = br.readLine().split(" ");

    int h = Integer.parseInt(head1[0]);
    int w = Integer.parseInt(head1[1]);
    int ch = Integer.parseInt(head2[0]) - 1;
    int cw = Integer.parseInt(head2[1]) - 1;
    int dh = Integer.parseInt(head3[0]) - 1;
    int dw = Integer.parseInt(head3[1]) - 1;
    String[] map = new String[h];
    for (int i = 0; i < h; i++) {
      map[i] = br.readLine();
    }
    br.close();

    Queue<Wizard> queueWalk = new ArrayDeque<>();
    Queue<Wizard> queueWarp = new ArrayDeque<>();
    int[][] visit = new int[h][w];
    for (int[] row : visit) {
      Arrays.fill(row, Integer.MAX_VALUE);
    }
    Wizard start = new Wizard(ch, cw, 0);
    visit[ch][cw] = 0;
    queueWarp.add(start);
    while (!queueWarp.isEmpty()) {
      queueWalk.addAll(queueWarp);
      queueWarp.clear();
      while (!queueWalk.isEmpty()) {
        Wizard wizard = queueWalk.poll();
        if (visit[wizard.posH][wizard.posW] < wizard.warp) {
          continue;
        }
        for (int curH = wizard.posH - 2; curH <= wizard.posH + 2; curH++) {
          if (curH < 0 || curH >= h) {
            continue;
          }
          for (int curW = wizard.posW - 2; curW <= wizard.posW + 2; curW++) {
            if (curW < 0 || curW >= w) {
              continue;
            }
            if (map[curH].charAt(curW) == '#') {
              continue;
            }
            if (visit[curH][curW] > wizard.warp) {
              if (Math.abs(curH - wizard.posH) + Math.abs(curW - wizard.posW) == 1) {
                visit[curH][curW] = wizard.warp;
                queueWalk.add(new Wizard(curH, curW, wizard.warp));
              } else {
                visit[curH][curW] = wizard.warp + 1;
                queueWarp.add(new Wizard(curH, curW, wizard.warp + 1));
              }
            }
          }
        }
      }
      if (visit[dh][dw] != Integer.MAX_VALUE) {
        System.out.println(visit[dh][dw]);
        return;
      }
    }
    System.out.println(-1);
  }
}

class Wizard {

  int posH, posW, warp;

  Wizard(int posH, int posW, int warp) {
    this.posH = posH;
    this.posW = posW;
    this.warp = warp;
  }
}


Measured memory_bytes: 62968
A,B,C,D,E,F = map(int,input().split())
waters = set()
iM = F//(100*A) + (not not F%(100*A))
jM = F//(100*B) + (not not F%(100*B))
for i in range(iM):
    for j in range(jM):
        if i*A*100+j*B*100>F:
            continue
        else:
            waters.add((i*A*100+j*B*100,(i*A+j*B)*E))

waters = list(waters)
waters.sort()

maxW,maxS = A*100,0
sugars = [False]*3001
sugars[0] = True

for i in range(3001):
    if sugars[i]:
        if i+C <3001:
            sugars[i+C]=True
        if i+D <3001:
            sugars[i+D]=True 
#print(waters)
for water,sugarM in waters:
    for i in range(sugarM,-1,-1):
        if i+water>F:
            continue
        if sugars[i]:
            maxSugar = i
            break
#    print(water,maxSugar) 
    if (maxSugar+water)*maxS<maxSugar*(maxW+maxS):
        maxW = water
        maxS = maxSugar
print(maxW+maxS,maxS)


Measured memory_bytes: 3064
N=int(input())
a=list(input().split())
s=0
ss=0
for i in range(N):
    a[i]=int(a[i])
    s+=a[i]
m=abs(2*a[0]-s)
for i in range(N):
    ss+=a[i]
    m=min(m,abs(2*ss-s))
print(m)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define lson rt<<1
#define rson rt<<1|1
#define scd(x) scanf("%d",&x)
#define scdd(x,y) scanf("%d%d",&x,&y)
const int maxn=3e5+10;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=0x3f3f3f3f;
ll arr[maxn],sum[maxn];
int main() {
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif // LOCAL
    int n;
    scd(n);
    for(int i=1;i<=n;i++){
        int x;
        scd(x);
        arr[x]++;
        sum[arr[x]]++;
    }
    for(int i=1;i<=3e5;i++)sum[i]+=sum[i-1];
    for(ll i=1;i<=n;i++){
        ll l=0,r=n,ans=0;
        while(r>=l){
            ll mid=(l+r)/2;
            if(i*mid<=sum[mid]){
                ans=mid;
                l=mid+1;
            }
            else r=mid-1;
        }
        printf("%lld\n",ans);
    }
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;}
const int inf = 1001001001;

int main() {
    int n;
    cin >> n;
    if(n < 3) {
        cout << 0 << endl;
        return 0;
    }
    vector<ll> v(5,0);
    rep(i,n) {
        string s;
        cin >> s;
        char c = s[0];
        if(c == 'M') v[0]++;
        else if(c == 'A') v[1]++;
        else if(c == 'R') v[2]++;
        else if(c == 'C') v[3]++;
        else if(c == 'H') v[4]++;
    }
    ll ans = 0;
    rep(i,1<<5) {
        vector<int> bit;
        rep(j,5) if(i & 1<<j) bit.pb(j);
        if(bit.size() != 3) continue;
        ll now = v[bit[0]]*v[bit[1]]*v[bit[2]];
        ans += now;
    }
    cout << ans << endl;
}

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

struct restaurant{
    std::string city;
    int score;
    int index;
    restaurant(std::string c = "", int s = 0) : city(c), score(s){}
    bool operator<(const restaurant &A){
        if(this->city == A.city){
            return this->score > A.score;
        }
        return this->city < A.city;
    }
};

int main(){
    int n;
    std::cin >> n;
    std::vector<restaurant> input(n);
    for(int i = 0; i < n; i++){
        std::cin >> input[i].city >> input[i].score;
        input[i].index = i + 1; // to 1 origin
    }

    std::sort(input.begin(), input.end());

    for(int i = 0; i < n; i++){
        std::cout << input[i].index << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int r, g, b;
int main() {
    cin >> r >> g >> b;
    int sum = r*100 + g*10 + b;
    if(sum % 4 == 0) {
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int map[100][100],i,j,t,w,h,sign;
    char line[101];
    scanf("%d %d",&h,&w);
    for(i=0;t=0,sign=0,i<h;i++){
        scanf("%s",line);
        for(j=0;j<w;j++){
            if(line[j]=='.' && sign==0)
                printf("-1%s",j==w-1?"":" ");
            if(line[j] == 'c'){
                t=0;
                sign=1;
                printf("%d%s",t++,j==w-1?"":" ");
            }
            else if(sign != 0)
                printf("%d%s",t++,j==w-1?"":" ");
        }

        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 604
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
ull n,m,v,i,x,y;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>x>>y;
  ll cnt = 0;
  while(x <= y){
    cnt++;
    x *= 2;
  }
  cout<< cnt <<endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
namespace my_std{
	using namespace std;
	#define Rint register int
	#define FOR(i,a,b) for(register int i=(a);i<=(b);++i)
	#define ROF(i,a,b) for(register int i=(a);i>=(b);--i)
	#define GO(x) for(register int i=p[x].head,v;i;i=e[i].link)
	#define FILE(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
	#define PII pair<int,int>
	#define MP make_pair
	typedef long long LL;
	typedef double DB;
	inline int read(){
		int ans=0,f=1;char c=getchar();
		while(c>'9'||c<'0'){ f^=(c=='-'); c=getchar(); }
		for(;c<='9'&&c>='0';c=getchar()) ans=ans*10+c-'0'; return f?ans:-ans;
	}
	const int mod = 1e9+7;
	inline void inc(int &x,const int &y){ x+=y; if(x>=mod) x-=mod; }
	inline int ksm(int x,LL y){ int res=1; for(;y;y>>=1,x=1ll*x*x%mod) if(y&1) res=1ll*res*x%mod; return res;}
}
using namespace my_std;

int a,b,c,d,ans;

int main(){
	a = read() , b = read() , c = read() , d = read();
	FOR(i,0,d/a){
		int k = d - a * i;
		FOR(j,0,k/b){
			int  g = k - b * j;
			if(g < 0) break;
			if(g % c == 0) ++ans;
		}
	}
	printf("%d",ans);
	return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

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

const ll INF=1LL<<60;
const int MOD=1e9+7;
const int N=2e5+5;

ll lcm2(ll a, ll b){
    ll d=__gcd(a, b);
    return a/d*b;
}

ll lcm(vector<ll> &arr){
    ll l=arr[0];
    for(int i=0; i<arr.size()-1; i++){
        l=lcm2(l, arr[i+1]);
    }
    return l;
}

int main(){
    int N, M; cin >> N >> M;
    vector<ll> arr(N);
    for(auto &x: arr) cin >> x;
    int cnt=0;
    bool ok=true;
    while(arr[0]%2 == 0 && ok){
        for(int i=0; i<N; i++){
            if(arr[i]%2 == 1){
                ok=false;
                break;
            }
            arr[i]/=2;
        }
        cnt++;
    }
    for(int i=0; i<N; i++){
        if(arr[i]%2 == 0) ok=false;
    }
    if(ok){
        ll val=lcm(arr)*pow(2, cnt-1);
        int res=0, k=1;
        if(val > 0){
            res=(M/val+1)/2;
        }
        cout << res << endl;
    }
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 1024
N,M,Q = map(int,input().split())
vote = [[0 for _ in range(N+1)] for _ in range(N+1)]
cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
    l,r = map(int,input().split())
    vote[l][r] += 1
for i in range(1,N+1):
    for j in range(1,N+1):
        cum[i][j] = vote[i][j]+cum[i-1][j]+cum[i][j-1]-cum[i-1][j-1]
for i in range(Q):
    p,q = map(int,input().split())
    print(cum[q][q]-cum[q][p-1]-cum[p-1][q]+cum[p-1][p-1])

Measured memory_bytes: 59352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i=a;i<b;i++)
#define REP(i, n) FOR(i, 0, n)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
#define PB push_back
#define MP make_pair
#define YES() printf("yes\n"),exit(0);
#define NO() printf("no\n"),exit(0);

#define N 1023
int h, w;
int a[N][N], p[2][N];
inline bool chk(int a, int b){
	return a/2==b || a/2+a%2==b;
}

int main(){
	scanf("%d%d", &w, &h);
	REP(i, h) REP(j, w) scanf("%d", a[i]+j);
	int sum=0;
	REP(i, h) REP(j, w) sum+=a[i][j];
	if(!chk(w*h, sum)) NO();
	REP(loop_cnt, 2){
		REP(i, h){
			sum=0;
			REP(j, w) sum+=a[i][j];
			// printf("%d: ", i); REP(j, w) printf("%d ", a[i][j]); printf("sum=%d\n", sum);
			if(!chk(w, sum)) NO();
			REP(j, w) p[a[i][0]][j]=a[i][j];
		}
		REP(i, h) REP(j, w) if(p[a[i][0]][j]!=a[i][j]) NO();
		swap(h, w);
		REP(i, N) REP(j, i) swap(a[i][j], a[j][i]);
	}
	YES();
}

Measured memory_bytes: 7228
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0); 
	int N; cin >> N; 
	int A[200010], B[200010]; 
	for(int i = 0; i < N; i++) cin >> A[i] >> B[i]; 
	sort(A, A+N); 
	sort(B, B+N); 
	if(N % 2 == 1){
		cout << B[(N-1)/2] - A[(N-1)/2] + 1 << "\n"; 
	}else{
		int l = A[N/2] + A[N/2 - 1]; 
		int r = B[N/2] + B[N/2 - 1]; 
		cout << r - l + 1 << "\n"; 
	}
}

Measured memory_bytes: 5208
m, n, mat, tmp = 0, 0, 0, 0
ans = 0
printer = []
dx = [0, 0, -1, 1]
dy = [1, -1, 0, 0]
def main():
    while True:
        global m, n, mat, tmp, printer,ans
        ans = 0
        m, n = [int(input()) for _ in range(2)]
        if m == n == 0:
            break
        mat = [list(map(int, input().split())) for _ in range(n)]
        for i in range(n):
            for j in range(m):
                if mat[i][j] == 1:
                    dfs(i, j, mat, 0)
        printer.append(ans)
    for i in range(len(printer)):
        print(printer[i])

def dfs(i, j, mat, c):
    global dx,dy,ans
    mat[i][j] = 0
    c += 1
    for k in range(4):
        if (0 <= i + dy[k] <= n - 1) and (0 <= j + dx[k] <= m - 1):
            if mat[i + dy[k]][j + dx[k]] == 1:
                dfs(i + dy[k], j + dx[k], mat, c)
    mat[i][j] = 1
    ans = max(ans,c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5668
#include <bits/stdc++.h>
using namespace std;
int kansu(int n){
  int m[9],k[9],l=0;
  int i, j;
  for(i=1;i<10;i++)
  {
    m[i-1]=n%i;
    k[i-1]=(n-m[i-1])/i ;
    if(0<k[i-1] && k[i-1]<10 && m[i-1]==0){
      l=1;
      break;
  }
   
  }
    return l;
}
  
int main(){
  int n;
  int l;
  cin >> n;
  l=kansu(n);
  if(l==1)
    cout<<"Yes";
  else
    cout << "No";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int hoge[20];
I vec1,vec2;
V<pair<int,int>> vec3;
int D,G;
int ans = INF;
int calc(){
    LL ins = 0;
    LL s = 0;
    for(int a = 0;a < D;a++){
        if(hoge[a] == 1){
            s += vec1.at(a) * (a+1)*100+vec2.at(a);
            ins += vec1.at(a);
        }
    }
    for(int a = 0;a < D;a++){
        if(hoge[vec3.at(a).second]==1)continue;
        for(int b = 0;b < vec3.at(a).first;b++){
            if(G > s){
                s += 100*(vec3.at(a).second+1);
                ins++;
            }
        }
    }
    return ins;
}
void bit(int i){
    if(i == D){
        ans = min(calc(),ans);
        return;
    }
    hoge[i] = 0;bit(i+1);
    hoge[i] = 1;bit(i+1);
}
int main(){
    std::cin >> D >> G;

    REP(a,D){
        CIN(c);CIN(b);
        vec1.push_back(c);
        vec2.push_back(b);
        vec3.push_back(make_pair(c,a));
    }
    sort(ALL(vec3));
    reverse(ALL(vec3));
    bit(0);
    COUT(ans);
    return 0;
}


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



int main()
{
    std::string s;
    std::cin >> s;
    int even_0 = 0;
    int odd_0 = 0;
    for(int i =0; i < s.length(); ++i){
        if(i % 2 == 0 && s[i] == '0') odd_0++;
        if(i % 2 == 0 && s[i] == '1') even_0++;
        if(i % 2 == 1 && s[i] == '0') even_0++;
        if(i % 2 == 1 && s[i] == '1') odd_0++;
    }

    even_0 > odd_0 ?
    std::cout << odd_0 << std::endl : std::cout << even_0 << std::endl;
    return 0;
}


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

int main(){ 
  int N;
  vector<int> P(10), Q(10);

  cin >> N;
  for(int i=0; i<N; i++) cin >> P[i];
  for(int i=0; i<N; i++) cin >> Q[i];

  vector<int> A = {1,2,3,4,5,6,7,8};

  int p, q, i=1;
  do{
    bool flagP = true, flagQ = true;
    for(int i=0; i<N; i++){
      if(A[i] != P[i]) flagP = false;
      if(A[i] != Q[i]) flagQ = false;
    }
    if(flagP) p = i;
    if(flagQ) q = i;
    i++;
  } while (next_permutation(A.begin(), A.begin()+N));

  cout << abs(p-q) << endl;
}

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

using namespace std;

constexpr int bn = 10;
int B[bn];
int main(){
  int testnum;
  cin >> testnum;
  for(int t = 0;t<testnum;++t){
    for(int i=0;i<bn;++i){
      cin >> B[i];
    }
    int i;
    for(i=0;i<(1<<bn);++i){
      vector<int> left,right;
      left.push_back(-1);
      left.push_back(0);
      right.push_back(-1);
      right.push_back(0);
      for(int j=0;j<bn;++j){
        if((1<<j)&i){
          left.push_back(B[j]);
        }else{
          right.push_back(B[j]);
        }
      }
      bool is_ordered=true;
      for(int j=0;j<left.size()-1;++j){
        if(left[j]>left[j+1]) is_ordered = false;
      }
      for(int j=0;j<right.size()-1;++j){
        if(right[j]>right[j+1]) is_ordered = false;
      }
      if(is_ordered){
        break;
      }
    }
    if(i==(1<<bn)){
      cout << "NO" << endl;
    }else{
      cout << "YES" << endl;
    }
  }

}

Measured memory_bytes: 2900
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector<long long int> hyou(n+1, 0);
		long long int a;
		long long int MAX = 0;
		int maxn = 0;
		for (int i = 0; i < n; i++) {
			cin >> a;
			hyou[i+1] = hyou[i] + a;
			if (i == 0) {
				MAX = hyou[1];
			}
		}
		for (int i = 2; i <= n; i++) {
			MAX = max(MAX, hyou[i]);
			for (int j = 1; j < i; j++) {
				if (hyou[j] < 0) {
					MAX = max(MAX, hyou[i]-hyou[j]);
				}
			}
		}
		cout << MAX << endl;
	}
	return 0;
}

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

main(){
  int stack[200];
  int i,j,temp1,temp2,s;
  char a[7];
  
  for(i=0;i<200;){
    scanf("%c",&a[0]);
    if(a[0]>='0'){          /* Input is operand case. */
      for(j=1;j<7;j++){
	scanf("%c",&a[j]);
	if(a[j]==' ')break;
      }
      a[j]='\0';
      stack[i]=atoi(a);
      i++;
    }
    if(a[0]=='*'){          /* Input is operator case. */
      temp1=stack[i-2];
      temp2=stack[i-1];
      i--;
      stack[i-1]=temp1*temp2;
    }
    if(a[0]=='+'){
      temp1=stack[i-2];
      temp2=stack[i-1];
      i--;
      stack[i-1]=temp1+temp2;
    }
    if(a[0]=='-'){
      temp1=stack[i-2];
      temp2=stack[i-1];
      i--;
      stack[i-1]=temp1-temp2;
    }
    if(a[0]=='\n')break;
  }
  
  printf("%d\n",stack[0]);
  
  return 0;
}

Measured memory_bytes: 0
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()
#define MOD 1000000007
#define INF INT_MAX

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
    if (a % b == 0) {
        return(b);
    }
    else {
        return(gcd(b, a % b));
    }
}

template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}


int main(void) {
    int k,s;
    cin>>k>>s;

    ll ans=0;
    rep(i,k+1){
        rep(j,k+1){
            if(s-i-j<=k&&s-i-j>=0){
                ++ans;
            }
        }
    }

    cout<<ans;
}


/*

*/

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main(){
 ll N;
 ll i;
 ll j;
 ll k;
 ll a[3][3];
 ll c[3][3];
 for(i=0;i<3;i++){
     for(j=0;j<3;j++){
         cin >> a[i][j];
        c[i][j]=0;
     }
 }
 cin >> N;
 ll b[N];
for(i=0;i<N;i++){
    cin >> b[i];
    for(j=0;j<3;j++){
        for(k=0;k<3;k++){
            if(a[j][k]==b[i])c[j][k]=1;
     }
 }}
 ll flag=0;
if(c[0][0]==1 && c[1][1]==1 && c[2][2]==1)flag++;
if(c[2][0]==1 && c[1][1]==1 && c[0][2]==1)flag++;
 for(i=0;i<3;i++){
    if(c[0][i]==1 && c[1][i]==1 && c[2][i]==1){
        flag++;
        break;
    }
    else if(c[i][0]==1 && c[i][1]==1 && c[i][2]==1){
        flag++;
        break;
    }
 }
 if(flag>0)cout << "Yes" << endl;
 else{cout << "No" << endl;}

}


Measured memory_bytes: 256
import sys
from sys import setrecursionlimit
from collections import deque
from heapq import heappop, heappush

setrecursionlimit(10**9)
#input = sys.stdin.readline

def inpl(): return map(int, input().split())
INF = 2**31

N, M = inpl()
D = [[] for _ in range(N+1)]

for _ in range(M):
    u, v, s = inpl()
    D[u].append((v, s))
    D[v].append((u, s))

S = [2**31] * (N+1)
C = [-1] * (N+1)
S[1] = 0
C[1] = 0

L = [1] * (N+1)
R = [2**31] * (N+1)

Q = [1]

state = 1
while Q:
    p = Q.pop()
    for q, s in D[p]:
        if C[q] == -1:
            C[q] = int(not C[p])
            S[q] = s - S[p]
            if C[q]:
                R[q] = min(R[q], S[q] - 1)
            else:
                L[q] = max(1, -S[q] + 1)
            Q.append(q)
        elif C[q] == C[p]:
            if C[p] == 0:
                a = s - S[p]
                b = S[q]
            else:
                a = S[q]
                b = s - S[p]

            if (a-b)%2:
                state = 0
                Q = []
                break
            t = (a-b)//2
            if t == L[q] == R[q]:
                continue
            R[q] = t
            L[q] = t
            Q.append(q)


        else:
            if S[q] != s - S[p]:
                state = 0
                Q = []
                break

if state == 0:
    print(0)
elif state == 1:
    print(max(0, min(R) - max(L) + 1))


Measured memory_bytes: 79136
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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! {
        K: i32,
        X: i32,
    }

    let ret = if 500 * K >= X {
        "Yes"
    } else {
        "No"
    };

    println!("{}", ret);
}

Measured memory_bytes: 4352
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = (1e-10);
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

struct Cake {
    int w, h;
};

void cut(int P, int S, vector<Cake> &a, int num) {
    S %= a[P].w * 2 + a[P].h * 2;

    Cake div[2];
    if (a[P].w + a[P].h < S && S < a[P].w*2 + a[P].h) {
        S = a[P].w - (S - a[P].w - a[P].h);
    } else if (a[P].w*2 + a[P].h < S) {
        S = a[P].h - (S - a[P].w*2 - a[P].h) + a[P].w;
    }

    if (S <= a[P].w) {
        div[0].h = a[P].h;
        div[1].h = a[P].h;
        div[0].w = S;
        div[1].w = a[P].w - div[0].w;        
    } else {
        div[0].w = a[P].w;
        div[1].w = a[P].w;
        div[0].h = S - a[P].w;
        div[1].h = a[P].h - div[0].h;
    }

    if (div[0].h * div[0].w > div[1].h * div[1].w) {
        swap(div[0], div[1]);
    }
    a.erase(a.begin() + P);
    a.push_back(div[0]);
    a.push_back(div[1]);
}

vector<int> solve(int N, int W, int D) {
    vector<Cake> a(1);
    a[0] = {W, D};
    for (int i = 1; i <= N; i++) {
        int p, s; cin >> p >> s;
        p--;
        cut(p, s, a, i);
    }

    vector<int> ret(N+1);
    for (int i = 0; i <= N; i++) {
        ret[i] = a[i].h * a[i].w;
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main(void) {
    int N, W, D;
    vector<vector<int>> ans;
    while (1) {
        cin >> N >> W >> D;
        if (!N && !W && !D) break;
        ans.push_back(solve(N, W, D));
    }

    for (auto &v : ans) {
        for (int i = 0; i < v.size(); i++) {
            if (i != v.size() - 1) cout << v[i] << " ";
            else cout << v[i];
        }
        cout << endl;
    }
}





Measured memory_bytes: 3112
n = int(input())

xl = []

for i in range(n):
    x,l = map(int,input().split())
    xl.append([x+l,x-l])
xl.sort()
ans = -10**10
count = 0
for j in range(n):
    if xl[j][1] >= ans:
        count +=1
        ans = xl[j][0]
print(count)

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

using namespace std;

int main(){
    string s;
    cin>>s;
    int tam=s.size()-1, ans=0;
    for(int i=0, j=tam; i<j;i++,j--){
        if(s[i]!=s[j])
            ans++;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
    int ans = 0;
    scanf("%d", &n);
    if(n == 0)
    {
        printf("0\n");
    }
    else if(n < 10)
    {
        printf("%d\n", n);
    }
    else if(n < 100)
    {
        printf("9\n");
    }
    else
    {
        int m = n;
        int a = 0, b = 0;
        while(m)
        {
            a++;
            m /= 10;
        }
        if(a == 3)
        {
            ans = 9 + n - 100 + 1;
        }
        else if(a == 4)
        {
            ans = 9 + 900;
        }
        else if(a == 5)
        {
            ans = 9 + 900 + n - 10000 + 1;
        }
        else if(a == 6)
        {
            ans = 9 + 900 + 90000;
        }
      printf("%d", ans);
    }
    
    return 0;
}

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

int n, W;
int w[155], v[155];
long long dp[100055];

int main() {
	cin >> n >> W;
	
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &w[i], &v[i]);
	}
	
	memset(dp, 63, sizeof(dp));
	
	dp[0] = 0;
	
	for (int i = 0; i < n; i++) {
		for (int j = (int)1e5; j - v[i] >= 0; j--) {
			dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
		}
	}
	
	for (int i = (int)1e5; i >= 0; i--) if (dp[i] <= W) {
		cout << i;
		break;
	}
}


Measured memory_bytes: 1024