akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int X,Y,Z;
int V[5];
int Me[65];
int Mm[65];
double dp[65][5002];
int used[65][5002];
inline int calc(int a){ return a>0?a:0; }
double solve(int id,int mon){
  if(id>=Y) return (double)mon;
  if(used[id][mon]) return dp[id][mon];
  used[id][mon]=1;
  double ret = 0.0f;
  for(int i=0;i<X;i++){
    int next = id+V[i];
    if(Me[next]!=0)
      ret += solve(next+Me[next],calc(mon))/(double)X;
    else
      ret += solve(next,calc(mon+Mm[next]))/(double)X;
  }
  return dp[id][mon] = ret;
}
int main(){
  while(1){
    memset(Mm,0,sizeof(Mm));
    memset(Me,0,sizeof(Me));
    for(int i=0;i<65;i++)for(int j=0;j<=5001;j++) dp[i][j]=0.0f;
    memset(used,0,sizeof(used));
    scanf("%d %d %d",&X,&Y,&Z);
    if(!X && !Y && !Z) break;
    for(int i=0;i<X;i++){
      scanf("%d",&V[i]);
    }
    for(int i=0;i<Z;i++){
      int N,E,A;
      scanf("%d %d %d",&N,&E,&A);
      if(E==1) Me[N]=A;
      else if(E==2) Mm[N]=A;
      else Mm[N]=-A;
    }
    printf("%d\n",(int)solve(0,0));
  }
}

Measured memory_bytes: 5004
#include <iostream>
#include <algorithm>
#include <string>

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

    while(true){
        std::string str;
        std::cin >> str;
        if(str=="-") break;
        int m;
        std::cin >> m;
        int cnt = 0;
        for(int i=0; i<m; ++i){
            int suffle;
            std::cin >> suffle;
            cnt += suffle;
        }
        int strSize = str.size();
        cnt %= strSize;
        str+=str;
        std::cout << str.substr(cnt, strSize) << "\n";
    }
    return 0;
}

Measured memory_bytes: 3160
# puts "hello world!!"
# i = 9
# if(i == 10)
#     puts "Yes"
# elsif(i == 9)
#     puts "999"
# else  
#      puts "No"
# end

# for i in 0...101
#     if(i%3 == 0 && i%5 == 0)
#         puts "FizzBuzz"
#     elsif(i%3 == 0)
#         puts "Fizz"
#     elsif(i%5 == 0)  
#          puts "Buss"
#     else
#         p i
#     end
# end

s = gets.chomp
if s >= "a"
    puts "a"
else
    puts "A"
end

Measured memory_bytes: 14400
#include<cstdio>
using namespace std;
int suu[1001][1001],c[1001],d[1001];
int main(void)
{
	int i,j,k,cnt,x,min,n,m,hiro;
	scanf("%d %d",&n,&m);
	for(i=0;i<=m;i++){
		for(j=0;j<=n;j++){
			suu[i][j]=210000000;
		}
	}
	for(i=0;i<n;i++){
		scanf("%d",&d[i]);
	}
	for(i=0;i<m;i++){
		scanf("%d",&c[i]);
	}
	suu[0][0]=0;
	for(i=0;i<m;i++){
		for(j=0;j<=n;j++){
			hiro=d[j]*c[i];
			if(suu[i+1][j]>suu[i][j]){
				suu[i+1][j]=suu[i][j];
			}
			if(suu[i+1][j+1]>suu[i][j]+hiro && j<=n){
				suu[i+1][j+1]=suu[i][j]+hiro;
			}
		}
	}
	/*for(i=0;i<=m;i++){
		for(j=0;j<=n;j++){
			printf("%8d",suu[i][j]);
		}
		printf("\n");
	}*/
	printf("%d\n",suu[m][n]);
	return 0;
}

Measured memory_bytes: 4944
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 0), 1000000001*3)
	sc.Split(bufio.ScanWords)
	n := nextInt()

	ans := 0
	aPrev := 0
	for i := 0; i < n; i++ {
		a := nextInt()
		switch {
		case a > i || a > aPrev+1:
			fmt.Println(-1)
			return
		case a == aPrev+1:
			ans++
		default:
			ans += a
		}
		aPrev = a
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1920
import java.util.Scanner;

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

        if (K == 1) {
            System.out.println(Math.abs(sc.nextInt()));
            return;
        }

        int[] candles = new int[N];

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

        int xl = Integer.MIN_VALUE;
        int xr = Integer.MAX_VALUE;

        int tmp = Integer.MAX_VALUE;
        int min = Integer.MAX_VALUE;

        for (int i = 0; i < N - K + 1; i++) {
            xl = candles[i];
            xr = candles[i+K-1];

            if (xl >= 0) {
                tmp = xr;
            } else if (xr <= 0) {
                tmp = Math.abs(xl);
            } else {
                tmp = Math.abs(xl) + xr + Math.min(Math.abs(xl), xr);
            }
            min = Math.min(min, tmp);
        }

        System.out.println(min);

    }
}


Measured memory_bytes: 50120
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{ 
	int n,a;
	cin>>n>>a;
	
	cout<<n*n-a<<endl;
	
	

}

