akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	string s;
	cin>>s;
	ll a = 0, b = 0, c = 0, mul = 1;
	fore(i, 0, s.size())
	{
		if(s[i] == 'A')
			a = (a + mul) % MOD;
		if(s[i] == 'B')
			b = (b + a) % MOD;
		if(s[i] == 'C')
			c = (c + b) % MOD;
		if(s[i] == '?')
		{
			c = (3*c + b) % MOD;
			b = (3*b + a) % MOD;
			a = (3*a +mul)%MOD;
			mul = (mul * 3) % MOD;
		}
		//cout<<a<<' '<<b<<' '<<c<<'\n';
	}
	cout<<c<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 512
D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
M[7][7][7];main(n,m,p,I,x,y,i,j,k,c,d,z){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,0,sizeof(M)),c=1,I=0;I<p;c*=-1){
		scanf("%d%d",&x,&y),x--,y--,I++;
		for(i=0;;i++)if(!M[x][y][i]){M[x][y][i]=c;break;}
		for(i=0;i<n;i++)for(j=0;j<n;j++)for(k=0;k<n;k++)for(d=0;d<13;d++)
			if(0<=i+D[d][0]*(m-1)&&i+D[d][0]*(m-1)<n&&0<=j+D[d][1]*(m-1)&&j+D[d][1]*(m-1)<n&&0<=k+D[d][2]*(m-1)&&k+D[d][2]*(m-1)<n){
				for(z=0;z<m;z++)if(M[i+D[d][0]*z][j+D[d][1]*z][k+D[d][2]*z]!=c)break;
				if(z==m){printf("%s %d\n",c==1?"Black":"White",I);goto next;}
			}
	}
	puts("Draw");
next:
	for(;I<p;I++)scanf("%d%d",&x,&y);
}exit(0);}

Measured memory_bytes: 612
#include <iostream>
#include <string>
#include <unordered_map>

using namespace std;

int main () {
  int n;
  cin >> n;
  while (n > 0) {
    unordered_map<string, string> map;
    for (int i = 0; i < n; i++) {
      string a, b;
      cin >> a >> b;
      map.emplace(a, b);
    }
    
    cin >> n;
    for (int i = 0; i < n; i++) {
      string a;
      cin >> a;
      if (map.find(a) != map.end()) {
        cout << map.at(a);
      } else {
        cout << a;
      }
    }
    cout << endl;
    cin >> n;
  }
  return 0;
}

Measured memory_bytes: 3088
#include <iostream>
#include <vector>
using namespace std;
 
struct st { int from, to; };
vector<st> E;
 
int main() {
    int m, n, x, y;
    cin >> m >> n;
 
    int c[21] = {};
    for (int i=0; i<n; ++i) {
        cin >> x >> y;
        E.push_back((st){x, y});
        c[y] ++;
    }
 
    for (int i=0; i<m; ++i) {
        for (int j=1; j<=m; ++j) {
            if (c[j] == 0) {
                cout << j << endl;
                c[j] = 1e8;
                for (int k=0; k<n; ++k) {
                    c[E[k].to] -= (E[k].from == j);
                }
                break;
            }
        }
    }
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


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

    if(s<="2019/04/30")cout<<"Heisei"<<endl;
    else cout<<"TBD"<<endl;
    return 0;
}


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

ll sum = 0, N, X;
vector<vector<ll>> A(100010);
vector<ll> Ru(100010, 0);

bool solve(ll a) {
	//a個選んだ時の結果
	ll p, q, cnt = 0, ans = 0;
	p = a / X;
	q = a % X;
	for (int i = 0;i < N;i++) {
		if (i > p)
			ans = Ru[p];
		else
			ans = Ru[p + 1] - A[i][0];

		if (A[i][1] > q) {
			//lowにする
			ans += q * A[i][2];
		}
		else {
			ans += q * A[i][3] - A[i][4];
		}
		cnt = max(cnt, ans);
	}
	return (cnt >= sum);
}

ll binary(ll ng, ll ok) {
	if (ng + 1 == ok)return ok;
	ll mid = (ng + ok) / 2;
	if (solve(mid)) {
		return binary(ng, mid);
	}
	else {
		return binary(mid, ok);
	}
}

