akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
mt19937 rng(high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rngll(high_resolution_clock::now().time_since_epoch().count());
template<typename T> T ctmax(T &x, const T &y){ return x = max(x, y); }
template<typename T> T ctmin(T &x, const T &y){ return x = min(x, y); }
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
 
 
int main(){
	cin.tie(0)->sync_with_stdio(0);
	long long a, b, c;
	cin >> a >> b >> c;
	c > a + b && 4 * a * b < (c - a - b) * (c - a - b) ? cout << "Yes" : cout << "No";
	return 0;
}
 
/*
100000000 100000000 400000000
*/
 
////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 256
A=input()
cntg=0
cntp=0
cnt=0
for i in A:
  if i=='g':
    if cntg==cntp:
      cntg+=1
    else:
      cntp+=1
      cnt+=1
  else:
    if cntg==cntp:
      cntg+=1
      cnt-=1
    else:
      cntp+=1
print(cnt)

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}


signed main() {
    //my-code
    int R; cin >> R;
    cout << fixed;
    cout << setprecision(12) << 2*R*1.0*3.1415926535 << endl;

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3788
#include<iostream>
using namespace std;
long long dp[110][10];
const long long res=1000000007;
int mul[10]={1,2,3,5,8,13,21,34};
int main(){
    int h,w,k;
    cin>>h>>w>>k;
    for(int i=0;i>110;i++){
        for(int j=0;j<10;j++){
            dp[i][j]=0;
        }
    }
    dp[0][1]=1;
    long long buf;
    int buf1=1;
    int buf2=1;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(j==1||j==w){
                buf=mul[w-2];
            if(j==1&&w-3>=0)buf2=mul[w-3];
            else buf2=1;
            if(j==w&&w>=3)buf1=mul[w-3];
            else buf1=1;
            }
            else {
                buf=mul[j-2]*mul[w-j-1];
                if(j-3>=0){
                buf1=mul[j-3]*mul[w-j-1];
                }
                else buf1=mul[w-j-1];
                if(w-j-2>=0){
                buf2=mul[w-j-2]*mul[j-2];
                }
                else{
                    buf2=mul[j-2];
                }
            }

            dp[i][j]=dp[i-1][j]*buf+dp[i-1][j-1]*buf1+dp[i-1][j+1]*buf2;
            dp[i][j]=dp[i][j]%res;
        }
    }
    if(w==1)dp[h][k]=1;
    cout<<dp[h][k]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

