akhauriyash/Code-Regression huggingface dataset:
/*
  Submitter: Nick Hudson
  Anumber: A01634984


  */

#include <iostream>

int main(){

  int K,X;
  int yen;

  std::cin>>K>>X;

  yen = K*500;

  if(yen >= X){
    std::cout<<"Yes";
  }else{
    std::cout<<"No";
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <memory.h>
#include <random>
#include <ctime>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <bitset>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
#ifdef LOCAL
    #define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
    #define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*++++++++++++++++++++++++++++++++++++coding area start+++++++++++++++++++++++++++++++++++++++++*/
const int MAXN = 1e5 + 10;
pii x[MAXN], y[MAXN], nums[MAXN];
bool vis[MAXN];

LL solve(bool lft, int n) {
    memset(vis, false, sizeof(vis));
    LL ret = 0, cur = 0;
    int i = 0, j = n-1;
    for (int k = 0; k < n; k++) {
        if (lft) {
            while (i < n && vis[x[i].second]) i++;
            vis[x[i].second] = true;
            if (nums[x[i].second].first <= cur && cur <= nums[x[i].second].second) continue;
            ret += abs(cur - x[i].first);
            cur = x[i].first;
        }
        else {
            while (j >= 0 && vis[y[j].second]) j--;
            vis[y[j].second] = true;
            if (nums[y[j].second].first <= cur && cur <= nums[y[j].second].second) continue;
            ret += abs(cur - y[j].first);
            cur = y[j].first;
        }
        lft = !lft;
    }
    ret += abs(cur);
    return ret;

}


/*-------------------------------------coding area end------------------------------------------*/
int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout.precision(10); cout << fixed;
    #ifdef LOCAL
        freopen("../test.txt", "r", stdin);
//        freopen("../output.txt", "w", stdout);
    #endif
/*++++++++++++++++++++++++++++++++++++coding area start+++++++++++++++++++++++++++++++++++++++++*/
    int n; cin >> n;
    int a, b;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        x[i] = {b, i};
        y[i] = {a, i};
        nums[i] = {a, b};
    }
    sort(x, x+n);
    sort(y, y+n);
    LL ret = max(solve(true, n), solve(false, n));
    cout << ret << endl;






/*-------------------------------------coding area end------------------------------------------*/

    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
    #endif
    return 0;
}
/* author:  txingml */


