akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}


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

    Int n;
    cin >> n;
    Int k = n/10;
    Int keta = k >= 1 ? 1 : 0;
    while(k >= 10){
        k /= 10;
        keta++;
    }
    Int sum = 0;
    if(keta > 0){
        for(Int i=0; i<keta; i++){
            if(i%2==0){
                sum += pow(10, i+1) - pow(10, i);
            }
        }
        if(keta%2==0){
            Int tmp = pow(10, keta);
            while(tmp <= n){
                sum++;
                tmp++;
            }
        }
    }else{
        sum = n;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

ll gcd(ll a,ll b){
  if(b==0)return a;
  return gcd(b,a%b);
}

ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main(){
  ll n,m;
  string s,t;
  cin >> n >> m >> s >> t;
  ll l = lcm(n,m);
  ll g = gcd(n,m);
  for(int i=0;i<g;i++){
    if(s[i*n/g] != t[i*m/g]){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << l << endl;
}


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



int main()
{
  ll a, b;
  cin >> a >> b;
  cout << a * b << endl;
  
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

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

	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c >= 22) cout << "bust\n";
	else cout << "win\n";
}


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



int sc1(){int x; scanf("%d",&x); return x;}

long long sc2(){long long x;scanf("%lld",&x);return x;}

#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>







int main()
{
	//freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll n;
    cin>>n;

    cout<<(n*(n-1))/2LL<<endl;
    
    return 0;
}




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

int main(){
    
    int A = 0, B = 0;
    for(int i = 0; i < 2; i++){
        char c;
        cin >> c;
        A = (A * 10) + c - '0';
    }
    for(int i = 0; i < 2; i++){
        char c;
        cin >> c;
        B = (B * 10) + c - '0';
    }
    int ym = 0, my = 0;
    if(1 <= B && B <= 12){
        ym = 1;
    }
    if(1 <= A && A <= 12){
        my = 1;
    }
    if(ym && my)cout << "AMBIGUOUS" << endl;
    else if(ym)cout << "YYMM" << endl;
    else if(my)cout << "MMYY" << endl;
    else cout << "NA" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        long ans = a[n - 1];
        for (int i = 0; i < n; i++) {
            ans = gcd(a[n - 1 - i], ans);
        }
        System.out.println(ans);
    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }
}

Measured memory_bytes: 49312
use proconio::input;
use std::cmp::Reverse;
use std::collections::BinaryHeap;

fn solve(camels: &Vec<Vec<i64>>) -> i64 {
    let mut qu = BinaryHeap::<Reverse<i64>>::new();
    for i in 0..camels.len() {
        for &v in &camels[i] { qu.push(Reverse(v)) }
        while qu.len() > i+1 { qu.pop(); }
    }
    let mut res = 0;
    while !qu.is_empty() {
        let Reverse(v) = qu.pop().unwrap();
        res += v;
    }
    res
}

fn main() {
    input! {
        t: usize
    };
    for _ in 0..t {
        input! {
            n: usize,
            c: [(usize, i64, i64); n]
        };
        let mut l = vec![Vec::new(); n];
        let mut r = vec![Vec::new(); n];
        let mut res = 0;
        for &p in &c {
            res += p.1.min(p.2);
            if p.1 > p.2 {
                l[p.0-1].push(p.1 - p.2)
            } else if p.1 < p.2 && p.0 < n {
                r[n-p.0-1].push(p.2 - p.1)
            }
        }
        res += solve(&l);
        res += solve(&r);
        println!("{}", res);
    }
}


Measured memory_bytes: 25052
N, *A, = map(int, open(0).read().split())
ans = 1; cur = A[0]; mode = 0
for i in range(N):
    if mode == 0:
        if cur < A[i]:
            mode = 1
        elif cur > A[i]:
            mode = 2
    else:
        if (mode == 1 and not cur <= A[i]) or (mode == 2 and not cur >= A[i]):
            ans += 1
            mode = 0
    cur = A[i]
print(ans)


Measured memory_bytes: 14052
#include <cstdio>

bool ok(int c[3][3]) {
  int a1=c[0][1]-c[0][0];
  if (c[1][0]+a1 != c[1][1]) return false;
  if (c[2][0]+a1 != c[2][1]) return false;

  int a2=c[0][2]-c[0][1];
  if (c[1][1]+a2 != c[1][2]) return false;
  if (c[2][1]+a2 != c[2][2]) return false;

  int b1=c[1][0]-c[0][0];
  if (c[0][1]+b1 != c[1][1]) return false;
  if (c[0][2]+b1 != c[1][2]) return false;

  int b2=c[2][0]-c[1][0];
  if (c[1][1]+b2 != c[2][1]) return false;
  if (c[1][2]+b2 != c[2][2]) return false;

  return true;
}

int main() {
  int c[3][3];
  for (int i=0; i<3; ++i)
    for (int j=0; j<3; ++j)
      scanf("%d", &c[i][j]);

  printf("%s\n", ok(c)? "Yes":"No");
}


Measured memory_bytes: 128
use std::io;
use std::str::FromStr;
use std::collections::HashMap;


fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}


