akhauriyash/Code-Regression huggingface dataset:
using System;
class test{
  static void Main(){
  int n = int.Parse(Console.ReadLine());
  var line = Console.ReadLine().Split(' ');
  int[] x = new int[n];
  int min = 101;
  int max = 0;
  for(int i = 0;i < n;i++)
  {
    x[i] = int.Parse(line[i]);
  }

  int[] sum = new int[100];

  for(int i = 0;i < 100;i++)
  {
    for(int j = 0;j < n;j++)
    {
      sum[i] += (x[j] - i)*(x[j] - i);
    }
  }
  

  int ans = sum[0];
  for(int i = 0;i < 100;i++)
  {
    
    if(sum[i] < ans)
    ans = sum[i];
  }
  Console.WriteLine(ans);
  
  }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    // 0に(0, 0)
    int st = 0, sx = 0, sy = 0;
    bool flag = true;
    rep(i, n) {
        int ti, xi, yi; cin >> ti >> xi >> yi;
        int t = ti - st;
        int d = abs(sx-xi) + abs(sy-yi);
        if (!(d<=t && t%2==d%2)) flag = false;
    }
    if (flag) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(int n)
    {
        var a = new int[n];
        for (int i = 1; i * i <= n; i++)
            for (int j = 1; j * j <= n; j++)
                for (int k = 1; k * k <= n; k++)
                {
                    var t = i * i + j * j + k * k + i * j + j * k + k * i;
                    if (t <= n) a[t - 1]++;
                }
        Console.WriteLine(string.Join("\n", a));
    }
}


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

int main() {
    ld a, b, x;
    cin >> a >> b >> x;
    ld y = a*a*b - x;
    ld Sx=x/a, Sy=y/a;
    ld Sj = a*b/2;
    ld ans;
    ld pi = 3.14159265358979323846;
    if (Sy <= Sj) {
        ld p = (2*Sy)/(a*a);
        ans = atan(p);
    }
    else {
        ld p = (2*Sx)/(b*b);
        ans = pi/2 - atan(p);
    }
    // ans = atan((2*Sy)/(a*a));
    ans *= 180/pi;

    cout << fixed << setprecision(8);
    cout << ans << endl;
}

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

typedef long long ll;
#define int         ll
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;
typedef vector<long long> vll;
typedef vector<vll> vlll;

const int           mod = 1e9 + 7;
#define pb          push_back
#define test        int t; cin >> t; while(t--)
#define debug1(x)    cout << '>' << #x << ':' << x << "\n";
#define endl        '\n'
#define off         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define max(a,b)   (a>b?a:b)
#define min(a,b)   (a<b?a:b)


template <typename Arg1>
void pr(Arg1&& arg1) {cout << arg1 << endl;}
template <typename Arg1, typename... Args>
void pr(Arg1&& arg1, Args&&... args)
{
  cout << arg1 << " ";
  pr(args...);
}

template <typename Arg1> void rd(Arg1& arg1) {cin >> arg1;}
template <typename Arg1, typename... Args>
void rd(Arg1& arg1, Args&... args)
{
  cin >> arg1;
  rd(args...);
}


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

template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  for (T i : v) {
    out << i<<" ";
  }
  return out;
}
#define debug(...) deb(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void deb(const char* name, Arg1&& arg1) {cout << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void deb(const char* names, Arg1&& arg1, Args&&... args)
{
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " = " << arg1;
  deb(comma, args...);
}





