akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
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 = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // 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); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; 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; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    lint ans = 0;
    for(int i = 0; i < N; i++){
        lint V;
        cin >> V;
        ans += (V - i - 1);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3100
import Numeric

main :: IO ()
main = getLine >>= mapM_ putStrLn . map myShow . slh . map read . words
  where slh [a, b, deg] = [a * b * sin rad / 2, a + b + sqrt (a ** 2 + b ** 2 - 2 * a * b * cos rad), b * sin rad] where rad = deg / 180 * pi
        myShow f = showFFloat Nothing f ""

Measured memory_bytes: 4028
open Batteries
(* charのlistをstringに *)
let string_of_chars chars = 
  let buf = Buffer.create 16 in
  List.iter (Buffer.add_char buf) chars;
  Buffer.contents buf

(* 文字列をcharのlistにする *)
let explode s = List.init (String.length s) (String.get s)
let n = read_int ()
let s, t = Scanf.sscanf (read_line()) "%s %s" (fun s t ->
  s, t
)
let l = List.concat @@ List.map (fun a -> let (b, c) = a in b :: c :: []) @@ List.combine (explode s) (explode t)
let _ = print_endline @@ string_of_chars l

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var ans = 0;
            var chk = 0;
            for (int i = 0; i < 5; i++)
            {
                var num = ReadInt();
                var rem = num % 10 == 0 ? 10 : num % 10;
                if ((10 - rem) > chk)
                {
                    chk = 10 - rem;
                }
                if (num % 10 == 0) ans += num;
                else ans += num / 10 * 10 + 10;
            }
            ans -= chk;

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 11092
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.LinkedList;

public class Main {
    static FastScanner in;
    static PrintWriter out;
    static int N;
    static int Q;
    static LinkedList<Integer>[] v;
    static int[] ans;
    static int[] parent;
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        in = new FastScanner(inputStream);
        out = new PrintWriter(outputStream);
        solve();
        out.flush();
    }

    static void solve() {
        N=in.nextInt();
        Q=in.nextInt();
        v=new LinkedList[N+1];
        ans=new int[N+1];
        parent=new int[N+1];
        for(int i=1;i<=N;i++) {
            v[i]=new LinkedList<Integer>();
        }
        for(int i=1;i<=N-1;i++) {
            int a=in.nextInt();
            int b=in.nextInt();
            v[a].add(b);
            parent[b]=a;

        }

        for(int i=0;i<Q;i++) {
            int p=in.nextInt();
            int q=in.nextInt();
            ans[p]+=q;
        }


        for(int i=2;i<=N;i++) {

            int pi=parent[i];
//            System.err.println("i pi "+i+" "+pi);

            if(pi!=0) {ans[i]+=ans[pi];}

        }

        for(int i=1;i<=N;i++) {
            out.print(ans[i]+" ");
        }
        out.println();
    }


    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}


Measured memory_bytes: 62700
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    string s;
    cin >> s;
    bool ans = s == "ABC";
    cout << (ans? "ARC" : "ABC") << endl;
}

Measured memory_bytes: 3136
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <vector>
#define ll long long
#define INF 1000000001
using namespace std;
struct Edge{int from, to, cost;};

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

    int n;
    cin >> n;
    int a[200001];
    int b[200001];
    map<int,int> mp;

    REP(i,n){
        cin >> a[i];
        if(mp[a[i]] == 0) mp[a[i]] = 1;
        else if(mp[a[i]] > 0) mp[a[i]]++;
    }

    int m;
    cin >> m;

    REP(i,m){
        cin >> b[i];
        mp[b[i]]--;
    }
    int flag = 0;
    REP(i,m){
        if(mp[b[i]] < 0){
            flag = 1;
            break;
        }
    }

    if(flag == 1) cout << "NO" << endl;
    else cout << "YES" << endl;

}

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

int main()
{
    int n;
    cin>>n;
    ll ara[n];
    int flag=1;
    for(int i=0; i<n; i++)
    {
        cin>>ara[i];
        if(ara[i]%2) flag=0;
    }
    if(flag)
    {
        int cnt=0;
        while(flag)
        {
            for(int i=0; i<n; i++)
            {
                ara[i]/=2;
                if(ara[i]%2) flag=0;
            }
            cnt++;
        }
        cout<<cnt<<endl;
    }
    else
        cout<<0<<endl;

}


