akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int a , b ;
	cin >> a >> b;
	cout << (a*3 + b )/2;
	
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


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

int main(){
	int N;
	cin>>N; 
	while(N-->0){
		int frist=0,last=0,a;
		string s = "YES";
		for(int i=0;i<10;i++){
			cin>>a;
			if(a>last){
				last = a;
			}else if(a>frist){
				frist = a;
			}else {
				frist = -1;
				s = "NO";
			}
		}
		cout<<s<<endl;
	}
	return 0;
}


Measured memory_bytes: 3056
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type Counter struct {
	Count int
	Parent *Counter
	Children []*Counter
}

func count(c *Counter) {
	if c.Parent != nil {
		c.Count += c.Parent.Count
	}
	for i := range c.Children {
		count(c.Children[i])
	}
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	q := nextInt()

	a := make([]int, n-1)
	b := make([]int, n-1)
	p := make([]int, q)
	x := make([]int, q)

	counters := make([]Counter, n)
	for i := 0; i<n; i++ {
		counters[i] = Counter{
			Count:    0,
			Parent:   nil,
			Children: []*Counter{},
		}
	}

	for i := 0; i<n-1;i++  {
		i1 := nextInt()
		i2 := nextInt()

		if i1 > i2 {
			i2, i1 = i1, i2
		}

		a[i] = i1
		b[i] = i2

		counters[a[i] - 1].Children = append(counters[a[i] - 1].Children, &counters[b[i] - 1])
		counters[b[i] - 1].Parent = &counters[a[i] - 1]
	}

	for i := 0; i<q;i++  {
		p[i] = nextInt()
		x[i] = nextInt()

		counters[p[i] - 1].Count += x[i]
	}

	count(&counters[0])

	for i, c := range counters {
		fmt.Printf("%d", c.Count)

		if i != len(counters) - 1 {
			fmt.Printf(" ")
		}
	}
}


Measured memory_bytes: 50944
#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
const double PI = acos(-1.0);
const ll INF = LLONG_MAX;
const int A = 1234567;
double arr[A]; 

int main() {
	int a, b,temp1,temp2 ;
	cin >> a >> b;
	while (b--)
	{
		cin >> temp1 >> temp2;
		arr[temp1]++;
		arr[temp2]++;
	}

	for (int i = 1;i <= a;i++)
	{
		cout << arr[i] << endl;
 	}
	
}

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

string S;

int main() {
  cin >> S;
  string res;

  if (S == "SUN") {
    cout << 7 << endl;
  } else if (S == "MON") {
    cout << 6 << endl;
  } else if (S == "TUE") {
    cout << 5 << endl;
  } else if (S == "WED") {
    cout << 4 << endl;
  } else if (S == "THU") {
    cout << 3 << endl;
  } else if (S == "FRI") {
    cout << 2 << endl;
  } else if (S == "SAT") {
    cout << 1 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long m=1000000007;
int main(){
    int n,k;
    cin>>n>>k;
    long a[2002][2002];
    for(int i=0;i<n+1;i++){a[i][0]=1;}
    for(int i=0;i<k+1;i++){a[i][i]=1;}
    for(int i=1;i<n+1;i++){
        for(int j=1;j<=i;j++){
            a[i][j]=(a[i-1][j]+a[i-1][j-1])%m;
        }
    }
    for(int i=1;i<=k;i++){
        cout<<a[n-k+1][i]*a[k-1][i-1]%m<<endl;
    }
}


Measured memory_bytes: 31488
#include <cstdio>
#include <cstring>

#include <algorithm>

using namespace std;

const int N = 110;

char s[N], t[] = "keyence";
int mp[N], ms[N];

int main() {
  scanf("%s", s);
  int n = strlen(s);
  int i = 0;
  while (i < 7 && s[i] == t[i])
    ++i;
  if (n < 7) {
    puts("NO");
    return 0;
  }
  if (strcmp(s + n - (7 - i), t + i) == 0)
    puts("YES");
  else
    puts("NO");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int d,r;
	do{
	cin >>d>>r;
	if(d==0||r==0)
		break;
	for(int i=0;i<d;i++){
		for(int j=0;j<r;j++)
			cout <<"#";
		cout<<endl;
	}
	cout<<endl;
	}while(1);
	return 0;
}

Measured memory_bytes: 3080
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int X = int.Parse(input[0]);

            int b = X;
            int p = 2;
            int A = 1;

            while (b > 1)
            {
                while (Math.Pow(b,p) <= X)
                {
                    if (Math.Pow(b, p) > A)
                    {
                        A = (int)Math.Pow(b, p);
                    }
                    p++;
                }
                b--;
            }

            Console.WriteLine(A);

        }
    }
}


Measured memory_bytes: 11092
N, K = map(int, input().split())
X = [int(i) for i in input().split()]
ans = 10000000000000000
for i in range(N-K+1):
  a = min(abs(X[i])+abs(X[i+K-1]-X[i]), abs(X[i+K-1])+abs(X[i]-X[i+K-1]))
  ans = min(a, ans)
print(ans)


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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

