akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define rep(i,a,n) for(int (i)=a;(i)<(int)(n);(i)++)
#define rrep(i,a,n) for(int (i)=(n)-1;(i)>=a;(i)--)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

const int INF = 1e9;

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

	rep(i,1,n+1) {
			stringstream s;
			s << i;
			if (i % 3 == 0 or s.str().find("3") != string::npos) {
					cout << " " << i;
			}
	}
	cout << endl;
}

Measured memory_bytes: 3180
#include<bits/stdc++.h>
#include<math.h>
#include<string.h>
#include<set>
#include<algorithm>
using namespace std;

int main(){
	int c[9];
	for(int i=0;i<9;++i)cin>>c[i];

	int minA = 101,minB = 101,minC = 101;
	for(int i=0;i<3;++i){
		minA = min(minA,c[i]);
	}
	for(int i=3;i<6;++i){
		minB = min(minB,c[i]);
	}
	for(int i=6;i<9;++i){
		minC = min(minC,c[i]);
	}

	for(int i=0;i<3;++i){
		c[i] -= minA;
	}
	for(int i=3;i<6;++i){
		c[i] -= minB;
	}
	for(int i=6;i<9;++i){
		c[i] -= minC;
	}

	int flag = 0;
	if(c[0] == c[3] and c[3] == c[6])++flag;
	if(c[1] == c[4] and c[4] == c[7])++flag;
	if(c[2] == c[5] and c[5] == c[8])++flag;
	if(flag == 3)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X = 1;
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    if (X * 2 > X + K) {X += K;}
    else {X *= 2;}}
  cout << X << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(){
    long n;
    long a[500001];
    long ans[500001];
    scanf("%ld",&n);
    for(int i = 2; i <= n; i++) scanf("%ld",&a[i]);
    
    for(int i = 2; i <= n; i++){
        ans[a[i]]++;
    }
    
    for(int i = 1; i <= n; i++) printf("%ld\n",ans[i]);
    return 0;
}


Measured memory_bytes: 4868
#include <bits/stdc++.h>
 
    using namespace std;
 
    typedef long long ll;
    typedef long double ld;
 
    typedef pair<int, int> pi;
    typedef pair<ll,ll> pl;

    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pi> vpi;
    typedef vector<pl> vpl;
    typedef vector<vi> vvi;

    #define FOR(i, a, b) for (int i=a; i<(b); i++)
    
    #define sz(x) (int)(x).size()
    #define mp make_pair
    #define pb push_back
    #define f first
    #define s second
    #define lb lower_bound
    #define ub upper_bound
    #define all(x) x.begin(), x.end()
 
    template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
    template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
    
    #define trav(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
 
    const int MOD = 1000000007;
    const char nl = '\n';
 
    int main() 
    {
        ios_base::sync_with_stdio(0); cin.tie(0);
        int a,b,c,k;cin>>a>>b>>c>>k;
        
        ll sum=0;

        while(k)
        {
            while(a and k)
            {
                sum+=1;
                k--;
                a--;
            }
            while(b and k)
            {
                k--;
                b--;
            }
            while(c and k)
            {
                sum-=1;
                k--;
                c--;
            }

        }

        cout<<sum;
    }


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll x, k, d; cin >> x >> k >> d;
    x = abs(x);
    if(x/d - k >= 0){
        cout << x - k*d << endl;
    }else{
        if(k%2 == (x/d)%2){
            cout << x%d << endl;
        }else{
            cout << abs(x%d - d) << endl;
        }
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7668
package main

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

func main() {
  sc := bufio.NewScanner(os.Stdin)

  sc.Scan()
  s := sc.Text()

  for i := 0; i < len(s) - 1; i++ {
    if s[i] == s[i + 1] {
      fmt.Println("Bad")
      os.Exit(0)
    }
  }

  fmt.Println("Good")

}




Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
void First(){
    cout << "first" << endl;
    exit(0);
}
void Second(){
    cout << "second" << endl;
    exit(0);
}
vector<ll>a;
int n;
int dp[100][100];
int dfs(int x,int y){
    if(dp[x][y]!=-1)return dp[x][y];
    bool flag = false;
    if(x>=1)flag |= dfs(x-1,y)==0;
    if(y>=1)flag |= dfs(x,y-1)==0;
    if(x>=1 and y>=1) flag |= dfs(x-1,y-1)==0;
    if(flag)return dp[x][y] = 1;
    else return dp[x][y] = 0;
}
//int main(){
//    cin >> n;
//    a.resize(n);
//    rep(i,n){
//        cin >> a[i];
//    }
//    sort(a.begin(),a.end());
//    rep(i,100)rep(j,100)dp[i][j] = -1;
//    dp[0][0] = 0;
//    rep(i,10){
//        show(i);
//        rep(j,10){
//            cout << dfs(i,j) << " ";
//        }
//        cout << endl;
//    }
//}
int main(){
    int n;
    cin >> n;
    rep(i,n){
        int x;
        cin >> x;
        if(x%2){
            First();
        }
    }
    Second();
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int len = s.length();
		int index = 0;
		if(s.equals(t)) {
			System.out.println("Yes");
		}else {
			while(index < len) {
				s = s.substring(s.length()-1)+s.substring(0, s.length()-1);
				if(s.equals(t)) {
					System.out.println("Yes");
					return;
				}else {
					index++;
				}
			}
		}
		if(index == len) {
			System.out.println("No");
		}
	}
}


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

