akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b&&b==c&&c==a)cout << "No" << endl;
  else if(a==b||b==c||c==a)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
import re


def code_shift(c, n_shift):
    return ord('a') + (ord(c) + n_shift - ord('a')) % 26


def get_candidate_plain(cipher, sym_ids, n_shift):
    plain = []
    for i, c in enumerate(cipher):
        if i not in sym_ids:
            plain.append(chr(code_shift(c, n_shift)))
        else:
            plain.append(c)
    plain = ''.join(plain)
    return plain


def decrypt(cipher):
    sym_ids = [m.start() for m in re.finditer(r'[\.\n\s]', cipher)]
    keyword = ['the', 'this', 'that']

    n_shift = 0
    while True:
        plain = get_candidate_plain(cipher, sym_ids, n_shift)
        for k in keyword:
            if plain.find(k) != -1:
                return plain
        n_shift += 1


if __name__ == '__main__':
    while True:
        try:
            cipher = input()
            print(decrypt(cipher))
        except:
            break


Measured memory_bytes: 6504
import sys
input = sys.stdin.readline
import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=len(set(A))
ans=0
if K>=m:
    print(0)
else:
    c = collections.Counter(A)
    c_=c.most_common()
    for i in range(m-K):
        ans+=c_[m-1-i][1]
    print(ans)

Measured memory_bytes: 96200
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int W, H, N, T = 0;

	cin >> W >> H >> N;

	vector<int> X(N);
	vector<int> Y(N);

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

	for (int i = 0; i < N - 1; i++)
	{
		if (X[i + 1] - X[i] >= 0 && Y[i + 1] - Y[i] >= 0)
		{
			T += max(X[i + 1] - X[i], Y[i + 1] - Y[i]);
		}
		else if (X[i + 1] - X[i] <= 0 && Y[i + 1] - Y[i] <= 0)
		{
			T += -min(X[i + 1] - X[i], Y[i + 1] - Y[i]);
		}
		else
		{
			T += abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i]);
		}
	}

	cout << T << endl;

	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	set<int> a;
	a.insert(n);
	for(int i=2;;i++)
	{
		if(n%2==0)
			n/=2;
		else
			n=n*3+1;
		a.insert(n);
		if(i!=a.size())
		{
			cout<<i;
			return 0;
		}
	}
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()

	n := sc.ReadInt()

	labels := []string{"AC", "WA", "TLE", "RE"}
	counts := []int{0, 0, 0, 0}

	for i := 0; i < n; i++ {
		s := sc.ReadString()
		for pos, label := range labels {
			if s == label {
				counts[pos]++
				break
			}
		}
	}

	for i := 0; i < len(labels); i++ {
		fmt.Printf("%s x %d\n", labels[i], counts[i])
	}
}

// from [my library](https://github.com/ikngtty/go-contestlib)
// -   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Ceil(divident, dividor int) int {
	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;




int n,q;
string s;
char t[maxn], d[maxn];


bool sim(int start, int dest) {
    int at = start;
    for (int i=0; i<q; i++) {
	if (s[at] == t[i]) {
	    if (d[i]=='L') at--;
	    if (d[i]=='R') at++;
	}
	if (at==dest) return true;
    }
    return false;
}

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

    cin>>n>>q;
    cin>>s;
    s="*"+s+"*";
    for (int i=0; i<q; i++) {
	cin>>t[i]>>d[i];
    }

    int fell = 0;

    {
	int lo = 0;
	int hi = n+1;
	while (hi-lo>1) {
	    int mid=(lo+hi)/2;
	    if (sim(mid, 0)) {
		lo = mid;
	    } else {
		hi = mid;
	    }
	}
	fell += lo;
    }

    {
	int lo = 0;
	int hi = n+1;
	while (hi-lo>1) {
	    int mid=(lo+hi)/2;
	    if (sim(mid, n+1)) {
		hi = mid;
	    } else {
		lo = mid;
	    }
	}
	fell += (n+1-hi);
    }

    int alive = n - fell;
    cout<<alive<<endl;
    
    return 0;
}


Measured memory_bytes: 4144
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)   make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    string a,b,c;
    int n,cnt = 0;
    cin >> n >> a >> b >> c;
    rep(i,n){
        if(a[i] == b[i] && a[i] != c[i]) cnt++;
        else if(a[i] == c[i] && a[i] != b[i]) cnt++;
        else if(b[i] == c[i] && b[i] != a[i]) cnt++;
        else if(a[i] != b[i] && b[i] != c[i] && a[i] != c[i]) cnt += 2;
    }   
    cout << cnt << '\n';
    return 0;
}


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

vector<vector<int> > G(2e5 + 1);
vector<int> res(2e5 + 1);

