akhauriyash/Code-Regression huggingface dataset:
/*
	author : SAMRAT DE
	username : Alucard_01
	NIT Durgapur
*/

/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>*/
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define vec(x) vector<x> 
#define st(x) set<x> 
#define pi(x,y) pair<x,y>
#define mpp(x,y) map<x,y>
#define pqq(x) priority_queue<x> 
#define min_heap(x) priority_queue<x, vector<x>, greater<x> >
#define all(x) x.begin(),x.end()
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(ll i=x-1;i>=y;i--)
#define rev(x) reverse(x.begin(),x.end())
#define mem(x,a) memset(x,a,sizeof(x))
#define mod 1000000007
#define nxt_per(x) next_permutation(x.begin(),x.end())
#define pb push_back
#define pf push_front
#define indexof order_of_key
#define valueat find_by_order
#define myds tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dxx[8]={0,0,1,-1,-1,-1,1,1};
int dyy[8]={1,-1,0,0,-1,1,1,-1};

using namespace std;
//using namespace __gnu_pbds;

int32_t main()
{
	fastio;
	//best of luck don't loose hope man	
		
	string s;cin>>s;
	int dp[s.size()];
	dp[0]=1;
	if(s[0]==s[1])
		dp[1]=1;
	else
		dp[1]=2;
	if(s[2]==s[1])
		dp[2]=2;
	else
		dp[2]=dp[1]+1;
	rep(i,3,s.size()){
		if(s[i]==s[i-1])
			dp[i]=dp[i-3]+2;
		else
			dp[i]=dp[i-1]+1;
	}
	cout<<dp[s.size()-1]<<endl;
	return 0;
}

Measured memory_bytes: 1300
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, K = map(int, input().split())
V = list(map(int, input().split()))

ans = 0  # 何もしないと0なので、ansの初期値は0


# pick->取り出す操作をする回数(listより多く取り出さないように注意)
for pick in range(min(K+1, N+1)):
    # 右から取り出す数
    for right in range(pick+1):
        left = pick-right  # 左から取り出す数
        pick_list = V[:right]+V[N-left:]

        # queueに戻す操作
        pick_list = sorted(pick_list)
        tmp_ans = sum(pick_list)  # 戻す前の合計値
        rem = min(K-pick, len(pick_list))  # 戻す操作をできる回数
        for i in range(rem):  # 負の値のものをできるだけ戻す
            if pick_list[i] < 0:
                tmp_ans -= pick_list[i]
            else:
                break
        ans = max(tmp_ans, ans)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<algorithm>
//#define LL long long

//#define  T int t;cin>>t;while(t--)
using namespace std;
int main(){
    int n;
    cin>>n;
    n=n%1000;
    if(n!=0) n=1000-n;
    cout<<n<<endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

string s, s2;
int ans;

int main() {

	cin >> s;
	for (int i = s.size() - 1;i >= 0;i--) {
		s2.push_back(s[i]);
	}

	rep(i, s.size() / 2) {
		if (s[i] != s2[i])ans++;
	}

	cout << ans << endl;

	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  int ans=0;
  REP(i,n){
    bool l[26], r[26];
    REP(j,26)l[j]=false;
    REP(j,26)r[j]=false;

    REP(j,i+1){
      l[s[j]-'a'] = true;
    }
    FOR(j,i+1,n){
      r[s[j]-'a'] = true;
    }

    int cnt=0;
    REP(j,26){
      if(l[j] && r[j])cnt++;
    }

    ans=max(ans,cnt);
  }

  cout << ans << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);i++)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}
const ll inf = 1LL<<60;

int main() {
  ll N,Y;cin>>N>>Y;
  int k;
  ll ans=0;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N;j++){
      if (i+j<=N){
        k=N-(i+j);
        ans=i*1000+j*5000+k*10000;
        if (ans==Y){
          cout<<k<<" ";
          cout<<j<<" ";
          cout<<i;
          return 0;
        }
      }
    }
  }
  cout<<-1<<" "<<-1<<" "<<-1<<" "<<endl;
}


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

using namespace std;