namespace AtCoder._20190209みんプロ
{
    class A
    {

        static List<int> Convert(IEnumerable<string> str)
        {
            var res = new List<int>();
            foreach (var i in str)
            {
                var data = int.Parse(i);
                res.Add(data);
            }
            return res;
        }

        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var result = Solve(Convert(input));
            Console.WriteLine(result);

        }

        static string Solve(List<int> data)
        {
            var N = data[0];
            var K = data[1];
            int value = 0;
            for (var i = 1; i <= N; i += 2)
            {
                value++;
            }
            if (value >= K)
            {
                return "YES";
            }
            else
            {
                return "NO";
            }
        }

    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, -1, 0, 1 };
int main(){
	int w, h;
	while( cin >> w >> h && w && h ){
		int maze[65][65];
		// 周りと壁の交点を１にする
		for( int i = 0; i < h * 2 + 1; i++ ){
			for( int j = 0; j < w * 2 + 1; j++ ){
				if( i == 0 || j == 0 ){
					maze[i][j] = 1;
				}else if( i % 2 == 0 && j % 2 == 0 ){
					maze[i][j] = 1;
				}else if( i == h * 2 || j == w * 2 ){
					maze[i][j] = 1;
				}else if( i % 2 == 1 && j % 2 == 1 ){
					maze[i][j] = 0;
				}else{
					int wall;
					cin >> wall;
					maze[i][j] = wall;
				}
			}
		}
		// 探索
		queue< P > que;
		que.push( P(1, 1) );
		maze[1][1] = 1;
		while( !que.empty() ){
			for( int i = 0; i < 4; i++ ){
				int x = que.front().first + dx[i];
				int y = que.front().second + dy[i];
				if( maze[x][y] == 0 ){
					que.push( P( x, y ) );
					maze[x][y] = maze[que.front().first][que.front().second] + 1;
				}
			}
			if( que.front().first == h * 2 - 1 && que.front().second == w * 2 - 1 ){
				break;
			}
			que.pop();
		}
		cout << (maze[h * 2 - 1][w * 2 -1] + 1) / 2 << endl;
	}
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
    int q, com, x;
    string key;
    multimap<string, int> M;
    cin >> q;
    
    rep(i, q)
    {
        cin >> com;
        
        if (com == 0)
        {
            cin >> key >> x;
            M.insert(make_pair(key, x));
        }
        else if (com == 1)
        {
            cin >> key;
            map<string, int>::iterator st, en;
            st = M.lower_bound(key);
            en = M.upper_bound(key);
            for(; st != en; st++){
				cout << st->second << endl;
			}
		}
        else if (com == 2)
        {
            cin >> key;
            M.erase(key);
        }
        else
        {
            string L, R;
            cin >> L >> R;
            map<string, int>::iterator st, en;
            st = M.lower_bound(L);
            en = M.upper_bound(R);
            for(; st != en; st++){
				cout << st->first << ' ' << st->second << endl;
			}
        }
    }
}



