akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> e(N);
    using P = pair<int, int>;
    vector<P> edge(M);
    vector<vector<int>> start(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        e[a].push_back(b);
        edge[i] = {a, b};
        start[a].push_back(i);
    }
    vector<vector<bool>> ok(N, vector<bool>(N, false));
    for (int i = 0; i < N; i++) {
        queue<int> q;
        q.push(i);
        ok[i][i] = true;
        while (not q.empty()) {
            const int s = q.front();
            q.pop();
            for (const int to : e[s]) {
                if (ok[i][to]) { continue; }
                ok[i][to] = true;
                q.push(to);
            }
        }
    }
    vector<bool> ans(M);
    for (int i = 0; i < N; i++) {
        vector<int> dp(N, -1);  // -1: yet, M: doubled
        queue<int> q;
        for (const int c : start[i]) {
            dp[edge[c].second] = c;
            q.push(edge[c].second);
        }
        while (not q.empty()) {
            const int s = q.front();
            q.pop();
            if (s == i) { continue; }
            for (const int to : e[s]) {
                if (dp[to] == M or dp[to] == dp[s]) { continue; }
                if (dp[to] == -1) {
                    dp[to] = dp[s];
                    q.push(to);
                } else {
                    dp[to] = M;
                    q.push(to);
                }
            }
        }
        for (const int c : start[i]) {
            const bool ts = ok[edge[c].second][edge[c].first];
            const bool dst = dp[edge[c].second] == M;
            ans[c] = ts ^ dst;
        }
    }
    for (int i = 0; i < M; i++) { cout << (ans[i] ? "diff" : "same") << endl; }
    return 0;
}


Measured memory_bytes: 5888
import sys

l = []
for i in sys.stdin:
    l.append(i.split())

for i in range(0,len(l)):
    for j in range(0,len(l[i])):
        l[i][j] = int(l[i][j])

for i in range(1,len(l)):
    l[i].append(sum(l[i]))

result = []
for i in range(0,l[0][1]+1):
    count = 0
    for j in range(1,l[0][0]+1):
        count += l[j][i]
    result.append(count)
l.append(result)

for i in range(1,len(l)):
    for j in range(0,len(l[i])):
        print(l[i][j],end='')
        if j < len(l[i]) - 1:
            print(" ",end='')
    print()


Measured memory_bytes: 6800
#include <stdio.h>
#include <string.h>
int main(){
  int n,i,j,f=1;
  char s[100][11];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%s",s[i]);
  for(i=0;i<n-1;i++)for(j=i+1;j<n;j++)if(strcmp(s[i],s[j])==0)f=0;
  for(i=0;i<n-1;i++)if(s[i][strlen(s[i])-1]!=s[i+1][0])f=0;
  puts(f?"Yes":"No");
  return 0;
}

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

using namespace std;

int main(){
    string s,t;
    cin >> s;
    cin >> t;

    int count=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]!=t[i]){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3836
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different 
Yours Faithfully
Shobhit Yadav */

#include<bits/stdc++.h>
using namespace std;
#define ll long long 

ll N;
/*ll freq[200005];*/
void solve(){
	 /*memset(freq,0,sizeof(freq));*/
	map<string , int> stringmaps;
	cin>>N;
    string s;
    for(ll i = 0 ; i<N ; i++){
    	cin>>s;
    	stringmaps[s]++;
    }
    ll maximum = 0;
    for(const auto &x: stringmaps){
    	ll v;
        v =  x.second;
        if(v>maximum) maximum = v;
    }


    for(auto it = stringmaps.begin() ; it != stringmaps.end() ; it++){
    	if(it->second == maximum)
    		cout<<it->first<<'\n';
    }



}



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

	return 0;
}


Measured memory_bytes: 19240
using System;
using System.Collections.Generic;

namespace ABC119_B
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			List<long> xList = new List<long>(n);
			List<long> uList = new List<long>(n);
			string[] input;
			double sum = 0;
			double BTCrate = 380000.0;
			for (int index = 0; index < n; index++)
			{
				input = Console.ReadLine().Split();
				if (input[1] == "JPY")
					sum += int.Parse(input[0]);
				else
				{
					sum += double.Parse(input[0]) * BTCrate;
				}
			}

			Console.WriteLine(sum);
		}
	}
}

Measured memory_bytes: 11220
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//




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






int main() {

    
    string s; cin >> s;

    int cnt = 0;
    rep(i,3) {
        if (s[i] == 'o') ++cnt;
    }
    out(700 + 100 * cnt);
    


    return 0;
}