int32_t main() {

  off;
    
  int n;
  cin>>n;
  vi ar1(n);
  map<int,int> mp;
  vi ar2(n-1);
  for (int i = 0; i < n; ++i){
          cin>>ar1[i];
  }
  for (int i = 0; i < n; ++i){
          int x;
          cin>>x;
          mp[i+1]=x;
  }
  for (int i = 1; i < n; ++i){
          cin>>ar2[i-1];
  }
  int ans=0;
  int lst=-1;
  for (int i = 0; i < n; ++i){
          ans+=mp[ar1[i]];
          if(ar1[i]==lst+1)
            ans+=ar2[ar1[i]-2];
        lst=ar1[i];
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll N;
    cin >> N;
    ll res = N;
    // 6^p(p = 0,1,...)円を用いてi円はらい、9^p(p = 0,1,...)円を用いて(N-i)円払う
    for(ll i = 0; i <= N; ++i) {
        ll cc = 0;
        ll t = i;
        while(t>0) cc += t%6, t /= 6;
        t = N - i;
        while(t>0) cc += t%9, t /= 9;
        if(res > cc) res = cc;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    int R;
    cin >> R;
    if(R < 1200){
        cout << "ABC" << endl;
    }else if(R < 2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,a,b) for (int i = (int)(a);i < (int)(b);++i)
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    int N; cin >> N;
    vector<ll> A(3*N);
    rep(i,3*N) cin >> A[i];

    priority_queue<ll,vector<ll>,greater<ll>> q1;
    priority_queue<ll,vector<ll>> q2;
    vector<ll> left(N + 1);
    vector<ll> right(N + 1);
    
    ll X = 0;
    rep(i,N) {q1.push(A[i]); X += A[i];}
    left[0] = X;
    rep(i,N) {
        X += A[i + N];q1.push(A[i + N]);
        X -= q1.top(); q1.pop();
        left[i + 1] = X;
    }
    ll Y = 0;
    rep(i,N) {q2.push(A[3*N - i - 1]); Y += A[3*N - i - 1];}
    right[N] = Y;
    rep(i,N) {
        Y += A[2*N - i - 1]; q2.push(A[2*N - i - 1]);
        Y -= q2.top(); q2.pop();
        right[N - i - 1] = Y;
    }
    ll ans = -HINF;
    rep(i,N + 1) ans = max(ans,left[i] - right[i]);
    cout << ans << '\n';
    return 0;
}

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

int n,k,cnt;
string s;

int main()
{
	
	cin>>n>>k;
	cin>>s;
	for(int i=1;i<n;i++)
		if(s[i]!=s[i-1]) cnt++;
	cnt++;
	cout<<min(n-1,n-cnt+2*k)<<'\n';
	
	return 0;
}

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

int main() {
  int N; cin >> N;
  vector<int> s(N); for (int i = 0; i < N; i++) cin >> s[i];

  int sum = 0; for (int i = 0; i < N; i++) sum += s[i];

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

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (sum % 10 != 0) {
      ans = sum;
      break;
    }

    if (s[i] % 10 != 0) {
      ans = sum - s[i];
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N, K = MAP()
A = LIST()
cnt = sorted(list(Counter(A).values()), reverse=True)
print(sum(cnt[K:]))



Measured memory_bytes: 34832
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


namespace mp = boost::multiprecision;

int main(){
  int n;
  cin >> n;
  mp::cpp_int a[n];
  mp::cpp_int prod=1;
  mp::cpp_int x=1;
  rep(i,18)x*=10;
  rep(i,n){
    cin >> a[i];
    if(a[i]==0){
      cout << 0 << endl;
      return 0;
    }
  }
  rep(i,n){
    if(a[i]>x){
      cout << -1 << endl;
      return 0;
    }
  }
  rep(i,n){
    prod*=a[i];
    if(prod>x){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << prod << endl;
return 0;}

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

class MainClass {
  public static void Main (string[] args) {
    var list = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    var N = list[0];
    var M = list[1];
    var lista = new List<long>();
    for(var i = 0; i < M; i++){
      var temp = Console.ReadLine().Split(' ').Select(long.Parse);
      lista.Add(temp.ElementAt(0));
      lista.Add(temp.ElementAt(1));
    }
    var ie = lista.GroupBy(g => g).Select(x => new {no = x.Key, count = x.Count()}).OrderBy(e => e.no).ToList();

    var c = 0;
    for(var i = 1; i <= N; i++){
      if(!ie.Select(x => x.no).Contains(i)){
        Console.WriteLine(0);
      }else{
        Console.WriteLine(ie[c].count);
        c++;
      }
    }

  }
}

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


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

using static Input;
using static Util;
class Program
{
    static int X;
    static void INPUT()
    {
        X = NextInt();
    }

    static void OUT()
    {
        var a = X / 500;
        var b = (X % 500) / 5;
        Console.WriteLine(a * 1000 + b * 5);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




Measured memory_bytes: 11220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

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

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		int k = fs.nextInt();
		String ans = "";
		for(int i = 0; i < k; i++) {
			ans+="ACL";
		}
		
		System.out.println(ans);
	} 

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 36508
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main(int argc, char const *argv[])
{
	unsigned long n,m,s,c,v;
	cin >> n >> m;
	v =0;
	if(m >= 2*n){
		v += n;
		m -= 2*n;
		n=0;
		v+=m/4;
		// debug(n);
		// debug(m);
	}
	else{
		v+=m/2;
		n -= m/2;
		m -= v*2;
		// debug(n);
		// debug(m);
	}
	cout << v << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b
ll f(ll a,ll b){
	if(b==0)return 1;
	if(b%2==0){
		ll t=f(a,b/2);
		return t*t;
	}
	return a*f(a,b-1);
}

signed main(){
	int n; cin>>n;
	map<ll,ll> mp;
	mp[0]=1;
	ll sum=0,ans=0;
	rep(i,0,n){
		ll a; cin>>a;
		sum+=a;
		ans+=mp[sum];
		mp[sum]++;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int A,B; cin >> A >> B;
    if((11+A)%13 > (11+B)%13) cout << "Alice" << endl;
    else if((11+A)%13 < (11+B)%13) cout << "Bob" << endl;
    else cout << "Draw" << endl;
    return 0;
}

Measured memory_bytes: 3592
import sys

#+++++		
		
def main():
	m, n = map(int, input().split())
	
	ll=[[] for _ in range(m+1)]
	lll=[]
	for ii in range(n):
		pi, yi = map(int, input().split())
		a=(ii,pi,yi)
		ll[pi].append(a)
		lll.append(a)
	
	for mm in ll:
		mm.sort(key=lambda x:x[2])
		#print(mm)
		for i, v in enumerate(mm):
			tmp = v[1]*1000000+(i+1)
			ofs='0'*(12-len(str(tmp)))
			lll[v[0]] = ofs + str(tmp)
			
	for iii in lll:
		print(iii)
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 39888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(void){
    ll N; cin >> N;
    int k=0;

    while(k*(k+1)/2 < N) k++;
    
    int dis = k*(k+1)/2 - N;

    for(int i=1; i<=k; i++){
        if(i == dis) continue;

        cout << i << endl;
    }
}

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

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

	string ans = "hon";
	int f = n.at(n.length()-1) - '0';
	if (f == 3) {
		ans = "bon";
	} else if (f == 0 || f == 1 || f == 6 || f == 8) {
		ans = "pon";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<int, Pi> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main() {
    int n;
    VE a;
    int A;
    cin >> n;
    REP(i, n){
        cin >> A;
        a.push_back(A);
    }
    sort(a.rbegin(), a.rend());
    int alice, bob;
    REP(i, n){
        if(i % 2 == 0){
            alice += a[i];
        }else{
            bob += a[i];
        }
    }
    print(alice - bob);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()


const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

int main() {
  double x1,y1,x2,y2,xq,yq;
  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&xq,&yq)==6) {
    P p1(x1,y1), p2(x2,y2), pq(xq,yq);
    double ang = 2*(arg(p2-p1)-arg(pq-p1));
    P pr;
    pr = p1 + (pq-p1) * P(cos(ang), sin(ang));
    printf("%.6lf %.6lf\n", pr.real(), pr.imag());
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 1<<10|3;
int n,m,pre[N][N],a[N][N];
inline int calc(int x1,int y1,int x2,int y2){
	return pre[x2][y2]-pre[x1-1][y2]-pre[x2][y1-1]+pre[x1-1][y1-1];
}
inline int calc(){
	For(i,1,n) For(j,1,m) pre[i][j]=pre[i-1][j]+pre[i][j-1]-pre[i-1][j-1]+a[i][j];
	int ans=0;
	For(i,1,n) For(j,1,m)
		For(_i,i,n) For(_j,j,m) ans+=calc(i,j,_i,_j)&1;
	return ans;
}

int ans[N][N];
inline void Build(int x1,int y1,int x2,int y2){
	if (y2-y1==0||x2-x1==0) return;
	int m1=(x1+x2)/2,m2=(y1+y2)/2;
	ans[(x1+x2)/2][(y1+y2)/2]=0;
	Build(x1,y1,m1-1,m2-1);
	Build(x1,m2+1,m1-1,y2);
	Build(m1+1,y1,x2,m2-1);
	Build(m1+1,m2+1,x2,y2);
}

int main(){
	int n=(1<<read())-1,m=(1<<read())-1;
	For(i,1,n) For(j,1,m) ans[i][j]=1;
	Build(1,1,n,m);
	For(i,1,n){
		For(j,1,m) printf("%d",ans[i][j]);
		puts("");
	}
}

Measured memory_bytes: 7808
// Working program with FastReader
import java.io.BufferedReader; 

import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer;
import java.lang.*;
public class Main
{ 
	static class FastReader 
	{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	} 

	long gcd(long a, long b) {
		if(b==0) {
			return a;
		}
		return gcd(b,a%b);
	}
	public static void main(String[] args) {
		FastReader ob = new FastReader();
		long a = ob.nextLong(),b=ob.nextLong();
		long gcd=0;
		Main ob1 = new Main();
		gcd = ob1.gcd(a,b);
		System.out.println(a*b/gcd);
	}

} 


Measured memory_bytes: 21972
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 2010
#define INF 2140000000
#define MOD 1000000007

long long bin[MAX][MAX] = {0};

void pascal_trianlge() {
	bin[0][0] = 1;
	for (int i = 1; i < MAX; ++i) {
		bin[i][0] = bin[i][i] = 1;
		for (int j = 1; j < i; ++j) {
			bin[i][j] = (bin[i-1][j] + bin[i-1][j-1]) % MOD;
		}
	}
}

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

	for (int i = 1; i < k + 1; ++i) {
			cout << (bin[n - k + 1][i] * bin[k - 1][k - i]) % MOD  << endl;
	}

	return 0;
}

Measured memory_bytes: 30336
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int h[100100];
vector<pair<int,int> > g[100100];
long long d1[100100];
int v[100100];
int main(){
	int a,b;
	long long x;
	scanf("%d%d%lld",&a,&b,&x);
	for(int i=0;i<a;i++){
		scanf("%d",h+i);
	}
	for(int i=0;i<b;i++){
		int p,q,r;
		scanf("%d%d%d",&p,&q,&r);
		p--;q--;
		g[p].push_back(make_pair(q,r));
		g[q].push_back(make_pair(p,r));
	}
//	printf("in\n");
	for(int i=0;i<a;i++)d1[i]=21000000000000000LL;
	priority_queue<pair<long long,int> > Q;
	Q.push(make_pair(0,0));
	d1[0]=0;
	while(Q.size()){
		int at=Q.top().second;
		long long cost=-Q.top().first;
		Q.pop();
		if(v[at])continue;
		v[at]=1;
		for(int i=0;i<g[at].size();i++){
			long long T=cost+g[at][i].second;
			if(-T+x>h[g[at][i].first]){
				T=x-h[g[at][i].first];
			}
			if(g[at][i].second>h[at])continue;
			
			if(!v[g[at][i].first]&&T<d1[g[at][i].first]){
				d1[g[at][i].first]=T;
				Q.push(make_pair(-d1[g[at][i].first],g[at][i].first));
			}
		}
	}
	if(d1[a-1]>1000000000000000LL)printf("-1\n");
	else{
		long long ret=d1[a-1];
	//	if(d1[a-1]>x){
			ret+=d1[a-1]-x;
	//	}
//		printf("%lld\n",d1[a-1]);
		printf("%lld\n",ret+h[a-1]);
	}
}

Measured memory_bytes: 14328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
	ll n;
	cin >> n;
	ll now = n;
	ll cnt = 0;
	while(now > 0){
		now/=2;
		cnt++;
	}
	ll ans = pow(2,cnt) - 1;
	cout << ans << endl;
}

Measured memory_bytes: 384
#! -*- coding:utf-8 -*-
n = int(input())
a = list(map(int,input().split()))
arr = []
count = 0
for i in range(len(a)):
    if a[i] <= 3199:
        arr.append(a[i] // 400)
    else:
        count += 1
if len(set(arr)) != 0:
    print(len(set(arr)), len(set(arr)) + count,sep = ' ')
else:
    print(1, count,sep = ' ')


Measured memory_bytes: 3060
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<int32_t, int32_t>;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int32_t a, b;
  cin >> a >> b;
  cout << (a * b) << " " << (a + b) * 2 << endl;

  return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const ll INF = 1e15;
int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,K;cin >> N >> K;
  vector<ll> v(N+1,0);
  rep(i,N)cin >> v[i+1];
  ll dp[N+1][N+1];
  rep(y,N+1) dp[0][y] = INF;
  rep(x,N+1) dp[x][0] = INF;
  dp[0][0] = 0;

  rep(y,N-K){
    rep(x,N){
      dp[x+1][y+1] = INF;
      if(x<y)continue;
      rep(i,x+1) dp[x+1][y+1] = min(dp[x+1][y+1], dp[i][y] + max(0ll,v[x+1]-v[i]) );
    }
  }
  /*
  rep(y,N-K+1){
    rep(x,N+1) cout << dp[x][y] SPF;
    cout << endl;
  }
  */
  ll ans = INF;
  rep(x,N+1) ans = min(ans,dp[x][N-K]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>

int m, n;
std::string S, T;
int dp[2010][2010][2]; // 0: テ・ツ・ツ?ヲツ閉ー(Iテァツオツづァツォツッ), 1: テ・ツ?カテヲツ閉ー(Oテァツオツづァツォツッ)

int main() {
    std::cin >> m >> n;
    std::cin >> S >> T;

    int max = 0;
    for(int i = 0; i <= m; ++i) {
        for(int j = 0; j <= n; ++j) {
            if(S[i] == 'I') {
                dp[i + 1][j][0] = std::max(dp[i][j][1] + 1, dp[i + 1][j][0]);
            }else if(S[i] == 'O' && dp[i][j][0]){
                dp[i + 1][j][1] = std::max(dp[i][j][0] + 1, dp[i + 1][j][1]);
            }

            if(T[j] == 'I') {
                dp[i][j + 1][0] = std::max(dp[i][j][1] + 1, dp[i][j + 1][0]);
            }else if(T[j] == 'O' &&dp[i][j][0]){
                dp[i][j + 1][1] = std::max(dp[i][j][0] + 1, dp[i][j + 1][1]);
            }

            max = std::max(max, dp[i][j][0]);
        }
    }

    std::cout << max << std::endl;
}

Measured memory_bytes: 34660
def linked(node, path):
  q = []
  q.append(node.keys()[0])
  while True:
    if len(q) == 0:
      break
    s = q.pop()
    if s in path:
      lst = path[s]
      for k in path[s].keys():
        if node[k] == False:
          node[k] = True
          q.append(k)
  for v in node.values():
    if v == False:
      return False
  return True

while True:
  n = int(raw_input())
  if n==0:
    break
  dic = {}
  node = {}
  path = {}
  for _ in xrange(n):
    word = raw_input()
    node[word[0]] = False
    node[word[len(word)-1]] = False
    if word[0] not in path:
      path[word[0]] = {}
    path[word[0]][word[len(word)-1]] = True

    if word[0] in dic:
      del dic[word[0]]
    else:
      dic[word[0]] = True
    if word[len(word)-1] in dic:
      del dic[word[len(word)-1]]
    else:
      dic[word[len(word)-1]] = True
  if len(dic) == 0:
    if linked(node, path):
      print "OK"
    else:
      print "NG"
  else:
    print "NG"
  dic = {}

Measured memory_bytes: 6416
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextpint(void){ char c=getc_unlocked(stdin); while(c<'0'||'9'<c) c=getc_unlocked(stdin); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getc_unlocked(stdin); } return x; }
void printpint(uint32_t x){ int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putc_unlocked(s[i], stdout); }
int main(void){
	uint32_t n=nextpint();
	uint32_t m=nextpint();
	{
		uint32_t a=m+1;
		for(uint32_t i=m/2; i>0; i--){
			printpint(i);
			putchar(32);
			printpint(a-i);
			putchar(10);
		}
	}
	{
		uint32_t a=(m+1)*2;
		for(uint32_t i=(m+1)/2; i>0; i--){
			printpint(m+i);
			putchar(32);
			printpint(a-i);
			putchar(10);
		}
	}
}




Measured memory_bytes: 1508
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

void solve(int n,int m){
    vector<int> a(n);
    iota(a.begin(),a.end(),1);
    reverse(a.begin(),a.end());
    rep(i,m){
        vector<int> na(n);
        int p,c;
        cin>>p>>c;
        rep(i,p-1){
            na[i+c]=a[i];
        }
        REP(i,p-1,p+c-1){
            na[i-p+1]=a[i];
        }
        REP(i,p+c-1,n)na[i]=a[i];
        swap(na,a);
    }
    cout<<a[0]<<endl;
}

int main(){
    int n,m;
    while(cin>>n>>m,n!=0){
        solve(n,m);
    }
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

int main(){
  int N; cin >> N;
  vector <ll> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> B[i];

  ll plus = 0, minus = 0;
  for (int i = 0; i < N; i++){
    if (A[i] < B[i]){
      plus += (B[i] - A[i]) / 2;
    }else{
      minus +=A[i] - B[i];
    }
  }
  
  if (plus >= minus){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  


  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;cin>>n;
  int sum=0, sum2=0, d;
  
  for(int i=0; i<n; i++){
    cin >> d;
    sum += d;
    sum2 += d*d;
  }
  cout << (sum*sum-sum2)/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int N;
  cin >> N;
  long long int a[N];
  long long int b[N];
  for (int i = 0; i < N; i++) cin >> a[N-i-1] >> b[N-i-1];
  long long int sum = 0;
  for (int i = 0; i < N; i++) {
    a[i] += sum;
    long long t = b[i] - a[i] % b[i];
    if (a[i] % b[i] != 0) {
      a[i] += t;
      sum += t;
    }
  }
  cout << sum << endl;
}

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

typedef struct cord {
	char suit;
	char value;
} Cord;

void BubbleSort( Cord a[], int n ) {
	for ( int i = 0; i < n-1; i++ ) {
		for ( int j = n-1; j > i; j-- ) {
			if ( a[j].value < a[j-1].value ) {
				swap( a[j], a[j-1] );
			}
		}
	}
}

void SelectionSort( Cord a[], int n ) {
	for ( int i = 0; i < n-1; i++ ) {
		int min = i;
		for ( int j = i; j < n; j++ ) {
			if ( a[j].value < a[min].value ) {
				min = j;
			}
		}
		swap( a[i], a[min] );
	}
}

void Print( Cord a[], int n ) {
	for ( int i = 0; i < n; i++ ) {
		if ( i ) cout << " ";
		cout << a[i].suit << a[i].value;
	}
	cout << endl;
}

bool IsStable( Cord C1[], Cord C2[], int n ) {
	for ( int i = 0; i < n; i++ ) {
		if ( C1[i].suit != C2[i].suit ) {
			return false;
		}
	}
	return true;
}

//void InsertionSort( Cord a[], int n ) {
//	for ( int i = 1; i < n; i++ ) {
//		int key = a[i].value;
//		int j;
//		for ( j = i-1; j >= 0; j-- ) {
//			if ( key < a[j].value ) {
//				a[j+1] = a[j];
//			}	
//		}
//		a[j+1].value = key;
//	}
//}

int main() {
	
	Cord C1[100], C2[100];
	int n;
	char ch;
	
	cin >> n;
	for ( int i = 0; i < n; i++ ) {
		cin >> C1[i].suit >> C1[i].value;
	}
	for ( int i = 0; i < n; i++ ) {
		C2[i] = C1[i];
	}
	
	BubbleSort(C1, n);
	SelectionSort(C2, n);
	
	Print(C1, n);
	cout << "Stable\n";
	Print(C2, n);
	if ( IsStable( C1, C2, n ) ) {
		cout << "Stable\n";
	} else {
		cout << "Not stable\n";
	}
	
	return 0;
}

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

int main() {
  int x;
  cin >> x;
  int ans = 1;
  for (int i = 1; i < 100; i++) {
    for (int j = 2; j < 100; j++) {
      int a = pow(i, j);
      if (ans < a && a <= x) {
        ans = a;
      }
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();
    let c: usize = itr.next().unwrap().parse().unwrap();
    let mut st = std::collections::HashSet::new();
    st.insert(a);
    st.insert(b);
    st.insert(c);
    println!("{}", st.len());
}


Measured memory_bytes: 2120
n = gets.chomp.to_i
xyh = []
n.times do
  xyh.push gets.split.map(&:to_i)
end
all = (0..100).to_a.product((0..100).to_a)
candidates = []
is_first=true
xyh.sort_by { |e| e[2] }.reverse.each do |e|
  x = e[0]
  y = e[1]
  h = e[2]
  as = []
  (is_first ? all : candidates).each do |a|
    cx = a[0]
    cy = a[1]
    ch = a[2]
    if h > 0
      cch = h + (x-cx).abs + (y-cy).abs
      as.push [cx, cy, cch] if is_first || ch == cch
    else
      i = 1
      if is_first
        while i - (x-cx).abs - (y-cy).abs <= 0
          as.push [cx, cy, i]
          i+=1
        end
      else
        as.push [cx, cy, ch] if ch - (x-cx).abs - (y-cy).abs <= 0
      end
    end
  end
  candidates = as
  is_first=false
end
puts candidates.first.join(' ')


Measured memory_bytes: 3324
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

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

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

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

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

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 10000;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

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

void solve() {
	int a, b; cin >> a >> b;
	if (a <= b) {
		cout << "unsafe\n";
	}
	else {
		cout << "safe\n";
	}
}


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


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

using namespace std;

string s;
int ans;

int main(){
//	freopen("input.inp", "r", stdin);
	cin >> s;
	int n = s.length();
        ans = n;
	for(int i = 1; i < n; ++i) if (s[i] != s[i - 1]){
		ans = min(ans, max(i, n - i));
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
#define min(a, b) ((a) < (b) ? (a) : (b))



long long gcd(long long a, long long b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}

double calculateDegree(double side, double B) {
	double radian = atan2(side, B);
	double degree = radian * (180.0 / 3.141592653589793238463);
	return degree;
}

int main() {
	int N, K;
	string S;
	cin >> N >> K >> S;
	int score = 0;
	for (int i = 0; i < N- 1; i++) {
		if (S[i] == S[i + 1])score++;
	}
    // Kが大きくなってN-1以上にすることを防止
	int ans = min(score + 2 * K, N - 1);
	cout << ans << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int power = scan.nextInt();
		int kuti = scan.nextInt();

		System.out.println((int)Math.ceil((double)(kuti-1)/(double)(power-1)));
		scan.close();
	}

}


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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

int n, k;
string s;
vi vn, vt;

int main()
{
    ci >> n >> k >> s;

    int type = s[0] - '0';
    int ren = 1;
    
    for(int i = 1; i < n; i++) {
	if(type == s[i] - '0') {
	    ren++;
	} else {
	    vn.pb(ren);
	    vt.pb(type);
	    type = s[i] - '0';
	    ren = 1;
	}
    }
    vn.pb(ren);
    vt.pb(type);

    int head = 0,  tail = 0;
    int val = vn[0];
    int mx = val;
    if(vt[0] == 0) k--;
    
    while(head < vn.size() - 1) {
	if(vt[head + 1] == 1) {
	    val += vn[++head];
	} else if(k) {
	    val += vn[++head];
	    k--;
	} else {
	    if(vt[tail] == 0) k++;
	    val -= vn[tail];
	    tail++;
	}

	mx = max(mx, val);
    }

    co << mx << en;
    
    return 0;
}


Measured memory_bytes: 1404
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(void){
    // Your code here!
    int h,w;
    cin>>h>>w;
    queue<P> P1;
    queue<P> P2;
    int maze[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>maze[i][j];
        }
    }
    int dx[2]={1,0};
    int dy[2]={0,1};
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(maze[i][j]%2==1){
                for(int k=0;k<2;k++){
                    if(dy[k]+i>=0 && dy[k]+i<h && dx[k]+j>=0 && dx[k]+j<w){
                        maze[i][j]--;
                        maze[dy[k]+i][dx[k]+j]++;
                        P1.push(P(i,j));
                        P2.push(P(dy[k]+i,dx[k]+j));
                        //cout<<P2.front().first<<endl;
                        break;
                        
                    }
                }
            }
        }
    }
    /*for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout<<maze[i][j];
        }
        cout<<endl;
    }*/
    int x1,y1,x2,y2;
    int ww=P1.size();
    cout<<ww<<endl;
    for(int i=0;i<ww;i++){
        x1=P1.front().first;
        y1=P1.front().second;
        x2=P2.front().first;
        y2=P2.front().second;
        //cout<<"W"<<endl;
        cout<<x1+1<<" "<<y1+1<<" "<<x2+1<<" "<<y2+1<<endl;
        P1.pop();
        P2.pop();
    }
}


Measured memory_bytes: 5120
#include<iostream>
#include<cstdio>
#define mod 1000000007
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,A,B,C,D;
int main()
{
	n=read();A=read();B=read();C=read();D=read();
	for(int i=0;i<=n-1;++i)
	{
		long long mx=A+1LL*i*D-1LL*(n-1-i)*C;
		long long mn=mx-1LL*(n-1)*(D-C);
		if(B>=mn&&B<=mx) return 0*puts("YES");
	}
	puts("NO");
	return 0;
}



Measured memory_bytes: 256