akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll


int n, m, k, a[300010], b[300010], q, l, r;

int t1[200010], t2[200010];

int32_t main(){
INIT
cin>>n>>m>>k;
for(int i=n; i>=1; i--){cin>>a[i];} for(int i=m; i>=1; i--){cin>>b[i];}
int res=0;
for(int i=n; i>=1; i--){t1[i]+=t1[i+1]+a[i];}
for(int i=m; i>=1; i--){t2[i]+=t2[i+1]+b[i];}





for(int i=n+1; i>=1; i--){
    if(t1[i]>k){break;}

    int l=1, r=m+1, m1=(l+r)/2;
    while(l<r){
            m1=(l+r)/2;
        if(t2[m1]<=(k-t1[i]) ){
            r=m1;
        }
        else{
            l=m1+1;
        }
        m1=(l+r)/2;
    }


    res=max(n-i+1+m-m1+1 ,res );

}
cout<<res;






return 0;
}


Measured memory_bytes: 9868
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    string s,t;
    cin>>s>>t;
    ll i=0,ans=0;
    while(s[i]!='\0'){
        if(s[i]!=t[i])
            ans++;
        i++;
    }
    cout<<ans;
    return 0;
}


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

using namespace std;

class City{
public:
    int i, Y;
    City(int i_, int Y_){
        i = i_;
        Y = Y_;
    }
};
class P {
public:
    vector<City> city;
    P(){
        city.clear();
    }
};

