akhauriyash/Code-Regression huggingface dataset:
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

t = 1
for i in range(1, N - 1):
  t *= i

ans = 0
for i in range(N - 1):
  for j in range(i + 1, N):
    x1, y1 = xy[i]
    x2, y2 = xy[j]
    ans += (((x1 - x2) ** 2 + (y1 - y2) ** 2) ** (1 / 2)) * (N - 1) * 2 * t

n = 1
for i in range(1, N + 1):
  n *= i

ans /= n

print(ans)


Measured memory_bytes: 3064
from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    elif n < r:
        return 0
    else:
        a = factorial(n) // factorial(r) // factorial(n - r)
    return int(a)

n, k = map(int, input().split())

for i in range(k):
    pick_count = i + 1

    blue_pattern =  count_pattern(k - 1, pick_count - 1)
    red_pattern = count_pattern(n - k + 1 , pick_count)
    total_pattern = blue_pattern * red_pattern
    print (int(total_pattern % (10 ** 9 + 7)))


Measured memory_bytes: 3316
N, Q = map(int, input().split())
S = input()

count = 0
cum_sum = []
for i in range(N):
    if i > 0 and S[i - 1] == 'A' and S[i] == 'C':
        count += 1
    cum_sum.append(count)

for _ in range(Q):
    l, r = map(int, input().split())
    print(cum_sum[r - 1] - cum_sum[l - 1])

Measured memory_bytes: 6104
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char x = s.charAt(0);
        boolean ans = false;
        for (char c : s.toCharArray()) {
            if (x != c) {
                ans = true;
            }
        }
        System.out.println(ans ? "Yes" : "No");
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


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

int main(){
    double d;
    vector<double> v;
    while(cin >> d) v.push_back(d);
    sort(v.begin(), v.end());
    printf("%.9f\n", v.back() - v.front());
}

Measured memory_bytes: 1260
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n; readV(n);
  int[] t, a; readC(n, t, a);

  auto ta = new long[](n), aa = new long[](n);
  ta[0] = t[0]; aa[0] = a[0];

  foreach (i; 1..n) {
    auto k = max((ta[i-1]+t[i]-1)/t[i], (aa[i-1]+a[i]-1)/a[i]);
    ta[i] = k*t[i]; aa[i] = k*a[i];
  }

  writeln(ta[$-1]+aa[$-1]);
}


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

int main(){
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    int bad = 1;
    for(int i = 0; i < N; i++){
        bad *= (A[i] + 1) % 2 + 1;
    }
    cout << pow(3, N) - bad << endl;
}

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