fn main() {
    let n: u64 = input();
    let a_vec = input_vec();
    let q: u64 = input();
    let mut a_map: HashMap<u64, u64> = HashMap::new();
    let mut sum = 0;
    for a in a_vec {
        sum += a;
        let n = a_map.entry(a).or_insert(0);
        *n += 1;
    }

    for _ in 0..q {
        let (b, c) = input_tuple();
        // println!("{:?}", a_map);
        if a_map.contains_key(&b) {
            let count = *a_map.get(&b).unwrap();
            sum = sum - b * count + c * count;
            let n = a_map.entry(c).or_insert(0);
            *n += count;
            a_map.remove(&b);
        }
        println!("{}", sum);
    }
}


Measured memory_bytes: 7232
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define r(x)  scanf("%d", &x)
#define rr(x , y)  scanf("%d%d" , &x , &y)
#define rst(s)  scanf("%s" , s)
#define rl(x)  scanf("%lld" , &x)
#define rrl(x , y)  scanf("%lld%lld" , &x , &y)
#define w(x)  printf("%d" , x)
#define ww(x , y)  printf("%d %d" , x , y)
#define wl(x)  printf("%lld" , x)
#define wwl(x , y)  printf("%lld %lld" , x , y)
#define sp()  printf(" ")
#define en()  puts("")
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++) 
#define per(i , n , x)  for(int i = n ; i >= x ; i --) 
#define mem0(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , inf , sizeof(x))
#define mem__inf(x)  memset(x , -inf , sizeof(x))
#define p_queue priority_queue
#define debug(x)  printf("%d\n" , x)
#define ddebug(x , y)  printf("%d %d\n" , x , y)
using namespace std ;
mt19937  rnd(chrono::high_resolution_clock::now().time_since_epoch().count()) ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
typedef pair<int , ll> pil ;
typedef pair<ll , int> pli ;
const int inf = 0x3f3f3f3f ;
const int maxn = 1e5 + 5 ;
const int maxm = 2e6 + 5 ;
const ll mod = 1e9 + 7 ;
using namespace std ;
ll qpow(ll a , ll b)
{
	if(b < 0)  return 0 ;
	ll ans = 1 ; 
	a %= mod ;
	while(b)
	{
		if(b & 1)  ans = (ans * a) % mod ;
		b >>= 1 , a = (a * a) % mod ;
	}
	return ans % mod ;
}
ll ans[maxn] ;
int main()
{
	int n , k ;
	rr(n , k) ;
	ll res = 0 ;
	per(i , k , 1)
	{
		ans[i] = qpow((ll)k / i , (ll)n) ;
		for(int j = i + i ; j <= k ; j += i)
		  ans[i] -= ans[j] ;
		res += ans[i] * i % mod ;
		res %= mod ;
	}
	res = (res + mod) % mod ;
	wl(res) , en() ;
	return 0 ;
}

Measured memory_bytes: 4548
#include <iostream>
using namespace std;
int main(){
	int a,b,x;
	char op;
	do{
	cin>>a>>op>>b;
	switch(op){
	case '+':cout<<a+b<<endl;
	break;
	case '-':cout<<a-b<<endl;
	break;
	case '*':cout<<a*b<<endl;
	break;
	case '/':cout<<a/b<<endl;
	break;
	}
	}while(op!='?');
	return 0;
}

Measured memory_bytes: 1164
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

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

  ll n;
  cin >> n;

  vll as(n);
  rep(i, n) cin >> as[i];
  ll ans = 0;
  map<ll, ll> mp;
  rep(i, n) mp[as[i]] = i;
  ll j = 0;
  for (auto x : mp) {
    if((x.second + j++) % 2) ans++;
  }

  cout << ans/2 << endl;
}


Measured memory_bytes: 10368
extern crate proconio;
use proconio::fastout;
use proconio::marker::Usize1;

#[fastout]
fn main() {
    proconio::input! {
        n: usize,
        a: [[Usize1]],
    }
    let mut ans = vec![true; n];
    for a in a {
        for a in a {
            ans[a] = false;
        }
    }
    println!("{}", ans.into_iter().filter(|&x| x).count());
}


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

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

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

#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define int long long int
#define mod 1000000007
const int N=1e5+5;

int n,w;
int wt[1000];
int val[1000];
int cache[100+5][N];

int dp(int pos,int sum)
{
	if(pos==n)
		return 0;
	if(cache[pos][sum]!=-1)
		return cache[pos][sum];
	if(sum+wt[pos]>w)
		cache[pos][sum]=dp(pos+1,sum);
	else
		cache[pos][sum]=max(dp(pos+1,sum),dp(pos+1,sum+wt[pos])+val[pos]);

	return cache[pos][sum];
}

int32_t main()
{
	fastIO;
  
	int i;
	cin>>n>>w;
	for(i=0;i<n;i++)
		cin>>wt[i]>>val[i];

	memset(cache,-1,sizeof(cache));
	cout<<dp(0,0)<<"\n";
	return 0;
}