int main() {
    int N, M, id_f[100000], id_r[100000];
    P p[100000];
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        static int p_tmp, y_tmp;
        cin >> p_tmp >> y_tmp;
        p_tmp--;
        p[p_tmp].city.emplace_back(City(i, y_tmp));
    }
    for (int i = 0; i < N; ++i) {
        sort(p[i].city.begin(), p[i].city.end(), [](const City& a, const City& b){ return(a.Y<b.Y); });
    }
    for (int i = 0; i < N; ++i) {
        int itr = 0;
        for (auto &c : p[i].city) {
            id_f[c.i] = i+1;
            id_r[c.i] = ++itr;
        }
    }
    for (int i = 0; i < M; ++i) {
        cout << setfill('0') << right << setw(6) << id_f[i];
        cout << setfill('0') << right << setw(6) << id_r[i];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 7808
n = int(input())
edges = [[] for _ in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

def bfs(v):
    q = []
    depth = [n]*n
    q.append(v)
    depth[v] = 0
    i = 0
    while i < len(q):
        x = q[i]
        d = depth[x]
        for e in edges[x]:
            if depth[e] == n:
                depth[e] = d+1
                q.append(e)
        i += 1
    return depth

d1 = bfs(0)
d2 = bfs(n-1)

c = 0
for i in range(n):
    if d1[i] <= d2[i]:
        c += 1
if 2*c > n:
    print("Fennec")
else:
    print("Snuke")


Measured memory_bytes: 29788
package main

import (
	"fmt"
	"os"
)

var (
	Anser = []string{"Even", "Odd"}
)

func main() {
	fmt.Println(ABC086(nil))
}

func ABC086(in *os.File) string {
	if in == nil {
		in = os.Stdin
	}
	var a, b int
	fmt.Fscanf(in, "%d", &a)
	fmt.Fscanf(in, "%d", &b)
	c := (a * b) % 2
	return Anser[c]
}

Measured memory_bytes: 512
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define rall(x) x.rbegin() , x.rend()
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
using ll = long long;
using ii = pair <ll , ll>;
void in(ll &x);
// const ll N = ;
#define singleCase
// #define multipleCase
ll n,a,b;

void work() {
   in(n); in(a); in(b);
   if (a > b || (n == 1 && a != b)) {
      puts("0");
   } else {
      ll low = b, high = a;
      for (ll i = 1 ; i < n ; i++) {
         low += a;
         high += b;
      }
      printf("%lld\n" , high - low + 1);
   }
   return;
}

int main() {
   #ifdef multipleCase
      ll nQ; in(nQ);
      while (nQ--)
         work();
   #endif
   #ifdef singleCase
      work();
   #endif
   return 0;
}

void in(ll &x) {
	bool neg = false;
	register ll c;
	x = 0;
	c = getchar();
	if(c == '-') {
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
	  x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000001
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define plll pair<pll,ll>
#define vplll vector<plll>
#define vpll vector<pll>
using namespace std;
using namespace std::chrono; 
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);

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

    string str;
    ll rep,len;
    cin>>str>>rep;
    len=str.size();
    vector<pair<ll,char>>chain;
    char ch=str[0];
    ll count=1;
    for(int i=1;i<len;i++)
    {
        if(str[i]==ch)
        {
            count++;
            continue;
        }
        chain.push_back({count,ch});
        count=1;
        ch=str[i];
    }
    ll ans=0,store;
    chain.push_back({count,ch});
    ll size=chain.size();
    if(size==1)
    {
        ans=len*rep;
        ans=ans/2;
        cout<<ans;
        exit(0);
    }
    for(int i=1;i<size-1;i++)
    {
        store=chain[i].first/2;
        store=store*rep;
        ans+=store;
    }
    ll common;
    if(chain[size-1].second==chain[0].second)
    {
        common=chain[size-1].first+chain[0].first;
        common=common/2;
        common*=(rep-1);
        ans+=common;
    }
    else
    {
        store=chain[size-1].first/2;
        store=store*(rep-1);
        ans+=store;
        store=chain[0].first/2;
        store=store*(rep-1);
        ans+=store;
    }
    store=chain[size-1].first/2;
    ans+=store;
    store=chain[0].first/2;
    ans+=store;
    cout<<ans;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define fill(a, x) memset(a, x, sizeof(a))
#define zero(a) fill(a, 0)
#define minus(a) fill(a, -1)
#define dbg(x) cout << #x "=" << x << endl

// naming rules
// array starts with "ar". for example ar_a
// stack starts with "st". for example st_a
// queue starts with "qu". for example qu_a
// vector starts with "vc". for example vc_a

int main() {
  stack<int> st1;
  stack<pair<int, int> > st2;
  char ch;
  int sum = 0;
  int i = 0;
  while (cin >> ch) {
    // escapeしている?
    // escapeとは?
    if (ch == '\\') st1.push(i);
    else if (ch == '/' && st1.size() > 0) {
      int j = st1.top(); st1.pop();
      int a = i - j;
      sum += a;
      // firstとは?
      while (st2.size() > 0 && st2.top().first > j) {
        // secondとは?
        a += st2.top().second; st2.pop();
      }
      st2.push(make_pair(j, a));
    }
    i++;
  }

  // 以下は結果の出力用
  vi ans;
  while (st2.size() > 0) {
    ans.pb(st2.top().second);
    st2.pop();
  }
  reverse(ans.begin(), ans.end());
  cout << sum << endl;
  cout << ans.size();
  rep(k, ans.size()) {
    cout << " ";
    cout << ans[k];
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3164
/* 
AUTHOR : @Sam_Jn
*/
//lo + 1, hi, ret lo
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
// typedef tree<pair<int, int>, null_type, less_equal<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define NN 1000002
#define in(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define ot(a, n) for(int i = 0; i < n; i++) cout << a[i] << " ";
#define ot2(a, n) for(int i = 0; i < n; i++) cout << a[i] << "\n";
ll pwr(ll a, ll b);
ll pwr(ll a, ll b, ll m);
int baap[200002];
int prime[NN];
int find(int i);  
bool Union(int x, int y);
ll inv(ll x) {return pwr(x, MOD - 2, MOD);}
void init();
ll max(ll x, ll y, ll z) {return max(x, max(y, z));}
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {-1, 1, 0, 0, 1, -1, 1, -1};
//----------------------------------SOLUTION-BELOW-------------------------------------------// 

void solve(){
    int n;
    cin >> n;
    int a[n];
    in(a, n);
    int mx = a[0];
    ll ans = 0;
    for(int i = 0; i < n; i++){
        mx = max(mx, a[i]);
        ans += mx - a[i];
    }
    cout << ans;
}
int main(){


                                                            #ifndef ONLINE_JUDGE    
                                                            freopen("../../input.txt", "r", stdin);
                                                            freopen("../../output.txt", "w", stdout);
                                                            #else
                                                            // online submission
                                                            #endif
// 

    boost
    int _ = 1;
    // cout << 0 << endl;
    // cin >> _;
    while(_--){
        solve();
        cout << endl;
    }
}
 
 
//--------------------------------------DEFININTIONS---------------------------------------
ll pwr(ll a, ll b){
    if(b == 0)
        return 1 ;
    ll c = pwr(a, b/2) ;
    c = c * c;
    if(b % 2)
        return c*a;
    return c ;
}
ll pwr(ll a, ll b, ll m){
    if(b == 0)
        return 1;
    ll c = pwr(a, b/2, m) % m ;
    c = (c * c) % m;    
    if(b % 2)
        return (c * a%m) % m;
    return c ;
}
int find(int i)  
{  
    if (baap[i] != i)  
        baap[i] = find(baap[i]);  
  
    return baap[i];  
}
 
bool Union(int x, int y)
{
    x = find(x);
    y = find(y);
    if(x == y) return false;
    baap[x] = y;
    return true;
}
void init(){
  for(ll i = 2; i < NN; i++){
      if(prime[i]) continue;
      for(ll j = 2*i; j < NN; j += i)
          prime[j] = i;
  }
}

Measured memory_bytes: 4448
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm. fill_n(&ans[0][0],n*m,0);*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
// #define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;	// You should not be writing p1.ss <= p2.ss !!!
	else if(p1.ff == p2.ff){ if(p1.ss < p2.ss)return true; return false; }
	return false;
}
/*		1. Take all the inputs
		4. Whenever you do multiplication and division in the same line, beware.
*/
void solve(){
	// int main  or  int32_t main ...
	int n;
	cin >> n;
	int mat[n][3];
	memset(mat,0,sizeof mat);
	
	int a[n],b[n],c[n];
	FO(i,0,n)cin >> a[i] >> b[i] >> c[i] ;
	
	mat[0][0] = a[0];
	mat[0][1] = b[0];
	mat[0][2] = c[0];
	
	FO(i,1,n){
		mat[i][0] = max(mat[i-1][1], mat[i-1][2]) + a[i];
		mat[i][1] = max( mat[i-1][0] , mat[i-1][2]) + b[i];
		mat[i][2] = max( mat[i-1][1] , mat[i-1][0]) + c[i];
	}
	cout << max( mat[n-1][0] , max ( mat[n-1][1] , mat[n-1][2] ) ) << endl;
}
/*	memset() can be used to set all values as 0 or -1 for integer data types.*/

int main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(15); std::cout << std::fixed;
	int t; t = 1;
	// cin >> t;
	while(t--){ solve(); }
	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

lli N, A, B, C, D, ans;
lli i;

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

	cin >> N;
	A = (N%10000 - N%1000)/1000;
	B = (N%1000 - N%100)/100;
	C = (N%100 - N%10)/10;
	D = N%10;

	for(i = 0; i < 8; i++){
		ans = A;
		if(i & 4) ans+=B;
		else ans -= B;
		if(i & 2) ans+=C;
		else ans -= C;
		if(i & 1) ans+=D;
		else ans -= D;
		if(ans == 7) break;
	}
	cout << A;
	if(i&4) cout << "+";
	else cout << "-";
	cout << B;
	if(i&2) cout << "+";
	else cout << "-";
	cout << C;
	if(i&1) cout << "+";
	else cout << "-";
	cout << D;
	cout << "=7";


	return 0;
}


Measured memory_bytes: 256
s = input()
t = input()

alphabet = [chr(i) for i in range(97, 97+26)]


def max_s(s):
    for c in alphabet:
        if c in s:
            return c


def min_s(s):
    for c in reversed(alphabet):
        if c in s:
            return c


def compare(s1, s2):
    s1_index = alphabet.index(s1)
    s2_index = alphabet.index(s2)
    return s1_index < s2_index


for i in range(max(len(s), len(t))):
    if len(s) == 0:
        print("Yes")
        break
    elif len(t) == 0:
        print("No")
        break

    s_max = max_s(s)
    t_min = min_s(t)

    if s_max == t_min:
        s = s[:s.find(s_max)] + s[s.find(s_max) + 1:]
        t = t[:t.find(t_min)] + t[t.find(t_min) + 1:]
        continue

    if compare(s_max, t_min):
        print("Yes")
        break
    else:
        print("No")
        break
else:
    print("No")


Measured memory_bytes: 3064
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>


/* ----- Type Alias ----- */
using Int = long long int;
using Real = long double;
using String = std::string;
template <class... Ts>
using Tuple = std::tuple<Ts...>;

template <class T>
using Vector = std::vector<T>;
template <class T>
using Queue = std::queue<T>;
template <class T>
using Stack = std::stack<T>;
template <class T>
using Deque = std::deque<T>;

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using Set = std::set<T>;
template <class T, class U>
using Map = std::map<T, U>;

template <class T, class... Us>
using Func = std::function<T(Us...)>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return Vector<decltype(genv<T>(ts...))>(l, Vector<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = Vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = Vector<Vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// constexpr Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    Int n, t;
    std::cin >> n >> t;

    Vector<Int> v;
    std::generate_n(std::back_inserter(v), n, [] {
        Int x;
        std::cin >> x;
        return x;
    });

    Int acc = 0, max = 0;
    for (auto h : v) {
        acc += h;
        max = std::max(max, h);

        Int s = t - acc;
        std::cout << (s < 0 ? 1 : s / max + 2) << std::endl;
    }
    return 0;
}



Measured memory_bytes: 3924
import java.util.Arrays;
import java.util.Scanner;

/**
 * Hot days
 * JOI 12th, Pre 4
 */
public class Main {

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

		int D = sc.nextInt();
		int N = sc.nextInt();

		int[] T = new int[D];
		int[][] ABC = new int[N][3];
		int[][] CC = new int[N][N];

		for (int i = 0; i < D; i++) {
			T[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 3; j++) {
				ABC[i][j] = sc.nextInt();
			}
		}

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				CC[i][j] = Math.abs(ABC[i][2] - ABC[j][2]);
			}
		}

		//
		int[][] dp = new int[D][N];

		for (int i = 0; i < dp.length; i++) {
			Arrays.fill(dp[i], -1);
		}

		for (int i = 0; i < N; i++) {
			if (ABC[i][0] <= T[0] && T[0] <= ABC[i][1]) {
				dp[0][i] = 0;
			}
		}

		for (int i = 1; i < D; i++) {
			for (int j = 0; j < N; j++) {
				if (ABC[j][0] <= T[i] && T[i] <= ABC[j][1]) {
					for (int k = 0; k < N; k++) {
						if (dp[i - 1][k] != -1) {
							dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + CC[j][k]);
						}
					}
				}
			}
		}

		int max = -1;
		for (int i = 0; i < N; i++) {
			max = Math.max(max,dp[D-1][i]);
		}

		System.out.println(max);

	}
}