void solve()
{
	ll a;
	double b;
	cin>>a>>b;
	// cout<<(ll)floor(10*b)<<endl;
	ll ans = (a*(ll)round(b*100))/100;;
	// ans += (a*(ll)floor(10*b - 10*floor(b)))/10;
	// ans += (a*(ll)floor(100*b- 10*floor(10*b)))/100;
	cout<<ans<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define ll long long
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pll pair<ll,ll>
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
using namespace std;


int main()
{
    FAST
    ll n;cin>>n;
    ll a[n];f(i,0,n) cin>>a[i];
    sort(a,a+n);
    ll ans=a[n-1];
    ll tot=2;
    ll i=n-2;
    while(tot<n)
    {
        // cout<<tot<<" ";
        if(tot+2<=n) 
        {
            ans+=2*a[i];
            tot+=2;
        }
        else ans+=a[i],tot++;
        i--;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5176
import re

s = input()


def isAlpha(value):
    """
    半角英字チェック
    :param value: チェック対象の文字列
    :rtype: チェック対象文字列が、全て半角英字の場合 True
    """
    return re.fullmatch(r"^A([a-z]+)C([a-z]+)", value) is not None


if isAlpha(s):
    print('AC')
else:
    print('WA')


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

#define         pb         push_back
#define         sf(x)      scanf("%d",&x)
#define         sfl(x)     scanf("%lld",&x)
#define         pf(x)      printf("%d\n",x)
#define         pfl(x)     printf("%lld\n",x)
#define         endl       '\n'
#define         pii        pair<int,int>
#define         mapii      map<int,int>
#define         mapll      map<ll,ll>
#define         mapci      map<char,int>
#define         mapcl      map<char,ll>
#define         mapsi      map<string,int>
#define         mapsl      map<string,ll>
#define         pll        pair<ll,ll>
#define         vi         vector<int>
#define         vl         vector<ll>
#define         vd         vector<double,double>
#define         all(c)     c.begin(),c.end()
#define         F          first
#define         S          second
#define         mp         make_pair
#define        ftc(x)      cerr << #x << ": " << x << " " << endl;
#define         PI         acos(-1)
#define         lcm(a,b)   ((a*b)/__gcd(a,b))
#define        optimize  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define        sqr(a)       ((a)*(a))
//int dx[] = {0,1,0,-1};
//int dx[] = {0,1,0,-1};
//int dy[] = {-1,0,1,0};

//   cout<<std::setprecision(12)<<

int main()
{
    ll i,j,k,l,m,n,co=0,baki,p;

    cin >> n >> m;

    vector<pll>v;

    for(i=0;i<n;i++)
    {
        cin >> k >> l;
        v.pb({k,l});
    }

    sort(all(v));
    baki = m;
    for(i=0;i<n;i++)
    {
        if(baki == 0)break;

        p =  min(baki,v[i].S);
        co += (p*v[i].F);
        baki -= p;
    }

    cout << co << endl;
}


Measured memory_bytes: 2420
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, K; cin >> N >> K;
	VI A(N);
	REP(i, N)cin >> A[i];
	FOR(i, K, N) {
		if (A[i - K] >= A[i]) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 4784
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        string[] input = ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);
        int[] p = new int[M];
        string[] s = new string[M];
        bool[] isACCount = new bool[N];
        bool[] isPenaCount = new bool[N];
        int[] numWA = new int[N];
        for (int i = 0; i < M; i++)
        {
            string[] a = ReadLine().Split(' ');
            p[i] = int.Parse(a[0]);
            s[i] = a[1];
            
        }
        for(int i = 0; i < N; i++)
        {
            isACCount[i] = true;
            isPenaCount[i] = false;
            numWA[i] = 0;
        }
        int ans1 = 0;
        int ans2 = 0;
        for(int i = 0; i < M; i++)
        {
            if (isACCount[p[i] - 1])
            {
                if(s[i] == "AC")
                {
                    isACCount[p[i] - 1] = false;
                    ans1++;
                    isPenaCount[p[i] - 1] = true;
                }
                else
                {
                    numWA[p[i] - 1]++;
                }
            }
        }

        for(int i = 0; i < N; i++)
        {
            if (isPenaCount[i])
            {
                ans2 += numWA[i];
            }
        }
        WriteLine(ans1 + " " + ans2);
    }
}

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

template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  T unit;
  Fn func;

public:
  SegmentTree() {}
  SegmentTree(int n_, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }
  SegmentTree(vector<T> v, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    int sz = v.size();
    while (N < sz)
      N *= 2;
    dat.resize(2 * N - 1);
    for (int i = 0; i < N; ++i)
      dat[i + N - 1] = (i < sz ? v[i] : unit);
    for (int i = N - 2; i >= 0; --i)
      dat[i] = func(dat[i * 2 + 1], dat[i * 2 + 2]);
  }

  // k 番目の要素を a に変更
  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  // k 番目の要素を取得
  T get(int k) { return dat[k + N - 1]; }

  // 区間 [l, r) の和を取得
  T query(int l, int r)
  {
    T vl = unit, vr = unit;
    for (l += (N - 1), r += (N - 1); l < r; l >>= 1, r >>= 1)
    {
      if ((l & 1) == 0)
        vl = func(vl, dat[l]);
      if ((r & 1) == 0)
        vr = func(vr, dat[--r]);
    }
    return func(vl, vr);
  }
};

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  auto f = [](int a, int b) { return __gcd(a, b); };
  SegmentTree<int> sg(a, f, 0);

  int Max = 0;
  for (int i = 0; i < n; i++)
  {
    int g = f(sg.query(0, i), sg.query(i + 1, n));
    Max = max(Max, g);
  }
  cout << Max << "\n";
  return 0;
}

Measured memory_bytes: 2048
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let s: String = sc.cin();
    if n >= 3200 {
        put!(s);
         } else {
             put!("red");
         }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define Rep(i,x) for(int i=head[x];i+1;i=nxt[i])