int main() {
  int N; cin >> N;
  vi d(N); rep(i,N) cin >> d.at(i);

  SORT(d);
  cout << d.at(N/2)-d.at(N/2-1) << endl;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(){
	//freopen("in/0003.txt","r",stdin);
	int n,a,b,c,m;
	int yes;
	scanf("%d",&n);
	while(n-->0){
		scanf("%d %d %d",&a,&b,&c);
		yes=0;
		if(a+b>c && a+c>b && b+c>a && abs(a-b)<c && abs(a-c)<b && abs(c-b)<a){
			if(a>b && a>c){
				yes=a*a==b*b+c*c;
			}
			else if(b>c){
				yes=b*b==a*a+c*c;
			}
			else{
				yes=c*c==a*a+b*b;
			}
		}
		printf("%s\n", yes? "YES":"NO");
	}
	return 0;
}

Measured memory_bytes: 580
# 本番では解けず。
from sys import stdin
import bisect

N = int(stdin.readline())
L = [int(x) for x in stdin.readline().rstrip().split()]

# (1)Lを昇順にソートする
L.sort()

s = 0

for i in range(N-2):
    for j in range(i+1, N-1):

        # (2)Lから2つの辺を固定で選ぶ（L[i]をa L[j]をbとする）
        # この場合、a < b + c, b < a + c はソート済みのため自明。
        # c < a + b が成り立つ棒の個数を調べる
        tmp = L[i] + L[j]

        # (3)Lの中から(2)の和(a+b)、を左に挿入できる場所二分探索で探す
        # つまりL[index - 1] < L[i] + L[j] < L[index] になるindexを探す。

        index = bisect.bisect_left(L, tmp)

        # (4) 固定で選んだ大きい方の辺から(3)で見つけた棒の間にある棒の個数を足す
        # b より右にあり、これより左にあるもの　→　開区間　(L[j], L[index])に含まれる棒は c < a + b を満たすので。
        s += (index - (j+1))

print(s)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int main()
{
    string s;
    long long int i,j,k;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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 (a>b) { a=b; return 1; } return 0; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    sort(A.begin(), A.end());
    ll res = 0;
    REP(i, K) res += A[i];
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>

int main()
{
	int a, b;
	std::cin >> a >> b;
	
	if( a <= 8 and b <= 8 ) {
		std::cout << "Yay!" << std::endl;
	}
	else {
		std::cout << ":(" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

int main() {
	long long Sum = 0;
	int N;
	cin >> N;
	vector<int> Pos;
	Pos.resize(N);
	int prev = 0;
	for (int i = 0; i < N; i++) {
		cin >> Pos[i];
		Sum += abs(prev - Pos[i]);
		prev = Pos[i];
	}
	Sum += abs(Pos[N - 1]);

	for (int i = 0; i < N; i++) {
		long long Cost = Sum;
		if (i == 0) {
			Cost -= abs(Pos[i]);
			Cost -= abs(Pos[i + 1] - Pos[i]);
			Cost += abs(Pos[i + 1]);
		} else 	if (i == N - 1) {
			Cost -= abs(Pos[i - 1] - Pos[i]);
			Cost -= abs(Pos[i]);
			Cost += abs(Pos[i - 1]);
		} else {
			Cost -= abs(Pos[i - 1] - Pos[i]);
			Cost -= abs(Pos[i + 1] - Pos[i]);
			Cost += abs(Pos[i - 1] - Pos[i + 1]);
		}
		cout << Cost << endl;
	}
}

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(void){
    int table[200][200]={{0}};
    int c,r;
    cin >> r >> c;
    for(int i=0; i < r; i++){
        for(int j = 0; j < c; j++){
            cin >> table[i][j];
        }
    }
    for(int i = 0; i < r+1; i++){
        int sum = 0;
        for(int j = 0; j < c; j++){
            sum += table[i][j];
        }
        table[i][c] = sum;
    }
    for(int j = 0; j < c+1; j++){
        int sum = 0;
        for(int i = 0; i < r; i++){
            sum += table[i][j];
        }
        table[r][j] = sum;
    }
    for(int i = 0; i < r+1; i++){
        for(int j = 0; j < c; j++){
            cout << table[i][j] << " ";
        }
        cout << table[i][c] << endl;
    }
}



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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i < (n)i++)
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define int long long
#define abs(a) llabs(a)
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

signed main()
{

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

   string s, v;
   int cnt = 0;
   cin >> s;

   v = s;

   re(v);

   rep(i, s.size())
   {
      if (s[i] != v[i])
         cnt++;
   }
   cout << cnt / 2 << '\n';
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i;
	long long a[7], ans;
	for (i = 0; i < 7; i++) scanf("%lld", &(a[i]));
	if (a[0] % 2 + a[3] % 2 + a[4] % 2 >= 2 && a[0] > 0 && a[3] > 0 && a[4] > 0) {
		ans = 3;
		a[0]--;
		a[3]--;
		a[4]--;
	} else ans = 0;
	ans += a[0] / 2 * 2 + a[1] + a[3] / 2 * 2 + a[4] / 2 * 2;
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

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

int main() {
  int a, b; string s; cin >> a >> b >> s;
  string ans = "Yes";
  if (s.at(a) != '-') ans = "No";
  for (char e: s.substr(0, a)) if (!('0' <= e && e <= '9')) ans = "No";
  for (char e: s.substr(s.size() - b, b)) if (!('0' <= e && e <= '9')) ans = "No";
  cout << ans << endl;
}

Measured memory_bytes: 256
def cal(n):
    for i in range(2,int(n**0.5) + 1 ):
        if n%i == 0:
            return False
        
    return True


N=int(input())

i=0
while(True):
    if cal(N+i):
        print(N+i)
        exit()
    else:
        i+=1



Measured memory_bytes: 40132
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdlib.h>
using namespace std;

#define INF 1e9
#define PI 3.141592653589793238
typedef long long ll;

int main() {
    int n; cin>>n;
    vector<int> v(n);
    for(int i=0; i<n; i++)cin>>v[i];
    sort(v.begin(), v.end());

    int ans=0;
    for(int i=0; i<n; i++){
        for(int j=0; j<i; j++){
            for(int k=0; k<j; k++){
                if(v[i]!=v[j] && v[j]!=v[k] && v[i]<v[k]+v[j]) ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(void) {
  int n, k;
  cin>>n>>k;
  int ans = 0;
  fr(i,n) {
    int h;cin>>h;
    if(h >= k) ans++;
  }
 
  cout << ans<< endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
const int N = 100005;
using namespace std;
typedef long long ll;
int a[N];
int main()
{
 
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    ll imax=2,imin=2;
 
    for(int i=n;i>=1&&imax>=imin;i--){
        if(imin%a[i]!=0)
            imin=imin/a[i]*a[i]+a[i]; //最小 计算机乘除法处理求出a[i]的整数倍
        imax=(imax/a[i]+1)*a[i]-1;    //最大 
    }
    if(imax>imin)
        printf("%lld %lld\n",imin,imax);
    else
        printf("-1\n");
    return 0;
}

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

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;

typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

typedef vector<double> VD;
typedef vector<VD> VVD;

typedef vector<string> VS;
typedef vector<VS> VVS;

typedef vector<bool> VB;
typedef vector<VB> VVB;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define fst first
#define snd second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(), (x).end()
#define RANGE(xx,y,mx,my) (0<=(x)&&0<=(y) && (x)<(mx) && y<(my))
#define REP(i, init, N) for(int i = (init); i < (int)(N); i++)

const int INF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(void) {
    int N;
    cin >> N;
    VVI es(N, VI(N));
    REP(i, 0, N) REP(j, 0, N) {
        cin >> es[i][j];
    }

    LL ans = 0;
    REP(i, 0, N) REP(j, i + 1, N) {
        ans += (LL)min(es[i][j], es[j][i]);
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1248
import fractions
a, b, c, d = map(int, input().split())
g = fractions.gcd(c, d)
lcm = c*d//g
A = (a-1) - (a-1)//c - (a-1)//d + (a-1)//lcm
B = b - b//c - b//d + b//lcm
print(B-A)


Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N; ll mod;
ll dp[6010][2010];

void solve() {
	cin >> N >> mod;
	dp[0][0] = 1;
	rep(i, 0, 3 * N) {
		rep(j, 0, N + 1) {
			if(!dp[i][j]) continue;
			ADD(dp[i + 1][j], dp[i][j] % mod);
			ADD(dp[i + 2][j + 1], dp[i][j] * (i + 1) % mod);
			ADD(dp[i + 3][j + 1], dp[i][j] * (i + 1) % mod * (i + 2) % mod);
		}
	}
	// rep(i, 0, 3 * N + 1) {
	// 	rep(j, 0, N + 1) {
	// 		debug(i, j, dp[i][j]);
	// 	}
	// }
	ll res = 0;
	rep(j, 0, N + 1) ADD(res, dp[3 * N][j]);
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



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

int main() {
    int N;
    cin >> N;
    vl A(N);
    rep(i, N) {
        cin >> A[i];
    }

    ll cnt = 0;
    int r = 0;
    ll sum = 0;
    for (int l = 0; l < N; l++) {
        while (r < N && ((sum + A[r]) == (sum ^ A[r]))) {
            sum += A[r];
            r++;
        }

        // rは上限+1になっているので-1している。l自身も含めるため+1している
        cnt += (r - 1) - l + 1;

        if (r == l) {
            r++;
        } else {
            sum -= A[l];
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 4848
#include <iostream>
#include <cmath>
#include <utility>

void koch(int d, std::pair<double, double> p1, std::pair<double, double> p2){
	if(d == 0) return;
	std::pair<double, double> s;
	s.first = (2*p1.first+1*p2.first)/3.0;
	s.second = (2*p1.second+1*p2.second)/3.0;
	std::pair<double, double> t;
	t.first = (1*p1.first+2*p2.first)/3.0;
	t.second = (1*p1.second+2*p2.second)/3.0;
	std::pair<double, double> u;
	u.first = (t.first-s.first)/2-sqrt(3.0)*(t.second-s.second)/2+s.first;
	u.second = sqrt(3.0)*(t.first-s.first)/2+(t.second-s.second)/2+s.second;
	koch(d-1, p1, s);
	std::cout << s.first << " " << s.second << std::endl;
	koch(d-1, s, u);
	std::cout << u.first << " " << u.second << std::endl;
	koch(d-1, u, t);
	std::cout << t.first << " " << t.second << std::endl;
	koch(d-1, t, p2);
}

int main(){
	int n;
	std::cin >> n;
	std::cout << 0.0 <<  " " << 0.0 << std::endl;
	std::pair<double, double> p1(0.0, 0.0);
	std::pair<double, double> p2(100.0, 0.0);
	koch(n, p1, p2);
	std::cout << 100.0 << " " << 0.0 << std::endl;
	return 0;
}

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


int main()
{
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	int N=s.size();
	vector<int> v(N+1);
	map<int,int> m;
	v[0]=0;
	const int MOD=2019;
	int x=1;
	v[0]=0;
	m[0]+=1;
	rep(i,N)
	{
		v[i+1]=x*(s[i]-'0')+v[i];
		v[i+1]%=MOD;
		m[v[i+1]]++;
		x*=10;
		x%=MOD;
	}
	ll ans=0;
	for(auto p : m)
	{
		ans+=p.second*(p.second-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;


int main(){
	
	long n;
	cin >> n;
	
	long a[n];
	for(int i=0;i<n;i++) cin >> a[i];
	
	sort(a,a+n);
	long dif = a[n-1]-a[0];
	
	cout << dif << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(x - a) > abs(x - b))
	{
		cout << "B" << endl;
	}
	else
	{
		cout << "A" << endl;
	}
}

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

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

int main(){
 
    int n;
    cin >> n;
 
    for(int i=1; i<=n;i++){
        if( i%3==0 ){
            cout << " " << i;
        }else{
			int x=i;
            while(x){
                if( x% 10==3 ){
                    cout << " " << i;
                    break;
                }
				x /= 10;
	    }
        }
    }
    cout << "\n";
 
    return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)

int main(void){

  //入力
  int N;
  cin >> N;
  
  //各和の合計
  int sum = 0;
  int tmp = N;
  while(tmp > 0){
    sum += tmp%10;
    tmp /= 10;
  }
  
  if(N%sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

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

struct Articulation_Points{
  int n,t;
  vector<int>h,f;
  vector<bool> mark,ans;
  vector<vector<int> >G;
  Articulation_Points(int sz):G(sz),n(sz),mark(sz),ans(sz),h(sz),f(sz){}
  void add(int a,int b){
    G[a].push_back(b);
    G[b].push_back(a);
  }
  void dfs(int v){
    mark[v]=true;
    f[v]=h[v];
    for(int i=0;i<G[v].size();i++){
      int u=G[v][i];
      if(!mark[u]){
        h[u]=h[v]+1;
        dfs(u);
        if(v==0) t++;
        if(v!=0 && f[u]>=h[v])
          ans[v]=true;
        f[v]=min(f[v],f[u]);
      }
      else if(h[u]<h[v]-1) f[v]=min(f[v],h[u]);
    }
  }
  void build(){
    fill(mark.begin(),mark.end(),0);
    fill(ans.begin(),ans.end(),0);
    fill(h.begin(),h.end(),0);
    fill(f.begin(),f.end(),0);
    t=0;
    dfs(0);
    if(t>1)ans[0]=true;
  }
  bool ANS(int x){
    return ans[x];
  }
};
 
int main(){
  int n,m;
  cin>>n>>m;
  Articulation_Points A(n);
  for(int i=0;i<m;i++){
    int v,u;
    cin>>v>>u;
    A.add(v,u);
  }
  A.build();
  for(int i=0;i<n;i++)
    if(A.ANS(i)) cout<<i<<endl;
}



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

typedef pair<long long, long long> ii;


long long mod = 1000000007;

int main(){
	//freopen("i.txt","r",stdin);
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	for(int i = 0;i < s.length();i++){
		char c = s[i];
		c += n;
		if(c > 'Z') c -= 26;
		cout << c;
	}
	
	
	
	
	
}


Measured memory_bytes: 256
// edpc_l
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (numeric_limits<ll>::max())
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;


int N;
vector<ll> A;
vector<vector<ll>> memo;

ll dp(int l, int r){

    if (l == r) return N & 1 ? A[l] : -A[l];
    if (l+1 == r) return N & 1 ? min(A[l] - A[r], A[r] - A[l]) : max(A[l] - A[r], A[r] - A[l]);

    if (memo[l][r] != INF) return memo[l][r];

    ll a = A[l] + min(-A[l+1] + dp(l+2, r), -A[r] + dp(l+1, r-1));
    ll b = A[r] + min(-A[l] + dp(l+1, r-1), -A[r-1] + dp(l, r-2));
    ll ret = max(a, b);

    return memo[l][r] = ret;
}


int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif


    cin >> N;
    A.assign(N, 0);
    REP(i, N) cin >> A[i];

    memo.assign(N, vector<ll>(N, INF));

    ll ret = dp(0, N-1);
    print(ret);

    return 0;
}


Measured memory_bytes: 70912
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=998244353;
const ll MAX_N=500010;
const ll INF=100100100100100;

struct union_find {
	ll par[MAX_N];
	ll Size[MAX_N];
	union_find(ll n) {
		for (int i = 0; i < n; i++) {
			par[i] = i;
			Size[i] = 1;
		}
	}
	ll root(ll x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	bool same(ll x, ll y) {
		return root(x) == root(y);
	}
	void unite(ll x, ll y) {
		if (same(x, y))return;
		Size[root(x)] += Size[root(y)];
		par[root(y)] = root(x);
	}
};

int main(){
    ll n,m;
    cin>>n>>m;
    struct union_find U(n);
    while(m){
        ll a,b,z;
        cin>>a>>b>>z;
        a--; b--;
        U.unite(a,b);
        m--;
    }
    ll ans=0;
    vector<bool> f(n,true);
    for(int i=0;i<n;i++){
        if(f[U.root(i)]){
            ans++;
            f[U.root(i)]=false;
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 4968
def calc():
  n=int(input())
  arr=[]
  check='abcdefghijklmnopqrstuvwxyz'
  while n!=0:
    n-=1
    arr.append(check[n%26])
    n//=26
  arr=arr[::-1]
  print(''.join(map(str,arr)))
  
calc()

Measured memory_bytes: 61696
#include <iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
int main(){
  int n,ans=0;
  cin>>n;
  int jun[n];
  rep(i,n)cin>>jun[i];
  rep(k,n)jun[k]--;
  int sei[n];
  rep(j,n){
    sei[jun[j]]=j;
  }
  rep(l,n)cout<<sei[l]+1<<endl;
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector <int> p(N);
    rep(i, N){
        cin >> p[i];
    }
    int max = *max_element(p.begin(),p.end());
    int P =0;
    rep(i,N){
        P += p[i];
    }
    P -= max;
    cout << P + (max/2) << endl;
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    int N;
    cin >> N;

    vector<vector<pair<int, int>>> statements(N);
    REP(n, N) {
        int a;
        cin >> a;
        REP(i, a) {
            int x, y;
            cin >> x >> y;
            --x;
            statements[n].pb(mp(x, y));
        }
    }

    int ans = 0;
    REP(i, 1 << N) {
        bool ok = true;

        // bitパターンから正直者・不親切を生成
        // 1: 正直者  0: 不親切
        vector<int> truth(N);
        int man = 0;
        REP(j, N) {
            if ((1 << j) & i) {
                truth[j] = 1;
                ++man;
            }
            else {
                truth[j] = 0;
            }
        }

        // 正直者の証言に矛盾がないか調べる
        REP(j, N) {
            if (truth[j]) {
                for(auto xy: statements[j]) {
                    auto x = xy.first;
                    auto y = xy.second;
                    if (y != truth[x]) {
                        ok = false;
                        break;
                    }
                }
            }
        }
        // 証言に矛盾が出た場合は終わり
        if (!ok) continue;

        ans = max(ans, man);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#define  ll         long long
#define  pb         push_back
#define  ff         first
#define  ss         second
#define  srt(v)     sort(v.begin(),v.end())

#define  inp(a)     scanf("%d",&a)
#define  lnp(a)     scanf("%lld",&a)
#define  inpp(a,b)  scanf("%d %d",&a,&b)
#define  lnpp(a,b)  scanf("%lld %lld",&a,&b)

#define  pnt(a)     printf("%d",a)
#define  pntl(a)    printf("%lld",a)
#define  mxn        1500
#define  MOD        1000000007
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

int n,m;
char ch[mxn][mxn];
int dp[mxn][mxn];
bool check(ll x,ll y)
{
    if(x >= 1 && x <= n && y >= 1 && y <= m){
        if(ch[x][y] == '.') return true;
    }
    return false;
}
ll solve(ll i,ll j)
{
    //cout << i <<" " << j << endl;
    if(ch[i][j] == '#') return 0;
    if(i  < 1 || i > n || j < 1 || j > m) return 0;
    if(i == n && j == m) return 1;
    if(dp[i][j] != -1) return dp[i][j];
    ll ret = 0;
    ret = (ret % MOD + solve(i,j+1) % MOD) % MOD;
    ret = (ret % MOD + solve(i+1,j) % MOD) % MOD;
    dp[i][j] = ret;
    return dp[i][j];
}

int main()
{
    cin >> n >> m;
    for(int i = 1;i <= n;i++){
        string s;cin >> s;
        for(int j = 0;j < m;j++){
            ch[i][j+1] = s[j];
        }
    }
    memset(dp,-1,sizeof dp);
    ll res = solve(1,1);
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }
 
int main(){
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> p(n);
    for (int i = 0; i < n; i++){
        cin >> p[i];
    }

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

    int one, two, three;
    one = two = three = 0;
    for (int i = 0; i < n; i++){
        if(p[i] <= a){
            one++;
        }else if (p[i] > a & p[i] <= b){
            two++;
        }else if(p[i] > b){
            three++;
        }
    }

    cout << min({one, two, three}) << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

d = ' '
n, q = map(int, input().split(d))

tree = [[] for _ in range(n)]

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

count = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split(d))
    p -= 1
    count[p] += x

ret = [0 for _ in range(n)]
q = deque(maxlen=n)
q.append((0, 0))
while len(q) > 0:
    f, c = q.popleft()
    ret[c] = count[c] + ret[f]
    for n in tree[c]:
        if n != f:
            q.append((c, n))

print(*ret)


Measured memory_bytes: 108748
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;

signed main() {
  string S;
  cin >> S;
  for( int i = 0; i < S.size()-1; i++ ){
    if( S.at(i) == S.at(i+1) ){
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
  }
  
  if( S.size() > 2 ){
    for( int i = 0; i < S.size()-2; i++ ){
      if( S.at(i) == S.at(i+2) ){
        cout << i+1 << " " << i+3 << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << endl;

}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  long long sup = 0;
  long long sub = 0;
  int ret = 0;
  vector<int> dif;
  for (int i = 0; i < n; i++) {
    if (a[i] > b[i]) {
      sup += a[i] - b[i];
      dif.push_back(a[i] - b[i]);
    } else if (b[i] > a[i]) {
      sub += b[i] - a[i];
      ret++;
    }
  }
  if (sup < sub) {
    cout << -1 << '\n';
    return 0;
  }
  sort(dif.begin(), dif.end());
  reverse(dif.begin(), dif.end());
  for (int d : dif) {
    if (sub <= 0) {
      cout << ret << '\n';
      return 0;
    }
    sub -= d;
    ret++;
  }
  cout << ret << '\n';
  return 0;
}

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

def main():
    H, W = map(int, input().split())
    s = [input().strip() for i in range(H)]

    ans = [[0] * W for i in range(H)]
    direction = [
        [-1, -1], [0, -1], [1, -1],
        [-1, 0],           [1, 0],
        [-1, 1],  [0, 1],  [1, 1]
    ]
    for y in range(H):
        for x in range(W):
            if s[y][x] == ".":
                for dx, dy in direction:
                    tx, ty = x+dx, y+dy
                    if 0 <= tx and tx < W and 0 <= ty and ty < H:
                        if s[ty][tx] == "#":
                            ans[y][x] += 1
    for y in range(H):
        for x in range(W):
            if s[y][x] == "#":
                print("#", end="")
            else:
                print(ans[y][x], end="")
        print()


if __name__ == "__main__":
    main()

Measured memory_bytes: 3444
#include<stdio.h>

int main(){
	int before[51],after[51],n,r,p,c,i,j;
	
	while(0<=scanf("%d%d",&n,&r)){
		
		if(n==0 && r==0){
			break;
		}
		for(i=0;i<=50;i++){
			before[i]=i;
			after[i]=i;
		}
		
		for(j=0;j<r;j++){
			scanf("%d%d",&p,&c);
			//shita to ue
			for(i=n-c-p+2;i<=n-p+1;i++){
				after[i+p-1]=before[i];
			}
			//ue to shita
			for(i=n-c+2-p;i<=n-c;i++){
				after[i]=before[i+c];
			}
			
			for(i=1;i<=n;i++){
				before[i]=after[i];
			}
			
			// for(i=1;i<=n;i++){
				// printf("%d ",before[i]);
			// }
			// printf("\n%d %d\n",p,c);
			

		}
		printf("%d\n",after[n]);
	}
	return 0;
}

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

int ans;

struct UF{
  vector<int> par; //親
  vector<int> depth; //木の深さ(木を均して計算の高速化)
  vector<int> size; //集合の大きさ

  void init(int n){
    par.resize(n);
    depth.resize(n,0);
    size.resize(n,1);
    for(int i = 0; i < n; i++){
      par[i] = i;
    }
  }

  //木の根を求める
  int root(int x){
    if(par[x] == x){
      return x;
    }
    else {
      return par[x] = root(par[x]);
    }
  }

  //xとyの属する集合を併合
  void unite(int x,int y){
    x = root(x);
    y = root(y);
    if(x == y) return;

    ans -= size[x]*size[y];

    if(depth[x] < depth[y]) swap(x,y);
    par[y] = x;
    if(depth[x] == depth[y]) depth[x]++;
    size[x] += size[y];
    //size[y] = size[x];
  }
}uf;

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

  int n,m; cin >> n >> m;
  vector< pair<int,int> > v(m);
  for(int i = 0; i < m; i++){
    cin >> v[i].first >> v[i].second;
  }
  uf.init(n+1);

  vector<int> out(m);
  ans = n*(n-1)/2;
  for(int i = m-1; i >= 0; i--){
    out[i] = ans;
    uf.unite(v[i].first,v[i].second);
  }

  for(int i : out){
    cout << i << endl;
  }

  return 0;
}


Measured memory_bytes: 6016
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100006
using namespace std;
char str[MAXN];
int main()
{
	while(~scanf("%s",str))
	{
		int len=strlen(str);
		int num=0;
		for(int i=1;i<len;i++)
		{
			if(str[i]!=str[i-1])
				num++;	
		}
		printf("%d\n",num);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n = s.size(), ans = 0;
  for (int i = 0; i < n/2; i++) {
    if (s[i] != s[n-1-i]) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define ll long long
#define mo 998244353
#define maxi 1000010
#define N 1000000
using namespace std;
ll ans,jie[maxi],nj[maxi],n,k,b;
ll po(ll x,ll y){ll z=1;while (y){if (y%2)z=x*z%mo;x=x*x%mo;y/=2;}return z;}
ll C(ll x,ll y,ll fh){ans=(ans+(fh*jie[x]*nj[y]%mo)*nj[x-y])%mo;} 
int main(){
	jie[0]=1;for (int i=1;i<=N;i++)jie[i]=jie[i-1]*i%mo;
	nj[N]=po(jie[N],mo-2);for (int i=N-1;i>=0;i--)nj[i]=nj[i+1]*(i+1)%mo;
	cin>>n>>k;
	for (int r=0;r<=k;r++){
		b=k-r;
		if (b==r&&r>=n)C(r+r-1,r,1),C(r+r-1,n-2,-1);
		if (r>b&&r>=n){C(b+r,r,1);if (r-b<n)C(b+r,n-r+b-1,-1);}
	}
	cout<<(ans+mo)%mo<<endl;
	return 0;
}

Measured memory_bytes: 15872
H, W = map(int, input().split())
S = [input() for i in range(H)]
dd = ((0, -1), (-1, 0), (0, 1), (1, 0))
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            continue
        for dx, dy in dd:
            nx = j + dx; ny = i + dy
            if 0 <= nx < W and 0 <= ny < H:
                if S[ny][nx] == '#':
                    break
        else:
            print("No")
            exit(0)
print("Yes")



Measured memory_bytes: 3064
// 28/03/2020  @ 17:56:56
// *****************************************************************
// *****************************************************************
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <stack>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
// *****************************************************************
// *****************************************************************
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fr(i,n) for(llu i=0;i<n;i++)
#define fl(j,a,b) for(llu j=a;j<=b;j++)
#define pi 3.14159265
#define mod 1e9+7
#define MID(a,b) ((a + b) >> 1)
#define MAX(a,b) ((a) > (b) ? (a): (b))
#define MIN(a,b) ((a) < (b) ? (a) :(b))
// *****************************************************************
// *****************************************************************
typedef long long unsigned int llu;
typedef long long int ll;
// *****************************************************************
// *****************************************************************
using namespace std;
// *****************************************************************
// *****************************************************************

                   // Dream it. Wish it. Do it.

                         // tannatsri //

              // Without tact you can learn nothing.

// *****************************************************************
// *****************************************************************
template< class Iterator,  class T>
// template<typename TT>
// *****************************************************************
// *****************************************************************
Iterator search(Iterator start, Iterator end, T key) {
    while(start != end) {
        if(*start == key){
            return start;
        }
        ++start;
    }
    return end;
}
bool rev(int a, int b) {
    return a > b;
}
// *****************************************************************
// *****************************************************************
int main() {
    IOS;
    // #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    // *****************************************************************
    // *****************************************************************
    llu n;
    cin >> n;
    llu x = (n/500) * 1000 + ((n%500)/5 * 5);
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
	int n,sum=0,d,e,f;
	vector<int> v1;
	vector<int>::iterator it;
	cin>>n;
	int a[n],b[n],c[n];
	for(int i=0;i<n;i++)
    cin>>a[i];
    for(int i=0;i<n;i++)
    cin>>b[i];
    for(int i=0;i<n-1;i++)
    cin>>c[i];
    for(int i=0;i<n;i++)
    {
    	d=a[i];
    	--d;
    	sum=0;
    	if(a[i+1]==++a[i])
    	{
    		sum=b[d]+c[d];
    		v1.push_back(sum);
		}
		else
		{sum=b[d];
		v1.push_back(sum); }    	
	}
	sum=0;
	for(it=v1.begin();it!=v1.end();it++)
	sum+=*it;
	cout<<sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pii pair<int, int>;
#define ss second
#define ff first
#define all(x) ((x).begin(), (x).end())

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;
const ll oo = 1 << 31;


int main(){

    ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    if (n == m) cout << "Draw" << endl;
    else if (n == 1 || (n > m and m != 1)) cout << "Alice" << endl;
    else cout << "Bob" << endl;
    return 0;
}

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

int main(void){
  int A, B, C;
  int cnt = 0;
  cin >> A >> B >> C;
  if(A == B)
    cnt++;
  if(B == C)
    cnt++;
  if(C == A)
    cnt++;
  if(cnt == 1) cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 3656
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    x,y,z = map(int, input().split())
    print(z, x, y)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3700
s = str(input())
n = int(len(s))
inversion_s = s[::-1]
palindrome_0 = ""

for _ in range(int((n-1)/2)):
    palindrome_0 += s[_]

inversion_palindrome_0 = palindrome_0[::-1]

palindrome_1 = ""
for _ in range(int((n+3)/2) - 1, n):
    palindrome_1 += s[_]

inversion_palindrome_1 = palindrome_1[::-1]

if s == inversion_s:
    if palindrome_0 == inversion_palindrome_0:
        if palindrome_1 == inversion_palindrome_1:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define maxn 100001
#define pb push_back
using namespace std;

int n,m,ans;
int dp[maxn];
vector<int> adj[maxn];

int dfs(int node) {
	if(dp[node])
		return dp[node];
	for( int i = 0 ; i < (int) adj[node].size() ; i++ )
		dp[node] = max( dp[node] , dfs( adj[node][i] ) );
	return ++dp[node];
}

int main() {
	scanf("%d%d",&n,&m);
	for( int i = 0 ; i < m ; i++ ) {
		int x,y;
		scanf("%d%d",&x,&y);
		adj[x].pb(y);
	}
	for( int i = 1 ; i <= n ; i++ )
		ans = max( ans , dfs(i) );
	printf("%d\n",ans-1);
	return 0;
}


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

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}

int main(){    
    int a ;
    cin >> a ;
    cout << (a+(a*a)+(a*a*a)) << endl ;
}


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

int main(void) {
    int a, b, h, i;
    scanf("%d%d", &a, &b);

    h = 0;
    for(i=1;i<b-a;i++) {
        h += i;
    }
    printf("%d\n", h-a);

    return 0;
}

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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    ll n; cin >> n;
    vector<bool> a(1000000000, false);
    ll in;
    rep(i, n){
        cin >> in;
        if(a[in]){
            cout << "NO" << endl;
            return 0;
        }
        else{
            a[in] = true;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 122368
open System
let readInt () = stdin.ReadLine() |> int
let readIntArray () = stdin.ReadLine().Split(' ') |> Array.map int

let [| N; Y |] = readIntArray ()

let showResult (a, b, c) = printfn "%d %d %d" a b c

[ for i in [0..N] do
    for j in [0..(N - i)] do
      yield (i , j, N - i - j)]
|> Seq.tryFind (fun (a, b, c) -> a * 10000 + b * 5000 + c * 1000 = Y)
|> (fun opt -> if Option.isSome opt then Option.get opt else (-1, -1, -1))
|> showResult 


Measured memory_bytes: 148252
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;


public class Main{
	 public static void main(String[] args){
	   Scanner sc = new Scanner(System.in);
	  int n = sc.nextInt();
	  double[] v = new double[n];
	  for(int i = 0; i < n; i++) {
		  v[i] = sc.nextInt();
	  }
	  Arrays.sort(v);
	  double sum = (v[0]+v[1])/2; 
	  for(int i = 2; i < n; i++) {
		  sum = (sum+v[i])/2;
	  }
	  System.out.println(sum);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstdlib>
#include<stack>
using namespace std;

int main () {
        stack<int> S;
        int a, b, x;
        string s;

        while( cin >>  s ) {
                if (s[0] == '+') {
                        a = S.top(); S.pop();
                        b = S.top(); S.pop();
                        S.push(a+b);
                } else if ( s[0] == '-') {
                        b = S.top(); S.pop();
                        a = S.top(); S.pop();
                        S.push(a-b);
                } else if ( s[0] == '*') {
                        a = S.top(); S.pop();
                        b = S.top(); S.pop();
                        S.push(a*b);
                } else {
                        S.push(atoi(s.c_str()));
                }
        }
        cout << S.top() << endl;
        return 0;
}


Measured memory_bytes: 3180
#include<stdio.h>

int main(void)
{
    char a;

    scanf("%c",&a);
         if (a=='A') printf("T\n");
    else if (a=='C') printf("G\n");
    else if (a=='G') printf("C\n");
    else if (a=='T') printf("A\n");
    return 0;
}


Measured memory_bytes: 128