Measured memory_bytes: 82304
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Integer d[] = new Integer [n];
        int count = 1;

        for(int i = 0;i < n;i++){
            d[i] = scanner.nextInt();
        }
        Arrays.sort(d, Comparator.reverseOrder());

        for(int i = 0;i < n - 1;i++){
            if(d[i] > d[i+1]){
                count++;
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int a,b;
    cin >> a>>b;

    cout << 6-a-b << endl;

   return 0;
}

Measured memory_bytes: 256
let () =
    let main () =
        let n = int_of_string (read_line ()) in
        let s = read_line () in
        print_endline (String.map (fun c -> char_of_int(((int_of_char c - int_of_char 'A' + n) mod 26) + int_of_char 'A')) s)
    in
    main ()

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

typedef long long int ll;
typedef long double ld;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007
#define lp(start,end) for(ll i=start;i<=end;i++) 
#define deb1(a) cout<<#a<<" = "<<(a)<<endl;
#define deb2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define deb3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;


ll modu(ll a, ll b)
{
	ll ans =1;
	while(b>0)
	{
		if(b&1)
		ans = (ans*a)%mod;
		b/=2;
		a = (a*a)%mod;
	}
	return ans;
}

ll fpar(ll x, ll par[])
{
	ll y = par[x];
	while(x!=y)
	{
		x=y;
		y=par[x];
	}
	return x;
}
ll var;
void dsu(ll x , ll y, ll size[], ll par[])
{
	ll parx = fpar(x,par);
	ll pary = fpar(y,par);

	if(parx!=pary){

	if(size[parx]>size[pary])
	{
		par[pary] = parx;
		size[parx]+= size[pary];
	}
	else
	{
		par[parx] = pary;
		size[pary]+= size[parx];
	}
	var++;

}
}
int main()
{
	fastio
	var=0;
	ll n,m;
	cin >> n >> m;
	ll vis[n+1],size[n+1],par[n+1];
	for(ll i=1;i<=n;i++){
		vis[i]=0;
		size[i]=1;
		par[i]=i;
	}
	vector<ll>adj[n+1];
	for(ll i=1;i<=m;i++)
	{
		ll u,v;
		cin >> u >> v;
		dsu(u,v,size,par);
	}
	cout << n-1-var << endl;
	return 0;	
}


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

typedef long long int ll;

int main() {
    int a, b, c;
    int m, n, p;
    while (cin >> a >> m >> b >> n >> c >> p, a || b || c || m || n || p) {
        int c1 = 1, c2 = 1, c3 = 1;
        int x = a % m;
        int y = b % n;
        int z = c % p;

        while (x != 1) {
            c1++;
            x = (a * x) % m;
        }
        while (y != 1) {
            c2++;
            y = (b * y) % n;
        }
        while (z != 1) {
            c3++;
            z = (c * z) % p;
        }

        int c = 2;
        map<int,int> dp;
        while (c1 > 1) {
            int count = 0;
            while (c1 % c == 0) {
                count++;
                c1 /= c;
            }
            if (count) {
                dp[c] = max(dp[c], count);
            }
            c++;
        }
        c = 2;
        while (c2 > 1) {
            int count = 0;
            while (c2 % c == 0) {
                count++;
                c2 /= c;
            }
            if (count) {
                dp[c] = max(dp[c], count);
            }
            c++;
        }
        c = 2;
        while (c3 > 1) {
            int count = 0;
            while (c3 % c == 0) {
                count++;
                c3 /= c;
            }
            if (count) {
                dp[c] = max(dp[c], count);
            }
            c++;
        }

        ll ans = 1LL;
        for (auto i : dp) {
            ans *= pow((ll)i.first, (ll)i.second);
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3256
#include <stdio.h>
#define Max_N 10

int N;
int preA,preB;
int data[Max_N+1];

bool dfs(int x){
	if(x==10) return true;
	if(preA<data[x]){
		preA=data[x];
		if(dfs(x+1)) return true;
	}
	if(preB<data[x]){
		preB=data[x];
		if(dfs(x+1)) return true;
	}
	return false;
}

void solve(){
	preA=0;preB=0;
	if(dfs(0)) printf("YES\n");
	else printf("NO\n"); 
}

int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		for(int j=0;j<10;j++){
			scanf("%d",&data[j]);
		}
		solve();
	}
	return 0;
}


Measured memory_bytes: 2608
#include <stdio.h>
 
int main(void) {
    int h[300],w[300];
    int a,b,c,d,i,n;
    a=0;
    b=0;
    while(1){
    	scanf("%d %d",&h[a],&w[b]);
    	c=h[a];
    	d=w[b];
    	if(c==0&&d==0){
    		break;
    	}
    	for(i=0;i<c;i++){
    		for(n=0;n<d;n++){
    			printf("#");
    		}
    		printf("\n");
    	}
    	printf("\n");
    	a++;b++;
    }
	return 0;
}


Measured memory_bytes: 2100
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] b = new String[n];
        int ac = 0;
        int tle = 0;
        int wa = 0;
        int re = 0;


        for(int i=0;i<n;i++){
            b[i] = sc.next();
            if(b[i].equals("AC")) {
                ac++;
            }
            if(b[i].equals("TLE")) {
                tle++;
            }
            if(b[i].equals("WA")) {
                wa++;
            }
            if(b[i].equals("RE")) {
                re++;
            }
        }
        System.out.println("AC x " + ac);
        System.out.println("WA x " + wa);
        System.out.println("TLE x " + tle);
        System.out.println("RE x " + re);
    }
}


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

