akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
          using namespace std;
          #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
          #define M_PI 3.14159265358979323846
          #define data data_
          #define ff first
          #define ss second
          #define pb push_back
          #define ll long long
          #define ld long double

          int main()
          {
               tani_nachi_ke  

               int n;
               cin >> n;
               int f[10][10];
               memset(f,0,sizeof(f));
               for(int i = 1; i <= n; i++)
               {
                    if(i%10 == 0)
                         continue;
                    int x = i;
                    int b = x%10;
                    while(x > 9)
                    {
                         x/=10;
                    }
                    f[x][b]++;
               }
               // for(int i = 1; i <= 9; i++)
               // {
               //      for(int j = 1; j <= 9; j++)
               //           cout << f[i][j] << " ";
               //      cout << endl;
               // }
               long long ans = 0;
               for(int i = 1; i <= 9; i++)
               {
                    for(int j = 1; j <= 9; j++)
                         ans += f[i][j] * f[j][i];
               }    
               cout << ans << endl;

             




         
               return 0;
          }

Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))

res = [0] * (n + 1)

for i in range(1, n + 1)[::-1]:
    sum_res = sum(res[x] for x in range(i, n + 1, i))
    if sum_res % 2 != arr[i - 1]:
        res[i] = 1

print(sum(res))

if sum(res):
    ans = []
    for i, ele in enumerate(res):
        if ele:
            ans.append(i)
    print(*ans)


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

int main(){
        long long N,A[100000],sum=0;
        cin >> N;
        for(long long i=0;i<N;i++){
                cin >> A[i];
        }
        sort(A,A+N);
        for(long long i=0;i<N;i++){
                sum++;
                if(i==N-1)break;
                if(A[i]==A[i+1]){
                        sum--;
                        i++;
                }
        }
        //if(A[N-1]!=A[N])sum++;
        cout << sum << endl;
        return 0;
        }

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>

using namespace std;
int A,B,C,D,ans=0;

