akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};

int main() {

	string s;
	cin>>s;
	cout<<s[0]<<s[1]<<s[2]<<endl;

	return 0;
}


Measured memory_bytes: 3536
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end
a, b, k = gets_i_list

ans = []

a.upto(a + k -1) do |i|
  if i <= b
    ans.push i
  end
end

(b - k + 1).upto(b) do |i|
  if i >= a
    ans.push i
  end
end

ans.uniq.sort.each do |i|
  puts i
end

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


int main()
{
  ll a, b, k;
  cin >> a >> b >> k;
  if (k <= a)
    cout << a - k << ' ' << b << endl;
  else if (k <= a + b)
    cout << 0 << ' ' << a + b - k << endl;
  else
    cout << "0 0" << endl;
  return 0;
}

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

 using namespace std;
 typedef long long ll;

 int main() {
   int N;
   string S;

   cin >> N >> S;

   vector<int> count(26);

   for (int i = 0; i < N; i++) {
     count.at((int)(S.at(i) - 'a'))++;
   }

   ll ans = 1;
   int div = 1000000007;

   for (int i = 0; i < 26; i++) {
     ans *= count.at(i) + 1;
     ans %= div;
   }

   cout << ans - 1 << endl;
 }


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String word = scan.nextLine();
            for(int x = 0; x < word.length(); x++){
                char c = word.charAt(x);
                if(Character.isLetter(c)){
                    if(Character.isLowerCase(c)){
                        System.out.print(Character.toUpperCase(c));
                    }
                    else{
                        System.out.print(Character.toLowerCase(c));
                    }
                }
                else{
                    System.out.print(c);
                }
                if(x == word.length() - 1){
                    System.out.println();
                }
            }
    }
}


Measured memory_bytes: 26944
n=int(input())
a=list(map(int,input().split()))
count=0
ans=0
for i in range(30):
    for i in range(n):
        if a[i]%2==0:
            a[i]=a[i]//2
            count+=1
        else:
            count=0
            break
    
    if count!=0:
        ans=count//n
    
print(ans)

Measured memory_bytes: 3064
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
import heapq

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
uvw = [LIST() for _ in range(N-1)]

graph = defaultdict(list)
for u, v, w in uvw:
	graph[u-1].append((v-1, w))
	graph[v-1].append((u-1, w))


color = [0] *  N
color[0] = 1
def DFS(node):
	for i, w in graph[node]:
		if not color[i]:
			if w % 2 == 0:
				color[i] = color[node]
			else:
				color[i] = color[node] * (-1)
			DFS(i)

DFS(0)
for c in color:
	if c == 1:
		print(0)
	elif c == -1:
		print(1)
	else:
		print("HOGE")


Measured memory_bytes: 108088
/**
 * Я слил Atcoder Beginner Contest 172, решив всего две задачи!
 * Я не могу апнуть синего!
 * Я постоянно сливаю раунды, либо не решив тупую задачу, либо набрав штрафа!
 * Я постоянно уступаю всем своим друзьям и знакомым в контестах и нахожу этому оправдания!
 * Я постоянно придумываю сложные неверные решения к простым задачам!
 * -------------------------------------------------------------
 * -Решать сложные задачи
 * -Участвовать в контестах
 * -Делать виртуальные соревнования
 * -------------------------------------------------------------
 * Не уберу это, пока не начну нормально решать задачи, а не заниматься ерундой!!!
**/
  
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

typedef long long  ll;
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<endl; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define halt {cout<<"NO"; return 0;}
const ll MOD = 1e9 + 7;
const ll MOD1 = 998244353;
const int N = 200010;
const int INF = 1e8;
const ll LL_INF=1e10;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// Template functions
string bin_rep(ll n)
{
     string s="";
      for(int i=63;i>=0;i--)
   {
           if(n&(1LL<<i)) s+='1';
           else s+='0';
   }
   return s;
}
int first_bit(int n)
{
  for(int i=0;i<=31;i++)
   {
           if(n&(1<<i)) return i;
   }
}

//------------------------------