Measured memory_bytes: 888
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

vector<int> dp; // 頂点 i から始まるパスで最長のものの長さ
multimap<int, int> mp; // 入力値(from, to)

// 一番遠い場所を探す
inline int rec(int from) {
    if (dp[from] != 0) {
        return dp[from];
    }
    int res = 0;
    // キーを持つ値を列挙する
    auto p = mp.equal_range(from);
    for (auto it = p.first; it != p.second; ++it) {
        res = max(res, rec(it->second) + 1);
    }
    return dp[from] = res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, ans = 0;
    cin >> n >> m;
    dp.resize(n + 1, 0);
    for (int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        mp.emplace(x, y);
    }
    for (int i = 1; i <= n; i++) {
        if (dp[i] == 0) {
            ans = max(ans, rec(i));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define  fill(st,et,val,arr) for(int i=st;i<=et;i++)arr[i]=val;
#define all(v) v.begin(),v.end()
template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = ch == '-', ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}
 
const int M=1e9 + 7;
const int MAX=1e5+7;
using namespace std;
bool comp(int a,int b)
{	
	return a>b;
}
void printQ(vector<int> q)
{   
    cout<<"v->  ";
	for(int i=0;i<q.size();i++)
	{
		cout<<q[i]<<" ";
	}
	cout<<endl;
}
int solve(int h,int* a,int*  c,int n,vector<vector<int>>& dp)
{
	if(h<=0)
	{
		return 0;
	}
	if(n==0)
	{
		return INT_MAX;
	}
	if(dp[h][n]!=-1)
	{
		return dp[h][n];
	}
	//int ans=c[0]+solve(h-a[0],a+1,c+1);
	int ans=solve(h,a+1,c+1,n-1,dp);
	ans=min(ans,c[0]+solve(h-a[0],a,c,n,dp));
	ans=min(ans,c[0]+solve(h-a[0],a+1,c+1,n-1,dp));
	dp[h][n]=ans;
	return ans;
}
int32_t main() 
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector<pair<int,string>> v;
    map<string,int> mp;
    for(int i=0;i<n;i++)
    {
    	string s;
    	cin>>s;
    	mp[s]++;
	}
	int mx=0;
	for(auto it=mp.begin();it!=mp.end();it++)
	{
//		v.pb({it->second,it->first});
		mx=max(it->second,mx);
	}
	vector<string> ans;
	for(auto it=mp.begin();it!=mp.end();it++)
	{
//		v.pb({it->second,it->first});
		//mx=max(it->second,mx);
		if(mx==it->second)
		{
			ans.pb(it->first);
		}
	}
	sort(all(ans));
	for(string s:ans)cout<<s<<endl;
//	cout<<"APPROVED"<<endl;
	return 0;
}













Measured memory_bytes: 27504
import java.util.Scanner;

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

    int A = scanner.nextInt();
    int B = scanner.nextInt();
    int K = scanner.nextInt();
    for (int i = 0; i < K && A + i <= B; i++) System.out.println(A + i);
    for (int i = Math.max(0, A - B + 2 * K - 1); i < K; i++) System.out.println(B - K + i + 1);
  }
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;

bool knapsack(vector<ll> &cards, int i, ll k) {
    ll a = cards[i];
    int n = cards.size();
    vector<vector<bool>> dp(n + 1, vector<bool>(k + 1, false));
    dp[0][0] = true;

    auto set = [&](int y, ll x) -> bool {
        if (y > n) return false;
        if (x > k) return false;


        dp[y][x] = true;
        return false;
    };

    rep(y, n) {
        if (y == i) {
            dp[y + 1] = dp[y];
            continue;
        }
        rep(x, k + 1) {
            if (!dp[y][x]) continue;
            // y を使わない
            set(y + 1, x);
            // yを使う
            set(y + 1, cards[y] + x);
        }
    }

    for (int j = max(k - a, 0ll); j < k; j++) {
        if (dp[n][j]) return true;
    }

    return false;

}


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

    vector<ll> cards(n);
    rep(i, n) cin >> cards[i];

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

    int floor = 0, ceil = n - 1;

    if (knapsack(cards, floor, k)) {
        cout << 0 << endl;
        ret();
    }
    if (!knapsack(cards, ceil, k)) {
        cout << n << endl;
        ret();
    }

    while (floor + 1 < ceil) {
        int mid = (floor + ceil) / 2;
        bool b = knapsack(cards, mid, k);
        if (b) ceil = mid;
        else floor = mid;
    }

    assert(knapsack(cards, floor, k) == false);
    assert(knapsack(cards, ceil, k) == true);

    cout << floor + 1 << endl;

}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int H, W; cin >> H >> W;
  vector<vector<int>> c(10, vector<int>(10));
  rep(i, 10) cin >> c[i];
  rep(k, 10) rep(i, 10) rep(j, 10) {
    minimize(c[i][j], c[i][k] + c[k][j]);
  }
  vector<vector<int>> A(H, vector<int>(W));
  rep(i, H) cin >> A[i];
  int count = 0;
  rep(i, H) rep(j, W) {
    if (A[i][j] > -1 && A[i][j] != 1) {
      count += c[A[i][j]][1];
    }
  }
  cout << count << "\n";
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    long long int n,m;
    scanf("%lld %lld",&n,&m);
    long long int A[m];
    int i,sum=0;
    for(i=1;i<=m;i++)
    {
        scanf("%lld",&A[i]);
        sum=sum+A[i];
    }
    if(sum>n)
    {
        printf("-1\n");
    }
    else if(n>=sum)
    {
        printf("%d\n",(n-sum));
    }
    return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