#define rep2(i,a,b) for(int i=(a);i<(b);i++)
#define ff first
#define ss second
using namespace std;
const int N=200005;
typedef long long ll;
//------------------------------------------head---------------------------------------------------//
int f[8105][4105];
ll fac[8005],inv[8005];
const int M=1e9+7;
pair<int,int>po[N];
inline int Add(int &x,int y){x+=y;x%=M;}
inline int C(int x,int y)
{
	return 1ll*fac[x]*inv[y]%M*inv[x-y]%M;
}
inline ll pw(ll x,ll y)
{
	ll res=1;
	while(y)
	{
		if(y&1)res=res*x%M;
		x=x*x%M;y>>=1;
	}return res;
}
int main()
{
	int n;scanf("%d",&n);int Z=2005;
	fac[0]=inv[0]=1;rep(i,1,8000)fac[i]=1ll*fac[i-1]*i%M,inv[i]=pw(fac[i],M-2);
	rep(i,1,n)
	{
		int x,y;scanf("%d%d",&x,&y);
		f[Z*2-x-y][Z-y]++;po[i]=make_pair(x,y);
		//printf("Case 0:%d %d\n",-x-y+Z*2,Z-y);
	}
	rep(i,1,8015)rep(j,1,4015)Add(f[i][j],f[i-1][j]+f[i-1][j-1]%M)%M;
	int X=0;
	rep(i,1,n)
	{
		int x=po[i].ff,y=po[i].ss;
		X+=f[x+y+Z*2][Z+y];X%=M;
		X-=C(x*2+y*2,x*2);X%=M;
	}
	X+=M;X%=M;X=1ll*X*pw(2,M-2)%M;
	printf("%d\n",X);
	return 0;
}

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