int main()
{
    #if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 int n;
 cin>>n;
 vector<int> v(n+1,0);
 for(ll i=1;i<=n;i++)
 {
           if(i*i>n) break;
           for(ll j=1;j<=n;j++)
           {
                     if(i*j>n || i*i>n || j*j>n) break;
                     for(ll k=1;k<=n;k++)
                     {
                               ll val=i*i+j*j+k*k+i*j+i*k+j*k;
                               if(val>n) break;
                              // cout<<val<<" ";
                               v[val]++;
                     }
           }
 }
 for(int i=1;i<=n;i++) cout<<v[i]<<endl;

 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

Measured memory_bytes: 3648
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int t = sc.nextInt();
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = Integer.parseInt(sc.next());
			int[] b = new int[n]; Arrays.fill(b, 0);
			int[] c = new int[n]; Arrays.fill(c, 0);
			PriorityQueue<Integer> alr = new PriorityQueue<Integer>();
			int count = 0; int max = 0; int dis = 0; int ans = 0;
			for (int i = n-1; i >= 0; i--) {
				if(max < a[i]) {
					count = 1;
					max = a[i];
				}else if(max == a[i]){
					count++;
				}else {
					b[i] = max;
					c[i] = count;
					dis = Math.max(max-a[i], dis);
				}
			}
			for (int i = 0; i < n; i++) {
				if(alr.isEmpty()) {
					if(b[i]-a[i] == dis) {
						alr.add(b[i]);
						ans += c[i];
					}
				}else {
					if((b[i]-a[i]==dis)&&!(alr.peek() == b[i])) {
						alr.add(b[i]);
						ans += c[i];
					}
				}
			}
			System.out.println(ans);
			sc.close();
		}catch (OutOfMemoryError e) {
			System.out.println(-1);
		}

	}
}

Measured memory_bytes: 48380
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <math.h>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll INF = 1000000000000000000LL;
using namespace std;

const int MOD = 1000000007;

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

    vector <ll> a(N);
    vector <ll> cnt(61, 0);
    REP(i,N)
    {
        cin >> a[i];
        for(ll bit = 0; bit <= 60; ++bit)
        {
            if(a[i] & (1LL << bit))
            {
                ++cnt[bit];
            }
        }
    }

    ll res = 0;
    for(ll bit = 0; bit <= 60; ++bit)
    {
        ll bai = (1LL << bit) % MOD;
        ll num = cnt[bit] * (N - cnt[bit]) % MOD;
        //cout << bit << " " << bai << " " <<  num << endl;
        res += bai * num;
        res %= MOD;
    }
    cout << res << endl;

    return 0;

}


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

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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        m: i64,
        ab: [(i64, i64); n],
    }
    let mut ab = ab;
    ab.sort();
    let mut tot = 0;
    let mut rem = m;
    for (a, b) in ab {
        let c = min(rem, b);
        tot += a * c;
        rem -= c;
        if rem == 0 { break; }
    }
    puts!("{}\n", tot);
        
}

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


Measured memory_bytes: 10492
pub fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();
    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    let xs = line.trim().split_whitespace();
    let mut result = Vec::new();

    for x in xs {
        let ans = x.parse::<T>().map_err(|_| format!("{}", "parse error"))?;
        result.push(ans);
    }
    Ok(result)
}

fn main() {
    loop {
        let (h, w) = read_parameters::<usize>().map(|xs| (xs[0], xs[1])).unwrap();
        if h == 0 && w == 0 {
            break;
        }
        let mut s = String::new();
        for _ in 0..w {
            s = s + "#";
        }
        for _ in 0..h {
            println!("{}", s);
        }
        println!("");
    }
}



Measured memory_bytes: 5036
using System;

namespace ABC090B
{
    class Program
    {
        static void Main(string[] args)
        {
            var target = Console.ReadLine().Split(' ');
            int a = int.Parse(target[0]);
            int b = int.Parse(target[1]);
            int count = 0; 
            for(int i = a; i <= b; i++){
                if(kai(i)) count++;
            }    
            Console.WriteLine(count);
        }
        public static Boolean kai(int x){
            string tmp = "";
            while(x > 0){
                tmp += (x % 10).ToString();
                x /= 10;
            }
            char[] c = tmp.ToCharArray();
            string a = new string(c);
            Array.Reverse(c);
            string rev = new string(c);
            if(a == rev) return true;
            else return false;
        }
    }
}


Measured memory_bytes: 17336
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		for (int i=0;i<=N;i++) {
			if ((int)(i*1.08)==N) {
				System.out.println(i);
				return ;
			}
		}
		System.out.println(":(");
	}
}


Measured memory_bytes: 35360
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


const int N = 2e5 + 100;

int P[N];

int main(){
	fio; cout<<fixed<<setprecision(25);	
	
	int n; cin >> n;
	int mn = N;
	int cnt = 0;
	for(int i =1 ;i <= n; ++i){
		cin >> P[i];
		mn = min(mn , P[i]);
		if(mn >= P[i])
			++cnt;
	}
	cout << cnt << endl;





	return 0;
}


Measured memory_bytes: 1024
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,t = inpl()
wv = [inpl() for _ in range(n)]
wv.sort(key = lambda x:x[1],reverse = True)
res = 0
for i in range(min(n,3)):
    dp = [[0] * (t+5) for _ in range(n+5)]
    for j in range(n):
        w,v = wv[j]
        for k in range(t):
            if k < w or i == j:
                dp[j+1][k] = dp[j][k]
            else:
                dp[j+1][k] = max(dp[j][k], dp[j][k-w] + v)
    # print(dp[n][t-1])
    res = max(dp[n][t-1] + wv[i][1], res)