int main()
{
	int a[3];
	int k,maxx = 0;
	cin >> a[0] >> a[1] >> a[2];
	cin >> k;
	sort(a, a + 3);
	for (int i = 0; i < k; i++) {
		a[2] *= 2;
	}
	cout << a[0] + a[1] + a[2] << endl;
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N;
vi a;

void solve() {
	
	cin >> N;

	bool ans = false;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		a.pb(tmp);
		if (tmp % 2 != 0) ans = true;
	}

	if (ans) {
		cout << "first" << endl;
	}
	else {
		cout << "second" << endl;
	}

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 892
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<=b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

std::string s;

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

    LL ans = 0;
    int cnt1 = 0;
    REP(i,s.size()) {
        while(i < s.size() && s[i] == 'A') i++,cnt1++;
        if(s.size() <= i) break;
        int j = i;
        while(j+1<s.size() && s[j] == 'B' && s[j+1] == 'C') j+=2, ans+=cnt1;
        if(s.size() <= i) break;
        if(i<s.size() && s[j] != 'A') cnt1 = 0;
        if(i < j) i = j-1;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 720
S = input()
n =len(S)
y = int()
c = int()
for i in range(n):
	if i % 2 ==0:
		x = "0"
	else:
		x ="1"
	if S[i] == x:
		c += 1
		#print(i, S[i],x,"OK")
	else:
		y += 1
		#print(i,S[i],x)

if c < y:
	print(c)
else:
	print(y)



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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> dp(n+20000, INT_MAX);
    dp[0] = 0;
    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;
        for (int j = 0; j <= n; j++) {
            dp[j+a] = min(dp[j+a], dp[j]+1);
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  string s;
  cin>>s;
  n=sz(s);
  ll ans=n/2;
  ll cu=0;
  rep(i,n){
    if(s[i]=='p') cu++;
  }
  COUT(ans-cu);
}

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

int main(){
	long n, ans=0;
	
	scanf(" %ld", &n);
	for(long i=0; i<n; ++i){
		long a;
		scanf(" %ld", &a);
		ans+=a;
	}
	
	printf("%ld\n", ans/n);
	return 0;
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

long long ans = 0;

void work(long long x, long long y)
{
	if (x < y)
	{
		ans += (y / x) * x * 2 - x;
		if (y % x == 0)
			return;
		ans += x;
		work(x, y % x);
	}
	else
	{
		ans += (x / y) * y * 2 - y;
		if (x % y == 0)
			return;
		ans += y;
		work(y, x % y);
	}
}

int main()
{
	long long N, X;
	cin >> N >> X;
	ans += N;
	work(X, N - X);
	cout << ans << endl;
}



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

#define MOD 1000000007
template<typename ty1,typename ty2>
inline int add(ty1 x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x += y; return x < MOD ? x : x - MOD;
}
template<typename ty1,typename ty2>
inline void addto(ty1 &x, ty2 y) {
		  if(y>=MOD)y%=MOD;
		  if(x>=MOD)x%=MOD;
	      x += y; if (x >= MOD) x -= MOD;
}
template<typename ty1,typename ty2>
inline int sub(ty1 x, ty2 y) {
		if(y>=MOD)y%=MOD;
		 if(x>=MOD)x%=MOD;
        x -= y; return x < 0 ? x + MOD : x;
}
template<typename ty1,typename ty2>
inline void subto(ty1 &x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x -= y; if (x < 0) x += MOD;
}
template<typename ty1,typename ty2>
inline int mul(ty1 x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        return 1ll * x * y % MOD;
}
template<typename ty1,typename ty2>
void multo(ty1 &x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        x=1ll * x * y % MOD;
}

#define MAX 100002

int n;
int m;

long long int dist[MAX];

vector<int> v[MAX];
map<pair<int,int>,int> mp;
void col2(int a,int b,int c){
	if(a>b)swap(a,b);
	mp[make_pair(a,b)]=c;
}
bool us[MAX];
char f[MAX];
inline void dfs(int b,int col,int pr=-1){
		us[b]=true;
		if(col==0){
			f[b]='W';
		}
		else{
			f[b]='B';
		}
		for(int go:v[b]){
			if(go==pr)continue;
			if(us[go]){
				col2(b,go,1000000000);
				continue;
			}
			if(dist[b]==dist[go]){
				//diffrent color
				dfs(go,col^1,b);
				int len=dist[b];
				col2(b,go,len);
				continue;
			}
			if(dist[b]<dist[go]){
				//same color
				int len=abs(dist[go]-dist[b]);
				dfs(go,col,b);
				col2(b,go,len);
			}
		}
}
vector<int> nd;
vector<pair<int,int> > dd;
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		scanf("%lld",&dist[i]);
		nd.push_back(i);
	}
	auto cmp=[&](int a,int b){
		return dist[a]<dist[b];
	};
	sort(nd.begin(),nd.end(),cmp);
	
	for(int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
		if(a>b)swap(a,b);
		mp[make_pair(a,b)]=-1;
		dd.push_back(make_pair(a,b));
	}
	for(int i=0;i<n;i++){
		bool ok=false;
		for(int el:v[i]){
			if(dist[i]>=dist[el]){
				ok=true;
			}
			if(dist[i]==dist[el]){
				
			}
		}
		if(ok==false){
			puts("-1");
			return 0;
		}
	}
	for(int el:nd){
		if(us[el]==false)dfs(el,0);
	}
	f[n]='\0';
	printf("%s\n",f);
	for(auto c:dd){
		printf("%d\n",mp[c]);
	}
	return 0;
}



Measured memory_bytes: 25712
#include <iostream>
using namespace std;
int main(){
    string S;
    cin >> S;
    int k = S.size();
    int ans = 0;
    for(int i = 0; i < k; i++){
        if(S[i] == 'x') ans++;
    }
    if(ans <= 7) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main(){
  int MOD = 86400;
  int BET = 10800;
  int N;
  int a[114514],b[114514];
  int table[100000]={};
  cin >>N;
  REP(i,N){cin >> a[i] >> b[i];}
  int now=0;
  REP(i,N){
    now+=a[i];
    table[now%MOD]++;
    now+=b[i];
    now%=MOD;
  }
  REP(i,MOD-1){
    table[i+1]+=table[i];
  }
  int Ans=0;
  REP(i,MOD){
    int sum=0;
    if(i==0){
      sum+=table[BET];
    }else if(i+BET>=MOD){
      sum+=table[(i+BET)%MOD];
      sum+=table[MOD-1]-table[i-1];
    }else{
      sum+=table[i+BET]-table[i-1];
    }
    Ans=max(Ans,sum);
  }
  cout << Ans << endl;


  return 0;
}


Measured memory_bytes: 1536
#include<stdio.h>
#define INF 2000000001
 
int t[250],n;
 
void parent(int x){
  if(x!=0){
    printf("parent key = %d, ",t[(x-1)/2]);
  }
}
 
void left(int x){
  int y=x*2+1;
  if(y<250&&t[y]!=INF){
    printf("left key = %d, ",t[y]);
  }
}
 
void right(int x){
  int y=x*2+2;
  if(y<250&&t[y]!=INF){
    printf("right key = %d, ",t[y]);
  }
}
 
int main(){
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&t[i]);
  for(i=n;i<250;i++)t[i]=INF;
 
  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i+1,t[i]);
    parent(i);
    left(i);
    right(i);
    printf("\n");
  }
  return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;

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

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

	swap(a, b);
	swap(a, c);

	cout << a << " " << b << " " << c;

	return 0;
}

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