int main() {
	ll b, l, u;
	cin >> N >> X;

	for (int i = 0;i < N;i++) {
		cin >> b >> l >> u;
		sum += b * l;
		A[i] = { u*X - (u - l)*b,b,l,u,(u - l)*b };
	}
	sort(all(A));
	reverse(all(A));
	for (int i = 1;i <= N;i++) {
		Ru[i] = Ru[i - 1] + A[i - 1][0];
	}
	cout << binary(-1, N*X) << endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

const int MAX = 510000;
const int MOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    COMinit();
	long long n,m,k,ans=0,tans;
	cin>>n>>m>>k;
	vector<long long>mm(n);
	mm[n-1]=m;
	for(int i=n-1;i>0;i--){
	    mm[i-1]=(mm[i]*(m-1))%MOD;
	}
	rep(i,k+1){
	    tans=(mm[i]*COM(n-1,i))%MOD;
	    ans+=tans;
	    ans%=MOD;
	}
	cout<<ans;
	return 0;
}


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

const int offset=160*(80+80);
bool dp[80][80][offset*2+1];

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

int main()
{
   int H,W; cin>>H>>W;
   vector<vector<int>> a,b;
   a=b=vector<vector<int>>(H,vector<int>(W));

   for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin>>a[i][j];
   for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin>>b[i][j];

   dp[0][0][a[0][0]-b[0][0]+offset]=true;
   dp[0][0][b[0][0]-a[0][0]+offset]=true;
   for(int i=0;i<H;i++) for(int j=0;j<W;j++){
      for(int k=-160*(i+j+1);k<=160*(i+j+1);k++) if(dp[i][j][k+offset]){
         for(int l=0;l<2;l++){
            int y=i+dy[l]; int x=j+dx[l];
            if(y<H and x<W){
               dp[y][x][k+a[y][x]-b[y][x]+offset]=true;
               dp[y][x][k+b[y][x]-a[y][x]+offset]=true;
            }
         }
      }
   }
   int ans=1e9;
   for(int i=-160*(H+W-2);i<=160*(H+W-2);i++) if(dp[H-1][W-1][i+offset]) ans=min(ans,abs(i));
   cout<<ans<<endl;
   return 0;
}


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

using namespace std;