Measured memory_bytes: 2688
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(mut x: i64, mut y: i64) -> i64 {
    while y != 0 {
        let r = x % y;
        x = y; y = r;
    }
    x
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut lft = vec![0; n + 1];
    let mut rgt = vec![0; n + 1];
    for i in 0..n {
        lft[i + 1] = gcd(lft[i], a[i]);
    }
    for i in (0..n).rev() {
        rgt[i] = gcd(a[i], rgt[i + 1]);
    }
    let mut ma = 0;
    for i in 0..n {
        ma = max(ma, gcd(lft[i], rgt[i + 1]));
    }
    puts!("{}\n", ma);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

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

    int ans = N;
    for (int i = 0; i <= N; i++)
    {
        int cc = 0;
        int tmp = i;
        while (tmp > 0)
        {
            cc += tmp % 9;
            tmp /= 9;
        }

        tmp = N - i;
        while (tmp > 0)
        {
            cc += tmp % 6;
            tmp /= 6;
        }

        if (ans > cc)
        {
            ans = cc;
        }
    }

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

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

bool isprime(int n){
    rep2(i,2,sqrtl(n)+1) if (n % i == 0) return false;
    return true;
}

signed main(){

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

    int n; cin >> n; cout << n << ":";
    vector<int> div;
    int a = n;
    if (n % 2 == 0){
        while (n % 2 == 0){
            cout << " " << 2;
            n /= 2;
        }
    }
    for (int i = 3; i*i <= n; i += 2){
        while (n % i == 0){
            cout << " " << i;
            n /= i;
        }
    }
    if (n != 1) cout << " " << n;
    cout << endl;
    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    bool can = false;
    for (int i = 0; i <= 25; i++)
    {
        for (int j = 0; j <= 14; j++)
        {
            if (i * 4 + j * 7 == N)
                can = true;
        }
    }
    if (can)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 384
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
//AtCoderC++.cpp

using namespace std;

inline int ceileing(int a, int b) {
	return a % b == 0 ? a / b : a / b + 1;
}

void show(vector<int> a) {
	for (auto v : a)cout << v << " ";
	cout << endl;
}

int main() {
	int N;cin >> N;
	auto as = vector<int>(N+1);
	long long E_sum = 0;
	for (size_t i = 0; i < N + 1; i++) {
		cin >> as[i];
		E_sum += as[i];
	}
	auto bs = vector<int>(N);
	for (size_t i = 0; i < N; i++) {
		cin >> bs[i];
	}
	for (size_t i = 0; i < N; i++) {
		if (as[i] < bs[i]) {
			bs[i] -= as[i];
			as[i] = 0;
			as[i + 1] = max(0, as[i + 1] - bs[i]);
		} else {
			as[i] -= bs[i];
		}
//		show(as);
	}
	long long sum = 0;
	for (size_t i = 0; i < N+1; i++) 	sum += as[i];
	cout << E_sum - sum << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const ll Inf = 1ll << 60;
ll n;
ll a[maxx];
ll ans = Inf;

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	bool flg = 0;
	ll sum = 0, res = 0;
	for(int i = 1; i <= n; i++) { // + - + - + - ...
		sum += a[i];
		if(!flg) { // sum为正, flg = 0
			if(sum <= 0) { //若当前sum <= 0, 将sum变为1
				res += 1 - sum; //sum变为1所需要的花费是 1 - sum (sum <= 0)
				sum = 1;
			}
		}
		else { // sum为负, flg = 1
			if(sum >= 0) { //若当前sum >= 0, 将sum变为-1
				res += sum + 1; //sum变为-1所需花费是 sum + 1 (sum >= 0)
				sum = -1;
			}
		}
		flg ^= 1; //flg变号, 按位异或
	}
	ans = min(ans, res);
	sum = res = 0;
	flg = 0;
	for(int i = 1; i <= n; i++) { // - + - + - + ...
		sum += a[i];
		if(!flg) { //sum为负, flg = 0
			if(sum >= 0) { //与上一次进行的O(n)操作同理
				res += sum + 1;
				sum = -1;
			}
		}
		else { //sum为正, flg = 1
			if(sum <= 0) { //与上一次进行的O(n)操作同理
				res += 1 - sum;
				sum = 1;
			}
		}
		flg ^= 1;
	}
	ans = min(ans, res);
	cout << ans << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s;
    string week="SATFRITHUWEDTUEMONSUN";
    int ans;
    cin >> s;
    for(int i=0;i<21;i+=3){
        if(s[0]==week[i]&&s[1]==week[i+1])ans=i/3+1;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
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 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():
    S=ST()
    #S_rev = S[::-1]
    dp = [[0]*13 for _ in range(10**5+2)] #dp[i][j]:=i-1桁目までで余りがjになる場合の数
    dp[0][0] = 1
    for i,s in enumerate(S):
        if s == "?":
            for hatena in range(10):
                for n in range(13):
                    amari = (10*n + hatena)%13
                    dp[i+1][amari] += dp[i][n]
                    dp[i+1][amari]%=mod
        else:
            for n in range(13):
                amari = (10 * n+int(s))%13

                dp[i+1][amari] += dp[i][n]
                dp[i+1][amari]%=mod
    print(dp[len(S)][5])
if __name__ == '__main__':
    main()

Measured memory_bytes: 61788
A, B, N = list(map(int, input().split()))

from math import floor
# ans = -1
# for x in range(N+1):
#     r = floor(A*x/B) - A * floor(x/B)
#     # print(ans, r)
#     print(x, r)

# print('---')

if B > N:
    ans = floor(A*N/B)
else:
    x = B-1
    ans = floor(A*x/B)

print(ans)

Measured memory_bytes: 9112
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] cs = new int[n - 1];
        int[] ss = new int[n - 1];
        int[] fs = new int[n - 1];
        for (int i = 0; i < n - 1; i++) {
            cs[i] = sc.nextInt();
            ss[i] = sc.nextInt();
            fs[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            System.out.println(solve(n, cs, ss, fs, i, 0));
        }
    }

    private static int solve(int n, int[] cs, int[] ss, int[] fs, int x, int t) {
        if (x == n - 1) {
            return t;
        }
        int departure;
        if (t < ss[x]) {
            departure = ss[x];
        } else {
            departure = (t + fs[x] - 1) / fs[x] * fs[x];
        }
        return solve(n, cs, ss, fs, x + 1, departure + cs[x]);
    }
}


Measured memory_bytes: 26988
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
#include<cmath>
using namespace std;

int b[1001];
int a[1001][1001];

int main()
{
	int n,m,c;
	scanf("%d%d%d",&n,&m,&c);
	for(int i=1;i<=m;i++)
	scanf("%d",&b[i]);
	for(int i=1;i<=n;i++)
	 for(int j=1;j<=m;j++)
	 scanf("%d",&a[i][j]);
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		int ans=0;
		for(int j=1;j<=m;j++)
		{
			ans+=a[i][j]*b[j];
		}
		ans+=c;
		if(ans>0)
		sum++;
	}
	printf("%d\n",sum); 
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  vector<ll> sums(n, 0);
  sums[0] = a[0];
  for (int i = 1; i < n; ++i) {
    sums[i] += a[i] + sums[i - 1];
  }
  ll res = LONG_LONG_MAX;
  for (int i = 0; i < n - 1; ++i) {
    res = min(res, abs(sums[i] - (sums[n - 1] - sums[i])));
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <unordered_set>

using namespace std;

int main(void) {
    int n;
    cin >> n;
    unordered_set<int> mochi;

    for (int i = 0; i < n; ++i) {
        int d;
        cin >> d;
        mochi.insert(d);
    }

    cout << mochi.size() << endl;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {

  def main(args:Array[String]) = {
    val n = readInt
    var a = 1;var b = 0
    for(i<-0 until n) {
      val c = a
      a = a+b
      b = c
    }
    println(a)
  }
}

Measured memory_bytes: 43708
// practice with kaiboy
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		long[] aa = new long[n];
		for (int i = 0; i < n; i++)
			aa[i] = sc.nextLong();
		long ans = 0;
		while (true) {
			long sum = 0;
			for (int i = 0; i < n; i++) {
				long cnt = aa[i] / n;
				sum += cnt;
			}
			if (sum == 0)
				break;
			ans += sum;
			for (int i = 0; i < n; i++) {
				long cnt = aa[i] / n;
				aa[i] = aa[i] % n + sum - cnt;
			}
		}
		println(ans);
	}
}


Measured memory_bytes: 36288
import java.util.*;

class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    long[] num = new long[a];
    for (int i = 0; i < a; i++) {
      num[i] = i + 1;
    }
    
    long sum = 0;
    for (int i = 0; i < a; i++) {
      if (num[i] % 3 != 0 && num[i] % 5 != 0 && num[i] % 15 != 0) {
        sum += num[i];
      }
    }
    
    System.out.println(sum);
  }
}

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