Measured memory_bytes: 3644
N= int(input())
A = [list(map(int, input().split(" "))) for i in range(N)]
A.insert(0, [0, 0, 0])

count = 0

for i in range(0,N):
	x = A[i+1][0] - A[i][0] + A[i+1][1] - A[i][1] + A[i+1][2] - A[i][2]
	y = A[i+1][0] - A[i][0]
	if x%2==0 and x <= 2*y:
		count += 1

if count == N:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 27324
import java.util.*;

public class Main {

    /* チェックリスト
     * intの範囲を超えていないか
     * TLEしそうな処理の有無
     */
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] ds = sc.nextLine().split(" ");
        List<Integer> ints = new ArrayList<Integer>();
        for(int i = 0;i < n;i++){
            ints.add(Integer.parseInt(ds[i]));
        }
        long result = 0;
        for(int i = 0;i < n;i++){
            for(int j = i;j < n;j++){
                if(i != j) {
                    result += ints.get(i) * ints.get(j);
                }
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 21840
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  ll i=1;
  while(i*i+i<2*n)
  {
     i++;
  }
  if(i*i+i==2*n)
  {
    cout<<i<<endl;
  }
  else
  {
    cout<<i<<endl;
  }

}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline #for input speed
sys.setrecursionlimit(10**6) #for deep recursion
n, q = map(int, input().split())

tree_index = [[] for _ in range(n)]
for i in range(n-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  tree_index[a].append(b) # a<bとは限らないため、双方向にする
  tree_index[b].append(a)
ans = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x
def dfs(cur, par):
    for chl in tree_index[cur]:
      if chl == par: #parentとchildが等しい時はスキップ
        continue
      ans[chl] += ans[cur] 
      dfs(chl, cur)
dfs(0, -1)
print(*ans)

Measured memory_bytes: 230960
import sys
readline = sys.stdin.readline

K = int(readline())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[K - 1])

Measured memory_bytes: 38384
#include <iostream>
#include <boost/multiprecision/cpp_dec_float.hpp>

namespace mp = boost::multiprecision;

int main(){
  mp::cpp_dec_float_100 x,a;
  //long long int a;
  std::cin >> a >> x;
  //long long int ans = x*a;
  std::cout << (long long int)(x*a) << std::endl;
}

Measured memory_bytes: 3728
#include <iostream>

using namespace std;

int main(void)
{
    int X;
    cin >> X;

    int a, b, r, x;
    a = 360;
    b = X;
    r = a % b;
    x = a * b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }

    int K;
    K = (x / b) / X;

    cout << K << "\n";
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x1,y1,x2,y2;
	int x3,y3,x4,y4;
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	int y=abs(x1-x2);int x=abs(y2-y1);
	if(x1<x2){
		if(y1<y2){
			x4=x1-x;
			y4=y1+y;
			x3=x2-x;
			y3=y2+y;
		}else if(y1>=y2){
			x4=x1+x;
			y4=y1+y;
			x3=x2+x;
			y3=y2+y;
		}
	}else if(x1>x2){
		if(y1<=y2){
			x4=x1-x;
			y4=y1-y;
			x3=x2-x;
			y3=y2-y;
		}else if(y1>y2){
			x4=x1+x;
			y4=y1-y;
			x3=x2+x;
			y3=y2-y;
		}
	}else{
		if(y1<y2){
			x4=x1-x;
			y4=y1+y;
			x3=x2-x;
			y3=y2+y;
		}else if(y1>y2){
			x4=x1+x;
			y4=y1+y;
			x3=x2+x;
			y3=y2+y;
		}else{
			x3=x4=x1;
			y3=y4=y1;
		}
	}
	printf("%d %d %d %d\n",x3,y3,x4,y4);
	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
if n%2!=0:
    print("No")
    exit()
else:
    tm=n//2
    flag=True
    for i in range(0,tm):
        if not s[i]==s[i+tm]:
            flag=False
    if flag:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3060
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <cstring>

#define ll long long
#define Int ll
#define loop(__x, __start, __end) for(Int __x = __start; __x < __end; __x++)
#define loopdown(__x, __start, __end) for(Int __x = __start; __x > __end; __x--)
#define rep(__n) for(Int __x = 0; __x < __n; __x++)
#define span(__a,__x,__y) __a.begin()+__x,__a.begin()+__y
#define span_all(__a) __a.begin(),__a.end()
#define len(__x) (__x.size())
#define last(__x) (__x[__x.size()-1])

using namespace std;

struct Point {
  Int x, y;
  Point(Int x, Int y): x(x), y(y) {}
  Point(): x(0), y(0) {}

  Point operator + (Point v) { return Point(x + v.x, y + v.y); }
  Point operator - (Point v) { return Point(x - v.x, y - v.y); }
  bool operator == (const Point &v) const {
    return x == v.x && y == v.y;
  }
  bool operator< (const Point &p1) const {
    return x < p1.x && y < p1.y;
  }
};
ostream & operator << (ostream & out, Point const & v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Point & v) {
  Int x, y;
  in >> x; in >> y; v.x = x; v.y = y;
  return in;
}

// Geometry

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N, M;
vector<Int> D(3, -1);

bool input() {
  cin >> N >> M;
  if (N == 1 && M == 0) {
    cout << "0" << endl;
    return false;
  }
  Int a, b;
  loop(n,0,M) {
    cin >> a >> b;
    a--;
    if (D.at(a) >= 0 && D.at(a) != b) {
      cout << "-1" << endl;
      return false;
    }

    if (a == 0 && N >= 2 && b == 0) {
      cout << "-1" << endl;
      return false;
    }

    D.at(a) = b;
  }
  return true;
}

void solve() {
  loop(n,0,N) {
    Int d = D.at(n);
    if (d == -1) {
      if (n == 0) cout << '1';
      else cout << '0';
    }
    else cout << d;
  }
  cout << endl;
}

int main() {
  bool r = input();
  if (r) solve();
  return 0;
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll a,b,n;
ll f(ll x){
	return (a*x/b)-a*(x/b);
}
int main(){
	cin>>a>>b>>n;
	//~ for(ll x=1;x<=n;x++){
		//~ cout<<x<<' '<<(a*x/b)-a*(x/b)<<endl;
	//~ }
	if(n<b-1){
		cout<<f(n)<<endl;
	}
	else{
		cout<<f(b-1)<<endl;
	}
}

Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N, M;
vector<ll> g[11];
ll ans;
ll used[11];

void dfs(ll s) {
    used[s]=1;
    ll i;
    ll flag=1;
    for(i=0; i<N; i++) {
        if(used[i]==0) flag=0;
    }
    
    if(flag) {
        ans++;
        used[s]=0;
        return;
    }
    
    for(i=0; i<g[s].size(); i++) {
        if(used[g[s][i]]) continue;
        dfs(g[s][i]);
    }
    
    used[s]=0;
}

int main(void) {
    ll i;
    cin >> N >> M;
    
    for(i=0; i<M; i++) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    
    dfs(0);
    pr(ans);
    
}















Measured memory_bytes: 256
// Problem: C. Binary String Reconstruction
// Contest: Codeforces - Educational Codeforces Round 94 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1400/problem/C
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long int
#define ii int
#define du double
#define jmp "\n"
#define vl vector<ll>
#define vvl vector<vl>
#define pb push_back
#define printv(v)     \
  for (auto x : v)    \
    cout << x << " "; \
  cout << jmp;
#define vi vector<int>
#define vb vector<bool>
#define SORT(v) sort(v.begin(), v.end())
#define REV(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define SET(x, a) memset(x, a, sizeof(x))
#define si(x) x.size()
#define ff first
#define ss second
#define iin insert
#define deb(x) cout << "test " << #x << "=" << x << jmp
#define deb2(x, y) cout << "test " << #x << "=" << x << "," << #y << "=" << y << jmp
using namespace std;
const ll nax = 1e5 + 5;
void solve()
{
  du d, t, s;
  cin >> d >> t >> s;
  if (d / s <= t)
    cout << "Yes";
  else
    cout << "No";
}
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  //cin >> t;
  while (t--)
    solve();
  return 0;
}


Measured memory_bytes: 3732
import itertools

N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
order = []

for i in range(1,N+1):
    order.append(i)

#print(coordinate)

count = 0
for vect in itertools.permutations(order):
    #print(vect)
    count +=1
    if vect == P:
        a = count
    if vect ==Q:
        b = count

print(abs(a-b))

Measured memory_bytes: 3064
n = int(input())
i = 1
#end_check_num
while i <= n:
    #check_num
    x = i
    if x % 3 == 0:
        print(" %d" % i, end = "")
    else:
        #INCLUDE3
        while x != 0:
            if x % 10 == 3:
                print(" %d" % i, end = "")
                break
            x //= 10
    i += 1
print()

Measured memory_bytes: 6740
#include<stdio.h>

#define N 100000

int main(){
  int loop,last,temp,point,init;
  int i,j;
  int Part[N];

  scanf("%d",&loop);
  for(i=0;i<loop;i++){
    scanf(" %d",&Part[i]);
  }

  last=Part[loop-1];
  init=-1;

  for(j=0;j<loop-1;j++){
    
    if(last>=Part[j]){
      init+=1;
      temp=Part[init];
      Part[init]=Part[j];
      Part[j]=temp;
    }
    
  }

  temp=Part[init+1];
  Part[init+1]=Part[loop-1];
  Part[loop-1]=temp;
  
  point=init+1;

  for(i=0;i<point;i++){
    printf("%d ",Part[i]);
  }

  printf("[%d] ",Part[point]);

  for(i=point+1;i<loop-1;i++){
    printf("%d ",Part[i]);
  }

  printf("%d\n",Part[loop-1]);
  
  return 0;
}



Measured memory_bytes: 2108
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt int

func main() {
	var S uint64
	var a, d, b, c uint64
	fmt.Scan(&S)
	if S <= 1e9 {
		fmt.Println(0, 0, S, 0, S, 1)
	} else {
		a, b = 1e9, 1
		c = (a - S%a) % a
		d = (S + c) / a
		fmt.Println(0, 0, a, b, c, d)
	}
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return abs(a[i]) < abs(a[j]) }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


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

int main()
{
	int h,w;
	while(1)
	{
		cin >> h >> w;
		int a[h][w];
		if(h==0 && w==0)
		{
			break;
		}
		for(int i=0; i<h; i++)
		{
			cout << "#";
			for(int j=0; j<w-1; j++)
			{
				cout << "#" ;
			}
			cout << endl;
		}

		cout << endl;
	}
}

Measured memory_bytes: 1168
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
using namespace std;
const int num = 8;
int tf[num][num], col[num], ld[num*2-1], rd[num*2-1], row[num];
inline void print() {
	for (int i = 0; i < num; i++) {
		for (int j = 0; j < num; j++) {
			if (tf[i][j])
				if (row[i] != j) return;
		}
	}
	for (int i = 0; i < num; i++) {
		for (int j = 0; j < num; j++) {
			cout << ((row[i] == j) ? "Q" : ".");
		}
		cout << endl;
	}
}
inline void queen(int i) {
	if (i == num) {
		print();
		return;
	}
	else {
		for (int j = 0; j < num; j++) {
			if (!col[j] || !ld[i + j] || !rd[i - j + num - 1]) continue;
			row[i] = j;
			col[j] = ld[i + j] = rd[i - j + num - 1] = 0;
			queen(i + 1);
			col[j] = ld[i + j] = rd[i - j + num - 1] = 1;
			row[i] = -1;
		}
	}
}
int main() {
	for (int i = 0; i < num; i++) {
		for (int j = 0; j < num; j++) tf[i][j] = 0;
		col[i] = 1; row[i] = -1;
	}
	for (int i = 0; i < num * 2 - 1; i++) ld[i] = rd[i] = 1;
	int n, x, y;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		tf[x][y] = 1;
	}
	queen(0);
	return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
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; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n;
  cin >> n;
  vector<ll>l(n);
  rep(i,n) cin >> l[i];
  sort(l.begin(),l.end());
  ll ans=0;
  rep(i,n-2){
    for(int j=i+1;j<n;j++){
      int k=lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin();
      ans+=max(k-(j+1),0);
    }
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    LL n;
    LL m;
    LL x;
    cin >> n >> m >> x;
    vector<LL> a(n+1,0);
    LL tmp;
    LL ans_l=0;
    LL ans_r=0;
    for(LL i=0; i<m; i++){
        cin >> tmp;
        a[tmp]=1;
    }

    for(LL i=0; i<x; i++){
        ans_l+=a[i];
    }
    for(LL i=x+1; i<=n; i++){
        ans_r+=a[i];
    }
    if(ans_l<ans_r){
        cout << ans_l << endl;
    }else{
        cout << ans_r << endl;
    }

    return 0;
}


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

int main(void){
    int N, abuf;
    int res = 0;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> abuf;
        if((i%2==0)&&(abuf%2==1))res++;
    }
    cout << res << endl;
    return 0;
}

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