int n,m,p1,p2,mn,mx;
int main() {
    cin>>n>>m; mx=1; mn=n;
    for (int i=0; i<m; i++) {
        cin>>p1>>p2;
        mx=max(mx,p1);
        mn=min(mn,p2);
    }
    cout<<max(0,mn-mx+1)<<'\n';
}

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

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  a.at(0) = toupper(a.at(0));
  b.at(0) = toupper(b.at(0));
  c.at(0) = toupper(c.at(0));
  cout << a.at(0) << b.at(0) << c.at(0) << endl;
}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, h, w;
    cin >> n >> h >> w;
    ll count = 0;
    for(int i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        if(h <= a && w <= b)
        {
            count++;
        }
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

    boolean bool = true;

    while(bool){
      int n = sc.nextInt();

      if(n == 0){
        bool = false;
        break;
      }

      double s[] = new double[n];
      double sum = 0;
      double a = 0;

      for(int i = 0; i < n; i++){
        s[i] = sc.nextDouble();
        sum += s[i];
      }

      double m = sum / n;

      for(int i = 0; i < n; i++){
        a += Math.pow((s[i] - m), 2);
      }

      System.out.println(Math.sqrt(a / n));
    }
  }
}



Measured memory_bytes: 40188
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  if(2*k-1 > n)return -1;
  var ans = [];
  var c = k+n*3-1, b = c-n, a = k+(n>>1);
  for(var i = 0; i < n+1>>1; i++){
    ans.push(a+" "+b+" "+c);
    a++,b-=2,c--;
  }
  b = k+n*2-2, a = k;
  for(;i < n; i++){
    ans.push(a+" "+b+" "+c);
    a++,b-=2,c--;
  }
  return ans.join("\n");
}

Measured memory_bytes: 70604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;

ll cnt[26];

void solve(void){
    string S;
    cin >> S;
    ll l = S.length();
    rep(l, i) cnt[S[i]-'a']++;
    ll ans = l*(l-1)/2 + 1LL;
    rep(26, i) {
        if (cnt[i] <= 1) continue;
        ans -= cnt[i]*(cnt[i]-1)/2;
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    char ch[100];
    scanf("%[^\n]s",ch);
    if(ch[0] == ch[1] && ch[2]==ch[3] && ch[0]  != ch[2] || ch[0] == ch[2] && ch[1]==ch[3] && ch[0] != ch[1] || ch[0] == ch[3] && ch[1]==ch[2] && ch[0]  != ch[1]) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines[0]);
  console.log(' ' + buildMaxHeap(lines[1].split(' ')).join(' '));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  const maxHeapify = (i) => {
    let left, right, largest = i;
    left = 2 * i + 1;
    right = 2 * i + 2;
    if (left < n && Number(arr[left]) > Number(arr[largest])) largest = left;
    if (right < n && Number(arr[right]) > Number(arr[largest])) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };

  for (let i = Math.floor(arr.length / 2); i >= 0; i--) maxHeapify(i);
  return arr;
}



Measured memory_bytes: 88300
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,b]=nrin(2)
  out(ceil((a+b)/2))
}
main()