void dfs(int i, int p) {
	for (int x : G[i]) {
		if (x == p) continue ;
		res[x] += res[i];
		dfs(x, i);
	}
}

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int n, q; cin >> n >> q;

	REP(i, n - 1) {
		int a, b; cin >> a >> b;
		G[--a].push_back(--b);
		G[b].push_back(a);
	}

	REP(i, q) {
		int p, x; cin >> p >> x;
		res[--p] += x;
	}

	dfs(0, 0);
	REP(i, n) {
		cout << res[i];
		if (i != n - 1) cout << " ";
	}
	cout << '\n';

    return 0;
}


Measured memory_bytes: 24260
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 35005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int ans[2005][2005] , a[10005] ;

int main()
{
    int i , j , k , l , m , n , fl ;

    scanf("%d %d",&n,&m) ;
    scanf("%d",&k) ;

    for(i=1 ; i<=k ; i++) scanf("%d",&a[i]) ;

    for(i=1,l=1 ; i<=n ; i++)
    {
        if(i%2==1){
            j=1 ; fl = 1 ;
        }
        else{
            j=m ; fl = -1 ;
        }
        for( ; j>=1 && j<=m ; j+=fl )
        {
            ans[i][j] = l ;
            a[l]-- ;
            if(a[l]==0) l++ ;
        }
    }

    for( i=1 ; i<=n ; i++ )
    {
        for(j=1; j<=m ; j++){
            printf("%d",ans[i][j]) ;
            if(j==m) printf("\n") ;
            else printf(" ") ;
        }
    }

    return 0 ;
}


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

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

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



int main(){
  cout<<setprecision(1000);
  string s;
  cin>>s;
  deque<char> S(s.begin(),s.end());
  ll Q;
  cin>>Q;
  int reversed=0;
  REP(Q){
    int T,F;
    string C;
    cin>>T;
    if(T==1){
      reversed=1^reversed;
    }else{
      cin>>F>>C;
      --F;
      if(reversed==F){
        S.push_front(C[0]);
      }else{
        S.push_back(C[0]);
      }
    }
  }
  if(reversed){
    reverse(S.begin(),S.end());
  }
  cout<<string(S.begin(),S.end())<<endl;
  return 0;
}


Measured memory_bytes: 1280
function myout(text){console.log(text);}//standard output
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var H = parseInt(input[0].split(" ")[0]);
  var W = parseInt(input[0].split(" ")[1]);
  for(var i = 1; i <= H; i++){
    input[i] = input[i].split("");
  }
  input.shift();
  for(var i = 0; i < H; i++){
    for(var j = 0; j < W; j++){
      var check = input[i][j];
      if(check == "#"){
         var u = ".";
        if(i != 0){
           u = input[i - 1][j];
        }
         var l = ".";
        if(j != 0){
           l = input[i][j - 1];
        }
         var r = ".";
        if(j != W - 1){
           r = input[i][j + 1];
           }
         var d = ".";
        if(i != H - 1){
           d = input[i + 1][j];
           }
        
         if(u !== "#" && l !== "#" && r !== "#" && d !== "#"){
            myout("No");
           return;
            }
      }
    }
  }
  myout("Yes");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const n = parseInt(args[0][0], 10)
	const t = args.slice(1, n + 1)
	const dp = new Array(n + 1)

	for (let i = 0; i < dp.length; i++) {
		dp[i] = new Array(3).fill(0)
	}

	for (let i = 0; i < n; i++) {
		const a = t[i].map(arg => parseInt(arg, 10))

		for (let j = 0; j < 3; j++) {
			for (let k = 0; k < 3; k++) {
				if (j === k) continue
				dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][k] + a[j])
			}
		}
	}

	let max = 0

	for (let i = 0; i < 3; i++) {
		max = Math.max(max, dp[n][i])
	}

	console.log(max)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

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

    ll N;
    cin >> N;
    ll ans = 0;
    int MAX = N + 1;
    vector<ll> cnt(MAX, 1);

    for (int i = 2; i < MAX; i++) {
        for (int j = 1; j * i < MAX; j++) {
            cnt[i * j]++;
        }
    }

    for (int i = 1; i < MAX; i++) {
        ans += i * cnt[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 81320
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;

	set<ll> st;
	for(i=1;i<=n;i++){
		cin>>k;
		if(st.find(k)!=st.end()){
			st.erase(st.find(k));
		}
		else st.insert(k);
	}
	cout<<st.size();
	return 0;
}

Measured memory_bytes: 4992
S = input()
T = input()
d = {}

for s, t in zip(S, T):
  if s in d:
    #含まれている場合で、tと異なるならば、変換ができないということ
    if d[s] != t:
      print("No")
      exit()
  else:
    d[s] = t

#keyの数に対し、valuesが重複していて、数が合わなければ、変換ができない
if len(d) != len(set(d.values())):
  print("No")
else:
  print("Yes")



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m,x,ans=LINF;
	cin>>n>>m>>x;
	vl c(n);
	vvl a(n,vl(m));
	rep(i,n){
		cin>>c[i];
		rep(j,m){
			cin>>a[i][j];
		}
	}
	rep(i,1ll<<n){
		ll score=0;
		vl skl(m);
		rep(j,n){
			if((1ll<<j)&i){
				score+=c[j];
				rep(k,m)skl[k]+=a[j][k];
			}
		}
		bool master=true;
		rep(j,m)master&=skl[j]>=x;
		if(master)chmin(ans,score);
	}
	cout<<(ans!=LINF?ans:-1)<<endl;
}