Measured memory_bytes: 256
try:
    while True:
        n = int(input())
        if n == 0:
            break
        ika = 0
        a = list(map(int,input().split()))
        m = sum(a) / n
        for j in a:
            if j <= m:
                ika += 1 
        print(ika)
except EOFError:
    pass




Measured memory_bytes: 6612
use std::io;
use io_ext::Reader;

fn main() {
    let stdin = io::stdin();
    let mut r = Reader::new(io::BufReader::new(stdin.lock()));
    r.read_line();
    let slimes = r.read_line().as_bytes();

    let mut count: u64 = 1;
    let mut current = slimes[0];

    for &slime in &slimes[1..] {
        if slime != current {
            count += 1;
            current = slime;
        }
    }

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

/// Extension of io module.
pub mod io_ext {
    use std::io::BufRead;

    pub struct Reader<R> {
        buf: String,
        inner: R,
    }

    impl<R> Reader<R> {
        #[inline]
        pub fn new(inner: R) -> Self {
            Reader { buf: String::new(), inner: inner }
        }

        #[inline]
        pub fn into_inner(self) -> R {
            self.inner
        }
    }

    impl<R: BufRead> Reader<R> {
        #[allow(deprecated)]
        #[inline]
        pub fn read_line(&mut self) -> &str {
            self.buf.clear();
            self.inner.read_line(&mut self.buf).unwrap_or_else(|e| panic!("{}", e));
            self.buf.trim_right()
        }
    }
}

/// Module supporting to parse strings.
pub mod parse {
    use std::str::FromStr;
    use std::borrow::Borrow;

    pub trait ParseNext: Iterator {
        fn parse_next<F: FromStr>(&mut self) -> F;
    }

    impl<'a, S: Borrow<str>, I: Iterator<Item=S>> ParseNext for I {
        fn parse_next<F: FromStr>(&mut self) -> F {
            if let Some(s) = self.next() {
                match s.borrow().parse() {
                    Ok(x) => x,
                    Err(_) => panic!("provided string cannot be parsed")
                }
            } else {
                panic!("iterator has no next element")
            }
        }
    }
}


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  int one = 0;
  int zero = 0;
  for(int i=0;i<s.size();i++){
    if(s[i] == '0'){
      zero++;
    }
    else{
      one++;
    }
  }
  cout << 2*min(one,zero) << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n, m;

const int FACT_MAX = 1000005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint perm(llint n, llint k)
{
	return comb(n, k) * fact[k] % mod;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	make_fact();
	
	cin >> n >> m;
	
	llint ans = 0;
	for(int i = 0; i <= n; i++){
		llint tmp = comb(n, i);
		tmp *= perm(m, i), tmp %= mod;
		tmp *= perm(m-i, n-i), tmp %= mod;
		tmp *= perm(m-i, n-i), tmp %= mod;
		if(i % 2) ans += mod - tmp, ans %= mod;
		else ans += tmp, ans %= mod;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 19280
N,*M=`dd`.split.map &:to_i;X,Y,*A,_=M.shift N;D=[*0..1e6];s=0;A.map{|e|e.times{|j|D.unshift D[j*2+1]};s+=e};M.map{|e|p (D[e]||e-s)+X-Y}

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

int n;
int a[200010];
long long ans = 0ll;

int main(){

	cin>>n;
	for(int i=0;i<n;i++){cin>>a[i];}
	a[n] = a[n-1];
	sort(a,a+n);

	int npos = n-1;
	int ncnt = 1;
	for(int i=0;i<n-1;i++){
		ans += a[npos];
		ncnt++;
		if(ncnt==2){
			npos--;
			ncnt=0;
		}
	}

	cout<<ans<<endl;

	return (0);
}

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

double pi = 3.14159265358979;

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    int n;
    double eps = 1e-6;
    double b = 2*pi/3000;
    while(cin>>n){
        if(n==0) break;
        double x[n],y[n];
        for(int i=0;i<n;i++){
            cin>>x[i]>>y[i];
        }
        int ans = 0;
        for(int i=0;i<n;i++){
            int ret = 0;
            for(int j=0;j<n;j++){
                double d = (x[i] - x[j]) * (x[i] - x[j]);
               d += (y[i] - y[j]) * (y[i]-y[j]);
                if(d <= 1.0) ret++;
            }
            ans = max(ans,ret);
        }
        //cerr << " a " << ans << endl;
        for(int i=0;i<n;i++){
            for(int cnt=0;cnt<3000;cnt++){
                double theta = b*cnt;
                double ox = x[i] + cos(theta);
                double oy = y[i] + sin(theta);
                int ret = 0;
                for(int j=0;j<n;j++){
                    double d = (ox - x[j]) * (ox - x[j]);
                    d += (oy - y[j]) * (oy - y[j]);
                    if(d <= 1.0 + eps) ret++;
                }
                ans = max(ans,ret);
            }
        }
        cout << ans << "\n";
    }
}


Measured memory_bytes: 3684
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
#define int long long
#define MAXN 200006
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
int n , m , q;

int fa[MAXN];
int find( int x ) {
	return x == fa[x] ? x : fa[x] = find( fa[x] );
}
struct dl{
	int u , v;
} d[MAXN] ;
int cnt , c;

signed main( ) {
	cin >> n >> m >> q;
	for( int i = 1 ; i <= n ; ++ i ) fa[i] = i;
	for( int i = 1 , u , v , c ; i <= q ; ++ i ) {
		scanf("%lld%lld%lld",&u,&v,&c);
		++ u , ++ v;
		if( !c ) {
			fa[find( u )] = find( v );
		} else {
			d[++ cnt] = (dl) { u , v };
		}
	}
	for( int i = 1 , u , v ; i <= cnt ; ++ i ) {
		if( find( d[i].u ) == find( d[i].v ) )
			return puts("No") , 0;
	}
	for( int i = 1 ; i <= n ; ++ i ) if( fa[i] == i )
		++ c;
	int ed = m - n + c;
	if( !cnt ) return puts( ( ed >= c - 1 && ed <= c * ( c - 1 ) / 2 ) ? "Yes" : "No" ) , 0;
	else return puts( ( ed >= max( c , 3ll ) && ed <= c * ( c - 1 ) / 2 ) ? "Yes" : "No" ) , 0;
}

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

using namespace std;
using   ll=long long;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve() 
{
	int n , m;
	
	cin >> n >> m;
	
	string s[n];
	
	for(int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	
	int left[n][m] {};
	int right[n][m] {};
	int up[n][m] {};
	int down[n][m] {};
	
	for(int i = 0; i < n; ++i) {
		int cnt = 0;
		for(int j = 0; j < m; ++j) {
			if(s[i][j] == '.') {
				cnt++;
				left[i][j] = cnt;
			}
			else {
				cnt = 0;
			}
		}
	}
	
	for(int i = 0; i < n; ++i) {
		int cnt = 0;
		for(int j = m-1; j >= 0; --j) {
			if(s[i][j] == '.') {
				cnt++;
				right[i][j] = cnt;
			}
			else {
				cnt = 0;
			}
		}
	}
	
	for(int i = 0; i < m; ++i) {
		int cnt = 0;
		for(int j = 0; j < n; ++j) {
			if(s[j][i] == '.') {
				cnt++;
				down[j][i] = cnt;
			}
			else {
				cnt = 0;
			}
		}
	}
	
	for(int i = 0; i < m; ++i) {
		int cnt = 0;
		for(int j = n-1; j >= 0; --j) {
			if(s[j][i] == '.') {
				cnt++;
				up[j][i] = cnt;
			}
			else {
				cnt = 0;
			}
		}
	}
	
	int ans = 0;
	
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < m; ++j) {
			if(s[i][j] == '.') {
				ans = max(ans , left[i][j] + up[i][j] + right[i][j] + down[i][j] - 3);
			}
		}
	}
	
	cout << ans;
}