double kaijyo(int n){
    int k(1);
    for(int i=n;i>0;i--){
        k *= i;
    }

    return k;
}

double distance(int x[],int y[],int i,int j){
    int dx = (x[i] - x[j]) * (x[i] - x[j]);
    int dy = (y[i] - y[j]) * (y[i] - y[j]);
    return sqrt(dx+dy);
}

int main(){
    int x,y;
    cin >> x >> y;
    if(x==y)    puts("Yes");
    else    puts("No");

    return 0;
}

Measured memory_bytes: 3660
N = int(input())
V = [int(i) for i in input().split()]

Vodd = V[1::2]
Veven = V[::2]

from collections import Counter

Vodd = sorted(Counter(Vodd).items(), key=lambda x:x[1])
Veven = sorted(Counter(Veven).items(), key=lambda x:x[1])

if Vodd[-1][0] == Veven[-1][0]:
    if len(Vodd) == len(Veven) == 1:
        ans = N - Vodd[-1][1]
    elif len(Vodd) == 1:
        ans = N - Vodd[-1][1] - Veven[-2][1]
    elif len(Veven) == 1:
        ans = N - Vodd[-2][1] - Veven[-1][1]
    elif Vodd[-2][1] >= Veven[-2][1]:
        ans = N - Vodd[-2][1] - Veven[-1][1]
    else:
        ans = N - Vodd[-1][1] - Veven[-2][1]
else:
    ans = N - Vodd[-1][1] - Veven[-1][1]


print(ans)


Measured memory_bytes: 20640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
using namespace std;
typedef long long ll;
int a[4] = { 0,1,0,-1 };
int b[4] = { 1,0,-1,0 };
int main() {
	int h, w;
	char c[55][55];
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++)cin >> c[i][j];
	}
	bool s = true;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (c[i][j] == '.')continue;
			bool f = false;
			for (int k = 0; k < 4; k++) {
				if (i + a[k] >= h || i + a[k] < 0 || j + b[k] >= w || j + b[k] < 0)continue;
				if (c[i + a[k]][j + b[k]] == '#')f = true;
			}
			if (!f)s = false;
		}
	}
	if (s)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
            #include<iostream>
            #include<cstdio>
            #include<vector>
            #include<queue>
            #include<map>
            #include<cstring>
            #include<string>
            #include <math.h>
            #include<algorithm>
        //    #include <boost/multiprecision/cpp_int.hpp>
            #include<functional>
          #define int long long
            #define inf  1000000007
            #define pa pair<int,int>
    #define ll long long
            #define pal pair<double,int>
            #define ppa pair<int,pa>
             #define ssa pair<string,int>
            #define  mp make_pair
            #define  pb push_back
            #define EPS (1e-10)
            #define equals(a,b) (fabs((a)-(b))<EPS)
     
            using namespace std;
     //priority_queue<int, vector<int>, greater<int> > que;
            class Point{
            	public:
            	double x,y;
            	Point(double x=0,double y=0):x(x),y(y) {}
            	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
            	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
            	Point operator * (double a) {return Point(x*a,y*a);}
            	Point operator / (double a) {return Point(x/a,y/a);}
            	double absv() {return sqrt(norm());}
            	double norm() {return x*x+y*y;}
            	bool operator < (const Point &p) const{
            		return x != p.x ? x<p.x: y<p.y;
            	}
            	bool operator == (const Point &p) const{
            		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
            	}
            };
            typedef Point Vector;
     
            struct Segment{
            Point p1,p2;
            };
     
        double hen(Vector a){
        if(fabs(a.x)<EPS && a.y>0) return acos(0);
        else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
        else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
        else if(fabs(a.y)<EPS && a.x>0) return 0.0;
        else if(a.y>0) return acos(a.x/a.absv());
        else return 2*acos(0)+acos(-a.x/a.absv());
     
        }
     
int gcd(int v,int b){
	if(v>b) return gcd(b,v);
	if(v==b) return b;
	if(b%v==0) return v;
	return gcd(v,b%v);
}
            double dot(Vector a,Vector b){
            	return a.x*b.x+a.y*b.y;
            }
            double cross(Vector a,Vector b){
            	return a.x*b.y-a.y*b.x;
            }
        
double distans(double x1,double y1,double x2,double y2){
	double rr=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
	return sqrt(rr);
	
}
            //----------------kokomade tenpure------------