Measured memory_bytes: 7500
#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<iterator>
#include<vector>
using namespace std;
typedef vector<int> vii;
#define ll long long
#define tt ll t;cin>>t;while(t--)
#define nl endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define vec vector<ll>
#define cinv(v) for(auto it:v)cin >> it;
#define coutv(v) for(auto it:v)cout << it <<' ';cout<<endl;
#define so ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
        so;

        int x;
        cin>>x;
        if(x>=30)cout<<"Yes"<<nl;
        else cout<<"No";



        return 0;
}



Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define QS ios_base::sync_with_stdio(false);
typedef long long ll;
const ll INF = 1e18;
const int MOD = 1e9+7;
using namespace std;

int main(){
//freopen("output.txt", "w", stdout);
    QS
    ll a, b;
    cin >> a >> b;
    ll g = __gcd(a, b);
    ll cnt = 1;
    for(ll k = 2; k * k <= g; ++k){
        if(g%k==0){
            cnt++;
            while(g%k == 0){
                g/=k;
            }
        }
    }
    if(g > 1) cnt++;
    cout << cnt << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100000
int n,m,s,t,a,b,c,d;
priority_queue<pair<long long,int> > pq;
vector<vector<pair<int,pair<int,int> > > > v;
long long val[MAXN+5],val2[MAXN+5];
bool visited[MAXN+5];
vector<long long> res;
int main(){
    scanf("%d %d %d %d", &n, &m, &s, &t);
    s--;
    t--;
    v.resize(n);

    for(int i = 0; i < m; i++){
        scanf("%d %d %d %d", &a, &b, &c, &d);
        a--;
        b--;
        v[a].push_back(make_pair(b,make_pair(c,d)));
        v[b].push_back(make_pair(a,make_pair(c,d)));
    }
    //for(int i = 0; i <= n; i++)val2[i] = (long long)(1e15);
    pq.push(make_pair((long long)(1e15),s));
    while(!pq.empty()){
        pair<long long, int> top = pq.top();
        pq.pop();
        long long nowmoney = top.first;
        int nownode = top.second;
        if(val[nownode])continue;
        val[nownode] = nowmoney;
        for(int i = 0; i < v[nownode].size(); i++){
            int targetnode = v[nownode][i].first;
            int targetcost = v[nownode][i].second.first;
            pq.push(make_pair(nowmoney-targetcost,targetnode));
        }
    }
    pq.push(make_pair(0,t));
    while(!pq.empty()){
        pair<long long, int> top = pq.top();
        pq.pop();
        long long nowmoney = top.first;
        int nownode = top.second;
        //cout<<nownode<<" "<<nowmoney<<endl;
        if(visited[nownode])continue;
        visited[nownode] = true;
        val2[nownode] = nowmoney;
        for(int i = 0; i < v[nownode].size(); i++){
            int targetnode = v[nownode][i].first;
            int targetcost = v[nownode][i].second.second;
            pq.push(make_pair(nowmoney-targetcost,targetnode));
        }
    }
    long long xam = 0;
    for(int i = n-1; i >= 0; i--){
        xam = max(xam,val[i]+val2[i]);
        res.push_back(xam);
    }

    for(int i = n-1; i >= 0; i--){
        printf("%lld\n", res[i]);
    }
}


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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_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(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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

int d[10][10];

int solve(){
  int h,w;cin>>h>>w;
  rep(i, 10){ rep(j, 10){ cin>>d[i][j]; } }
  dump_2d(d, 10, 10);

  rep(k, 10){
    rep(i, 10){
      rep(j, 10){
        chmin(d[i][j], d[i][k]+d[k][j]);
      }
    }
  }
  dump_2d(d, 10, 10);

  int res = 0;
  rep(i, h){
    rep(j, w){
      int x=in();
      if (x==-1) { continue; }
      res += d[x][1];
    }
  }
  cout << res << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


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

int main(){
  int N;
  int64_t K;
  cin >> N >> K;
  vector<int> A(N);
  priority_queue<int> pq;
  map<int,int> m;
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    pq.push(A.at(i));
    if(m.count(A.at(i))){
      m.at(A.at(i))++;
    }else{
      m[A.at(i)]=1;
    }
  }
  int64_t x=0;
  bool flag;
  int64_t p=int64_t(pow(10,9));
  do{
    flag=false;
    for(int i=0;i<N-1;i++){
      if(A.at(i)>A.at(i+1)){
        swap(A.at(i),A.at(i+1));
        x++;
        flag=true;
      }
    }
  }while(flag);
  int64_t ans=(x*K);
  ans%=(p+7);
  int n=N;
  int key=pq.top();
  int64_t y=(n-m.at(key));
  pq.pop();
  for(int i=1;i<N;i++){
    if(key==pq.top()){
      y+=(n-m.at(key));
      pq.pop();
    }else{
      n-=m.at(key);
      key=pq.top();
      y+=(n-m.at(key));
      pq.pop();
    }
  }
  int64_t c=((K*(K-1))/2)%(p+7);
  ans+=(y*c);
  ans%=(p+7);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

A, B, C, D = i_l()

A -= 1
l = lcm(C,D)

a = (B + C) // C - (A + C) // C
b = (B + D) // D - (A + D) // D
c = (B + l) // l - (A + l) // l

print((B - A) - a - b + c)

Measured memory_bytes: 3064
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <tuple>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    //    ifstream in("input.txt");
    //    cin.rdbuf(in.rdbuf());
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    if (n >= 1000) cout << "ABD" << endl;
    else cout << "ABC" << endl;
    
    return 0;
}

Measured memory_bytes: 888
import Data.List

main :: IO()
main = getContents >>= print.solve.map read.tail.lines

solve          :: [Int] -> Int
solve (x:y:ys) = fst $foldl' f (y-x, min x y) ys
    where f (x,y) z = let a = max (z-y) x; b = min z y  in (a, b) 

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

int N, T, S;
int A[3010];
int B[3010];
int dp[3010][3010];

int main() {
  cin >> N >> T >> S;
  for (int i=0; i<N; i++) cin >> A[i] >> B[i];

  for (int i=0; i<N; i++) {
    if (i > 0) {
      for (int j=0; j<=T; j++) dp[i][j] = max(dp[i][j], dp[i-1][j]);
    }
    for (int j=0; j<T; j++) {
      if (j > 0) dp[i][j] = max(dp[i][j], dp[i][j-1]);
      if (j < S && j + B[i] > S) continue;
      if (j + B[i] > T) continue;
      dp[i+1][j + B[i]] = max(dp[i+1][j + B[i]], dp[i][j] + A[i]);
    }
  }

  int ans = 0;
  for (int i=0; i<=N; i++) {
    for (int j=0; j<=T; j++) {
      ans = max(ans, dp[i][j]);
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 38412
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
	int n;
	while(1){
		cin>>n;
		if(n==0) break;
		int h,m,mm;
		int sum[3]={},ok[3]={};
		rep(i,0,n){
			scanf("%lld:%lld %lld",&h,&m,&mm);
			if(m>mm) mm+=60;
			if(11<=h && h<15){
				sum[0]++;
				if(mm-m<=8) ok[0]++;
			}else if(18<=h && h<21){
				sum[1]++;
				if(mm-m<=8) ok[1]++;
			}else if(21<=h || h<2){
				sum[2]++;
				if(mm-m<=8) ok[2]++;
			}
		}
		int ans=0;
		string s[3]={"lunch","dinner","midnight"};
		rep(i,0,3){
			cout<<s[i]<<" ";
			if(sum[i]==0) cout<<"no guest"<<endl;
			else{
				ans=100.0*(double)ok[i]/(double)sum[i];
				o(ans);
			}
		}
	}
}

Measured memory_bytes: 1252
#include "bits/stdc++.h"
using namespace std;
     
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
     
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
  int n, i, j;
  cin >> n;
  vi c(n), s(n), f(n);
  for (i = 0; i < n - 1; i++) {
    cin >> c[i] >> s[i] >> f[i];
  }
  for (i = 0; i < n; i++) {
    int t = 0;
    for (j = i; j < n - 1; j++) {
      if (t < s[j]) {
	t = s[j];
      }
      if (t % f[j] != 0) {
	t = (t / f[j] + 1) * f[j];
      }
      t += c[j];
    }
    cout << t << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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; }

ll solve(ll h) {
    if (h == 1) return 1;
    return solve(h / 2) * 2 + 1;
}

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

    const int INF = 1e9;
    vector<vector<int>> dp(n + 1, vector<int>(h + 1, INF));
    dp.at(0).at(0) = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < h + 1; j++) {
            chmin(dp.at(i + 1).at(j), dp.at(i).at(j));
            chmin(dp.at(i + 1).at(min(h, j + a.at(i))), dp.at(i).at(j) + b.at(i));
            //dp.at(i + 1).at(min(h, j + a.at(i))) = min(dp.at(i).at(min(h, j + a.at(i))), dp.at(i + 1).at(j) + b.at(i));
            chmin(dp.at(i + 1).at(min(h, j + a.at(i))), dp.at(i + 1).at(j) + b.at(i));
        }
    }
    cout << dp.at(n).at(h) << endl;
}

Measured memory_bytes: 39424
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int m = sc.nextInt();

		int left = 1;
		int right = n;
		for(int i = 0; i < m; i++){
			int l = sc.nextInt();
			int r = sc.nextInt();

			if(l > right || r < left){
				System.out.println(0);
				return;
			}

			left = Math.max(l, left);
			right = Math.min(r, right);
		}

		System.out.println(right - left + 1);
	}

}