using namespace std;
using ll = long long;
const ll oo = 4e18;

ll solve(ll n, int a, int b, int c, int d) {
	map<ll, ll> dp;
	auto push = [&dp](ll u, ll dt) {
		if(dt > oo) return;
		auto it = dp.find(u);
		if(it == dp.end()) dp[u] = dt;
		else it->second = min(it->second, dt);
	};
	push(n, 0);
	while(prev(dp.end())->first != 1) {
		ll u, dt;
		tie(u, dt) = *prev(dp.end());
		dp.erase(prev(dp.end()));
// 		printf(".. dist[%lld] = %lld\n", u, dt);
		ll t2 = (2 - u % 2) % 2;
		ll t3 = (3 - u % 3) % 3;
		ll t5 = (5 - u % 5) % 5;
		ll v2 = (u + t2) / 2;
		ll v3 = (u + t3) / 3;
		ll v5 = (u + t5) / 5;
		push(v2, t2 * d + a + dt);
		push(v3, t3 * d + b + dt);
		push(v5, t5 * d + c + dt);
		
		if((u - v2) < oo / d)
			push(v2, (u - v2) * d + dt);
		if((u - v3) < oo / d)
			push(v3, (u - v3) * d + dt);
		if((u - v5) < oo / d)
			push(v5, (u - v5) * d + dt);

		push((u - u % 2) / 2, u % 2 * d + a + dt);
		push((u - u % 3) / 3, u % 3 * d + b + dt);
		push((u - u % 5) / 5, u % 5 * d + c + dt);
	}
// 	cout << ".." << dp[1] << endl;
	push(0, dp[1] + d);
// 	assert(dp.size() == 1);
	return dp[0];
}

int main() {

	int t;
	scanf("%d", &t);

	while(t--) {
		ll n; int a, b, c, d;
		scanf("%lld %d %d %d %d", &n, &a, &b, &c, &d);
		printf("%lld\n", solve(n, a, b, c, d));
	}

}


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	int a,b,c,hisi=0,chou=0;
	while(~scanf("%d,%d,%d",&a,&b,&c)){
		if( a==b ){
			if( a>c ){
				if( b+c>a )hisi++;
			}else{
				if( a+b>c )hisi++;
			}
		}
		else if( a*a+b*b==c*c )chou++;
	}
	printf("%d\n%d\n",chou,hisi);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main() {
	int a, b, c;
	cin >> a>>b>>c;
	if (a>b) swap(a,b);
	cout << (a<=c&&c<=b ? "Yes" : "No") << endl;
}


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