Measured memory_bytes: 3500
// AOJ 0372: Three Meals
// 2017.11.14 bal4u@uu
// 2017.11.16

#include <stdio.h>
#include <stdlib.h>

typedef struct { long long b; int n, t; } T;
T tbl[3][1440]; int sz[3];
long long a[3][1440];

int bitcount64(long long x)
{
	x = ((x & 0xAAAAAAAAAAAAAALL) >>  1) + (x & 0x55555555555555LL);
	x = ((x & 0xCCCCCCCCCCCCCCLL) >>  2) + (x & 0x33333333333333LL);
	x = ((x & 0xF0F0F0F0F0F0F0LL) >>  4) + (x & 0x0F0F0F0F0F0F0FLL);
	x = ((x & 0x00FF00FF00FF00LL) >>  8) + (x & 0xFF00FF00FF00FFLL);
	x = ((x & 0xFF0000FFFF0000LL) >> 16) + (x & 0x00FFFF0000FFFFLL);
	x = ((x & 0xFFFFFF00000000LL) >> 32) + (x & 0x000000FFFFFFFFLL);
	return (int)x;
}

int cmp(T *a, T *b) { if (b->n - a->n) return b->n - a->n; return b->t - a->t; }

int main()
{
	int n, i, j, k, at, ht, an, f, ans;
	long long b, bb;
	
	scanf("%d", &n);
	for (b = 1, i = 0; i < n; i++, b <<= 1) for (j = 0; j < 3; j++) {
		int sh, sm, eh, em, t;
		scanf("%d%d%d%d", &sh, &sm, &eh, &em);
		sh = sh*60+sm, eh = eh*60+em;
		for (t = sh; t <= eh; t++) a[j][t] |= b;
	}
	for (j = 0; j < 3; j++) {
		T *tp;
		for (tp = tbl[j], i = 0; i < 1440; i++) if ((b = a[j][i]) > 0) {
			tp->b = b, tp->n = bitcount64(b), tp->t = i, tp++;
		}
		sz[j] = tp - tbl[j];
		qsort(tbl[j], sz[j], sizeof(T), cmp);
	}

	ans = 0;
	b  = tbl[0][0].b, n = tbl[0][0].n;
	b &= tbl[1][0].b; if (tbl[1][0].n < n) n = tbl[1][0].n;
	b &= tbl[2][0].b; if (tbl[2][0].n < n) n = tbl[2][0].n;
	if (bitcount64(b) == n && tbl[0][0].t < tbl[1][0].t && tbl[1][0].t < tbl[2][0].t) {
		ans = n; goto done;
	}

	for (i = 0; i < sz[0]; i++) {
		if ((an = tbl[0][i].n) <= ans) goto done;
		at = tbl[0][i].t, b = tbl[0][i].b;
		for (j = 0; j < sz[1]; j++) {
			if (tbl[1][j].n <= ans) break;
			if ((ht = tbl[1][j].t) <= at) continue;
			bb = tbl[1][j].b & b;
			if (bitcount64(bb) <= ans) continue;
			for (k = 0; k < sz[2]; k++) {
				if (tbl[2][k].n <= ans) break;
				if (tbl[2][k].t <= ht) continue;
				if ((f = bitcount64(bb & tbl[2][k].b)) > ans) {
					ans = f;
					if (ans == an) goto done;
				}
			}
		}
	}
done:
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<pair<long long, long long>> task;
    for (int i = 0; i < n; ++i) {
        long long a, b;
        cin >> a >> b;
        task.emplace_back(b, a);
    }
    sort(task.begin(), task.end());
    long long sum = 0;
    for (auto &e : task) {
        sum += e.second;
        if (sum > e.first) {
            cout << "No" << "\n";
            return 0;
        }
    }
    cout << "Yes" << "\n";
    return 0;
}


Measured memory_bytes: 6256
#include <bits/stdc++.h>
using namespace std;
const int INF=INT_MAX;
const int maxn=3e5+1;

int read(){
	int x=0;char ch=getchar();
	while(!isdigit(ch)) ch=getchar();
	while(isdigit(ch)) x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}

struct node{
	int u,d;
	bool operator < (const node &x) const{
		return d>x.d;
	}
};

bitset<maxn>vis;
vector<int>to[maxn];
int n,m,s,t,dis[maxn];
priority_queue<node>q;