Measured memory_bytes: 63216
#include <iostream>
#include <cmath>
int x,n,p[110];
int main(){
	std::cin>>x>>n;
	for(int i=0;i<n;i++){
		std::cin>>p[i];
	}
	int ans=0;
	for(int i=0;i<=101;i++){
		bool appeared=false;
		for(int j=0;j<n;j++){
			if(p[j]==i){
				appeared=true;
				break;
			}
		}
		if(!appeared&&std::abs(ans-x)>std::abs(i-x)){
			ans=i;
		}
	}
	std::cout<<ans<<std::endl;
	return 0;
}


Measured memory_bytes: 3584
from collections import deque
N, M = map(int, input().split())

graph = [set() for _ in range(N + 1)]
edge = []
for m in range(M):
    a, b = map(int, input().split())
    graph[a].add(b)
    graph[b].add(a)
    edge.append([a, b])

ans = 0
for m in range(M):
    Bridge = True
    fr, to = edge[m][0], edge[m][1]
    V = {fr} | set(graph[fr]) - {to}
    que = set(graph[fr]) - {to}
    while que:
        node = que.pop()
        for new_node in graph[node]:
            if new_node == to:
                Bridge = False
                break
            if new_node not in V:
                que.add(new_node)
                V.add(new_node)
        else:
            continue
        break
    if Bridge:
        ans += 1