int main() {
    long long n, m;
    cin >> n >> m;

    int ret = 1;
    for (int i = 1; i * i <= m; i++) {
        if (m % i == 0) {
            if ((n - 1) * i < m) {
                int last = m - (n - 1) * i;
                ret = max(ret, __gcd(i, last));
            }
            if ((n - 1) * (m / i) < m) {
                int last = m - (n - 1) * (m / i);
                ret = max(ret, __gcd((int) m / i, last));
            }
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (size_t i = 0; i <= n; i++) if(GetDigit(i)%2 == 1) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3884
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main () {
  int n;
  cin >> n;
  int r[n]; 
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  int maxv = -1000000001;
  int minv = r[0];

  for (int i = 1; i < n; i++) {
    maxv = max (maxv, r[i] - minv);
    minv = min (minv, r[i]);
  }
  cout << maxv << endl;
  return 0;
}

Measured memory_bytes: 3876
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdlib>
using namespace std;

typedef pair<int, int> P;
const int INF = 1<<24;
const int N = 5;


vector<P> V[N+2];
vector<int> T[N+2];

int dist(P a, P b) {
  return abs(a.first-b.first) + abs(a.second-b.second);
}

int calc(int st) {
  for(int i = 0; i < N+2; ++i) T[i].clear();
  T[0].push_back(0);

  int bp = 0;
  for(int i = 1; i <= N; ++i) {
    int p;
    if(i == N) p = N+1;
    else       p = (st-1+i)%N+1;
    for(int j = 0; j < V[p].size(); ++j) {
      int minCost = INF;
      for(int k = 0; k < V[bp].size(); ++k) {
	minCost = min(minCost, T[bp][k] + dist(V[bp][k], V[p][j]));
      }
      T[p].push_back(minCost);
    }
    bp = p;
  }
  return T[N+1][0];
}

void solve() {
  int ans = INF;
  int ansi = -1;

  for(int i = 1; i <= N; ++i) {
    int newValue = calc(i);
    if(newValue < ans) {
      ans = newValue;
      ansi = i;
    }
  }
  if(ansi == -1) cout << "NA" << endl;
  else cout << ansi << " " << ans << endl;
}

int main() {
  int W, H;
  while(cin >> W >> H && (W || H)) {
    for(int i = 0; i < N+2; ++i) V[i].clear();
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
	char c;
	cin >> c;
	if(c == 'S')      V[0].push_back(P(j,i));
	else if(c == 'G') V[N+1].push_back(P(j,i));
	else if(c != '.') V[c-'0'].push_back(P(j,i));
      }
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 980
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskD {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int k = in.nextInt();
			int[] a = new int[n];
			int[] b = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = in.nextInt();
				b[i] = in.nextInt();
			}
			long ans = 0;
			for (int i = 0; i < n; i++) {
				if (a[i] == k) {
					ans += b[i];
				}
			}
			for (int same = 0; same < 31; same++) {
				for (int last = 0; last < 2; last++) {
					long cur = 0;
					int lower1 = (1 << (31 - same)) - 1;
					int lower2 = (1 << (30 - same)) - 1;
					int top = (k & ~lower1) | (last << (30 - same));
					if (top > k) {
						continue;
					}
					int mask = 0;
					for (int i = 0; i < n; i++) {
						int nmask = mask | a[i];
						int ntop = nmask & ~lower2;
						if ((ntop | top) == top && nmask <= k) {
							mask = nmask;
							cur += b[i];
						}
					}
					ans = Math.max(ans, cur);
				}
			}
			out.println(ans);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



Measured memory_bytes: 44916
import           Control.Monad
import qualified Data.ByteString.Char8       as BS
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM


readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  n <- getInt

  vs <- VBM.new (n+1)
  VBM.set vs (Seq.empty)

  replicateM (n-1) $ do
    [a, b] <- getIntList
    sa <- VBM.read vs a
    VBM.write vs a (sa Seq.|> b)
    sb <- VBM.read vs b
    VBM.write vs b (sb Seq.|> a)

  vs' <- VB.freeze vs

  cs <- getIntList
  let cs' = sortBy (flip compare) cs

  ws <- VM.new (n+1)
  VM.set ws (0::Int)

  let bfs s cs | Seq.null s = return ()
               | otherwise = do
                   let x Seq.:< xs = Seq.viewl s
                   w <- VM.read ws x
                   if w == 0
                     then do VM.write ws x (head cs)
                             let cs' = tail cs
                                 xs' = xs Seq.>< (vs' VB.! x)
                             bfs xs' cs'
                     else bfs xs cs

  bfs (Seq.fromList [1]) cs'

  print $ sum $ tail cs'

  forM_ [1..n] $ \i -> do
    when (i > 1) $ putStr " "
    w <- VM.read ws i
    (putStr . show) w

  putStrLn ""

Measured memory_bytes: 6524
N = int(raw_input())
line = raw_input()

num_list1 = line.split()

num_list2 = line.split()


flag = 1
while flag==1:
    flag =0
    for j in range(N-1,0,-1):
        if int(num_list1[j][1:]) < int(num_list1[j-1][1:]):
            a = num_list1[j]
            num_list1[j] = num_list1[j-1]
            num_list1[j-1] = a
           
            flag =1

print " ".join(num_list1)
print "Stable"



for i in range(0,N,1):
   
    minj =i
    for j in range(i,N,1):
        if int(num_list2[j][1:]) < int(num_list2[minj][1:]):
            minj = j
            
    num_list2[i], num_list2[minj] = num_list2[minj], num_list2[i]
print " ".join(num_list2)


if num_list1 == num_list2: 
    print "Stable"
else:
    print "Not stable"

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    string A, B; cin >> A >> B;


    if(A.size() > B.size()) {
        cout << "GREATER" << endl;
    } else if(A.size() < B.size()) {
        cout << "LESS" << endl;
    } else if(A.size() == B.size()){
        REP(i, A.size()) {
            if((A[i] - '0')== (B[i] - '0')) {
                if(i == A.size() - 1) {
                    cout << "EQUAL" << endl;
                }

                continue;
            }

            if((A[i] - '0') > (B[i] - '0')) {
                cout << "GREATER" << endl;
                break;
            } else if((A[i] - '0') < (B[i] - '0')) {
                cout << "LESS" << endl;
                break;
            }
        }
    }
}

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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	for (int i = 0; i < tx - sx; i++)
		cout << 'R';
	for (int i = 0; i < ty - sy; i++)
		cout << 'U';
	for (int i = 0; i < tx - sx; i++)
		cout << 'L';
	for (int i = 0; i < ty - sy; i++)
		cout << 'D';

	cout << 'D';

	for (int i = 0; i < tx - sx + 1; i++)
		cout << 'R';
	for (int i = 0; i < ty - sy + 1; i++)
		cout << 'U';

	cout << "LU";

	for (int i = 0; i < tx - sx + 1; i++)
		cout << 'L';
	for (int i = 0; i < ty - sy + 1; i++)
		cout << 'D';

	cout << 'R' << endl;

}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int; // 多倍長整数（任意精度）

/*
 * 定数
 */
const long double PI = (acos(-1));
const long double EPS = 1e-10;
const long long INF = 1e18;

/*
 * データ変換 
 */
/* char -> int */
int ctoi(char c) { return (int)(c - '0'); }

/*
 * 数学的な計算
 */
/* 階乗 */
int factorial(int n){ int ret = 1; for(int i = 1; i < n + 1; ++i) { ret = ret * i; } return ret; }

/* 最大公約数 */
template <typename T>T gcd(T x, T y){ return x % y == 0 ? y : gcd(y, x % y); }

/* 最小公倍数 */
template <typename T>T lcm(T a, T b) { return a * b / gcd(a, b); }

/* n個の整数の最小公倍数 */
template <typename T>T lcm_n(vector<T> &numbers) { T l; l = numbers[0]; for(int i = 1; i < numbers.size(); ++i) { l = lcm(l, numbers[i]); } return l; }

/*
 * DP向け
 */
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; }