signed main() {
    fast;
    
    int t = 1;
    
	//cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 132664
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
const ll inf=1e9+7;
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

int n;
int main(){

  cin>>n;
  Q a(n);
  rep(i,0,n){
    a[i].second=i+1;
    cin>>a[i].first;
  }

  sort(a.begin(),a.end());
  rep(i,0,n) cout<<a[i].second<<endl;
}

Measured memory_bytes: 2432
rows, cols = [int(x) for x in input().split()]
matrix = []
vector = []
for i in range(rows):
    matrix.append([int(x) for x in input().split()])
for i in range(cols):
    vector.append(int(input()))

for row in matrix:
    result = 0
    for x, y in zip(row, vector):
        result += x*y
    print(result)

Measured memory_bytes: 7980
N = int(input())
S1 = input()
S2 = input()
mod = 10**9 + 7
ans = 1
prv = 0
if S1[0] == S2[0]:
    ans *= 3
    prv = 1
else:
    ans *= 6
    prv = 2
for i in range(1, N):
    if prv == 2:
        prv = 3
        continue
    else:
        if S1[i] == S2[i]:
            if prv == 3:
                ans %= mod
                prv = 1
            else:
                ans *= 2
                ans %= mod
                prv = 1
        
        else:
            if prv == 3:
                ans *= 3
                ans %= mod
                prv = 2
            else:
                ans *= 2
                ans %= mod
                prv = 2
                
print(ans)

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

using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    int ans=0;
    for (int i = 1; i < b-a; ++i) {
        ans+=i;
    }
    ans=ans-a;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private Scanner sc;

	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		while (sc.hasNextLine()) {
			String[] nico = sc.nextLine().split(" ");

			int y = Integer.parseInt(nico[0]);
			int m = Integer.parseInt(nico[1]);
			int d = Integer.parseInt(nico[2]);
			
			int ymd = Integer.parseInt(y + String.format("%02d", m) + String.format("%02d", d));
			
			String ans = " " + nico[1] + " " + nico[2];
			if (ymd < 18680908) {
				ans = "pre-meiji";
			} else if (ymd < 19120730) {
				ans = "meiji " + (y - 1867) + ans;
			} else if (ymd < 19261225) {
				ans = "taisho " + (y - 1911) + ans;
			} else if (ymd < 19890108) {
				ans = "showa " + (y - 1925) + ans;
			} else {
				ans = "heisei " + (y - 1988) + ans;				
			}
			
			System.out.println(ans);
		}
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define PI acos(-1.0)
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
#define MOD1 1000000005
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, 1};
int dy4[] = {1, -1, 1, -1};
//#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n, i, c=0;
    double d;
    cin>>n>>d;
    for(i=0;i<n;i++){
        double x, y, dis;
        cin>>x>>y;
        dis=sqrt((x*x)+(y*y));
        if(dis<=d)c++;
        //cout<<dis<<endl;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 3840
a, b, x = map(int, input().split())
s = set()
for i in [j for j in range(a, min(b + 1, a + x))] :
  print(i)
  s.add(i)
for i in [j for j in range(max(a, b - x + 1), b + 1)] :
  if i not in s:
    print(i)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main() {
	int m;
	
	cin >> m;
	
	for(int i=0; i<m; i++) {
		string in_str;
		set<string> set_str;
		
		cin >> in_str;
		
		// str?????????
		for(int i=1; i<in_str.size(); i++) {
			string str1(in_str);
			string str2(in_str);
			
			str1.erase(str1.begin()+i, str1.end());
			str2.erase(str2.begin()+0, str2.begin()+i);
			
			// cout << str1 << " " << str2 << endl;
			
			// str????????¢
			for(int i=0; i<4; i++) {
				switch(i) {
					case 0:
						break;
					case 1:
						reverse(str1.begin(), str1.end());
						break;
					case 2:
						reverse(str1.begin(), str1.end());
						reverse(str2.begin(), str2.end());
						break;
					case 3:
						reverse(str1.begin(), str1.end());
						break;
				}
				
				// cout << "  " << str1 << " " << str2 << endl;
				
				// str?????????
				for(int i=0; i<2; i++) {
					string str_join;
					
					switch(i) {
						case 0:
							str_join = str1 + str2;
							break;
						case 1:
							str_join = str2 + str1;
							break;
					}
					
					// cout << "    " << str_join << endl;
					
					// ???????????????
					set_str.insert(str_join);
				}
			}
		}
		
		cout << set_str.size() << endl;
	}
	
	return 0;
}

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

int main(){
    int n,m;
    cin >> n>>m;
    vector<int> a(m);
    rep(i,m) {
        cin >> a[i];
        n=n-a[i];
    }
    if(n>=0) cout << n << endl;
    else cout << -1 << endl;

}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
	void run(){
      Scanner s = new Scanner(System.in);
      while(true){
        int x = s.nextInt();
        int y = s.nextInt();
        int p = s.nextInt();
        if (x == 0 && y == 0 & p == 0) break;
        int max = 0;
         for(int i = 1; i < p; i++) {
           for (int j = 1; j < p; j++){
              int checkNum = i * (100 + x) / 100 + j * (100 + x) / 100;
              if( checkNum ==  p){
                  int onceNum = (int)((double)(i * (100 + y) / 100) + (double)(j * (100 + y) / 100));
                  max = Math.max(max, onceNum);
              }
           }
         }
         System.out.println(max);
       }
	}

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

Measured memory_bytes: 29200
N, Y = map(int, input().split())
count = 0
for a in range(N+1):
  for b in range(N-a+1):
    if Y == 10000*a+5000*b+1000*(N-a-b) and count == 0:
      print("{} {} {}".format(a, b, N-a-b))
      count += 1
    else:
      pass

if count == 0:
  print("-1 -1 -1")

Measured memory_bytes: 3060
#include <stdio.h>



int main(void)
  
{

  char S[100000];
  int i,j,count=0;
  
   
  scanf("%s", S);
  
 for(i=0;S[i]!='\0';i++);
  for(j=1;j<=i;j++)
  {
   if(S[j]==S[j-1])
   { if(S[j]=='0')
     S[j]='1';
   else
     S[j]='0';   
    
     count++;
   } 
 }
  

  
    printf("%d", count);
  
 
  	return 0;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
//NIL is NULL
#define NIL NULL
//Node structure
struct Node{
  int key;
  struct Node *parent;
  struct Node *leftc;
  struct Node *rightc;
};
//define Nodepointer
typedef struct Node * Nodepointer;

//root         
Nodepointer root;

//function insert
void insert(int k){
  Nodepointer x,y,z;
  y=NIL;
  x=root;
  //make memory
  z=new struct Node();

  z->key=k;
  z->leftc=NIL;
  z->rightc=NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key) x=x->leftc;
    else x=x->rightc;
  }

  z->parent=y;

  if(y==NIL) root=z;

  else if(z->key<y->key) y->leftc=z;

  else y->rightc=z;


}