print(ans)

Measured memory_bytes: 3316
inputs = open(0).readlines()
n, m = map(int, inputs[0].split())
PY = [map(int, x.split()) for x in inputs[1:]]
A = [[] for _ in range(n)]
B = [''] * m
for i, (p, y) in enumerate(PY):
    A[p-1].append([y, i])
    B[i] += '{:06}'.format(p)
for a in A:
    a.sort()
    for i in range(len(a)):
        B[a[i][1]] += '{:06}'.format(i+1)
print(*B, sep='\n')

Measured memory_bytes: 73168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
//#define _GLIBCXX_DEBUG

int main() {
    string T;
    cin >> T;
    rep(i,0,T.length()) {
        if (T[i] == '?') T[i] = 'D';
    }
    cout << T << endl;
}

Measured memory_bytes: 3756
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int is_prime_num(int n) {
	if (n < 2) {
		return -1;
	} else if (n == 2) {
		return 1;
	} else if (n % 2 == 0) {
		return -1;
	}
	
	int i;
	for (i = 3; i <= (int)sqrt(n); i+=2) {
		if (n % i == 0) {
			return -1;
		}
	}
	return 1;
}

int memoized_map[999999] = {};

bool memoized_prime_num(int n) {
	int res = memoized_map[n];
	if (res == 0) {
		res = is_prime_num(n);
		memoized_map[n] = res;
	}
	if (res == 1) {
		return true;
	} else {
		return false;
	}
}

int count_prime_num(int n) {
	int acc = 0;
	int i;
	for (i = 2; i <= n; i++) {
		if (memoized_prime_num(i)) {
			acc++;
		}
	}
	return acc;
}

int main() {
	char line[256];
	while (fgets(line, 256, stdin)) {
		printf("%d\n", count_prime_num(atoi(line)));
	}
}

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

int main()
{
  int a,b,c;
  cin >> a>> b>> c;
  if(b >= c) cout << "delicious" << endl;
  else if(c - b <= a) cout << "safe" << endl;
  else cout << "dangerous" << endl;
  return 0;
}


Measured memory_bytes: 3624
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int h = parseInt(sc.next());
		int w = parseInt(sc.next());
		sc.close();
		out.println(Math.min(diff_min(h, w), diff_min(w, h)));