Measured memory_bytes: 30552
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,enable_if_t<iterable<T>::value,int> =0>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}
template<class T,enable_if_t<is_integral<T>::value,int> =0>T mod(T a, T b){if(a>0)return a%b;return b-(-a%b);}
template<class T,enable_if_t<is_floating_point<T>::value,int> =0>T mod(T a, T b){if(a>0)return a%b;return b-fmod(-a,b);}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    cout<<setprecision(10);
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b+c>=22?"bust":"win");
}


Measured memory_bytes: 256
M,D = map(int,input().split())
count=0
for i in range(1,M+1):
	for j in range(1,D+1):
		if j>=10:
			if i == (int(list(str(j))[0])*int(list(str(j))[1])):
				if int(list(str(j))[0]) >1 and int(list(str(j))[1]) >1:
					count +=1	
print(count)

Measured memory_bytes: 3064
#include<iostream>
#include<cassert>
using namespace std;
#define N 8
#define F -1
#define NF 1

int r[N], c[N], dp[2 * N - 1], dn[2 * N - 1];
bool x[N][N];

void print() {
	int i, j;
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			if (x[i][j]) {
				if (r[i] != j) {
					return;
				}
			}
		}
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			cout << ((r[i] == j) ? "Q" : ".");
		}
		cout << endl;
	}
 }