print(res)

Measured memory_bytes: 259056
#include <bits/stdc++.h>
using namespace std;
int main() {
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int n;
     cin>>n;
     if(n%1000==0)
     cout<<"0";
     else if(n<1000)
     cout<<1000-n;
     else
     cout<<(n/1000+1)*1000-n;
     return 0;
}


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

using namespace std;


int main(int argc, char *argv[])
{
    
    
    
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    
    int n, score1 = 0, score2 = 0;
    string word1, word2;
    
    cin >> n;
    
    while(n--){
        cin >> word1 >> word2;
        if (word1 == word2) {
            score1 += 1;
            score2 += 1;
        }
        score1 += word1 > word2 ? 3:0;
        score2 += word2 > word1 ? 3:0;
    }
    cout << score1 << " " << score2 << endl;
    return 0;
}



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

int h, w, ar[15];
bool used[15], ev;
char s[12][12];

inline bool isRev(char a[], char b[]) {
	for (int i = 0; i < h; i++)if (a[i] != b[h - 1 - i])return false;
	return true;
}

bool dfs(int p, int n, int e) {
	if (e) {
		for (int i = 0; i < h; i++) {
			used[i] = true; ar[h / 2] = i;
			if (dfs(0, 0, 0))return true;
			used[i] = false;
		}
		return false;
	}
	else if (n != h / 2) {
		while (used[p])p++;
		for (int i = p + 1; i < h; i++)if (!used[i]) {
			used[i] = true;
			ar[n] = p; ar[h - 1 - n] = i;
			if (dfs(p + 1, n + 1, 0))return true;
			used[i] = false;
		}
		return false;
	}
	else {
		char tmp[15][15];
		bool u[15] = {}, ev = !(w % 2);
		for (int i = 0; i < w; i++)for (int j = 0; j < h; j++)tmp[i][j] = s[ar[j]][i];
		for (int i = 0; i < w; i++){
			for (int j = i + 1; j < w && !u[i]; j++)if (!u[j]) {
				u[i] = u[j] = isRev(tmp[i], tmp[j]);
			}
			if (!u[i] && !ev)u[i] = ev = isRev(tmp[i], tmp[i]);
			if (!u[i])return false;
		}
		return true;
	}
}