int s[200002]={0};
int rui[200002]={0};
    signed  main(){
    	string st;
    	cin>>st;
    	for(int i=0;i<st.length();i++){
    		s[st[i]-'a']++;
    	}
    	 bool b=true;
    	for(int i=0;i<26;i++) if(s[i]%2==1) b=false;
    	if(b) cout<<"Yes"<<endl;
    	else cout<<"No"<<endl;
   // 	cout<<ans<<endl;
  //  	printf("%.10f\n",ans[n-1]);
    	return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <math.h>
#include <stdlib.h>
#include <algorithm>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

//INT_MAX	2,147,483,647 = 2*1.0e9

vector<vector<int>> path;
vector<vector<int>> rpath;

vector<bool> canGo;
vector<bool> canCome;


void dfs(int v){
  if(canGo[v]) return;
  else {
    canGo[v] = true;
    for(int i : path[v]) dfs(i);
  }
}


void rdfs(int v){
  if(canCome[v]) return;
  else {
    canCome[v] = true;
    for(int i : rpath[v]) rdfs(i);
  }
}

const int INF = 1000000000;

int main(){
  int N, M, P;
  cin >> N >> M >> P;

  path.resize(N);
  rpath.resize(N);
  canGo.assign(N, false);
  canCome.assign(N, false);

  vector<tuple<int, int, int>> ABC;

  for(int i = 0; i < M; i++){
    int a, b, c; cin >> a >> b >> c;
    a--;
    b--;
    c -= P;
    path[a].push_back(b);
    rpath[b].push_back(a);
    ABC.push_back(make_tuple(a, b, -c));
  }

  dfs(0);
  rdfs(N-1);

  vector<bool> OK(N);
  for(int i = 0; i < N; i++) OK[i] = canGo[i] & canCome[i];

  vector<int> dist(N, INF);
  dist[0] = 0;
  bool upd = true;
  int cnt = 0;
  while(upd){
    upd = false;
    for(int i = 0 ; i < M; i++){
      int a, b, c;
      tie(a, b, c) = ABC[i];
      if(!OK[a]) continue;
      if(!OK[b]) continue;

      if(dist[b] > dist[a] + c){
        dist[b] = dist[a] + c;
        upd = true;
      }
    }

    cnt++;

    if(cnt > N){
      cout << "-1" << endl;
      return 0;
    }
  }

  int ans = max(0, -dist[N-1]);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define modulo N
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000005



int main(){
	
	long long X;
	cin>>X;
	
	for(long long a=-2000;a<=2000;a++){
		for(long long b=-2000;b<=2000;b++){
			if(a*a*a*a*a-(b*b*b*b*b)==X){
				cout<<a<<' '<<b<<endl;
				return 0;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5]) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stack>
using namespace std;

int main (){
	char s;
	stack<int> A;
	stack<pair<int,int> > B;
	int i=0,j,ans=0,a;
	while(cin>>s){
		if(s=='\\') A.push(i);
		else if(s=='/'&&!A.empty()){
			j=A.top();A.pop();
			a=i-j;
			ans+=a;
			while(!B.empty() && B.top().first>j){
				a=a+B.top().second;
				B.pop();
			}
			B.push(make_pair(j, a));
		} 
		i++;
	}
	cout<<ans<<endl;
	vector<int> X;
	int z;
	z=B.size();
	for(int i =0;i<z;i++){
		X.push_back(B.top().second);
		B.pop();
	}
	cout<<X.size();
	for(int i =X.size()-1;i>=0;i--){
		cout<<" "<<X[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3204
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int n;
vector<int> a;
vector<vector<int> > edges;
vector<int> ans;

void solve(int curr, int prev, vector<int>& dp)
{
    auto it = lower_bound(dp.begin(), dp.end(), a[curr]);
    int tmp = *it;
    *it = a[curr];
    ans[curr] = lower_bound(dp.begin(), dp.end(), INT_MAX) - dp.begin();

    for(int next : edges[curr]){
        if(next != prev)
            solve(next, curr, dp);
    }

    *it = tmp;
}

int main()
{
    cin >> n;
    a.resize(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    edges.assign(n, vector<int>());
    for(int i=0; i<n-1; ++i){
        int u, v;
        cin >> u >> v;
        -- u;
        -- v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }

    ans.resize(n);
    vector<int> dp(n, INT_MAX);
    solve(0, -1, dp);
    for(int i=0; i<n; ++i)
        cout << ans[i] << endl;

    return 0;
}


Measured memory_bytes: 30984
//#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

int main() {
    //freope    n("in.txt", "rt", stdin);
    int n;
    scanf("%d", &n);
    double ans = 0, x;
    for (int i = 0; i < n; ++i) {
        scanf("%lf", &x);
        ans += (1.0 / x);
    }
    printf("%.5lf", 1 / ans);

}

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

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#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 srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

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

  ll roop_cnt {};
  ll roop_start_cnt {};
  ll roop_start_pos {};
  int now_pos {};
  vector<int> B(N, -1);
  rep(i, N) {
    if (B[now_pos] != -1) {
      roop_start_cnt = B[now_pos];
      roop_cnt = i - B[now_pos];
      roop_start_pos = now_pos;
      break;
    }
    B[now_pos] = i;
    now_pos = A[now_pos]-1;
  }
//  rep(i, N) {
//    cout << B[i] << ' ';
//  }
//  cout << '\n';
//  cout << roop_start_cnt << ' ' << roop_cnt << ' ' << roop_start_pos+1 << '\n';
//  return 0;
  if (K > roop_start_cnt) {
    ll tmp_K = K - roop_start_cnt;
    tmp_K %= roop_cnt;
    ll answer {roop_start_pos};
    rep(i, tmp_K) {
      answer = A[answer]-1;
    }
    cout << answer +1 << '\n';
  } else {
    ll answer {};
    rep(i, K) {
      answer = A[answer]-1;
    }
    cout << answer+1 << '\n';
  }
}


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

int main() {
    int a,j;
    cin >> a;
    j = a - (a/10)*10;
      
  if( j == 0 ){
    
    cout << "pon" << endl;
    
  }
  
  else if( j == 1 ) {
    
    cout << "pon" << endl;
    
  }
  
  else if( j == 3 ){
  
    cout << "bon" << endl;
    
  }
 
  else if( j == 6 ) {
    
    cout << "pon" << endl;
    
  }

  else if( j == 6 ) {
    
    cout << "pon" << endl;
    
  }
  
  else if( j == 8 ) {
    
    cout << "pon" << endl;
    
  }
  
  else {
    
    cout << "hon" << endl;
    
  }

}
  

Measured memory_bytes: 3592
#include<iostream>
#include<string>
using namespace std;
int main (void){

    string s;
    int i;
    
    cin >> s;
    i = s.size() - 1;


    if(s[i] == '2' || s[i] == '4' || s[i] == '5' || s[i] == '7' || s[i] == '9')
        cout << "hon" << endl;
    else if (s[i] == '0' || s[i] == '1' || s[i] == '6' || s[i] == '8')
        cout << "pon" << endl;
    else
        cout << "bon" << endl;

    return 0;
}

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

int main(){
    int a,b,k;
    cin >> a >> b >> k;

    if(b-a+1<2*k){
        for(int i=a; i<=b; i++){
            cout << i << endl;;
        }
    }
    else{
        for(int i=0; i<k; i++){
            cout << a+i << endl;
        }
        for(int i=k-1; i>=0; i--){
            cout << b-i << endl;
        }
    }
}
    

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define all(a) (a).begin(), (a).end()


int main(){
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << ' ' << x << ' ' << y << endl;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

typedef long long ll;

const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e6 + 5;

ll mod_pow(ll a, int n) {
	ll res = 1;
	while(n) {
		if(n&1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}

int num[MAXN];

int main() {
	int n, x;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) {
		scanf("%d", &x);
		++num[x];
	}
	bool flag = true;
	if(n&1) {
		flag = num[0] == 1;
		for(int i = 2; i < n; i += 2) {
			if(num[i] != 2) flag = false;
		}
	} else {
		for(int i = 1; i < n; i += 2) {
			if(num[i] != 2) flag = false;
		}
	}
	if(flag) {
		printf("%lld\n", mod_pow(2, n / 2));
	} else puts("0");
	return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
n = int(input())
a = []
for i in range(n):
    a.append([str(i) for i in input().split()])
x = str(input())

part = 0
tmp = 0
for i in range(n):
    if x == a[i][0]:
        tmp = i
for i in range(tmp + 1, n):
    part += int(a[i][1])
print(part)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(){
    int i, j, k;
    int antenas[256];

    for(i=4;i>=0;i--){
        cin >> antenas[i];
    }
    cin >> k;

    for(i=0;i<5;i++){
        for(j=i;j<5;j++){
            if(antenas[i]-antenas[j]>k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}



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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int n, m;
  cin >> n >> m;
  vi can;
  for(int i = 1; i*i <= m; i++) {
    if(m%i == 0) {
      can.push_back(i);
      can.push_back(m/i);
    }
  }
  int ans = 1;
  rep(i,sz(can)) {
    if(m/can[i] >= n) ans = max(ans, can[i]);
  }
  //rep(i,sz(can)) cout << can[i] << endl;
  cout << ans << endl;
}

Measured memory_bytes: 256
#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>;

int main() {
  int n;
  cin >> n;
  vector<int>d(n);
  rep(i,n){
    cin >> d[i];
  }
  int ans = 0;
  rep(i,n) {
    rep(j,n){
      if (i >= j) continue;
      else{
        ans += d[i]*d[j];
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,w,x,y,xcmp=0,ycmp=0,sum=0;

string s;

vector<int> z;

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

       cin >> n >> a >> b;
       rrep(i,1,n+1){
           cmp=i;
       while(cmp!=0){
            sum+=cmp%10;
            cmp/=10;
        }
       // Cout(sum);
        if(sum>=a && sum<=b){
            ans+=i;
        }
            sum=0;
       }
        Cout(ans);
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
int main(void){
    // Your code here!
    int n;
    string s;
    map<string,int> m;
    cin>>n;
    while(cin>>s){
        m[s]++;
    }
    int imax=0;
    for(auto i=m.begin();i!=m.end();i++){
        imax=max(imax,i->second);
    }
    for(auto i=m.begin();i!=m.end();i++){
        if(imax==i->second){
            cout<<i->first<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 25216
#include <bits/stdc++.h>
#include <ctime>
#include <sstream>
#define weewoo ios::sync_with_stdio(false);cin.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define ll long long
#define se second
#define fi first
#define ctoi(x) (x-'0')
#define pi (acos(-1))
#define llputin(a,n) for(int i=0;i<n;i++){ll x;cin >> x;a.push_back(x);}
#define iputin(a,n) for(int i=0;i<n;i++){int x;cin >> x;a.push_back(x);}

#define MOD ((ll) 1e9 + (ll) 7)
using namespace std;

ll pw(ll x,ll a){
    if(a==0)
        return 1;
    ll t = pw(x,a/2);
    if(a%2==0)
        return (t*t);
    else
        return (t*t*x);
}

bool prime(int x)
{
    if(x < 2) return false;
        for(int i=2; i<= sqrt(x); i++) {
            if ((x%i) == 0) return false;
        }
    return true;
}

vector<int>f,s;

int main()
{
    weewoo;
    ll n;
    cin >> n;
    iputin(f,n);
    iputin(s,n);
    vector<int>a(n);
    iota(a.begin(),a.end(),1);
    int u1=0,u2 = n;
    int cnt=1;
    do{
        if(f==a)
            u1 = cnt;
        if(s==a)
            u2 = cnt;
        cnt++;
    }while(next_permutation(a.begin(),a.end()));

    cout << abs(u1 - u2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
    string s = "";
    cin >> s;
    int a = (s[0] - '0') * 10 + (s[1] - '0');
    int b = (s[2] - '0') * 10 + (s[3] - '0');

    bool fa = 1 <= a && a <= 12;
    bool fb = 1 <= b && b <= 12;
    if (fa && fb)
    {
        cout << "AMBIGUOUS" << endl;
    }
    else if (fa)
    {
        cout << "MMYY" << endl;
    }
    else if(fb) {
        cout << "YYMM" << endl;
    }
    else {
        cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N = I()
A,B = LIR(N,2)
A.sort()
B.sort()

if N%2 == 1:
    min_ = A[(N-1)//2]
    max_ = B[(N-1)//2]
    print(max_-min_+1)
else:
    smin_ = A[N//2-1]+A[N//2]
    smax_ = B[N//2-1]+B[N//2]
    print(smax_-smin_+1)

Measured memory_bytes: 121060
package main

import (
	"fmt"
)

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	a := []int{0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1}

	if a[x] == a[y] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

using namespace std;

#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define pb			    push_back

typedef long long ll;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n, m;
    cin >> n >> m;
    int tot = n + m;
    vector<int> ball;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
    	ball.pb(2);
    }
    for (int i = 0; i < m; ++i) {
        ball.pb(1);
    }
    // 2 4 1
    // 2
    // 2 4 1
    // cnt = 1;
    for (int i = 0; i < tot; ++i) {
    	for (int j = i+1; j < tot; ++j) {
    		if (i == j)
    			continue;
    		if ((ball[i] + ball[j]) % 2 == 0) {
    			cnt++;
    		}
    	}
    }
    cout << cnt;
    cout << endl;

    return 0;
}

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

using namespace std;

int n,k,m;
/*int pan [1000001] ;
void init ()
{
    pan[0]=1;
    k=1;
    for (int i=6;i<=100001;i*=6)
        pan[k++]=i;
    for (int i=9;i<=100001;i*=9)
        pan[k++]=i;
    sort (pan , pan+k) ;
}*/
int main ()
{
    ios::sync_with_stdio (false ) ;
   // init () ;
    while (cin>>n>>m )
    {
        int t= m-n ;
        t= (1+t)*t/2;
        cout<<t-m<<endl ;


       /* int t= k-1;
        int ans =0;
        while (t>-1)
        {
            if (pan[t] > n) t--;
            else
            {
                n-=pan[t] ;
                ans++ ;
            }
        }
        cout<<ans<<endl ;*/
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
class UF{
public:
	vector<int> par,num;
	int find(int v){
		return (par[v]==v)? v: (par[v]=find(par[v]));
	}
	explicit UF(int N):par(N),num(N,1){
		iota(all(par),0);
	}
	void unite(int u,int v){
		u=find(u),v=find(v);
		if(u==v)return;
		if(num[u]<num[v])swap(u,v);
		num[u]+=num[v];
		par[v]=u;
	}
	bool same(int u,int v){
		return find(u)==find(v);
	}
	bool ispar(int v){
		return v=find(v);
	}
	int size(int v){
		return num[find(v)];
	}
};
int main(){
  ll n,m;
  cin>>n>>m;
  UF uf(n+m);
  set<int> s;
  for(int i=0;i<n;i++){
    int k;cin>>k;
    for(int j=0;j<k;j++){
      int a;cin>>a;
      uf.unite(i,a-1+n);
      s.insert(a);
    }
  }
  if(uf.size(0)==s.size()+n)cout<<"YES"<<"\n";
  else cout<<"NO"<<"\n";
}



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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll N, K; cin >> N >> K;
  ll A[N]; rep(i,N) cin >> A[i];

  ll result = 0;
  rep(i,N) {
    ll cl = 0, cr = 0;
    rep(j,N) {
      if (A[i]<A[j]) {
        if (i<j) cl++;
        else if (i>j) cr++;
      }
    }
    // cout << cl << " " << cr << endl;
    result += ( K*(K-1)/2 % MOD ) * cl; result %= MOD;
    result += ( K*(K+1)/2 % MOD ) * cr; result %= MOD;
  }
  cout << result << endl;
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> a(n);
  for (int i = 0;i < n;i++){
    cin >> a.at(i);
  }

  int count = 0;
  for (int i = 0;i < n;i++){
    int b;
    b=a.at(i);
    count+=min(2*abs(b-k),2*abs(b));
  }

  cout << count;


  return 0;
}


Measured memory_bytes: 256
n,x = map(int, input().split())

b = [[1,1]]

for i in range(n):
    b.append([b[-1][0]*2+3, b[-1][1]*2+1])

ans = 0
for i in range(len(b)):
    if x >= b[-1-i][0]:
        x -= b[-1-i][0]
        ans += b[-1-i][1]
        if x > 0:
            x-=1
            ans += 1
        if x>=b[-1-i][0]:
            x -= b[-1 - i][0]
            ans += b[-1 - i][1]
            break
    x-=1
    if x<=0:
        break

print(ans)


Measured memory_bytes: 38256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
int INPUT_INT() { int d; cin >> d; return d; } // 入力をpush_back(d)やarray[d]に使う時に1行で書ける

// ------------------- include, typedef, define END. -------------------

double ave(int a, int b, int c){
	return (a + b + c) / 3.0;
}

char solve(int m, int e, int j){
	if (m == 100 || e == 100 || j == 100 || ((m + e) / 2.0) >= 90.0 || ave(m, e, j) >= 80.0)
		return 'A';
	else if (ave(m, e, j) >= 70.0 || (ave(m, e, j) >= 50.0 && (m >= 80 || e >= 80)))
		return 'B';
	else
		return 'C';
}

int main(){
	fastIO;
	int n,m,e,j;
	while (cin >> n, n){
		while (n--){
			cin >> m >> e >> j;
			cout << solve(m,e,j) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;
template <typename T> using vvec = vector<vector<T>>;

constexpr int64_t mpow(int64_t a, int64_t b, int64_t mod = 1000000007) {
    if (b <= 0) { return 1; } if (b == 1) { return a % mod; } if (b == 2) { return (a * a) % mod; }
    return (max(a * (b & 1), (int64_t)1) * mpow(mpow(a, b / 2, mod), 2, mod)) % mod;
}
constexpr int64_t mdiv(int64_t a, int64_t b, int64_t mod = 1000000007) {
    return (a * mpow(b, mod - 2, mod)) % mod;
}

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



Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int n,q;
  cin>>n>>q;
  int a[n+1]={0},sum[n+1]={0};
	for(int i=0;i<n-1;i++)
    {
      int par,ch;
      cin>>par>>ch;
      a[ch]=par;
    }  
  for(int i=0;i<q;i++)
  {
    int ind,val;
    cin>>ind>>val;
    //cout<<ind<<" "<<val<<endl;
    sum[ind]+=val;
  }
  for(int i=1;i<=n;i++)
  {
    
    cout<<sum[i]+sum[a[i]]<<" ";
    sum[i]+=sum[a[i]];
  }
  return 0;
} 

Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int[] a = { 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 = scanner.nextInt();

		System.out.println(a[k - 1]);
	}

}


Measured memory_bytes: 21712
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int a, b, x;
    cin>>a>>b>>x;
    if(a == 0) cout<<b/x + 1<<endl;
    else cout<<b/x - (a - 1)/x<<endl;
}


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

int main() {
  vector<vector<int>> a(3,vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  for (int i = 0; i < N; i++) {
    cin >> b.at(i);
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (b.at(i) == a.at(j).at(k)) {
          a.at(j).at(k) = 0;
        }
      }
    }
  }
  string ans = "No";
  for (int i = 0; i < 3; i++) {
    if (a.at(i).at(0) == a.at(i).at(1) && a.at(i).at(1) == a.at(i).at(2)) {
      ans = "Yes";
    }
  }
  for (int i = 0; i < 3; i++) {
    if (a.at(0).at(i) == a.at(1).at(i) && a.at(1).at(i) == a.at(2).at(i)) {
      ans = "Yes";
    }
  }
  if (a.at(0).at(0) == a.at(1).at(1) && a.at(1).at(1) == a.at(2).at(2)) {
    ans = "Yes";
  }
  if (a.at(0).at(2) == a.at(1).at(1) && a.at(1).at(1) == a.at(2).at(0)) {
    ans = "Yes";
  }
  cout << ans <<endl;
}


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

int tot = 199999, cnt = 0;

int Operator1(int x, int y, int z = tot) {
	cnt++;
	if (z == tot) tot--;
	cout << "< " << x << " " << y << " " << z << endl;
	return z;
}

int Operator2(int x, int y, int z = tot) {
	cnt++;
	if (z == tot) tot--;
	cout << "+ " << x << " " << y << " " << z << endl;
	return z;
}

int A = 0, B = 1, zero = 3, ONE;

int get_A(int one, int A) {
	vector <int> pw; pw.push_back(one);
	for (int i = 1; i < 30; i++) {
		int x = Operator2(pw.back(), pw.back());
		pw.push_back(x);
	}
	int ans = tot--;
	for (int i = 29; i >= 0; i--) {
		int x = Operator2(pw[i], ans);
		x = Operator1(x, A);
		x = Operator2(x, one);
		x = Operator1(ONE, x);
		for (int j = 0; j < i; j++) {
			Operator2(x, x, x);
		}
		Operator2(ans, x, ans);
	}
	int x = Operator1(zero, A);
	x = Operator2(x, one), x = Operator1(ONE, x);
	Operator2(x, ans, ans);
	return ans;
}

int main () {
//	freopen("code.lan", "w", stdout);
	cout << "20182" << endl;
	ONE = Operator1(zero, Operator2(A, B));
	vector <int> pw;
	int lst = ONE; pw.push_back(ONE);
	for (int i = 1; i <= 30; i++) {
		int x = Operator2(lst, lst);
		pw.push_back(x), lst = x;
	}
	int cur = tot--, ans = 2;
	for (int i = 29; i >= 0; i--) {
		int x = Operator2(cur, pw[i]);
		x = Operator1(x, B);
		int y = get_A(x, A);
		for (int j = 0; j < i; j++) {
			Operator2(x, x, x);
			Operator2(y, y, y);
		}
		Operator2(cur, x, cur), Operator2(ans, y, ans);
	}
	int x = get_A(Operator1(zero, B), A);
	Operator2(ans, x, ans);
	return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int R;
	cin >> R;
	if (R<1200){
		cout << "ABC" << endl;
	}else if(R<2800){
		cout << "ARC" << endl;
	}else{
		cout << "AGC" << endl;
	}
}

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

int main(void){
  int S;
  cin>>S;
  if(S%100>0&&S%100<13){
    if(S/100>0&&S/100<13)cout<<"AMBIGUOUS";
    else cout<<"YYMM";
  }
  else{
    if(S/100>0&&S/100<13)cout<<"MMYY";
    else cout<<"NA";
  }
}

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

int main() {
  int N; cin >> N;
  int x[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  int score = 1e9;
  for (int p = 0; p <= 100; p++) {
    int s = 0;
    for (int i = 0; i < N; i++) {
      s += (x[i]-p)*(x[i]-p);
    }
    score = min(s, score);
  }
  cout << score << endl;
}
    

Measured memory_bytes: 256
#A

a, b, c = map(int, input().split())
print(min(b//a, c))

#B
"""
a, b, k = map(int, input().split())
for i in range(1,max(a, b)+1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
             print(i)
"""

Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] sca = s.toCharArray();
        String t = sc.next();
        char[] tca = t.toCharArray();
        Arrays.sort(sca);
        Arrays.sort(tca);
        String ss = new String(sca);
        String tt = new String(tca);
        int tttt = tt.length();
        int cnt = ss.length() < tt.length() ? ss.length() : tt.length();
        int flag = 0;
        for (int i = 0; i < cnt; i++) {
            if (sca[i] < tca[tttt - 1 - i]) {
                flag = 1;
                break;
            } else if (sca[i] > tca[tttt - 1 - i]) {
                flag = -1;
                break;
            }
        }
        if (flag == 0) {
            if (cnt == ss.length() && cnt != tt.length()) {
                flag = 1;
            } else {
                flag = -1;
            }
        }
        if (flag == 1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 23508
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;

void flip( vector<int>& v ) {
	reverse( v.begin(), v.end() );
	for(int i=1; i<v.size(); i+=2) {
		v[i] *= -1;
	}
}

int main() {
	int n;
	while(cin >> n, n) {
		vector<int> lines[51];
		rep(dn, n+1) {
			int m, px, py, ppx, ppy;
			cin >> m >> ppx >> ppy >> px >> py;
			lines[dn].push_back(abs(px-ppx)+abs(py-ppy));
			rep(i, m-2) {
				int x, y;
				cin >> x >> y;
				int cross = (x-px)*(py-ppy) - (y-py)*(px-ppx);
				lines[dn].push_back(cross>0 ? 1 : -1);
				lines[dn].push_back(abs(x-px)+abs(y-py));
				ppx=px; ppy=py;
				px=x;   py=y;
			}
		}
		for(int i=1; i<=n; i++) {
			if(lines[0] == lines[i]) {
				cout << i << endl;
			} else {
				flip(lines[i]);
				if(lines[0] == lines[i]) {
					cout << i << endl;
				}
			}
		}
		cout << "+++++" << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

void Debug(const vector<ll>& x, string name) {
  return;
  cerr << name << endl;
  for (ll t : x) cerr << t << "\t";
  cerr << endl;
  cerr << endl;
}

int main()
{
  ll x, y, r, g, b;
  cin >> x >> y >> r >> g >> b;
  vector<ll> A(r);
  vector<ll> B(g);
  vector<ll> C(b);
  for (ll i = 0; i < r; ++i) cin >> A[i];
  for (ll i = 0; i < g; ++i) cin >> B[i];
  for (ll i = 0; i < b; ++i) cin >> C[i];

  Debug(A, "A");

  sort(A.rbegin(), A.rend());
  A.resize(x);

  Debug(A, "A");

  sort(B.rbegin(), B.rend());
  B.resize(y);

  Debug(B, "B");

  sort(C.rbegin(), C.rend());
  if (C.size() > x + y) C.resize(x + y);

  Debug(C, "C");

  for (ll t : B) A.push_back(t);

  Debug(A, "A");

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

  Debug(A, "A");

  ll sum = 0;
  for (ll t : A) sum += t;

  //cerr << "sum = " << sum << endl;
  ll result = sum;

  for (int i = 0; i < C.size(); ++i) {
    sum -= A[i];
    sum += C[i];
    //cerr << "  sum = " << sum << endl;
    result = max(result, sum);
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int R = scan.nextInt();

		if(N >= 10) {
			System.out.println(R);
		}else {
			System.out.println(R +  100 * (10 - N));
		}

	}

}

Measured memory_bytes: 23380
// 解き直し.
// https://img.atcoder.jp/aising2020/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vvi = vector<vector<int>>;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back

int main(){
    
    // 1. 入力情報.
    int T;
    scanf("%d", &T);
    
    // 2. 各テストケース回答.
    rep(i, T){
        // 2-1. テストケース取得.
        int N;
        scanf("%d", &N);
        
        // 2-2. ラクダの情報を保存.
        int K, L, R;
        LL ans = 0;
        vvi rCamel(N + 1), bCamel(N + 1);
        rep(j, N){
            scanf("%d %d %d", &K, &L, &R);
            
            // 最小値を加算.
            ans += (LL)min(L, R);
            
            // ラクダの情報を, Kごとに分けて保存.
            if(L < R) bCamel[K].pb(R - L);
            else      rCamel[K].pb(L - R);
        }
        
        // 2-3. 赤いラクダの追加, 削除 を 繰り返す.
        priority_queue<int, vector<int>, greater<int>> rPQ; // 赤いラクダたちの集合.
        repx(j, 1, N + 1){
            // 追加.
            for(auto &p : rCamel[j]) rPQ.push(p);
            // 削除.
            while(rPQ.size() > j) rPQ.pop();
        }
        
        // 2-4. 青いラクダの追加, 削除 を 繰り返す.
        priority_queue<int, vector<int>, greater<int>> bPQ; // 青いラクダたちの集合.
        repr(j, N, 1){
            // 追加.
            for(auto &p : bCamel[j]) bPQ.push(p);
            // 削除.
            while(bPQ.size() > N - j) bPQ.pop();
        }
        
        // 2-5. うれしさの差分を追加.
        while(!rPQ.empty()) ans += (LL)rPQ.top(), rPQ.pop();
        while(!bPQ.empty()) ans += (LL)bPQ.top(), bPQ.pop();
        
        // 2-6. 出力.
        printf("%lld\n", ans);
    }
    return 0;
    
}


Measured memory_bytes: 18176
N = int(input())

fs = [0] * N
for i in range(2, N + 1):
    d = 2
    while i > 1:
        if i % d == 0:
            fs[d - 1] += 1
            i //= d
        else:
            d += 1

MOD = 10 ** 9 + 7
ans = 1
for f in fs:
    ans *= (f + 1)
    ans %= MOD

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define preeti ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f first
#define s second
#define SIZE 26 
const long double PI = 3.141592653589793238L;
int fac[2000005]={0};
void factorial(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=((i%MOD)*(fac[i-1]%MOD))%MOD;}
int power(int n,int m)
{int p=1;if(m==0)return 1;p=(power(n,m/2)%MOD);p=(p%MOD*p%MOD)%MOD;
return(m&1?((p%MOD*n%MOD)%MOD):(p%MOD));}
int ncr(int n,int r){return ((fac[n]*power(fac[r],MOD-2))%MOD*power(fac[n-r],MOD-2))%MOD;}

int main()
{
  preeti;
  ll n;
  cin>>n;
  if(n%1000==0)
  cout<<0<<"\n";
  else 
  {
    ll i=1;
    while(i*1000<n)
    {
      i++;
    }
    ll ans=(1000*i)-n;
    cout<<ans<<"\n";
  }
 
return 0;
}

Measured memory_bytes: 3620
#include <algorithm>  //min, max, sort, unique, fill
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>  //pair, swap,
#include <vector>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using VI = vector<ll>;
using VB = vector<bool>;
using VP = vector<P>;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) for (ll i = 0; i < (n); i++)

static const ll kIntMax = numeric_limits<ll>::infinity();
static const double kFloatMax = numeric_limits<double>::infinity();

vector<ll> vi;

int main() {
  ll x, a, b, c;
  int cnt = 0;
  cin >> a >> b >> c >> x;
  REP(i, a + 1)
  REP(j, b + 1) REP(k, c + 1) {
    if (i * 500 + j * 100 + k * 50 == x) cnt++;
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
dp=[[0]for i in range(n)]
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Measured memory_bytes: 17144