void Dijkstra(){
	fill(dis,dis+1+n*3,INF);
	dis[s]=0;q.push((node){s,0});
	while(!q.empty()){
		int u=q.top().u;q.pop();
		if (vis[u]) continue;
		vis[u]=1;
		for (auto v:to[u]){
			if (vis[v]) continue;
			if (dis[v]>dis[u]+1)
			dis[v]=dis[u]+1,q.push((node){v,dis[v]});
		}
	}
	dis[t]=(dis[t]==INF)?-1:dis[t]/3;
}

int main(){
	n=read(),m=read();
	for (int i=1;i<=m;++i){
		int u=read(),v=read();
		to[(u-1)*3+0].push_back((v-1)*3+1);
		to[(u-1)*3+1].push_back((v-1)*3+2);
		to[(u-1)*3+2].push_back((v-1)*3+0);
	}
	s=(read()-1)*3,t=(read()-1)*3;
	Dijkstra();
	printf("%d\n",dis[t]);
}

Measured memory_bytes: 17920
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[] hills = new int[10];
		for(int i=0;i<10;i++)
			hills[i]=in.nextInt();
		for(int i=0;i<3;i++){
			for(int j=i+1;j<10;j++){
				if(hills[j]>hills[i]){
					int tmp;
					tmp=hills[i];
					hills[i]=hills[j];
					hills[j]=tmp;
				}
			}
		}
		for(int i=0;i<3;i++)
			System.out.println(hills[i]);
	}

}

Measured memory_bytes: 17168
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
vector<int>from[100001];
vector<int>dp;
int df(int i){
  if(dp[i]!=-1)
    return dp[i];
  dp[i]=0;
  for(int f:from[i])
    dp[i]=max(dp[i],df(f)+1);
  return dp[i];
}
int main(){
  int N,M;cin>>N>>M;
  for(int i=0;i<M;i++){
    int x,y;cin>>x>>y;
    from[y].push_back(x);
  }
  dp.resize(N+1,-1);
  for(int i=1;i<=N;i++)
    if(dp[i]==-1)df(i);
  cout<<*max_element(dp.begin(),dp.end())<<endl;
}

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

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

map<ll, ll> ret;

// 素因数分解
void prime_factor(ll n) {
	//map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ++ret[n];
}

void solve_abc_c() {
	ll n, m;
	ll x;
	ll a;
	string s;
	string s_ans;
	ll l_ans = 0;
	double d_ans = 0;
	
	cin >> n;

	rep1(i, n) {
		prime_factor(i);
	}

	l_ans = 1;
	for (auto itr : ret) {
		l_ans *= itr.second + 1;
		l_ans %= MOD;
	}

	cout << l_ans << "\n";
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(15);

	solve_abc_c();

	return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n,m;cin >> n >> m;
    vvl p(n+1);
    vpii pa;
    rep(i,m){
        int P,Y;cin>>P>>Y;
        p[P].emplace_back(Y);
        pa.emplace_back(make_pair(P,Y));
    }
    rep(i,n+1)sort(all(p[i]));
    for(auto paa:pa){
        int a = paa.first;
        int b = lower_bound(all(p[a]),paa.second) - p[a].begin();
        printf("%06d%06d\n",a,b+1);
    }
}


Measured memory_bytes: 7796
S =input()
S_list = list(map(int,S.split()))
S_list = [i - 1 for i in S_list]

if  S_list[0] == S_list[1] :
    result = "Draw"
elif (S_list[0] - S_list[1]) * S_list[1] >0 or S_list[0] == 0:
    result = "Alice"
else:
    result = "Bob"
print(result)


Measured memory_bytes: 9164
a8, b10 = map(int, input().split())
min8 = a8 / 0.08
max8 = (a8+1) / 0.08 

min10 = b10 / 0.1
max10 = (b10+1) / 0.1 
list10 = [i for i in range(int(min10), int(max10))]
if int(min8) - min8 != 0:
    min8 = int(min8) + 1
if int(max8) - max8 != 0:
    max8 = int(max8) + 1
flg = 0 
for i in range(int(min8), int(max8)):
    if i in list10:
        print(i)
        flg = 1
        break
if flg == 0:
    print(-1)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int a[5];
int main()
{
	int n,i=0;
	cin>>n;
	while(n!=0)
	{
		if(n%10==1)
		a[i]=9;
		else
		a[i]=1;
		i++;
		n=n/10;
	}
	for(int j=i-1;j>=0;j--)
		cout<<a[j];
	return 0;	
}

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

#define ll long long
const int mod = 1e9 + 7;
ll int INF = 1e17;


int n;
int arr[105];
ll int dp[105][100005];
ll int psum[105][100005];