int main() {
	scanf("%d%d", &h, &w);
	for (int i = 0; i < h; i++)scanf("%s", s[i]);
	puts(dfs(0, 0, h % 2) ? "YES" : "NO");

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
long long n,a,b;
int main()
{
    scanf("%lld%lld%lld",&n,&a,&b);
    long long ans=n/(a+b)*a+(n%(a+b)>=a?a:n%(a+b));
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll n,w;
	rl2(n,w);
	VL wt(n),val(n);
	fr(i,0,n)
	{
		rl2(wt[i],val[i]);
	}
	ll k[n+1][w+1];
	fr(i,0,n+1)
	{
		fr(j,0,w+1)
		{
			if(i==0||j==0)
				k[i][j]=0;
			else if(wt[i-1]<=j)
			{
				k[i][j]=max(val[i-1]+k[i-1][j-wt[i-1]],k[i-1][j]);
			}
			else
				k[i][j]=k[i-1][j];

		}
	}
	wl(k[n][w]);
	NL;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 79104
if __name__ == '__main__':
    L = ['dream', 'dreamer', 'erase', 'eraser']
    S = input()
    n = len(S)

    while True:
        if S[-7:] == 'dreamer':
            n -= 7
            S = S[:-7]
        elif S[-6:] == 'eraser':
            n -= 6
            S = S[:-6]
        elif S[-5:] == 'dream' or S[-5:] == 'erase':
            n -= 5
            S = S[:-5]
        else:
            break
    if len(S) == 0:
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define orep(i, n) for(int i = 1; i < (int)(n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main() {
    int n;
    cin >> n;
    cout << n * n << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <vector>

int main()
{
    int input_size;
    scanf("%d", &input_size);
    std::vector<int> data(input_size);
    for(int i = 0; i < data.size(); i++) {
        scanf("%d", &data[i]);
    }
    for(int i = 0; i < data.size(); i++) {
        printf("node %d: ", i + 1);
        printf("key = %d, ", data[i]);
        if(i != 0) {
            printf("parent key = %d, ", data[(i + 1) / 2 - 1]);
        }
        if(2 * i + 1 < data.size()) {
            printf("left key = %d, ", data[2 * i + 1]);
        }
        if(2 * i + 2 < data.size()) {
            printf("right key = %d, ", data[2 * i + 2]);
        }
        putchar('\n');
    }
}

Measured memory_bytes: 2672
n, m, x = map(int, input().split())
al = []
cl = []
for i in range(n):
    al.append(list(map(int, input().split())))
    cl.append(al[i].pop(0))

ans = []
for i in range(2**n):
    books = []
    for j in range(n):
        if i>>j & 1:
            books.append(j)

    a = True
    for alg in range(m):
        und = 0
        for b in books:
            und += al[b][alg]
        if und < x:
            a = False
            break
    if a:
        cost = 0
        for b in books:
            cost += cl[b]
        ans.append(cost)

if len(ans) != 0:
    print(min(ans))
else:
    print(-1)

Measured memory_bytes: 9164
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		while (n != 0) {
			int[][] num_i = new int[n + 1][n + 1];
			int[] sum_line = new int[n + 1];
			int[] sum_column = new int[n + 1];
			int total = 0;
			for (int i = 0; i < n; i++) {
				String readLine = sc.nextLine();
				String[] num_s = readLine.split(" ");
				for (int j = 0; j < n; j++) {
					int a = Integer.parseInt(num_s[j]);
					num_i[i][j] = a;
					sum_line[i] += a;
				}
				num_i[i][n] = sum_line[i];
				total += sum_line[i];
			}
			num_i[n][n] = total;
			for (int k = 0; k < n; k++) {
				for (int l = 0; l < n; l++) {
					sum_column[k] += num_i[l][k];
				}
				num_i[n][k] = sum_column[k];
			}
			
			for (int x = 0; x < n + 1; x++) {
				StringBuilder sb = new StringBuilder();
				for (int y = 0; y < n + 1; y++) {
					String s = "" + num_i[x][y];
					while (s.length() != 5) {
						s = " " + s;
					}
					sb.append(s);
				}
				System.out.println(sb);
			}
			n = Integer.parseInt(sc.nextLine());
		}
	}
}


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

int main(void){
    char moji[] = "aeiou";
    string s;
    cin >> s;
    int check = 0;
    for(int i = 0; i < 5; i++){
        if(s[0] == moji[i])
            check++;
    }
    if(check != 0)
        cout << "vowel" << endl;
    if(check == 0)
        cout << "consonant" << endl;
    return 0;
}

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

#define LL long long int
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define mp make_pair
#define FOR(i, n) for(i = 0; i < n; ++i)
typedef vector <int> vi;
typedef vector <LL> vll;
typedef pair<LL, LL> iPair;
const int MOD = 1e9+7;

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

    LL t = 1;
    LL i,j;
    // cin>>t;
    
    while(t--)
    {
        string s;
        cin>>s;
        int ans = 0;
        string prev;
        for(int i =0; i < s.length(); )
        {
            if(prev.length() != 1 || prev[0] != s[i]) {ans++;  prev = s[i];i++;}
            else
            {
                if(i != (s.length()-1))
                {
                    ans++;
                    prev = s[i];
                    prev += s[i+1];
                    // cout<<prev<<endl;
                    i += 2;
                }
                else
                {
                     i++;
                }
                
            }
            
        }
        cout<<ans;
    }

	return 0;
}


Measured memory_bytes: 720
// at_abc156b.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
int main()
{
    int n, k;cin >> n >> k;
    int Count = 0;
    while (n != 0) {
        n /= k;
        Count++;
    }
    cout << Count << "\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int R = 0;
  int G = 0;
  
  cin >> R;
  cin >> G;
  if ((( 0 <= R ) && ( R <= 4500 )) &&
      (( 0 <= G ) && ( G <= 4500 )))
  {
    cout << R + (G-R)*2 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N;
	int i;
	long long int sum = 0;
	scanf("%d", &N);
	
	for(i = 1; i <= N; i++){
		if(!(i % 3 == 0 || i % 5 == 0)){
			sum = sum + i;	
		}
	}
	printf("%lld", sum);
	
	return 0;
}

Measured memory_bytes: 1692
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int h,ans=1;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>h;
	while(ans<=h)
	{
		ans<<=1;
	}
	cout<<ans-1;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <deque>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

struct Water {
    double t; int v;
};

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

    int n, l;
    cin >> n >> l;
    deque<Water> q;
    double s = 0;
    q.push_back({ 0, l });

    for (int i = 0; i < n; i++) {
        int t, v;
        cin >> t >> v;
        for (int k = v;;) {
            auto& o = q.front();
            if (o.v <= k) {
                k -= o.v;
                s -= o.t * o.v;
                q.pop_front();
                if (k == 0) break;
            } else {
                o.v -= k;
                s -= o.t * k;
                break;
            }
        }
        double x = t;
        s += x * v;
        for (;;) {
            if (q.empty()) {
                q.push_back({ x, v });
                break;
            }
            auto& o = q.back();
            if (x > o.t) {
                q.push_back({ x, v });
                break;
            } else {
                x = (x * v + o.t * o.v) / (v + o.v);
                v += o.v;
                q.pop_back();
            }
        }
        cout << fixed << setprecision(9) << s / l << '\n';
    }

    return 0;
}

Measured memory_bytes: 18192
import sys
input=sys.stdin.readline
def is_prime(n):
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            return False
            exit()
    return True

L=[0]*(10**5+1)
cnt=0
for i in range(3,10**5+1):
    if is_prime(i) and is_prime((i+1)//2):
        cnt+=1
    L[i]=cnt

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

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
// #define push push_back
// #define pop pop_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> prii;
// typedef string str;

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    int N, W;
    cin >> N >> W;

    int v[101], w[101];
    REP(i, 1, N+1) {
        cin >> v[i] >> w[i];
    }

    int dp[10001][101] = {0};
    REP(i, 1, W+1) {
        REP(j, 1, N+1) {
            dp[i][j] = dp[i][j-1];
            if(i - w[j] >= 0) {
                dp[i][j] = max(dp[i][j-1], dp[i - w[j]][j-1] + v[j]);
            }
        }
    }

    // rep(i, W+1) {
    //     rep(j, N+1) {
    //         cout << dp[i][j] << " ";
    //     } cout << endl;
    // } cout << endl;

    cout << dp[W][N] << endl;

    return 0;
}



Measured memory_bytes: 7088
#include <stdio.h>


int main(){

	int N;

	scanf("%d",&N);

	int i;

	int ans=0;

	for(i=0;i<N;i++){
	int l,r;
	scanf("%d %d",&l,&r);
	ans+=r-l+1;
	}
	printf("%d\n",ans);


return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.Math;

public class Main {
    public static void main(String[] args) throws IOException {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        double r = Double.parseDouble(br.readLine());
        
        double area = Math.PI * (r * r);
        double circumference = 2 * (Math.PI * r);
        
        System.out.printf("%6f %6f", area, circumference);
    }
}

Measured memory_bytes: 24864
#include<stdio.h>
int main(void)
{
	int i,j;
	char a;
	a='x';
	for(i=1;i<=9;i++){
		for(j=1;j<=9;j++){
			printf("%d%c%d=%d\n",i,a,j,i*j);
		}
	}
return 0;
}


Measured memory_bytes: 2036
program main
  implicit none
  integer :: n, i, res
  integer, allocatable :: v(:), c(:)
  read (*, *) n
  allocate (v(n), c(n))
  read (*, *) (v(i), i = 1, n)
  read (*, *) (c(i), i = 1, n)
  res = 0
  do i = 1, n
    res = res + max(0, v(i) - c(i))
  end do
  write (*, "(i0)") res
end program main


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
const int Mod = 1e9 + 7;

int n, m;
long long f[2003][2003];
int s[10004], t[10004];

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        scanf("%d", s + i);
    for (int i = 1; i <= m; ++i)
        scanf("%d", t + i);
    f[0][0] = 1;
    for (int i = 0; i <= n; ++i)
        f[i][0] = 1;
    for (int i = 0; i <= m; ++i)
        f[0][i] = 1;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            (f[i][j] += (f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1]) % Mod) %= Mod;
            if (s[i] == t[j])
                (f[i][j] += f[i - 1][j - 1]) %= Mod;
        }
    }
    
    cout << (f[n][m] % Mod + Mod) % Mod << endl;
    return 0;
}