int main(){
    cin >> A >> B >> C >> D;
    if(A > B){
        ans = ans + B;
    }else{
        ans = ans + A;
    }
    if(C > D){
        ans = ans + D;
    }else{
        ans = ans + C;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(string, s);
	map< char, int > mp;
	bool ok = true;
	REP(i, s.size()) mp[s[i]]++;
	EACH(mi, mp) {
		ok &= mi.second <= 1;
	}
	OUT(ok ? "yes" : "no")BR;

  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define PPC(x) __builtin_popcount((x))
#define ALL(x) (x).begin(), (x).end()
#define pb push_back
using namespace std;

int main()
{
	int n, m, a, b;
	scanf ("%d%d%d%d", &n, &m, &a, &b);

	FOR(i, 0, b)
	{
		FOR(j, 0, m)
			printf("%c", j < a ? '0' : '1');
		printf("\n");
	}
	
	FOR(i, 0, n-b)
	{
		FOR(j, 0, m)
			printf("%c", j < a ? '1' : '0');
		printf("\n");
	}
	
	return 0;
}



Measured memory_bytes: 1280
import sys

class Node:
    __slots__ = ["key","left","right"]
    def __init__(self,key):
        self.key = key
        self.left = self.right = None

root = None

def insert(key):
    global root
    x,y = root,None
    while x:
        y = x
        x = x.left if key < x.key else x.right
    if y is None:root = Node(key)
    elif key < y.key:y.left = Node(key)
    else:y.right = Node(key)

def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    return result is None

def delete(target):
    def remove_node(p,c,a):
        if p.left == c: p.left = a
        else: p.right = a
    p,c = None,root
    while c.key != target:
        p,c = c,c.left if target < c.key else c.right
    if c.left is None:
        remove_node(p,c,c.right)
    elif c.right is None:
        remove_node(p,c,c.left)
    elif c.right.left is None:
        c.right.left = c.left#親の上書き
        remove_node(p,c,c.right)
    else:
        g = c.right
        while g.left.left:g = g.left
        c.key = g.left.key
        g.left = g.left.right

def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ""

def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ""

input()
for e in sys.stdin:
    if e[0] == "i":insert(int(e[7:]))
    elif e[0] =="d":delete(int(e[7:]))
    elif e[0] =="f":print(["yes","no"][find(int(e[5:]))])
    else:print(inorder(root));print(preorder(root))



Measured memory_bytes: 53580
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const ll mod = 1000000007;
int main() {
	int N, v, a = 0, b = 0, c = 0;
	scanf("%d", &N);
	rep(i, 0, N) {
		scanf("%d", &v);
		if (v % 4 == 0)a++;
		if (v % 2 == 0)b++;
		if (v % 2)c++;
	}
	puts((c <= a || b == a && c - 1 <= a) ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; }

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int a[200000];
int b[200000];
int main(){
    int n;
    cin >> n;
    rep(i,n){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b, b+n, greater<int>());
    int mx = b[0];
    int nx = b[1];
    rep(i,n){
        if(a[i] == mx) cout << nx << endl;
        else cout << mx << endl;
    }
}



Measured memory_bytes: 3200
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  int k=0,n,c,i,j,l,a[10][10],b[10][10];
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      scanf("%d ",&a[i][j]);
      b[i][j]=0;
    }
    scanf("\n");
  }
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
    scanf("%d\n",&c);
    for(j=0;j<3;j++){
      for(l=0;l<3;l++){
        if(a[j][l]==c){
          b[j][l]=1;
        }
      }
    }
  }
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      if(b[i][j]==0){
        k=1;
        break;
      }
    }
    if(k==0){
      printf("Yes\n");
      return 0;
    }
    k=0;
  }
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      if(b[j][i]==0){
        k=1;
        break;
      }
    }
    if(k==0){
      printf("Yes\n");
      return 0;
    }
    k=0;
  }
  for(i=0;i<3;i++){
    if(b[i][i]==0){
      k=1;
    }
  }
  if(k==0){
      printf("Yes\n");
      return 0;
  }
  k=0;
  if(b[0][2]==1 && b[1][1]==1 && b[2][0]==1){
    printf("Yes\n");
    return 0;
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sx = sc.nextInt(), sy = sc.nextInt(), tx = sc.nextInt(), ty = sc.nextInt();
		sc.close();
		for (int i = 0; i < Math.abs(sx - tx); ++i) System.out.print("R");
		for (int i = 0; i < Math.abs(sy - ty); ++i) System.out.print("U");
		for (int i = 0; i < Math.abs(sx - tx); ++i) System.out.print("L");
		for (int i = 0; i < Math.abs(sy - ty); ++i) System.out.print("D");
		System.out.print("D");
		for (int i = 0; i < Math.abs(sx - tx) + 1; ++i) System.out.print("R");
		for (int i = 0; i < Math.abs(sy - ty) + 1; ++i) System.out.print("U");
		System.out.print("LU");
		for (int i = 0; i < Math.abs(sx - tx) + 1; ++i) System.out.print("L");
		for (int i = 0; i < Math.abs(sy - ty) + 1; ++i) System.out.print("D");
		System.out.print("R");
	}
}

Measured memory_bytes: 22468
import math
import copy

neko = 0
nuko = 0
inu = 0

h,w = map(int,input().split())
p = []
for i in range(h):
    p.append(input())
for i in range(w+1):
    print("#",end = '')
print("#")
for i in range(h):
    print('#'+ p[i] + '#')
for i in range(w+2):
    print("#",end = '')

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N; cin >> N;
  string S; cin >> S;
  multiset<char> ms{S.begin(), S.end()};

  ll ans = 1;
  for (char c = 'a'; c <= 'z'; ++c) {
    auto n = ms.count(c);
    if (n > 0) {
      ans *= n + 1;
      ans %= MOD;
    }
  }
  ans -= 1;
  if (ans < 0) { ans += MOD; }
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 5072
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

int main(){
    std::ios_base::sync_with_stdio(false);

    int r,D,x; cin >> r >> D >> x;

    rep(i,10){
        x = r*x-D;
        cout << x << endl;
    }


    return 0;
}

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

typedef long long int64;