void init() {
	int i;
	for (i = 0; i < N; i++) { r[i] = F, c[i] = F; }
	for (i = 0; i < 2 * N - 1; i++) { dp[i] = F; dn[i] = F; }
}

void recur(int i) {
	int j;
	if (i == N) {
		print();
		return;
	}
	for (j = 0; j < N; j++) {
		if (NF == c[j] || NF == dp[i + j] || NF == dn[i - j + N - 1]) {
			continue;
		}
		r[i] = j;
		c[j] = dp[i + j] = dn[i - j + N - 1] = NF;
		recur(i + 1);
		r[i] = c[j] = dp[i + j] = dn[i - j + N - 1] = F;
	}
}

int main(void) {
	int i,j, k,r,c;
	init();
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			x[i][j] = false;
		}
	}
	cin >> k;
	for (i = 0; i < k; i++) {
		cin >> r >> c;
		x[r][c] = true;
	}
	recur(0);
	return 0;
}


Measured memory_bytes: 3128
import itertools
N,M = map(int,input().split())
es = [[0 for j in range(N)] for i in range(N)]
for i in range(M):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    es[a][b] = es[b][a] = 1

ans = 0
for ptn in itertools.permutations(range(1,N)):
    prev = 0
    for v in ptn:
        if not es[prev][v]:
            break
        prev = v
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(b-a==c-b) printf("YES\n");
  else printf("NO\n");
  return 0;
}


Measured memory_bytes: 128
from collections import Counter

N=int(input())
N_=N
f_=[]
for n in range(2,int(N**(1/2))+2):    
    while N_ % n==0: 
        N_=int(N_/n)
        f_.append(n)
        
if N_ != 1:
	f_.append(N_)
    
C=Counter(f_)
N_=N
ans=0
for c in C.keys():
    for c_ in range(1,C[c]+1):
        if N_ % c**c_ == 0:
            N_ = N_/c**c_
            ans+=1
if N==1:
    ans=0
print(ans)


Measured memory_bytes: 9576
l = []
n = int(input())
for i in range(n):
    l.append(input())

print("AC x " + str(l.count("AC")))
print("WA x " + str(l.count("WA")))
print("TLE x " + str(l.count("TLE")))
print("RE x " + str(l.count("RE")))

Measured memory_bytes: 16280
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <map>
#include <ctime>
#include <cstdlib>
#include <random>
using namespace std;

#define int long long

int k, n;
int a[300000];
int ans;