Measured memory_bytes: 31616
#include<iostream>
#include<vector>
#include<queue>

using namespace std;

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

typedef pair<int, pair<int, bool> > data;

int main() {
  while (true) {
    int n, m;
    cin >> n >> m;
    if (n == 0 && m == 0) break;
    vector<vector<pair<int, int> > > edge(n);
    rep (i, m) {
      int a, b, c;
      cin >> a >> b >> c;
      --a, --b;
      edge[a].push_back(make_pair(c, b));
      edge[b].push_back(make_pair(c, a));
    }
    vector<vector<int> > free(n);
    rep (i, n) rep (j, edge[i].size()) rep (k, edge[edge[i][j].second].size()) {
      free[i].push_back(edge[edge[i][j].second][k].second);
    }
    vector<int> cost[2];
    rep (j, 2) rep (i, n) cost[j].push_back(1000000000);
    priority_queue<data, vector<data>, greater<data> > que;
    que.push(make_pair(0, make_pair(0, false)));
    while (!que.empty()) {
      data now = que.top();
      que.pop();
      if (cost[now.second.second][now.second.first] <= now.first) continue;
      cost[now.second.second][now.second.first] = now.first;
      //cout << now.second.first << " " << now.first << " " << now.second.second << endl;
      rep (i, edge[now.second.first].size()) {
	que.push(make_pair(now.first + edge[now.second.first][i].first, make_pair(edge[now.second.first][i].second, now.second.second)));
      }
      if (now.second.second) continue;
      rep (i, free[now.second.first].size()) {
	que.push(make_pair(now.first, make_pair(free[now.second.first][i], true)));
      }
    }
    cout << min(cost[0][n - 1], cost[1][n - 1]) << endl;
  }
  return 0;
}