int main() {
  string s;cin >> s;
  int c=0;
  bool ans = true;
  if(s[0] == 'A' && 'a'<=s[1] && s[1]<='z' && s[s.size()-1] != 'C'){
    for(int i=2;i<s.size();++i){
      if(s[i]=='C') ++c;
      else if(!('a'<=s[i] && s[i]<='z')){
        ans = false;
        break;
      }
    }
  }else{
    ans = false;
  }
  if(ans && c==1) cout << "AC"<<endl;
  else cout << "WA"<<endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

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

#############
# Main Code #
#############

A,B = inputIL()

if B%A == 0:
  print(A+B)
else:
  print(B-A)

Measured memory_bytes: 63980
// happy valentine's day with two code
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<(int)(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(int)(a);i--)
template<typename T> ostream& operator<<(ostream& s, vector<T> t) {rep(i, 0, t.size()) s << (i ? " " : "") << t[i]; return s;}
template<typename T> istream& operator>>(istream& s, vector<T> &t) {rep(i, 0, t.size()) s >> t[i]; return s;}
template<typename T, typename U> ostream& operator<<(ostream& s, pair<T, U> t) {s << "(" << t.first << "," << t.second << ")"; return s;}
template<typename T, typename U> istream& operator>>(istream& s, pair<T, U> &t) {s >> t.first >> t.second; return s;}
typedef long long ll;

const int N = 1e5 + 10;
vector<int> g[N];
bool win = false;
int bad = 0;

bool dfs(int a, int from) {
    int sons = 0;
    for (auto b : g[a]) {
        if (b == from) continue;
        bool ex = dfs(b, a);
        if (!ex) continue;
        sons++;
    }
    if (sons > 1) {
        win = true;
    }
    if (sons == 1) {
        bad += 2;
        return false;
    }
    return true; //leaf
}

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i, 0, n - 1) {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    if (n == 2) {
        cout << "Second" << endl;
        return 0;
    }
    rep(i, 1, n + 1) {
        if (g[i].size() > 1) {
            dfs(i, -1);
            break;
        }
    }
    if (win || n - bad == 1) {
        cout << "First" << endl;
        return 0;
    }
    //cout << "b:" << bad << endl;
    assert(n == bad);
    cout << "Second" << endl;
}