struct TopologicalSort{
  Int n;
  vector<set<Int> > G;
  vector<bool> used;
  vector<Int> indeg,p;
  
  TopologicalSort(){}
  TopologicalSort(Int sz):n(sz),G(n),used(n),indeg(n),p(0){}

  void add_edge(Int s,Int t){
    G[s].insert(t);
  }
  
  void bfs(Int s){
    queue<Int> q;
    q.push(s);
    used[s]=1;
    while(!q.empty()){
      Int v=q.front();q.pop();
      p.push_back(v);
      for(Int u:G[v]){
	indeg[u]--;
	if(indeg[u]==0&&!used[u]){
	  used[u]=1;
	  q.push(u);
	}
      }
    }
  }
  
  vector<Int>  build(){
    fill(used.begin(),used.end(),0);
    fill(indeg.begin(),indeg.end(),0);
    
    for(Int i=0;i<n;i++)
      for(Int v:G[i]) indeg[v]++;
    
    for(Int i=0;i<n;i++)
      if(indeg[i]==0&&!used[i]) bfs(i);
    
    return p;
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  TopologicalSort ts(n);
  for(Int i=0;i<m;i++){
    Int a,b;
    cin>>a>>b;
    a--;b--;
    ts.add_edge(a,b);
  }
  auto ord=ts.build();
  auto G=ts.G;
  
  using BS = bitset<5555>;
  vector<BS> dp(n);
  for(Int i=0;i<n;i++){
    Int v=ord[i];
    for(Int u:G[v]){
      dp[u]|=dp[v];
      dp[u][v]=1;
    }
  }

  for(Int x:ord) cout<<x+1<<endl;

  bool flg=0;
  for(Int i=0;i<n;i++)
    for(Int j=0;j<i;j++)
      flg|=(!dp[i][j]&&!dp[j][i]);

  cout<<flg<<endl;
  return 0;
}



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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int N,T,A;
    cin >> N >> T >> A;

    vector<int> H(N);
    rep(i,N) cin >> H[i];

    ll ans = abs( A*1000 - (T*1000 - H[0]*6));
    int key = 1;

    REP(i, 1, N)
    {
        if( ans > abs( A*1000 - (T*1000 - H[i]*6) ) )
        {
            ans = abs( A*1000 - (T*1000 - H[i]*6) );
            key = i+1;
        }
    }
    cout << key << endl;
}


Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]
A.sort(reverse=True)
ans = 0
count = 0
i = 0
while count < N:
    ans += A[i]
    count += 1
    if count % 2 == 0:
        i += 1

ans -= A[0]
print(ans)

Measured memory_bytes: 31748
#include<stdio.h>
#include<string.h>
#include<math.h>
#define ll long long int

void sort(int array[],ll n){

ll i,j,temp;

for(i=0;i<n;i++)
{

    for(j=0;j<n;j++)
    {

        if (array[j] > array[j + 1])
            {
                temp = array[j];
                array[j] = array[j + 1];
                array[j + 1] = temp;
            }

    }



}




}



int main()
{

ll a,b,k,left;


scanf("%lld%lld%lld",&a,&b,&k);

if(a<=k)
{
    k=k-a;
    a=0;


}

if(a>k)
{
    a=a-k;
    k=0;

}

if(b>=k)
{

    b=b-k;
    k=0;

}

if(b<k)
{
    b=0;


}
printf("%lld %lld",a,b);


    return 0;
}


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

int main() {
	string A, B;
	cin >> A >> B;
	if (A.length() > B.length()) cout << "GREATER";
	else if (A.length() < B.length()) cout << "LESS";
	else { // 桁が等しいなら各桁を見ていく
		for (int i = 0;i < A.length();i ++) {
			if (A[i] > B[i]) {
				cout << "GREATER";
				return 0;
			} else if (A[i] < B[i]) {
				cout << "LESS";
				return 0;
			}
		}
		cout << "EQUAL";
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

AとBが大きすぎる(10^100>=2^330)ので、まずは文字列で持っておく
ここで、|A|と|B|が違うなら、桁数の多い方が間違いなく値が大きいのでそっち
桁数が同じなら、上の桁から順にみていって、値が違ったらその瞬間に大小が確定する
O(min(|A|, |B|))
*/

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC170_d1 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int A[] = new int[N];
            int computed[] = new int[1000005];

            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }
            for (int x : A) {
                if (computed[x] != 0) {
                    computed[x] = 2;
                    continue;
                }
                for (int i = x; i < 1000005; i += x) {
                    computed[i]++;
                }
            }
            int ans = 0;
            for (int x : A) {
                if (computed[x] == 1) {
                    ans++;
                }
            }
            out.println(ans);

        }

    }
}