Measured memory_bytes: 24768
/*
* @author:  codancer
*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define pb push_back
#define SZ(x) ((int)(x).size())
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
typedef vector<int> VI;
typedef pair<int,int> pii;
int main(){
	ll n,m;
	cin>>n>>m;
	cout<<(n*(n-1)/2+m*(m-1)/2)<<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 rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

    ll ans = 0;
    for (ll x = 1; x * x <= n; x++) {
        if (n % x == 0) {
            ll m = n / x - 1;
            if (x < m) ans += m;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 10;
int N, D, X[Nmax][Nmax];

int main(){
	cin >> N >> D;
	for(int i=0; i<N; i++){
		for(int j=0; j<D; j++){
			cin >> X[i][j];
		}
	}

	int ans = 0;
	for(int i=0; i<N; i++){
		for(int j=i+1; j<N; j++){
			int d = 0;
			for(int k=0; k<D; k++){
				d += (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
			}

			int dsq = sqrt(d);
			for(int k=dsq-2; k<dsq+3; k++){
				if(k*k==d){
					ans++;
					break;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
m = 0
t0, a0 = 1, 1
for i in range(n):
    t, a = nm()
    m = max((a0 + a - 1) // a, (t0 + t - 1) // t)
    a0 = a * m
    t0 = t * m
print(a0 + t0)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)(x).size())
#define mset(a,v) memset(a,v,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))
using namespace std;
typedef long long ll;

int n;
char s[64];
map<string,int> w,w2;

void doit(map<string,int>& w){
	fore(i,0,1<<n){
		string a="",b="";
		fore(j,0,n){
			if(i&(1<<j))a.pb(s[j]);
			else b.pb(s[j]);
		}
		w[a+'#'+b]++;
	}
}

int main(){
	scanf("%d%s",&n,s);
	doit(w);
	reverse(s,s+2*n);
	doit(w2);
	ll r=0;
	for(auto p:w)r+=1LL*p.snd*w2[p.fst];
	printf("%lld\n",r);
	return 0;
}

Measured memory_bytes: 83584
#include<bits/stdc++.h>
using namespace std;
int digits(int x){
	int cnt=0;
	while(x){
		cnt++;
		x/=10;
	}
	return cnt;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++){
		if(digits(i)&1) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//最大公約数
long long mygcd(long long a, long long b) {
  if (a < b) std::swap(a, b);
  long long r = a % b;
  while (r) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

//a^n mod p
//n > 0
//#include <cmath>
long long modpow(long long a, long long n, long long p) {
  a %= p;
  if (a == 0) return 0;
  if (a == 1) return 1;
  long long b = 1, cnt = 0;
  while (b < p && cnt < n) {
    b *= a;
    cnt++;
  }
  if (b < p) return b;
  b %= p;
  return modpow(b, n / cnt, p) * (long long)pow(a, n % cnt) % p;
}

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

	ll n;
	cin >> n;
	vll a(n);
	for (ll i = 0; i < n; i++) cin >> a[i];

	vector<vll> dp(n, vll(2));
	//a[i]まで，j:切り捨て，切り上げ，k:値，自身を含むかどうか
	dp[0][0] = 0;
	dp[0][1] = a[0];
	dp[1][0] = max(a[0], a[1]);
	dp[1][1] = max(a[0], a[1]);

	vll v(n);
	v[0] = a[0];
	for (ll i = 2; i < n; i += 2) v[i] = v[i - 2] + a[i];

	for (ll i = 2; i < n; i++) {
		if (i % 2 == 0) {
			dp[i][0] = max(dp[i - 1][1], dp[i - 2][0] + a[i]);
			dp[i][1] = v[i];
		}
		else {
			dp[i][0] = max(dp[i - 1][1], dp[i - 2][0] + a[i]);
			dp[i][1] = dp[i][0];
		}
	}
	cout << dp[n - 1][0] << endl;
}


Measured memory_bytes: 17316
#include <stdio.h>
#include <string.h>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>
#include <string>
#include <math.h>

using namespace std;


int main() {

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

  char tab[10000];

  scanf("%s", &tab);

  string s(tab);

  if (s.size() > k) {
    s = s.substr(0, k) + "...";
  }

  printf("%s", s.c_str());

  return 0;
}


Measured memory_bytes: 3340
import java.util.Scanner;

public class Main {

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

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i=0;i<n;i++)h[i] = Integer.parseInt(sc.next());
		sc.close();

		int max = 0;int cnt = 0;
		for(int i=0;i<n;i++) {
			if(h[i]>=max) {
				cnt ++;
				max = h[i];
			}
		}

		System.out.println(cnt);
	}

}

Measured memory_bytes: 21588
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll X;
    cin >> X;

    ll sum = 0;
    FOR(i, 1, X + 1)
    {
        if (sum >= X)
        {
            cout << i - 1 << endl;
            break;
        }
        sum += i;
    }

    return 0;
}


Measured memory_bytes: 3152
///貪欲でやっても自炊は何回それまでに自炊したかによって幸福度が決まるので、無理
//ヒント、k回自炊したとしたら、ということは、
//k回自炊すると仮定すれば、自炊による幸福度の数は決まる
//k回で仮定して前から順に埋めてけばいいんじゃね
//それではダメか、どのタイミングで自炊したかも必要かも
//自炊だけか、食堂だけか、どうすれば良いのかわからない
#include<iostream>
#include<algorithm>
#include<utility>
#include<numeric>
using namespace std;

bool compare_happiness(const pair<long long,long long> x,const pair<long long,long long> y){
  return x.second < y.second;
}

int main(){
  long long N,P,Q;
  pair<long long,long long> C[500000+10];
  cin >> N >> P >> Q;
  for(int i=0;i<N;i++){
    long long c;
    cin >> c;
    C[i].first=i+1;//何日目か
    C[i].second=c+(i+1)*P;//
  }
  sort(C,C+N,compare_happiness);
  long long a1=0;//sum_pairs(C,N,P);//そこまででmaxのものを保存
  long long a2=0;//sum_pairs(C,N,P);//ここに順に足していく
  for(int i=0;i<N;i++){
    a2+=(Q-C[i].first+2*i+1)*P;
    a1=max(a1+C[i].second-C[i].first*P,a2);
  }
  cout << a1 << endl;
  //int型では色々だめ
  //本質的じゃなくないですか
}



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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){
  int n;
  string s1, s2;
  cin >> n >> s1 >> s2;
  vector<bool> isVertical;
  ll tmp = 1000000007;
  for (int i = 0; i < n; i++) {
    if(s1[i] == s2[i]){
      isVertical.push_back(true);
    }
    else{
      isVertical.push_back(false);
      i++;
    }
  }
  ll res;
  if(isVertical[0]) res = 3;
  else res = 6;


  int vsize = int(isVertical.size());

  for (int i = 1; i < vsize; i++) {
    if(!isVertical[i] && !isVertical[i-1]) res *= 3;
    else if(!isVertical[i-1] && isVertical[i]) res *= 1;
    else if(isVertical[i-1] && isVertical[i]) res *= 2;
    else res *= 2;
    res %= tmp;
  }

  cout << res << endl;

}


Measured memory_bytes: 256
import numpy as np

N = int(input())
grid = np.zeros((2, N),dtype="int")
for i in range(2):
    grid[i] = np.array([int(x) for x in input().split()])

candy_sums = np.zeros((2, N), dtype="int")
for i in range(2):
    for n in range(N):
        candy_sums[i,n] += grid[i,n]
        if (n-1) >= 0 & (i-1) >= 0:
            candy_sums[i,n] += max(candy_sums[i-1,n], candy_sums[i,n-1])
        elif (i-1) >= 0:
            candy_sums[i,n] += candy_sums[i-1, n]
        elif (n-1) >=0:
            candy_sums[i,n] += candy_sums[i, n-1]
            
print(candy_sums[1,N-1])

Measured memory_bytes: 22564
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<n-1;i++){
			System.out.print(a[n-1-i]+" ");
		}
		System.out.print(a[0]);
		System.out.println();
	}	
}

Measured memory_bytes: 26376
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll solve (ll i, ll x) {
    if (i == 1) {
        return max((ll)0, 5 * x);
    } else {
        return max((ll)0, (2 * i + 1) * x);
    }
}

int main() {
    ll N, X;
    cin >> N >> X;
    ll x[N];
    for (int i = 0; i < N; i++) {
        cin >> x[i];
    }
    ll sum[N + 1];
    sum[0] = 0;
    for (int i = 1; i < N + 1; i++) {
        sum[i] = sum[i - 1] + x[i - 1];
    }
    ll ans = llmax;
    for (int k = 1; k <= N; k++) {
        ll tmp = 0;
        bool ok = true;
        for (int i = 1; i <= (N + k - 1) / k; i++) {
            ll xtop = N - 1 - (i - 1) * k;
            ll xbot = max(N - 1 - i * k + 1, (ll)0);
            ll tmpsum = sum[xtop + 1] - sum[xbot];
            ll tmpe = solve(i, tmpsum);
            if (tmpe == 0) {
                ok = false;
            }
            tmp += tmpe;
            if (tmpe < 0) {
                ok = false;
            }
        }
        ll ansnum = tmp + (N + k) * X;
        if (ansnum < 0) {
            ok = false;
        }
        //cout << ansnum << endl;
        if (ok && ansnum < ans) {
            ans = ansnum;
        }
    }
    cout << ans << endl;
}


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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

//int mex(vi a)
//{
//	sort(all(a));
//	a.erase(unique(all(a)),end(a));
//	rep(i,a.size()) if(a[i]!=i) return i;
//	return a.size();
//}

//int grundy(int x,int k,map<int,int>& memo)
//{
//	if(memo.count(x))
//		return memo[x];
//	if(x<k)
//		return memo[x]=0;
//	vi a;
//	for(int i=1;i<=x/k;i++)
//		a.push_back(grundy(x-i,k,memo));
//	return memo[x]=mex(a);
//}

int grundy(int x,int k)
{
	if(x<k) return 0;
	if(x%k==0) return x/k;
	int d=x/k+1;
	int m=max(x%k/d,1);
	return grundy(x-d*m,k);
}

void test()
{
	for(int k=1;k<=20;k++){
		for(int x=0;x<=30;x++)
			printf("%3d",grundy(x,k));
		cout<<endl;
	}
}

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi gs(n);
		rep(i,n){
			int a,k; cin>>a>>k;
			gs[i]=grundy(a,k);
		}
		cout<<(accumulate(all(gs),0,bit_xor<int>())?"Takahashi":"Aoki")<<endl;
	}
}


Measured memory_bytes: 384
import java.io.*;
import java.math.*;
import java.util.*;
public class Main{

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int T = 1;
		for (int i = 1; i <= T; i++) {
			int X = input.nextInt();
			int cur = X;
			int ans = 1;
			while (cur%360!=0) {
				cur+=X;
				cur%=360;
				ans++;
			}
			System.out.println(ans);
		}
	}
}

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

	int d;
	cin >> d;
	int c[26];
	int i, j;
	for (i = 0; i < 26; i++) {
		cin >> c[i];
	}
	int s[365][26];
	for (i = 0; i < d; i++) {
		for (j = 0; j < 26; j++) {
			cin >> s[i][j];
		}
	}
	int last[26];
	for (i = 0; i < 26; i++) {
		last[i] = 0;
	}
	int jmax, jindex;
	for (i = 0; i < d; i++) {

		jmax = 0;
		jindex = -1;
		for (j = 0; j < 26; j++) {
			if (c[j] *(i - last[j]) > jmax) {
				jmax = c[j] *(i - last[j]);
				jindex = j;
			}
			else if (c[j] *(i - last[j]) == jmax) {
				if (s[i][j] > s[i][jindex]) {
					jindex = j;
				}
			}
		}
		last[jindex] = i;
		cout << jindex + 1 << endl;
		


	}
	return 0;


}

Measured memory_bytes: 3672
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, K: int, p: "List[int]"):
    ans = 0
    # for i in range(max(1,N),N):
    #     t = p[i]*(p[i]+1)/(2*p[i])
    #     print(t)
    #     ans += t
    pi = [p[i]*(p[i]+1)/(2*p[i]) for i in range(N)]
    api = [0] * (N+1)
    for i in range(N):
        api[i+1] = api[i] + pi[i]
    ans = 0
    for i in range(0, N-K+1):
        ans = max(ans, api[K+i]-api[i])

    print(ans)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 37260
from collections import deque


n = int(input())
e = {}
for i in range(n-1):
    u,v,w = map(int,input().split())
    if u not in e:
        e[u] = [[v,w]]
    else:
        e[u].append([v,w])

    if v not in e:
        e[v] = [[u,w]]
    else:
        e[v].append([u,w])


que = deque()
que.append([1,0,0])
ans = [-1 for i in range(n)]
ans[0] = 0
no_one = True
flag = True
while True:
    if len(que) == 0:
        break
    top = que.popleft()
    st = top[0]
    for edge in e[st]:
        ecos = edge[1]
        nex = edge[0]
        if ans[nex-1] == -1:
            cos0 = top[1]+ecos
            cos1 = top[2]+ecos

            if cos0 %2 == 0:
                que.append([nex,0,cos1])
                ans[nex-1] = 0
            elif cos1 %2 == 0:
                que.append([nex,cos0,0])
                ans[nex-1] = 1
            else:
                if no_one:
                    que.append([nex, cos0, 0])
                    ans[nex - 1] = 1
                else:
                    flag = False
                    break

    if not flag:
        break
    # print(que)

for a in ans:
    print(a)
# print(ans)

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

const int N = 100003;
int n, m, head[N], to[N << 1], nxt[N << 1] ,dfn[N], tim;
inline void add(int a, int b)
{
	static int cnt = 0;
	to[++ cnt] = b; nxt[cnt] = head[a]; head[a] = cnt;
}
inline int dfs(int x, int f)
{
	dfn[x] = ++ tim;
	int v = 0;
	for(int i = head[x];i;i = nxt[i]) if(to[i] != f){
		if(!dfn[to[i]])
        {
			int val = dfs(to[i], x);
			if(val) printf("%d %d\n", x, to[i]);
			else printf("%d %d\n", to[i], x);
			v ^= val;
		}
      	else 
      	{
			if(dfn[to[i]] < dfn[x]) continue;
			printf("%d %d\n", x, to[i]);
			v ^= 1;
	  	}
	}
	return 1 - v;
}
int main()
{
	cin >> n >> m;
	if(m & 1)
      return cout << -1 , 0;
	
 	for(int i = 1;i <= m;i ++)
    {
		int a, b;
		cin >> a >> b;
		add(a, b); add(b, a);
	}
	dfs(1, 0);
}

Measured memory_bytes: 6528
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

int main(void){
    ll x;
    cin>>x;
    ll a = 100;
    ll day = 0;
    while(a<x){
        day++;
        a = a+a/100;
    }
    cout<<day<<endl;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int combination (int x, int y);
int main(){
  int n,m;
  cin>> n >> m;
  int ans;
  ans = combination(n,2) + combination(m,2);
  cout << ans << endl;
}
int combination (int x, int y)
{
  if(x == 1){
    return(0);
  }
  int c = 1;
  for(int i = x; i > x-y; i--){
    c *= i;
  }
  for(int i = 1; i < y + 1; i++){
    c /= i;
  }
  return(c);
}

  

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


int main(void){
  int N;
  cin >> N;
  int ans = 0;
  int num = 0;

  for(int i=0; i<=N; i++){
    int a = i;
    int ctn = 0;
    while(1){
      if(a%2 != 0 || a == 0)break;
      a /= 2;
      ctn++;
    }
    
    if(num < ctn) {
      num = ctn;
      ans = i;
    }
  }

  if(ans <= 0) cout << 1 << endl;
  else cout << ans << endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>

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

int main() {
  int n;
  std::cin >> n;
  int a[n][n];
  rep(i, n) rep(j, n) a[i][j] = 0;

  rep(i, n) {
    int u, k, v;
    std::cin >> u >> k;
    rep(j, k) {
      std::cin >> v;
      a[u - 1][v - 1] = 1;
    }
  }

  rep(i, n) {
    rep(j, n) {
      if (j) std::cout << ' ';
      std::cout << a[i][j];
    }
    std::cout << '\n';
  }
  return 0;
}



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

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

    int n, m;
    cin >> n >> m;

    dsu d = dsu(n);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        d.merge(--a, --b);
    }

    int ans = -1;
    for (int i = 0; i < n; i++)
    {
        if (d.leader(i) == i)
            ans++;
    }
    cout << ans << '\n';
    return 0;
}


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

using namespace std;

int abs(int x) {
  if(x < 0) {
    return (-1) * x;
  }
  else {
    return x;
  }
}

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

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

  cout << sum - abs(a[0]) - abs(a[1] - a[0]) + abs(a[1]) << endl;
  for(int i = 1; i < n - 1; i++) {
    long long tmp = sum;
    tmp = tmp - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1]);
    cout << tmp << endl;
  }
  cout << sum - abs(a[n - 1] - a[n - 2]) - abs(a[n - 1]) + abs(a[n - 2]) << endl;
}

Measured memory_bytes: 1664
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        List<int> a = Console.ReadLine().Split().Select(i => int.Parse(i)).ToList();

        int ans = a[0];
        for (int i = 1; i < n; i++)
        {
            ans = Gcd(ans, a[i]);
        }
        Console.WriteLine(ans);
    }

    static int Gcd(int a, int b)
    {
        while (b != 0)
        {
            int r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
}

Measured memory_bytes: 19296
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<LL> D(LL n) {
	vector<LL> ans;
	for(LL x=2;x*x<=n;x++){
		if(n%x==0){
			ans.push_back(x);
			if(x*x!=n) {
				ans.push_back(n/x);
			}
		}
	}
	if (n > 1) ans.push_back(n);
	return ans;
}
LL n;
int main() {
	cin >> n;
	vector<LL> f1 = D(n);
	LL ans = 0;
	for (auto k: f1) {
		LL t = n; 
		while (t % k == 0) t /= k;
		if (t%k==1) {
			//printf("# %lld\n", k);
			ans++;
		}
	}

	vector<LL> f2 = D(n-1);
	ans += f2.size();
	cout << ans << endl;
}
/*


n-1, divs, not n's div


n = k^p * (1+qk) 
*/