Measured memory_bytes: 5888
//AtCoder Beginner Contest 133 目指せ3冠、勝ち取れ内定(⊙ꇴ⊙)

#include <stdio.h>
int main(void){
    //変数宣言ここから٩(ˊᗜˋ*)و
    
    char s[100001];
    long long int n,i,j,count;
    long long int l,r;
    long long int min = 9223372036854775807;
    int mode = 0;
    
    //入力処理ここから٩(ˊᗜˋ*)و
    
    scanf("%lld %lld",&l,&r);
    
    //処理部分ここから٩(ˊᗜˋ*)و
    
    if (l % 2019 == 0){
        mode = 1;
        min = 0;
    }
    
    if (mode == 0){
        for (i = l; i <= r - 1; i++){
            if (i % 2019 == 0){
                min = 0;
                break;
            }
            for (j = l + 1; j <= r; j++){
                count = ((i * j) % 2019);
                if (min > count){
                    min = count;
                    if (min == 0){
                        break;
                    }
                }
                if (j % 2019 == 0){
                    min = 0;
                    break;
                }
            }
            if (min == 0){
                break;
            }
        }
    }
        
    //出力処理ここから٩(ˊᗜˋ*)و
    
    printf("%lld",min);
    
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

public class Main {
	static FastScanner sc = new FastScanner();
	static int N, Q;
	static int[][] key = new int[512][512];
	static int[][] val = new int[512][512];
	static Reader input = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws Exception {
		StringBuilder sb = new StringBuilder();
		int[] A = new int[100000];
		while (true) {
			N = sc.nextInt();
			if (N == 0) break;
			int S = sc.nextInt();
			int W = sc.nextInt();
			Q = sc.nextInt();
			int g = S;
			for (int i = 0; i < N; ++i) {
				A[i] = (g / 7) % 10;
				g = (g / 2) ^ (W * (g % 2));
			}
			sb.append(solve(A) + "\n");
		}
		System.out.print(sb);
	}

	static long solve(int[] A) {
		long ans = 0;
		if (Q == 2 || Q == 5) {
			int nonzero = 0;
			for (int i = 0; i < N; ++i) {
				if (A[i] != 0) ++nonzero;
				if (A[i] % Q == 0) {
					ans += nonzero;
				}
			}
			return ans;
		}
		for (int i = 0; i < key.length; ++i) {
			for (int j = 0; val[i][j] != 0; ++j) {
				val[i][j] = 0;
			}
		}

		long sum = 0;
		long base = 1;
		for (int i = 0; i < N; ++i) {
			sum += A[N - 1 - i] * base;
			while (sum >= Q) {
				sum -= Q;
			}
			base *= 10;
			while (base >= Q) {
				base -= Q;
			}
			int c = 0;
			int k = (int) (sum & 511);
			for (int j = 0;; ++j) {
				if (val[k][j] == 0) {
					key[k][j] = (int) sum;
					val[k][j] = 1;
					break;
				}
				if (key[k][j] == (int) sum) {
					c = val[k][j];
					val[k][j]++;
					break;
				}
			}
			if (A[N - 1 - i] != 0) {
				ans += c;
				if (sum == 0) ans++;
			}
		}
		return ans;
	}

	static class FastScanner {
		Reader input;

		FastScanner() {
			this.input = new BufferedReader(new InputStreamReader(System.in));
		}

		int nextInt() throws IOException {
			int sign = 1;
			int b = input.read();
			while ((b < '0' || '9' < b) && b != '-' && b != '+') {
				b = input.read();
			}
			if (b == '-') {
				sign = -1;
				b = input.read();
			} else if (b == '+') {
				b = input.read();
			}
			int ret = b - '0';
			while (true) {
				b = input.read();
				if (b < '0' || '9' < b) return ret * sign;
				ret *= 10;
				ret += b - '0';
			}
		}
	}

}

Measured memory_bytes: 25256
#include<bits/stdc++.h>
using namespace std;
int n,f[100001];
int main()
{
	cin>>n;
	f[0]=1;
	for(int i=0;i<n;i++)
	if(f[i]==1)
	for(int j=100;j<=105;j++)
	f[i+j]=1;
	printf("%d",f[n]);
	return 0;
}

Measured memory_bytes: 640
def print_preorder(node: int) -> None:
    global trees
    print(f" {node}", end="")
    left_child = trees[node]['left-child']
    right_child = trees[node]['right-child']
    if -1 != left_child:
        print_preorder(left_child)
    if -1 != right_child:
        print_preorder(right_child)


def print_inorder(node: int) -> None:
    global trees
    left_child = trees[node]['left-child']
    right_child = trees[node]['right-child']
    if -1 != left_child:
        print_inorder(left_child)
    print(f" {node}", end="")
    if -1 != right_child:
        print_inorder(right_child)


def print_postorder(node: int) -> None:
    global trees
    left_child = trees[node]['left-child']
    right_child = trees[node]['right-child']
    if -1 != left_child:
        print_postorder(left_child)
    if -1 != right_child:
        print_postorder(right_child)
    print(f" {node}", end="")


if __name__ == "__main__":
    node_num = int(input())
    trees = {idx:
             {"parent": -1, "left-child": -1, "right-child": -1}
             for idx in range(node_num)}

    for _ in range(0, node_num):
        node, left_child, right_child = map(lambda x: int(x), input().split())
        if -1 != left_child:
            trees[node]["left-child"] = left_child
            trees[left_child]["parent"] = node
        if -1 != right_child:
            trees[node]["right-child"] = right_child
            trees[right_child]["parent"] = node

    root_node = [k for k, v in trees.items() if v["parent"] == -1][0]

    print("Preorder")
    print_preorder(root_node)
    print("")
    print("Inorder")
    print_inorder(root_node)
    print("")
    print("Postorder")
    print_postorder(root_node)
    print("")



Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    cout << ((n + 1) / 2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int w,h,n;
    cin>>w>>h>>n;
    int arr[w+2][h+2];
     for(int i=0;i<w;i++)
        for(int j=0;j<h;j++)
          arr[i][j]=0;
    for(int lp = 0;lp<n ; lp++)
    {
        int x,y,a;
        cin>>x>>y>>a;
        if(a==1)
        {
           for(int i=0;i<x;i++)
            for(int j=0;j<h;j++)
             arr[i][j]=1;
        }
        if(a==2)
        {
           for(int i=x;i<w;i++)
            for(int j=0;j<h;j++)
             arr[i][j]=1;
        }
        if(a==3)
        {
           for(int i=0;i<w;i++)
            for(int j=0;j<y;j++)
             arr[i][j]=1;
        }
        if(a==4)
        {
           for(int i=0;i<w;i++)
            for(int j=y;j<h;j++)
             arr[i][j]=1;
        }


    }
    int cnt = 0;
    for(int i=0;i<w;i++)
        for(int j=0;j<h;j++)
         if(arr[i][j]==0) cnt++;
    cout<<cnt<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)

//-----------------------------------------------
int mod=2019;
//------------------------------------------------
int main(){
  int n,c;
  c=0;
  cin>>n;
  int a[n],b[n];
  rep(i,0,n) cin>>a[i];
  rep(i,1,n-1) {
    if(i%2==1) c-=a[i];
    else c+=a[i];
  }
  b[0]=a[0]+c+a[n-1];
  rep(i,1,n){
    b[i]=2*a[i-1]-b[i-1];
  }
rep(i,0,n) cout<<b[i]<<endl;
}


Measured memory_bytes: 2048
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    /** フィールド1辺の長さ */
    static int FIELD_SIZE = 10;

    public static void main(String[] args) throws IOException {
        int[] field = initField();
        dropInk(field);
        System.out.println(countField(field)[0]);
        System.out.println(countField(field)[1]);
    }

    /**
     * フィールドを表す配列を初期化する
     * @return 初期化されたフィールド用配列
     */
    private static int[] initField() {
        int[] field = new int[FIELD_SIZE * FIELD_SIZE];
        for (int y = 0; y < FIELD_SIZE; y++) {
            for (int x = 0; x < FIELD_SIZE; x++) {
                field[y * FIELD_SIZE + x] = 0;
            }
        }
        return field;
    }

    /**
     * フィールドにインクを落とす
     * @param field フィールドを表す配列
     * @throws IOException 入出力例外
     */
    private static void dropInk(int[] field) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String input = bufferedReader.readLine();
        while (input != null) {
            int x = Integer.parseInt(input.split(",")[0]);
            int y = Integer.parseInt(input.split(",")[1]);
            int size = Integer.parseInt(input.split(",")[2]);
            selectPaintField(field, x, y, size);
            input = bufferedReader.readLine();
        }
    }

    /**
     * フィールドの色の濃さを評価して、白いフィールド数と、一番色の濃いフィールドの値を返却する
     * @param field フィールドを表す配列
     * @return 結果の配列（[0]：白いフィールド数、[1]：一番色の濃いフィールドの値）
     */
    private static int[] countField(int[] field) {
        int[] result = {0, 0};
        for (int y = 0; y < FIELD_SIZE; y++) {
            for (int x = 0; x < FIELD_SIZE; x++) {
                if (field[y * 10 + x] == 0)
                    result[0]++;
                if (result[1] < field[y * 10 + x])
                    result[1] = field[y * 10 + x];
            }
        }
        return result;
    }

    /**
     * フィールドに色を塗る
     * @param field フィールドを表す配列
     * @param x フィールドのx座標
     * @param y フィールドのy座標
     */
    private static void paintField(int[] field, int x, int y) {
        if (0 <= x && x < FIELD_SIZE && 0 <= y && y < FIELD_SIZE)
            field[y * FIELD_SIZE + x]++;
    }

    /**
     * インクのサイズにより、色を塗る範囲を決める
     * @param field フィールドを表す配列
     * @param x フィールドのx座標
     * @param y フィールドのy座標
     * @param size インクのサイズ
     *
     */
    private static void selectPaintField(int[] field, int x, int y, int size) {
        paintField(field, x, y);
        paintField(field, x - 1, y);
        paintField(field, x, y - 1);
        paintField(field, x + 1, y);
        paintField(field, x, y + 1);

        if (size > 1) {
            paintField(field, x - 1, y - 1);
            paintField(field, x + 1, y - 1);
            paintField(field, x - 1, y + 1);
            paintField(field, x + 1, y + 1);
        }

        if (size > 2) {
            paintField(field, x - 2, y);
            paintField(field, x, y - 2);
            paintField(field, x + 2, y);
            paintField(field, x, y + 2);
        }
    }

}

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

