akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define rep(i,n) for(int i = 0;i<(int)(n);i++);
using namespace std;
using ll = long long;
const ll INF = 100100100100100;

ll two(ll a) {//何回2で割れるか　２以上は変わらないので２にする
	ll cnt = 0;
	while (true) {
		if (a % 2 == 0) {
			a /= 2;
			cnt++;
		}
		else break;
	}
	if (cnt >= 2) return 2;
	else return cnt;
}
int main() {
	ll N;
	cin >> N;
	vector<ll> a(N);
	ll count = 0;
	for (int i = 0; i < N; i++) {
		cin >> count;
		a[i] = two(count);
	}//{1 2 4 8}ならa ={0 1 2 2}
	vector<ll> twonum(3);//{0の数,１の数,２の数}
	for (int i = 0; i < N; i++) twonum[a[i]]++;
	if (twonum[1] == 0 && twonum[0] <= twonum[2]+1)cout << "Yes" << endl;
	else if (twonum[0] <= twonum[2])cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

const int l = 17;

vector<bitset<l>> any2any(bitset<l> start, bitset<l> goal, int dim);
vector<bitset<l>> zero2any(bitset<l> goal, int dim);

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    bitset<17> x(a), y(b);
    if (x.count() % 2 == y.count() % 2) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        auto res = any2any(a, b, n);
        for (auto e : res) {
            cout << e.to_ulong() << endl;
        }
    }
    return 0;
}

vector<bitset<l>> zero2any(bitset<l> goal, int dim) {
    if (dim == 1) {
        return {0, 1};
    }
    if (goal[dim - 1] == 0) {
        int replace = -1;
        for (int i = 0; i < l; i++) {
            if (goal[i] == 1) {
                replace = i;
                break;
            }
        }
        goal[dim - 1] = 1, goal[replace] = 0;
        auto res = zero2any(goal, dim);
        for (auto &e : res) {
            int a = e[dim - 1], b = e[replace];
            e[dim - 1] = b, e[replace] = a;
        }
        return res;
    }
    goal[dim - 1] = 0;
    auto y = goal ^ bitset<l>(1);
    auto half_0 = zero2any(y, dim - 1);
    auto half_1 = any2any(y, goal, dim - 1);
    for (auto e : half_1) {
        e[dim - 1] = 1;
        half_0.push_back(e);
    }
    return half_0;
}

vector<bitset<l>> any2any(bitset<l> start, bitset<l> goal, int dim) {
    auto res = zero2any(goal ^ start, dim);
    for (auto &e : res) {
        e ^= start;
    }
    return res;
}

Measured memory_bytes: 2288
#include <iostream>
#include <numeric>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {

	int S;
	cin >> S;
	
	cout << "ABC"<<S << endl;
}

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

namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            new Program().Solve();
        }

        void Solve()
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int x = int.Parse(Console.ReadLine());

            int count = 0;
            for (int aCount = 0; aCount <= a; aCount++)
            {
                for (int bCount = 0; bCount <= b; bCount++)
                {
                    for (int cCount = 0; cCount <= c; cCount++)
                    {
                        if (500 * aCount + 100 * bCount + 50 * cCount == x)
                        {
                            count++;
                        }
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;
import java.io.*;

public class Main
{
  public static void main(String args[]) throws IOException
  {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tokenizer1 = new StringTokenizer(br.readLine());
    int k = Integer.parseInt(tokenizer1.nextToken());
    int x = Integer.parseInt(tokenizer1.nextToken());
    
    printPossibleBlack(k,x);
  }
  
  public static void printPossibleBlack(int k, int x)
  {
    int size = 2*Math.abs(k-1) + 1;
    if(size == 0)
    {
      System.out.print(x);
      return;
    }
    int[] arr = new int[size];
    
    int i = x - (k - 1);
    int j = x + (k - 1);
    int k1 = 0;
    
    while(i<=j)
    {
      arr[k1] = i;
      k1++;
      i++;
    }
    
    for(int l=0;l<size;l++)
    {
      System.out.print(arr[l]+" ");
    }
    
  }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A_vec(N); 
  vector<int> B_vec(N);
  vector<int> C_vec(N - 1);
  int sum = 0;
  for (int a = 0; a < N; a++) {
    cin >> A_vec.at(a);
  }
  for (int b = 0; b < N; b++) {
    cin >> B_vec.at(b);
    sum += B_vec.at(b);
  }
  for (int c = 0; c < N - 1; c++) {
    cin >> C_vec.at(c);
  }
  for (int i = 0; i < N; i++) {
    if (i > 0 && A_vec.at(i) == A_vec.at(i - 1) + 1) {
      sum += C_vec.at(A_vec.at(i - 1) - 1);
    }
  }
  cout << sum << endl;
}

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

int main() {
  int N;
  cin >> N;
  bool hanntei = 1;
  vector<int> number(N);
  for (int i = 0; i < N; i++) {
    cin >> number.at(i);
    if (number.at(i) % 2 == 0) {
      if(number.at(i) % 6 != 0 && number.at(i) % 10 != 0) {
        hanntei = 0;
      }
    }
  }
  if (hanntei == 1) {
    cout << "APPROVED" << endl;
  }
  
  else if (hanntei == 0) {
    cout << "DENIED" << endl;
  }
}

Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <stdio.h>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"


template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
long long minArr(const T * arr, int s, int fn) {
    ll res = 1e16 + 1;
    for (int i = s; i <= fn; ++ i) {
        res = min(res, arr[i]);
    }
    return res;
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <class T>
bool uax(T&a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
bool uin (T&a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int main () {
    to_pray();
    
    ll a, b;
    
    cin >> a >> b;
    
    ll n = __gcd(a,b);
      
    ll ans = 1;
    if(n % 2 == 0){
        ans++;
        while(n % 2 == 0) n /= 2;
    }
  
    for (ll i = 3; i*i <= n; i+=2) {
        if(n % i == 0){
            ans++;
            while (n%i == 0) n /= i;
        }
      	if(n == 1) break;
	}
  	if(n != 1) ans++;
 
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int res = 0;
    for (int bit = 0; bit < (1 << (int)(s.size()-1)); ++bit) {
        vector<char> a;
        res = 0;
        res += s[0] - '0';
        for (size_t i = 0; i < s.size()-1; ++i) {
            
            if (bit & (1 << i)) {
                res += s[i+1] - '0';
                a.push_back('+');
            }
            else {
                res-= s[i+1] - '0';
                a.push_back('-');
            }
        }

        if (res == 7) {
            cout << s[0] << a[0] << s[1] << a[1] << s[2] << a[2] << s[3] << "=7" << endl;
            return 0;
        }
    }
    return 0;
}


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

using namespace std;

using ll = long long int;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	vb check(n);
	vl a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	ll ma1 = 0, ma2 = 0;
	for (int i = 0; i < n - 1; i++) {
		if (!check[i] && !check[i + 1] && a[i] == a[i + 1]) {
			ma2 = ma1;
			ma1 = a[i];

			check[i] = check[i + 1] = true;
		}
	}

	ll res = ma1 * ma2;
	cout << res << endl;
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007

int main(void){

    int k, n;
    cin >> k >> n;

    vector<int> a(n);
    for (int i = 0; i < n;i++)
        cin >> a.at(i);

    //１つめ最小設定
    int ans = a.at(n - 1) - a.at(0);

    for (int i = 1; i < n;i++){
        int dis = (k - a.at(i)) + a.at(i - 1);
        ans = min(ans, dis);
    }

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll N,K;
  pair<ll,ll> p[100000];
  cin>>N;
  for(ll i=0;i<N;i++){
    cin>>K;
    p[i]=make_pair(K,i);
  }
  sort(p,p+N);
  for(ll i=0;i<N;i++) cout<<(p[i].second)+1<<" ";
  cout<<endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

const int MAX= 2e5+10;

int N, A[MAX];
int ans[MAX];

void solve() {
    int m = 0;
    FORR (i, 1, N+1) {
        int j = i;
        int a = 0;
        while (j <= N) {
            a += ans[j];
            j += i;
        }
        if (a%2 != A[i]) {
            ans[i] = 1;
            m++;
        }
    }
    cout << m << endl;
    FOR (i, 1, N+1) if (ans[i]) {
        m--;
        cout << i << ((m==0) ? "\n" : " ");
    }
}

int main() {
    cin >> N;
    REP (i, N) cin >> A[i+1];
    solve();
}

Measured memory_bytes: 2432
n = int(input())

ans = ""
i = 1
while n != 0:
    if n%2 == 1:
        n += (-1)**i
        ans = "1" + ans
    else:
        ans = "0" + ans
    n //= 2
    i += 1

if ans == "":
    ans = "0"
print(ans)


Measured memory_bytes: 2940
public class Main {
	
	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		final int n = sc.nextInt();
		
		for (int i = 1; i <= n; ++i) {
			if (i % 3 == 0) {
				out.print(" " + i);
			} else {
				for (int j = i; j > 0; j /= 10) {
					if (j % 10 == 3) {
						out.print(" " + i);
						break ;
					}
				}
			}
		}
		out.println();
		sc.close();
	}

	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

}

Measured memory_bytes: 28848
#include <bits/stdc++.h>
#define int long long
const int MOD = 1e9+7;
using namespace std;
int n;
int dp[1001][1001];
signed main() {
    int r,c;
    cin >> r >> c;
    r--;c--;
    string a[1001];
    for(int i = 0;i<=r;i++) cin>>a[i];
    dp[r][c] = 1;
    for(int col = c;col>=0;col--)
        if (a[r][col]=='.') dp[r][col] = 1;
        else break;
    for(int row=r;row>=0;row--)
        if(a[row][c] == '.') dp[row][c] = 1;
        else break;
    for(int row = r-1;row>=0;row--) {
        for(int col = c-1;col>=0;col--) {
            if(a[row][col]=='.')
            dp[row][col] = (dp[row+1][col]+dp[row][col+1])%MOD;
        }
    }
//    for(int i = 0;i<=r;i++){
//    for(int j = 0;j<=c;j++){
//        cout << dp[i][j] <<' ';
//    }
//        cout << '\n';
//    }
    cout << dp[0][0] << '\n';
}



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

int main(){
    int n;
    long long lucas[90];
    cin >> n;
    lucas[0] = 2;
    lucas[1] = 1;
    int ind = 2;
    if(n == 1){
        cout << lucas[1] << endl;
        return 0;
    }
    while(true){
        lucas[ind] = lucas[ind-1] + lucas[ind-2];
        if(ind == n){
            cout << lucas[ind] << endl;
            return 0;
        }
        ind++;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
int H,W,a,b;
	while(1){scanf("%d %d",&H,&W);
		if(H==0 && W==0)break;
		for(b=1;H>=b;b++)
			{for(a=1;W>=a;a++)
				{
						if(a==1 || b==1){printf("#");}
					else{
					if(a!=W && b!=H){printf(".");}
				else{printf("#");}
					}
				}printf("\n");
		}printf("\n");
}
return 0;
}


Measured memory_bytes: 2036
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K = MI()
    A=LI_()
    ans = 0
    before = defaultdict(int)
    *cumsum,=accumulate(A)
    for i,a in enumerate(cumsum):
        cumsum[i] = a%K
    # print(cumsum)
    for i,a in enumerate(cumsum):
        if i >= K:
            before[cumsum[i-K]]-=1
        ans += before[a]
        before[a]+=1

    ans += cumsum[:K-1].count(0)
    print(ans)

if __name__ == '__main__':
    main()

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

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

  int ans=0;
  bool flag;
  rep(i,3){
    if(s[i]=='R' && flag){
      ans++;
    }else flag=false;

    if(s[i]=='R' && !flag){
      ans=1;
      flag=true;
    }
  }
  cout << ans << endl;
}

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

int main() {
  char c;
  cin >> c;
  char bo[] = {'a', 'i', 'u', 'e', 'o'};
  for (int i = 0; i < 5; i++) {
    if (c == bo[i]) {
      cout << "vowel" << endl;
      return 0;
    }
  }
  cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll H,W,h,w;
	while(cin>>H>>W>>h>>w) {
		ll ans = 0;
		
		cout<<(W-w)*(H-h)<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define pob(x) pop_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin()+n)
// #define int long long
#define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const int INF = -1;
ll dp[100005][13];

signed main(void) {
	int N;
	cin >> N;

	cout << N * N * N << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,x;cin>>n>>m>>x;
  vi A(m);
  for(auto &a:A)cin>>a;
  ll c=0,cc=0;
  for(auto a:A){
    if(a < x)c++;
    else cc++;
  }
  cout<<min(c,cc)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long a, b, c, d, e, f;
	while(~scanf("%lld %lld %lld %lld", &a, &b, &c, &d))
	{
		e = a * b;
		f = c * d;
		printf("%lld\n", e>=f?e:f);
	}
	
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    X, Y = list(map(int, input().split()))
    return X, Y


def main(X: int, Y: int) -> None:
    """
    求解処理を行う.

    Args:
        X (int): 庭の動物の総数
        Y (int): 庭の動物の足の総数
    """
    # 求解処理
    ans = "No"
    for crane in range(X + 1):
        turtle = X - crane
        if math.isclose(2 * crane + 4 * turtle, Y):
            ans = "Yes"
            break

    # 結果出力
    print(ans)


if __name__ == "__main__":
    X, Y = get_input()
    main(X, Y)


Measured memory_bytes: 9204
#include "bits/stdc++.h"
using namespace std;
int main(){
	int arr[1100]={0};
	int x; cin>>x;

	arr[1] = 1;
	for(int i=2;i<=x;i++){
		int exp = i*i;
		while(exp <= x){
			arr[exp] = 1;
			exp *= i;
		}
	}
	
	for(int i=x;i>=1;i--){
		if(arr[i] == 1){
			cout<< i <<endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = 0
for i in range(2,int(N**(1/2)//1)+1):
  if N%i == 0:
    cnt = 0
    while N%i == 0:
      N //= i
      cnt += 1
    for j in range(1,cnt+1):
      if cnt - j >=0:
        cnt -= j
        ans += 1
      else:
        break
  else:
    continue   
if N != 1:
  ans += 1     
print(ans)    

Measured memory_bytes: 9460
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int dfs(int li, int ri, int ln, int rn) {
  using std::min;
  if (li >= 5 && ri >= 5) return false;
  if (ln >= 5 && rn >= 5) return true;

  if (ln < 5) {
    if (li < 5)
      if (!dfs(min(5, ln+li), rn, li, ri)) return true;
    if (ri < 5)
      if (!dfs(min(5, ln+ri), rn, li, ri)) return true;
  }
  if (rn < 5) {
    if (li < 5)
      if (!dfs(ln, min(5, rn+li), li, ri)) return true;
    if (ri < 5)
      if (!dfs(ln, min(5, rn+ri), li, ri)) return true;
  }
  return false;
}

int main() {
  int Li, Ri, Ln, Rn;
  scanf("%d %d %d %d", &Li, &Ri, &Ln, &Rn);

  printf("%s\n", dfs(Li, Ri, Ln, Rn)? "ISONO":"NAKAJIMA");
}



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

int main(){
  int n;
  cin >>n;
  
  int a,b,c,d;
  int A,B,C;
  a = n / 1000;
  A = a * 1000;
  b = (n - A) /100;
  B = b * 100;
  c = (n - A - B) /10;
  C = c *10;
  d = n - A -B - C;
  
  if(a==b && b==c){
    cout <<"Yes"<<endl;
  }
  else if(b==c && c==d){
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
  
}

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


int main() {
  int n, a;
  cin >> n >> a;
  if(n % 500 <= a){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  return 0;
}




Measured memory_bytes: 3508
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;



int main() {
	vector<vector<int>> s;
	int n, m, k;
	cin >> n >> m;
	s.resize(m);
	for (int i = 0; i < m; i++) {
		cin >> k;
		s[i].resize(k);
		for (int j = 0; j < k; j++) {
			cin >> s[i][j];
		}
	}
	vector<int> p(m);
	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}
	int count = 0;
	for (int bit = 0; bit < (1 << n); bit++) {
		bool tf = true;

		for (int i = 0; i < m; i++) {
			int on = 0;
			for (int j = 0; j < s[i].size(); j++) {
				if (bit & (1 << s[i][j] - 1)) {
					on++;
				}
			}
			if (p[i] == 0 && on % 2 != 0)tf = false;
			if (p[i] == 1 && on % 2 != 1)tf = false;
	
		}
		if (tf)count++;
	}
	cout << count << endl;
	return 0;
}

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

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; }
const ll INF = 1LL << 60;

//Write From this Line

int main()
{
	string s ;
	cin >>  s ;
	ll k ;
	cin >>  k ;
	rep(i,s.size()){
		int num = s[i] - 'a' ;
		if(s[i]!='a'&&(26 - num <= k )&&( i != s.size()-1)){
			k -=  (26 - num);
			s[i] = 'a';
		}
		if(i == s.size() -1 ){
			s[i] = 'a' + ((num + k)%26);
		}
	}
	cout << s << endl;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll dfs(ll now, vector<vector<ll>>& graph)
{
    int i;
    vector<ll> v;
    for(i = 0;i < graph.at(now).size();++i){
        v.push_back(dfs(graph.at(now).at(i), graph));
    }
    sort(all(v));
    ll res = 0;
    for(i = 0;i < v.size();++i){
        res = max(res, v.at(i) + (ll)v.size() - i);
    }
    return res;
}

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<vector<ll>> graph(n);
    for(i = 1;i < n;++i){
        ll a;
        cin >> a;
        --a;
        graph.at(a).push_back(i);
    }
    cout << dfs(0, graph) << endl;

    return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n; cin >> n;
  string s; cin >> s;

  map<char,ll> m;
  rep(i, n) ++m[s[i]];

  ll ans = m['R'] * m['G'] * m['B'];
  rep(i, n) rep2(j, i+1, n-1) {
    int k = j + (j - i);

    if (k >= n) continue;
    if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k]) --ans;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3628
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
int main(){
  ll N,ans=0,a,b;
  cin>>N;
  vector<ll>A(N+1);
  vector<ll>B(N);
  REP(i,N+1){
    cin>>A[i];
  }
  REP(i,N){
    cin>>B[i];
  }
  
  REP(i,N){
    if(A[i]>0){
      a=A[i];
      b=B[i];
      A[i]=max(a-a,a-b);
      B[i]=max(a-a,b-a);
      ans+=a-A[i];
    }
    if(B[i]>0){
      a=A[i+1];
      b=B[i];
      A[i+1]=max(a-a,a-b);
      ans+=a-A[i+1];
    }
  }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fine cout<<"fine"<<endl;
#define ll long long int
#define pb push_back
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
const ll inf=(ll)2e18;
const int mod=1e9+7;
bool overflow(ll a,ll b){
    if (a <= (inf+b-1)/b) return false;
    return true;
}
int main(){
FASTIO;
long double l;
cin>>l;
long double ans=l*l*l;
ans=ans*1.0/27;
cout<<setprecision(10)<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long n;
    char str[1024];
    cin >> n;
    long long t;
    int i=0;
    for(i=0;n!=0;i++){
        n--;
        t=n%26;
        str[i]=(char)t;
        n=n/(long long)26;
    }
    for(i--;i>=0;i--){
        cout << (char)(str[i] + 'a');
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3608
-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr)
import qualified Data.ByteString.Char8 as BS

main = do
  [l,r] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ if r - l >= 2018
          then 0
          else minimum [ (i * j) `mod` 2019 | i <- [l..r-1], j <- [i+1..r] ]


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	string s;
	cin >> s;

	bool ans = true;
	for (int i = 1; i < (int)s.size(); i++) {
		if (s[i - 1] == s[i]) {
			ans = false;
			break;
		}
	}

	cout << (ans ? "Good" : "Bad") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>



using namespace std;


int main()
{
	unsigned long a, b, c, x, i, j, k;
	unsigned long cnt = 0;
	unsigned long tmp1, tmp2, tmp3 = 0;

	
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> x;

	for (i=0; i<a+1; i++) {
		tmp1 = 500*i;
		if (tmp1 > x)
			break;
		for (j=0; j<b+1; j++) {
			tmp2 = tmp1 + 100*j;
			if (tmp2 > x)
				break;
			for (k=0; k<c+1; k++) {
				tmp3 = tmp2 + 50*k;
				if (x < tmp3) {
					break;
				}else if (tmp3 == x) {
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;
}
	


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE
Int H, W;
vector<string> mp;
Int used[101][101][2];
Int mem[101][101][2];
Int dfs(Int y, Int x, Int rev){
  if(y == H-1 && x == W-1) return 0;
  if(used[y][x][rev]++) return mem[y][x][rev];

  Int res = INF;
  for(Int i=0;i<=1;i++){
    for(Int j=0;j<=1;j++){
      if(i == 0 && j == 0) continue;
      if(i == 1 && j == 1) continue;
      Int ny = y + i;
      Int nx = x + j;
      if(ny >= H || nx >= W) continue;
      char ch = mp[ny][nx];
      if(rev == 1) ch = ch == '#'? '.':'#';
      Int cost = ch == '#' && rev == 0;
      Int nrev = rev;
      if(ch == '#') nrev = !nrev;
      pr(y, x, rev, ny, nx, nrev, cost);
      Int r = dfs(ny, nx, nrev) + cost;
      Min(res, r);
    }
  }
  return mem[y][x][rev] = res;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);


  cin>>H>>W;
  mp.resize(H);
  cin>>mp;

  Int ans;
  if(mp[0][0] == '#') ans = dfs(0, 0, 1) + 1;
  else ans = dfs(0, 0, 0);
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 640
import java.io.*;
import java.util.*;
public class Main
{
 public static void main(String args[]) throws Exception
            {
 Scanner cin=new Scanner(System.in);
 int a,b;
 cin.useDelimiter("\n| ");
 while(cin.hasNext()){
	 a = cin.nextInt();
	 b = cin.nextInt();
	 int sum = a+b;
	 int count = 0;
	 while (sum>0){
		 sum = sum/10;
		 count++;
	 }
	 
	 System.out.println(count);
	 
 	
 }
       
            
            }
}

Measured memory_bytes: 26588
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    Node[] nodes = new Node[N];
    for (int i = 0; i < N; i++) nodes[i] = new Node();
    for (int i = 0; i < M; i++) {
      int l = scanner.nextInt() - 1;
      int r = scanner.nextInt() - 1;
      int d = scanner.nextInt();
      nodes[l].edges.add(new Edge(nodes[r], d));
      nodes[r].edges.add(new Edge(nodes[l], -d));
    }

    for (Node node : nodes) {
      if (!node.visited) {
        if (!dfs(node)) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }

  private static boolean dfs(Node node) {
    node.visited = true;
    for (Edge edge : node.edges) {
      Node a = edge.to;
      if (!a.visited) {
        a.pos = node.pos + edge.dist;
        if (!dfs(a)) return false;
      } else if (a.pos != node.pos + edge.dist) {
        return false;
      }
    }
    return true;
  }

  private static class Node {
    private int pos;
    private List<Edge> edges = new ArrayList<>();
    private boolean visited;
  }

  private static class Edge {
    private final Node to;
    private final int dist;

    private Edge(Node to, int dist) {
      this.to = to;
      this.dist = dist;
    }
  }
}


Measured memory_bytes: 178760
f1 = ->(n) {(n ** 3 + 6 * n ** 2 + 11 * n + 6) / 6}
f2 = ->(n) {
  n1 = n - 1000
  (335337002 + 1004001 * n1 + 998 * n1 ** 2 - n1 ** 3) / 2
}
f3 = ->(n) {
  n1 = n - 2001
  (1337336000 - 4002 * n1 - 1999 * n1 ** 2 + n1 ** 3) / 2
}
f4 = ->(n) {
  n1 = n - 3002
  (999999000 - 2999999 * n1 + 3000 * n1 ** 2 - n1 ** 3) / 6
}

$<.readlines.map(&:to_i).each do |s|
  result = case s
           when    0..1000 then f1.(s)
           when 1001..2001 then f2.(s)
           when 2002..3002 then f3.(s)
           when 3003..4000 then f4.(s)
           end
  puts result
end


Measured memory_bytes: 6884
#include <algorithm>
#include <complex>
#include <cstdio>
#include <utility>
#include <vector>
#include <iostream>
#define X real()
#define Y imag()
#define EPS 1e-10
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
typedef pair<P,double> C;

double dot(P a, P b){
  return a.X*b.X + a.Y*b.Y;
}

double cross(P a, P b){
  return a.X*b.Y - a.Y*b.X;
}

P projection(P a, P b){
  return dot(a,b)/norm(b)*b;
}

double p_to_l_dist(P p, L l){
  return abs(cross(l.second-l.first,p-l.first))/abs(l.first-l.second);
}

vector<P> sort_comp(vector<P> a){
  int l = a.size();
  vector< pair<double, double> > t(l);
  for(int i = 0; i < l; ++i){
    t[i].first = a[i].X;
    t[i].second = a[i].Y;
  }
  sort(t.begin(),t.end());
  for(int i = 0; i < l; ++i){
    a[i] = P(t[i].first,t[i].second);
  }
  return a;
}

vector<P> cpcl(C c, L l){
  double d = p_to_l_dist(c.first,l), r = c.second;
  P m = l.first + projection(c.first-l.first,l.second-l.first);
  P x = sqrt(r*r-d*d)/abs(l.second-l.first)*(l.second-l.first);
  vector<P> cp(2,m);
  cp[0] -= x;
  cp[1] += x;
  return cp;
}

int main(){
  double x1, y1, x2, y2, r;
  cin >> x1 >> y1 >> r;
  C c = C(P(x1,y1),r);
  int q;
  cin >> q;
  for(int i = 0; i < q; ++i){
    cin >> x1 >> y1 >> x2 >> y2;
    L l;
    l.first = P(x1,y1);
    l.second = P(x2,y2);
    vector<P> cp = sort_comp(cpcl(c,l));
    printf("%.10lf %.10lf %.10lf %.10lf\n", cp[0].X, cp[0].Y, cp[1].X, cp[1].Y);
  }
  return 0;
}

Measured memory_bytes: 3336
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	long long int a,b,c,k,n,d;
    cin>>n>>k;
    
    ll tt=n/k;
    if(n%k)
    tt++;
    ll aa=abs(n-k*tt);
    ll bb=abs(n-k*(tt+1));
    ll cc=INT_MAX;
    if(tt!=0)
     cc=abs(n-k*(tt-1));
    ll dd=abs(n-k*(tt+2));
    dd=min(dd,cc);
    aa=min(aa,bb);
    aa=min(aa,dd);
    cout<<min(aa,n);
	
}


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

int main() {
  int N;
  int64_t sum = 0;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    if (i % 3 != 0 && i % 5 != 0) {
      sum += i;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3628
#include<stdio.h>

int sum(int s){
  int ret;
  if(s==1){
    ret=1;
  }else{
  	ret=sum(s-1)+s;
  }
  return ret;
}

int main(void){
  int n;
  scanf("%d",&n);
  printf("%d\n",sum(n));

  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 3000100
ll dp[N];
int main(){
	int n;
	cin>>n;
	dp[0] = 1; dp[1] = -1;
	ll res = 0;
	for(int i = 1; i <= 2*n+5; i++){
		if(i>1) (dp[i-1]+=dp[i-2])%=mod;
		if(i<n) (res+=dp[i-1]*(n-1)%mod*(n-1))%=mod;
		if(i>n) (res+=dp[i-1])%=mod;
		if(i<=n){
			(dp[i]+=dp[i-1])%=mod;
			(dp[i+1]-=dp[i-1])%=mod;
			(dp[i+2]+=dp[i-1])%=mod;
			(dp[i+n+1]-=dp[i-1])%=mod;
		}
	}
	//for(int i = 1; i <= 2*n+10; i++) cerr<<dp[i]<<endl;
	cout<<(res+mod)%mod<<endl;

	return 0;
}


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

#pragma warning( disable : 4996 )

#define si(n) scanf("%d", &n)
#define sll(n) scanf("%lld", &n)
#define ss(s) scanf("%s", &s)
#define pi(n) printf("%d\n", n)
#define pll(n) printf("%lld\n", n)
#define ps(s) printf("%s\n", s)
#define FOR(i, a, b) for (int i=a;i<=b;i++)

typedef long long ll;

void max_heapify(vector<int> &a, int i) {
	int largest = i;
	int l = 2 * i;
	int r = 2 * i + 1;
	if (l <= (int) a.size()-1 && a[l] > a[i]) {
		largest = l;
	}
	if (r <= (int)a.size()-1 && a[r] > a[largest]) {
		largest = r;
	}
	if (largest != i) {
		swap(a[i], a[largest]);
		max_heapify(a, largest);
	}
}

void build_maxheap(vector<int> &a) {
	for (int i = (a.size()-1) / 2; i >= 1; i--) {
		max_heapify(a, i);
	}
}

void print_vec(vector<int> a) {
	for (int i = 0; i < a.size() - 1; i++) {
		cout << a[i] << ' ';
	}
	cout << a.back() << endl;
}

void solve() {
	//input
	int n, m;
	si(n);
	si(m);
	vector<int> a(n+1);
	FOR(i, 1, n) {
		int temp;
		si(temp);
		a[i] = temp;
	}
	//heapify
	build_maxheap(a);

	//implementation
	while (m--) {
		a[1] /= 2;
		max_heapify(a, 1);
	}

	//output
	ll sum = 0;
	FOR(i, 1, n) sum += (ll)a[i];
	cout << sum << endl;
}

int main() {
	solve();
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    string S;
    cin >> S;

    long long m[S.length()][13];
    rep(i,13) m[0][i] = 0;
    if (S[0] == '?') {
        rep(k,10) m[0][k] = 1;
    } else {
        m[0][S[0] - '0'] = 1;
    }

    for (int i = 1; i < S.length(); i++) {
        rep(j,13) m[i][j] = 0;
        if (S[i] == '?') {
            rep(k,10) {
                rep(j,13) {
                    m[i][(10 * j + k) % 13] = (m[i][(10 * j + k) % 13] + m[i - 1][j]) % MOD;
                }
            }
        } else {
            int k = S[i] - '0';
            rep(j,13) {
                m[i][(10 * j + k) % 13] = (m[i][(10 * j + k) % 13] + m[i - 1][j]) % MOD;
            }
        }
    }

    cout << m[S.length() - 1][5] << endl;
    
    return 0;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// string p=s.substr(0,len);
// sort(arr, arr+n, greater<int>());
// cout<<fixed<<setprecision(9)<<pi<<endl
// const  double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>

using namespace std;

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

	int n,k;
	cin >> n >> k;

	map<int,int> a;
	int tmp;
	for(int i=0; i<n; i++){
		cin >> tmp;
		if(a.find(tmp) == a.end()) a[tmp] = 1;
		else						a[tmp]++;
	}

	vector<int> num;
	for(auto i=a.begin(); i!=a.end(); i++) num.push_back(i->second);
	sort(num.begin(), num.end());
	int ans=0;
	for(int i=0; i<(int)num.size()-k; i++)	ans += num[i];

	cout << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 10744
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,C;
	cin>>n>>C;
	vvi dp(10010,vi(101,-1));
	dp[0][0]=0;
	rep(q,n){
		vvi ndp=dp;
		int a,b,c;
		cin>>a>>b>>c;
		rep(i,10010)rep(j,101){
			if(j+c>C)continue;
			if(dp[i][j]==-1)continue;
			int A=i+a;
			int B=dp[i][j]+b;
			ndp[max(A,B)][j+c]=max(ndp[max(A,B)][j+c],min(A,B));
			A=i+b;
			B=dp[i][j]+a;
			ndp[max(A,B)][j+c]=max(ndp[max(A,B)][j+c],min(A,B));
		}
		dp=ndp;
	}
	int out=0;
	rep(i,10010)rep(j,101)out=max(out,dp[i][j]);
	cout<<out<<endl;
}

Measured memory_bytes: 11584
#include<iostream>
#include<algorithm>
#include<cstdio>
#define INF 11111111
using namespace std;

int main(){

  int n,m;
  int a,b,c,d;
  int x,y,r,z;
  int cost[100][100];

  cin >> n >> m;

  for(int i=0;i<100;i++){
    for(int j=0;j<100;j++) cost[i][j] = INF;
  }

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

  scanf("%d,%d,%d,%d",&x,&y,&r,&z);

  for(int k=1;k<=m;k++){
    for(int i=1;i<=m;i++){
      for(int j=1;j<=m;j++) cost[i][j] = min(cost[i][j],cost[i][k]+cost[k][j]);
    }
  }

  cout << r - z - cost[x][y] - cost[y][x] << endl;
}

Measured memory_bytes: 1276