akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n;

signed main() {
	cin >> n;
	cout << 1110-n << endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))

    b = []
    for x in range(n): #?´???°?????????
        hoge = [i for i in range(1, a[x] + 1)]
        fuga = []
        for y in range(len(hoge)):
            if a[x] % hoge[y] == 0:
                fuga.append(hoge[y])
            else:
                pass
        b.append(fuga)

    if n == 2: #????´???°????????????
        c = sorted(list(set(b[0]) & set(b[1])))
    else:
        c = sorted(list(set(b[0]) & set(b[1]) & set(b[2])))

    for x in range(len(c)):
        print(c[x])


if __name__ == "__main__":
    main()

Measured memory_bytes: 161588
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[1001001]; cin>>a[0];
  for(int i=1; i<=1001001; i++){
    if(a[i-1]%2) a[i]=3*a[i-1]+1;
    else a[i]=a[i-1]/2;
    for(int j=0; j<i; j++){
      if(a[i]==a[j]){cout<<i+1; return 0;}
    }
  }
}

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include <algorithm>
#include <vector>
using namespace std;


int main(){
    int* array;
    array = new int[3];
    cin >> array[0] >> array[1] >> array[2];
    if(array[0] == array[1] && array[1] == array[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main(){
    int n ;
    string s;
    cin >> n >> s ;
    int ans = 0 ;
    for (size_t i = 0; i < n-2; i++)
    {
        if (s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i+2) == 'C')
        {
            ans ++ ;
        }
        
    }
    cout << ans << endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

const long long mod = 1007050321;
const long long base = 521;
const long long N = 5e5 + 5;
const long long MOD = 1e9 + 7;
const long long inf = 2e9;

long long x,y,a,b,c;
long long p[N],q[N],r[N];
priority_queue <long long> hp;

bool cmp (long long a,long long b) {
    return a > b;
}

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

    cin >> x >> y >> a >> b >> c;
    for (long long i = 1; i <= a; ++i) cin >> p[i];
    for (long long i = 1; i <= b; ++i) cin >> q[i];
    for (long long i = 1; i <= c; ++i) cin >> r[i];

    sort(p+1,p+1+a,cmp);
    sort(q+1,q+1+b,cmp);
    sort(r+1,r+1+c,cmp);

    for (long long i = 1; i <= x; ++i) hp.push(p[i]);
    for (long long i = 1; i <= y; ++i) hp.push(q[i]);
    for (long long i = 1; i <= c; ++i) hp.push(r[i]);

    long long dem = 0,ans = 0;
    while (dem < x + y) ans += hp.top(),dem++,hp.pop();

    cout << ans;

    return 0;
}


Measured memory_bytes: 15216
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int n; cin>>n;
	int c[26]; CLR(c);
	rep(i,n){
		string s; cin>>s;
		int d[26]; CLR(d);
		rep(j,s.size()){
			d[s[j]-'a']++;
		}
		rep(j,26){
			if(i==0) c[j]=d[j];
			else chmin(c[j],d[j]);
		}
	}

	rep(i,26){
		char y = 'a'+i;
		rep(j,c[i]){
			cout<<y;
		}
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(c)  c.begin(), c.end()
#define ulli unsigned long long int
#define lli long long int
#define llv vector< ll >
#define llc vector< char >
#define lls vector< string >
#define llb vector< bool >
#define mp make_pair
#define endl "\n"
#define degb cout<<"HI"<<endl;
#define ins insert
#define foo(i,n) for(ll i = 0;i<n;i++)
#define foa(i,a) for(auto i = a.begin();i!=a.end();i++)
#define foe(i,a,b) for(ll i = a;i<=b;i++)
#define INF 2147483647
#define siz size
#define len length

int main(){
    ll n,arr[1000000],r,brr[1000000];
  cin >> n;
    foo(i,n){
        cin >> arr[i];
      brr[i]=arr[i];
    }
    sort(arr,arr+n);
    if(arr[n-1]==arr[n-2]){
        foo(i,n){
            cout << arr[n-1]<<"\n";
        }
    }
    else{
        foo(i,n){
            if(brr[i]==arr[n-1]){
                r=i;
            }
        }
        foo(i,n){
            if(i!=r){
            cout << arr[n-1]<<"\n";
            }
            else{
                cout << arr[n-2]<<"\n";
            }
        }
    }
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
#define mxn (int)1e5+10
#define INF (int)1e4+10
using namespace std;

int ar[mxn], dp[mxn];

// simple recursive
int solve(int n, int k) {

    if(n == 0) return 0;
    if(n < 0) return INF;

    if(dp[n] != -1) return dp[n];

    int ans = INT_MAX;

    for(int i=1; i<=k; ++i) {
        ans = min(ans, solve(n-i, k) + abs(ar[n-i] - ar[n]));
    }

    return dp[n] = ans;
}

int main() {
    int n, k; cin >> n;// >> k;
    for(int i=0; i<n; ++i) cin >> ar[i];
    for(int i=0; i<mxn; ++i) dp[i] = -1;

    cout << solve(n-1, 2) << '\n';

    return 0;
}


Measured memory_bytes: 7296
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
xy = [inpl() for _ in range(n)]
res = 0
for f in itertools.permutations(range(n)):
    for i in range(n-1):
        a,b = xy[f[i]], xy[f[i+1]]
        dist = (a[0]-b[0])**2 + (a[1]-b[1]) ** 2
        res += math.sqrt(dist)
print(res/math.factorial(n))


Measured memory_bytes: 68712
#include <bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(false);cin.tie(0);

typedef long long int ll;

int main() {
	optimizar_io
	ll k, num = 7;
	vector<int> prev(1000010);

	cin >> k;
	int cnt = 1;
	num %= k;
	while (!prev[num % k]) {
		prev[num % k] = 1;
		if (num == 0) {
			cout << cnt << "\n";
			return 0;
		}
		num *= 10;
		num %= k;
		num += 7;
		num %= k;
		cnt++;
	}
	cout << "-1\n";
	return 0;
}

Measured memory_bytes: 7104
a,b = gets.chomp.split(" ").map(&:to_i)

if (a - b) % 2 == 1 then
  puts "IMPOSSIBLE"
  exit 0
end

k1 = (a - b) / 2
k2 = (b - a) / 2
k3 = (a + b) / 2

[k1, k2, k3].each do |k|
  if (a - k).abs == (b - k).abs then
    puts k
    exit 0
  end
end
puts "IMPOSSIBLE"



Measured memory_bytes: 1788
#include<iostream>
#include<math.h>
#include<string>
using namespace std;

int main() {
	string Sa, Sb, Sc;
	cin >> Sa >> Sb >> Sc;

	char first = 'a';

	while (true) {
		if (first == 'a') {
			if (Sa.empty()) {
				cout << 'A' << endl;
				return 0;
			}
			first = Sa[0];
			Sa.erase(0, 1);
		}
		else if (first == 'b') {
			if (Sb.empty()) {
				cout << 'B' << endl;
				return 0;
			}
			first = Sb[0];
			Sb.erase(0, 1);
		}
		else if (first == 'c') {
			if (Sc.empty()) {
				cout << 'C' << endl;
				return 0;
			}
			first = Sc[0];
			Sc.erase(0, 1);
		}
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			int a = sc.nextInt();
			
			System.out.println(a * (a + 1) / 2);

		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 9552
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

struct QuickFind{
	vector<int> par;
	vector<vector<int>> group;
	QuickFind(int n) : par(n),group(n){
		for(int i = 0;i < n;i++){
			par[i] = i;
			group[i].push_back(i);
		}
	}
	int find(int x){
		return par[x];
	}
	void unite(int x,int y){
		x = par[x],y = par[y];
		if(x == y) return;
		if(group[x].size() < group[y].size()) swap(x,y);
		for(int v : group[y]) par[v] = x;
		group[x].insert(group[x].end(),group[y].begin(),group[y].end());
		group[y].clear();
		par[y] = x;
	}
	bool same(int x,int y){
		return par[x] == par[y];
	}
};

struct RMQIndex{
	using P = pair<int,int>;
	int seg,init;
	vector<P> dat;

	RMQIndex(int n,int init) : init(init),seg(1){
		while(seg < n) seg *= 2;
		dat.resize(seg * 2 - 1);
		for(int i = 0;i < seg;i++) dat[i + seg - 1] = make_pair(init,i);
		for(int i = seg - 2;i >= 0;i--) dat[i] = min(dat[i * 2 + 1],dat[i * 2 + 2]);
	}
	void update(int i,int x){
		dat[i + seg - 1] = make_pair(x,i);
		i += seg - 1;
		while(i){
			i = (i - 1) / 2;
			dat[i] = min(dat[i * 2 + 1],dat[i * 2 + 2]); //do
		}
	}
	P get(int a = 0,int b = -1,int k = 0,int l = 0,int r = -1){
		if(b == -1) b = seg;
		if(r == -1) r = seg;
		if(b <= l || r <= a) return make_pair(init,a);
		if(a <= l && r <= b) return dat[k];
		return min(get(a,b,k * 2 + 1,l,(l + r) / 2),get(a,b,k * 2 + 2,(l + r) / 2,r)); //do
	}
};

signed main(){
	int n,d,a[200010],ans = 0;
	cin >> n >> d;
	for(int i = 0;i < n;i++) cin >> a[i];
	QuickFind qf(n);
	vector<RMQIndex> rmq(2,RMQIndex(n,INF));
	for(int i = 0;i < n;i++){
		rmq[0].update(i,a[i] - d * i);
		rmq[1].update(i,a[i] + d * i);
	}
	while(1){
		bool update = false;
		for(int i = 0;i < n;i++){
			if(qf.group[i].empty()) continue;
			P mi(INF,INF);
			for(int v : qf.group[i]){
				rmq[0].update(v,INF);
				rmq[1].update(v,INF);
			}
			for(int v : qf.group[i]){
				P p = rmq[0].get(0,v),q = rmq[1].get(v + 1);
				chmin(mi,min(P(p.first + d * v + a[v],p.second),P(q.first - d * v + a[v],q.second)));
			}
			for(int v : qf.group[i]){
				rmq[0].update(v,a[v] - d * v);
				rmq[1].update(v,a[v] + d * v);
			}
			//cout << i << " " << mi.first << " " << mi.second << endl;
			if(mi.second < n && !qf.same(i,mi.second)){
				qf.unite(i,mi.second);
				ans += mi.first;
				update = true;
			}
		}
		if(!update) break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 49664
from collections import defaultdict
N, M = map(int, input().split())

subs = defaultdict(list)
for i in range(M):
    p, s = map(str, input().split())
    p = int(p)
    subs[p].append(s)

ac = 0
pena = 0
for k, v in subs.items():
    wa = 0
    for a in v:
        if a == 'AC':
            ac += 1
            pena += wa
            break
        wa += 1

print(ac, pena)

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:
ll gcd(ll a, ll b) {
  if(b==0) return a;
  return gcd(b, a % b);
}

int main() {
  int n; cin >> n;
  vector<ll> a(n);
  ll ans;
  for(int i = 0; i < n; ++i) {
    int t; cin >> t;
    if(i == 0) ans = t;
    ans = gcd(ans, t);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
typedef long long LL;

int main() {
   int x;
   cin >> x;
   if (x == 3 || x == 5 || x == 7) puts("YES");
   else puts("NO");
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <cassert>
#include <queue>
using namespace std;
using lint = long long;
const lint mod = 256;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ans, sum = 0;
    for(int i = 0; i < S.size(); i++){
        sum += (S[i] == '.');
    }
    ans = sum;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == '.'){
            sum--;
        }else{
            sum++;
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

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

int main(){
  int B[3][3];
  for(int x=0; x<3; x++){
    for(int y=0; y<3; y++){
      cin >> B[x][y];
    }
  }
    int M;
  cin >> M;
  int* n = new int[M];
  for(int z=0; z<M; z++){
    cin >> n[z];
  }
  for(int i=0; i<M; i++){
    if(B[0][0] == n[i])B[0][0] = 0;
     if(B[0][1] == n[i])B[0][1] = 0;
      if(B[0][2] == n[i])B[0][2] = 0;
       if(B[1][0] == n[i])B[1][0] = 0;
        if(B[1][1] == n[i])B[1][1] = 0;
	 if(B[1][2] == n[i])B[1][2] = 0;
	  if(B[2][0] == n[i])B[2][0] = 0;
	   if(B[2][1] == n[i])B[2][1] = 0;
	    if(B[2][2] == n[i])B[2][2] = 0;
    }
 for(int a=0; a<3; a++){
    if(B[0][a] == B[1][a] && B[1][a] == B[2][a]){
      if(B[1][a] == 0){
	cout << "Yes" << endl;
	return 0;
      }
    }
    if(B[a][0] == B[a][1] && B[a][1] == B[a][2]){
      if(B[a][0] == 0){
	cout << "Yes" << endl;
	return 0;
      }
    }
  }
  if(B[1][1] == 0){
    if(B[0][0] == 0 && B[2][2] == 0){
      cout << "Yes" << endl;
      return 0;
    }
    if(B[0][2] == 0 && B[2][0] == 0){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


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

using namespace std;

void __start__() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef MY
    freopen("/home/ainur/CLionProjects/wow/input.txt", "r", stdin);
    freopen("/home/ainur/CLionProjects/wow/output.txt", "w", stdout);
#else
#define endl '\n'
    //freopen("search.in", "r", stdin);
    //freopen("search.out", "w", stdout);
#endif
}

#define sz(x) (int)x.size()
#define yes cout<<"Yes\n"
#define  no cout << "No\n"
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ft first
#define sd second
#define read(a) for(auto &qwqw:a)cin >> qwqw;
#define print(a) for(auto qwqw:a)cout<<qwqw<<' ';
#define print_plus(a) for(auto qwqw:a)cout<<qwqw+1<<' ';
//#define FOR(i, b, n) for(int i=b;i<n;i++) #define FOR(i, n) FOR(i, 0, n) #define FOR(n) FOR(i, 0, n)
mt19937_64 rnd(time(0));
#define int long long
using ll = long long;
using vi = vector<int>;
using ld = long double;
using vb = vector<bool>;
using pii = pair<int, int>;
using vd = vector<long double>;


int log2(int q) {
    int c = 0;
    while (q) {
        q >>= 1;
        c++;
    }
    return c;
}


void test_case() {

}


signed main() {
    __start__();
    string s;
    cin >> s;
    int n = 0;
    for (int i = 0; i < sz(s); ++i) n += s[i] - '0';
    (n % 9 ? no : yes);

}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<string> rr(n);
    vector<pair<char, char>> ar(n);
    vector<pair<char, char>> arr;
    rep(i,n){
        cin >> rr[i];
    }
    string s;
    rep(i,n){
        s = rr[i];
        ar[i].first = s.at(0);
        ar[i].second = s.at(1);
    }
    arr = ar;
    pair<char, char> le, ri;
    bool t = true;
    while (t){
        t = false;
        rep(i,n-1){
            if (ar[i].second > ar[i+1].second){
                le = ar[i+1];
                ri = ar[i];
                ar[i] = le;
                ar[i+1] = ri;
                t = true;
            }
        }
    }
    rep(j,n-1){
        cout << ar[j].first << ar[j].second << " ";
    }
    cout << ar[n-1].first << ar[n-1].second << endl;
    cout << "Stable" << endl;
    
    char mi;
    int e;
    rep(i,n-1){
        mi = arr[i].second;
        e = i;
        repp(j,n,i+1){
            if (mi > arr[j].second){
                mi = arr[j].second;
                e = j;
            }
        }
        if (e != i){
            le = arr[e];
            ri = arr[i];
            arr[i] = le;
            arr[e] = ri;
        }
    }
    rep(i,n-1){
        cout << arr[i].first << arr[i].second << " ";
    }
    cout << arr[n-1].first << arr[n-1].second << endl;
    if (ar == arr){
        cout << "Stable" << endl;
    }
    else{
        cout << "Not stable" << endl;
    }
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D,left, right;
  cin >> A >> B >> C >> D;
  left = A + B;
  right = C + D;
  
	if (left == right) {
		cout << "Balanced" << endl;
    }
   	else if (left > right) {
      cout << "Left" << endl;
    }
  else {
      cout << "Right" << endl;
  } 
}

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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<long long> vll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    int a, p;
    cin >> a >> p;
    cc((a*3+p)/2); 
}

Measured memory_bytes: 256
#![allow(non_snake_case, dead_code)]
use proconio::input;
use proconio::marker::Chars;
//use std::collections::HashSet;
//use std::cmp::*;

fn main() {
    input! {
        chars: Chars
    }
    let m = 2019;
    let mut nums: Vec<i32> = Vec::with_capacity(chars.len());
    let l = chars.len();
    for c in chars {
        nums.push(c as i32 - 48);
    }
    nums.reverse();

    // 左からnum[i]までを取った時のあまり。
    let mut amari: Vec<i32> = vec![0; l];
    let mut num_of_amari: Vec<i32> = vec![0; 2019];
    amari[0] = nums[0];
    num_of_amari[amari[0] as usize] += 1;
    let mut tenth: Vec<i32> = vec![0; l];
    tenth[0] = 1;
    for i in 1..l {
        tenth[i] = tenth[i - 1] * 10 % 2019;

        amari[i] = (amari[i - 1] + nums[i] * tenth[i]) % m;
        num_of_amari[amari[i] as usize] += 1;
        //println!("amari[{}]={}", i, amari[i]);
    }

    let mut ans = 0;
    for n in &num_of_amari {
        ans += n * (n - 1) / 2;
    }
    ans += num_of_amari[0];
    println!("{}", ans);
}


Measured memory_bytes: 4432
#include<iostream>
#include<cstdio>
#include<cstring>
typedef long long ll;
const int MAXN=100,P=1e9+7;

char s[2][MAXN];

int main()
{
	int i;
	scanf("%d",&i);
	scanf("%s%s",s[0],s[1]);
	int ans;
	for(i=0;i<strlen(s[0]);i++)
	{
		if(!i)
		{
			if(s[0][i]!=s[1][i]) ans=6,i++;
			else ans=3;
		}else
		{
			if(s[0][i]!=s[1][i]) 
			{
				if(s[0][i-1]!=s[1][i-1]) ans=((ll)ans*3)%P;
				else ans=((ll)ans*2)%P;
				i++;
			}
			else 
			{
				if(s[0][i-1]!=s[1][i-1]) ans*=1;
				else ans=((ll)ans*2)%P;
			}
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

bool mark[1000000];
void init() {
	for(int i=0; i < 1000000; i++) mark[i] = false;
	
	mark[0] = true;
	mark[1] = true;
	for(int i = 2;i < 1000000;i++)
	{
		if(mark[i])
			continue;
		for(int j = i * 2; j < 1000000; j += i)
		{
			mark[j] = true;
		}
		
	}

}
int main() {
	init();
	int n, count=0;
	//if(freopen("D:\\test.txt", "r", stdin) == NULL) return -1;
	while(scanf("%d", &n) != EOF) {
		for(int i = 2; i <= n;i++)
		{
			if(!mark[i])
			{
				count++;
			}
		}
		printf("%d\n", count);
		count = 0;
	}
	return 0;
}

Measured memory_bytes: 2000
def print_max():
	N = int(input())
	S = [int(input()) for i in range(N)]
	
	if sum(S)%10 != 0:
		print(sum(S))
		return
	S.sort()
	S_n = S[:]
	for i in range(len(S)):
		S_n.pop(i)
		if sum(S_n)%10 != 0:
			print(sum(S_n))
			return
		S_n = S[:]
	print(0)
	return
	
print_max()

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		long x = sc.nextLong();
		// 5, 6重複翻
		long times = x / 11L;
		
		long remainder = x % 11L;
		
		if (remainder == 0) {
			remainder = 0;
		} else {
			if (remainder > 6) {
				remainder = 2;
			} else {
				remainder = 1;
			}
		}
		System.out.println(times * 2L + remainder);
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 23124
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a,b,c;
int k1,k2,k3;

int main(){
  cin >> a >> b >> c;
  k1 = a-b;
  k1 = max(k1,-k1);
  k2 = b-c;
  k2 = max(k2,-k2);
  k3 = c-a;
  k3 = max(k3,-k3);
  int ans;
  ans = max(k1,k2);
  ans = max(ans,k3);
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
s=input()
x,y=0,0
li=s
if 'N' in li and 'S' in li and not 'E' in li and not 'W' in li:
  print('Yes')
  exit()
  
if 'E' in li and 'W' in li and not 'S' in li and not 'N' in li:
  print('Yes')
  exit()
 
for i in s:
    if(i=='N'):
        y+=1
    elif(i=='S'):
        y-=1
    elif(i=='W'):
        x-=1
    else:
        x+=1
if(x==0 and y==0):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61856
n = int(input())
tasks = []

for i in range(n):
    ai, bi = list(map(int, input().split()))
    tasks.append((ai, bi))

tasks = sorted(tasks, key=lambda x: x[1])

t = 0
for i in range(n):
    if t > tasks[i][1] - tasks[i][0]:
        print("No")
        exit()
    else:
        t += tasks[i][0]

print("Yes")

Measured memory_bytes: 39028
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
const int M=100000+5;
int main()
{
	int n,a[M];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=1;i<n;i++){
		if(a[i]==a[i-1]){
			for(int j=i;j<n-1;j++)
				a[j]=a[j+1];
			n--;
		}	
	} 
	int t=1;
	for(int i=2;i<n;i++){
		if(a[i-1]<a[i-2] && a[i]>a[i-1]) {t++;i++;}
		else if(a[i-1]>a[i-2] && a[i]<a[i-1]) {t++;i++;}
	}
	cout<<t<<endl;
	return 0; 
}

Measured memory_bytes: 640
//https://atcoder.jp/contests/dp/submissions/12965498
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;
 
const int Mod = 1e9 + 7;
 
 
template <typename T>
class Matrix {
  int n, m;
  vector<vector<T>> mat;
public:
  Matrix(int n): n(n), m(n) { mat.resize(n, vector<T>(m, T())); }
  Matrix(int n, int m): n(n), m(m) { mat.resize(n, vector<T>(m, T())); }
  Matrix(int n, int m, T v): n(n), m(m) { mat.resize(n, vector<T>(m, v)); }
  const vector<T>& operator[](int r) const { return mat[r]; }
  vector<T>& operator[](int r) { return mat[r]; }
  inline int N() { return n; }
  inline int M() { return m; }
  T trace() const {
    T r = T();
    for(int i = 0; i < n; i++)
      r = r + mat[i][i];
    return r;
  }
  Matrix rotate() const {
    Matrix R(m, n, T());
    for(int i = 0; i < n; i++)
      for(int j = 0; j < m; j++)
        R[j][n - 1 - i] = mat[i][j];
    return R;
  }
  Matrix reflect() const {
    Matrix R(n, m);
    for(int i = 0; i < n; i++)
      for(int j = 0; j < n; j++)
        R[i][m - 1 - j] = mat[i][j];
    return R;
  }
  static Matrix identity(int n) {
    Matrix R(n, n, T());
    for(int i = 0; i < R.N(); i++)
      R[i][i] = 1;
    return R;
  }
  friend Matrix operator+ (const Matrix& A, const Matrix& B) {
    Matrix R(A.N(), B.M());
    for(int i = 0; i < R.N(); i++)
      for(int j = 0; j < R.M(); j++)
        R[i][j] = A[i][j] + B[i][j], R[i][j] %= Mod;
    return R;
  }
  friend Matrix operator* (const Matrix& A, const Matrix& B) {
    Matrix R(A.n, B.m);
    for(int i = 0; i < R.n; i++)
      for(int j = 0; j < R.m; j++) {
        R[i][j] = T();
        for(int k = 0; k < R.n; k++)
          R[i][j] = (R[i][j] + A[i][k] * B[k][j]) % Mod;
      }
    return R;
  }
  friend Matrix operator^ (const Matrix& A, long long p) {
    if(!p) return Matrix::identity(A.n);
    if(p & 1) return A * (A ^ (p - 1));
    return (A * A) ^ (p >> 1);
  }
  friend ostream& operator<<(ostream& cout, const Matrix& A) {
    for(int i = 0; i < A.n; i++) {
      for(int j = 0; j < A.m; j++)
        cout << A.mat[i][j] << ' ';
      cout << '\n';
    }
    return cout;
  }
};
 
 
int main()
{
  int n;
  long long k;
  cin >> n >> k;
  Matrix<long long> a(n);
  for(int i = 0 ; i < n ; i++)
    for(int j = 0 ; j < n ; j++)
      cin >> a[i][j];
  Matrix<long long> b = a ^ k;
  long long ans = 0;
  for(int i = 0 ; i < n ; i++)
    for(int j = 0 ; j < n ; j++)
      ans += b[i][j], ans %= Mod;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1536
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=math.floor,math.ceil
from collections import deque
Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO')
is_even=lambda x:True if x%2==0 else False

def main():
    x = aint()
    print((x//500)*1000+((x%500)//5)*5)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    //REP(i,n) cout << a[i]<< endl;
   
    int mi = INF;
    FOR(i,a[0],a[n-1]+1){//三項目がi<nなのでa[n-1]+1としなければならない

        int cost = 0;
        REP(j,n){
              cost+=(a[j]-i)* (a[j]-i);
        }
        mi = min(cost,mi);


    }
    cout << mi << endl;
    return 0;

}


Measured memory_bytes: 256
use std::io;
use std::cmp;

// read a line(without line feed)
fn read_line() -> String {
    let mut in_str = String::new();
    io::stdin().read_line(&mut in_str).unwrap();
    return in_str.trim().to_string();
}

// read wods on a line
pub fn read_words_in_line() -> Vec<String> {
    let s = read_line();
    return s.split_whitespace().map(|x| x.to_string()).collect::<Vec<String>>()
}

// read type t on a line
pub fn read_t_in_line<T : std::str::FromStr>() -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for e in read_words_in_line().iter().map(|x| x.parse::<T>()) {
        if let Ok(r) = e {
            v.push(r);
        }
        else{
            return Vec::new();
        }
    }
    return v;
}

// sort slice
pub fn sort<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort();
}
// sort slice by reverse order
pub fn sort_rev<T : std::cmp::Ord>(slice : &mut [T]) {
    slice.sort_by(|x, y| y.cmp(x));
}

pub fn min<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::min(a, b);
}

pub fn max<T : std::cmp::Ord>(a : T, b : T) -> T{
    return cmp::max(a, b);
}

fn main() {

    let x_t = read_t_in_line::<i32>();
    let (x, t) = (x_t[0], x_t[1]);
    println!("{}", max(0, x-t));
    

}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    HashMap<int, int> dp;

    signed call_of_Cthulhu( signed datum ) {
        
        int n;
        read n;
        for ( int i = 0; i < n; i++ ) {
            int a;
            read a;
            dp[a]++;
        }
        int ans = 0;
        for ( Pii a : dp ) {
            ans += (a.second&1);
        }

        echo ans fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


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

long long N;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> N;
	for(int h=1; h<=3500; ++h)
		for(int n=1; n<=3500; ++n)
			if(4*h*n != N*(n+h) && N*h*n % (4*h*n-N*n-N*h) == 0 && (4*h*n-N*n-N*h) > 0){
				cout << h << " " << n << " " << N*h*n / (4*h*n-N*n-N*h) << "\n";
				return 0;
			}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  vector<int> sum(n,0);
  int cnt=0;
  rep(i,n){
    if(s[n-1-i]=='W'){
      sum[n-i-1]=sum[n-i]+1;
      cnt++;
    }
    else{
      sum[n-i-1]=sum[n-i];
    }
  }
  cout<<cnt-sum[n-cnt]<<endl;
  return 0;
}


Measured memory_bytes: 4412
n=int(input())
a= [input() for i in range(n)]
c=[0]*4
for i in a:
    if i=='AC':
        c[0]+=1
    elif i=='WA':
        c[1]+=1
    elif i=='TLE':
        c[2]+=1
    else:
        c[3]+=1

print('AC'+' ' + 'x'+' '+ str(c[0]))
print('WA'+' '+ 'x'+' '+ str(c[1]))
print('TLE' +' ' +'x'+' '+str(c[2]))
print('RE'+' ' +'x' +' '+str(c[3]))


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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define debug(x) cerr << #x << " = " << (x) << endl;
template<typename T>
ostream& operator<<(ostream& o, vector<T>& v) {
    for (auto& x : v) o << x << ' ';
    return o;
}

typedef pair<pii, int> piii;
const int INF = (int)1e9;
int main(){
    std::ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m; cin >> n >> m;
    vvi dist(n, vi(n, INF));
    for (int i = 0; i < n; i++) dist[i][i] = 0;
    vector<piii> edges;
    for (int i = 0; i < m; i++){
        int u, v; cin >> u >> v; u--; v--;
        cin >> dist[u][v];
        dist[v][u] = dist[u][v];
        edges.push_back({{u, v}, dist[u][v]});
    }
    for (int k = 0; k < n; k++)
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

    int res = 0;
    for (int i = 0; i < m; i++){
        bool shortest = false;
        for (int u = 0; u < n; u++)
            for (int v = u + 1; v < n; v++){
                //cout << u << ' ' << v << ' ' << dist[u][v] << ' ' << edges[i].X.X << ' ' << edges[i].X.Y << ' ' << edges[i].Y << endl;
                if (dist[u][v] == dist[u][edges[i].X.X] + dist[edges[i].X.Y][v] + edges[i].Y) shortest = true;
                if (dist[u][v] == dist[v][edges[i].X.X] + dist[edges[i].X.Y][u] + edges[i].Y) shortest = true;
            }
        if (!shortest) res++;
    }
    cout << res << endl;
}


Measured memory_bytes: 384
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int h,a;
  cin >> h >> a;
  if(h%a==0) printf("%d\n", h/a);
  else printf("%d\n",(int)(h/a)+1 );

  return 0;
}


Measured memory_bytes: 256
N,K = [ int(it) for it in input().split() ]

if (K!=0):
  s=0
  for b in range(K+1,N+1):
    w = N//b
    a = N%b
    ds = 0
    ds+= max(a-K+1,0)# amari <= a
    ds+= w*(b-K)

    s+=ds
    #print(b,ds)
  print (s)
else:
  print (N*N)
  

Measured memory_bytes: 3060
//1.read question_2.read I/O_3.read test cases_4.read constraints(to decide TC of solution)_5.decide method_6.dry run_
//7.code_8.test_9.submit
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define _READ freopen("input.txt","r", stdin);
#define pb push_back
#define _FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{
   
    lli n;cin>>n;vector<lli> ar(n);
    lli mini=LONG_LONG_MAX;lli temp,ans=0;
    for(lli i=0;i<n;i++)
    {
        cin>>temp;
        if(mini>temp)
        {
            ++ans;
            mini=temp;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>

using namespace std;

int main(){
        string s1,s2,s3;
        cin >> s1 >> s2 >> s3;
        s1[0] = s1[0] - 32;
        s2[0] = s2[0] - 32;
        s3[0] = s3[0] - 32;
        cout << s1[0] << s2[0] << s3[0] << endl;
        return 0;
        }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

void solve()
{
  int n;
  cin>>n;
  string a,b;
  cin>>a>>b;
  for(int i=0;i<n;i++){
    cout<<a[i]<<b[i];
  }
  cout<<endl;
}

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

        solve();

    return 0;
}



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


int main() {
  	int n;
  	cin >> n;
  	if (n >= 1000)
      cout << "ABD" << endl;
  	else
      cout << "ABC" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int m,n;
    cin>>n>>m;
    char A[55][55],B[55][55];
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
            cin>>A[i][j]; 
    }
    for(int i = 1; i <= m; i++)
    {
        for(int j = 1; j <= m; j++)
            cin>>B[i][j];
    }
    for(int i = 1; i <= n - m + 1; i++)
    {
        for(int j= 1; j <= n - m + 1; j++)
        {
            bool flag = true;
            for(int a = 1; a <= m; a++)
            {
                for(int b = 1; b <= m; b++)
                {
                    if(A[i+a-1][j+b-1]!=B[a][b])
                    {
                        flag = false;
                        break;
                    }
                    
                }
                if(!flag)
                    break;
                
            }
            if(flag)
            {
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	int na = n; if (n%a != 0)na += a - (n%a);
	int nc = n; if (n%c != 0)nc += c - (n%c);
	cout << min(b*na / a, d*nc / c) << endl;
	return 0;
}


Measured memory_bytes: 3092
S = list(input())
n = len(S) // 2

m = -1
s = 0
ans = 0

for i in range(n):
    if S[s] != S[m]:
        ans += 1
        s += 1
        m -= 1
    elif S[s] == S[m]:
        s += 1
        m -= 1
    
   
        
print(ans)

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


ll arr[3010],n;
ll dp[3010][3010],sum;

ll solve(int i,int j)
{
	if(i>j)
	{
		return 0;
	}
	if(dp[i][j]!=-1)return dp[i][j];
	
	ll a=min(solve(i+2,j),solve(i+1,j-1))+arr[i];
	ll b=min(solve(i+1,j-1),solve(i,j-2))+arr[j];
//	cout<<a<<" "<<b<<endl;
	return dp[i][j]=max(a,b);
	
	
}

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

    cin>>n;
    memset(dp,-1,sizeof(dp));
    
    for(int i=0;i<n;i++)
	{
	cin>>arr[i];
	sum+=arr[i];	
	}
    
    ll res=solve(0,n-1);

    cout<<2LL*res-sum<<endl;
    
	return 0;
}

Measured memory_bytes: 71168
n, y = list(map(int, input().split()))

for i in range(n + 1):
  for j in range(n + 1):
    if (n - (i + j) >= 0) and (i * 10000 + j * 5000 + (n - (i + j)) * 1000 == y):
      print(str(i) + " " + str(j) + " " + str(n - (i + j)))
      exit()
else:
  print("-1 -1 -1")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,t,a;
  cin >> n >> t >> a;
  vector<int> h(n);
  rep(i,n) cin >> h.at(i);
  double ans = INF;
  rep(i,n){
    double deg = t-h.at(i)*0.006;
    ans = min(ans,abs(deg-a));
  }
  rep(i,n){
    double deg = t-h.at(i)*0.006;
    if(ans==abs(deg-a)){
      cout << i + 1 << 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;

int main(){
    int a, b;
    cin >> a >> b;
    double r;
    r = double(a) / double(b);
    printf("%d %d %f", a/b, a%b, r);
    return 0;
}


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

N = len(S)
M = len(T)

i_a = 0
for i in reversed(range(N-M+1)):
    ans = 0
    for j in range(M+1):
        if j == M:
            print((S[:i]+T+S[i+M:]).replace('?','a'))
            exit()
        if T[j] == S[i+j] or S[i+j] == '?':
            continue
        else:
            break

print('UNRESTORABLE')

Measured memory_bytes: 3064
#include <iostream>
 using namespace std; int main(void){ 
    int a,b;
    cin>>a>>b;
    if(a>b){
        for(int i=0;i<a;i++){
             cout<<b;
             }
    }else{
    for(int i=0;i<b;i++){
        cout<<a;
    }
}
    return 0;
    }


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);
/*
void foreach_permutation(int n, function<void(int *)> f) {
    int indexes[n];
    for(int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while(next_permutation(indexes, indexes + n));
}*/

//================ Main Loop ================
int main() {
    setpre(10);
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    rep(i, n) {
        cin >> x[i] >> y[i];
    }
    double ans = 0;
    int indexes[n];
    for(int i = 0; i < n; i++) indexes[i] = i;
    do {
        for(int i = 1; i < n; i++) {
            ans += sqrt(pow(x[indexes[i]] - x[indexes[i - 1]], 2) + pow(y[indexes[i]] - y[indexes[i - 1]], 2));
        }
    } while(next_permutation(indexes, indexes + n));
    /*foreach_permutation(n, [](int *indexes) {
        for(int i = 1; i < n; i++) {
            ans += sqrt(pow(x[indexes[i]] - x[indexes[i - 1]], 2) + pow(y[indexes[i]] - y[indexes[i - 1]], 2));
        }
    });*/
    for(int i = 1; i <= n; i++) {
        ans /= i;
    }
    cout << ans << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}


Measured memory_bytes: 256