using namespace std;

//#define PRAGMA 448
#ifdef PRAGMA
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif

#ifdef LUCARIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif

typedef int intt;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;

#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define int long long
#define pb push_back
#define bs binary_search
#define up upper_bound
#define fs first 
#define sd second 
#define mp make_pair    
#define endl "\n"

#define fore(i,a,b) for(ll i = a; i < b; i++)
#define rfore(i, a, b) for(ll i = a - 1; i >= b; i--)
#define forev(a,b) fore(i,0,b)cout<<a[i]<<" "; 
#define ing(g,u,v)  g[u].pb(v); g[v].pb(u);
#define ingp(g,u,v,c) (g[u].pb({v,c});g[v].pb({u,c});)
#define mm(a,b) memset(a , b , sizeof a) 
#define ALL(a) a.begin(),a.end() 
#define SZ(n) ((ll) (n).size())
#define sfind(s,t) (s.find(t) != string::npos)

#define infll (ll)1e14
#define infi  (int)(1e9+1)
#define PI 3.14159265359 
#define mod (ll)(1e9+7)
#define eps  1e-6

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b,a%b); } 
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }

int n,k;
int a[3][100001];
int dp[3][100001];

int solve(int k,int i){
    if(i == n)return 0;
    if(~dp[k][i])return dp[k][i];
    int &r = dp[k][i];
    r = 0;
    fore(j,0,3){
        if(k != j)r = max(r,a[j][i]+solve(j,i+1));
    }
    return r;
}