Measured memory_bytes: 384
// written by : soumya_27
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define mod ((int)1e9+7)//998244353//((int)1e18+7)
#define M_PI 3.14159265358979323846
// #define maxx ((int)1e7+7)
#define pb push_back
#define ins insert
#define F first
#define S second
#define ins insert
#define pii pair <int , int>
#define lb lower_bound
#define ub upper_bound
#define usefile freopen("input.txt","r",stdin); freopen("ou(tp)ut.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test int t; cin >> t; while(t--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
int exp(int x,int y,int p){ int res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int add(int a, int b) {return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)     
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
using namespace std;
int fact[1000006];
// void facto() {fact[0] = 1; for(i=1 ; i<1000006 ; i++) fact[i] = mul(fact[i-1], i);}
// int ncr(int n, int r) { int res = fact[n]; res = mul(res, inv(fact[r])); res = mul(res, inv(fact[n-r])); return res;}
void solve()
{
    fast
    // test
    {
        int n, i, j, k, c = 0;
        cin >> n;
        string s;
        cin >> s;
        int l=0, r=n-1;
        while(l<r)
        {
        	while(l<n && s[l] == 'R')
        		l++;
        	while(r>=0 && s[r] == 'W')
        		r--;
        	if(l < r)
        		c++;
        	l++;
        	r--;
        }
        cout << c << "\n";
    }
}

signed main()
{
    // time__("solve")
    {
        solve();
    }
    return 0;
}

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

using namespace std;
typedef long long int ll;

ll A[81][81];
ll B[81][81];
ll D[81][81];
bool dp[81][81][6600];

int main() {

    ll H, W; cin >> H >> W;
 
    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            cin >> A[i][j];
        }
    }

    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            cin >> B[i][j];
            D[i][j] = abs(A[i][j] - B[i][j]);
        }
    }

    //初期化
    dp[0][0][D[0][0]] = true;

    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            for(ll k = 0; k < 6500; k++){
                if(dp[i][j][k]){
                    dp[i][j+1][abs(k - D[i][j+1])] = true;
                    dp[i][j+1][abs(k + D[i][j+1])] = true;
                    
                    dp[i+1][j][abs(k - D[i+1][j])] = true; 
                    dp[i+1][j][abs(k + D[i+1][j])] = true;
                     
                }
            }
        }
    }

    for(ll k = 0; k < 6500; k++){
        if(dp[H-1][W-1][k]){
            cout << k << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 42496
#include <bits/stdc++.h>
using namespace std;
 
/*てんぷれぞーん！*/
//static const int INF = 2147483647;
static const int INF = 1000000000;
static const long long llINF = 9223372000000000000;
static const int NIL = -1;
static const int MOD = 1000000007;
typedef long long ll;
typedef pair<int,int> P;
struct edge {int to,cost;};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
/* t y p o っ て 知 っ て る ゥ ！ ？ */
#define itn int
#define scnaf scanf
#define reutnr return
/*必要に応じて使ってね*/
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll
//#define INF llINF

void debug(){
    //puts("unko\n");
}

signed main(){
    int n,m;
    scanf("%d%d",&n,&m);
    bool Tokyo[n][n];
    vector<int> K;
    for(int i=0;i<n;i++){   //初期化ループ
        if(i!=0) K.pb(i);
        for(int j=0;j<n;j++){
            Tokyo[i][j] = false;
        }
    }

    debug();

    for(int i=0;i<m;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        a--,b--;
        Tokyo[a][b] = Tokyo[b][a] = true;
    }

    debug();
    
    int ans = 0;

    if(n==2){
        if(Tokyo[0][1]){
            puts("1\n");
        } else {
            puts("0\n");
        }
        return 0;
    }

    if(Tokyo[0][K[0]]){
        for(int i=0;i<n-2;i++){
            if(!Tokyo[K[i]][K[i+1]]) break;
            else if(i == n-3) ans++;
        }
    }

    while(np(all(K))){
        if(Tokyo[0][K[0]]){
            for(int i=0;i<n-2;i++){
                if(!Tokyo[K[i]][K[i+1]]) break;
                else if(i == n-3) ans++;
            }
        }
    }
    debug();

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

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b,c,tyo,hisi;

	tyo = 0;
	hisi = 0;
	while(scanf("%d,%d,%d",&a,&b,&c) != EOF){
		if(a*a + b*b == c*c){
			tyo++;
		}else if(a == b){
			hisi++;
		}
	}

	printf("%d\n%d\n",tyo,hisi);

	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
map<int,int> m;
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		int k;
		cin >> k;
		m[k]++;
	}
	map<int,int>::iterator it;
	int ans = 0;
	for(it=m.begin();it!=m.end();it++){
		if((it->sec)%2==1)ans++;
	}	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,y; cin>>x>>y;
  if(y%2!=0)cout<<"No"<<endl;
  else
  {
      if(y%4==0)
      {
          if(x>=(y/4)&&x<=(y/2))cout<<"Yes"<<endl;
          else cout<<"No"<<endl;
      }
      else if(x>=((y/4)+1) && x<=(y/2))cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
  }
  
}

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

int main()
{
    int n;
    cin >> n;
    int r[n];

    for(int i = 0; i < n; i++){
        cin >> r[i];
    }

    long long int minr = r[0];
    long long int maxv = -1000000000;

    for(int j = 1; j <= n - 1; j++){
        if(maxv < r[j] - minr){
            maxv = r[j] - minr;
        }
        if(minr > r[j]){
            minr = r[j];
        }
    }
    cout << maxv << endl;
}


Measured memory_bytes: 3852
#include <iostream>

using namespace std;

typedef long long ll;

//0~aまでのxor
ll func(ll a) {
	if (a % 2 == 0) {
		if ((a / 2) % 2 == 0)
			return a;
		else
			return 1 ^ a;
	}
	else {
		if ((a / 2) % 2 == 0)
			return (a - 1) ^ a;
		else
			return 1 ^ (a - 1) ^ a;
	}
}

int main() {
	ll A, B;

	cin >> A >> B;

	ll ans;
	if (A > 0) ans = func(A - 1) ^ func(B);
	else ans = func(B);

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;




int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n);
	vector<int> h(n);
	for (int i = 0; i < n; i++)cin >> h[i];
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		bool ok = true;
		for (auto u : g[i]) {
			if (h[u] >= h[i])ok = false;
		}
		if (ok)ans++;
	}
	cout << ans;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll X; cin >> X;
  ll kosuu = X / 100;
  ll amari = X % 100;
  ll ans = amari / 5;
  amari -= amari / 5 * 5;
  ans += amari / 4;
  amari -= amari / 4 * 4;
  ans += amari / 3;
  amari -= amari / 3 * 3;
  ans += amari / 2;
  amari -= amari / 2 * 2;
  ans += amari;
  amari -= amari;
  if(ans <= kosuu)
  {
    fin(1)
  }
  else
  {
    fin(0)
  }
  
  return;
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 256