int main()
{
  int N, K;
  cin >> N >> K;
  vector< int64 > x(N);
  vector< int64 > y(N);
  for (int i = 0; i < N; ++i) {
    cin >> x[i] >> y[i];
  }

  vector< int64 > sorted_x(x);
  vector< int64 > sorted_y(y);
  sort(sorted_x.begin(), sorted_x.end());
  sort(sorted_y.begin(), sorted_y.end());

  int64 ans = (sorted_y.back() - sorted_y[0]) * (sorted_x.back() - sorted_x[0]);

  // cout << ans << endl;
  
  for (int hi = 0; hi < N; ++hi) {
    for (int wi = 0; wi < N; ++wi) {
      for (int hj = hi; hj < N; ++hj) {
	for (int wj = wi; wj < N; ++wj) {

	  int sm = 0;
	  for (int i = 0; i < N; ++i) {
	    if (sorted_y[hi] <= y[i] && y[i] <= sorted_y[hj] &&
		sorted_x[wi] <= x[i] && x[i] <= sorted_x[wj]) {
	      sm++;
	    }
	  }

	  if (sm >= K) {
	    ans = min(ans, (sorted_y[hj] - sorted_y[hi]) * (sorted_x[wj] - sorted_x[wi]));
	  }
	  
	}
      }
    }
  }

  cout << ans << endl;

  
  
  return 0;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
)

func main() {
	var N, A, B int
	fmt.Scan(&N, &A, &B)
	div := N / (A + B)
	rem := N % (A + B)
	// A==0の場合は結果的に場合分けしなくて良い
	// divが、N個のボールのうち高橋くんが実行する回数（余りを含まない）
	// remがdiv回の操作が行われた余り。
	// remがAより小さかったらそれはすべて青いボール
	// remがAより大きかったらA個のボールが含まれる
	// if A == 0 {
	// 	fmt.Println(0)
	// } else
	fmt.Println(div*A + MinOf(rem, A))
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}


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

int main(){
  int N,T,A;
  cin >> N;
  cin >> T >> A;
  int H[N];
  float sub[N];
  for(int i=0;i<N;i++){
    cin >> H[i];
    sub[i] = T - H[i]*0.006;
  }
  int ans = 0;
  float mini = 100000;
  for(int i=0;i<N;i++){
    if(A-sub[i] > 0){
    if(min(A-sub[i],mini) == A-sub[i]){
      ans = i;
      mini = min(A-sub[i],mini);
    }
  }else{
    if(min(sub[i]-A,mini) == sub[i] - A){
      ans = i;
      mini = min(sub[i]-A,mini);
    }
  }
  }
  cout << ans+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

ll gcd(ll a, ll b){
    ll num1 = max(a, b);
    ll num2 = min(a, b);
    if(num1 % num2 == 0){
        return num2;
    }
    return gcd(num1 % num2, num2);
}

int main() {
    ll A, B, d, ans;
    cin >> A >> B;
    d = gcd(A, B);
    ans = 0;
    for(ll i = 2; i * i <= d; i++){
        if(d % i == 0){
            ans++;
        }
        while(d % i == 0){
            d /= i;
        }
    }
    if(d > 1)ans++;
    cout << ++ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define go(i, a, n) for (ll i = a; i < (ll)n; i++)
#define gor(i, a, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define gos(i, a, n, step) for (ll i = a; i < (ll)n; i += step)
#define show(a) cout << a << '\n'
#define show2(a, b) cout << a << " " << b << '\n'
#define show3(a, b, c) cout << a << " " << b << " " << c << '\n'
#define show4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << '\n'
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define mod 1000000007
#define mem(a, k) memset(a, k, sizeof(a))
#define answer(z, k) cout << "Case #" << z << ": " << k << endl;
auto t1 = chrono::high_resolution_clock::now();
class student
{
public:
    string name, rno;
    float marks;
    ll index;
};
bool cmp(student a, student b)
{
    if (a.marks == b.marks)
        return a.index < b.index;
    return a.marks < b.marks;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    ld d;
    cin >> n >> d;
    ll cnt = 0;
    go(i, 0, n)
    {
        ld x, y;
        cin >> x >> y;
        if (sqrt((x * x) + (y * y)) <= d)
            cnt++;
    }
    show(cnt);
    auto t2 = chrono::high_resolution_clock::now();
    auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
    clog << "Time taken = " << duration * 1.0 / 1000 << " seconds" << endl;
    return 0;
}

Measured memory_bytes: 3872
#include "bits/stdc++.h"
 
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORL(i,a,b) for(LL i=(a);i<(b);++i)
#define REPL(i,n)  FORL(i,0,n)
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_LARGE = 1000000100;
 
 
//debug func
template<typename T>
void vecprint(vector<T> v) {
    for(auto x : v) {
        cerr << x << " ";
    }
    cerr << endl;
}
 
template<typename T>
void vecvecprint(vector<vector<T>> vv) {
    REP(i, SIZE(vv)) {
        REP(j, SIZE(vv[i])) {
            cerr << vv[i][j] << " ";
        }
        cerr << endl;
    }
}
 
template <typename Iterator>
inline bool next_combination(const Iterator first, Iterator k, const Iterator last)
{
   /* Credits: Thomas Draper */
   if ((first == last) || (first == k) || (last == k))
      return false;
   Iterator itr1 = first;
   Iterator itr2 = last;
   ++itr1;
   if (last == itr1)
      return false;
   itr1 = last;
   --itr1;
   itr1 = k;
   --itr2;
   while (first != itr1)
   {
      if (*--itr1 < *itr2)
      {
         Iterator j = k;
         while (!(*itr1 < *j)) ++j;
         iter_swap(itr1,j);
         ++itr1;
         ++j;
         itr2 = k;
         rotate(itr1,j,last);
         while (last != j)
         {
            ++j;
            ++itr2;
         }
         rotate(k,itr2,last);
         return true;
      }
   }
   rotate(first,k,last);
   return false;
}

inline double get_time_sec(void){
    return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count())/1000000000;
}

template<typename T>
T gcd(T a, T b) {
    if(a > b) swap(a, b);
    if(a == 0) return b;
    else return gcd(b%a, a);
}

template<typename T>
map<T, T> prime_list(T n) {
    map<T, T> ret;
    for(T i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            ret[i] = 0;
            while(n % i == 0) {
                n /= i;
                ret[i]++;
            }
        } 
    }
    if(n != 1) ret[n]++;
    return ret;
}