int main() {
  string str;
  cin >> str;
  string ans = "No";
  for (int i = 0; i < str.size()-1; i++) {
    if (str.at(i) == 'A') {
      if (str.at(i+1) == 'C') {
        ans = "Yes";
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)























int main(){
    ll n;
    cin >> n;
    vector<ll> s(n);
    REP(i, n){
        cin >> s[i];
    }
    
    ll ans = 0;
    for(ll i = 1; i < n; i++){
        ll sum = 0;
        vector<bool> used(n);
        for(ll j = 0; j < n - i; j += i){
            ll k = n - 1 - j;
            
            if(used[j]) break;
            used[j] = true;
            sum += s[j];
            
            if(used[k]) break;
            used[k] = true;
            sum += s[k];
            
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
}

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

using ll = long long int;
const int MAX_N = 50;

ll k;

ll a[MAX_N];

int main(void){
  // Here your code !
  scanf("%lld", &k);

  for (int i = 0; i < MAX_N; ++i) {
    a[i] = i;
    a[i] += k / 50;
  }

  ll notyet = k % 50;

  for (int i = 0; i < notyet; ++i) {
    int tind = 0;
    ll mine = (ll)1e16 + 10000 + 5;
    for (int j = 0; j < MAX_N; ++j) {
      if (mine > a[j]) {mine = a[j]; tind = j;}
    }

    for (int j = 0; j < MAX_N; ++j) {
      if (j == tind) a[j] += MAX_N;
      else a[j] -= 1;
    }
  }

  printf("%d\n", 50);
  for (int i = 0; i < MAX_N; ++i) {
    printf("%lld ", a[i]);
  }

  printf("\n");

  return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

int main()
{
	int N;
	scanf("%d", &N);

	printf("%d\n", N*N*N);

	return 0;
}

// FOR GNU C++ use the following pattern:
// Uncomment the code below and change your main into main2
// It does not build in MS C++
// But it does increase the stack size from 256 MB on CF and uses GNU C++

//#include <Processthreadsapi.h>
//#include <iostream>
//#include <Synchapi.h>
//#include <windows.h>
//#include <process.h>
//
//DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
//    main2(nullptr);
//    return 0;
//}
//int main() {
//    auto h = CreateThread(nullptr, 1024 << 20, MyThreadFunction, nullptr, STACK_SIZE_PARAM_IS_A_RESERVATION, nullptr);
//    WaitForSingleObject(h, INFINITE);
//}

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

#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define ms memset
#define mp make_pair
#define f first
#define s second
#define int long long

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
typedef pair<int, pair<int, int>> piii;

#define MAXN 100010


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

	int a, b, c, d;

	cin >> a >> b >> c >> d;

	int ans1 = max(a, b) * max(c, d);
	int ans2 = min(a, b) * max(c, d);
	int ans3 = min(a, b) * min(c, d);
	int ans4 = max(a, b) * min(c, d);

	cout << max({ans1, ans2, ans3, ans4}) << "\n";
	
	return 0;	
}

Measured memory_bytes: 3644
require 'set'

N = STDIN.gets.to_i - 1
A = STDIN.gets.split(' ').map(&:to_i)

l = {}
r = {}

k = Set.new

0.upto(N) do |i|
  l[i + A[i]] ||= []
  l[i + A[i]] << i
  k.add(i + A[i])

  r[i - A[i]] ||= []
  r[i - A[i]] << i
  k.add(i - A[i])
end

c = 0

k.each do |i|
  if r[i] && l[i]
    c += r[i].count * l[i].count
  end
end

print c


Measured memory_bytes: 62996
import math
a,b,h,m = map(int,input().split())

h_kaku = math.radians(h*30+m*(1/2))
m_kaku = math.radians(m*6)

a_x = math.sin(h_kaku)*a
a_y = math.cos(h_kaku)*a
b_x = math.sin(m_kaku)*b
b_y = math.cos(m_kaku)*b

ans = math.sqrt((a_x-b_x)**2+(a_y-b_y)**2)

print(ans)

Measured memory_bytes: 9520
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll x,t;cin>>x>>t;
    cout<<max(x-t,0)<<ednl;
}

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

int alphabet[26] = {0};

void charCount(string str){
	int index;
	for(int i = 0; i < str.length(); i++){
		str[i] = tolower(str[i]);
		index = str[i] - 'a';
		if( 0 <= index && index <= 26){
			alphabet[index]++;
		}
	}
	
}

int main()
{
	string str;
	getline(cin,str);
	while (!str.empty()){
		charCount(str);
		getline(cin,str);
	}
	
	for(int i = 0 ; i < 26; i++){
		char ch = i + 'a';
		cout<<ch<<" : "<<alphabet[i]<<endl;
	}
	return 0;
}

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

using ll = long long;

int main() {
  ll L, R;
  scanf("%lld%lld", &L, &R);

  ll MOD = 2019;

  ll ans = MOD;
  // ループの終了条件に ans > 0 を追加し、不要な計算を打ち切る
  for (ll i = L; i < R && ans > 0; i++) {
    for (ll j = i + 1; j <= R && ans > 0; j++) {
      ans = min((i * j) % MOD, ans);
    }
  }

  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    
    vector<float> hoge(n);
    
    for(int i=0;i<n;i++){
        cin>>hoge.at(i);
    }
    
    sort(hoge.begin(),hoge.end());
    
    int i=1;
    while(true){
        if(i==n)break;
        
        hoge.at(i)=(hoge.at(i)+hoge.at(i-1))/2;
        hoge.at(i-1)=0;
        i++;
    }
    cout<<hoge.at(n-1)<<endl;
}

Measured memory_bytes: 256
n = int(input())
D = [list(map(int, input().split())) for _ in range(n)]

count = 0
ans = 'No'
for dd in D:
    d1, d2 = dd
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        ans = 'Yes'

print(ans)

Measured memory_bytes: 62316
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  int n;cin >> n;
  map<int,ll> mp;
  repi(i,0,n){
    int t;cin >> t;
    if(mp.find(t) == mp.end()){
      mp[t] = 1LL;
    } else {
      mp[t] += 1LL;
    }
  }
  ll cnt_one = 0LL;
  ll cnt_not_one = 0LL;
  ll sum_not_one = 0LL;
  for (auto const& ele: mp) {
    if(ele.second == 1LL){
      ++cnt_one;
    } else {
      ++cnt_not_one;
      sum_not_one += ele.second;
    }
  }
  sum_not_one -= cnt_not_one;
  cnt_one += cnt_not_one;
  if(sum_not_one%2LL != 0){
    --cnt_one;
  }
  cout << cnt_one << endl;
  return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int64_t a,b;
void solve(){
  if (a<10&&b<10) {
    cout<<a*b<<endl;
  }else{
    cout<<"-1"<<endl;
  }

}


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


  solve();
  return 0;
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
    }
    let mut s = vec![];
    for _ in 0..m {
        input! {
            k: usize,
            ss: [usize; k]
        }
        s.push(ss);
    }
    input! {
        p: [usize; m]
    }

    let mut ans = 0;
    // onであるスイッチの部分全列挙
    for bit in 0..2u32.pow(n as u32) {
        let mut all_is_on = true;
        for k in 0..m {
            let mut on_num = 0;
            for id in &s[k] {
                let id = id - 1;
                if (bit >> id) & 1 == 1 {
                    on_num += 1;
                }
            }
            if on_num % 2 != p[k] {
                all_is_on = false;
            }
        }
        if all_is_on {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2188
#include <iostream>

using namespace std;

int main() {
	int a; cin >> a;
	for (int i = 1; i <= a; i++) {
	    if (i % 3 == 0) cout << " " << i;
	    else {
	        int o = i;
	        if (o % 10 == 3) {
	            cout << " " << i;
	        } else {
	            while (o > 10) {
	                o = o / 10;
	                if (o % 10 == 3) { 
	                    cout << " " << i;
	                    break;
	                }
                }
	        }
	    }
	}
	cout << endl;
}



Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		Scanner scan = new Scanner(System.in);
		
		while(true){
			int H = scan.nextInt();
			int W = scan.nextInt();
			int i = 0;
			int i2 = 0;
			
			// ??\??????0,0?????¨???
			if ((H==0) && (W==0)) break;
	
			for(i=0; i<H; i++){
				//????????¨?????????????????¨???
				if ((i==0) || (i==H-1)) {
					for(i2=0; i2<W; i2++) System.out.print("#");
				}
				else {
					for(i2=0; i2<W; i2++) {
						//??????????????¨???????????¨???
						if ((i2==0 || (i2==W-1)))System.out.print("#");
						else System.out.print(".");
					}
				}
				System.out.println("");
			}
			System.out.println("");
		}
		
	}
}

Measured memory_bytes: 34372
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll N,K;cin>>N>>K;
    vl info(N);
    rep(i,N)cin>>info[i];
    ll count=0;
    rep(i,N-1){
        repl(j,i+1,N){
            if(info[i]>info[j])count++;
        }
    }
    sort(all(info));
    vl check(N);
    rep(i,N)check[i]=info.end()-upper_bound(all(info),info[i]);
    ll ans=count*K%MOD+accumulate(all((check)),0)*((K-1)*K/2%MOD)%MOD;
    ans%=MOD;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);


    int m,d;
    cin >> m >> d;
    int a;
    cin >> a;
    cin >> a;

    bool res = false;
    if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
        res = d == 31;
    } else if (m == 2) {
        res = d == 28;
    } else {
        res = d == 30;
    }

    if (res) {
        cout << 1 << '\n';
    } else {
        cout << 0 << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n,a,b;
	while (cin >> n && n) {
		int suma = 0, sumb = 0;
		for (int i = 1; i <= n; ++i) {
			cin >> a >> b;
			if (a > b) suma += (a + b);
			else if (a < b) sumb += (a + b);
			else {
				suma += a;
				sumb += b;
			}
		}
		cout << suma << " " << sumb << endl;
	}
	return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<string> w(n);
  for(int i=0;i<n;i++){
    cin>>w[i];
  }
  bool ans=true;
  for(int i=0;i<n-1;i++){
    if(w[i+1][0]!=w[i][w[i].size()-1]){
      ans=false;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<i;j++){
      if(w[i]==w[j]){
        ans=false;
      }
    }
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#include<climits>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 20005
#define M 10005
//#define INF
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-7
using namespace std;
const ll INF = ~1ull>>1;
inline int Max(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^b;
}
inline int Min(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^a;
}
int is_mul_overflow(ll a, ll b) {
        return LLONG_MAX / a < b;
}

int a[N],b[N],p[N],r[N];
unordered_map<int,int>mp;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin>>n)
    {
        MST(b,0);
        mp.clear();
        FOR(i,1,n)cin>>p[i],r[p[i]] = i;
        FOR(i,1,n)a[i] = i*N;
        FOR(i,1,n)b[i] = N*(n-i)+r[i];
        FOR(i,1,n)cout<<a[i]<<" ";
        cout<<endl;
        FOR(i,1,n)cout<<b[i]<<" ";
        cout<<endl;
        //FOR(i,1,n)cout<<a[p[i]]+b[p[i]]<<" ";
        //cout<<endl;
    }
    return 0;
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int gcd(int a, int b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
int lcm (int a, int b) {
    return a / gcd(a, b) * b;
}
int solve(){
    cin>>n>>m; int m1=0;
    int a[n]; rep(i,0,n-1) cin>>a[i];
    rep(i,0,n-1){
        a[i]/=2;
    }
    int t=1;
    int b[n];
    rep(i,0,n-1){
        b[i]=0; int x=a[i];
        while(x%2==0){
            b[i]++;
            x/=2;
        }
        t=lcm(t,a[i]);
    }
    sort(b,b+n);
    if(b[0]==b[n-1]) cout<<m/t-m/(2*t);
    else cout<<0;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


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

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Main me = new Main();
		System.out.println(me.fact(Integer.parseInt(in.readLine())));
	}
	private long fact(long n){
		if(n==0)
			return 1;
		else
			return n*fact(n-1);
	}
}

Measured memory_bytes: 16852
using System;

namespace abc123_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int index = 0,answer = 0, cooltime = 0, cooltimemax = 0,lastOrder = 0;
            int[] order = new int[5];
            int[] waittime = new int[5];
            int[] inputs = new int[5];

            for(int i = 0; i < 5; i++)
            {
                inputs[i] = int.Parse(Console.ReadLine());
                cooltime = 10 - inputs[i] % 10;
                if(cooltime==10)
                {
                    waittime[i] = 0;
                    //0の時はクールタイムがないので途中に入れたほうがいい
                }
                else if (cooltimemax <= cooltime)
                {
                    cooltimemax = cooltime;
                    waittime[i] = cooltime;
                    index = i;
                }
                else
                {
                    waittime[i] =cooltime;
                }

            }
            lastOrder=inputs[index];
            inputs[index] = 0;
            waittime[index] = 0;
            for(int i = 0; i < 5; i++)
            {
                answer = answer + inputs[i]+waittime[i];
            }
            answer = answer + lastOrder;
            Console.WriteLine(answer);



        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

struct vertex{
    int X;
    int Y;
};

int	gcd(int	a, int b){
    while( b ){
        int	m = a % b;
        a = b;
        b = m;
    }
    return a;
}

int	lcm(int a, int	b){
    return (a*b)/gcd(a,b);
}

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //????????????

    double n;
    cin >> n;

    if(n==0){
        cout << 0 << endl;
        return 0;
    }
    int i=0;
    for(i=0;i<=1000;i++){
        if(n<pow(2,i)){
            break;
        }
    }
    
    cout << i << endl;
    
    //???????????§
    //cout << "ans" << endl;????????????
    //printf("%.7f",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

Measured memory_bytes: 1260
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bitset>
#include <ctime>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 2e5 + 5;
const int maxA = 2e3 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll modP(ll a, ll b = MOD - 2){
	if (b == 0)
		return 1;
	ll c = modP(a, b / 2);
	c = (c * c) % MOD;
	if (b & 1)
		c = (a * c) % MOD;
	return c;
}

int fact[maxN], inv[maxN];
int a[maxN], b[maxN];
int dp[2 * maxA][2 * maxA];

ll choose(ll k, ll r){
	if (r < 0 || r > k)
		return 0;
	return (1ll * fact[k] * inv[r] % MOD) * inv[k - r] % MOD;
}

int main(){
	time_t START = clock();
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	fact[0] = 1;
	for (int i = 1; i < maxN; i++)
		fact[i] = (1ll * fact[i - 1] * i) % MOD;
	inv[maxN - 1] = modP(fact[maxN - 1]);
	for (int i = maxN - 2; i > -1; i--)
		inv[i] = (1ll * inv[i + 1] * (i + 1)) % MOD;
	int n; scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d%d", a + i, b + i);
	ll ans = 0;
	for (int i = 0; i < n; i++){
		ans = (ans + MOD - choose(2 * a[i] + 2 * b[i], 2 * a[i])) % MOD;
		dp[maxA - a[i]][maxA - b[i]]++;
	}
	for (int i = 0; i < 2 * maxA; i++)
		for (int j = 0; j < 2 * maxA; j++){
			if (i)
				dp[i][j] = (dp[i - 1][j] + dp[i][j]) % MOD;
			if (j)
				dp[i][j] = (dp[i][j - 1] + dp[i][j]) % MOD;
		}
	for (int i = 0; i < n; i++)
		ans = (ans + dp[maxA + a[i]][maxA + b[i]]) % MOD;
	printf("%d\n", (modP(2) * ans) % MOD);
	time_t FINISH = clock();
	cerr << "Execution time: " << (ld)(FINISH - START) / CLOCKS_PER_SEC * 1000.0 << " milliseconds.\n";
	return 0;
}
 



Measured memory_bytes: 66176
import math as mt
ct=0
a,c=map(int,input().split())
for i in range(0,a):
    a1,c1=map(int,input().split())
    x=(a1*a1)+(c1*c1)
    y=mt.sqrt(x)
    if(y<=c):
        ct+=1
print(ct)

Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
 
 
 
int main(){
	//freopen("output.txt","r",stdin);
 
	int t;
	cin>>t;
	long int sum = 0;
	for(int i=1;i<=t;i++){
		if(i % 3 != 0 && i % 5 != 0)
			sum += i;
	}
 
	cout<<sum<<endl;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
  static int top = 0;
  static int[] S = new int[101];
  
  static void push(int x) {
    S[++top] = x;
  }

  static int pop() {
    top--;
    return S[top + 1];
  }
  
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    String s;
    int a, b;
    while (stdIn.hasNext()) {
      s = stdIn.next();
      if (s.equals("+")) {
        a = pop();
        b = pop();
        push(a + b);
      } else if (s.equals("-")) {
        b = pop();
        a = pop();
        push(a - b);
      } else if (s.equals("*")) {
        a = pop();
        b = pop();
        push(a * b);
      } else {
        push(Integer.parseInt(s));
      }
    }

    System.out.println(pop());
  }
}  

Measured memory_bytes: 26284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (2147483647)
#define mod (1000000007)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)

void solve()
{
    ll h,n;
    cin>>h>>n;
    vector<ll>dp(2e4,1e18);dp[0]=0;
    ll a,b;
    REP(i,n){
        cin>>a>>b;
        REP(j,h+1)dp[j+a]=min(dp[j+a],dp[j]+b);
    }
    ll ans=1e18;
    rep(i,h,2e4){
        ans=min(ans,dp[i]);
    }cout<<ans<<endl;
}

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

Measured memory_bytes: 384
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int n;
		int[][][][] R = new int[16][16][16][258];
		for (int s = 0; s < 16; s++) {
			for (int a = 0; a < 16; a++) {
				for (int c = 0; c < 16; c++) {
					R[s][a][c][0] = s;
					for (int i = 1; i < 258; i++) {
						R[s][a][c][i] = (a*R[s][a][c][i-1] + c) % 256;
					}
				}
			}
		}
		while (true) {
			n = sc.nextInt();
			if (n == 0) break;
			int[] I = new int[n];
			for (int i = 0; i < n; i++)
				I[i] = sc.nextInt();
			
			int[] O = new int[n];
			
			int anss, ansa, ansc;
			anss = ansa = ansc = 0;
			double min = Double.MAX_VALUE;
			
			int[] num = new int[257];
			for (int s = 0; s < 16; s++) {
				for (int a = 0; a < 16; a++) {
					for (int c = 0; c < 16; c++) {
						for (int i = 0; i < n; i++) {
							O[i] = (I[i] + R[s][a][c][i+1]) % 256;
						}
						Arrays.fill(num, 0);
						for (int i : O)
							num[i]++;
						double h = 0;
						for (int i : num) {
							if (i > 0) {
								h -= (double)i/n*Math.log10((double)i/n);
							}
						}
						if (h+1E-6 < min) {
							min = h;
//							out.printf("%.20f\n",min);
							anss = s;
							ansa = a;
							ansc = c;
						}
					}
				}
			}
			
			out.printf("%d %d %d\n", anss, ansa, ansc);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 31948
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 500050
int mod1=998244353,base1=19260817,inv1;
int mod2=353448299,base2=20000003,inv2;
int h1[N],mi1[N],imi1[N],p[N],n,C;
int h2[N],mi2[N],imi2[N];
map<pair<int,int>,int>mp;
int pw(int x,int y,int p){int r=1;for(;y;y>>=1,x=1ll*x*x%p)if(y&1)r=1ll*r*x%p;return r;}
char ss[N],str;
int main()
{
	inv1=pw(base1,mod1-2,mod1);
	inv2=pw(base2,mod2-2,mod2);
	scanf("%d",&n);
	int i;
	for(mi1[0]=imi1[0]=mi2[0]=imi2[0]=i=1;i<=(n<<1);i++)
	{
		mi1[i]=ll(mi1[i-1])*base1%mod1;
		imi1[i]=ll(imi1[i-1])*inv1%mod1;
		mi2[i]=ll(mi2[i-1])*base2%mod2;
		imi2[i]=ll(imi2[i-1])*inv2%mod2;
	}
	scanf("%s",ss+1);
	p[0]=n;
	for(i=1;i<=n;i++)
	{
		str=ss[i];
		if(str=='+'){p[i]=p[i-1];h1[i]=(h1[i-1]+mi1[p[i]])%mod1;h2[i]=(h2[i-1]+mi2[p[i]])%mod2;}
		else if(str=='-'){p[i]=p[i-1];h1[i]=(h1[i-1]-mi1[p[i]]+mod1)%mod1;h2[i]=(h2[i-1]-mi2[p[i]]+mod2)%mod2;}
		else if(str=='>'){p[i]=p[i-1]+1;h1[i]=h1[i-1];h2[i]=h2[i-1];}
		else{p[i]=p[i-1]-1;h1[i]=h1[i-1];h2[i]=h2[i-1];}
		mp[make_pair(h1[i],h2[i])]++;
	}
	ll ans=0;
	for(i=1;i<=n;i++)
	{
		int d=p[i-1]-n,t1=h1[n],t2=h2[n];
		if(d>=0) t1=ll(t1)*mi1[d]%mod1,t2=ll(t2)*mi2[d]%mod2;
		else t1=ll(t1)*imi1[-d]%mod1,t2=ll(t2)*imi2[-d]%mod2;
		t1=(t1+h1[i-1])%mod1;t2=(t2+h2[i-1])%mod2;
		ans+=mp[make_pair(t1,t2)];
		mp[make_pair(h1[i],h2[i])]--;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 44416
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,(n)-1,0)
#define FOR(i,a,b) for(int i=(a),i##Len_=(b);i<i##Len_;i++)
#define RFOR(i,a,b) for(int i=(a),i##End_=(b);i>=i##End_;i--)
const char* LF = "\n";
namespace{struct _{_(){
    cin.tie(0);
    ios::sync_with_stdio(false);
}}a;}

signed main() {
    ll N;
    cin >> N;
    string S;
    cin >> S;

    ll nb = 0;
    ll nw = 0;
    REP(i, N) {
        if (S[i] == '.') {
            nw++;
        }
    }

    ll ans = nw + nb;
    REP(i, N) {
        if (S[i] == '.') {
            nw--;
        }
        else {
            nb++;
        }
        ans = min(ans, nw + nb);
    }

    cout << ans << LF;

    return 0;
}


Measured memory_bytes: 720
import sys
n = int(input())
a = []
visited = []
for _ in range(n):
  a.append(int(input()))
  visited.append(0)
  
ans = 0
c = 0

for i in range(n):
  ans += 1
  visited[c] = 1
  c = a[c]-1
  if c == 1:
    print(ans)
    sys.exit()
  elif visited[c] == 1:
    break
print(-1)

Measured memory_bytes: 85888
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  for (int i = 0;i < N;i++){
    cin >> vec.at(i);
  }
  vector<int> check(N);
  for (int j = 0;j < M;j++){
    int A, B;
    cin >> A >> B;
    if (vec.at(A - 1) > vec.at(B - 1)){
      check.at(B - 1) = 1;
    }
    else if(vec.at(A - 1) == vec.at(B - 1)){
      check.at(A - 1) = 1;
      check.at(B - 1) = 1;
    }
    else if(vec.at(A - 1) < vec.at(B - 1)){
      check.at(A - 1) = 1;
    }  
  }
  int count = 0;
    for (int n = 0;n < N;n++){
      if (check.at(n) == 0)
        count++;
    }
  cout << count << endl;
}
     

Measured memory_bytes: 4048
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define rep(i,a,b) for(int i = a; i <= b;i++)


int main(void){
  long long int x;
  scanf("%lld",&x);
  long long int year = 0;
  long long int money = 100;
  while(money < x){
    year ++;
    money += money/100;
  }
  printf("%lld",year);

  return 0;
}


Measured memory_bytes: 1732