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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	vector<int> A(13, 0);
	A.at(4)=A.at(6)=A.at(9)=A.at(11)=1;
	A.at(2)=2;
	int x, y;
	cin >>x >>y;
	if (A.at(x)==A.at(y))
		cout <<"Yes" <<endl;
	else
		cout <<"No" <<endl;
	return 0;
}



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

#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define REP(i, n) FOR(i, 0, (n))
#define ALL(a) (a.begin(), a.end())
typedef vector<int> vi;
bool check(int a)
{
    string s = to_string(a);
    REP(i, s.size()-1)
    {
        if(s[i+1]-s[i] != 1) return false;
    }
    return true;
}

int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    REP(i, n) cin>>v[i];
    int ans = -1;
    vector<pair<int, vector<int>>> kouho;
    REP(i, n)REP(j, i)
    {
        if(v[i] == 0 || v[j] == 0) continue;
        int t = v[i] * v[j];
        if(check(t))
        {
            ans = max(ans, t);
            kouho.emplace_back(t, vi{i, j});
        }
    }
    bool update = true;
    while(update)
    {
        update = false;
        REP(i, kouho.size())
        {
            int a = kouho[i].first;
            vi w = kouho[i].second;
            REP(j, n)
            {
                bool f = false;
                REP(k, w.size())
                {
                    if(w[k] == j) f = true;
                }
                if(f) break;
                int t = a * v[j];
                if(check(t))
                {
                    update = true;
                    ans = max(ans, t);
                    vi x = w;
                    x.push_back(j);
                    kouho.emplace_back(t, x);
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3244
N = int(input())
a = list(map(float, input().split()))
dp=[[[0.0] *(N+2) for _ in range(N+2)] for _ in range(N+2)]
one,two,three=a.count(1),a.count(2),a.count(3)
for k in range(three+1):
    for j in range(two+three+1):
        for i in range(N+1):
            if k==0 and j==0 and i==0:
                continue
            num=N
            if i>0:
                num+=dp[i-1][j][k]*i
            if j>0:
                num+=dp[i+1][j-1][k]*j
            if k>0:
                num+=dp[i][j+1][k-1]*k
            dp[i][j][k]=num/(k+j+i)
print(dp[one][two][three])

Measured memory_bytes: 298568
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

map <int, int> M;
int n;
int x;

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x); M[x]++;
	}
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		if (M[x] == 0) { printf("NO\n"); return 0; }
		M[x]--;
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 9600
(ns Atcoder.ABC085-B)
(require '[clojure.string :as str])
(def n (read-string (read-line)))
(def d (loop [input []  count 0]
              (if (= count n)
                input
                (recur (conj input (read-string (read-line))) (inc count)))))


(println (count (set d)))

Measured memory_bytes: 67192
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	
	static BufferedReader reader =
			new BufferedReader(new InputStreamReader(System.in));
	
	public static void main(String[] args)throws IOException{
		Main byakko = new Main();
		
		String str;
		int sum = 0,count = 0;
		double cost = 0;
		
		while((str = reader.readLine()) != null){
			String[] buy = str.split(",", 0);
			
			sum += byakko.sum(buy[0], buy[1]);
			
			cost += byakko.cost(buy[1]);
			
			count++;
		}
		System.out.println(sum);
		System.out.println(Math.round(cost / count));
		
		reader.close();
	}
	
	public int sum(String x, String y){
		int sum = 0;
		int z = Integer.parseInt(x);
		int v = Integer.parseInt(y);
		
		sum = z * v;
		
		return sum;
	}
	
	public double cost(String x){
		double z = Double.parseDouble(x);
		
		return z;
	}
}

Measured memory_bytes: 17112
import java.util.*;
import static java.lang.System.*;
import java.math.*;
 
public class Main{
  public static void main(final String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] A = new int[9];
    for (int i=0; i < 9; i++) {
      A[i] = sc.nextInt();
    }
    int N = sc.nextInt();
    int[] b = new int[N];
    for (int i = 0; i < N; i++) {
      b[i] = sc.nextInt();
    }
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < N; j++) {
        if (A[i] == b[j]) {
          A[i] = 101;
        }
      }
    }

    if ((A[0] + A[1] + A[2]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    if ((A[3] + A[4] + A[5]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    if ((A[6] + A[7] + A[8]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    if ((A[0] + A[3] + A[6]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    if ((A[1] + A[4] + A[7]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    if ((A[2] + A[5] + A[8]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    if ((A[0] + A[4] + A[8]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    if ((A[6] + A[4] + A[2]) == 303) {
      out.print("Yes");
      System.exit(0);
    }
    out.print("No");
    
  }
  }



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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(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 VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> Pair;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, A, B, C, D;

int main() {
    cin >> N >> A >> B >> C >> D;
    REP(i, N) {
        ll j = N - 1 - i;
        if(i * C - j * D <= B - A && B - A <= i * D - j * C) {
            cout << "YES"
                 << "\n";
            return 0;
        }
    }
    cout << "NO"
         << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N, K;
vector<lint> a;

int main()
{
    cin >> N >> K;
    a.resize(N);
    cin >> a;
    vector<lint> as(N + 1);
    REP(i, N) as[i + 1] = a[i];
    FOR(i, 1, N + 1) as[i] += as[i - 1];

    vector<lint> x[2];
    REP(i, N + 1) REP(j, i) x[0].push_back(as[i] - as[j]);

    lint ans = 0;
    lint d = 62;
    int now = 0;
    while (d >= 0)
    {
        x[1 - now].clear();
        for (auto v : x[now]) if (v & (1LL << d)) x[1 - now].push_back(v);
        if (x[1 - now].size() >= K)
        {
            now = 1 - now;
            ans += (1LL << d);
        }
        d--;
    }
    cout << ans << endl;
    ;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    ll res=0;
    set<string> S;
    for(int i=0;i<N;i++){
        string s;
        cin>>s;
        S.insert(s);
    }
    cout<<(int)S.size();
    return 0;
}

Measured memory_bytes: 19224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep2(i,a,b) for (ll i = (a); i < (b); ++i)

#define INF (1<<18)



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

    int ans=0;
    rep(x,k+1){
        rep(y,k+1){
            int z = s-x-y;
            if(0<=z && z<=k) ans++;
        }
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

int n, a, b;
int main(){
    cin >> n >> a >> b;
    if ((a-b)%2==0) cout << "Alice";
    else cout << "Borys";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int main(int argc, char *argv[])
{
  int H, i;
  int *node;
  int parent, left, right;
 
  scanf("%d", &H);
  node = (int *)malloc(sizeof(int) * (H + 1));
  for (i = 1; i <= H; i++) scanf("%d", &node[i]);
 
  for (i = 1; i <= H; i++) {
    printf("node %d: key = %d, ", i, node[i]);
    parent = (int)floor(i/2.0);
    left = 2 * i;
    right = 2 * i + 1;
    if (1 <= parent && parent <= H) printf("parent key = %d, ", node[parent]);
    if (1 <= left && left <= H) printf("left key = %d, ", node[left]);
    if (1 <= right && right <= H) printf("right key = %d, ", node[right]);
    printf("\n");
  }
 
  return 0;
}

Measured memory_bytes: 600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	static int[] ar;
	static int N,tracks;

	public static void main(String args[]){
		SC sc = new SC(System.in);
		N=sc.nextInt();
		tracks=sc.nextInt();
		ar=new int[N];
		for(int i=0; i<N; i++) {
			ar[i]=sc.nextInt();
		}
		int max=Integer.MAX_VALUE/10;
		int min=0;
		while(max-min>1) {
			int mid=(max+min)/2;
			if(bi(mid)) {
				max=mid;
			}
			else {
				min=mid;
			}
		}
		if(bi(min)) {
			pl(min);
		}
		else {
			pl(max);
		}

	}
	public static boolean bi(int mid) {
		int kaisu=0;
		int now=0;
		for(int i=0; i<N; i++) {
			if(now+ar[i]<=mid) {
				now+=ar[i];
			}
			else {
				kaisu++;
				if(ar[i]>mid) {
					return false;
				}
				else {
					now=ar[i];
				}
			}
		}
		if(now>0) {
			kaisu++;
		}
		if(kaisu<=tracks) {
			return true;
		}
		else {
			return false;
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}


Measured memory_bytes: 43504
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define ss second
#define mod 998244353
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl

#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
//int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<int,int> &a, 
              const pair<int,int> &b) 
{   
    if(a.ff == b.ff){
        return (b.ss < a.ss);
    }
    return (a.ff<b.ff); 
}

int32_t main()
{
    // IOS;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    // #endif
    /********************* From here ***********************/
    string s;
    cin >> s;
    int d[100005][2] ;
    int n = s.length();
    int w = 100002;
    vector<string> perm = {"01", "10"};
    for(int i=0;i<2;i++){
        string t = perm[i];
        int cnt = 0;
        int k = 0;
        for(int j=0;j<n;j++){
            if(s[j]!=t[k]){
                cnt++;
            }
            k++;
            k = k%2;
        }

        
        w = min(w, cnt);

    }
    cout << w;

}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdbool.h>

int main()
{
  int S,h,m,s;
  scanf("%d", &S);
  h=S/3600;
  m=(S%3600)/60;
  s=S-(3600*h)-(60*m);
  printf("%d:%d:%d\n", h,m,s);
  return 0;
}




Measured memory_bytes: 2044
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main() {
	ll n;
	cin >> n;
	ll ans = 1;
	for (int i = 1; i <= n; i++) {
		ans *= i % inf;
		ans %= inf;
	}
	cout << ans << endl;
	return 0;
}



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

int main() {
    int n;
    ll ans = 0;
    cin >> n;

    map<string, int> mp;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    
    for (auto hoge : mp)
    {
        int a = hoge.second;
        ans += (ll)a * (a - 1) / 2;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11136
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

int64 N, A, B;
int64 h[100000];

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> A >> B;
    for (int j = 0; j < N; ++j) {
        cin >> h[j];
    }

    int64 l = 0, r = 1000000001;
    while (l < r) {
        int64 m = (l + r) / 2;
        int64 D = A-B, b = 0;
        for (int j = 0; j < N; ++j) {
            int64 tt = h[j] - B * m;
            if (tt < 0) tt = 0;
            b += (tt + D - 1) / D;
        }
        if (b <= m) {
            r = m;
        } else {
            l = m+1;
        }
    }
    cout << r << endl;
    return 0;
}


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

int main() {
  int x, y;
  for (int i = 0;; ++i) {
    cin >> x >> y;
    if (x == 0 && y == 0) break;
    if (x < y) cout << x << " " << y << endl;
    else cout << y << " " << x << endl;
  }

  return 0;
}


Measured memory_bytes: 3112
N=int(input())
A=list(map(int, input().split()))

M=[0]*N
M[0]=2
for i in range(N):
    if i+1==N:
        pass
    else:
        M[i+1]=(A[i]-M[i]//2)*2
dif=A[N-1]-M[0]//2-M[N-1]//2
#print(M)
#print(dif)
for i in range(N):
    if i%2==0:
        M[i]+=dif
    else:
        M[i]-=dif
print(' '.join(list(map(str, M))))

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

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(void){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
        cin >> b.at(i);
    }
    struct Task{
        int time;
        int deadline;
    };
    vector<Task> t(n);
    for(int i = 0; i < n; i++){
        t.at(i).time = a.at(i);
        t.at(i).deadline = b.at(i);
    }
    sort(t.begin(), t.end(), [](const Task& x, const Task& y){ return x.time < y.time;});
    sort(t.begin(), t.end(), [](const Task& x, const Task& y){ return x.deadline < y.deadline;});
    int now = 0;
    bool can = true;
    for(int i = 0; i < n; i++){
        now+=t.at(i).time;
        if(now > t.at(i).deadline) can = false;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3328
package main

// https://atcoder.jp/contests/agc005/tasks/agc005_a
// 入力 X: 偶数の長さの文字列で半分が'S', もう半分が'T'
// 出力: 所定のルールを適用した後の文字列長

import (
	"fmt"
)

type (
	Stack struct {
		top    *node
		length int
	}
	node struct {
		value interface{}
		prev  *node
	}
)

// Create a new stack
func New() *Stack {
	return &Stack{nil, 0}
}

// Return the number of items in the stack
func (this *Stack) Len() int {
	return this.length
}

// View the top item on the stack
func (this *Stack) Peek() interface{} {
	if this.length == 0 {
		return nil
	}
	return this.top.value
}

// Pop the top item of the stack and return it
func (this *Stack) Pop() interface{} {
	if this.length == 0 {
		return nil
	}

	n := this.top
	this.top = n.prev
	this.length--
	return n.value
}

// Push a value onto the top of the stack
func (this *Stack) Push(value interface{}) {
	n := &node{value, this.top}
	this.top = n
	this.length++
}

func solve(x string) {
	stk := New()
	for _, c := range x {
		// if c == 'S' {
		// 	stk.Push(c)
		// 	continue
		// }
		if p, ok := stk.Peek().(rune); ok {
			if p == 'S' && c == 'T' {
				stk.Pop()
				continue
			}
		}
		stk.Push(c)
	}
	fmt.Printf("%v\n", stk.Len())
}

func main() {
	var x string
	fmt.Scanf("%s\n", &x)

	solve(x)
}


Measured memory_bytes: 8064
def main():
    n, a, b = map(int, input().split())
    ans = (b*(n-1)+a) - (a*(n-1)+b) + 1
    if a > b or (n == 1 and a != b):
        print("0")
    else:
        print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
#include<stdio.h>
#include<string.h>

int main(){

	char str[26];
	char result[26] = {0};
	int temp = 0;
	int Flag = 0;
	int len = 0;

	scanf("%s",str);
	len = strlen(str);

	for(int i=0; i<len; i++){
		result[str[i] - 'a']++;
	}

	for(int j=0; j<len; j++){
		if(result[j] > 1){
			printf("no");
			return 0;
		}
	}

	printf("yes");

	return 0;

}

Measured memory_bytes: 128
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

vector<pair<ll,ll> > vp;
ll dd[500300];
ll index1;

vector<vector<ll> > vv;

void dfs(ll a, ll p, ll h){
  if(vv[a].sz==1&&p!=-1){
  	vp[a]=mp(index1,index1+1);
  	index1+=2;
    return;
  }
  ll p1,p2;
  p1 = index1;
  index1++;
  rep(i,0,vv[a].sz){
    if(vv[a][i]==p)continue;
    dfs(vv[a][i],a,h+1);
  }
  p2 = index1;
  index1++;
  vp[a]=mp(p1,p2);
  return;
}

int main(){
	ll n,q;
	cin>>n>>q;
	vector<vector<ll> > vv_(n,vector<ll>());
	vv = vv_;
	vector<pair<ll,ll> > vp_(n,pair<ll,ll>());
	vp = vp_;
	rep(i,0,n-1){
		ll a,b;
		cin>>a>>b;
		a--;b--;
		vv[a].pb(b);
		vv[b].pb(a);
	}
	index1 = 0;
	dfs(0,-1,0);
	clr(dd,0);
	rep(i,0,q){
		ll p,x;
		cin>>p>>x;
		p--;
		ll l = vp[p].fi;
		ll r = vp[p].se;
		dd[l]+=x;
		dd[r]-=x;
	}
	rep(i,1,500300){
		dd[i]+=dd[i-1];
	}
	vector<ll> ans;
	rep(i,0,n){
		ll l = vp[i].fi;
		ans.pb(dd[l]);
	}
	rep(i,0,ans.sz){
		cout << ans[i];
		if(i!=ans.sz-1)cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 42356
#include <stdio.h>

int main(void)
{
    int i, j;
    char c[4][4];
    for (i = 0; i < 3; i++) {
        for (j = 0; j < 3; j++) {
            scanf(" %c", &c[i][j]);
        }
    }

    for (i = 0; i < 3; i++) {
        printf("%c", c[i][i]);
    }
    printf("\n");
}

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

int main() {

	int D = 0;
	int T = 0;
	int S = 0;

	double time = 0;//到着までにかかる時間

	do {

		cin >> D >> T >> S;

	} while ( D < 1 || D > 10000 || T < 1 || T > 10000 || S < 1 || S > 10000);

	time = (double)D/ (double)S;

	if (T >= time) {

		cout << "Yes" << endl;

	}
	else {

		cout << "No" << endl;

	}

	return 0;

}

Measured memory_bytes: 3624
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long s = sc.nextLong();
    long x1 =0;
    long y1=0;
    long x2=1000000000;
    long y2 =1;
    long start = s/x2;
    for(long i=start;i<=x2;i++){
      long x3 = i*x2-s;
      if(x3>=0 && x3<=x2){
        System.out.print(x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+i);
        break;
      }
    }
  }
}

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

int main() {
    while(true){
        ll n;
        cin>>n;
        if(n==0)break;
        vector<ll> w(n);
        vector<vector<ll>> dp(n,vector<ll>(n+1,0));
        rep(i,n)cin>>w[i];
        for(ll d=2;d<=n;d++){
            for(ll l=0;l<n;l++){
                ll r=l+d;
                if(r>n)break;
                if(abs(w[l]-w[r-1]) <= 1 && dp[l+1][r-1] == d-2){
                    dp[l][r]=d;
                }
                for(ll m=l+1;m<r;m++){
                    dp[l][r] = max(dp[l][r],dp[l][m]+dp[m][r]);
                }
            }
        }
        cout<<dp[0][n]<<endl;
    }
}



Measured memory_bytes: 3628
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    string s; cin>>s;
    ll k; cin>>k;
    ll ans=0,cnt=0;
    if(s[0]!=s[s.size()-1]){
        rep(i,s.size()){
            cnt=0;
            while(s[i]==s[i+1]){
                i++;
                cnt++;
            }
            ans+=(cnt+1)/2;
        }
        cout<<ans*k<<endl;
        return 0;
    }
    if(s.size()==1){
        cout<<k/2<<endl;
        return 0;
    }
    ll l=0,r=0;
    cnt=0;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]==s[i+1]){
            cnt++;
            if(i==s.size()-2){
                l=cnt+1;
                break;
            }
            continue;
        }
        l=cnt+1;
        break;
    }
    cnt=0;
    for(int i=s.size()-1;0<=i;i--){
        if(s[i]==s[i-1]){
            cnt++;
            continue;
        }
        r =cnt+1;
        break;
    }
    //cout<<l<<endl;
    //cout<<r<<endl;
    if(l+r>=s.size()){
        cout<<s.size()*k/2<<endl;
        return 0;
    }
    for(int i=l;i<s.size()-r;i++){
        cnt=0;
        while(s[i]==s[i+1]){
            i++;
            cnt++;
        }
        ans+=(cnt+1)/2;
    }

ll A=(r+l)/2*(k-1)+l/2+r/2+ans*k;
cout<<A<<endl;
}


















































Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ld x;cin>>x;x/=3;
	x=x*x*x;printf("%.9Lf\n",x);
}



Measured memory_bytes: 256
a, b, h, m = gets().chomp.split("\s").map{|x| x.to_i}

h_angle = 360.0 * (h * 60 + m) / 720.0
m_angle = 360.0 * (m / 60.0)
r = (h_angle - m_angle).abs
r = 360 - r if r > 180

rad = r * Math::PI / 180

res = Math.sqrt(a**2 + b**2 - 2 * a * b * Math.cos(rad)).abs

puts res


Measured memory_bytes: 14680
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

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

struct edge {int to, cap, rev;};

vector<edge> g[200010];
int level[200010], iter[200010];

void add_edge(int from, int to, int cap) {
	g[from].PB({to, cap, (int)g[to].size()});
	g[to].PB({from, 0, (int)g[from].size() - 1});
}

void bfs(int s) {
	memset(level, -1, sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.push(s);
	while(que.size()) {
		int v = que.front(); que.pop();
		for(edge& e: g[v]) {
			if(e.cap > 0 && level[e.to] < 0) {
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f) {
	if(v == t) return f;
	for(int &i = iter[v]; i < (int)g[v].size(); ++i) {
		edge &e = g[v][i];
		if(e.cap > 0 && level[v] < level[e.to]) {
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0) {
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t) {
	int flow = 0;
	while(1) {
		bfs(s);
		if(level[t] < 0) return flow;
		memset(iter, 0, sizeof(iter));
		int f;
		while((f = dfs(s, t, INF)) > 0) {
			flow += f;
		}
	}
}

string a[105];
signed main(void)
{
	int h, w;
	cin >> h >> w;
	REP(i, h) cin >> a[i];

	REP(i, h) REP(j, w) {
		if(a[i][j] == 'o') {
			add_edge(i, h+j, 1);
			add_edge(h+j, i, 1);
		} else if(a[i][j] == 'S') {
			add_edge(h+w, i, INF);
			add_edge(h+w, h+j, INF);
			add_edge(i, h+j, INF);
			add_edge(h+j, i, INF);
		} else if(a[i][j] == 'T') {
			add_edge(i, h+w+1, INF);
			add_edge(h+j, h+w+1, INF);
			add_edge(i, h+j, INF);
			add_edge(h+j, i, INF);
		}
	}
	ll ans = max_flow(h+w, h+w+1);
	if(ans >= INF) cout << -1 << endl;
	else cout << ans << endl;

	return 0;
}


Measured memory_bytes: 9344
#include<iostream>
using namespace std;
int main(){
	int a[10] = {}, b[10] = {},A=0,B=0;
	for (int i = 0; i < 4; i++){
		cin >> a[i];
		A = A + a[i];
	}
	for (int i = 0; i < 4; i++){
		cin >> b[i];
		B = B + b[i];
	}
	if (A >= B){
		cout << A << endl;
	}
	if (B > A){
		cout << B << endl;
	}
	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define REPS(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define RREP(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define RREPS(i, n) for (int i = ((int)(n)); i > 0; i--)
#define IREP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define IREPS(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVISORT(v) sort(v.begin(), v.end(), greater<int>());
#define ALL(v) v.begin(), v.end()
#define MP(n, m) make_pair(n, m);
#define COUT(d) cout<<std::setprecision(10)<<d<<endl;
#define CIN(n) getline(cin,n);
 
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using ll = long long;
using ul = unsigned long;
 
typedef long long ll;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
 
void printv(VI& v){
  REP(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
 
int vtotal(VI& v){
  int total=0;
  REP(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
	
  //init(); // mint初期化
 
  ll a,b;
  cin>>a>>b;
 
  ll ans=0;
  if(a>b){
    ans+=a;a--;
  }
  else{
    ans+=b;b--;
  }
  if(a>b)ans+=a;
  else ans+=b;
 
  cout<<ans<<endl;
 
  return 0;
}

Measured memory_bytes: 256
A,B,C,D = map(int, input().split())
ma=B
mi=A-1
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
def lcm(a,b):
  return a*b//gcd(a,b)

E=lcm(C,D)

ta=ma//C
tb=mi//C
h=ta-tb

tc=ma//D
td=mi//D
i=tc-td

te=ma//E
tf=mi//E
j=te-tf

wareru=h+i-j
kotae=ma-mi-wareru
print(kotae)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

ll how_many_decendable(const vector<vector<ll>>&tree,vector<ll>&res,ll from,ll parent)
{
    ll ans=0;
    for(auto c:tree[from]){
        if(c!=parent){
            ans=max(ans,how_many_decendable(tree,res,c,from));
        }
    }
    return (res[from]=ans)+1;
}
void tree_distance(const vector<vector<ll>>&tree,vector<ll>&res,ll from,ll parent,ll dist=0)
{
    res[from]=dist;
    for(auto c:tree[from]){
        if(c!=parent){
            tree_distance(tree,res,c,from,dist+1);
        }
    }
}
void get_parent(const vector<vector<ll>>&tree,vector<ll>&res,ll from,ll parent)
{
    for(auto c:tree[from]){
        if(c!=parent){
            get_parent(tree,res,c,from);
        }
    }
    res[from]=parent;
}
int main()
{
    ll n=in(),u=in()-1,v=in()-1;
    vector<vector<ll>>tree(n);
    for(ll i=0;i<n-1;++i){
        ll a=in()-1,b=in()-1;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }

    vector<ll>decendable_root_v(n);how_many_decendable(tree,decendable_root_v,v,-1);
    vector<ll>dist_from_v(n);      tree_distance(tree,dist_from_v,v,-1);
    vector<ll>parent_root_v(n);    get_parent(tree,parent_root_v,v,-1);
    ll ans=-1;
    for(
        ll up=0,upto=u;
        up<dist_from_v[upto];
        ++up,upto=parent_root_v[upto]
    ){
        ans=max(ans,dist_from_v[upto]+decendable_root_v[upto]-1);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 14592
H, W=map(int, input().split())
m=float("inf")
for i in range(1,H):
    S1=i*W
    S2=W*((H-i)//2)
    S3=H*W-S1-S2
    if m>max(S1, S2, S3)-min(S1, S2, S3):
        m=max(S1, S2, S3)-min(S1, S2, S3)

    S2=(H-i)*(W//2)
    S3=H*W-S1-S2
    if m>max(S1, S2, S3)-min(S1, S2, S3):
        m=max(S1, S2, S3)-min(S1, S2, S3)
H,W=W,H
for i in range(1,H):
    S1=i*W
    S2=W*((H-i)//2)
    S3=H*W-S1-S2
    if m>max(S1, S2, S3)-min(S1, S2, S3):
        m=max(S1, S2, S3)-min(S1, S2, S3)

    S2=(H-i)*(W//2)
    S3=H*W-S1-S2
    if m>max(S1, S2, S3)-min(S1, S2, S3):
        m=max(S1, S2, S3)-min(S1, S2, S3)
print(m)


Measured memory_bytes: 3064
// ------------------------------------
// Date:2018/ 3/ 8
// Problem:ABC 061 BetweenTwoIntegers a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;

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

  int A, B, C;
  cin >> A >> B >> C;
  cout << (A <= C and C <= B ? "Yes" : "No") << endl;
  
  return 0;
}



Measured memory_bytes: 256
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n = read()
    a = [read() for _ in range(n)]
    s = 0
    c = 2
    for i in range(n):
        if i == 0:
            s = a[i] - 1
            continue
        x = a[i] // c
        if c == a[i]:
            c += 1
            x = 0
        elif a[i] % c == 0:
            x -= 1
        s += x
    print(s)

main()

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

int main() {
  int H,W;
  string S;
  cin>>H>>W;
  
  rep(j,W+2){cout<<"#";}
  cout<<endl;
  
  rep(i,H){cout<<"#";
           cin>>S;
           rep(j,W){cout<<S.at(j);}
           cout<<"#"<<endl;
          }
  
  rep(j,W+2){cout<<"#";}
  cout<<endl;         
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n;
    cin >> n;
    vl a(n);
    map<ll, int> cnt;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    sort(a.begin(), a.end(), greater<ll>());
    ll ret = 0;
    for (int i = 0; i < n; ++i) {
        if (cnt[a[i]] == 0)
            continue;
        cnt[a[i]]--;
        ll k = 0;
        while ((1LL << k) <= a[i])
            k++;
        ll pair = (1LL << k) - a[i];
        if (cnt[pair] == 0)
            continue;
        else {
            cnt[pair]--;
            ret++;
        }
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 26752
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n;
    cin>>n;
    long long int a=sqrt(n);
    for(int i=a;i>0;i--){
        if(n%i==0){
            cout<<max(to_string(i).size(),to_string(n/i).size())<<endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
int main(){
    int a,b;cin>>a>>b;
    a>b?co("safe"):co("unsafe");
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    string a, b;
    cin >> a >> b;
    vector<char>s(a.size());
    vector<char>t(b.size());
    for(int i=0; i<a.size(); i++){
        s[i] = a[i];
    }
    for(int i=0; i<b.size(); i++){
        t[i] = b[i];
    }
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    for(int i=0; i<a.size(); i++){
        a[i] = s[i];
    }
    for(int i=0; i<b.size(); i++){
        b[i] = t[i];
    }
    if(s<t){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
int A[4][5]={{10,9,7,18,8},{12,9,6,3,13},{1,2,3,15,21},{1,4,7,10,16}};
int B[4][5]={{12,24,22,13,23},{19,28,25,22,15},{28,29,30,16,19},{24,27,30,21,18}};
struct state{int col[31];};
bool check(state x)
{
	for(int i=1;i<=9;i++)if(x.col[i]!=x.col[1])return false;
	for(int i=10;i<=12;i++)if(x.col[i]!=x.col[10])return false;
	for(int i=13;i<=15;i++)if(x.col[i]!=x.col[13])return false;
	for(int i=16;i<=18;i++)if(x.col[i]!=x.col[16])return false;
	for(int i=19;i<=21;i++)if(x.col[i]!=x.col[19])return false;
	for(int i=22;i<=30;i++)if(x.col[i]!=x.col[22])return false;
	return true;
}
int bfs(state start)
{
	queue<pair<int,state> > q;
	if(check(start))return 0;
	q.push(mp(0,start));
	while(!q.empty())
	{
		pair<int,state> a = q.front();
		q.pop();
		for(int i=0;i<4;i++)
		{
			state next=a.second;
			for(int j=0;j<5;j++)swap(next.col[A[i][j]],next.col[B[i][j]]);
			if(check(next))return a.first+1;
			q.push(mp(a.first+1,next));
		}
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		state start;
		for(int j=1;j<=30;j++)scanf("%d",&start.col[j]);
		printf("%d\n",bfs(start));
	}
	return 0;
}

Measured memory_bytes: 3696
a = int(input())
b = [list(map(int, input().split())) for _ in range(a)]
c = 0
for i in range(a-1, -1, -1):
    d = (b[i][0] + c + b[i][1] - 1) // b[i][1]
    c += d * b[i][1] - (b[i][0] + c)
print(c)


Measured memory_bytes: 27380
#include <bits/stdc++.h>
#define REP0(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define X first
#define Y second
#define pb push_back
#define ALL(arr) arr.begin(), arr.end()
#define MMST(arr, val) memset(arr, val, sizeof(arr))
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> llp;
const ll INF = 4e18;
const double PI = acos(-1);
ll n, k;
ll x[100005];
ll cls;
int main() {
    IOS;
    cin >> n >> k;
    REP1(i, n) {
        cin >> x[i];
    }
    ll ans = INF;
    for (ll l = 1, r = k; r <= n; l++, r++) {
        ans = min({ans, abs(0 - x[l]) + abs(x[l] - x[r]), abs(0 - x[r]) + abs(x[l] - x[r])});
    }
    cout << ans << '\n';
    return 0;
}
/*
*/


Measured memory_bytes: 1024
n = gets.split.map(&:to_i)
for i in 0..3
  if n[i] == 1
    break
  end
  if i == 3
    puts "NO"
    exit
  end
end
for i in 0..3
  if n[i] == 9
    break
  end
  if i == 3
    puts "NO"
    exit
  end
end
for i in 0..3
  if n[i] == 7
    break
  end
  if i == 3
    puts "NO"
    exit
  end
end
for i in 0..3
  if n[i] == 4
    break
  end
  if i == 3
    puts "NO"
    exit
  end
end
puts "YES"


Measured memory_bytes: 3836
#include <iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim() {
	int u, minv;
	int d[MAX], p[MAX], color[MAX];
	for (int i = 0; i < n; i++)
	{
		d[i] = INFTY;
		p[i] = -1;
		color[i] = WHITE;
	}
	d[0] = 0;
	while (1)
	{
		minv = INFTY;
		u = -1;
		for (int i = 0; i < n; i++)
		{
			if (minv > d[i] && color[i] != BLACK) {
				u = i;
				minv = d[i];
			}
		}
		if (u == -1) break;
		color[u] = BLACK;
		for (int v = 0; v < n; v++)
		{
			if (color[v] != BLACK && M[u][v] != INFTY)
			{

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

	int main() {
		cin >> n;

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++) {
				int e; cin >> e;
				M[i][j] = (e == -1) ? INFTY : e;
			}
		}
		cout << prim() << endl;
		return 0;
	}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;

int main(void)
{
    cout << fixed << setprecision(5);
    int N;
    cin >> N;

    vector<double> money(N);
    vector<string> form(N);
    for (int i = 0; i < N; i++)
    {
        cin >> money.at(i) >> form.at(i);
    }

    double sum = 0;
    double btc = 380000.0;
    for (int i = 0; i < N; i++)
    {
        if (form.at(i) == "JPY")
        {
            sum += money.at(i);
        }
        else
        {
            sum += money.at(i) * btc;
        }
    }

    cout << sum << endl;
    return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int MOD = 1e9 + 7;

int main(){
    fast;
    ld a, b;
    cin >> a >> b;
    ld ans = a*b;
    ans = floor(ans);
    int j = 1;
    string s = to_string(ans);
    for(int i = 0; i < s.size(); ++i){
        if(s[i] == '.'){
            j = i;
            break;
        }
    }
    for(int i = 0; i < j; ++i)
        cout << s[i];
    return 0;
}
//                                      **!!_Sumit_!!**

Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int64_t x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    
    int64_t wari = x / d;
    int64_t amari = x % d;
 
        if(wari > k){
            cout << x - (k * d) << endl;
        }else{
            int64_t nokori = k - wari;
            if(nokori % 2 == 0){
                cout << amari << endl;
            }else{
                cout << abs(amari - d) << endl;
            }
        }
        
}


Measured memory_bytes: 3612
from math import ceil
from collections import defaultdict as dd
n, k = map(int, input().split())
sushi = []
for i in range(n):
    sushi.append(list(map(int, input().split())))
sushi.sort(key=lambda x: x[1])

dic = dd(list)
for sushi_type, oishisa in sushi:
    dic[sushi_type].append(oishisa)

sushi_type_num = len(dic)

#base point priority
dp = [0] * (sushi_type_num + 1)
eaten_sushi = dd(list)
base_point = 0
stack_remove = []
for i in range(k):
    sushi_type, oishisa = sushi.pop()
    eaten_sushi[sushi_type].append(oishisa)
    base_point += oishisa
    if len(eaten_sushi[sushi_type]) >= 2:
        stack_remove.append([sushi_type, oishisa])
bonus_point = len(eaten_sushi) ** 2
point = bonus_point + base_point
dp[len(eaten_sushi)] = point

#print(base_point, bonus_point, eaten_sushi, dp)

while sushi != []:
    #print(base_point, bonus_point, eaten_sushi, dp)
    sushi_type, oishisa = sushi.pop()
    if eaten_sushi[sushi_type] == []:
        #remove
        if stack_remove != []:
            remove_type, remove_oishisa = stack_remove.pop()
            eaten_sushi[remove_type].pop()
            base_point -= remove_oishisa
        #add
            eaten_sushi[sushi_type].append(oishisa)
            base_point += oishisa
            bonus_point = len(eaten_sushi) ** 2
            point = bonus_point + base_point
            dp[len(eaten_sushi)] = point
        else:
            break
print(max(dp))

Measured memory_bytes: 122868
#include<stdio.h>
int main()
{
	long long N,n,h,w,sign;
	while(~scanf("%lld",&N))
	{
		getchar();
		sign=0;
		for(n=1;n<=3500;n++)
		{
			for(h=1;h<=3500;h++)
			{
				w=(N*h*n)/(4*h*n-n*N-h*N);
				if((4*h*n-n*N-h*N)>0&&(N*h*n)%(4*h*n-n*N-h*N)==0) 
				{
					printf("%lld %lld %lld\n",n,h,w);
					
					sign=1;break;
				}
			}
			if(sign) break;
		}
	}
} 

Measured memory_bytes: 128