akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,K;
  cin>>N>>K;
  ll A[N];
  REP(i,N) cin>>A[i];
  REP(i,N-K){
    if(A[i]<A[i+K]) COYe;
    else CONo;
  }
  return 0;
}

Measured memory_bytes: 5192
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [a, b, c, k]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    if (a + b >= k) {
      return `${Math.min(a, k)}`;
    }
    return `${a - Math.min(c, k - (a + b))}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29896
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  int n, s, t; cin >> n >> s >> t, --s, --t;
  auto qry = [&](int u, int v) -> int {
    cout << "? " << u + 1 << ' ' << v + 1 << endl;
    int res; cin >> res;
    assert(res != -1);
    return res;
  };
  int d = qry(s, t);
  V<> ds(n), dt(n);
  ds[t] = dt[s] = d;
  for (int v = 0; v < n; ++v) if (v != s and v != t) {
    ds[v] = qry(s, v);
    dt[v] = qry(t, v);
  }
  V<> vs(n);
  iota(begin(vs), end(vs), 0);
  sort(begin(vs), end(vs), [&](int u, int v) { return ds[u] < ds[v]; });
  V<> res;
  int p = s;
  for (int v : vs) if (ds[v] + dt[v] == d) {
    if (ds[p] + qry(p, v) + dt[v] > d) continue;
    res.push_back(v);
  }
  cout << '!';
  for (int e : res) cout << ' ' << e + 1;
  cout << endl;
}


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

int main(){
    int n, q;
    while(cin >> n >> q, n+q){
        int m, d, ok[100] = {};
        for(int i = 0; i < n; i++){
            cin >> m;
            for(int j = 0; j < m; j++){
                cin >> d;
                ok[d]++;
            }
        }
        int ans, ma = 0;
        for(int i = 0; i < 100; i++){
            if(ok[i] > ma){
                ans = i, ma = ok[i];
            }
        }

        cout << (ma < q ? 0 : ans) << endl;
    }
    return 0;
}


Measured memory_bytes: 3004
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int N, K;
    io.read(N, K);
    auto l = io.read_vec<int>(N);
    sort(l.begin(), l.end());
    int ans = 0;
    for(int i = N - 1; i >= N - K; i--){
        ans += l[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Solution
{
    static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int n = vals[0];
        int k = vals[1];
        var items = new long[n][];
        for (int i = 0; i < n; i++)
        {
            items[i] = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        var masks = new List<long>();
        masks.Add(k);
        for(int i = 30; i >= 0;i--)
        {
            long pop = k & (1 << i);
            if(pop != 0)
            {
                long mask = k ^ pop;
                for(pop >>= 1; pop > 0 ;pop >>= 1 )
                {
                    mask |= pop;
                }
                masks.Add(mask);
            }
        }
        
        var max = masks.Select(mask =>
        items.Where(item => (item[0] | mask) == mask).Sum(item => item[1])).Max();
        Console.WriteLine(max);
    }
}

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

int main() {
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> win(n);

  for (int i=0; i<q; i++){
    int winner;
    cin >> winner;
    win.at(winner-1) += 1;
  }
  
  for (int i=0; i<n; i++){
    int point;
    point = k - (q - win.at(i));
    if (point >= 1){
      cout << "Yes";
    }
    else{
      cout << "No";
    }
    if (i != (n-1)){
      cout << endl;
    }
  }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace std;
#define int long long int
#define double long double
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> new_data_set;
bool isprime(int n)
	{
    	if(n==1) return true;
    	for(int i = 2;i*i<=n;i++){
    		if(n%i==0) return false;
		}
		return true;
	}
int lcm(int a,int b){
	return (a*b)/__gcd(a,b);
}
int gcd(int a, int b) 
{ 
    if (b == 0){
    	return a;
	} 
    return gcd(b, a % b);  
      
} 
unsigned int factorial(unsigned int n) 
{ 
    if (n == 0) 
    return 1; 
    return n * factorial(n - 1); 
} 
const int inf=1e17+7;
int dsu[1000001],s[100005];
void init(int n,int m){
	for(int i=1;i<=n;i++){
		dsu[i]=i;
		s[i]=1;
	}
}
int root(int x){
	while(dsu[x]!=x){
		x = dsu[x];
	}
	return x;
}
void uni(int x,int y){
	int p = root(x);
	int q = root(y);
	if(p==q){
		return;
	}
	else{
		if(s[p]<s[q]){
			s[q]+=s[p];
			dsu[p] = q;
		}
		else{
			s[p]+=s[q];
			dsu[q] = p;
		}
	}
}
int power(int x, unsigned int y)  
{  
    int res = 1;
    x = x ; 
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res);   
        y = y>>1;  
        x = (x*x);  
    }  
    return res;  
}
vector<int>graph[100001];
set<pair<int,int>>st;
char arr[1001][1001];
bool visit[1001][1001];
void dfs(int x,int y,int n,int m){
	st.erase({x,y});
	visit[x][y]=true;
	if(x<n-1 && arr[x+1][y]=='#' && !visit[x+1][y])dfs(x+1,y,n,m);
	if(x>0 && arr[x-1][y]=='#' && !visit[x-1][y])dfs(x-1,y,n,m);
	if(y<m-1 && arr[x][y+1]=='#' && !visit[x][y+1])dfs(x,y+1,n,m);
	if(y>0 && arr[x][y-1]=='#' && !visit[x][y-1])dfs(x,y-1,n,m);
}
signed main(){
	FAST
	int n;
	cin>>n;
	double dp[n][n+1];
	double arr[n];
	for(int i=0;i<n;i++){
		double x;
		cin>>x;
		arr[i]=x;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<=n;j++){
			if(j<=i+1){
				if(j==0 && i==0){
					dp[i][j]=1-arr[i];
				}
				else if(j==0){
					dp[i][j]=(1-arr[i])*(dp[i-1][j]);
				}
				else if(i==0){
					dp[i][j]=arr[i];
				}
				else{
					dp[i][j]=(dp[i-1][j-1]*arr[i])+(dp[i-1][j]*(1-arr[i]));
				}
			}
			else{
				dp[i][j]=0;
			}
		}
	}
	double ans=0;
	for(int i=(n/2)+1;i<=n;i++){
		ans+=dp[n-1][i];
	}
	cout<<fixed<<setprecision(9)<<ans;
}

Measured memory_bytes: 145024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  string s;
  cin >> s;
  string ans = "";
  rep(i, s.size()) {
    if (s[i] == '0') ans += '0';
    else if (s[i] == '1') ans += '1';
    else {
      if (ans.size() != 0) ans.pop_back();
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int H;
	int W;
	int i , j , k;
	String[] weather;
	char[][] weatherArray;
	int[][] count;
	
	void input(){
		H = sc.nextInt();
		W = sc.nextInt();
		weather = new String[H];
		weatherArray = new char[H][W];
		for(i = 0 ; i < H ; i++){
			weather[i] = sc.next();
		}
		for(i = 0 ; i < H ; i++){
			for(j = 0 ; j < weather[i].length() ; j++){
				weatherArray[i][j] = weather[i].charAt(j);
			}
		}
	}
	
	void content1(int i){
		if(weatherArray[i][0] == 'c'){
			count[i][0] = 0;
			return;
		}else if(weatherArray[i][0] == '.'){
			count[i][0] = -1;
			return;
		}
	}
	
	void content2(int i , int j){
		if(weatherArray[i][j] == 'c'){
			count[i][j] = 0;
			return;
		}else if(weatherArray[i][j] == '.'){
			for(k = 1 ; k < j + 1 ; k++){
				count[i][j]++;
				if(weatherArray[i][j - k] == 'c'){
					return;
				}
				if(count[i][j] == j){
					count[i][j] = -1;
					return;					}
				}
		}
		
	}
	
	void process1(){
		count = new int[H][W];
		for(i = 0 ; i < H ; i++){
			content1(i);
		}
	}	
	
	void process2(){
		for(i = 0 ; i < H ; i++){
			for(j = W - 1 ; j > 0  ; j--){
				content2(i,j);
			}
		}
	}
		
	void output(){
		for(i = 0 ; i < H ; i++){
			for(j = 0 ; j < W ; j++){
				System.out.print(count[i][j]);
				if(j + 1 != W){
					System.out.print(" ");
				}
			}
			System.out.println("");
		}
	}
	
	void doIt(){
		input();
		process1();
		process2();
		output();
	}
	
	public static void main(String[] args){
		new Main() . doIt();	
	}
	
}

Measured memory_bytes: 36180
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scin = new Scanner(System.in);
		
		String[] input = scin.nextLine().split(" ");
		
		Stack<Integer> polishStack = new Stack<>();
		
		for (int i = 0; i < input.length; i++) {
			//System.out.println("char is " + input[i]);
			try {
				int num = Integer.parseInt(input[i]);
				polishStack.push(num);
			}catch (Exception e) {
				//now we know it is an operation
				int num1 = polishStack.pop();
				int num2 = polishStack.pop();
				
				if (input[i].equals("*")) {
					polishStack.push(num1 * num2);
				}else if (input[i].equals("+")) {
					polishStack.push(num1 + num2);
				}else {
					//subtraction
					polishStack.push(num2 - num1);
				}
			}
			//System.out.println("Stack is " + polishStack);
		}
		
		System.out.println(polishStack.pop());
		
	}
}


Measured memory_bytes: 26148
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
string s;
bool first = true;
void rec(int i, int res, string sign) {
    if(i==3) {
        if(first&&res == 7) {
            rep(i, 3) {
                cout << s[i] << sign[i];
            }
            cout << s[3] << "=7" << endl;
            first = false;
        }
    }else{
        rec(i+1,res+(s[i+1]-'0'),sign+'+');
        rec(i+1,res-(s[i+1]-'0'),sign+'-');
    }
}
int main() {
    cin >> s;
    int res = s[0] - '0';
    rec(0, res, "");
}


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

int main() {
  int A,B;
  cin >> A >> B;
  if (A<6){
    cout << 0 <<endl;
  }
  else if (5<A && A<13){
    cout << B/2 <<endl;
  }
  else {
    cout << B <<endl;
  }
}


Measured memory_bytes: 256
//header{{{
#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 setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n){
		cin >> a[i];
	}
	int cnt = 0;
	rep(i,n-1){
		if(a[i] == a[i+1]){
			++cnt;
			++i;
		}
	}
	cout << cnt << '\n';
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramB
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var result = "";
            for (var i = 0; i < s.Length; i++)
            {
                result += "x";
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 25716
#include <iostream>
#include <set>

using namespace std;

int main() {
	int n, k; cin >> n >> k;
	set<int> st;
	for (int i = 0; i < k; ++i) {
		int d; cin >> d;
		for (int j = 0; j < d; ++j) {
			int a; cin >> a;
			st.insert(a);
		}
	}
	cout << n - st.size() << endl;

	return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
int N;
int i, j,ans;
int main(){
    scanf("%d", &N);

    fornum(i,0,N){
        int h;
        scanf("%d", &h);
        if(j<=h){
            j=h;
            ans++;
        }
    }
    printf("%d", ans);
    return 0;
}

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

const int INF = 1e9;
string A;
int N;

int next(int i, char c) {
  int pos = A.find(c, i);
  return ( (pos != string::npos) ? pos : N );
}

int main() {
  cin >> A;
  N = A.length();
  vector<int> dp(N + 2, INF);
  dp[N] = 1; dp[N + 1] = 0;
  for (int i = N; i >= 0; --i) {
    for (int j = 0; j < 26; ++j) {
      int k = next(i, 'a' + j) + 1;
      dp[i] = min(dp[i], dp[k] + 1);
    }
  }
  string ans;
  int cur = 0;
  while (cur < N + 1) {
    for (int j = 0; j < 26; ++j) {
      int k = next(cur, 'a' + j) + 1;
      if (dp[cur] == dp[k] + 1) {
        cur = k;
        ans += static_cast<char>('a' + j);
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1412
#include <stdio.h>

char C[105][105];

int main() {

	int H, W;

	scanf("%d %d",&H,&W);


	int i,j;

	for (i = 1; i <= H; i++) {
		for (j = 1; j <= W; j++) {
			scanf(" %c",&C[i][j]);
		}
	}
	for (i = 1; i <= 2*H; i++) {
		for (j = 1; j <= W; j++) {
			printf("%c", C[(i+1)/2][j]);
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int N;
float money = 0;

int main(int argc, char const *argv[]) {
  cin >> N;
  for (int i=0; i < N; i++){
    float value;
    string coin;
    cin >> value >> coin;
    if(coin == "JPY"){
      money = money + value;
    }
    else{
      money = money + value * 380000.0;
    }

  }
	cout << money << endl;

  return 0;
}


Measured memory_bytes: 256
l1 = []
l2 = []
n = int(input())
a = list(map(int, input().split()))
flag = -1
for i in range(n):
    if flag < 0:
        l1.append(a[i])
    else:
        l2.append(a[i])
    flag *= -1
if n%2 == 0:
    print(*(list(reversed(l2))+l1))
else:
    print(*(list(reversed(l1))+l2))

Measured memory_bytes: 100308
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;

//"Never let your head hang down. Never give up and sit down and grieve. Find another way." - Satchel Paige

void solve() {
	int n; string s;
	cin >> n >> s;
	
	if(n % 2) {
		cout << "No" << endl;
		return;
	}
	
	for(int i = 0; i < n / 2; i++) {
		if(s.substr(0, i + 1) + s.substr(0, i + 1) == s) {
			cout << "Yes" << endl;
			return;
		}
	}
	
	cout << "No" << endl;
}

int main(){
#define MULTITEST 0
#if MULTITEST   
 
    CASET {
        solve();
    }
    
#else

    solve();
    
#endif

    return 0;
}

Measured memory_bytes: 3612
import java.util.*;
import java.io.*;
class Main
{
    public static void main(String args[])
    {
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int arr[][]=new int[n+1][3];
        arr[0][0]=0;
        arr[0][1]=0;
        arr[0][2]=0;
        for(int i = 1 ;i<=n;i++)
        {
            arr[i][0]=sc.nextInt();
            arr[i][1]=sc.nextInt();
            arr[i][2]=sc.nextInt();
        }
        for(int i = 1 ;i<=n;i++)
        {
            int time = arr[i][0]-arr[i-1][0];
            int dist=Math.abs(arr[i][1]+arr[i][2]-arr[i-1][1]-arr[i-1][2]);
            int timeleft=time-dist;
            if(timeleft<0||timeleft%2==1)
            {
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 92072
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin >> a >> b;
  if(a%3==0 || b%3==0 ||(a+b)%3==0)
  cout << "Possible" << endl;
  else 
  cout << "Impossible" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long X, long long Y, long long Z){
  printf("%lld %lld %lld\n",Z,X,Y);
}

int main(){
  cout<<setprecision(1000);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] length = new int[n];
		int sum=0;

		for(int i=0;i<n;i++) {
			length[i]=sc.nextInt();
		}

		Arrays.sort(length);

		for(int i=0;i<n-1;i++) {
			sum+=length[i];
		}

		System.out.println(length[n-1]<sum?"Yes":"No");

	}
}

Measured memory_bytes: 23508
a = int(raw_input())	
strings = raw_input().split(" ")
s0 = strings[0]
s1 = strings[1]
r = ""
t = 0
for i in range(len(s0)*2):
  if i % 2 == 0:
  	r += s0[t]
  else:
    r += s1[t]
    t += 1


print(r)

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

int main()
{
	int sum;
	while (cin >> sum, sum) {
		for (int i = 0; i < 9; i++) {
			int tmp;
			cin >> tmp;
			sum -= tmp;
		}
		cout << sum << endl;
	}
	return 0;
}



Measured memory_bytes: 3024
#include<bits/stdc++.h>
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int s;
    cin>>s;
    if(s%111==0)
    {
        cout<<s<<nl;
    }
    else
    {
        s++;
        for(int j=s;j<=999;j++)
        {
            if(j%111==0)
            {
                cout<<j<<nl;
                return 0;
            }
        }
    }
    //cout<<nl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,x[5];
  	
  	for(int i=0;i<5;i++){
    	cin >> x[i];
      	if(x[i]==0) a=i;
    }
  	cout << a+1 << endl;
  	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, total = 0, p2 = 0; cin >> N;
  int d[N];
  for(int i = 0; i < N; i++){
    cin >> d[i];
    total += d[i];
    p2 += d[i] * d[i];
  }
  cout << (total * total - p2) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  int n,m,X,Y;
  cin>>n>>m>>X>>Y;
  vector<int>x(n);
  vector<int>y(m);
  rep(i,n)cin>>x[i];
  rep(i,m)cin>>y[i];
  int maxx=X;
  int miny=Y;
  rep(i,n)maxx=max(maxx,x[i]);
  rep(i,m)miny=min(miny,y[i]);
  if(maxx<miny)cout<<"No War"<<endl;
  else cout<<"War"<<endl;
}

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

int main() {
	int K,s=0;
	cin >> K;
	vector<vector<int>> g(K, vector<int>(K));

	rep(i,K)
		rep(j,K)
			g.at(i).at(j) = gcd(i+1, j+1);
		
	rep(i,K)
		rep(j,K)
			rep(k,K)
				s += g.at(g.at(i).at(j)-1).at(k);

	cout << s << endl;
}

Measured memory_bytes: 3736
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Main m = new Main();
    m.show(m.solve());
  }

  int a;
  int b;
  
  public Main() {
    Scanner sc = new Scanner(System.in);
    try {
      a = sc.next().equals("H") ? 1 : 0;
      b = sc.next().equals("H") ? 1 : 0;
   } finally {
      sc.close();
    }
  }
  
  boolean solve() {
    return a == b;
  }

  void show(boolean ans) {
    System.out.println(ans ? "H" : "D");
  }
}


Measured memory_bytes: 35392
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    HashMap<Integer, Long> map = new HashMap<Integer, Long>();
    for(int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
      if(map.containsKey(a[i])) {
        map.put(a[i], map.get(a[i]) + (long)1);
      } else {
        map.put(a[i], (long)1);
      }
    }
    long t = 0;
    for(int key : map.keySet()) {
      long c = map.get(key);
      t += ((c * (c - 1)) / 2);
    }
    for(int i = 0; i < n; i++) {
      long t1 = map.get(a[i]) - 1;
      System.out.println(t - t1);
    }
  }
}

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

using ll = long long;

struct Graph
{
    int R, C;
    struct Edge { int source, target, constraint; };
    vector<vector<Edge>> adjacency_list;

    Graph(const int R, const int C) : R(R), C(C), adjacency_list(R+C) {}

    void add_edge(const int row, const int column, const int constraint)
    {
        adjacency_list[row].push_back({row, R+column, constraint});
        adjacency_list[R+column].push_back({R+column, row, constraint});
    }

    bool solve() const
    {
        auto seen = vector<bool>(R+C);
        auto differences = vector<ll>(R+C);

        bool is_consistent;
        ll min_row, min_column;
        const function<void(int)> dfs = [&](const int v)
        {
            for (const auto e : adjacency_list[v])
            {
                const auto d = e.constraint - differences[e.source];

                if (seen[e.target]) is_consistent &= differences[e.target] == d;
                else
                {
                    seen[e.target] = true;
                    differences[e.target] = d;

                    if (e.target < R) min_row = min(min_row, d);
                    else min_column = min(min_column, d);

                    dfs(e.target);
                }
            }
        };

        for (auto row = 0; row < R; row++) if (!seen[row])
        {
            is_consistent = true;
            min_row = 0;
            min_column = numeric_limits<ll>::max();

            seen[row] = true;
            dfs(row);

            if (!is_consistent || min_row + min_column < 0)
                return false;
        }
        return true;
    }
};

int main()
{
    int R, C; cin >> R >> C;

    auto graph = Graph(R, C);

    int N; cin >> N;
    for (auto i = 0; i < N; i++)
    {
        int r, c, a; cin >> r >> c >> a;
        r--; c--;
        graph.add_edge(r, c, a);
    }

    cout << (graph.solve() ? "Yes" : "No") << endl;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  string s, t; std::cin >> s >> t;
  int n = s.size();
  bool ok = true;
  map<char, char> convert;
  rep(i, 26) convert['a'+i] = '?';
  rep(i, n) {
    if (convert[s[i]] == '?') convert[s[i]] = t[i];
    else if (convert[s[i]] != t[i]) ok = false;
  }
  rep(i, 26) convert['a'+i] = '?';
  rep(i, n) {
    if (convert[t[i]] == '?') convert[t[i]] = s[i];
    else if (convert[t[i]] != s[i]) ok = false;
  }
  std::cout << (ok ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 916
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    double W, H, x, y;
    cin >> W >> H >> x >> y;
    double area;
    area = W * H / 2.0;
    printf("%.9f ", area);
    if(W / 2.0 == x && H / 2.0 == y) cout << 1 << endl;
    else cout << 0 << endl; 
}


Measured memory_bytes: 256
L=[]
for i in range(3):
  L.append(list(map(int,input().split())))
if all(L[i][0]-L[i+1][0]==L[i][1]-L[i+1][1]==L[i][2]-L[i+1][2] for i in range(2)) and all(L[0][i]-L[0][i+1]==L[1][i]-L[1][i+1]==L[2][i]-L[2][i+1] for i in range(2)):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] h = new int[N];
    int count =0;
    for (int i =0; i<N; i++) {
      h[i] = sc.nextInt();
      if (h[i] >= K) count++;
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 51824
n=int(input())
w=list(map(int,input().split()))
w_sum=sum(w)
ans=w_sum
w0=0
for i in range(1,n):
    w0+=w[i-1]
    buf=w_sum-2*w0
    ans=min(ans,abs(buf))
    if buf<0:
        break
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int calculate(int num1, int num2);

int main(void){
  int west,east;
  scanf("%d %d",&west,&east);
  printf("%d\n",calculate(west,east));
  return 0;
}

int calculate(int num1, int num2){
  int diff,height;
  diff = num2 - num1;
  height = diff*(diff + 1)/2 - num2;
  return height;
}

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

using namespace std;
	
int a[30];

int main()
{
	int a,b;
	cin >> a >> b;
	bool d=0;
	if(abs(b)>=abs(a))
		d=1;
	if(d==1)
	{
		if(a==b)
			cout << 0;
		else if(a>=0 && b>=0)
			cout << b-a;
		else if(a<0 && b>0)
			cout << b+a+1;
		else if(a>=0 && b<0)
			cout << (abs(b)-a)+1;
		else if(a<0 && b<0)
			cout << abs(b-a)+2;
	}
	else 
	{
		if(a>=0 && b>=0)
			cout << a+1;
		else if(a>=0 && b>=0)
			cout << a-b+2;
		else if(a<0 && b>0)
			cout << -a-b+1;
		else if(b<0 && a>0)
			cout << a+b+1;
		else if(a<0 && b<0)
			cout << -a+b;
		else if(a<0 && b==0)
			cout << abs(a);
	}
}

 



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main() {
  	int n; cin >> n;
  	if (n%2==1) {
    	cout << (double)(n/2+1)/(double)n << endl;
    } else {
    	cout << 0.5 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vi;

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

int main() {
  int N;
  cin >> N;
  vi H(N);
  rep(i,N) {
    cin >> H[i];
  }

  vi bit(N-1);
  rep(i,N-1) {
    // cout << H[i] << " " << H[i+1] << endl;
    if(H[i] >= H[i+1]) bit[i] = 1;
    else bit[i] = 0;
  }

  int ans = 0;
  int cnt = 0;
  rep(i,N-1) {
    if(bit[i] == 1) {
      cnt++;
    }
    ans = max(ans,cnt);
    if(bit[i] == 0) cnt = 0;  
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	ss := strings.Split(s, "")
	if ss[2] == ss[3] && ss[4] == ss[5] {
		fmt.Println("Yes")
		return
	}

	fmt.Println("No")
}


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

int main(){
    int n ,k, q;
    cin >> n >> k >> q;

    int p[n + 1];
    for (int i = 1; i < n + 1; i++){
        p[i] = 0;
    }

    int tmp;
    for(int i = 0; i < q; i++){
        cin >> tmp;
        p[tmp]++;
    }

    for (int i = 1; i < n + 1; i++){
        if(p[i] + k - q > 0){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }
    return 0;
}


Measured memory_bytes: 1024
n, a, b = map(int, input().split())
mod = 10**9 + 7
def comb(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    k=min(n-k,k)
    ans=1
    inv=[1]*(k+1)
    if k>=1:
        ans*=(n-k+1)%mod
    for i in range(2,k+1):
        inv[i]=mod-inv[mod%i]*(mod//i)%mod
        ans=ans*(n-k+i)*inv[i]%mod
    return ans
c = comb(n, a)
d = comb(n, b)
answer = pow(2, n, mod) - 1
print((answer-c-d)%mod)

Measured memory_bytes: 10932
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		String S = sc.next();

		if(S.length() <= K) {
			System.out.println(S);
		}else {
			System.out.println(S.substring(0, K) + "...");
		}
	}
}

Measured memory_bytes: 38680
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int N;
    cin >> N;
    vector<vector<int>> A(2, vector<int>(N));
    rep(i,2){
        rep(j,N){
            cin >> A[i][j];
        }
    }
    ll ans=0;
    rep(i,N){
        ll sum=0;
        rep(j,i+1){
            sum+=A[0][j];
        }
        rept(j,i,N){
            sum+=A[1][j];
        }
        ans=max(ans, sum);
    }
    cout << ans << endl;
}

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

ll gcd(ll x, ll y){
    ll z;
    while(y>0){
        z = x%y;
        x=y;
        y=z;
    }
    return x;
}

const ll n=1001001;
vector<bool> eratosthenes(vector<bool> prime){
    rep(i,n) prime[i] = 1;
    prime[0] = prime[1] = 0;
    rep(i,n){
        if(prime[i]){
            for(ll j = i+i; j<n; j+=i){
                prime[j] = 0;
            }
        }
    }
    return prime;
}



int main() {
    ll a,b; cin >> a >> b;
    a = gcd(a,b);
    if(a==1){
        cout << 1 << endl;
        return 0;
    }
    vector<bool> prime(n);
    prime = eratosthenes(prime);
    ll ans=1;
    rep(i,n){
        if(prime[i]){
            if(a%i==0){
                ans++;
                while(a%i==0) a/=i;
            }
        }
    }
    if(a!=1) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3760
#include <iostream>
#include <vector>

using namespace std;
using vi = vector<int>;

#define rep(i,n) for(int i=0;i<(n);++i)
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"

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

  vi A(N), C(N);
  rep(i, N) {
    in(A[i]);
  }
  int sum = 0;
  rep(i, N) {
    int b; in(b);
    sum += b;
  }
  rep(i, N-1) {
    in(C[i]);
  }
  rep(i, N) {
    if (A[i] + 1 == A[i+1])
      sum += C[A[i]-1];
  }
  out(sum);

  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> x;
	int temp;
	long long z=1<<n;
	for(int i=0;i!=z;++i){
		cin>>temp;
		x.push_back(temp);
	}
	while(x.size()!=1){
		vector<int> y(x.size()/2);
		for(int i=0;i!=x.size();i+=2){
			if(x[i]==x[i+1])
				y[i/2]=x[i];
			else
				y[i/2]=max(x[i],x[i+1])-min(x[i],x[i+1]);
		}
		x=y;
	}
	cout<<x[0];
}


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

#define ll long long
#define ld long double

#define pii pair<int, int>
#define pci pair<char, int>
#define pcc pair<char, char>

#define vi vector <int>
#define vll vector<long long>
#define vld vector<long double>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>

#define vvi vector<vi>
#define vvll vector<vll>
#define vvld vector<vld>
#define vvb vector<vb>
#define vvc vector<vc>
#define vvs vector<vs>

#define vpii vector<pii>
#define vpci vector<pci>
#define vpcc vector<pcc>

#define all(v) (v).begin(), (v).end()
#define allrev(v) (v).rbegin(), (v).rend()
#define allcomp(v) (v).begin(), (v).end(), comp
#define allrevcomp(v) (v).rbegin(), (v).rend(), comp

const int MOD = 1e9 + 7;
const ld pi = 3.1415926535897932384626433832;

#define line cout<<"\n";
#define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);



void solve(int test_case){
    int n;
    cin >> n;
    map<string, int> m;
    string a;
    for(int i = 0; i < n; i++)
        cin >> a, m[a]++;

    cout << "AC x " << m["AC"];
    line;
    cout << "WA x " << m["WA"];
    line;
    cout << "TLE x " << m["TLE"];
    line;
    cout << "RE x " << m["RE"];

}

int main(){
    fast
    int test = 1;
    //cin>>test;
    for(int i = 1; i <= test; i++){
        solve(i);
    }
    return 0;
}


Measured memory_bytes: 3676
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;

vector<vector<ll>> comb(ll n) {
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));

    for (ll i = 0; i < v.size(); i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }

    for (ll j = 1; j < v.size(); j++) {
        for (ll k = 1; k < j; k++) {
            v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
        }
    }
    return v;
}

int main() {
    ll N;
    cin >> N;

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

    vector<ll> Amap(N, 0);
    rep(i, N) Amap[A[i] - 1]++;

    // rep(i, N) { cout << Amap[i] << " "; }
    // cout << endl;

    // vector<vector<ll>> vcomb = comb(N);
    vector<ll> Acomb(N, 0);
    rep(i, N) { Acomb[i] = Amap[i] * (Amap[i] - 1) / 2; }

    ll Asum = 0;
    rep(i, N) {
        Asum += Acomb[i];
        // cout << Acomb[i] << " ";
    }
    // cout << endl;
    // cout << Asum << endl;

    rep(i, N) {
        ll ans = Asum - Amap[A[i] - 1] * (Amap[A[i] - 1] - 1) / 2 +
                 (Amap[A[i] - 1] - 1) * (Amap[A[i] - 1] - 2) / 2;
        cout << ans << endl;
    }

    return 0;
}

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

int main(){
  int X;
  cin>>X;
  //int x=floor(sqrt(X));
  vector<bool> expo(X+1);
  expo[1]=1;
  for(int b=2; b<=X; b++){
    int v = b*b;
    while(v<=X){
      expo[v]=1;
      v*=b;
    }
  }
  for(int i=X; i>=1; i--){
    if(expo[i]){
    cout<<i<<endl;
    break;
    }
  }
}
 


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

ll N, AI, BI, WI, ans[100005];
vector<pair<ll, ll> > G[100005];

void dfs(ll v, ll c) {
	if (ans[v] != -1) return;
	ans[v] = c;
	for (ll i = 0; i < G[v].size(); i++) {
		if (G[v][i].second % 2 == 0) dfs(G[v][i].first, c);
		else dfs(G[v][i].first, 1-c);
	}
}

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

	cin >> N;
	for (ll i = 0; i < N-1; i++) {
		cin >> AI >> BI >> WI;
		G[AI].push_back(make_pair(BI, WI));
		G[BI].push_back(make_pair(AI, WI));
	}

	memset(ans, -1, sizeof(ans));
	dfs(1, 1);
	for (ll i = 1; i <= N; i++) {
		cout << ans[i] << "\n";
	}
}

Measured memory_bytes: 10240
#include<stdio.h>

int main(void)
{
        int n=0,i = 0;
        double fact = 1.0;

        scanf("%d",&n);

        for(i=1; i<= n; i++)
        {
                fact = fact * (double)i;
        }
        printf("%0.0f\n", fact);

        return 0;
}

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

int main() {
  int W, a, b;
  cin >> W >> a >> b;
  if(a > b) swap(a,b);//a < bに
  if(a + W >= b){//初めから連結
    cout << "0" <<endl;
  }else{
    cout << b - a - W <<endl;
  }
  
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

int n;
vector<vector<int>> v;

int main(){
  cin>>n;
  int k=0;
  FOR(i,1,10000){
    k+=i;
    if(n<k){
      cout<<"No"<<endl;
      return 0;
    }
    if(n==k){
      k=i;
      break;
    }
  }
  if(k==1){
    cout<<"Yes"<<endl;
    cout<<2<<endl;
    cout<<1<<" "<<1<<endl;
    cout<<1<<" "<<1<<endl;
    return 0;
  }
  k+=1;
  v.resize(k);
  int su=0;
  FOR(i,1,k){
    REP(j,i){
      su+=1;
      v[j].push_back(su);
      v[i].push_back(su);
    }
  }
  
  cout<<"Yes"<<endl;
  cout<<k<<endl;
  REP(i,v.size()){
    cout<<k-1;
    REP(j,v[i].size()){
      cout<<" "<<v[i][j];
    }
    cout<<endl;
  }
  
  return 0;
}


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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    string arr[]={"AC","WA","TLE","RE"};
    vector<ll> cnt(4,0);
    ll n;
    cin>>n;
    repA(i,1,n)
    {
      string str;
      cin>>str;
      rep(i,4)
      {
        if(str==arr[i]) cnt[i]++;
      }
    }
    rep(i,4)
    {
      cout<<arr[i]<<" x "<<cnt[i]<<'\n';
    }
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


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

int main() {
    int x[] = { 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 << x[K-1] << endl;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,k;
  cin >> a >> b >> k;
  ll m = max<ll>(0,k-a);
  cout << max<ll>(0,a-k) << " " << max<ll>(0,b-m) << endl;
  return 0;
}


Measured memory_bytes: 256
a = input()
alpha = ["a", "b", "c", "d", "e", "f", "g",
         "h", "i", "j", "k", "l", "m", "n",
          "o", "p", "q", "r", "s", "t", "u",
        "v", "w", "x", "y", "z"]


for i in range(len(alpha)):
    # s = i + 1    
    alphabet = alpha[i]
    if a == alphabet:
        s = i + 1    
        alphabet = alpha[s]
        print(alphabet)
        break
        

Measured memory_bytes: 2940
o[9999];m[99][99];main(x,y,d,e){
	for(d=0;~y;o[d++]=x)if(y=scanf("%d",&x),!y)getchar(),scanf("%d",&x);
	for(d=(int)sqrt(d),e=x=0;x<d;x++)for(y=0;y<=x;y++)m[x-y][y]=o[e++];
	for(x=d-2;~x;x--)for(y=0;y<=x;y++)m[d-1-y][d-1-(x-y)]=o[e++];
	for(x=1;x<d;x++)m[x][0]+=m[x-1][0];
	for(y=1;y<d;y++)m[0][y]+=m[0][y-1];
	for(x=1;x<d;x++)for(y=1;y<d;y++)m[x][y]+=m[x-1][y]>m[x][y-1]?m[x-1][y]:m[x][y-1];
	printf("%d\n",m[d-1][d-1]);exit(0);
}

Measured memory_bytes: 632