//function search
Nodepointer find(Nodepointer now,int data){
  if(now==NIL||data==now->key) return now;
  if(data<now->key) return find(now->leftc,data);
  else return find(now->rightc,data);
}

//function treeminimum
Nodepointer treeminimum(Nodepointer x){
  while(x->leftc!=NIL){
    x=x->leftc;
  }
  return x;
}
//function treesuccerssor
Nodepointer treesuccessor(Nodepointer x){
  Nodepointer y;
  if(x->rightc!=NIL) return treeminimum(x->rightc);
  y=x->parent;
  while(y!=NIL && x==x->rightc){
    x=y;
    y=y->parent;
  }
  return y;
}
//function treedelete
void treedelete(Nodepointer z){
  Nodepointer x,y;
  if(z->leftc==NIL ||z->rightc==NIL)y=z;
  else y=treesuccessor(z);

  if(y->leftc!=NIL)x=y->leftc;
  else x=y->rightc;
 
  if(x!=NIL)x->parent=y->parent;
  if(y->parent==NIL) root=x;
  else if(y==y->parent->leftc) y->parent->leftc=x;
  else y->parent->rightc=x;

  if(y!=z) z->key=y->key;

}

//print
void inorderprint(Nodepointer now){
  if(now!=NIL){
    inorderprint(now->leftc);
    printf(" %d",now->key);
    inorderprint(now->rightc);
  }
}