/*
 * グラフ
 */
class Graph {
   public:
    vector<vector<int>> G;
    vector<int> Trans;
    vector<int> inDeg;
    int numV;
 
    Graph(int numV) {
        this->numV = numV;
        inDeg.assign(numV, 0);
        Trans.assign(numV, 0);
        G.assign(numV, vector<int>());
    }
 
    int topologicalSort(int v, vector<int> &dp) {
        if (dp[v] != -1) {
            return dp[v];
        }
 
        int res = 0;
 
        for (auto to : G[v]) {
            chmax(res, topologicalSort(to, dp) + 1);
        }
 
        return dp[v] = res;
    }
};

int main(){
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;

  cout << a[k-1] << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

int main()
{
    int l;
    cin >> l;
    long double ans;
    ans = (l / 3.0) * (l / 3.0) * (l / 3.0);
    cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
r=0
for i in range(n-1):
    if a[i+1]==a[i]+1:
        r+=c[a[i]-1]
print(sum(b)+r)

Measured memory_bytes: 3064
import java.util.*;

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

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


int main() {
    string s;
    int n;
    cin >> n;
    cin >> s;
    for(int i = 0; i<s.size(); i++) {
        s[i] = 'A'+((s[i]-'A' +n) % 26);
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    vector<vector<int>> happy(n, vector<int>(3, 0));

    for(int i=0; i<n; i++) cin >> happy[i][0] >> happy[i][1] >> happy[i][2];

    vector<vector<int>> dp(n, vector<int>(3, 0));
    dp[0][0] = happy[0][0];
    dp[0][1] = happy[0][1];
    dp[0][2] = happy[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 && dp[i][j] < dp[i-1][k] + happy[i][j])
                    dp[i][j] = dp[i-1][k] + happy[i][j];
            }
        }
    }

    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]) << endl;

    return 0;
}