Measured memory_bytes: 64116
N = int(input())
ans = []


def next_chr(ch):
    res = []
    g = ord(ch) - ord("a") + 2
    for i in range(g):
        res.append(chr(ord("a")+i))
    return res


def answer(s, i):
    if i == N:
        ch = next_chr(max(s))
        for m in ch:
            ans.append("".join([s, m]))
    else:
        i += 1
        ch = next_chr(max(s))
        for m in ch:
            answer("".join([s, m]), i)


if N == 1:
    print("a")
else:
    answer("a", 2)
    ans = sorted(ans)
    for c in ans:
        print(c)

Measured memory_bytes: 63068
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func gcd(x, y int) int {
	if x < y {
		x, y = y, x
	}
	for y > 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func gcdList(x []int) int {
	ret := x[0]
	for i := 1; i < len(x); i++ {
		ret = gcd(ret, x[i])
	}
	return ret
}

func solve(k int) int {
	result := 0
	for a := 1; a <= k; a++ {
		for b := 1; b <= k; b++ {
			for c := 1; c <= k; c++ {
				result += gcdList([]int{a, b, c})
			}
		}
	}

	return result
}

func main() {
	k, _ := strconv.Atoi(input())
	fmt.Println(solve(k))
}


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

    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);
        String S = in.next();
        String T = in.next();
        int count = 0;
        if (S.length() == T.length()){
            for (int i = 0; i < S.length(); i++) {
                if (S.charAt(i) != T.charAt(i)){
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 32136
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        var ab = ReadLine().Split().Select(int.Parse).ToArray();
        int a = ab[0];
        int b = ab[1];
        var d = new int[999];
        d[0] = 1;
        for (int i = 0; i < 998; i++)
        {
            d[i + 1] = d[i] + i + 2;
        }
        var diff = b - a;
        WriteLine(d[diff-1]-b);
    }
}


Measured memory_bytes: 28248
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(Int i=0;i<h;i++) cin>>s[i];
  vector<string> t(h,string(w,'.'));
  for(Int i=0;i<h;i++){
    for(Int j=0;j<w;j++){
      if(s[i][j]!='#') continue;
      if(j+1<w&&s[i][j+1]=='#'){
	t[i][j]='#';
	t[i][j+1]='#';
      }
      if(i+1<h&&s[i+1][j]=='#'){
	t[i][j]='#';
	t[i+1][j]='#';
      }
    }
  }
  cout<<(s==t?"Yes":"No")<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){int h,w;char ch[]="#.";register int i,j;while(1){scanf("%d %d",&h,&w);if(!(h|w))exit(0);for(j=0;j++<h;){for(i=0;i++<w;){putchar(ch[(i+j)&1]);}putchar('\n');}putchar('\n');}}

Measured memory_bytes: 572
#include<cstdio>
#include<cmath>
using namespace std;
int main(void)
{
	double x,h,y,s;
	while(1)	{
		scanf("%lf %lf",&x,&h);
		if(x==0.0 && h==0.0)	break;
		y=sqrt((x/2.0)*(x/2.0)+h*h);
		s=x*x+4.0*(x*y/2.0);
		printf("%lf\n",s);
	}
	return 0;
}


Measured memory_bytes: 1072
"""Counting Sort."""

def countingSort(A, B):
    """Sort the elements of list A with Counting Sort algorithm.

    n is the length of A.
    The elements of A are intergers between 0 and k, inclusive.
    B is the output list where the sorted elements will be arranged.
    
    Print the elements of B in a line separated by a space character.
    """

    C = [0 for i in range(10001)]

    for i in A:
        C[i] += 1

    for i in range(1, 10001):
        C[i] = C[i] + C[i - 1]
    
    for i in A[::-1]:
        B[C[i]] = i
        C[i] -= 1

    print(*B[1:])


n = int(input())

A = list(map(int, input().split()))

B = [0 for i in range(n + 1)]

# k = max(A)

countingSort(A, B)

Measured memory_bytes: 233640
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin - 1; end <= i; i--)		// repeat reverse

#endif


struct Work
{
	ll time;
	ll end;
	bool operator < (const Work& w) const
	{
		return end < w.end;
	};
	bool operator > (const Work& w) const
	{
		return end > w.end;
	};
};

class ABC131D
{
public:
	ABC131D()
	{
		cin >> n;
		w.resize(n);
		rep(i, 0, n)
			cin >> w[i].time >> w[i].end;
	}
	void Run(void)
	{
		sort(all(w));
		ll ans = 0;
		for (const auto& e : w)
		{
			ans += e.time;
			if (e.end < ans)
			{
				cout << "No";
				return;
			}
		}

		cout << "Yes";
	}
private:
	ll n;
	vector<Work> w;
};