int kil(int idx, int kleft)
{
  if(idx == n)
  {
    if(kleft == 0)
      return 1;
    return 0;
  }
  if(dp[idx][kleft] != -1)
    return dp[idx][kleft];

  dp[idx][kleft] = 0;
  for(int i=0;i<=min(arr[idx], kleft);i++)
    dp[idx][kleft] += kil(idx+1, kleft-i);

  return dp[idx][kleft];
}

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

  int k, res;
  cin>>n>>k;
  for(int i=0;i<n;i++)
    cin>>arr[i];

   // iterative
   memset(dp, 0, sizeof dp);
   dp[n][0] = 1;

   for(int kleft = 0; kleft <= k; kleft ++)
     psum[n][kleft] = ((kleft > 0) ? psum[n][kleft - 1] : 0) + dp[n][kleft];

   for(int idx = n-1; idx>=0; idx--)
   {
     for(int kleft = 0; kleft <= k; kleft ++)
     {
       // for(int i=0;i<=min(arr[idx], kleft);i++)
       //   dp[idx][kleft] += dp[idx+1][kleft-i];
       //   // sum  dp[kleft] + dp[kleft-1] + dp[kleft-2] .... dp[kleft-min(arr[idx], kleft)]
       //   // dp[k] .... dp[0]
       int y = min(arr[idx], kleft);
       dp[idx][kleft] = (psum[idx+1][kleft] + mod - ((kleft - y) > 0 ? psum[idx+1][kleft - y -1] : 0)) % mod;
       psum[idx][kleft] = (((kleft > 0) ? psum[idx][kleft - 1] : 0) + dp[idx][kleft]) % mod;
     }
   }

   // recursive
   // memset(dp, -1, sizeof dp);
   // cout<<kil(0, k)<<endl;

   cout<<dp[0][k]<<endl;

   return 0;
}


Measured memory_bytes: 162304
#include<stdio.h>
#include<string.h>

char str[27];


int main(void) {

	int i, j;
	int len;
	char tmp;

	gets(str);

	len = strlen(str);

	for (i = 0; i < len; i++) {
		for (j = i + 1; j < len; j++) {
			if (str[i] < str[j]) {
				tmp = str[i];
				str[i] = str[j];
				str[j] = tmp;
			}
		}
	}

	for (i = 0; i < len; i++) {
		if (str[i] == str[i + 1]) {
			printf("no\n");
			return 0;
		}
	}
	
	printf("yes\n");



	return 0;
}

Measured memory_bytes: 128
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e18
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int n,weight;  cin >> n >> weight;
  vi w(n),v(n);
  rep0(i,n)cin >> w[i] >> v[i];
  vector<vll> dp(n+1,vll(weight+1));
  rep1(i,n){
    rep0(j,weight+1){
      dp[i][j] = dp[i-1][j];
      if(j-w[i-1] >= 0) chmax(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
    }
  }
  cout << dp[n][weight];
}


Measured memory_bytes: 80256
import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))


r = int(input())
print(3 * r * r)

pass


Measured memory_bytes: 38256
ls1 = [1,3,5,7,8,10,12]
ls2 = [4,6,9,11]
ls3 = [2]

x,y = map(int,input().split())

flg = "Yes"

if ls1.count(x) != ls1.count(y):
    flg = 'No'
elif ls2.count(x) != ls2.count(y):
    flg = 'No'
elif ls3.count(x) != ls3.count(y):
    flg = 'No'
else:
    pass

print(flg)

Measured memory_bytes: 38256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N, L;

signed main()
{
	cin >> N >> L;

	int all = 0;
	for (int i = 1; i <= N; i++)
	{
		all += L + i - 1;
	}

	int ans = 0;
	int min = INT_MAX;
	for (int j = 1; j <= N; j++)
	{
		int sum = 0;
		for (int i = 1; i <= N; i++)
		{
			if (i == j) continue;
			sum += L + i - 1;
		}
		int sub = abs(all - sum);
		if (sub < min)
		{
			min = sub;
			ans = sum;
		}
	}

	cout << ans;
}









Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*100+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
ll a[100],b[100];
int main(){
    std::ios::sync_with_stdio(false);
    ll i,n;
    cin>>n;
   // ll iinf=inf;
    //iinf*=inf;
    rep(i,n){
    	cin>>a[i];
    }
    ll sumi=0,steps=0,flag;
    
    while(1){
    	flag=0;
    	sumi=0;
    	rep(i,n){
    		if(a[i]<n){
    			flag++;
    		}
    	}
    	if(flag==n){
    		cout<<steps<<endl;
    		return 0;
    	}
    	rep(i,n){
    		b[i]=a[i]/n;
    		sumi+=b[i];
    	}
    	rep(i,n){
    		a[i]%=n;
    		a[i]+=sumi-b[i];
    	}
    	steps+=sumi;
    	//cout<<steps<<endl;
    }	
    
    return 0;      

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; --i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e8
#define MOD 1000000007
typedef long long ll;


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

    int s,w; cin >> s >> w;
    if(w>=s) cout << "unsafe" << endl;
    else cout << "safe" << endl;

    return 0;
}


Measured memory_bytes: 3640
using System;