//		for (i = 2; i <= 100; i++) {
//			for (j = 2; j <= 100000; j++) {
//				out.printf("%d %d ", i ,j);
//				out.println(Math.min(diff_min(i, j), diff_min(j, i)));
//			}
//		}
	}
	public static int diff_min(int a, int b) {
		int ans = 100000;
		int hmod = a % 3; 
		if(hmod == 0) {
			ans = 0;
		} else {
			int a3 = a / 3;
			int b2 = b / 2;
			if(b % 2 == 0) {
				ans = b2;
			} else if(hmod == 1){
				ans = Math.min(Math.min(Math.max(a3+b2*2+1, a3*2), Math.max(a3*2+1, b2 + a3 + 1)),b);
//				out.printf("%d %d %d %d%n",a3+b2*2+1, a3*2, a3*2+1, b2 + a3 + 1);
			} else {
				ans = Math.min(Math.min(Math.max(a3*2+2, a3+b2*2+2), Math.max(a3*2+1, b2 + a3 + 1)),b);
//				out.printf("%d %d %d %d%n",a3*2+2, a3+b2*2+2, a3*2+1, b2 + a3 + 1);
			}
		}
		return ans;
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn = 10000010;
ll tb[maxn];
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j += i) {
			tb[j] ++;
		}
	}
	ll ans = 0;
	for (ll i = 1; i <= n; i++)ans += i * tb[i];
	cout << ans;
	return 0;
}

Measured memory_bytes: 81264
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>
#include <random>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define endl '\n'

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e5) + 17;

int n, k;

bool read() {
    if (!(cin >> n >> k))
        return false;

    return true;
}

void solve() {
    if (n % k > 0)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()
 
int main() {
  string s;
  cin >> s;
  if(s[0] == s[1] or s[1] == s[2] or s[2] == s[3]) puts("Bad");
  else puts("Good");
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define mod 1000000000
#define ll long long
#define _USE_MATH_DEFINES
using namespace std;
int main()
{
int n;cin>>n;
int a;
map<int,int> mp;
for(int i=0;i<n-1;i++)
{
cin>>a;
mp[a]++;
}
for(int i=1;i<=n;i++)
{
cout<<mp[i]<<endl;
}

}


Measured memory_bytes: 13008
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, w, ans = 0, count = 0;
  string s, t;
  vector<pair<string, pair<lli, lli>>> pr;
  cin >> n;
  lli i = 1;
  while (n > 0)
  {
    n -= 1000 * i;
  }
  cout << abs(0 - n) << endl;
}

Measured memory_bytes: 3644
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
vector<tuple<LL,LL,LL>> dish;

LL ans = 0;

void solve(){
	sort(dish.begin(),dish.end());
	for(int i=0;i<N;i++){
		int j = N-1-i;
		//cout << get<1>(dish[j]) << " " << get<2>(dish[j])<< endl;
		if(i%2==0){
			ans += get<1>(dish[j]);
		}
		if(i%2==1){
			ans -= get<2>(dish[j]);
		}
	}
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++){
    	LL a,b;cin >> a >> b;
    	dish.push_back(tuple<LL,LL,LL>(a+b,a,b));
    }
 
    solve();

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

Measured memory_bytes: 4980
use std::collections::HashSet;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() -> () {
    input!{
        n: usize,
        w: [chars; n],
    }
    let mut c = w[0].last();
    let mut used = HashSet::new();
    used.insert(w[0].clone());
    for i in 1..n {
        if used.contains(&w[i]) {
            println!("No");
            return;
        }
        if w[i].first() != c {
            println!("No");
            return;
        }
        c = w[i].last();
        used.insert(w[i].clone());
    }
    println!("Yes");
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

class Main
{
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static Scanner sc = new Scanner(new InputStreamReader(System.in));
	
	public static void main (String[] args) throws java.lang.Exception {
		int inning = Integer.parseInt(br.readLine());
		solve(inning);
	}

	public static void solve(int maxInning) throws IOException{
		int runner = 0;
		int inning = 0;
		int out = 0;
		int[] score = new int[2];
		score[0] = 0;
		score[1] = 0;
		
		while(inning < maxInning) {
			String str = br.readLine();
			if (str.equals("HIT")) {
				if (runner == 3) score[inning%2]++;
				else runner++;
			} else if (str.equals("HOMERUN")) {
				score[inning%2] += (runner+1);
				runner = 0;
			} else if (str.equals("OUT")) {
				if (out == 2) {
					runner = 0;
					System.out.println(score[inning%2]);
					inning ++;
					out = 0;
					score[0] = 0;
					score[1] = 0;
				} else {
					out++;
				}
			}
		}
	}
}

Measured memory_bytes: 17152
#include<stdio.h>

int main(){
  
  int N,K;
  scanf("%d %d",&N,&K);

  int sum = 0;
  int len = 0;

  for(int i=0; i<N; i++){
    scanf("%d",&len);
    if( K-len > len ){
      sum = sum + 2*len;
    }else{
      sum = sum + 2*( K - len );
    }
  }

  printf("%d",sum);

  return 0;

}

Measured memory_bytes: 128
a,v=map(int,input().split())
b,w=map(int,input().split())
t = int(input())

kyori = (v-w) * t
aida = abs(a - b)

if a == b:
    print("YES")
    exit()

if kyori < 0:
    print("NO")
    exit()

if aida <= kyori:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9132
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>

using namespace std;
long long n,a[6],ans;
string s[200000];
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++) cin>>s[i];
    for(int i=1;i<=n;i++){
        if(s[i][0]=='M') ++a[1];
        if(s[i][0]=='A') ++a[2];
        if(s[i][0]=='R') ++a[3];
        if(s[i][0]=='C') ++a[4];
        if(s[i][0]=='H') ++a[5];
    }
    ans+=a[1]*a[2]*a[3];
    ans+=a[1]*a[2]*a[4];
    ans+=a[1]*a[2]*a[5];
    ans+=a[1]*a[3]*a[4];
    ans+=a[1]*a[3]*a[5];
    ans+=a[1]*a[4]*a[5];
    ans+=a[2]*a[3]*a[4];
    ans+=a[2]*a[3]*a[5];
    ans+=a[3]*a[4]*a[5];
    ans+=a[2]*a[4]*a[5];
    printf("%lld\n",ans);
    return 0;
}

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