int main(void)
{
	ABC131D abc131d;
	abc131d.Run();
	
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vint a(n), f(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> f[i];
    sort(rall(a));
    sort(all(f));
    ll l = -1;
    ll r = 1e12;
    while (r-l > 1) {
        ll mid = (l+r)/2;
        bool check = [&] {
            ll sum = 0;
            rep(i,n) sum += max((ll)0,a[i] - mid/f[i]);
            return sum <= k;
        }();
        if (check) r = mid;
        else l = mid;
    }
    cout << r << endl;
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

int dp[35001][6];

signed main(){
    dp[0][0] = 1;
    rep(i, 1, 257){
        rep(j, 1, 35001){
            rep(k, 0, 4){
                if(j - i*i >= 0){
                    dp[j][k + 1] += dp[j - i*i][k];
                }
            }
        }
    }
    rep(i, 0, 35000){
        rep(j, 0, 5){
            dp[i][5] += dp[i][j];
        }
    }
    /*rep(i, 0, 100){
        cout << i << ' ' << dp[i] << endl;
    }*/
    int n;
    while(cin >> n, n){
        cout << dp[n][5] << endl;
    }
}

Measured memory_bytes: 2796
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
   ll n; cin >> n;
   ll sum = 0;
   for(ll i = 1; i <= n; i++){
      if(i % 3 != 0 && i % 5 != 0)sum += i;
   }
   cout << sum << endl;
}

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

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

Measured memory_bytes: 256
s=input()
n = len(s)
front = s[:(n-1)//2]
back = s[(n+3)//2-1:n]
if s==s[::-1]:
  if front==front[::-1]:
    if back==back[::-1]:
      print('Yes')
    else:
      print('No')
  else:
      print('No')
else:
      print('No')
  

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

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

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	int a;
	string s;
	cin >> a >> s;
	cout << (a >= 3200 ? s : "red") << endl;
	return 0;
}


Measured memory_bytes: 256
def calc(lis, m_lis):
    copy_list = lis[:]
    copy_list[m_lis[0] - 1] = m_lis[1]
    print(sum(copy_list))


int(input())
lis = list(map(int, input().split()))
[calc(lis, i) for i in [list(map(int, input().split()))
                        for i in range(int(input()))]]

Measured memory_bytes: 3060
import Text.Printf

readDouble x = read x :: Double

mincowskiSub p 0 xs ys = 0
mincowskiSub p n (x:xs) (y:ys) = (abs (x - y))^p + mincowskiSub p (n - 1) xs ys
mincowski p n xs ys = (mincowskiSub p n xs ys) ** (1 / (fromIntegral p :: Double))

mincowskiMax xs ys = maximum $ zipWith (\x y -> abs (x - y)) xs ys

main = do
  n <- readLn
  x <- return . map readDouble . words =<< getLine
  y <- return . map readDouble . words =<< getLine
  putStrLn $ printf "%.06f" $ mincowski 1 n x y
  putStrLn $ printf "%.06f" $ mincowski 2 n x y
  putStrLn $ printf "%.06f" $ mincowski 3 n x y
  putStrLn $ printf "%.06f" $ mincowskiMax x y

Measured memory_bytes: 4520
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#include <functional>
using namespace std;

const int INF = 1<<28;

struct edge_t {
    int from, to, cost;
    edge_t(int from, int to, int cost) : from(from), to(to), cost(cost) {}
    bool operator<(const edge_t &o) const {
        return (cost < o.cost);
    }
    bool operator>(const edge_t &o) const {
        return (cost > o.cost);
    }
};
struct state_t {
    int v;
    int min_cost;
    state_t(int v, int min_cost) : v(v), min_cost(min_cost) {}
    bool operator<(const state_t &o) const {
        return (min_cost < o.min_cost);
    }
    bool operator>(const state_t &o) const {
        return (min_cost > o.min_cost);
    }
};
typedef vector<edge_t> vertex_t;
struct graph_t {
    vector<vertex_t> g;

    graph_t() {}

    graph_t(int vertex_count) {
        g.resize(vertex_count);
    }
    graph_t(vector<vertex_t> g) : g(g) {}

    inline void add_edge(int from, int to, double cost) {
        g[from].push_back(edge_t(from, to, cost));
    }

    void dijkstra(int s, vector<int> &min_cost) {
        min_cost.resize(g.size());
        priority_queue< state_t, vector<state_t>, greater<state_t> > q;
        
        fill(min_cost.begin(), min_cost.end(), INF);

        min_cost[s] = 0;
        q.push(state_t(s, 0));

        while (!q.empty()) {
            state_t p = q.top(); q.pop();
            int v = p.v;
            if (min_cost[v] < p.min_cost) continue;
            for (int i = 0; i < g[v].size(); i++) {
                edge_t e = g[v][i];
                if (min_cost[e.to] > min_cost[v] + e.cost)  {
                    min_cost[e.to] = min_cost[v] + e.cost;
                    q.push(state_t(e.to, min_cost[e.to]));
                }
            }
        }
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    graph_t graph(n+1);
    for (int i = 0; i < m; i++) {
        int a, b, c, d;
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        graph.add_edge(a, b, c);
        graph.add_edge(b, a, d);
    }
    int s, g, init_money, tree_cost;
    scanf("%d,%d,%d,%d", &s, &g, &init_money, &tree_cost);
    int reward = init_money - tree_cost;
    vector<int> min_cost;
    graph.dijkstra(s, min_cost);
    reward -= min_cost[g];
    graph.dijkstra(g, min_cost);
    reward -= min_cost[s];
    cout << reward << endl;
    return 0;
}

Measured memory_bytes: 0
A,B,C=map(int,input().split())
if A==5:
    if B==7:
        if C==5:
            print('YES')
        else:
            print('NO')
    elif B==5:
        if C==7:
            print('YES')
        else:
            print('NO')
    else:
        print('NO')
elif A==7:
    if B==C==5:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
int main (void)
{
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if (a<b && b<c) {
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}



Measured memory_bytes: 2040
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] arg) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int L = sc.nextInt();
		double[] P = new double[N];
		int[] T = new int[N];
		int[] V = new int[N];
		for (int i = 0; i < N; ++i) {
			P[i] = sc.nextInt() * 0.01;
			T[i] = sc.nextInt();
			V[i] = sc.nextInt();
		}
		double[][] comb = new double[M + 1][M + 1];
		for (int i = 0; i <= M; ++i) {
			comb[i][0] = comb[i][i] = 1;
		}
		for (int i = 0; i <= M; ++i) {
			for (int j = 1; j < i; ++j) {
				comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
			}
		}
		double[][] time = new double[N][M + 1];
		double[][] prob = new double[N][M + 1];
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j <= M; ++j) {
				time[i][j] = 1. * L / V[i] + j * T[i];
				prob[i][j] = comb[M][j] * Math.pow(P[i], j) * Math.pow(1 - P[i], M - j);
			}
		}
		double EPS = 1e-9;
		for (int i = 0; i < N; ++i) {
			double sum = 0;
			for (int j = 0; j <= M; ++j) {
				double t = time[i][j];
				double p = prob[i][j];
				for (int k = 0; k < N; ++k) {
					if (k == i) continue;
					double win = 1;
					for (int l = 0; l <= M; ++l) {
						if (time[k][l] - EPS > t) break;
						win -= prob[k][l];
					}
					p *= win;
				}
				sum += p;
			}
			System.out.printf("%.8f\n", sum);
		}
	}

}

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