int main(void) {
    int n;
    double t, a;
    cin >> n >> t >> a;
    vector<double> vt(n);
    REP(i, n) {
        double tmp;
        cin >> tmp;
        vt[i] = abs(t - tmp * 0.006 - a);
    }
    vecprint(vt);
    double mint = 100000;
    int idx = 0;
    REP(i, n) {
        if(vt[i] < mint) {
            mint = vt[i];
            idx = i + 1;
        }
    }
    cout << idx << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int count = 0;
		for(int i=0;i<n;i++) count += in.nextInt() % 2 == 0 ? 0 : 1;
		System.out.println(count % 2 == 0 ? "YES" : "NO");
	}
}


Measured memory_bytes: 32216
#include <cstdio>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cmath>
 
using namespace std;
 
#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)
 
#define EPS 1e-10
#define EQUAL(a, b) (fabs((a)-(b))<EPS)
 
typedef vector<int> vi;
 
int main()
{
    int n;
    scanf("%d", &n);
    rep(i, n){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        puts(EQUAL((x2-x1)*(y4-y3), (y2-y1)*(x4-x3)) ? "YES" : "NO");
    }
 
    return 0;
}

Measured memory_bytes: 1048
/* https://codeforces.com/contest/1360/problem/H */
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second 
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define	lb lower_bound
#define	ub upper_bound
#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;