using ll = long long;

int main(){
  long long int H,ans=0;
  cin >> H;
  long long int cnt = 1;
  while(H>0){
    H /= 2;
    ans += cnt;
    cnt *= 2;
  }

  cout << ans << endl;
}

/*
ex
HP = 5
→ 5, 2+2, 1+1+1+1 →1+2+4 = 7回
HP = 12
→ 12, 6+6, 3+3+3+3, 1+1 + 1+1 + 1+1 + 1+1 → 1+2+4+8=15
32
→ 32,16+16,8+8+8+8,4*8,2*16,1*32
2^n回でHPが倍のものが倒せる
*/

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(){
	string moji[3];
	for(int i=0;i<3;i++)
		cin >> moji[i];
	for(int j=0;j<3;j++)
		cout << (char)((int)moji[j][0]-32);
	cout << "" << endl;
	return 0;
}


Measured memory_bytes: 888
n = int(input())
a = list(map(int, input().split()))
L = sum(a)
l = 0
i = 0
while l < L / 2:
    l += a[i]
    i += 1
print(min(abs(sum(a[:i - 1]) - sum(a[i - 1:])), abs(sum(a[:i]) - sum(a[i:]))))


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

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    int abmax_pos = 0;
    int abmax = abs(a[0]);
    for (int i = 1; i < N; i++) {
        if (abmax < abs(a[i])) {
            abmax_pos = i;
            abmax = abs(a[i]);
        }
    }
    if (a[abmax_pos] >= 0) {
        cout << 2*N-1 << endl;
        for (int i = 1; i <= N; i++) cout << abmax_pos+1 << " " << i << endl;
        for (int i = 1; i <= N-1; i++) cout << i << " " << i+1 << endl;
        return 0;
    }
    else if (a[abmax_pos] < 0) {
        cout << 2*N-1 << endl;
        for (int i = 1; i <= N; i++) cout << abmax_pos+1 << " " << i << endl;
        for (int i = N-1; i >= 1; i--) cout << i+1 << " " << i << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main{
	public static void main(String[] args)throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String out="";
		for(int i=str.length()-1;i>=0;i--){
			out+=str.substring(i,i+1);
		}
		System.out.println(out);
	}

}

Measured memory_bytes: 16868
N=int(input())
ans=[0]*N
x=1
while 6*(x**2)<=N:
    y=x
    while (x**2)+3*(y**2)+(2*x*y)<=N:
        z=y
        while x**2+y**2+z**2+x*y+y*z+z*x<=N:
            a=x**2+y**2+z**2+x*y+y*z+z*x
            if x<y<z:
                ans[a-1]+=6
            elif x==y==z:
                ans[a-1]+=1
            else:
                ans[a-1]+=3
            z+=1
        y+=1
    x+=1
for i in range(N):
    print(ans[i])

Measured memory_bytes: 9340