Measured memory_bytes: 1252
#include<stdio.h>
#define N 1000

int n,A[N],B[N],C[N],con,res,min;

void swap(int* A,int* B)
{
  int ch;
  ch=*A;
  *A=*B;
  *B=ch;
}
int small(int a,int b)
{
  if(a<b)return a;
  else return b;
}

int search(int a)
{
  int i;
  for(i=0; i<n; i++){
    if(A[i]==a)return i;
  }
}

int main()
{
  int i,j,sum=0,p;

  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%d",&A[i]);
    B[i]=A[i];
  }

  for(i=n-1; i>0; i--){
    for(j=0; j<i; j++){
      if(B[j]>B[j+1]) swap(&B[j],&B[j+1]);
    }
  }

  for(i=0; i<n; i++)C[i]=0;

  for(i=0; i<n; i++){
    p=i;
    con=res=0;
    min=(1<<24);

    while(C[p]==0){
      C[p]=1;
      con++;
      res+=A[p];
      min=small(min,A[p]);
      p=search(B[p]);
    }

    if(con<2)continue;
    sum+=small(res+B[0]*(con+1)+min,res+min*(con-2));
  }

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



Measured memory_bytes: 2096
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,i,a[100010];
  int *r;
  cin >> n;
  for (i=0;i<n;i++) cin >> a[i];
  sort(a,a+n);
  cout << a[n-1] << ' ';
  r=lower_bound(a,a+n,a[n-1]/2)-1;
  if (r[0]+r[1] > a[n-1] || r[1]==a[n-1]) cout << r[0] << endl;
  else cout << r[1] << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    int A, B, C;
    cin >> A >> B >> C;

    if ((A == B and B != C) or (A == C and B != C) or (B == C and A != B)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){

	int month,day;
	int sn;
	int i;
	int ofs_30[12]={
	1,-1,1,0,1,0,1,1,0,1,0,1
		};
	char *wd[7]={
			"Thursday",
			"Friday",
			"Saturday",
			"Sunday",
			"Monday",
			"Tuesday",
			"Wednesday"
			};
	
	while(scanf("%d %d",&month,&day)!=EOF){
	
		if(month==0)break;
		sn=(month-1)*30+day-1;
		for(i=0;i<month-1;i++)sn+=ofs_30[i];
		sn%=7;
		
		if(month)printf("%s\n",wd[sn]);	
	}

	return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            String str = sc.next();
            if(str.equals("0")) break;
            char[] a = new char[str.length()];
            int sum = 0;
            for(int i=0;i<str.length();i++){
                a[i] = str.charAt(i);
                int b = a[i] - '0';
                sum +=b;
            }
            System.out.println(sum);
        }
        sc.close();
    }
}


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

long long MOD = 1000000007;