class Program
{
    static void Main(string[] args)
    {
        string a = Console.ReadLine();
        string b = Console.ReadLine();
        string c = Console.ReadLine();
        int turn = 1;
        while (true)
        {
         /*   if (a == "") { }
            if (c == "") { Console.WriteLine("C"); break; }
            if (b == "") { Console.WriteLine("B"); break; }
           */ if (turn == 1) { if (a == "") { Console.WriteLine("A"); break; } if (a[0] == 'a') { turn = 1; } else if (a[0] == 'b') { turn = 2; } else if (a[0] == 'c') { turn = 3; } a =a.Substring(1); }
         else   if (turn == 2) { if (b == "") { Console.WriteLine("B"); break; } if (b[0] == 'a') { turn = 1; } else if (b[0] == 'b') { turn = 2; } else if (b[0] == 'c') { turn = 3; }  b =b.Substring(1); }
           else if (turn == 3) { if (c == "") { Console.WriteLine("C"); break; } if (c[0] == 'a') { turn = 1; } else if (c[0] == 'b') { turn = 2; } else if (c[0] == 'c') { turn = 3; } c =c.Substring(1); }
        }Console.ReadLine();
    }
}



Measured memory_bytes: 13140
#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()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  ll res = 0;
  if(k == 0){
    cout << n * n << endl;
    return 0;
  }

  for (ll b = k+1; b <= n; b++) {
    ll num = n / b;
    num *= b - k;
    res += num;
    ll tmp = n % b;
    // cout << tmp << endl;
    res += max(tmp - k + 1, 0ll);
    // cout << res << endl;
  }
  cout << res << endl;
}


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