using namespace std;

int main() {
    int n;
    cin >> n;

    set<int> st;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        st.insert(a);
    }
    cout << ((st.size() == n) ? "YES" : "NO") << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> pa;

#define fst first
#define snd second
#define pb push_back

const int maxn=300005,maxm=106;
const double pi=acos(-1.0);
const ll mod=1000000007;
const double eps=1e-6;

int n,m;

int x;

ll cal(ll y)
{
    return y*y*y*y*y;
}
void solve()
{
    ll i,j;
    for(i=0;i<=1000;i++)
    {
        for(j=i;j<=1000;j++)
        {
            if(cal(i)+cal(j)==x)
            {
                printf("%lld %lld\n",i,-j);
                return;
            }
            if(cal(j)-cal(i)==x)
                {
                printf("%lld %lld\n",j,i);
                return;
            }
        }
    }
}

int main()
{
	int i,j,k,l;
	scanf("%d",&x);
	solve();
    return 0;
}


Measured memory_bytes: 3828
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <iomanip>
#include <bits/stdc++.h>
#include <fstream>
#include <map>
using namespace std;
typedef long long ll;
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)


int main(){
  int N,L;
  cin >> N >> L;

  vector<vector<string>> s(N,vector<string>(L));

  REP(i,N){
    cin >> s[i][0];
  }

  sort(s.begin(),s.end());

  REP(i,N){
    cout << s[i][0];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3900
from collections import defaultdict as dd
def find(u,x):
    if u[x]<0:
        return x
    u[x] = find(u,u[x])
    return u[x]

def unite(u,a,b):
    a = find(u,a)
    b = find(u,b)
    if a == b:
        return False
    if u[b] < u[a]:
        a,b = b,a
    u[a] += u[b]
    u[b] = a
    return True
n,k,l = map(int, input().split())
ufr = [-1]*(n+1)
uft = [-1]*(n+1)
for _ in range(k):
    a,b = map(int, input().split())
    unite(ufr,a,b)
for _ in range(l):
    a,b = map(int, input().split())
    unite(uft,a,b)
tot = dd(int)
for i in range(1,n+1):
  tot[(find(ufr,i),find(uft,i))] += 1
print(" ".join([str(tot[(find(ufr,i),find(uft,i))]) for i in range(1,n+1)]))

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

#define REP(i, n) for (int i = 0; i < (int)(n); 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 ALL(v) v.begin(), v.end()

int main() {
  int N;
  int ans;
  cin >> N;
  cout << pow(N,3) << endl;
}


Measured memory_bytes: 256
a,b,c=map(int,input().split())
x=[]
if c>b-a+1:
    c=b-a+1
for i in range(c):
    print(a+i)
    x.append(a+i)
for j in range(c-1,-1,-1):
    if b-j not in set(x):
        print(b-j)
        x.append(b-j)
    else:
        continue


Measured memory_bytes: 3060
a= list(map(int,input().split()))
x= a[0]
y= a[1]
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
if (x in A and y in A) or (x in B and y in B):
    print('Yes')
else:
    print('No')


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

int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::string s;
  std::cin >> s;
  int i = 0;
  int j = s.length() - 1;
  int count = 0;
  while(i < j){
    if(s[i++] != s[j--]) ++count;
  }
  std::cout << count << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;

bool chmax(int &a,int b){
if(a<b){a=b;return 1;}
  return 0;
}


int main(){
  int n;
  cin>>n;
  int abc[100010][3];
  rep(i,n) cin>>abc[i][0]>>abc[i][1]>>abc[i][2];
  
  int dp[100010][3];
  rep(i,n)rep(j,3){dp[i][j]=0;}
  dp[0][0]=abc[0][0];
  dp[0][1]=abc[0][1];
  dp[0][2]=abc[0][2];
  
  for(int i=1;i<n;i++){
    for(int j=0;j<3;j++){
       for(int k=0;k<3;k++){
          if(j==k) continue;
          chmax(dp[i][j],dp[i-1][k]+abc[i][j]);
       }
    }
  }
  
  chmax(dp[n-1][0],dp[n-1][1]);
  chmax(dp[n-1][0],dp[n-1][2]);
  cout<<dp[n-1][0]<<endl;
  
  //rep(i,n) cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<endl;
}


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

using namespace std;

int main(){
  int h, w;
  cin >> h >> w;
  string s[h];
  
  for(int i = 0; i < h; i++){
    cin >> s[i];
  }
  
  for(int i = 0; i < h; i++){
    cout << s[i] << endl;
    cout << s[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using std::swap;
const int mod = 1e9+7;
char str[112345];
int t[112345];
int dp[112345][14];
int main(){
	scanf("%s", str);
	int len = strlen(str);
	for(int i(len - 1), p(1); i >= 0; --i, ++p){
		if(str[i] == '?') t[p] = -1;
		else t[p] = str[i] - '0';
	}
	int lef = 0;
	int rem = 1;
	for(int i(1); i <= len; ++i){
		if(t[i] != -1) lef = (lef + rem*t[i]) % 13;
		rem = rem*10%13;
	}
	rem = 1;
	dp[0][lef] = 1;
	for(int i(1); i <= len; ++i){
		if(t[i] != -1){
			for(int j(0); j < 13; ++j) dp[i][j] = dp[i-1][j];
		}
		else{
			for(int j(0); j <= 9; ++j){
				int k = rem*j%13;
				for(int j(0); j < 13; ++j) dp[i][(j+k)%13] += dp[i-1][j], dp[i][(j+k)%13] %= mod;
			}
		}
		rem = rem*10%13;
	}
	printf("%d\n", dp[len][5]);
	return 0;	
}


Measured memory_bytes: 6784
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  int n,m; cin>>n>>m;
  set<int> s;
  vector<P> a(m);
  bool c=0;
  rep(i,m) cin>>a[i].fs>>a[i].sc;
  
  sort(ALL(a));
  rep(i,m){
    if(a[i].fs==1)
    s.insert(a[i].sc);
    else if(a[i].sc==n){
      if(s.count(a[i].fs)){
        puts("POSSIBLE");
        return 0;
      }
    }
  }

  puts("IMPOSSIBLE");

  return 0;
}


Measured memory_bytes: 6528