signed main(){
	cin >> k >> n;
	for(int i = 0; i < n; i++)cin >> a[i];
	a[n] = a[0] + k;
	for(int i = n; i > 0; i--){
		int val = a[i] - a[i - 1];
		ans = max(ans, val);
	}
	cout << k - ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
typedef int LL;
const LL maxn=1e6+9;
LL n;
LL a[maxn],L[maxn],R[maxn];
void Solve1(){
	for(LL i=1;i<=n;++i){
		a[i]=L[i];
	}
	std::sort(a+1,a+1+n);
	LL ret1(a[n/2]+a[n/2+1]);
	for(LL i=1;i<=n;++i){
		a[i]=R[i];
	}
	std::sort(a+1,a+1+n);
	LL ret2(a[n/2]+a[n/2+1]);
	printf("%d\n",ret2-ret1+1);
}
void Solve2(){
	for(LL i=1;i<=n;++i){
		a[i]=L[i];
	}
	std::sort(a+1,a+1+n);
	LL ret1(a[n/2+1]);
	for(LL i=1;i<=n;++i){
		a[i]=R[i];
	}
	std::sort(a+1,a+1+n);
	LL ret2(a[n/2+1]);
	printf("%d\n",ret2-ret1+1);
}
int main(){
	scanf("%d",&n);
	for(LL i=1;i<=n;++i){
		scanf("%d%d",L+i,R+i);
	}
	if(n&1) Solve2();
	else Solve1();
	return 0;
}

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

const int MAXN = 205;

int N, a[MAXN];

int main() {

    scanf("%d", &N);
    for (int i = 0; i < 2 * N; i++) {
        scanf("%d", &a[i]);
    }

    sort(a, a + 2 * N);

    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += a[2 * i];
    }

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

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n=int(input())
L=list(map(int,input().split()))
L.sort()
count=0
for i in range(n):
    for j in range(i+1,n):
        if L[i]==L[j]:
            continue
        val = L[i]+L[j]
        for k in range(j+1,n):
            if L[k]==L[i] or L[k]==L[j]:
                continue
            if val>L[k]:
                count+=1

print(count)


Measured memory_bytes: 9188
#!/usr/bin/env python3

S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    exit()

A = []
cnt = 1
C = []
for i in range(1,len(S)):
    if S[i-1] == S[i]:
        cnt += 1
    else:
        C.append([S[i-1], cnt])
        cnt = 1
C.append([S[i], cnt])

ans = 0
if len(C) == 1:
    print((C[0][1]*K) // 2)
    exit()
else:
    for c in C:
        ans += c[1] // 2

ans *= K

ans2 = 0
if S[-1] == S[0]:
    ans2 = ((C[0][1]+C[-1][1])//2 - C[0][1]//2 - C[-1][1]//2) * (K-1)
print(ans + ans2)


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL h,w,n;cin>>h>>w>>n;

    set<PLL> m;
    REP(i,n){
        LL a,b;cin>>a>>b;
        a--;b--;
        m.insert(MP(a,b));
    }

    VI dx={-2,-2,-2,-1,-1,-1, 0, 0, 0};
    VI dy={-2,-1, 0,-2,-1, 0,-2,-1, 0};
    VL result(10);
    set<PLL> visited;
    for(auto c : m){
        //cerr<<c.first<<" "<<c.second<<endl;
        REP(i,9){
            int sx = c.first+dx[i];
            int ex = sx+3;
            int sy = c.second+dy[i];
            int ey = sy+3;
            if(sx<0 || ex>h || sy<0 || ey>w){
                //cerr<<"("<<sx<<","<<sy<<"):continued1"<<endl;
                continue;
            }
            if(visited.find(MP(sx,sy)) != visited.end()){
                //cerr<<"("<<sx<<","<<sy<<"):continued2"<<endl;
                continue;
            }
            visited.insert(MP(sx,sy));
            int b=0;
            FOR(x, sx, ex){
                FOR(y, sy, ey){
                    if(m.find(MP(x,y)) != m.end()){
                        b++;
                    }
                }
            }
            //cerr<<"("<<sx<<","<<sy<<"):"<<b<<endl;
            result[b]++;
        
        }
    }
    result[0]=(h-2)*(w-2);
    FOR(i,1,10){
        result[0]-=result[i];
    }

    REP(i,10){
        cout<<result[i]<<endl;
    }





	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 62848
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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

	string S;
	cin >> S;

	for (ll i = 0; i < S.size(); ++i) cout << "x";

	cout << endl;

	//system("pause");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
const int mod = 1000003; 
int expmod(int x, int n, int mod) {
    int rtn = 1;
    while (n) {
        if (n & 1) rtn = 1ll * rtn * x % mod;
        x = 1ll * x * x % mod, n >>= 1;
    }
    return rtn;
} 
int f[mod];
int main() {
    f[0] = 1;
    for (int i = 1; i < mod; i ++) f[i] = 1ll * i * f[i-1] % mod;
    int q;
    scanf("%d", &q);
    while (q --) {
        int x, d, n;
        scanf("%d %d %d", &x, &d, &n);
        if (d == 0) printf("%d\n", expmod(x, n, mod));
        else {
            x = 1ll * expmod(d, mod - 2, mod) * x % mod;
            if (!x || x + n - 1 >= mod) puts("0");
            else {
                printf("%d\n", 1ll * expmod(f[x-1], mod - 2, mod) * f[x+n-1] % mod * expmod(d, n, mod) % mod);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4736
import itertools
n = int(input())
p= "".join(input().split())
q= "".join(input().split())

ans=[]
for s in itertools.permutations([str(i+1) for i in range(n)]):
    ans.append("".join(s))
sorted(ans)
print(abs(ans.index(p)-ans.index(q)))

Measured memory_bytes: 41072
import math


def main():
    A, B, H, M = [int(v) for v in input().split()]

    h = H + M / 60.0

    rad_a = math.pi * h / 6.0
    ay = A * math.sin(rad_a)
    ax = A * math.cos(rad_a)

    rad_b = math.pi * M / 30.0
    by = B * math.sin(rad_b)
    bx = B * math.cos(rad_b)

    dx = ax - bx
    dy = ay - by

    l = math.sqrt(dx * dx + dy * dy)
    print(l)


main()


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

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(i, n) REP(j, m) printf("%d%c", a[i][j], j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1000;
const int V_MAX = N_MAX * N_MAX;

int N;

//------------------------------------------------------------------------------
int V;
vector<int> G[V_MAX];

void add_edge(int from, int to) {
  G[from].push_back(to);
}

//------------------------------------------------------------------------------
int indeg[V_MAX];
bool used[N_MAX];

int card_id(int a, int b) {
  if (a > b) swap(a, b);
  return a * N + b;
}

void solve() {
  fill(indeg, indeg + V, 0);
  REP(v, V) REP(i, G[v].size()) {
    int u = G[v][i];
    indeg[u]++;
  }

  queue<int> que;
  REP(v, V) {
    int a = v / N;
    int b = v % N;
    if (a >= b) continue;
    if (indeg[v] == 0) que.push(v);
  }

  int ans = 1;
  fill(used, used + N, false);
  while (!que.empty()) {
    int v = que.front(); que.pop();
    int a = v / N;
    int b = v % N;
    if (used[a] || used[b]) {
      ans++;
      fill(used, used + N, false);
    }
    used[a] = used[b] = true;
    REP(i, G[v].size()) {
      int u = G[v][i];
      if (--indeg[u] == 0) que.push(u);
    }
  }

  REP(v, V) if (indeg[v] > 0) {
    puts("-1");
    return;
  }
  printf("%d\n", ans);
}

void input() {
  scanf("%d", &N);
  V = N * N;

  REP(a, N) {
    int from = -1;
    REP(j, N - 1) {
      int b;
      scanf("%d", &b);
      int to = card_id(a, b - 1);
      if (from >= 0) add_edge(from, to);
      from = to;
    }
  }
}

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


Measured memory_bytes: 43264
#include<bits/stdc++.h>
#define ll long long int
#define ss second
#define ff first
#define Mem(x,val) memset(x,val,sizeof x)
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
#define cerr(x) cerr << __LINE__ << " th Line : " << #x << " = " << x << "\n"
#define debug(a,b) cerr << #a<<" = "<<a<<"   |   "<<#b<<" = "<<b<<'\n'
#define endl '\n'
#define SZ(a) ((int)a.size())
using namespace std;
typedef pair<int, int> pi32;
typedef pair<ll, ll> pi64;
typedef vector<int> vi32;
typedef vector<ll> vi64;
typedef vector<pi32> vp32;
typedef vector<pi64> vp64;
const ll mod = 1e9 + 7;
const int MX = 2e5+7;
ll fr[MX];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	ll n;
	cin>>n;
	vi64 a(n+1),pref(n+1,0);
	Mem(fr,0);
	for(int i=1;i<=n;i++){
		cin>>a[i];
		pref[i]=pref[i-1]+a[i];
		fr[a[i]]++;
	}
	int q;cin>>q;
	ll sum=0;
	while(q--){
		int l,r;cin>>l>>r;
		pref[n]-=l*fr[l];
		pref[n]+=r*fr[l];
		fr[r]+=fr[l];
		fr[l]=0;
		cout<<pref[n]<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 6296
n, k = $stdin.readline.chomp.split.map(&:to_i)
a = $stdin.readline.chomp.split.map(&:to_i).sort
f = $stdin.readline.chomp.split.map(&:to_i).sort.reverse

c = a.zip(f).sort_by! {|x, y| [x * y, y] }

# 成績をx以下にするために必要な最小の修行回数
res = (0..10 ** 18).bsearch {|x|
  cnt = 0
  i = c.bsearch_index {|y, z| y * z > x } || n
  while i < n
    cnt += ((c[i].inject(:*) - x) + c[i][1] - 1) / c[i][1]
    i += 1
  end
  cnt <= k
}
puts res

Measured memory_bytes: 60608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
const int dx[] = { -1 , -1 , -1 , 0 , 0 , 0 , 1 , 1 , 1 };
const int dy[] = { -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 };
const ll integer = pow(2, 32) - 1; // 4294967295
#define N 8010000
#define TC int t;cin>>t;for(int T=1;T<=t;T++)
#define mod 1000000007
#define PI acos(-1)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
void AIA() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isprime(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0)return 0;
	}
	return (n!=1);
}

/*
 _____________              __                ___        ___       ___________________________     ____        ____
|             |            /\ \              |   |      |   |     |                           |    \   \      /   /
|   __________|           / /\ \             |   |      |   |     |      _____      _____     |     \   \    /   /
|  |                     / /  \ \            |   |      |   |     |     |     |    |     |    |      \   \  /   /
|  |                    / /    \ \           |   |      |   |     |     |     |    |     |    |       \   \/   /
|  |______             / /      \ \          |   |______|   |     |     |     |    |     |    |        \      /
|         |           / /        \ \         |              |     |     |     |    |     |    |         \    /
|   ______|          / /          \ \        |    ______    |     |     |     |    |     |    |          |  |
|  |                / /============\ \       |   |      |   |     |     |     |    |     |    |          |  |
|  |               / /==============\ \      |   |      |   |     |     |     |    |     |    |          |  |
|  |              / /                \ \     |   |      |   |     |     |     |    |     |    |          |  |
|  |             / /                  \ \    |   |      |   |     |     |     |    |     |    |          |  |
|__|            /_/                    \_\   |___|      |___|     |_____|     |____|     |____|          |__|

										  <<<<<<<<<<< NEVER GIVE UP !! >>>>>>>>>>>
										<<<<<<<< YOU CAN DO IT IF YOU WANT !! >>>>>>>>
										 <<<<<<<<< BELIEVE IN YOURSELF !! >>>>>>>>>

*/
int main() {
	//cout << fixed << setprecision(9);
	//freopen("stand.in","r",stdin);
	//freopen("stand.out","w",stdout);
	AIA();
	ll n;
	cin>>n;
	ll m = ceil(n / 1000.0);
	m*=1000;
	cout<<m-n;
	return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

list<int> l;

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

    rep(i, size(s)){
        if(s[i] == '0'){
            l.pb(0);
        }else if(s[i] == '1'){
            l.pb(1);
        }else{
            if(size(l) != 0){
                l.pop_back();
            }
        }
    }

    foreach(e, l){
        print(e);
    }
}

Measured memory_bytes: 256
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

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


N, X, Y = inp_list()

"""
    XY間のショートカット経路を使う場合と使わない場合の距離をそれぞれ計算して、
    その小さい方が最短経路。
"""

ans = [0] * N
for i in range(N):
    for j in range(i + 1, N):
        min_dist = min(j - i, abs(X - i - 1) + 1 + abs(Y - j - 1))
        ans[min_dist] += 1

for i in range(1, N):
    print(ans[i])


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

using namespace std;

int main() {
	
	int n, l;
	scanf("%d %d", &n, &l);
	int arr[n], sum = 0, res;
	for(int i = 0; i < n; i++) {
		arr[i] = l + i;
		sum += (l + i);
	}
	res = 0;
	for(int i = 1; i < n; i++) {
		if(abs(arr[i]) < abs(arr[res]))
			res = i;
	}
	printf("%d", sum - arr[res]);
	return 0;
}

Measured memory_bytes: 256
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

S = input()

setS = set(S)

check1 = {'E', 'W'}
check2 = {'S', 'N'}

ansflag1 = True
ansflag2 = True
for eachd in setS:
  if len(check1):
    if eachd in check1:
      ansflag1 = not ansflag1
      check1.remove(eachd)
  if len(check2):
    if eachd in check2:
      ansflag2 = not ansflag2
      check2.remove(eachd)

if ansflag1 and ansflag2: print('Yes')
else: print('No')



Measured memory_bytes: 3824
// Copyright 2015 KanatoNagayama
#include <iostream>
#define HOUR 3600
#define MINUTE 60
using std :: cout;
using std :: cin;
using std :: endl;
int main() {
  int t;
  int h, m, s;
  cin >> t;
  //h t???60*60*60??§?????£??????
  h = t / HOUR;
  //m t???
  m = (t % HOUR) / MINUTE;
  //s
  s = t % MINUTE;
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}

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

int main() {
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(NULL);

    vector<string> v = {"AC", "WA", "TLE", "RE"};
    int n;
    cin >> n;

    map<string, int> cnt;
    for (int i = 1; i <= n; i++) {
        string s;
        cin >> s;
        cnt[s]++;
    }

    for (auto i: v) {
        cout << i << " x " << cnt[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const long long LINF = 1000000000000000018ll;
const int INF = 1000000009;
const int mod = 1000000007;
const int mod2 = 998244353;

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

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::setprecision(20) << std::fixed;

  long long a;
  long double b;

  cin >> a >> b;

  cout << (long long)(a * b) << "\n";

  return 0;
}


Measured memory_bytes: 3744
#define _'			'
A[_];long P[_],M=1e9+7,F[_],I[_],X;i,j,k,t;c(a,b)int*a,*b;{t=a[*I=1]-b[1]?:*a-*b;}p(a,b){return b?p(a%M*a%M,b/2)*(b%2?a:1L)%M:1;}f(a,b){return F[a+b]*I[a]%M*I[b]%M;}main(s){for(;++X<_;~scanf("%d",A+i)&&i++%2&&gets(P))I[X]=p(s=F[X]=X*s%M,M-2);for(qsort(A,i/2,8,c);j<i;P[j++-1]=X)for(X=f(t=A[++j]-=1,s=A[k=j]-=1);k;X=s<A[k-=2]?X:(X-f(s-A[k],t-A[k+1])*P[k]%M+M)%M);printf("%d",X);}

Measured memory_bytes: 14336
import heapq
n, m = map(int, input().split())
a = list( map(int, input().split())) 
ans = sum(a)
a = [(-x, x) for x in a]
heapq.heapify(a)


for i in range(m):
    minusaa, aa  = heapq.heappop(a)
    ans -= aa
    heapq.heappush(a, (-(aa//2), aa//2))
    ans += aa//2

print(ans)

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
//const i64 smod = 998244353ll;
const i64 inf = 1'000'000'000'000'000'000ll + 7;

const double eps = 1e-8;

const i64 MAXN = 2 * 100'000 + 6;
i64 n, k;

i64 c[MAXN];

i64 binpow(i64 a, i64 n) {
    i64 res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        n >>= 1;
    }
    return res % mod;
}


int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> k;

    i64 z = binpow(10, 100);

    vector<pair<i64, i64>> q;

    i64 R = 0;
    for (i64 m = k; m <= n + 1; m++) {
        i64 sh = (z * m) % mod;

        i64 smin = (m - 1) * m / 2;
        i64 smax = (2 * n - m + 1) * m / 2;

        //if (smax - smin + 1 >= mod) {
        //    cout << mod << endl;
        //    return 0;
        //}

        //cerr << smin << " " << smax << endl;

        R += (smax - smin + 1) % mod;
        R %= mod;

        //if (smax >= smin) {
        //    q.push_back({ smin, 0 });
        //    q.push_back({ smax, 1 });
        //}
        //else {
        //    q.push_back({ smax, 0 });
        //    q.push_back({ mod - 1, 1 });

        //    q.push_back({ 0, 0 });
        //    q.push_back({ smin, 1 });
        //}
    }

    cout << R << endl;

    //sort(q.begin(), q.end());

    //vector<pair<i64, i64>> r;

    //i64 l = q[0].first;
    //i64 o = 1;
    //for (i64 i = 1; i < q.size(); i++) {
    //    if (!q[i].second) {
    //        if (!o) {
    //            l = q[i].first;
    //        }
    //        o += 1;
    //    }
    //    else {
    //        o -= 1;
    //        r.push_back({ l, q[i].first });
    //    }
    //}

    //i64 R = 0;
    //for (auto t : r) {
    //    R += t.second - t.first + 1;
    //    R %= mod;
    //}

    //cout << R << endl;

    return 0;
}

Measured memory_bytes: 3656
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int r = sc.nextInt();
        int c = sc.nextInt();
        int[][] ary = new int[r+1][c+1];
        for (int i = 0;i < r;i++) {
            for (int j = 0;j < c;j++) {
                ary[i][j] = sc.nextInt();
            }
        }
        
        for (int i = 0;i < c;i++) {
            for (int j = 0;j < r;j++) ary[r][i] += ary[j][i];
        }

        for (int i = 0;i < r;i++) {
            for (int j = 0;j < c;j++) ary[i][c] += ary[i][j];
        }
        
        for (int i = 0;i < r;i++) ary[r][c] += ary[i][c];
        
        for (int i = 0;i < r+1;i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0;j < c+1;j++) {
                sb.append(ary[i][j]).append(" ");
            }
            System.out.println(sb.substring(0, sb.length()-1));
        }
    }
}



Measured memory_bytes: 39568
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()

#define pr_arr(name, a, b) \
  for (int i = (a); i < (b); i++) { \
    for (int j = (a); j < (b); j++) {\
      if (j > (a)) printf(" "); \
      printf("%lld", name[i][j]); \
    }\
    printf("\n");\
  }\

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int N, M;

int main(void) {
    scanf("%d %d", &N, &M);

    for (int i = M/N; i >= 1; i--) {
        if (M%i==0) {
            printf("%d\n", i);
            return 0;
        }
    }
	return 0;
}


Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))

dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
    step1 = abs(h[i] - h[i-1])
    step2 = abs(h[i] - h[i-2])
    dp[i] = min(dp[i-1]+step1, dp[i-2]+step2)

print(dp[N-1])

Measured memory_bytes: 13928