void preorderprint(Nodepointer now){
  if(now!=NIL){
    printf(" %d",now->key);
    preorderprint(now->leftc);
    preorderprint(now->rightc);
  }
}


int main(){

  int n,i,j,data;
  Nodepointer del;
  char str[10];
  //load n
  scanf("%d",&n);
  //load commnad and key
  for(i=0;i<n;i++){
    scanf("%s",str);
    //insert
    if(strcmp(str,"insert")==0) {
      scanf("%d",&data);
      insert(data);
    }
    //find
    else if(strcmp(str,"find")==0){
      scanf("%d",&data);
      if(find(root,data)!=NIL) printf("yes\n");
      else printf("no\n");
    }
    //delete
    else if(strcmp(str,"delete")==0){
      scanf("%d",&data);
      del=find(root,data);
      treedelete(del);
    }
    //print
    else if(strcmp(str,"print")==0){
      inorderprint(root);
      cout <<endl;
      preorderprint(root);
      cout <<endl;
    }
  }

  return 0;
}

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

ll min_cost = 1200001;
ll n, m, x;
vector <vector<ll>> a(14, vector<ll>(14));
vector <ll> c(14);
vector <ll> kara(14);

void dfs(int len, ll cost, vector<ll> skill){
  if (len > n){
    bool ok = true;
    rep(i, m) if (skill.at(i) < x) ok = false;
    if (ok) min_cost = min(min_cost, cost);
  }
  else{
    dfs(len + 1, cost, skill);
    rep(i, m) skill.at(i) += a.at(len).at(i);
    dfs(len + 1, cost + c.at(len), skill);
  }
}

int main() {

  cin >> n >> m >> x;

  rep(i, n){
    cin >> c.at(i);
    rep(j, m) cin >> a.at(i).at(j);
  }
  dfs(0, 0, kara);
  if (min_cost == 1200001) cout << -1 << endl;
  else cout << min_cost << endl;
}

Measured memory_bytes: 3636
from collections import Counter
import sys

N = int(input())
D = list(input().split())

M = int(input())
T = list(input().split())

D_count = Counter(D)
T_count = Counter(T)

for k in T_count:
    if D_count[k] < T_count[k]:
        print('NO')
        sys.exit()

print('YES')


Measured memory_bytes: 126292
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define output(x) cout<<x<<endl;

int par[100001];

void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
	}
}
//木の根を求める
int root(int x) {
	if (par[x] == x)
		return x;
	else {
		return par[x] = root(par[x]);
	}
}
//find
bool same(int x, int y) {
	return root(x) == root(y);

}
//union
void unite(int x, int y) {
	x = root(x);
	y = root(y);
	if (x == y) return;
	par[x] = y;
}

int main()
{
	long long int i, j, k, l, m, n, sum, flag;
	sum = 1;
	flag = 1;
	cin >> n;
	vector<int> A(n);
	REP(i, 0, n) {
		cin >> A[i];
		A[i] %= 2;
		flag *= 3;
		if (A[i]) {
			sum *= 1;
		}
		else
			sum *= 2;
	}
	output(flag-sum);




	return 0;
}



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

bool is_prime[300000];

int sieve(int a) {
	int p = 0,p1=0;
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= a * 2; i++) {
		if (i == a+1)p1 = p;
		if (is_prime[i]) {
			p++;
			for (int j = i * 2; j <= a * 2; j += i)is_prime[j] = false;
		}
	}
	return p - p1;
}

int main() {
	int n;
	memset(is_prime, true, 300000);
	while (cin >> n, n) {
		cout << sieve(n) << endl;
	}
}

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