int main() {
  int k,n; cin >> k >> n;
  vector<int> a(n);
  int mx = 0;
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  for(int i=0; i<n; i++){
    if(i != 0) mx = max(a[i] - a[i-1], mx);
    else mx = max(a[0]+k-a[n-1],mx);
  }
  cout << k-mx << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include <stdlib.h>

int com(const int *val1, const int *val2) {
	if ( *val1 < *val2 ) {
		return -1;
	} else if ( *val1 == * val2 ) {
		return 0;
	} else {
		return 1;
	}
}



int main (void){
	for (;;){
		int n;
		int i=0,j=0;
		
		scanf("%d",&n);
		if (n==0){
			break;
		}
		
		int taro[n];
		int hanako[n];
		int hcount=0;
		int cardcheck;
		for (i=0;i<n;i++){
			scanf("%d",&taro[i]);
		}
		qsort(taro, n, sizeof(int),(int (*)(const void *, const void *))com);
		
		
		for (i=1;i<=2*n;i++){
			cardcheck=0;
			for (j=0;j<n;j++){
				if(i==taro[j]){
					cardcheck=1;
				}
			}
			if (cardcheck==0){
				hanako[hcount]=i;
				hcount++;
			}
		}
		
		int tcards=n;
		int hcards=n;
		int tcheck[n];
		int hcheck[n];
		for (i=0;i<n;i++){
			tcheck[i]=0;
			hcheck[i]=0;
		}
		int mode=0;
		int yamahuda;
		
		for (;;){
			if (mode==0){
				for (i=0;i<n;i++){
					if (tcheck[i]==0){
						yamahuda=taro[i];
						tcheck[i]=1;
						break;
					}
				}
				tcards--;
				mode=3;
			}else if(mode==1){
				for (i=0;i<n;i++){
					if (hcheck[i]==0){
						yamahuda=hanako[i];
						hcheck[i]=1;
						break;
					}
				}
				hcards--;
				mode=2;
			}else if (mode==2){
				for (i=0;i<n;i++){
					if (taro[i]>yamahuda&&tcheck[i]==0){
						yamahuda=taro[i];
						tcheck[i]=1;
						tcards--;
						mode=3;
						break;
					}
				}
				if (i==n){
					mode=1;
					yamahuda=0;
				}
			}else if (mode==3){
				for (i=0;i<n;i++){
					if (hanako[i]>yamahuda&&hcheck[i]==0){
						yamahuda=hanako[i];
						hcheck[i]=1;
						hcards--;
						mode=2;
						break;
					}
				}
				if (i==n){
					mode=0;
					yamahuda=0;
				}
			}
			
			
			if (tcards==0||hcards==0){
				break;
			}
		}
		
		printf("%d\n",hcards);
		printf("%d\n",tcards);
		
		
	}
	return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

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

constexpr long long mod = 1000000007;

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

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

    int n;
    cin >> n;

    vll a(n);
    rep(i, n) cin >> a[i];

    vll b(n + 1, 0);

    b[0] = abs(a[0] - 0);

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

    ll sum = 0;
    for (int i = 0; i <= n; i++) {
        sum += b[i];
    }

    for (int i = 0; i < n; i++) {
        ll t = sum - (b[i] + b[i + 1]);

        if(i==0){
            t += abs(0 - a[1]);
        }else if(i==n-1){
            t += abs(0 - a[n - 2]);
        }else{
            t += abs(a[i - 1] - a[i + 1]);
        }

        cout << t << endl;
    }
}

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

int main() {
    int n;
    vector<long long> b;
    long long ans = 0;
    long long const mod = 1e9+7;
    cin >> n;
    b.assign(60, 0);
    for(int i=0;i<n;i++){
        long long a;
        cin >> a;
        for(int i=0;i<60;i++){
            b[i] += a%2;
            a >>= 1;
        }
    }
    for(int i=0;i<60;i++){
        ans += b[i]*(n-b[i]) % mod * ((1LL<<i)%mod);
        ans %= mod;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//run: g++ -std=c++14 -o run_sol.exe solution.cpp -DLOCAL_JUDGE
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define INFLL 1e17
#define PI 2*acos(0.0)
#define show(x) cout<< #x <<" is "<< x <<"\n"
using namespace std;

#define FS first
#define SC second
#define PB(t) push_back(t)
#define LEN(t) ((int)t.size())
#define ALL(t) t.begin(),t.end()
#define MP(x, y) make_pair((x), (y))
#define Fill(a,c) memset(&a, c, sizeof(a))
#define POPCOUNT __builtin_popcount

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;

int main() {
    #ifdef LOCAL_JUDGE
        freopen("../input.txt", "rt", stdin);
        freopen("../output.txt", "wt", stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    for (int n, k; cin >> n >> k;) {
        VI nums(n);

        for (auto& val : nums) {
            cin >> val;
        }

        VI dp(n, INF / 2);
        dp[0] = 0;
        for (int i = 1; i < n; i++) {
            for (int j = 1; j <= k and i - j >= 0; j++) {
                dp[i] = min(dp[i], dp[i - j] + abs(nums[i] - nums[i - j]));
            }
        }

        cout << dp[n - 1] << "\n";
    }

return 0;
}

Measured memory_bytes: 1024
from collections import defaultdict

N, K = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 19

acc = defaultdict(int)

x = [-INF]
y = [-INF]

for ex, ey in xy:
	acc[(ex, ey)] = 1
	x.append(ex)
	y.append(ey)

x.sort()
y.sort()

for i in range(N):
	for j in range(N + 1):
		acc[(x[i+1], y[j])] += acc[(x[i], y[j])]

for j in range(N):
	for i in range(N + 1):
		acc[(x[i], y[j+1])] += acc[(x[i], y[j])]

ans = INF
for i in range(1, N + 1):
	for j in range(i + 1, N + 1):
		for k in range(1, N + 1):
			for l in range(k + 1, N + 1):
				cnt = acc[(x[j], y[l])] - acc[(x[j], y[k-1])] - acc[(x[i-1], y[l])] + acc[(x[i-1], y[k-1])]
				if cnt >= K:
					sq = (x[j] - x[i]) * (y[l] - y[k])
					ans = min(ans, sq)

print(ans)


Measured memory_bytes: 55260
import scala.io.StdIn

object Main extends App {
  
  val a = StdIn.readLine().trim.split(' ').map(_.toInt)
  val d: Int = a(0)/a(1)
  val r: Int = a(0)%a(1)
  val f: Double = a(0).toDouble/a(1).toDouble
  
  print(d + " " + r + " " + f"$f%.5f")

}


Measured memory_bytes: 44076
import java.util.Scanner;
// import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String[] scan = scanner.nextLine().split(" ");
		int h = Integer.parseInt(scan[0]);
		int w = Integer.parseInt(scan[1]);
		String[][] map = new String[h][w];
		for(int i = 0; i < h; i++) {
			map[i] = scanner.nextLine().split("");
		}
		// for(int i = 0; i < h; i++) {
		// 	for(int j = 0; j < w; j++) {
		// 		System.out.print(map[i][j]);
		// 	}
		// 	System.out.println("");
		// }
		scanner.close();
		for(int i = 0; i < h; i++) {
			for(int j = 0; j < w; j++) {
				if(map[i][j].equals("#")) {
					boolean able = false;
					if(i > 0 && map[i - 1][j].equals("#")) able = true;
					if(i < map.length - 1 && map[i + 1][j].equals("#")) able = true;
					if(j > 0 && map[i][j - 1].equals("#")) able = true;
					if(j < map[i].length - 1 && map[i][j + 1].equals("#")) able = true;
					if(!able) {
						System.out.println("No");
						return;
					}
				}
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 23124
#include <iostream>

int main(){
    int n;
    std::cin >> n;
    int t = n;
    int tmp;
    int mltp4 = 0;
    for(int i = 0; i < n; i++){
        std::cin >> tmp;
        if(!(tmp%4)){
            mltp4++;
        }else if(!(tmp%2)){
            t--;
        }
    }
    if(t == n){ t--; }
    if(t - mltp4 > mltp4){
        std::cout << "No";
    }else{
        std::cout << "Yes";
    }
    return 0;
}


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 result = "WA";
		if("A".equals(S.substring(0,1)) &&
				(S.substring(S.length()-1)).toLowerCase().equals(S.substring(S.length()-1))) {
			for(int i = 1; i < S.length()-1; i++) {
				if("C".equals(S.substring(i,i+1))) {
					if(i == 1)  {
						result = "WA";
						break;
					}else if("WA".equals(result)) {
						result = "AC";
					}else {
						result = "WA";
						break;
					}
				}else if(!(S.substring(i,i+1).toLowerCase()).equals(S.substring(i,i+1))) {
					result = "WA";
					break;
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 26980
n, k = map(int, input().split())
a = list(map(int, input().split()))
r = 0
s = {0: [0]}
for i in range(n):
    r = (r + a[i] - 1) % k
    if r in s:
        s[r].append(i + 1)
    else:
        s[r] = [i + 1]
ret = 0
for key in s:
    a = s[key]
    en = 0
    for st in range(len(a)):
        while en < len(a) and a[en] - a[st] < k:
            en += 1
        ret += en - st - 1
print(ret)

Measured memory_bytes: 120392
import numpy as np
import itertools as it
n,m = map(int, input().split())
xyz_l = []
for _ in range(n):
    x,y,z = map(int, input().split())
    xyz_l.append((x,y,z))

xyz = np.array(xyz_l)

seed = ('+', '-')
pattern = list(it.product(seed, seed, seed))

ans = 0
for p in pattern:
    totals = []
    for (x,y,z) in xyz:
        t = 0
        if p[0] == '+':
            t += x
        else:
            t -= x
        if p[1] == '+':
            t += y
        else:
            t -= y
        if p[2] == '+':
            t += z
        else:
            t -= z
        totals.append(t)
    bs = list(reversed(sorted(totals)))
    cand = 0
    for i in range(m):
        cand += bs[i]
    ans = max(ans, cand)

print(ans)


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

int main(){
    int x, y;
    int a, b;

    cin >> x >> y;

    if (y % 2 != 0){
        cout << "No" << endl;
        return 0;
    }

    a = 2 * x - y / 2;
    b = y / 2 - x;

    if (a >= 0 and b >= 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define dd double
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ll long long
#define ull unsigned long long
#define ld long double
#define mx 200005
#define mod 1000000007
#define fr first
#define cti(a) (a-48)
#define itc(a) char(a+48)
#define se second
#define End cout<<"\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define memo(Array,val) memset(Array, val, sizeof Array)
#define PI acos(-1)
bool check(ll n, ll pos){ return (n&(1<<pos)); }
bool Set(ll n, ll pos) {  return (n | (1<<pos)); }
ld LOG(ld b, ld e){ return log(b)/log(e); }

void solve()
{
    ll n,m;
    cin >> n >> m;
    cout << (n*(n-1))/2+(m*(m-1))/2 << "\n";
}

int main()
{
    fast;
	int t;
	t=1;
	while(t--) solve();
	return 0;
}


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

int main(int argc, char const *argv[])
{
	int n, it = 0, ih = 0;
	string taro, hanako;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> taro >> hanako;
		if(taro.compare(hanako) < 0)
			ih+=3;
		else if(taro.compare(hanako) > 0)
			it+=3;
		else
		{
			++it;
			++ih;
		}
	}
	cout << it << " " << ih << endl;
	return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

vector<int> toposort(vector< vector<int> > &G){
  size_t N = G.size();
  vector<int> ret, d_in(N,0);
  for(size_t i = 0; i < N; ++i)
    for(size_t j = 0; j < G[i].size(); ++j)
      ++d_in[G[i][j]];
  queue<int> wait;
  for(size_t i = 0; i < N; ++i)
    if(!d_in[i]) wait.emplace(i);
  while(!wait.empty()){
    int v = wait.front();
    wait.pop();
    ret.emplace_back(v);
    for(size_t i = 0; i < G[v].size(); ++i){
      int v_ = G[v][i];
      --d_in[v_];
      if(!d_in[v_]) wait.emplace(v_);
    }
  }
  return ret;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector< vector<int> > G(N);
  for(int i = 0; i < M; ++i){
    int s, t;
    cin >> s >> t;
    G[s].emplace_back(t);
  }
  vector<int> order = toposort(G);
  for(int i = 0; i < N; ++i)
    cout << order[i] << endl;
  return 0;
}



Measured memory_bytes: 3732
N = int(input())
para = []
com = [] 
for i in range(N):
    a = int(input())
    para.append(a)
    com.append(a)
com.sort(reverse= True)
for i in range(N):
    if para[i] == com[0]:
        print(com[1])
    else:
        print(com[0])

Measured memory_bytes: 14980
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
B = sorted(A, reverse=True)
max = B[0]
second = B[1]
for i in range(N):
    if(max == second):
        print(max)
    else:
        if(A[i] == max):
            print(second)
        else:
            print(max)

Measured memory_bytes: 14076
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int S, W;
    cin >> S >> W;
    if(W>=S){
        cout << "unsafe" << endl;
    }else{
        cout << "safe" << endl;
    }
}

Measured memory_bytes: 3620