int main(){
    long long N, K;
    cin >> N >> K;
    long long sum=0, SUM=0;
    for(long long i = 1; i <= K; i++){
        sum += (i-1);
        SUM += N-(i-1);
    }
    long long ans=0;
    for(long long k=K; k<=N+1; k++){
        ans = (ans+SUM - sum + 1)%MOD;
        sum += k;
        SUM += N-k;
    }
    cout << ans << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 3700
n, m = map(int, input().split())
used = []
for i in range(n+1):
    # visited, pv, cost
    used.append([False, None])
path = []
for i in range(n+1):
    path.append([])
for i in range(m):
    a, b = map(int, input().split())
    path[a].append(b)
    path[b].append(a)

import collections
q = collections.deque([])
q.append([1, -1, 0])
#print(path)
while len(q) > 0:
    #print("qu", q)
    curroom, pv, cost = q.popleft()
    #print("visit", curroom, used)
    #print(" > path", path[curroom])
    if used[curroom][0] is True:
        continue
    used[curroom][0] = True
    used[curroom][1] = pv
    for i in range(len(path[curroom])):
        nextroom = path[curroom][i]
        #print(" >> path[{0}] = {1}".format(path[curroom][i], nextroom))
        #print(" >>>>", used[nextroom])
        if used[nextroom][0] is True:
            #print(" >>!!visited")
            continue
        q.append([nextroom, curroom,cost])

#print(used)


can = True # 判定
for i in range(1, n+1):
    x,y = used[i]
    if x is False:
        can = False

if can is False:
    print("No")
else:
    print("Yes")
    for i in range(2, n+1):
        print(used[i][1])



Measured memory_bytes: 121836
def main():
    mod = 10**9+7
    #n,a = get_input()
    n = int(input())
    a = [int(x) for x in input().split()]
    ans = 0
    asum = sum(a) 
    for i in range(n):
        asum = asum - a[i]
        ans = ( ans + ((a[i] * asum) % mod)) % mod
    
    print(ans)
    
if __name__ == '__main__':
    main()

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 4001
#define int ll
int N;
string S;

map <char,int> idx = {{'R',0},{'G',1},{'B',2}};

int dp[maxn][(1<<4)];

int dpf(int i,int bm){
	if (dp[i][bm] != -1) return dp[i][bm];
	
	if (bm == (1<<3) - 1) return 1;
	if (i == N) return 0;
	
	if (bm & (1<<idx[S[i]])) dp[i][bm] = dpf(i + 1, bm);
	else dp[i][bm] = dpf(i + 1,bm) + dpf(i + 1, bm | (1<<idx[S[i]]));
	
	return dp[i][bm];
}

int32_t main(){
	fast;
	
	cin>>N>>S;
	
	mem(dp,-1);
	
	
	
	int ans = dpf(0,0);
	
	FOR(i,0,N-1){
		FOR(j,i+1,N-1){
			if (S[i] == S[j]) continue;
			
			int k = j + (j - i);
			
			if (k < N && S[k] != S[i] && S[k] != S[j]){
				//cout<<i<<' '<<j<<' '<<k<<'\n';
				ans--;
			}
		}
		
	}
	
	cout<<ans;
				
}



Measured memory_bytes: 4384
use std::io::{Read, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    let mut iter = input.split_whitespace();

    for i in 1.. {
        let x = iter.next().unwrap();
        if x=="0" {
            break;
        }
        out.write_fmt(format_args!("Case {}: {}\n", i, x)).unwrap();
    }

}



Measured memory_bytes: 5024
/*Ph@n^0m Dec0d3r*/
/*----------------*/
/* 	^_HAR HAR MAHADEV_^
   	|Om namah shivaya|
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define fast std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define pb(temp) push_back(temp)
#define mp make_pair
#define mod (ll)1000000007
//using namespace boost::multiprecision;
using namespace std ;
typedef unsigned long long int ulli;

ulli gcd(ulli x,ulli y) {
	if(x==0) return y;
	return gcd(y%x,x);
}
ulli factorial(ulli n) {
	if (n == 0)
		return 1;
	return n * factorial(n - 1);
}
ll findS(ll s) {
	return (sqrtl(8*s + 1) - 1)/2;
}
ll prime(ll a) {
	if(a==1)return 0;
	if(a==2 || a==3)return true;
	if(a%2==0 ||a%3==0)return 0;
	for(ll i=5; i<=sqrt(a); i+=6)
		if(a%i==0 || a%(i+2)==0)
			return 0;

	return 1;
}
ll power(ll x,ll y) {
	if (y == 0)
		return 1;
	ll p = power(x, y/2) % mod;
	p = (p * p) % mod;

	return (y%2 == 0)? p : (x * p) % mod;
}
ll powermod(ll x,ll y) {
	ll res = 1;
	x = x % mod;
	while (y > 0) {
		if (y & 1)
			res = (res*x) % mod;
		y = y>>1;
		x = (x*x) % mod;
	}
	return res;
}
ll nCr(ll n,ll k) {
	ll C[k+1];
	//memset(C, 0, sizeof(C));

	C[0] = 1;

	for (ll i = 1; i <= n; i++) {
		for (ll j = min(i, k); j > 0; j--)
			C[j] = (C[j] + C[j-1])%(ll)(1e9 + 7);
	}
	return C[k];
}
ll LOGN(ll n , ll r) {
	return (n > r-1) ? (1 + LOGN(n / r , r)) : 0 ;
}
void dfs(vector<ll> v[], bool visited[], ll current_node) {
	visited[current_node]=true;
	for(ll nxt_node : v[current_node]) {
		if(visited[nxt_node]==false) {
			dfs(v , visited, nxt_node);
		}
	}
	return;
}

void bfs(vector<ll> v[], bool visited[], ll root) {

	int current_node;
	queue<int> q;

	q.push(root);

	while(!q.empty()) {

		current_node=q.front();

		visited[current_node]=true;

		for(int x:v[current_node])
			if(!visited[x])
				q.push(x);
	}
}
ll computeXOR(ll n) {
	switch(n & 3) {
		case 0:
			return n;
		case 1:
			return 1;
		case 2:
			return n + 1;
		case 3:
			return 0;
	}
}
int maxSubArraySum(int a[], int size) {
	int max_so_far = a[0];
	int curr_max = a[0];
	for (int i = 1; i < size; i++) {
		curr_max = max(a[i], curr_max+a[i]);
		max_so_far = max(max_so_far, curr_max);
	}
	return max_so_far;
}
int main() {
	fast;
	ll a , b , k ;
	cin >> a >> b >> k ;
	if(k >= a+b) {
		cout << "0" << " 0" ;
	} else if(k >= a && k < (a+b)) {
		cout << "0 " << b-k+a ;
	} else {
		cout << a-k << " " << b ;

	}
}


Measured memory_bytes: 256
// AOJ 0241
#include <iostream>
#include <cmath>

using namespace std;

int data[4][4] = {{1, 2, 3, 4},
				  {2, -1, 4, -3},
				  {3, -4, -1, 2},
				  {4, 3, -2, -1}};

int main()
{
	int n;
	while (cin >> n, n){
		while (n--){
			int num1[4][2], num2[4][2];
			for (int i = 0; i < 4; i++){
				cin >> num1[i][0];
				num1[i][1] = i;
			}
			for (int i = 0; i < 4; i++){
				cin >> num2[i][0];
				num2[i][1] = i;
			}
			int ret[4] = {};
			for (int i = 0; i < 4; i++){
				for (int j = 0; j < 4; j++){
					int t = data[num1[i][1]][num2[j][1]];
					int tmp = num1[i][0] * num2[j][0];
					// cout << t << endl;
					if (t < 0){
						ret[(int)(abs(t) - 1)] -= tmp;
					}
					else {
						ret[(int)(abs(t) - 1)] += tmp;
					}
				}
			}
			for (int i = 0; i < 4; i++){
				cout << ret[i] << (i + 1 == 4 ? '\n' : ' ');
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1160
N,K = list(map(int,input().split()))
H = [int(input()) for _ in range(N)]
H.sort()
min=10**9
for i in range(N+1-K):
    if(min>H[i+K-1]-H[i]):
        min=H[i+K-1]-H[i]
print(min)


Measured memory_bytes: 7444
from bisect import bisect_right

sum_list = []
nm = 1
sm = 1
while sm <= 10**8:
    sum_list.append(sm)
    nm += 1
    sm += nm
    
n = int(input())

k = bisect_right(sum_list, n)

ans_set = set([i for i in range(1,k+2)])
ans_set.remove(sum_list[k] - n)
ans = list(ans_set)

for a in ans:
    print(a)

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

int main(){
int n;
cin>>n;
long long s=0;
  for(int i=1;i<n+1;i++){
    if(!(i%3==0 ||i%5==0)){
      s += i;
    }
  }
 cout << s << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    rep(i, 1, n){
        if(a[i] == a[i-1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


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

using namespace std;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int n;
string s;
map<string, int> cnt;
int main() {
    
    cin >> n;
    
    for (int i = 1; i <= n; i++) {
        cin >> s;
        cnt[s]++;
    }
    
    cout << "AC x " << cnt["AC"] << endl;
    cout << "WA x " << cnt["WA"] << endl;
    cout << "TLE x " << cnt["TLE"] << endl;
    cout << "RE x " << cnt["RE"] << endl;
    
    return 0;
}


Measured memory_bytes: 3612
n,m,x,y = map(int,input().split())
xn = list(map(int,input().split()))
ym = list(map(int,input().split()))

c = []
for i in range(x+1,y+1):
    cnt = 0
    for j in range(n):
        if xn[j] < i:
            cnt += 1

    for j in range(m):
        if ym[j] >= i:
            cnt += 1
    c.append(cnt)
    
if n+m in c:
    print('No War')
else:
    print('War')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define N 1000010
using namespace std;
int cnt=0;
void insertionSort(int *A,int n,int g){
  for(int i=g;i<n;i++){
    int v = A[i];
    int j = i - g;
    while(j>=0 && A[j]>v){
      A[j+g] = A[j];
      j = j - g;
      cnt++;
    }
    A[j+g] = v;
  }
}
 
 
 
void shellSort(int *A,int n){
  cnt = 0 ;
  int m = 1;//
  int G[25] = {1};
  for(int i=1;G[i-1]*2<=n;i++)G[i] = G[i-1]*2,m++;
  for(int i=0;i<m;i++) insertionSort(A,n,G[m-1-i]);
   
  cout<<m<<endl;
  for(int i=0;i<m;i++){
    if(i)printf(" ");
    printf("%d",G[m-1-i]);
  }
  cout<<endl;
}
 
int main(){
  int n,A[N];
  cin>>n;
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
   
  shellSort(A,n);
   
  cout<<cnt<<endl;
  for(int i=0;i<n;i++) printf("%d\n",A[i]);
   
  return 0;
}


Measured memory_bytes: 7200
s=input()
L=len(s)

for i in range(L):
    if i<L-1 and s[i]==s[i+1]:
        print(i+1,i+2)
        break
    if i<L-2 and s[i]==s[i+2]:
        print(i+1,i+3)
        break

else:
    print(-1,-1)

Measured memory_bytes: 3188
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int n = Integer.parseInt(sc.next());
int[] a=new int[n];
    for (int i = 0; i < n; i++) {
        a[i]=Integer.parseInt(sc.next());
    }
Arrays.sort(a);
    out.println(a[n-1]-a[0]);
}
}

Measured memory_bytes: 21716