int main(){
    int N;
    cin >> N;
    int a[N];
    rep(i, N){
        cin >> a[i];
    }
    int n=a[0];
    if(n==2){
        cout << 1 << endl;
        return 0;
    }
    rep(i, N){
        n = a[n-1];
        if(n==2){
            cout << i+2 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


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

int main(){
	long long a,b,k;
	cin >> a >> b >> k;
	vector<long> val(2*k,0);
	
	if(a+k-1<b-k+1){
		int n=0;
		for(int i=a;i<=a+k-1;i++){
			cout << i << endl;
		}
		for(int i=b-k+1;i<=b;i++){
			cout << i << endl;
		}
	}else{
		for(int i=a;i<=b;i++){
			cout << i << endl;
		}
	}	
	return 0;
}


Measured memory_bytes: 256
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
    
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
      
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
print(lcm_list(T))

Measured memory_bytes: 3700
module Main where

import Control.Applicative
import Numeric
import Data.List

type House = [Floor]
type Floor = [Room]
type Room = Int

officialHouseInit :: [House]
officialHouseInit = replicate 4 houseInit

houseInit :: House
houseInit = replicate 3 floorInit

floorInit :: Floor
floorInit = replicate 10 roomInit

roomInit :: Room
roomInit = 0

showOfficialHouse :: [House] -> String
showOfficialHouse = intercalate (replicate 20 '#' ++ "\n") . map showHouse

showHouse :: House -> String
showHouse = unlines . map showFloor

showFloor :: Floor -> String
showFloor = concatMap ((' ':) .  showRoom)

showRoom :: Room -> String
showRoom = show

main :: IO ()
main = do
  {[n] <- getInts
  ; hs <- loop n officialHouseInit
  ; putStr $ showOfficialHouse hs
  }

loop:: Int ->[House] -> IO [House]
loop 0 hs = return hs
loop n hs = do
  {[b, f, r, v] <- getInts
  ; let (fronts, ho : ends) = splitAt (b - 1) hs
  ; let (lows, fl : ups)    = splitAt (f - 1) ho
  ; let (xs, rm :ys)        = splitAt (r - 1) fl
  ; let fl' = xs ++ (rm + v) : ys
  ; let ho' = lows ++ fl': ups
  ; let hs' = fronts ++ ho' : ends 
  ; loop (n-1) hs'
  }
  
--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn  .  unwords .  map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""



Measured memory_bytes: 4648
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  string s;
  cin >> s;
  int ans = 0;
  bool ok = true;
  while (s.size() >= 2)
  {
    if (s[0] == s[s.size() - 1])
    {
      s = s.substr(1, s.size() - 2);
      continue;
    }

    if (s[0] == 'x')
    {
      ans++;
      s = s.substr(1, s.size() - 1);
      continue;
    }

    if (s[s.size() - 1] == 'x')
    {
      ans++;
      s = s.substr(0, s.size() - 1);
      continue;
    }

    ok = false;
    break;
  }

  if (ok)
  {
    cout << ans << endl;
  }
  else
  {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=500005;
const ll INF=0x3f3f3f3f;
const ll MOD=1000000007;
ll n,m,a[MAX],a_sum[MAX],b[MAX],b_sum[MAX],s1,s2;
int main(){
    scanf("%lld%lld",&n,&m);
    for(ll i=0;i<n;i++) scanf("%lld",&a[i]),a_sum[i+1]=(a_sum[i]+a[i])%MOD;
    for(ll i=0;i<m;i++) scanf("%lld",&b[i]),b_sum[i+1]=(b_sum[i]+b[i])%MOD;
    sort(a,a+n),sort(b,b+m);
    for(ll i=0;i<n;i++) s1=(s1+i*a[i]-a_sum[i])%MOD;
    for(ll i=0;i<m;i++) s2=(s2+i*b[i]-b_sum[i])%MOD;
    printf("%lld\n",s1*s2%MOD);

    return 0;
}


Measured memory_bytes: 13312
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int f(int a[][100][100],int x,int y,int w,int h,int p,int q){
  if(x==w||y==h)
    return (p&1)==(q&1)||(p&2)==(q&2);
  else{
    if((p&1)==(q&1)||(p&2)==(q&2))
      return (f(a,x+1,y,w,h,1,p)+f(a,x,y+1,w,h,2,p))%100000;
    else{
      if(a[(p-1+(w-x>h-y))%2][w-x<h-y?w-x:h-y][w-x>h-y?w-x:h-y]==0)
	a[(p-1+(w-x>h-y))%2][w-x<h-y?w-x:h-y][w-x>h-y?w-x:h-y]=f(a,x+!!(p&1),y+!!(p&2),w,h,p,p);
      return a[(p-1+(w-x>h-y))%2][w-x<h-y?w-x:h-y][w-x>h-y?w-x:h-y];
    }
  }
}
int main(){
  int a[3][100][100],w,h;
  memset(a,0,sizeof(a));
  for(h=2;h<101;h++)
    for(w=h;w<101;w++)
      a[2][h][w]=f(a,1,1,h,w,3,3);
  while(cin>>w>>h&&w+h)
    cout<<a[2][w<h?w:h][w>h?w:h]<<endl;
  return 0;
}

Measured memory_bytes: 928
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm> // swap
#include <map>
#include <utility> // pair

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

using namespace std;

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

	int a, b, c;
	int x;

	cin >> a;
	cin >> b;
	cin >> c;
	cin >> x;

	int result = 0;
	int maxA = x / 500;
	if (maxA > a) maxA = a;

	REP(i, maxA) {
		
		int maxB = (x-500*i) / 100;
		if (maxB > b) maxB = b;
		
		REP(j, maxB) {
			
			int numC = (x -500*i- 100 * j) / 50;

			if (numC > c) continue;
			
//			cout << i << " " << j << " " << numC << endl;

			result++;
			
		}
	}

	cout << result;


	system("pause");
	return 0;
}

Measured memory_bytes: 504
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;


class Program {
    

    internal static void Main(string[] args)
    {

        var S = ReadLine();

        if (string.Join("",S.ToCharArray().OrderBy(c => c)) == "abc") {
            WriteLine("Yes");
        } else {
            WriteLine("No");
        }

    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
const int maxn=1e5+7;

int a[maxn];

int main()
{
//    freopen("input.txt","r",stdin);
    
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int temp=a[0];
    for(int i=1;i<n;i++) temp=__gcd(temp,a[i]);
    cout<<temp<<endl;
    
    return 0;
}
//想着稍微改一改思路来做这道题也不错 
//考虑一下我为什么会把G题的思路想起来 














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

#define int long long int
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 
bool sortbysecdesc(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.second>b.second; 
} 
 
/*
Mistakes
 
- while using pairs make sure you comparator datatype it's int by default change it as per the need
- Modify comparator if you want to
*/
#define f first
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll64 int64_t
#define pb push_back
#define pll pair<long long int,long long int>
#define pi pair<int,int>
#define mi map<int,int>
#define mll map<long long int,long long int>
#define umi unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define vpi vector<pair<int,int>>
#define vpll vector<pair<long long int,long long int>>
#define mod 1000000007
#define fp(i,x,n) for(int i=x;i<n;i++)
#define fn(i,x,n) for(int i=x;i>n;i--)
#define fpm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define asort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysec)
#define asort_vp_first(vect) sort(vect.begin(), vect.end())
#define dsort_vp_first(vect) sort(vect.begin(), vect.end(), sortinrev) 
#define dsort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysecdesc)
#define vi vector<int>
#define vll vector<long long int>
#define c(x) cout<<x<<endl;
#define M 1000000007
using namespace std; 

signed main()
{
    string s;
    cin>>s;
    long long sum=0;
    fp(i,0,s.size())
    {
        sum= (sum + (s[i]-'0'))%9;
    }
    if(sum==0)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(l,k,h) for(int l = k; l <= h; ++l)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;


int main() {
    string a,b;
    cin >> a >> b;
    a += b;
    int num = stoi(a);
    rep3(i,1,num) {
        if(num == i*i) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

int main(){
  int n;
  cin >> n;
  int a[n];
  cin.ignore();
  for(int i = 0;i < n; i++){
    cin >> a[i];
  }
  for(int j = n-1;j>=0;j--){
    if(j !=0){
      cout << a[j] << " ";
    }else{
      cout << a[j]<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3004
#include<bits/stdc++.h>
using namespace std;
#define lnt long long int
int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];

    }
    lnt ans=0;
    for(int i=1;i<n-1;i++)
    {

        if((arr[i]<arr[i-1]&&arr[i]>arr[i+1])||(arr[i]>arr[i-1]&&arr[i]<arr[i+1]))
        {
            //cout<<i<<endl;
            ans++;

        }
    }
    cout<<ans;



}



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

int main(){
    int m,d;
    cin>>m>>d;
    
    int ans=0;
    rep(i,m){
        int month=i+1;
        rep(j,d){
            int day=j+1;
            int d1=day%10;
            int d10=day/10;

            if(d1>=2 && d10>=2 && d1*d10==month) ans++;
        }
    }
    cOut(ans);
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define ForE(it,v) for(auto it : v)
#define mod 1000000007
#define All(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

using namespace std;

int a,b,c;
int n,m,cnt,ans;
string u,s,t;

main()
{
        cin>>s>>t>>a>>b>>u;

        if(u==s)a--;
        else b--;

        cout<<a<<" "<<b<<endl;

}

Measured memory_bytes: 256
n = int(input())
c = [[0 for _ in range(10)] for _ in range(10)]

for i in range(n + 1):
    left = int(str(i)[0])
    right = i % 10
    c[left][right] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += c[i][j] * c[j][i]

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

long power(long a, long b) {
    return b ? power(a*a%MOD, b/2) * (b%2?a:1)%MOD:1;
}

long perm(int N, int K) {
    long x = 1;
    for(int i = 1; i <= K; i++) x = x * (N-i+1) % MOD;
    return x % MOD;
}

long comb(int N,int K) {
    long x = 1, y = 1;
    for(int i = 1; i <= K; i++) {
        x = x * (N-i+1) % MOD;
        y = y * i % MOD;
    }
    return x * power(y, MOD-2) % MOD;
}

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

void dfs(const vector<vector<int>> &G, int v, vector<int> &seen) {
    seen[v] = true;

    for(int next_v : G[v]) {
        if(seen[next_v]) continue;
        dfs(G, next_v, seen);
    }
}

void yes() { cout << "Yes" << endl;}
void no() { cout << "No" << endl;}



int main() {
  
int x, y, z; cin >> x >> y >> z;

cout << z << " " << x << " " << y;

}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

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

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  ll X;

  cin >> X;

  for (ll i = -1000; i <= 1000; i++) {
    for (ll j = -1000; j <= 1000; j++) {
      ll r = i * i * i * i * i - j * j * j * j * j;
      if (r == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  assert(false);

  return 0;
}

Measured memory_bytes: 3516
n, m = gets.split.map(&:to_i)
rets = []
ps = {}
m.times do |i|
  p, y = gets.split.map(&:to_i)
  rets.push({ p: p, y: y})
  ps[p] ||= []
  ps[p].push({ y: y, i: i })
end
ps.each do |p, v|
  sorted = v.sort{|a,b| a[:y] <=> b[:y] }
  sorted.each_with_index do |x, i|
    ret = rets[x[:i]]
    ret[:code] = ret[:p].to_s.rjust(6, '0') + (i + 1).to_s.rjust(6, '0')
  end
end
=begin
rets.map{|x| x[:p]}.uniq.each do  |p|
  sorted = rets.select{|x| x[:p] == p}.sort{|a,b| a[:y] <=> b[:y]}
  sorted.each_with_index do |x, i|
    x[:code] = x[:p].to_s.rjust(6, '0') + (i + 1).to_s.rjust(6, '0')
  end
end
=end
rets.each do |r|
  puts r[:code]
end
  

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

int main(){
  long long income=100,interest,x;
  long time=0;
  cin>>x;
  while(income<x){
    income+=0.01*income;
    floor(income);
   	time++;
  }
  cout<<time;
  
return 0;
}

Measured memory_bytes: 3632
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		//数値を読み込む
		int N = int.Parse(Console.ReadLine());
		
		//ディクショナリを定義
		var wordList = new Dictionary<string, int>();
		
		//ループ処理
		for(int i=0; i<N; i++){
				string word = Console.ReadLine();
				//既に出てきた言葉の場合
				if(wordList.ContainsKey(word)){
						wordList[word] ++;
				}
				//初出の場合
				else{
						wordList.Add(word, 1);
				}
		}
		
		//出現回数の最大値を取得
		int max = wordList.Max(x => x.Value);
		
		//答えを格納するリストを定義
		List<string> answerList = new List<string>();
		
		//ループ処理
		foreach(var word in wordList){
				if(word.Value == max){
						answerList.Add(word.Key);
				}
		}
		
		//答えをソート
		answerList.Sort(StringComparer.Ordinal);
		
		//出力
		foreach(string answer in answerList){
				Console.WriteLine(answer);
		}
	}
}

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

using namespace std;

typedef long long int ll;

bool fac(ll n) {
	ll c = 0;
	for (ll i = n; i >= 1; i--) {
		if (n % i == 0) c++;
		if (c >= 100) return true;
	}
	return false;
}

int main() {
	/*ll test;
	cin >> test;
	while (test--) {
		
	}*/
	char x;
	cin >> x;
	int n = (int)x;
	if (n >= 97 and n <= 122) cout << 'a';
	else cout << 'A';
	
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
int64_t N,P,p,i,r,v,m[1<<20];std::string S;main(){std::cin>>N>>P>>S;if(10%P)for(*m=p=1,i=N;i--;)r+=m[v=(v+(S[i]-48)*(p=(p*10)%P))%P]++;else for(;i<N;i++)if(!((S[i]-8)%P))r+=i+1;std::cout<<r;}

Measured memory_bytes: 644
import sys

import numpy as np

input = sys.stdin.readline


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def iml(N: int, t: type = int):
    return [t(input()) for _ in range(N)]


N = ii()
D = iml(N)

print(np.unique(D).size)


Measured memory_bytes: 12464
import java.util.*;

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();
    }
    int ans = 1;
    int sub = 1;
    for(int i=0; i<N; i++){
      ans *= 3;//abs_max.(A-b) = 3
      if(A[i]%2==0){
        sub *= 2;//Whan even > odd, even(A[i]), odd > then supposed to 2 minus  
      }
    }
    System.out.println(ans-sub);
  }
}
    

Measured memory_bytes: 35672
#include <bits/stdc++.h>
const int mu=1000000007;
int n,m,l,r,right[3005],sum[3005],f[3005][3005];
char s[3005];
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) right[i]=i;
	scanf("%s",s+1);
	for (int i=1;i<=n;i++) sum[i]=sum[i-1]+s[i]-'0';
	for (int i=1;i<=m;i++){
		scanf("%d%d",&l,&r);
		right[l]=std::max(right[l],r);
	}
	for (int i=1;i<=n;i++) right[i]=std::max(right[i],right[i-1]);
	f[0][0]=1;
	for (int i=1;i<=n;i++){
		int t=sum[right[i]]-sum[right[i-1]];
		for (int j=0;j<=right[i];j++){
			if (!f[i-1][j]) continue;
			if (j+t>0) f[i][j+t-1]=(f[i][j+t-1]+f[i-1][j])%mu;
			if (right[i]-i+1>j+t) f[i][j+t]=(f[i][j+t]+f[i-1][j])%mu; 
		}
		//if (i==right[i]) for (int j=1;j<=n;j++) f[i][j]=0;
	}
	printf("%d\n",f[n][0]);
}

Measured memory_bytes: 33920
from collections import Counter
H,W,m = map(int,input().split())
ci = Counter([])
cj = Counter([])
s = set()
for i in range(m):
    h,w = map(int,input().split())
    ci[h] += 1
    cj[w] += 1
    s.add((h,w))
mi = max(ci.values())
mj = max(cj.values())
ci = list(ci.items())
cj = list(cj.items())
xi = [ci[i][0] for i in range(len(ci)) if ci[i][1] == mi]
xj = [cj[i][0] for i in range(len(cj)) if cj[i][1] == mj]
for i in xi:
    for j in xj:
        if (i,j) not in s:
            print(mi+mj)
            quit()
print(mi+mj-1)

Measured memory_bytes: 245152