int main() {
  set<ll> d;
  ll n;
  cin >> n;
  for(int i=0;i<n;i++) {
    ll temp;
    cin >> temp;
    d.insert(temp);
  }
  cout << d.size() << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int count = 0;
		int k = sc.nextInt();
		int s = sc.nextInt();

		for (int i = 0; i <= k; i++) {
			for(int j = 0;j <= k;j++){
				if(i+j <= s && s-(i+j) <= k){
					count++;
				}
			}
		}

		System.out.println(count);
	}
}


Measured memory_bytes: 9796
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t N;
  cin>>N;
  vector<int64_t> A(5,0);
  for(int i=0;i<N;i++){
  string s;
    cin>>s;
      char x=s.at(0);
    if(x=='M') A.at(0)++;
    if(x=='A') A.at(1)++;
    if(x=='R') A.at(2)++;
    if(x=='C') A.at(3)++;
    if(x=='H') A.at(4)++;
  }int64_t ans=0;
  for(int i=0;i<3;i++){
  for(int j=i+1;j<4;j++){
  for(int k=j+1;k<5;k++)
    ans+=A.at(i)*A.at(j)*A.at(k);
  }
  
  }
  cout<<ans<<endl;
  
    return 0;
}

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

using namespace std;

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

vector<string> inputs(int H){
  vector<string> data(H);
  rep(i, H){
    cin >> data.at(i);
  }
  return data;
}

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> data = inputs(H);
  
  vector<bool> row(H, false);
  vector<bool> column(W, false);
  rep(i, H){
    rep(j, W){
      if(data.at(i).at(j) == '#'){
        row.at(i) = true;
        column.at(j) = true;
      }
    }
  }
  rep(i, H){
    if(row.at(i)){
      rep(j, W){
        if(column.at(j))
          cout << data.at(i).at(j);
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
int main(){
    string s;
    cin>>s;
    bool bl=true;
    rep(i,s.length()){
        if(i%2==0){
            if(s[i]=='L')bl=false;
        }
        if(i%2==1){
            if(s[i]=='R')bl=false;
        }
    }
    string ans=bl?"Yes":"No";
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
#define INF 100000000
#define MAX_C 100
using namespace std;
map<int, int> mp;
int main()
{
	int x;
	cin >> x;
	vector<bool> expo(x + 1);
	expo[1] = 1;
	for (int b = 2; b <= x; b++) {
		int v = b * b;
		while (v <= x) {
			expo[v] = 1;
			v *= b;
		}
	}
	for (int i = x; i >= 1; i--) {
		if (expo[i]) {
			cout << i << endl;
			return 0;
		}
	}
}

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

#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                            long long
 
#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first  
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'
 
 
// Debug //
 
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
 
using namespace std;






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


	
	ll r;
	cin>>r;

	cout<<float(2*22*r)/float(7)<<endl;


	



	
	




}

Measured memory_bytes: 3804
#include<iostream>
#include<string>

using namespace std;

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

	string str;
	for(int i = n; i <= 999; i++) {
		str = to_string(i);
		if (str[0] == str[1] && str[1] == str[2]) {
			break;
		}
	}

	cout << str << endl;

	return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

    ll n;
    cin>>n;
    vector<string>v(n);
    map<string,bool>m;
    bool ok=1;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        v[i]=s;
        if(!m[s])
        {
            m[s]=1;
        }
        else
        {
            ok=0;

        }
        if(!i)
        {
            continue;
        }
        else
        {
            if(*v[i-1].rbegin()!=*v[i].begin())
            {
                ok=0;
            }
        }
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
string s;
llong dp1[256];
llong dp2[256];
llong dp3[256];

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

    for (int idx = 0; idx < n; idx++) {
        llong sum = 0;
        for (int i = '0'; i <= '9'; i++) {
            sum += dp2[i];
        }
        dp3[s[idx]] = max(dp3[s[idx]], sum);

        sum = 0;
        for (int i = '0'; i <= '9'; i++) {
            sum += dp1[i];
        }
        dp2[s[idx]] = max(dp2[s[idx]], sum);

        dp1[s[idx]] = 1;

    }

    llong ans = 0;
    for (int i = '0'; i <= '9'; i++) {
        ans += dp3[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        
        int n = scan.nextInt();
        double[] x = new double[n];
        String[] u = new String[n];
        for (int i = 0; i < n; i++)
        {
            x[i] = scan.nextDouble();
            u[i] = scan.next();
        }
        double ans = 0;
        for(int i = 0; i < n; i++)
        {
            if(u[i].equals("BTC"))
            {
                ans += x[i] * 380000;
            }
            else
            {
                ans += x[i];
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...) \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 3000009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 1e9 + 7;
class {
   public:
    int r1, r2, c1, c2, n, m;
    i64 fac[maxn], invfac[maxn];
    i64 pw(i64 a, i64 b) {
        i64 c = 1;
        while (b) {
            if (b & 1)
                c = c * a % MOD;
            a = a * a % MOD;
            b >>= 1;
        }
        return c;
    }
    void init() {
        for (int i = 0; i < 6; ++i) {
            for (int j = 0; j < 6; ++j) {
                cout << C(i + j, i) << ' ';
            }
            cout << endl;
        }
    }
    void solve() {
        cin >> r1 >> c1 >> r2 >> c2;
        fac[0] = 1;
        for (int i = 1; i < maxn; ++i) fac[i] = fac[i - 1] * i % MOD;
        invfac[maxn - 1] = pw(fac[maxn - 1], MOD - 2);
        for (int i = maxn - 2; i >= 0; --i) invfac[i] = invfac[i + 1] * (i + 1) % MOD;
        // init();
        G0[0] = 1;
        for (int i = 1; i < maxn; ++i) G0[i] = (G0[i - 1] + 1) % MOD;
        cout << ((G(r2, c2) + G(r1 - 1, c1 - 1) - G(r1 - 1, c2) - G(r2, c1 - 1)) % MOD + MOD) % MOD << '\n';
    }
    i64 G0[maxn];
    i64 G(i64 a, i64 b) {
        i64 res = G0[b];
        for (int i = 1; i <= a; ++i) {
            res = (res + C(i + 1 + b, b)) % MOD;
        }
        return res;
    }
    i64 C(i64 a, i64 b) {
        return fac[a] * invfac[b] % MOD * invfac[a - b] % MOD;
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define inf 1000000007
int dp[100001], height[100001];
int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)scanf("%d", &height[i]);
    for(int i = 0; i < n; i++)dp[i] = inf;
    dp[0] = 0;
    for(int i = 1; i < n; i++)
    {
        dp[i] = min(dp[i], abs(height[i]-height[i-1])+dp[i-1]);
        if(i > 1)dp[i] = min(dp[i], abs(height[i]-height[i-2])+dp[i-2]);
    }
    printf("%d", dp[n-1]);
    //printf("\nTime: %lf", ((double)(clock() - z) / CLOCKS_PER_SEC)*1e-6);
    return 0;
}


Measured memory_bytes: 1024
# Reference: https://note.nkmk.me/python-union-find/
class UnionFind:
    # if x is root: self.parents[x] = -(the number of the group nodes)
    # else: self.parents[x] = the parent of x
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # return the parent of x
    def find(self, x):
        history = []
        while self.parents[x] >= 0:
            history.append(x)
            x = self.parents[x]
        for node in history:
            self.parents[node] = x
        return x

    # merge the group of x and the group of y
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    # return the size of the group of x
    def size(self, x):
        return -self.parents[self.find(x)]

    # return whether x and y in a same group
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # return [all nodes which is in the group of x]
    # O(n)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    # return [all roots]
    # O(n)
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    # return the number of groups
    # O(n)
    def group_count(self):
        return len(self.roots())

from sys import stdin
input = stdin.buffer.readline

def main():
    n, m = map(int, input().split())

    uf = UnionFind(n)

    for _ in range(m):
        a, b = map(int, input().split())
        uf.union(a-1, b-1)

    print(uf.group_count() - 1)

main()

Measured memory_bytes: 70728
#include<bits/stdc++.h>
using namespace std;
int a[1001],ans;
int main()
{
	int n,k;
	cin >> n >> k;
	for (int i=1;i<=n;i++) cin >> a[i];
	sort(a+1,a+n+1);
	for (int i=1;i<=k;i++) ans+=a[i];
	cout << ans; 
	return 0;
}

Measured memory_bytes: 3580
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdlib> 
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	int sum = a  + b;
	if (sum >= c) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

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

int n;
long long f[1000005]; // v2(i!)
long long c[1000005]; // need to get parity of (n-1)C(i)

void prec(){
	f[0]=0;f[1]=0;
	for(int i=2;i<1000005;i++){
		f[i]=f[i-1]+__builtin_ctz(i);
	}
	for(int i=0;i<n;i++){
		c[i]=f[n-1]-f[i]-f[n-i-1];
		if(c[i]==0)c[i]=1;
		else c[i]=0;
	}
}

int main(){
	scanf("%d",&n);
	char arr[n+5];
	scanf("%s",arr);
	for(int i=0;i<n;i++)arr[i]--;
	prec();
	/*for(int i=0;i<n;i++)printf("%lld ",f[i]);
	printf("\n");
	for(int i=0;i<n;i++)printf("%lld ",c[i]);
	printf("\n");*/
	long long p=0;
	for(int i=0;i<n;i++){
		p+=(long long)(arr[i]-'0')*c[i];
		p%=2;
	}
	if(p%2==1){printf("1");return 0;}
	for(int i=0;i<n;i++){
		if(arr[i]=='1'){printf("0");return 0;}
	}
	for(int i=0;i<n;i++){
		if(arr[i]=='2')arr[i]--;
	}
	p=0;
	for(int i=0;i<n;i++){
		p+=(long long)(arr[i]-'0')*c[i];
		p%=2;
	}
	if(p%2==1){printf("2");return 0;}
	printf("0");
}


Measured memory_bytes: 16896
#include<stdio.h>
int main()
{
    double a,b,c,d,e,f;
    double x,y;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
    y=((c*d)-(f*a))/((b*d)-(e*a));
    x=(c-(b*y))/a;
        printf("%.3lf %.3lf\n",x,y);}
    return 0;
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

struct UnionFind {
    vector<int> parent;
    vector<int> rank;
    vector<ll> size;

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        parent.resize(n);
        rank.resize(n);
        size.resize(n);
        rep(i, n) {
            parent[i] = i;
            size[i] = 1;
        }
    }

    int root(int x) {
        if (parent[x] == x) return x;
        parent[x] = root(parent[x]);
        return parent[x];
    }

    bool isSame(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        if (isSame(x, y)) return;
        x = root(x); y = root(y);
        if (rank[x] > rank[y]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;
        parent[y] = x;
        size[x] += size[y];
    }

    ll get_size(int x) {
        if (root(x) == x) return size[x];
        size[x] = get_size(root(x));
        return size[x];
    }
};

int main() {
    ll N, M; cin >> N >> M;
    vector<ll> A(M), B(M);
    for (ll i = M-1; i >= 0; i--) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }
    vector<ll> ans(M);
    ans[M-1] = N*(N-1)/2;
    UnionFind UF = UnionFind(N);
    rep(i, M-1) {
        if (UF.isSame(A[i], B[i])) {
            ans[M-i-2] = ans[M-i-1];
            continue;
        }
        ans[M-i-2] = ans[M-i-1] - UF.get_size(A[i])*UF.get_size(B[i]);
        UF.unite(A[i], B[i]);
    }
    rep(i, M) cout << ans[i] << endl;
}


Measured memory_bytes: 7264
module AtCoder

	export readline

	function readline(T)
  		return Base.parse(T, Base.readline(Base.stdin))
	end

end


module ABC162

	import Main.AtCoder
	export task_a

	function task_a(target_integer::Core.UInt16)

  		given_integer = AtCoder.readline(Core.UInt16)
  		data_digits   = Base.digits(given_integer)
  
  		for itr = 1:1:Base.size(data_digits, 1)
    		if (data_digits[itr] == target_integer)
      			return "Yes"
    		end
  		end

  		return "No"

	end

end

Base.println(ABC162.task_a(Base.convert(Core.UInt16, 7)))

Measured memory_bytes: 182412
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=20;

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

      int a,b;
      cin>>a>>b;
      a-=2*b;
      a=max(a,0LL);
      cout<<a<<" ";      
}
// I never lose. I either win or I learn

Measured memory_bytes: 256
fun main(args: Array<String>) = IO().exec {
    val n = int()
    val a = LongArray(n){long()}
    val cnt = mutableMapOf<Long, Int>()
    for (i in 0 until n step 2) cnt[a[i]] = 1
    a.sort()
    val cnt2 = mutableMapOf<Long, Int>()
    for (i in 0 until n step 2) cnt2[a[i]] = 1
    var ret = 0
    for ((k, v) in cnt) ret += v - (cnt2[k] ?: 0)
    println(ret)
}

// region template
operator fun Int.iterator() = 0.until(this).iterator()

class IO {
    val printable = 33..126
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    val out = java.io.PrintWriter(System.out)
    fun hasNextByte(): Boolean = if (ptr < buflen) true else {
        ptr = 0
        buflen = System.`in`.read(buffer)
        buflen > 0
    }

    fun readByte(): Byte = if (hasNextByte()) buffer[ptr++] else -1
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }

    fun string(): String {
        if (!hasNext()) throw java.util.NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun long(): Long {
        if (!hasNext()) throw java.util.NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun int(): Int {
        val nl = long()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }

    fun double(): Double = string().toDouble()
    fun print(obj: Any) = out.print(obj)
    fun print(i: Int) = out.print(i)
    fun print(l: Long) = out.print(l)
    fun println(obj: Any) = out.println(obj)
    fun println(i: Int) = out.println(i)
    fun println(l: Long) = out.println(l)
    inline fun exec(block: IO.() -> Unit) {
        block()
        out.flush()
    }
}
// endregion

Measured memory_bytes: 41844
#include <stdio.h>
int main()
{
  int A, B;
  scanf("%d ", &A);
  scanf("%d", &B);

  if (A <= 9)
    if (B <= 9)
      printf("%d\n", A * B);
    else
      printf("-1\n");
  else
    printf("-1\n");

  return 0;
}


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

struct Dice
{
	Dice(int d[6]){
		for(int i = 0; i < 6; ++i)
			n[i] = d[i];
	}
	void toN(){ shift( n[0], n[1], n[5], n[4] ); }
	void toS(){ shift( n[0], n[4], n[5], n[1] ); }
	void toW(){ shift( n[0], n[2], n[5], n[3] ); }
	void toE(){ shift( n[0], n[3], n[5], n[2] ); }
	void shift( int& a, int& b, int& c, int& d ){
		int t = a;
		a = b;
		b = c;
		c = d;
		d = t;
	}
	void twist(){
		int a = n[1];
		n[1] = n[2];
		n[2] = n[4];
		n[4] = n[3];
		n[3] = a;
	}
	bool isSameNumber( const Dice& d ){
		for(int i = 0; i < 6; ++i){
			if(n[i] != d.n[i])
				return false;
		}
		return true;
	}
	bool isTwistSame( const Dice& d ){
		if( n[0] != d.n[0] || n[5] != d.n[5] )
			return false;

		for(int j = 0; j < 4; ++j){
			twist();
			if( this->isSameNumber( d ))
				return true;
		}
		return false;
	}
	bool isSame( const Dice& d ){
		if( this->isTwistSame(d) ) return true;
		this->toN();
		if( this->isTwistSame(d) ) return true;
		this->toN();
		if( this->isTwistSame(d) ) return true;
		this->toN();
		if( this->isTwistSame(d) ) return true;
		this->toE();
		if( this->isTwistSame(d) ) return true;
		this->toN();
		this->toN();
		if( this->isTwistSame(d) ) return true;

		return false;
	}
	
	int n[6];
};

int main()
{
	int n, i, t, f, 
		d1[6] = {},
		d2[6] = {};
	for(i = 0; i < 6; ++i) cin >> d1[i];
	for(i = 0; i < 6; ++i) cin >> d2[i];

	Dice dice1(d1);
	Dice dice2(d2);
	
	cout << (dice1.isSame( dice2 ) ? "Yes" : "No") << "\n";

	return 0;
}

Measured memory_bytes: 1128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    long long n,m; cin>>n>>m;
    pair<long long,long long> p[n];
    rep(i,n){
        long long a,b; cin>>a>>b;
        p[i]={a,b};
    }
    sort(p,p+n);
    long long ans=0;
    rep(i,n){
        if(m>=p[i].second){
            ans+=p[i].first*p[i].second;
            m-=p[i].second;
        }else{
            ans+=p[i].first*m;
            m=0;
        }
        if(m<=0){
            cout<<ans<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 1792
n = int(input())
sum_abs_a = 0
min_abs_a = 10 ** 9
minus_odd = False
for a in map(int, input().split()):
  if a < 0:
    minus_odd = not minus_odd
    a = -a
  sum_abs_a += a
  min_abs_a = min(min_abs_a, a)
if minus_odd:
  print(sum_abs_a - 2 * min_abs_a)
else:
  print(sum_abs_a)

Measured memory_bytes: 11516
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <bitset>
#include <iterator>
#include <valarray>
#include <complex>
#include <utility>
#include <string>
#include <sstream>
#include <tuple>
#include <initializer_list>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef tuple<int, int> tii;
template<typename T> ostream &operator<<(ostream &os, set<T> const &s) { if (s.size() == 0) return os << "{}"; os << "{"; decltype(s.begin()) iter; for (iter = s.begin(), ++iter; iter != s.end(); ++iter) { --iter; os << *iter << ", "; ++iter; } --iter; os << *iter << '}'; return os; }
template<typename T> ostream &operator<<(ostream &os, multiset<T> const &s) { if (s.size() == 0) return os << "{}"; os << "{"; decltype(s.begin()) iter; for (iter = s.begin(), ++iter; iter != s.end(); ++iter) { --iter; os << *iter << ", "; ++iter; } --iter; os << *iter << '}'; return os; }
template<typename T, typename U> ostream &operator<<(ostream &os, map<T, U> const &mp) { if (mp.size() == 0) return os << "{}"; os << "{" << endl; decltype(mp.begin()) iter; for (iter = mp.begin(), ++iter; iter != mp.end(); ++iter) { --iter; os << "  {" << iter->first << ", " << iter->second << "}," << endl; ++iter; } --iter; os << "  {" << iter->first << ", " << iter->second << "}" << endl << '}'; return os; }
template<typename T> ostream &operator<<(ostream &os, vector<T> const &v) { os << '['; rep(i, v.size()-1) os << v[i] << ", "; if (v.size() > 0) os << v[v.size()-1]; cerr << ']'; return os; }
template<typename T, unsigned N, unsigned Last> struct TuplePrinter { static void print(ostream &os, T const& v) { os << std::get<N>(v) << ", "; TuplePrinter<T, N + 1, Last>::print(os, v); } };
template<typename T, unsigned N> struct TuplePrinter<T, N, N> { static void print(ostream &os, T const &v) { os << std::get<N>(v); } };
template<typename... Types> ostream& operator<<(ostream &os, tuple<Types...> const &v) { os << "("; TuplePrinter<tuple<Types...>, 0, sizeof...(Types) - 1>::print(os, v); os << ")"; return os; }
template<typename T> void _dbg(T const &t) { cerr << t << endl; }
template<typename T, typename... Args> void _dbg(T const &t, Args... args) { cerr << t << " "; _dbg(args...); }
template<typename... Args> void __dbg(const char *fn, int l, Args... args) { cerr << "[" << fn << ":" << l << "] "; _dbg(args...); }
#define dbg(...) __dbg(__func__, __LINE__, __VA_ARGS__)

const ll infty = 1223372036854775807;
const double eps = 1e-8;



int main(int argc, char *argv[]) {
  // cin.tie(0); cout.sync_with_stdio(false);
  int A, P;
  cin >> A >> P;
  cout << (3 * A + P) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// 998244353;// ;
constexpr long long INF = numeric_limits<LL>::max() / 2;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<LL>>g;
vector<edge>edges;
vector<LL>v;
map<LL, LL>ma;
set<Pll>st;
LL h, w, n, m, k, t, s, p, q, last, cnt, sum, ans, dp[210000],a[210000], b[210000];
string str, ss;
bool f;
char c;
vector<LL> tsort(vector<vector<LL>>&g) {
	LL n = g.size();
	vector<LL>ret;
	vector<bool>used(n);
	function<void(LL)>dfs = [&](LL cur) {
		used[cur] = 1;
		rep(i, g[cur].size()) {
			if(!used[g[cur][i]])
			dfs(g[cur][i]);
		}
		ret.push_back(cur);
	};
	rep(i, n) {
		if (!used[i])dfs(i);
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
int main() {
	cin >> n>>m;
	g.resize(n);
	rep(i, m) {
		LL x, y;
		cin >> x >> y;
		g[x].push_back(y);
	}
	vector<LL>ts = tsort(g);
	rep(i, n) {
		cout << ts[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int a, b;
    cin >> a >> b;

    int ans = b * 10;

    bool ansb = false;
    rep(i, 10){
        int res = ans + i;
        if (res*2/25 == a){
            ansb = true;
            ans = res;
            break;
        }
    }

    if(ansb) cout << ans << endl;
    else cout << "-1" << endl;
}



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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#ifdef MPS
#define D(x...) printf(x)
#else
#define D(x...)
#endif
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}

int a[4];

int main()
{
	#ifdef MPS
		fp("1.in","r",stdin);
		fp("1.out","w",stdout);
		double mps = clock();
	#endif
		fo(i,0,3) cin >> a[i];
		sort(a,a+4);
		if(a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) puts("YES");
		else puts("NO");
	D("excution time : %.5f\n",clock()-mps);
	return 0;
}

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


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))

    result = 0
    for i in range(n):
        meal = a[i] - 1
        result += b[meal]

        if i == n - 1:
            break
        if a[i+1] - a[i] == 1:
            result += c[meal]

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn, dt;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int H = getint(), W = getint(), D = getint();
	pair<int, int> A[90001];
	A[0] = mp(0, 0);
	rep(i, H) rep(j, W) {
		A[getint()] = mp(i, j);
	}
	vector<int> V[90000];
	rep(i, D) {
		int j = i;
		auto a = mp(0, 0);
		int mae = 0;
		while (j <= H * W) {
			V[i].pb((mae += (abs(A[j].first - a.first) + abs(A[j].second - a.second))));
			a = A[j];
			j += D;
		}
	}
	int Q = getint();
	rep(i, Q) {
		int l = getint(), r = getint();
		int k = l % D;
		putint(V[k][r / D] - V[k][l / D]);
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> count(n);
  int a,b;
  rep(i,m){
    cin >> a >> b;
    count.at(a-1)++;
    count.at(b-1)++;
  }
  rep(i,n){
    cout << count.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c,d,i,n,e;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a,&b,&c);
    if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==a*a+b*b){
      printf("YES\n");
    }
    else{
      printf("NO\n");
    }
  }
  return 0;
}

Measured memory_bytes: 0