int main() {
	int a,b;
	string s1,s2;
	cin >> s1 >> s2;
	cin >> a >> b;
	string s;
	cin >> s;
	if(s==s1){
	    cout << a-1 <<" " <<  b << endl;
	}
	else{
	    cout << a << " " << b-1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N;
vector<int>G[100005];
int dist[100005];
void dfs1(int x,int p){
	for(int i:G[x])if(i!=p){
		dist[i]=dist[x]+1;
		dfs1(i,x);
	}
}
int dfs2(int x,int p){
	vector<int>v;
	for(int i:G[x])if(i!=p)v.pb(dfs2(i,x));
	sort(all(v),greater<>());
	int res=0;
	rep(i,len(v)){
		if(i<len(v)-1)res+=max(1ll,v[i]);
		else res+=v[i];
	}
	return res;
}
signed main(){
	cin>>N;
	rep(i,N-1){
		int a,b;cin>>a>>b;
		G[a].pb(b);G[b].pb(a);
	}
	dfs1(0,0);
	int par,mx=0;
	rep(i,N)if(chmax(mx,dist[i]))par=i;
	cout<<dfs2(par,par)+1<<endl;
}


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

long dx[] = {1, 0, -1, 0};
long dy[] = {0, 1, 0, -1};
using pll = pair<long, long>;
constexpr long MOD = 1000000007;

int main() {
	double d, t, s; cin >> d >> t >> s;
	if (d / t <= s) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3084
#include <iostream>
using namespace std;
#define REP(i, n) for(int i=0; i<(n); i++)

int main() {
	int n, m, k;
	bool flag = false;
	cin >> n >> m >> k;
	REP(i, n + 1)REP(j, m + 1) {
		if (i*(m - j) + (n - i)*j == k)flag = true;
	}
	puts(flag ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    map<string, int> mp;
    
    rep(i, n) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    ll ans = 0;
    for(auto& p : mp) {
        int t = p.second;
        ans += (ll)t*(t-1)/2LL;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 100000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back

bool is_prime(int x){
  if(x<2) return false;
  for(int i=2;i*i<=x;i++){
    if(x%i==0) return false;
  }
  return true;
}

int main(){
  vector<int> v(110000);
  rep(i,110000){
    if(is_prime(i)&&is_prime((i+1)/2))
      v[i]++;
  }
  FOR(i,1,110000){
    v[i]+=v[i-1];
  }

  int q;
  cin>>q;
  rep(i,q){
    int l,r;
    cin>>l>>r;
    cout<<v[r]-v[l-1]<<endl;
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
multiset<int,greater<int> > s,s2;
int main()
{
	int p;
	scanf("%d",&p);
	int n=(1<<p);
	for (int i=0;i<n;i++)
	{
		int a;
		scanf("%d",&a);
		s.insert(a);
	}
	s2.insert(*s.begin());
	s.erase(s.begin());
	for (int i=0;i<p;i++)
	{
		vector<int> in;
		for (int j:s2)
		{
			auto it=s.upper_bound(j);
			if (it==s.end())
			{
				printf("No");
				return 0;
			}
			in.push_back(*it);
			s.erase(it);
		}
		for (int j:in)
		s2.insert(j);
	}
	printf("Yes");
}

Measured memory_bytes: 13304
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll A, B, K;

void solve() {
    cin >> A >> B >> K;

    if (A <= K) {
        K -= A;
        A = 0;
    } else {
        A -= K;
        K = 0;
    }
    if (0 == A) {
        B -= K;
    }
    printf("%ld %ld\n", (A < 0 ? 0 : A), (B < 0 ? 0 : B));
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
S = int(input())

max_itr = S//3

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2000
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


res = 0
for _k in range(max_itr):
    k = _k + 1
    a = cmb(S-2*k-1,k-1,mod)
    res += a

print(res%mod)

Measured memory_bytes: 65480
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

ll gcd(ll a, ll b)
{
  ll m = std::min(a, b);
  ll M = std::max(a, b);

  if (m == 0)
  {
    return M;
  }
  else
  {
    return gcd(m, M % m);
  }
}

int main()
{
  int n;
  ll t;
  ll res = 1;

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> t;
    ll g = gcd(res, t);
    res = res / g * t;
  }

  cout << res << endl;
}

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

int calc(int x) {
    int res = 0;
    while(x % 100 == 0) {
        x /= 100;
        ++res;
    }
    return res;
}

int main(void)
{
    using namespace std;
    
    int d, n;
    cin >> d >> n;
    int cnt = 0, val = 0;
    while(cnt < n) {
        ++val;
        if(calc(val) == d)
            ++cnt;
    }

    cout << val << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#define R register
#define IN inline
#define W while
#define gc getchar()
#define MX 100050
#define ll long long
template <class T>
IN void in(T &x)
{
	x = 0; R char c = gc;
	W (!isdigit(c)) c = gc;
	W (isdigit(c))
	x = (x << 1) + (x << 3) + c - 48, c = gc;
}
int main(void)
{
	int num, buf, mul; in(num);
	bool merge = false; ll ans = 0, cut = 0;
	W (num--)
	{
		in(buf); mul = std::log2(buf); merge = false;
		if((1 << mul) != buf) merge = true;
		if(cut < mul) ans += mul - cut;
		if(cut > mul) merge = false;
		cut = mul; if(merge) ++cut, ++ans;
	}
	printf("%lld", ans);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int a, b;
    cin >> a >> b;
    if (a == 1)
        a += 100;
    if (b == 1)
        b += 100;
    if (a > b)
        cout << "Alice" << "\n";
    else if (a < b)
        cout << "Bob" << "\n";
    else
        cout << "Draw" << "\n";
    return 0;
}

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

int main() {
	int H, W;
	bool check = true;
	string S[50];
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '#') {
				if ((i == 0 || S[i - 1][j] != '#') && (j == 0 || S[i][j - 1] != '#') && (j == W - 1 || S[i][j + 1] != '#') && (i == H - 1 || S[i + 1][j] != '#')) {
					check = false;
				}
			}
		}
	}
	if (check) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, A, B, C): (usize, i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let l: Vec<i64> = (0..N)
        .map(|_| {
                let mut line: String = String::new();
                std::io::stdin().read_line(&mut line).unwrap();
                line.trim().parse().unwrap()
        })
        .collect();
    static INF: i64 = 1_000_000_000_000;

    fn f(i: usize, a: i64, b: i64, c: i64, p: i64, q: i64, r: i64,
            N: usize, A: i64, B: i64, C: i64, l: &Vec<i64>) -> i64 {
        if i == N && p >= 1 && q >= 1 && r >= 1 {
            (A - a).abs() + (B - b).abs() + (C - c).abs() + 10 * (p - 1) + 10 * (q - 1) + 10 * (r - 1)
        } else if i == N && ((p == 0) || (q == 0) || (r == 0)) { INF }
        else {
            *vec![
                f(i + 1, a + l[i], b, c, p + 1, q, r, N, A, B, C, l),
                f(i + 1, a, b + l[i], c, p, q + 1, r, N, A, B, C, l),
                f(i + 1, a, b, c + l[i], p, q, r + 1, N, A, B, C, l),
                f(i + 1, a, b, c, p, q, r, N, A, B, C, l)
            ].iter().min().unwrap()
        }
    }
    let ans = f(0, 0, 0, 0, 0, 0, 0, N, A, B, C, &l);

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

Measured memory_bytes: 4352
#!/usr/bin/env python3
h, w = map(int, input().split())
b = ".";j = [b+b*w+b]
s = j + [b+input()+b for _ in [0]*h] + j
for i in range(1, h+1):
    d = [n+1 for n in range(w) if s[i][n:n+3] == ".#."]
    if d and any([s[i-1][c] == s[i+1][c] == b for c in d]):
        print("No");exit()
print("Yes")

Measured memory_bytes: 3064
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    ABCDE = [int(input()) for _ in range(5)]
    X = [-(-x // 10) * 10 for x in ABCDE]
    print(sum(X) - max([x - a for a, x in zip(ABCDE, X)]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define MAXN	500005
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
char s[MAXN];
int n, a[MAXN];
int func(int x) {
	int ans = 0;
	while (x) {
		ans += x % 10;
		x /= 10;
	}
	return ans;
}
bool check(int value) {
	int ans = 0, now = value * 9;
	for (int i = n; i >= 1; i--) {
		now += a[i] * 9;
		ans += now % 10;
		now /= 10;
	}
	return ans + func(now) <= value * 9;
}
int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for (int i = n; i >= 1; i--)
		a[i] = s[i] - '0';
	int l = 1, r = n;
	while (l < r) {
		int mid = (l + r) / 2;
		if (check(mid)) r = mid;
		else l = mid + 1;
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 2816
from itertools import product
l = list(map(int, input()))
comb = product((0, 1), repeat=3)

def can_calc(l, comb):
    val = l[0]
    for i in range(3):
        if comb[i] == 0:
            val += l[i+1]
        else:
            val -= l[i+1]
    if val == 7:
        return True
    else:
        return False

for c in comb:
    if can_calc(l, c):
        break
l = ''.join(map(str, l))
c = ''.join(map(lambda x: '+' if x==0 else '-', c))
print(l[0]+c[0]+l[1]+c[1]+l[2]+c[2]+l[3]+'=7')

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

class DICE {
    int top, front, right, left, back, bottom;
public:
    void setValue (int *diceValue);
    void rotate (char order);
    int showValue (int direction);
};

void DICE::setValue (int *diceValue) {
    DICE::top    = diceValue[0];
    DICE::front  = diceValue[1];
    DICE::right  = diceValue[2];
    DICE::left   = diceValue[3];
    DICE::back   = diceValue[4];
    DICE::bottom = diceValue[5];
}

void DICE::rotate (char order) {
    int tmp;
    switch (order) {
        case 'E':
            tmp = DICE::right;
            DICE::right  = DICE::top;
            DICE::top    = DICE::left;
            DICE::left   = DICE::bottom;
            DICE::bottom = tmp;
            break;
        case 'N':
            tmp = DICE::back;
            DICE::back   = DICE::top;
            DICE::top    = DICE::front;
            DICE::front  = DICE::bottom;
            DICE::bottom = tmp;
            break;
        case 'S':
            tmp = DICE::front;
            DICE::front  = DICE::top;
            DICE::top    = DICE::back;
            DICE::back   = DICE::bottom;
            DICE::bottom = tmp;
            break;
        case 'W':
            tmp = DICE::left;
            DICE::left   = DICE::top;
            DICE::top    = DICE::right;
            DICE::right  = DICE::bottom;
            DICE::bottom = tmp;
            break;
        default:
            break;
    }
}

int DICE::showValue (int direction) {
    int value;
    switch (direction) {
        case 0:
            value = DICE::top;
            break;
        case 1:
            value = DICE::front;
            break;
        case 2:
            value = DICE::right;
            break;
        case 3:
            value = DICE::left;
            break;
        case 4:
            value = DICE::back;
            break;
        case 5:
            value = DICE::bottom;
            break;
        default:
            break;
    }
    return value;
}

int solve (int *diceValue, string order) {
    int result;
    DICE dice;
    dice.setValue (diceValue);
    for (int i=0; i<order.length(); i++) {
        dice.rotate (order[i]);
    }
    result = dice.showValue(0); // top
    return result;
}

int main () {
    // input
    int diceValue[6];
    for (int i=0; i<6; i++) {
        cin >> diceValue[i];
    }
    string order;
    cin >> order;

    // solve
    int result = solve(diceValue, order);

    // output
    cout << result << endl;
}


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

#define ll long long int

vector<pair<ll, ll>> g[100005];
vector<bool> whites(100005, false), vis(100005, false);

void dfs(int node, int par) {
    for (auto adj : g[node]) {
        if (adj.first != par) {
            if (adj.second % 2 == 0) {
                whites[adj.first] = whites[node];
            } else {
                whites[adj.first] = !whites[node];
            }
            dfs(adj.first, node);
        }
    }
}

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

    for (int i = 0; i < n - 1; i++) {
        ll a, b, w;
        cin >> a >> b >> w;
        g[a].push_back({b, w});
        g[b].push_back({a, w});
    }

    whites[1] = true;

    dfs(1, -1);

    for (int i = 1; i <= n; i++) {
        cout << whites[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 10240
#include<bits/stdc++.h>
using namespace std;
#define lld long long int
int main(){
    lld n,x;
    cin>>n;
    if(n&1){
        x=n/2;
        cout<<x*(x+1)<<endl;
    }
    else{
        x=n/2;
        cout<<x*x<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<string>
#include<set>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
typedef long long ll;

int main(){//A
/*
    int x;
    cin>>x;
    int c=int((x-600)/200)+1;
    if(x<600) c=0;
    cout<<8-c<<endl;
    */
   //B
   int a,b,c;
   cin>>a>>b>>c;
   int k,l;
   cin>>k;
   l=k;
   while(b<=a){
       if(l==0){
           if(c<=b){
               cout<<"No"<<endl;
               return 0;
           }
           else{
               cout<<"Yes"<<endl;
               return 0;
           }
       }
       else{
           b*=2;
           l--;
       }
   }
   while(c<=b){
       if(l==0){
           if(c<=b){
               cout<<"No"<<endl;
               return 0;
           }
           else{
               cout<<"Yes"<<endl;
               return 0;
           }
       }
       else{
           c*=2;
           l--;
       }
   }
   cout<<"Yes"<<endl;
   return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
int n,m;
typedef struct{
    int value;
    int key;
} mp;

bool operator<(const mp& left, const mp& right) {
        return left.value < right .value;
}

vector<mp> x;
int b[200001];
int main(void)
{
    cin >> n ;
    mp v = {-1,0};
    x.push_back(v);
    int a;
    for(int i=1;i<=n;i++){
        cin >> a;
        mp v = {a,i};
        x.push_back(v);
    }

    sort(x.begin()+1,x.end());
    for(int i = 1;i<=n;i++){
        b[x[i].key] = i;
    }

    int cen = n/2;
    for(int i=1;i<=n;i++){
        if(b[i] <= cen)
            cout << x[cen+1].value;
        else
            cout << x[cen].value;
        putchar('\n');
    }
    return 0;
}

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

int main(){

    int n, m;

    cin >> n >> m;

    vector<char> s(m);
    vector<char> c(m);
    string str(n, '0');

    rep(i,m) {
        cin >> s[i] >> c[i];
    }
    rep(i,m) {
        if (str[s[i]-'0'-1] == '0' || str[s[i]-'0'-1] == c[i]) {
            str[s[i]-'0'-1] = c[i];
        }
        else {
            cout << -1 << endl;
            return 0;

        }

        if (n > 1 && s[i] == '1' && c[i] == '0') {
            cout << -1 << endl;
            return 0;
        }

    }

    if (n > 1 && str[0] == '0') {
        str[0] = '1';
    }

    cout << str << endl;

    return 0;
} 


Measured memory_bytes: 3584
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

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

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, vector<vector<T>> &v)
{
	for (vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, vector<T> &v)
{
	for (T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i < b; i++)
#define per(i,b,a) for (int i = b; i > a; i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	int n;
	cin >> n;
	vi v(n);
	cin >> v;
	map<ll, ll> m;
	for(ll x : v)
		m[x]++;
	ll ans = 0;
	for(auto p : m)
		ans += p.S * (p.S - 1) / 2;
	rep(i,0,n)
	{
		cout << ans - (m[v[i]] - 1) << '\n';
	}
}


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long

#define sc(n) scanf("%lld",&n)
#define scc(n1,n2) scanf("%lld %lld",&n1,&n2)
#define sccc(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define debug(x) cerr<<#x<<": "<<x<<endl;

signed main() {
    int t;
    cin>>t;
    map<string, int> m;
    while(t--){

       string str;
       cin>>str;
       m[str]++;
    } 
    int maxtimes=-1;
    for(auto itr=m.begin(); itr!=m.end(); itr++){
         maxtimes= max(maxtimes, itr->second);
    }

    for(auto itr=m.begin(); itr!=m.end(); itr++) if(itr->second==maxtimes) cout<<itr->first<<endl;

}



Measured memory_bytes: 19268
#include<stdio.h>
long f(long H);
long main(void){
    long H;
    scanf("%ld",&H);
    printf("%ld",f(H));
    return 0;
}

long f(long H){
    if (H==1){
        return 1;
    }else{
        return (1+2*f(H/2));
    }
}

Measured memory_bytes: 128
import bisect
x,n = map(int,input().split())
p = list(map(int,input().split()))
lis = []
for i in range(110,-50,-1):
    if i not in p:
        lis.append(i)
m = 10000
ans = 0
for i in lis:
    if abs(x-i)<=m:
        m = abs(x-i)
        ans = i

print(ans)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
const int mxn = 1e5+10;
int n;
long long ar[mxn];

int main()
{
    cin>>n;
    for(int i = 0; i < n; i++)
        cin>>ar[i];
    long long prev = ar[n-1];
    if(prev!=2)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    long long left = 2;
    long long right = 2;
    for(int i = n-1; i >= 0; i--)
    {
		left = ((left-1)/ar[i] + 1)*ar[i];
		right = ((right/ar[i])*ar[i]+ar[i]-1);
		long long tmp = (right/ar[i])*ar[i];
		
		if(left > tmp) { cout<<"-1"<<endl; return 0;}
	}
	cout<<left<<" "<<right<<endl;
    return 0;
}


Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DDoubleDots {
public:

    vector<int> graph[100005];

    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n, m; cin >> n >> m;
      rep(i, m) {
        int a, b; cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
      }

      vector<int> dp(n, INT_MAX/2);
      vector<int> ret(n);
      dp[0] = 0;
      deque<P> que;
      que.emplace_back(0, 0);
      while(!que.empty()) {
        auto pa = que.front(); que.pop_front();
        if (pa.second > dp[pa.first]) continue;
        for(auto e: graph[pa.first]) {
          if (dp[e] > pa.second + 1) {
            dp[e] = pa.second + 1;
            ret[e] = pa.first;
            que.emplace_back(e, dp[e]);
          }
        }
      }

      cout << "Yes" << endl;
      for(int i=1; i<n; i++) {
        cout << ret[i]+1 << '\n';
      }

    }
};

signed main() {
  DDoubleDots solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 11636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) begin(x), end(x)
#define SZ(x) (int)(x).size()
#define cps(x) sort(all(x)), (x).erase(unique(all(x)), end(x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	string s;
	cin >> s;
	int res = 0;
	for (int i = 0; i < SZ(s); i++)
		res = (res + (s[i] - '0')) % 9;
	if (res == 0) cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    ll ans;
    ans = pow((k-1),n-1);
    ans *= k;
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main(){
	int n,b;
	string a;
	vector <pair<string,pair<int,int>>> sp;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		b*=-1;
		sp.push_back(make_pair(a,make_pair(b,i)));
	}
	sort(sp.begin(),sp.end());
	for(int i=0;i<n;i++){
		cout<<sp[i].second.second<<endl;;
	}
	return 0;
}

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

int main(){

  string s[5] = {"afkpuz","bglqv.","chmrw?","dinsx!","ejoty "};
  string t;
  int z,x,y;

  while(cin >> t){
    z = 0;

    if(t.size()%2 == 1){
      cout << "NA" << endl;
      continue;
    }

    for(int i=0;i<t.size();i++){
      if(i%2 == 0){
	if(t[i] < '1' || t[i] > '6'){
	  cout << "NA" << endl;
	  z = 1;
	  break;
	}
      }

      if(i%2 == 1){
	if(t[i] < '1' || t[i] > '5'){
	  cout << "NA" << endl;
	  z = 1;
	  break;
	}
      }
    }

    if(z == 1) continue;

    for(int i=0;i<t.size();i+=2){
      x = t[i] -'0'-1;
      y = t[i+1] - '0'-1;

      cout << s[y][x];
    }

    cout << endl;
  }
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
const long long INF = 1LL<<60;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max


int main () {

    int n;cin>>n;

    int a[200010];

    rep(i,n) {
        cin>>a[i];
    }

    ll ans=0;
    int right=0;
    int sum=0,sum_x=0;
    for (int left=0;left<n;left++) {
        while(right<n&&(sum+a[right]==(sum_x ^ a[right]))) {
            sum+=a[right];
            sum_x ^=a[right];
            right++;
        }
        ans+=right-left;
        if (right==left) {
            right++;
        }
        else {
            sum-=a[left];
            sum_x^=a[left];
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
    using namespace std;
    int main()
    {
      int a[3];
      int b[3]={0,0,0};
      for(int i=0;i<3;i++)
      {
        cin>>a[i];
      }
      b[0]=a[2];
      b[1]=a[0];
      b[2]=a[1];
      for(int i=0;i<2;i++)
      {cout<<b[i]<<" ";
      }
      cout<<b[2];
    }

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

int main() {
  int N, x;
  cin >> N;
  x = 0;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    x += (r - l + 1);
  }
  cout << x << endl;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

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

using namespace std;
using ll=long long;
using pii=pair<int,int>;


const int all=1010;
int L;
int x[110],w[110];

int num[110];

int main(void){
	int n;
	cin >>  L >>  n;
	rep(i,n){
		cin >> x[i] >> w[i];
		num[x[i]+L]+=w[i];
	}

	vector<pii> ans;
	for(int i=-L;i<=L;++i) ans.push_back(pii(i,all-num[i+L]));
	cout << ans.size() << endl;
	for(auto &it:ans){
		cout << it.first << " " << it.second << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
#include<iostream>
using namespace std;
int main()
{
  long long n,k,a,b;
  cin>>n>>k;
  if(n%k==0)
    cout<<0<<endl;
  else
  {
  a=n%k;
  b=k-a;
  cout<<min(a,b)<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>


#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9
#define vint vector<int>

using namespace std;
typedef long long  ll;

const long long MOD = 1e9+7;


int main() {
    ll n, m;
    cin >> n >> m;
    ll a;
    REP(i, 0, m){
        cin >> a;
        n = n - a;
    }

    if(n < -1){
        p(-1);
    } else {
        p(n);
    }
}

Measured memory_bytes: 3632
import java.util.Scanner;

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

if(a<b) System.out.println("a < b");
else if (a>b) System.out.println("a > b");
else System.out.println("a == b");
}
}

Measured memory_bytes: 26160
//A - AtCoder Contest Scheduling
//Hiia
#include <stdio.h>
#include <stdlib.h>//rannsuu, zettaichi(absolute)
#include <time.h>
//srand((unsigned int) time(0));
#include <math.h>//koudona keisann
#include <string.h>//hairetsu
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
typedef long long ll;
//#define N 998244353

int gcd(int m,int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
int lcm(int m,int n){if((0==m)||(0==n))return 0;return(m*n/gcd(m, n));}
int fact(int x){if(x==1) return(x);else return(x*fact(x-1));}//Kaijou x!
int ruijou(int base,int exponent){int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

long long int llgcd(long long int m,long long int n){if((0==m)||(0==n))return 0;while(m!=n)if(m>n)m=m-n;else n=n-m;return m;}
long long int lllcm(long long int m,long long int n){if((0==m)||(0==n))return 0;return(m*n/llgcd(m, n));}
long long int llfact(long long int x){if(x==1) return(x);else return(x*llfact(x-1));}//Kaijou
int llruijou(long long int base,long long int exponent){long long int i,answer=1;i=exponent;while(i!=0){answer=answer*base;--i;}return answer;}//ruijou base^exponent

int main()
{
  long long int d,c[30],i,j,tmp;
  scanf("%lld", &d);
  for(i = 1; i <= 26; i++) {
    scanf("%lld", &c[i]);
  }
  long long int s[d+2][30];
  for(i = 1; i <= d; i++) {
    for(j = 1; j <= 26; j++) {
          scanf("%lld", &s[i][j]);
    }
  }


  long long int r[367]={};
  for (i=1; i<=d; ++i) {
    r[i]=1;
    for (j=2; j<=26; ++j) {
      //for (k=i+1; k<=total; ++k) {
          if (s[i][1] < s[i][j]) {
            tmp =  s[i][1];
            s[i][1] = s[i][j];
            s[i][j] = tmp;
            r[i]=j;
          }
      //}
    }
  }
  //printf("aaa\n");

  for (i=1; i<=d; ++i) {
    printf("%lld\n", r[i]);
  }

  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[5];

int main(int argc, char* argv[])
{
    int n,m;
    scanf("%d%d", &n, &m);
    vector<int> flag(n), cnt(n);
    int i;
    for(i=0; i<m; i++) {
        int tmp;
        scanf("%d%s", &tmp, str); tmp--;
        if(strcmp(str,"AC")==0) {
            flag[tmp]=1;
        }
        else {
            if(flag[tmp]==0) {
                cnt[tmp]++;
            }
        }
    }

    int cnt0=0, cnt1=0;
    for(i=0; i<n; i++) {
        if(flag[i]) {
            cnt0++;
            cnt1+=cnt[i];
        }
    }
    printf("%d %d\n", cnt0, cnt1);

    return 0;
}




Measured memory_bytes: 1024