Measured memory_bytes: 11136
n,y=list(map(int,input().split()))
y//=1000
ans=0
for x in range(y//10+1):
    for j in range(y//5+1):
        if 0 <= y-10*x-5*j == n-x-j:
            print(x,j,n-x-j)
            exit(0)
print("-1 -1 -1")

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

vi Z_Algorithm(string s){
	int S=s.size();
	vi A(S);
	A[0]=S;
	int i=1,j=0;
	while(i<S){
		while(i+j<S&&s[j]==s[i+j]) j++;
		A[i]=j;
		if(!j){
			i++;
			continue;
		}
		int k=1;
		while(i+k<S&& k+A[k] < j){
			A[i+k]=A[k];
			k++;
		}
		i+=k;
		j-=k;
	}
	return A;
}

string s,t;
int S,T;

vi f(){
	string s_=t+s;
	vi a=Z_Algorithm(s_),res(S);
	for(int i=0;i<S;i++) res[i]=a[i+T];
	return res;
}

int main(){
	cin>>s>>t;
	S=s.size();
	T=t.size();
	vi a=f(),b;
	reverse(s.begin(),s.end());
	reverse(t.begin(),t.end());
	b=f();
	int res=0;
	for(int i=0;i<=S-T;i++) if(a[i]+b[S-T-i]==T-1) res++; 
	cout<<res<<endl;
}

Measured memory_bytes: 8104
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <limits>
#include <numeric>

using namespace std;

long long gcd(long long a, long long b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

long long lcm(long long a, long long b){
    long long g = gcd(a,b);
    return a / g * b;
}

int main(){
    int N;
    long int T[110];

    cin >> N;
    for(int i = 0; i < N; i++) cin >> T[i];

    long int x = 1;
    for(int i = 0; i < N; i++)  x = lcm(x, T[i]);
    

    cout << x << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M, Q) = Slice3<long>();
            var pos = new long[N + 1, N + 1];
            for (var i = 0; i < M; ++i)
            {
                var (l, r) = Slice2<long>();
                ++pos[l, r];
            }
            var rui = new long[N + 2, N + 2];
            for (var i = 1; i <= N + 1; ++i)
                for (var j = 1; j <= N + 1; ++j)
                    rui[i, j] = rui[i, j - 1] + rui[i - 1, j] - rui[i - 1, j - 1] + pos[i - 1, j - 1];

            for (var i = 0; i < Q; ++i)
            {
                var (p, q) = Slice2<long>();
                var ans = rui[q + 1, q + 1] - rui[q + 1, p] - rui[p, q + 1] + rui[p, p];
                WriteLine(ans);
            }
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

using namespace std;

int main(void)
{
    long long n, p = 2;
    int count = 0;
    cin >> n;
    long long cpy = n;
    for (long long i = 2; i * i <= cpy; i++)
    {
        if (n % i == 0)
        {
            p = i;
            for (long long j = 1; n % i == 0; j++)
            {
                if (((n / p) % (p * i)) == 0 || (n / p) % i != 0)
                {
                    n /= p;
                    count++;
                }
                p *= i;
            }
            
        }
        if (n == 1)
            break;
    }
    if (n == 1)
        printf("%d", count);
    else
        printf("%d", count + 1);
}

Measured memory_bytes: 3768
#include <stdio.h>

void Frame(int H, int W)
{	
	for(int y = 0; y < H; y++){
		for(int x = 0; x < W; x++){
			if(y == 0 || y == H - 1){
				printf("#");
			}
			else if(x == 0 || x == W - 1){
				printf("#");
			}
			else{
				printf(".");
			}
		}
		printf("\n");
	}
}
		
int main(void)
{
	int H, W;
	
	while(true){
	
		scanf("%d %d",&H, &W);
		
		if(H == 0 && W == 0){
			break;
		}
		
		Frame(H, W);
				
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 2584
/*input
10000000019
*/

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

int main() {
    ll n;
    cin >> n;
    ll div = 1;
    for (ll i = 1; i*i <= n; i++) {
        if (n%i == 0) {
            div = i;
        }
    }
    cout << div-1+n/div-1 << endl;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-
s = input()
k = int(input())

tmp_count = 0
continue_str = s[0]
cont_nums = []
for i, si in enumerate(s):
    if continue_str == si:
        tmp_count += 1
    else:
        cont_nums.append(tmp_count)
        tmp_count = 1
        continue_str = si
    if i == len(s) - 1:
        cont_nums.append(tmp_count)

count_in_loop = 0
half_count = 0
result = 0
if len(cont_nums) == 1:
    result = cont_nums[0] * k // 2
else:
    for i, cni in enumerate(cont_nums):
        count_in_loop += cni // 2
    if (s[0] == s[len(s)-1]) & (cont_nums[0] % 2 == 1) & (cont_nums[-1] % 2 == 1):
        half_count = 1
    result = count_in_loop * k + half_count * (k-1)
print(result)


Measured memory_bytes: 3064
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
n = int(input())
#n, k = map(int, sys.stdin.readline().split())
s = input()
#a = list(map(int, sys.stdin.readline().split()))

def main():
    r = []
    g = []
    b = []

    for i in range(n):
        if s[i] == "R":
            r.append(i)
        elif s[i] == "G":
            g.append(i)
        else:
            b.append(i)


    ans = 0
    z = len(b)
    for i in range(len(r)):
        for j in range(len(g)):
            d = abs(r[i] - g[j])
            e = 0
            p = min(r[i], g[j]) - d
            q = max(r[i], g[j]) + d
            if (r[i] + g[j]) % 2 == 0:
                t = int((r[i] + g[j]) / 2)
                if p >= 0:
                    if s[p] == "B":
                        e += 1
                if q < n:
                    if s[q] == "B":
                        e += 1
                if s[t] == "B":
                    e += 1
            else:
                if p >= 0:
                    if s[p] == "B":
                        e += 1
                if q < n:
                    if s[q] == "B":
                        e += 1

            ans += (z - e)

    print(ans)
            
main()
    


Measured memory_bytes: 9732
n = int(input())
l0 = 2
l1 = 1
if n == 0:
    print(l0)
    exit()
if n == 1:
    print(l1)
    exit()

l_prev = l0
l_next = l1

i = 2
while True:
    l_new = l_prev + l_next
    if n == i:
        print(l_new)
        break
    l_prev = l_next
    l_next = l_new
    i += 1


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int ab, bc, ca;
	cin >> ab >> bc >> ca;

	cout << bc * ab / 2 << endl;
	return 0;
}


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

c = []
t = []
for i in range(1,N+1):
    a, b=map(int,input().split())
    c.append(a)
    t.append(b)

if T < min(t):
  print('TLE')

else:
  Answer = 1000
  for i in range(N):
    if t[i] <= T and c[i] <= Answer:
      Answer = c[i]
  print(Answer)

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

int main() {
    int N;
    cin >> N;
    
    int A[110];
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A, A+N);
    cout << A[N-1] - A[0] << endl;
}


Measured memory_bytes: 3644
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int main(){
    int a,b;
    cin >> a>>b;
    int ans=0;
    if(a>b){
        rep(i,a){
            ans=ans*10+b;
        }
    }else{
        rep(i,b){
            ans=ans*10+a;
        }
    }
    cout<<ans<<endl;
    return 0;
}



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

#define int             long long int
#define ff              first
#define ss              second
#define pb              push_back

#define vi              vector <int>
#define pii             pair <int, int>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))

#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl



template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;


void solve()
{
	int n;
	cin>>n;
	if(n>=30) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return;

}

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

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

	int t=1;
	//cin >> t;
	while (t--) solve();

	return 0;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
  int n, t;
  cin >> t;
  set<int> sp, sm;
  set<pair<pair<ll, ll>, ll> > p, m;
  while (t--) {
    cin >> n;
    ll ans = 0LL;
    sp.clear();
    sm.clear();
    p.clear();
    m.clear();
    vector<ll> k(n), l(n), r(n), a(n), f(n);
    for (int i = 0; i < n; i++) {
      a[i] = 0;
      f[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      cin >> k[i] >> l[i] >> r[i];
      ans += r[i];
      k[i]--;
      if (-(r[i] - l[i]) < 0LL) {
        m.insert({{-(r[i] - l[i]), k[i]}, i});
      } else {
        p.insert({{-(r[i] - l[i]), k[i]}, i});
      }
    }
    for (int i = 0; i < n; i++) {
      if (i < p.size()) {
        sp.insert(-i);
      } else {
        sm.insert(i);
      }
    }
    set<pair<pair<ll, ll>, ll> >::reverse_iterator it = p.rbegin();
    for (; it != p.rend(); it++) {
      if (sp.lower_bound(-it->first.second) != sp.end()) {
        ans += it->first.first;
        sp.erase(sp.lower_bound(-it->first.second));
      } else {
        sp.erase(sp.begin());
      }
    }
    set<pair<pair<ll, ll>, ll> >::iterator it2 = m.begin();
    for (; it2 != m.end(); it2++) {
      if (sm.upper_bound(it2->first.second) != sm.end()) {
        sm.erase(sm.upper_bound(it2->first.second));
      } else {
        sm.erase(sm.begin());
        ans += it2->first.first;
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 33012
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
const int inf = 1e9+7;
int mod = 1e9+7;

int a[100004];
vector<int> vec;
signed main(){
	int n, ans = 1;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld", &a[i]);
	if(n%2 == 0){
		rep(i,n/2)rep(j,2)vec.pb(i*2+1);
	}else{
		vec.pb(0);
		rrep(i,n/2)rep(j,2)vec.pb(i*2);
	}
	rep(i,n/2)ans = (ans*2)%mod;
	sort(all(vec));
	sort(a, a+n);
	
	int f = 1;
	rep(i,n)if(a[i] != vec[i])f = 0;
	if(f)printf("%lld\n", ans);
	else printf("0\n");
	return 0;
}


Measured memory_bytes: 2168
#include<iostream>
#include<array>
#include<algorithm>

int main() {
	int num;
	std::array<int,3> ar;

	std::cin >> num;

	for(int i = 0; num != 0;i++) {
		ar[i] = num % 10;
		num /= 10;
	}

	std::cout<<std::count(ar.begin(), ar.end(), 1) << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
const int INF = (int)1e9;
int S, T, U, N, O, D;
int E[100], C[100], H[100], A[100];
int train[101][101][101];
// ??????, 0, U
int getTrain(int a, int b, int c) {
  int &ret = train[a][b][c];
  if(ret != -1) return ret;
  if(c == 0) return ret = 0;
  if(b == T) return ret = -INF;
  ret = getTrain(a, b + 1, c);
  if(a - E[b] >= 0 && c - 1 >= 0) {
    ret = max(ret, getTrain(a - E[b], b + 1, c - 1) + C[b]);
  }
  return ret;
}
int donuts[10001];
// ????????????
int getDonuts(int a) {
  int &ret = donuts[a];
  if(ret != -1) return ret;
  ret = 0;
  for(int i = 0; i < N; ++i) {
    if(a - A[i] >= 0) ret = max(ret, getDonuts(a - A[i]) + H[i]);
  }
  return ret;
}
int happy[101][101];
int getHappy(int a, int b) {
  // ??\, ??????
  int &ret = happy[a][b];
  if(ret != -1) return ret;
  if(a == D) return 0;
  ret = -INF;
  for(int i = 0; i <= b; ++i) {
    int cal = getTrain(b - i, 0, U);
    // cerr << "getTrain " << b - i << " = " << cal << endl;
    if(cal < 0) continue;
    ret = max(ret, getHappy(a + 1, min(i + O, S)) + getDonuts(cal));
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> S >> T >> U >> N >> O >> D;
  REP(i,T) cin >> E[i] >> C[i];
  REP(i,N) cin >> H[i] >> A[i];
  memset(train, -1, sizeof(train));
  memset(donuts, -1, sizeof(donuts));
  memset(happy, -1, sizeof(happy));
  int h = getHappy(0, S);
  cout << (h < 0 ? -1 : h) << endl;
}

Measured memory_bytes: 5316
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
 
typedef long long ll;


ll gcd(ll a,ll b) {
	
	while(1){
		if(a < b) swap(a, b);
		if(!b) break;
		a %= b;
	}
//	cout << a <<endl;
	return a;
}

ll lcm(ll a,ll b){
	
	return (a*b)/gcd(a,b);
}

ll or_not(ll a,ll c,ll d,ll tmp){
	ll res = a/c + a/d - a/tmp;
	return res;
}


int main(){
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	a--;
	ll tmp = lcm(c,d);
	//cout << tmp <<endl;
	ll hoge = or_not(b,c,d,tmp);
	ll hoge2 = or_not(a,c,d,tmp);
	//cout << hoge2 <<" " << hoge <<endl; 
	ll res = (b-a)-(hoge-hoge2);
	
	cout << res <<endl;
	
	
	
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,m;
  unsigned long long ans=0;
  cin>>n;
  vector<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;i++)cin>>c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  for(int i=0;i<n;i++){
    m=b[i];
    ans+=distance(a.begin(),lower_bound(a.begin(),a.end(),m))*distance(upper_bound(c.begin(),c.end(),m),c.end());
  }
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

const int maxn=1e5+10;

struct mmp
{
    int x,y;
};
mmp p[maxn];

int main()
{
    int n,i;
    int s[10]= {1,2,3,4,5,6,7,8,9};
    double sum=0.0,num=0.0,ans=0.0;
    scanf("%d",&n);
    for(i=1; i<=n; ++i)
    {
        scanf("%d%d",&p[i].x,&p[i].y);
    }
    for(i=1,sum=0.0; i<n; ++i)
    {
        num=(p[s[i]].x-p[s[i-1]].x)*(p[s[i]].x-p[s[i-1]].x)+(p[s[i]].y-p[s[i-1]].y)*(p[s[i]].y-p[s[i-1]].y);
        sum+=sqrt(1.0*num);
    }
    int c=1;
    while(next_permutation(s,s+n))
    {
        for(i=1; i<n; ++i)
        {
            num=(p[s[i]].x-p[s[i-1]].x)*(p[s[i]].x-p[s[i-1]].x)+(p[s[i]].y-p[s[i-1]].y)*(p[s[i]].y-p[s[i-1]].y);
            sum+=sqrt(1.0*num);
        }
        c++;
    }
    printf("%f\n",sum/c);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  
  cin >> a >> b;
  
  if ( (a * b) % 2 == 0 ) {
    cout << "Even" << endl;
  } else {
     cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
   
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

const int INF=1e9+7;

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

int V;
vector<edge> g[3002];
int h[3002];
int dist[3002];
int prevv[3002], preve[3002];

void add_edge(int from, int to, int cap, int cost){
	edge e;
	e.to=to, e.cap=cap, e.cost=cost, e.rev=g[to].size();
	g[from].push_back(e);
	e.to=from, e.cap=0, e.cost=-cost, e.rev=g[from].size()-1;
	g[to].push_back(e);
}

int min_cost_flow(int s, int t){
	int res=0;
	fill(h, h+V, 0);
	while(1){
		priority_queue<P, vector<P>, greater<P>> que;
		fill(dist, dist+V, INF);
		dist[s]=0;
		que.push(P(0, s));
		while(!que.empty()){
			P p=que.top(); que.pop();
			int v=p.second;
			if(dist[v]<p.first) continue;
			for(int i=0; i<g[v].size(); i++){
				edge &e=g[v][i];
				if(e.cap>0 && dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
					dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
					prevv[e.to]=v;
					preve[e.to]=i;
					que.push(P(dist[e.to], e.to));
				}
			}
		}
		for(int v=0; v<V; v++) h[v]+=dist[v];
		if(h[t]>=0) break;
		int d=INF;
		for(int v=t; v!=s; v=prevv[v]){
			d=min(d, g[prevv[v]][preve[v]].cap);
		}
		res+=d*h[t];
		for(int v=t; v!=s; v=prevv[v]){
			edge &e=g[prevv[v]][preve[v]];
			e.cap-=d;
			g[v][e.rev].cap+=d;
		}
	}
	return res;
}

int main()
{
	int n;
	cin>>n;
	set<int> st;
	int a[1000], b[1000];
	for(int i=0; i<n; i++){
		cin>>a[i]>>b[i];
		st.insert(a[i]);
		st.insert(b[i]);
	}
	map<int, int> mp;
	int num=0;
	for(auto x:st){
		mp[x]=num;
		num++;
	}
	V=2+n+num;
	for(int i=0; i<n; i++){
		add_edge(V-2, i, 1, 0);
	}
	for(int i=n; i<n+num; i++){
		add_edge(i, V-1, 1, 0);
	}
	for(int i=0; i<n; i++){
		add_edge(i, mp[a[i]]+n, 1, -b[i]);
		add_edge(i, mp[b[i]]+n, 1, -a[i]);
	}
	cout<<-min_cost_flow(V-2, V-1)<<endl;
    return 0;
}


Measured memory_bytes: 3664
x1,y1,x2,y2 = map(int,input().split())
x4 = x1-(y2-y1)
y4 = y1+(x2-x1)
x3 = x4+(x2-x1)
y3 = y4+(y2-y1)
print(x3,y3,x4,y4)

Measured memory_bytes: 8964
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
struct el {
	double val;
	int a;
	bool operator<(const el &r)const {
		return val + 1e-9< r.val;
	}
};
int main()
{
	double n;
	cin >> n;
	vector<el> v;
	el cur;
	int Z = 1;
	for (int i = 1; i <= 3500; ++i) {
		cur.val = Z*4.0 - Z*double(n) / i;
		cur.a = i;
		v.push_back(cur);
	}
	sort(v.begin(), v.end());
	for (int i = 1; i <= 3500; ++i)
		for (int j = 1; j <= 3500; ++j) {
			cur.val = Z*double(n) / i + Z*double(n) / j;
			auto it = lower_bound(v.begin(), v.end(), cur);
			for (int k = 0; it != v.end() && k < 3; ++k) {
				if (fabs(it->val - cur.val) < 1e-11) {
					//cout << 1.0 / i + 1.0 / j + 1.0 / it->a << " == " << 4.0 / n << endl;
					cout << i << " " << it->a << " " << j << endl;
					return 0;
				}
				++it;
			}
		}
	assert(false);
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
}

int32_t main()
{
	c_p_c();
	int h, a; cin >> h >> a;
	cout << (h + a - 1) / a << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000000LL;

int main() {
	int r,g,b;
	cin>>r>>g>>b;
	if((100*r+10*g+b)%4==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a!=b&&a!=c)
    printf("%d",a);
    else if(b!=a&&b!=c)
    printf("%d",b);
    else if(c!=a&&c!=b)
    printf("%d",c);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    int n;cin>>n;
    vector<int> v(n),ans(n);
    for(int i=0;i<n;i++)cin>>v[i];
    for(int i=0;i<n;i++)ans[v[i]-1]=i+1;
    for(int i=0;i<n;i++)cout<<ans[i]<<' ';
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, M; scanf("%d %d", &N, &M);
  vector<vector<int> > adj(N + 1, vector<int>(N + 1, 0));
  for (int i = 0; i < M; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a][b] = adj[b][a] = 1;
  }

  vector<int> v;
  for (int i = 2; i <= N; ++i) { v.push_back(i); }
  sort(v.begin(), v.end());

  int ans = 0;
  do {
    int u = 1;
    bool ok = true;
    for (int i = 0; i < (int)v.size(); ++i) {
      if (adj[u][v[i]] != 1) {
        ok = false;
        break;
      }
      u = v[i];
    }
    if (ok) { ++ans; }
  } while (next_permutation(v.begin(), v.end()));

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int A;
int B;
int C;
int sum = 0;
int ans = 0;

int main(){
	
	cin>>A>>B>>C;
	
	REP( i, B ){
		sum += A;
		if( sum % B == C ){
			ans = 1;
			break;
		}
	}
	
	if( ans ) puts("YES");
	else{	puts("NO");}
	
	return 0;

}

Measured memory_bytes: 256