int32_t main(int32_t argc, char const *argv[]){
    FIN;
    cin>>n;
    fore(i,0,n)cin>>a[0][i]>>a[1][i]>>a[2][i];
    int res = 0;
    fore(i,0,3){
        mm(dp,-1);
        res = max(res,solve(i,0));
    }
    cout<<res;



    return 0;
}



















Measured memory_bytes: 12800
fun main(args: Array<String>) {
    abc061c()
}

fun abc061c() {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    val inputs = (1..n).map { readLine()!!.split(" ").map { it.toLong() } }
        .map { Input(it[0], it[1]) }
        .sortedBy { it.value }

    var remainCount = k
    for (input in inputs) {
        if (input.time >= remainCount) {
            return println(input.value)
        } else {
            remainCount -= input.time
        }
    }
}

private data class Input(val value: Long, val time: Long)


Measured memory_bytes: 86568
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> p;
typedef vector<p> vp;

int main(int argc,char const* argv[])
{
  int n;
  string s;
  cin >> n;
  cin >> s;
  int firstmin1=0,firstmin2=0;
  for(int i=1;i<n;i++)
    {
      if(s[i]=='E') firstmin1++;
    }
  for(int i=0;i<n-1;i++)
    {
      if(s[i]=='W') firstmin2++;
    }
  int ans=100000000;
  ans=min(ans,firstmin1);
  int now=firstmin1;
  for(int i=1;i<n;i++)
    {
      if(s[i-1]=='W'  && s[i]=='W')now++;
      //else if(s[i-1]=='W' && s[i+1]=='E' && s[i]=='E')now++;
      //else if(s[i-1]=='E' && s[i+1]=='W' && s[i]=='W') now--;
      else if(s[i-1]=='E' && s[i]=='E') now--;
      ans=min(ans,now);
    }
  ans=min(ans,firstmin2);
  cout << ans << endl;
}


Measured memory_bytes: 900
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b&&b==c&&a==c){
		printf("1\n");
	}
	else if(a==b||a==c||b==c){
		printf("2\n");
	}
	else{
		printf("3\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
///////////////////////////////////////////////
int main(){
	int a,b,c,d;
	a = 0, b = 0, c= 0, d = 0;
	REP(i,4){
		int n; cin >> n;
		if (n==1) a = 1;
		if (n==9) b = 1;
		if (n==7) c = 1;
		if (n==4) d = 1;
	}
	if (a*b*c*d == 1) printf("YES\n");
	else printf("NO\n");

}

Measured memory_bytes: 256