int main() {
	for (int i = 0;i < 5;++i) {
		int x;
		cin>>x;
		if (x == 0) {
			cout<<i+1<<endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 3624
fn main() {
  let (n, z, w): (usize, isize, isize) = get::tuple3();
  let mut xs: Vec<isize> = get::list();

  if xs.len() == 1 {
    println!("{}", (xs[0] - w).abs());
    return
  }

  xs.insert(0, z);

  let s1 = (xs[n] - w).abs();
  let s2 = (xs[n-1] - xs[n]).abs();
  let ans = std::cmp::max(s1, s2);

  println!("{}", ans);
}

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main(){
    long N, M, ans;
    cin >> N;
    cin >> M;
    if(N >= 3 && M >= 3){
        ans = N * M - (2*N + 2*M - 4);
        cout << ans << endl;
    }
    else if(N == 2 || M == 2){
        ans = 0;
        cout << ans << endl;
    }
    else if(N == 1 || M == 1){
        if(N == M){
            ans = 1;
            cout << ans << endl;
        }
        else if(N > M){
            ans = N - 2;
            cout << ans << endl;
        }
        else if(N < M){
            ans = M - 2;
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=5e4+5,M=1e5+5;
int a[M],b[M],n,m,T;
bool col[M];

namespace sub1{

	bool ok[N];
	bitset<N> can[N];
	
	void main(){
		for(int i=1;i<=n;i++) can[i][i]=1;
		for(int i=1;i<=m;i++){
			can[a[i]]=can[b[i]]=can[a[i]]|can[b[i]];
			if(can[a[i]].count()==n){
				ok[a[i]]=ok[b[i]]=1;
				for(int j=i-1;j;j--) if(ok[a[j]]||ok[b[j]]){
					if(ok[a[j]]) col[j]=1;
					ok[a[j]]=ok[b[j]]=1;
				}
				for(int i=1;i<=m;i++) putchar(col[i]?'^':'v');
				return ;
			}
		}
		write(-1);
	}
}

namespace sub2{
	
	int sz[N],to[N];
	bool flag;
	
	void main(){
		for(int i=1;i<=n;i++) to[i]=i,sz[i]=1;
		for(int i=m;i;i--){
			if(max(sz[to[a[i]]]-1,sz[to[b[i]]]+1)<max(sz[to[a[i]]]+1,sz[to[b[i]]]-1)) sz[to[a[i]]]--,sz[to[a[i]]=to[b[i]]]++;
			else col[i]=1,sz[to[b[i]]]--,sz[to[b[i]]=to[a[i]]]++;;
		}
		for(int i=1;i<=n;i++) flag|=sz[i]==n;
		if(flag) write(-1);
		else for(int i=1;i<=m;i++) putchar(col[i]?'^':'v');
	}
}

signed main(){
	read(n,m,T);
	for(int i=1;i<=m;i++) read(a[i],b[i]);
	if(T==1) sub1::main();
	else sub2::main();
}

Measured memory_bytes: 309928
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
#define N 1000;
	string n, m;
	cin >> n >> m;
	
	string s = n + m;
	//cout << s << endl;
	int size = s.size();
	int snum = 0;
	int ten = 1;
	rrep(i, size - 1, 0) {
		snum += (s[i]-'0') * ten;
		ten *= 10;
	}
	//cout << snum << endl;
	
	bool ans = false;
	rep(i,1,100100){
		if (i * i == snum)ans = true;
	}
	
	
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;


	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll a,b;
  cin >> a >> b;
  pri((a+b-1)/b);
  return 0;
}


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

int main(){
    int n, m; cin >> n >> m;
    vector<int> g[n];
    rep(i, m){
        int a, b; cin >> a >> b;
        --a;--b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    int ans[n];
    memset(ans, -1, sizeof(ans));
    queue<int> q;
    q.push(0);
    while(q.size()){
        int now = q.front(); q.pop();
        for(int n : g[now]) {
            if(ans[n] < 0){
                ans[n] = now;
                q.push(n);
            }
        }
    }
    rep(i, n) {
        if(ans[i] < 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    loop(i, 1, n) cout << ans[i]+1 << endl;

    return 0;
}

Measured memory_bytes: 10416
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define MAX 500

int c[MAX+1][MAX+1], d[MAX+1][MAX+1];

int main(){
	int n, m, q, l, r;
	cin >> n >> m >> q;
	for(int i=0; i<m; i++){
		cin >> l >> r;
		c[l][r]++;
	}
	for(int j=1; j<=n; j++){
		for(int i=n; i>0; i--){
			if(i==n) d[i][j]=c[i][j];
			else d[i][j]=d[i+1][j]+c[i][j];
		}
	}

	for(int i=0; i<q; i++){
		cin >> l >> r;
		int t=0;
		for(int j=1; j<=r; j++) t+=d[l][j];
		cout << t << endl;
	}
	return 0;
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1000000007ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll inf = 1ll << 60;



int main() {
    int n, q;
    scanf("%d%d", &n, &q);
    char s[100010];
    scanf("%s", s);
    vector<int> a(100010); //i番目までの'AC'の数
    rp(i, 1, n) {
        if(s[i-1] == 'A' and s[i] == 'C') a.at(i) = a.at(i-1) + 1;
        else a.at(i) = a.at(i-1);
    }
    rp(i, 0, q) {
        int l, r;
        scanf("%d%d", &l, &r);
        printf("%d\n", a.at(r-1) - a.at(l-1));
    }
    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

int field[2010][2010];

int count_step_x(int x,int y,int H, int W){
  int count=1;
  int step=0;
  while(field[x+step][y]==0){
    step+=1;
    if(x+step==W){
      break;
    }
  }
  count+=(step-1);
  step=0;
  while(field[x-step][y]==0 && x+step>=0){
    step+=1;
    if(x-step==(-1)){
      break;
    }
  }
  count+=(step-1);

  return count;
}


int count_step_y(int x,int y,int H, int W){
  int count=1;
  int step=0;
  while(field[x][y+step]==0){
    step+=1;
    if(y+step==H){
      break;
    }
  }
  count+=(step-1);
  step=0;
  while(field[x][y-step]==0){
    step+=1;
    if(y-step==(-1)){
      break;
    }
  }
  count+=(step-1);
  return count;
}


  int main(){
    int H,W;
    cin>>H>>W;
    std::string s1;
    for(int i=0;i<H;++i){
      cin>>s1;
      for(int j=0;j<W;++j){
        if(s1[j]=='.'){
          field[j][i]=0;
        }
        else{
          field[j][i]=1;
        }
      }
    }
    int yoko[W][H]={};
    int tate[W][H]={};
    //yokokeisann
    for(int i=0;i<H;++i){
      for(int j=0;j<W;++j){
        if(j==0 && field[j][i]==0){
          yoko[j][i]=count_step_x(j,i,H,W);
        }
        else if(field[j][i]==0 && field[j-1][i]==1){
          yoko[j][i]=count_step_x(j,i,H,W);
        }
        else if(field[j][i]==0){
          yoko[j][i]=yoko[j-1][i];
        }
      }
    }
    //tatekeisann
    for(int j=0;j<W;++j){
      for(int i=0;i<H;++i){
        if(i==0 && field[j][i]==0){
          tate[j][i]=count_step_y(j,i,H,W);
        }
        else if(field[j][i]==0 && field[j][i-1]==1){
          tate[j][i]=count_step_y(j,i,H,W);
        }
        else if(field[j][i]==0){
          tate[j][i]=tate[j][i-1];
        }
      }
    }
    int ans=0;
    int tmp;
    for(int i=0;i<H;++i){
      for(int j=0;j<W;++j){
        tmp=yoko[j][i]+tate[j][i];
        ans=max(ans,tmp);
      }
    }
  cout<<ans-1<<"\n";
return 0;
}


Measured memory_bytes: 47232
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

main = do
  [n, m] <- getIntList
  let [n', m'] = sort [n, m]
  print $ abs ((n' - 2) * (m' - 2))


Measured memory_bytes: 3752
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = collections.Counter(["".join(sorted(list(str(input().rstrip('\n'))))) for _ in range(n)])
    cnt = 0
    for k, v in s.items():
        for i in range(1, v):
            cnt += i
    print(cnt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 64220
n = gets.chomp.to_i
#k,x = gets.chomp.split().map(&:to_i)

s = gets.chomp.split(//)

ans = 0
count = 0
s.each do |c|
  if c == 'A'
    count = 1
  elsif c == 'B' && count == 1
    count = 2
  elsif c == 'C' && count == 2
    ans += 1
    count = 0
  else
    count = 0
  end
end

puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
                using namespace std;
                #define int long long
                #define fi first
                #define se second
                #define pi pair<int,int>  
                #define pb push_back

                // dont forget to initialize global variables inside main() ;
                int mod = 1e9 + 7;
                
                int func(string &s,string &t,int k){
                    int ans=0;
                    for(int i=k;i<k+(int)t.size();i++){
                        if( s[i]!=t[i-k] )
                            ans++;
                    }
                    return ans;
                }
                int32_t main() {
                
                ios::sync_with_stdio(false);
                cin.tie(0);
                cout.tie(0);

                int tt=1;//;cin>>tt; 
                
                
                while( tt-- ){

                    int n;cin>>n;
                    vector<int > a(n);
                    for(int i=0;i<n;i++)
                        cin>>a[i];
                    vector<int > s(n);
                    for(int i=n-1;i>=0;i--){
                        if( i==n-1 ){
                            s[n-1]=a[n-1];
                        }
                        else{
                            s[i] = a[i]+s[i+1];
                        }
                    }
                    int ans=0;
                    for(int i=0;i<n-1;i++){
                        ans = (ans%mod + (a[i]%mod)*(s[i+1]%mod))%mod;
                    }
                    cout<<ans<<endl;
                }
                return 0;
            }

                        


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

typedef struct {
    float x;
    float y;
} Vector;


void printVectorEndl(Vector u) {
    printf("%f %f\n", u.x, u.y);
}

void fractalGeneration (
    Vector begin, 
    Vector end, 
    int remainingNumberOfGenerations
) 
{
    remainingNumberOfGenerations--;
    
    // end if no remaining generations
    if (remainingNumberOfGenerations < 0) {
        printVectorEndl(begin);
        return;
    }
    
    // distance from begin to end
    float d = sqrt( // sqrt(Dx^2 + Dy^2)
        (end.x - begin.x) * (end.x - begin.x) + 
        (end.y - begin.y) * (end.y - begin.y)   
    );
    // unit parallel vector
    Vector parallel_unit = { 
        (end.x - begin.x) / d,
        (end.y - begin.y) / d
    };
    // unit perpendicular vector
    Vector perpendicular_unit = {
        -parallel_unit.y, 
         parallel_unit.x
    };
    
    // find points in between begin and end
    Vector A = {
        d/3 * parallel_unit.x   +begin.x,
        d/3 * parallel_unit.y   +begin.y
    };
    Vector B = {
        d/6 * parallel_unit.x + d*sqrt(3)/6 * perpendicular_unit.x   +A.x,
        d/6 * parallel_unit.y + d*sqrt(3)/6 * perpendicular_unit.y   +A.y
    };
    Vector C = {
        d/3 * parallel_unit.x   +A.x,
        d/3 * parallel_unit.y   +A.y
    };
    
    // do next generation
    fractalGeneration(begin , A     , remainingNumberOfGenerations);
    fractalGeneration(A     , B     , remainingNumberOfGenerations);
    fractalGeneration(B     , C     , remainingNumberOfGenerations);
    fractalGeneration(C     , end   , remainingNumberOfGenerations);
};

int main(int argc, char** argv) {
    int n;
    scanf("%d", &n);
    
    Vector begin = {0,0};
    Vector end = {100, 0};
    
    fractalGeneration(begin,end,n);
    printVectorEndl(end);
    
    return (EXIT_SUCCESS);
}




Measured memory_bytes: 2048
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    int64_t res = 0;
    for(int64_t i=0; i<=50000; i++){
        if(floor(i * 1.08) == n){
            res = i;
        }
    }
    if(res!=0){
        cout << res << endl;
    }else{
        cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
int main()
{
	while (true)
	{
		int n;
		std::cin >> n;
		if (n == 0)
		{
			break;
		}
		int result = 0;
		int five_pow = 5;
		while (true)
		{
			const int fives = n / five_pow;
			if (fives == 0)
			{
				break;
			}
			result += fives;
			five_pow *= 5;
		}
		std::cout << result << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2992
import java.util.*;
  
class Main{
   public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int a = input.nextInt();
		int b = input.nextInt();
		int c = input.nextInt();
   	if(a < b && b < c){
     	System.out.println("Yes");
   	}else{
   		System.out.println("No");
   	}
   	
  }
}

Measured memory_bytes: 17160
#include <iostream>
#include <stack>

using namespace std;

struct locate{
  int x;
  int y;
};

int graph[64][64] = {{}};
int flag[64][64] = {{}};
int w,h;

int dfs(locate );


int main(){

  int sum = 0;
  locate in;

  while(1){
  cin >> w >> h ;
  if(w == 0 && h == 0) break;
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      cin >> graph[i][j];
    }
  }
    for(int i = 0;i < h;i++){
      for(int j = 0;j < w;j++){
	if(graph[i][j] == 1 && flag[i][j] == 0){
	  sum++;
	  in.x = j;
	  in.y = i; 
	  if(dfs(in) == -1){
	    sum-= 1;
	  }
	  //	cout << "sum = " << sum << endl;
	}
      }
    }

    cout << sum << endl;
    sum = 0;
    for(int i = 0;i < 64;i++){
      for(int j = 0;j < 64;j++){
	graph[i][j] = 0;
	flag[i][j] = 0;
      }
    }
  }
  return 0;
}



int dfs(locate in){

  stack<locate> S;
  locate u,v,re;
  int  dx,dy,a = 0;

  S.push(in);

  while(!S.empty()){
    v = S.top();S.pop();
    for(dy = -1;dy <= 1;dy++){
      if(v.y + dy < 0 || v.y + dy > 63) continue;
      for(dx = -1;dx <= 1;dx++){
	if(v.x + dx < 0 || v.x + dx > 63 || (dx == 0 && dy == 0)) continue;
	//	cout << "x = " << v.x << "y = " << v.y << endl; 
	if(graph[v.y + dy][v.x + dx] == 1 && flag[v.y + dy][v.x + dx] == 0){
	  // cout << 'a' << endl;
	  flag[v.y + dy][v.x + dx] = 1;
	  re.x = v.x + dx;
	  re.y = v.y + dy;
	  a = 1;
	  dfs(re);
	}
	/*else if(graph[v.y + dy][v.x + dx] == 1 && flag[v.y + dy][v.x + dx] == 1){
	  cout << 'b' << endl;
	  a = 0;
	  return -1;
	  }*/
      }
    }
  }
  return a;
}

Measured memory_bytes: 5108
n = 200000
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
x=int(input())
for i in primes:
    if i>=x:
        print(i)
        exit()


Measured memory_bytes: 90080
#include<stdio.h>
int main() {
	int m,n1, n2, n3;
	scanf("%d%d%d", &n1, &n2, &n3);
	if (n1 < n2  ) {
		m = n1;
		n1 = n2;
		n2 = m;
	}
	if (n1 < n3) {
		m = n3;
		n3 = n1;
		n1 = m;
	}
	if (n2 < n3) {
		m = n2;
		n2 = n3;
		n3 = m;
	}
	printf("%d ", (n1-n2)+(n2- n3));
	return 0;
}

	

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

int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  for(int i = 0; i < N; i++){
    cin >> p.at(i);
  }
  sort(ALL(p));
  reverse(ALL(p));
  p.at(0) /= 2;
  int sum = 0;
  for(int i = 0; i < N; i++){
    sum += p.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n,a,i,ans=0;
	scanf("%d",&n);
	for (i=0;i<n;i++) {
		scanf("%d",&a);
		while (a%2==0){
			ans++;
			a = a/2;
		}

	}
	printf("%d\n",ans);
	
	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] v = new int[N], c = new int[N];
		int sum = 0;

		for(int i = 0;i<N;i++)
			v[i] = sc.nextInt();

		for(int j = 0; j<N; j++)
			c[j] = sc.nextInt();

		for(int i = 0;i < N;i++) {
			int b = v[i] - c[i];
			if(b>0)
				sum+=b;
		}

		System.out.println(sum);
	}
}

Measured memory_bytes: 23892
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
vector<int>G[100004];
int p[100004], y[100004];
string ans[100004];
map<P, int>M;
int digit(int a) {
	int res = 0;
	while (a) {
		res++;
		a /= 10;
	}
	return res;
}
signed main() {
	int n, m; cin >> n>>m;
	rep(i, m) {
		cin >> p[i] >> y[i];
		G[p[i]].push_back(y[i]);
		M[P(p[i], y[i])] = i;
	}
	rep(i, n+1) {
		sort(G[i].begin(), G[i].end());
		rep(j, G[i].size()) {
			int np = M[P(i, G[i][j])];
			string s;
			rep(k, 6 - digit(i))s.push_back('0');
			s += to_string(i);
			rep(k, 6 - digit(j + 1))s.push_back('0');
			s += to_string(j + 1);
			ans[np] = s;
		}
	}
	rep(i, m)cout << ans[i] << endl;
}

Measured memory_bytes: 20224
import sys
from collections import defaultdict
from math import gcd

def input(): return sys.stdin.readline()

K = 1_000_000_000
L = K**2
D = defaultdict(int)
for _ in range(int(input())):
    D[gcd(round(float(input()) * K), L)] += 1

D = tuple(D.items())
ans = 0
for i, (k1, v1) in enumerate(D):
    if k1*k1 % L == 0:
        ans += v1*(v1-1) // 2
    for k2, v2 in D[i+1:]:
        if k1*k2 % L == 0:
            ans += v1 * v2
print(ans)


Measured memory_bytes: 9372