akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///
long long n,m,t,ans,ts;
string a,b;

main()
{
    fastio();
    cin>>a>>b;
    n=a.size(),m=b.size();
    ans=0;
    ll i,j;
    for(i=0;i<=n-m;i++){
        ll c=0;
        for(j=0;j<m;j++){
            if(a[i+j]==b[j]) c++;
        }
        ans=max(ans,c);
    }
    cout<<m-ans el;
}

///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3608
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (a : b : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  print . max 0 $ a - 2 * b

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;

vector<vector<int>> graph(MAX_N);

int oa[MAX_N], ob[MAX_N];

bool visited[MAX_N];

int max_color = 0;

map<pair<int, int>, int> ans;

void coloring(int node) {
  if (visited[node]) return;

  visited[node] = true;

  set<int> used;

  vector<int> nexts;

  for (int i = 0; i < graph[node].size(); ++i) {
    int to = graph[node][i];
    auto node_to_to = make_pair(node, to);
    auto to_to_node = make_pair(to, node);

    if (ans.find(node_to_to) == ans.end() && ans.find(to_to_node) == ans.end()) {
      nexts.push_back(to);
      continue;
    }

    if (ans.find(node_to_to) != ans.end()) {
      used.insert(ans[node_to_to]);
      continue;
    }

    if (ans.find(to_to_node) != ans.end()) {
      used.insert(ans[to_to_node]);
    }
  }

  int new_node_num = nexts.size();

  int remaining = max_color - (int)(used.size());

  if (remaining < new_node_num) {
    max_color += (new_node_num - remaining);
  }

  int idx = 1;

  for (auto &to : nexts) {
    auto node_to_to = make_pair(node, to);
    auto to_to_node = make_pair(to, node);

    while (used.find(idx) != used.end()) idx += 1;

    ans[node_to_to] = idx;
    ans[to_to_node] = idx;

    used.insert(idx);
  }

  for (auto &to : nexts) {
    coloring(to);
  }
}

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

  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);

    oa[i] = a;
    ob[i] = b;

    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  for (int i = 1; i <= n; ++i) {
    visited[i] = false;
  }

  coloring(1);

  printf("%d\n", max_color);

  for (int i = 0; i < n - 1; ++i) {
    printf("%d\n", ans[make_pair(oa[i], ob[i])]);
  }

  return 0;
}


Measured memory_bytes: 31488
main = do
  n <- readLn
  let p (h, w) = let den = 4 * h * w - n * (w + h)
                 in den > 0 && (n `mod` den * h `mod` den * w `mod` den) `mod` den == 0
      (h, w):_ = filter p [ (h, w) | h <- [1..3500], w <- [1..3500] ]
      n' = (n * h * w) `div` (4 * h * w - n * (w + h))
  putStrLn $ show h ++ " " ++ show n' ++ " " ++ show w


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

using namespace std;

typedef long long int ll;

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

  int a, b, c, k;
  cin >> a >> b >> c >> k;

  while (a >= b && k > 0) {
    b *= 2;
    k--;
  }

  while (b >= c && k > 0) {
    c *= 2;
    k--;
  }

  cout << ((a < b && b < c) ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 3632
#include<iostream>
long long t[1001]={0},a[1001]={0};
using namespace std;
int main()
{
	long long n,b;
	cin>>n;
	for(long long i=1;i<=n;i++)
	{ 
		cin>>t[i];
		cin>>a[i];
	} 
	for(long long i=1;i<=n;i++)
	{ 
		if(t[i]<=t[i-1]||a[i]<=a[i-1])
		{
			b=max((a[i-1]+a[i]-1)/a[i],(t[i-1]+t[i]-1)/t[i]);
			t[i]=b*t[i];
			a[i]=b*a[i];
		}
	} 
	cout<<t[n]+a[n];
	return 0;
} 

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

template <typename T>
class BinaryIndexedTree
{
public:
    vector<T> arr;
    long long size;
    T initial_value;

    BinaryIndexedTree(long long N)
    {
        setSize(N);
    }

    BinaryIndexedTree(long long N, T init)
    {
        setSize(N);
        setInitialValue(init);
        initializeArr();
    }

    void setSize(long long N)
    {
        size = N + 1;
    }

    void setInitialValue(T init)
    {
        initial_value = init;
    }

    void initializeArr()
    {
        arr = vector<T>(size, initial_value);
    }

    void initializeArr(T init)
    {
        setInitialValue(init);
        initializeArr();
    }

    T func(T x, T y);

    void update(long long idx, T value)
    {
        while (idx <= size)
        {
            arr[idx] = func(arr[idx], value);
            idx += (idx & -idx);
        }
    }

    T query(long long idx)
    {
        T ret = initial_value;
        while (idx > 0)
        {
            ret = func(ret, arr[idx]);
            idx -= (idx & -idx);
        }
        return ret;
    }
};

template <typename T>
T BinaryIndexedTree<T>::func(T a, T b)
{
    return a + b;
}

long long convert_to_BIT_idx(long long idx, long long n)
{
    return idx + n + 1;
}

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

    vector<long long> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }

    long long l = 1;
    long long r = 1000000001;
    while (r - l > 1)
    {
        long long c = (l + r) / 2;
        BinaryIndexedTree<long long> bit(convert_to_BIT_idx(N, N), 0);
        long long current = 0;
        long long count = 0;
        bit.update(convert_to_BIT_idx(current, N), 1);
        for (int i = 0; i < N; i++)
        {
            if (a[i] >= c)
            {
                current++;
            }
            else
            {
                current--;
            }
            count += bit.query(convert_to_BIT_idx(current, N));
            bit.update(convert_to_BIT_idx(current, N), 1);
        }

        if (count * 2 >= N * (N + 1) / 2)
        {
            l = c;
        }
        else
        {
            r = c;
        }
    }
    cout << l << endl;
}


Measured memory_bytes: 2560
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
#define inf 1000000000

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int a[20], b[20][20], p[20];

void solve(){
   int n,m;
   cin >> n >> m;

   for(int i = 1;i<=m;i++){
    cin >> a[i];
    for(int j = 1;j<=a[i]; j++){
        cin >> b[i][j];
        b[i][j]--;
    }
   }

   for(int i = 1;i<=m;i++){
    cin >> p[i];
   }

   int ans = 0;

   for(int i = 0;i<(1<<n); i++){
    bool flag = true;
    for(int j = 1;j<=m;j++){
        int cnt = 0;
        for(int k = 1;k<=a[j];k++){
            if(i&(1<<b[j][k])){
                cnt++;
            }
        }

        if(cnt%2!=p[j]%2){
            flag = false;
            break;
        }
    }
    if(flag)ans++;
   }
   cout << ans ;
   cout << endl;
} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, k := nextInt(), nextInt()
	s := next()

	l, r := 0, 0
	zero := 0
	if s[r] == '0' {
		zero = 1
	}
	ans := 0
	for l < n && r < n {
		// rを伸ばす
		for r < n && zero <= k {
			if r+1 < n && s[r] == '1' && s[r+1] == '0' {
				if zero == k {
					break
				}
				zero++
			}
			r++
		}
		if r == n {
			r--
		}
		// r-l+1人が並んでいる
		ans = max(ans, r-l+1)
		// 一番左の0区域を削除するまでlを進める
		for l < n && s[l] == '1' {
			l++
		}
		for l < n && s[l] == '0' {
			l++
		}
		zero--
	}

	puts(ans)
}


Measured memory_bytes: 896
#include <stdio.h>
 
using namespace std;
 
int main() {
 
    long X, Y;
    scanf("%ld %ld", &X, &Y);
    if (X % Y == 0) {
        printf("-1\n");
    } else {
        printf("%ld\n", X * (Y - 1));
    }
 
    return 0;
}

Measured memory_bytes: 128
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
ll longinf=1ll<<60;
int inf=1<<29;
ll mod=1000000000+7;


int D,p[11],c[11],G; 
int main(){
    cin>>D>>G;
    rep0(i,D){
        cin>>p[i]>>c[i];
    }
    int n=1<<D;
    int ans=inf;
    rep0(g,n){
        int now=0;
        int cnt=0;
        rep0(i,D){
            if((g>>i)&1){
                now+=(100*(i+1)*p[i]+c[i]);
                cnt+=p[i];
            }
        }
        bool ok=false;
      bool ok1=true;
      int cnt1=0;
        for(int i=D-1;i>=0;i--){
            if(((g>>i)&1)==0){
              while(1){
                if(G<=now){
                  bool ok=true;
                    break;
                }
                now+=(100*(i+1));
                cnt++;
                cnt1++;
                if(cnt1>=p[i]) ok1=false;
            }
            }
          if(ok) break;
        }
        if(ok1) ans=min(cnt,ans);
    }
    cout<<ans<<endl;

    
    return 0;
}

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

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count = Integer.parseInt(br.readLine());
        
        for(int i = 0; i < count; i++){
            System.out.println(br.readLine().replaceAll("Hoshino" , "Hoshina"));
        }
        
    }
}

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

#include <bits/stdc++.h>
using namespace std;

typedef vector< vector<int> > vvi;
typedef vector< vector<bool> > vvb;
typedef vector< vector<char> > vvc;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef long long ll;


int main(){
    int n,k;
    cin >> n >> k;
    vi a(n);
    for(int i=0;i<n;i++){
        cin >> a[i] ;
    }
    for(int i=k;i<n;i++){
        if(a[i-k]<a[i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 4048
fn main() {
    use std::collections::HashMap;
    let mut data: HashMap<u64, usize> = HashMap::new();
    for i in 0..3 {
        for j in 0..3 {
            let pos = i * 10 + j;
            data.insert(read(), pos);
        }
    }

    let mut m: HashMap<usize, bool> = HashMap::new();
    let n: usize = read();
    for _ in 0..n {
        let num: u64 = read();
        if let Some(&pos) = data.get(&num) {
            m.insert(pos, true);
        }
    }

    // よこ
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&0), m.get(&1), m.get(&2)) {
        println!("Yes");
        return;
    }
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&10), m.get(&11), m.get(&12)) {
        println!("Yes");
        return;
    }
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&20), m.get(&21), m.get(&22)) {
        println!("Yes");
        return;
    }
    // たて
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&0), m.get(&10), m.get(&20)) {
        println!("Yes");
        return;
    }
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&1), m.get(&11), m.get(&21)) {
        println!("Yes");
        return;
    }
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&2), m.get(&12), m.get(&22)) {
        println!("Yes");
        return;
    }
    // ななめ
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&0), m.get(&11), m.get(&22)) {
        println!("Yes");
        return;
    }
    if let (Some(&true), Some(&true), Some(&true)) = (m.get(&2), m.get(&11), m.get(&20)) {
        println!("Yes");
        return;
    }
    println!("No");
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include <stdio.h>

int main()
{
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a<b&&b<c) printf("Yes\n");
  else if(a==b&&b<c) printf("No\n");
  else printf("No\n");
  return 0;
}

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

bool seki[31] = {false};

int main()
{
	int s;
	for(int i=0;i<28;i++){
		cin >> s;
		seki[s] = true;
	}
	for(int i=1;i<31;i++){
		if(!seki[i])
			cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
int main()
{
	ll i,j,k=5,a,b=2,c,n,x,l,h,y,s=0,p=0,q=0;
	cin>>n;x=n/2;
	if(n%2==1) cout<<0;
	//x=n/2
	else
	{
		while(1)
		{
			s=s+(x/k);
			if((x/k)==0) break;
			k=k*5;
		}
		/*while(1)
		{
			p=p+floor(x/b);
			if(floor(x/b)==0) break;
			b=b*2;
		}
		p=p+n/2;*/
		cout<<s;
	}
}

Measured memory_bytes: 256
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (x, y) = {
        let ab = get_line()
            .split_whitespace()
            .map(|e| e.parse().unwrap())
            .collect::<Vec<usize>>();
        (ab[0], ab[1])
    };

    let mut result = false;
    for i in 0..=x {
        let ret = 4 * i + 2 * (x - i);
        if ret == y {
            result = true;
        }
    }
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2096
while true

	aryMondai = gets.split.map(&:to_i);
	
	num1 = aryMondai[0];
	num2 = aryMondai[1];
	
	if num1 == 0 && num2 == 0 then
		break;
	end
	
	for i in 0..num1-1 do
		
		for j in 0..num2-1 do
		
			if i == 0 || i + 1 == num1 || j == 0 || j + 1 == num2 then
				
				print "#";
				
			else
				
				print ".";	
				
			end
		
		end
		
		print "\r\n";
	end
	
	print "\r\n";
end

Measured memory_bytes: 8836
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main {
  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();

    System.out.println(A <= 9 && B <= 9 ? A * B : -1);

  }
}


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


int main()
{
    int n;
    cin >> n;
    int a [n];
    for (int i = 0;i<n;i++)
    {
        cin >> a[i];
    }
    int dp[n] = {0};
    dp[1]=abs(a[0]-a[1]);
    for (int i = 2;i<n;i++)
    {
        int x = dp[i-2]+abs(a[i-2]-a[i]);
        int y = dp[i-1]+abs(a[i-1]-a[i]);
        dp[i]=min(x,y);
    }
    cout << dp[n-1] << endl;

}


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

typedef vector<int> vi;
typedef set<int> si;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define onesNumber(x) builtin_popcount(x) //builtin_popcount(ll)
#define testCases int t; cin >> t; while(t--)
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) (x * y / gcd(x, y))
const double PI = acos(-1.0);
const int N = 1e3 + 6;
const int MD = 1e5 * 4;

void solve(){

}

int main()
{
    //ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //testCases
        //solve();
    int n;
    cin >> n;
    cout << (n >= 30 ? "Yes" : "No");


    return 0;
}


Measured memory_bytes: 3604
n=int(input())
h=[int(i) for i in input().split()]
j=0
ans=0
while j<max(h):
  if h[0]>j:
    ans+=1
  for i in range(1,n):
    if h[i-1]<=j and h [i]>j:
      ans+=1
  j+=1
print(ans) 

Measured memory_bytes: 3060
// Header {{{
#include <bits/stdc++.h>

using namespace std;
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;
typedef unsigned long long int ull;
typedef long long int ll;
#define rep(i,a,b) for (ll i=(a); i<(b); i++)
typedef pair<ll,ll> PLL;
// }}}

signed main() {
    bool front=false;
    ll n;
    list<ll> l;
    cin>>n;
    rep(i,0,n){
        ll a;
        cin>>a;
        if (front) {
            l.push_front(a);
        } else {
            l.push_back(a);
        }
        front = !front;
    }
    if (n%2==1){
        for (auto it = l.rbegin(); it != l.rend(); it++){
            cout<<*it<<" ";
        }
        cout<<endl;
    }else{
        for (auto it = l.begin(); it != l.end(); it++){
            cout<<*it<<" ";
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 8448
N = gets.to_i
a = gets.split.map(&:to_i)

r = 0
x = a[0] <=> a[1]

(a.size-2).times{|i|
  y = a[i+1] <=> a[i+2]
  #p [x,y],r
  next if y==0
  if x!=y && x!=0 then
    r+=1
    x=0
  else
    x = y
  end
}

puts r+1

Measured memory_bytes: 8452
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
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.st << "," << P.nd << ")";
}

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

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  string a,b;
  cin >> a >> b;
  int res = 0;
  R(i,SZ(a)){
    res += a[i] == b[i];
  }
  cout << res << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    
    vector<int>a1(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a1[i];
    }
    
    
    
        
    //cout<<a2[1]<<a2[2]<<a2[3];
    for (int i = 0; i < n-k; i++)
    {
        if (a1[k+i]>a1[i])
        {
            cout<<"Yes"<<endl;
        }else
        {
            cout<<"No"<<endl;
        }
        
        
    }
    
    
}

Measured memory_bytes: 3576
S=input()
N=len(S)

flag1=0
flag2=0
flag3=0

num_l=0
for i in range(N):
  if S[i].islower():
    num_l+=1
#print(num_l)
if num_l==N-2:
  flag1=1
  
if S[0]=="A":
  flag2=1

for i in range(2,N-1):
  if S[i]=="C":
    flag3=1

#print(flag1,flag2,flag3)
print("AC" if flag1*flag2*flag3==1 else "WA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> V(N);
    rep(i,0,N)cin >> V[i];
    int mini = INF;
    vector<P> cnt1(100010),cnt2(100010);
    rep(i,0,100010){
        cnt1[i].second = i;
        cnt2[i].second = i;
    }
    for(int i = 0;i < N;i++){
        if(i % 2){
            cnt1[V[i]].first++;
        }else{
            cnt2[V[i]].first++;
        }
    }
    sort(cnt1.rbegin(),cnt1.rend());
    sort(cnt2.rbegin(),cnt2.rend());
    ll num = N - (cnt1[0].first + cnt2[0].first);
    //cout << num << endl;
    //cout << cnt1[0].second << endl;
    if(cnt1[0].second == cnt2[0].second){
        int left = cnt1[0].first - cnt1[1].first;
        int right = cnt2[0].first - cnt2[1].first;
        num += min(left,right);
    }
    cout << num << endl;
    
}

Measured memory_bytes: 2176
import java.util.*;

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

        long ans = 0;
        
        for(int i = 0 ; h > 0 ; i++){
        	ans += (long)1 << i;
        	h >>= 1;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


# https://atcoder.jp/contests/abc158/submissions/10664809
S = sys.stdin.buffer.readline().decode().rstrip()
N = len(S)
P = 2019


def solve25():
    ans = 0
    for i, c in enumerate(S):
        if int(c) % P == 0:
            ans += i + 1
    return ans


if P in (2, 5):
    ans = solve25()
    print(ans)
    exit()

# U[i]: int(S[i:]) % P
U = [0] * N
n = 0
p = 1
for i, c in reversed(list(enumerate(S))):
    n += int(c) * p
    n %= P
    U[i] = n
    p *= 10
    p %= P

counts = [0] * P
for u in U:
    counts[u] += 1

ans = counts[0]
for i in reversed(range(N)):
    # U[i] を引いたときに 0 (mod P) となる数
    counts[U[i]] -= 1
    ans += counts[U[i]]
print(ans)


Measured memory_bytes: 36892
#include<stdio.h>
int main(){
  int h,w;
  // char s;
  // s ='#';
  while (1)
  {
    scanf("%d",&h);
    scanf("%d",&w);
    if(w == 0 && h == 0 )break;
    for (int i = 0; i < h; i++)
    {
      for (int j = 0; j < w; j++)
      {
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  ///////////////////////////////////////////////////////////
  //   while (1)
  // {
  //   scanf("%d",&h);
  //   scanf("%d",&w);
  //   if(w == 0 && h == 0 )break;
  //   for (int i = 0; i < h; i++)
  //   {
  //     for (int j = 0; j < w; j++)
  //     {
  //       if(j == 0 || j == w-1 || i == 0 || i == h-1 ) s = '#';
  //       else
  //       {
  //         s = ' ';
  //       }
        
  //       printf("%c",s);
  //     }
  //     printf("\n");
  //   }
  //   printf("\n");
  // }
  return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	ll n;
	cin >> n;
	ll sum = 0;
	for (int i = 1;i <= n;i++)
		for (int j = 1;j <= n;j++)
			for (int k = 1;k <= n;k++)
				sum += __gcd(i, __gcd(j, k));
	cout << sum << '\n';
}


Measured memory_bytes: 3652
//#define _USE_MATH_DEFINES // for C++
//#include <cmath>
#include <stdio.h>
//#include <vector>

using namespace std;

int gcd(int x, int y){

	int a, b, c;
	int ans;


	if (x >= y){
		a = x;
		b = y;
	}
	else{
		a = y;
		b = x;
	}

	c = a % b;
	if (c == 0){
		ans = b;
	}
	else{
		ans = gcd(b, c);
	}

	return ans;

}


int main(){
	
	int x, y;

	scanf("%d %d", &x, &y);

	printf("%d\n", gcd(x, y));

	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3
#define MAX_N 1000000001

struct state {
    int v, rest, c;
};

bool operator<(const state &a, const state &b) {
    return a.c > b.c;
}

int main(){
    cin.sync_with_stdio(false);
    int n, m, l, k, a, h;
    while(cin >> n >> m >> l >> k >> a >> h, n) {
        set<int> freezer{a, h};
        int d[n][n];
        rep(i, n)rep(j, n) d[i][j] = (i == j) ? 0 : INF;

        rep(i, l) {
            int tmp;
            cin >> tmp;
            freezer.insert(tmp);
        }

        rep(i, k) {
            int x, y, t;
            cin >> x >> y >> t;
            d[x][y] = d[y][x] = t;
        }
        rep(i, n)rep(j, n)rep(k, n) minch(d[j][k], d[j][i] + d[i][k]);


        priority_queue<state> q;
        q.push(state{a, m, 0});
        bool visited[n][m + 1] = {};

        int ans = -1;
        while(!q.empty()) {
            state s = q.top(); q.pop();

            if (visited[s.v][s.rest]) continue;
            else visited[s.v][s.rest] = true;

            if (s.v == h) {
                ans = s.c;
                break;
            }

            each(i, freezer) {
                if (d[s.v][i] < m + 1 && !visited[i][max(0, s.rest - d[s.v][i])]) {
                    int plus = 0;
                    if (s.rest < d[s.v][i]) plus = d[s.v][i] - s.rest;
                    q.push(state{i, max(0, s.rest - d[s.v][i]), s.c + d[s.v][i] + plus});
                }
            }
        }

        if (ans > 0) {
            cout << ans << endl;
        } else {
            cout << "Help!" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
#define MN 3000
#define mod 1000000007
const int inv=(mod+1)/2;
inline int read()
{
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='1') f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
int ax[MN+5],ay[MN+5],n,m,a[MN+5],f[MN+5][MN+5],mem[MN+5][MN+5];
void Revise(int x,int y,int z)
{
    f[x][y]=1LL*(mem[x][y]+mem[x][z])*inv%mod;
    f[y][x]=1LL*(mem[y][x]+mem[z][x])*inv%mod;
}
int main()
{   
    n=read();m=read();int num=1;
    for(int i=1;i<=n;++i) a[i]=read();
    for(int i=1;i<=m;++i) ax[i]=read(),ay[i]=read(),num=num*2%mod;
    for(int i=1;i<=n;++i) for(int j=i+1;j<=n;++j) f[i][j]=num;
    for(int i=m;i;--i)
    {
        if(ax[i]>ay[i]) swap(ax[i],ay[i]);
        for(int j=1;j<=n;++j) 
            mem[j][ax[i]]=f[j][ax[i]],mem[ax[i]][j]=f[ax[i]][j],
            mem[j][ay[i]]=f[j][ay[i]],mem[ay[i]][j]=f[ay[i]][j];
        for(int j=1;j<=n;++j) if(j!=ax[i]&&j!=ay[i]) Revise(j,ax[i],ay[i]),Revise(j,ay[i],ax[i]);
        f[ax[i]][ay[i]]=f[ay[i]][ax[i]]=1LL*(f[ax[i]][ay[i]]+f[ay[i]][ax[i]])*inv%mod;
    }
    int ans=0;
    for(int i=1;i<=n;++i) for(int j=i+1;j<=n;++j) 
    {
        if(a[i]<a[j]) ans=(ans+f[j][i])%mod;
        if(a[i]>a[j]) ans=(ans+f[i][j])%mod;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 70912
# AGC013A - Sorted Arrays
def main():
    n = int(input())
    A = tuple(map(int, input().rstrip().split()))

    # compress continuous parts of same numbers (e.g. 111 -> 1)
    B, cur = [], 0
    for i in A:
        if i != cur:
            B += [i]
            cur = i
    B += [0]

    # check the modified sequence
    ans, cur = 0, B[0]
    flg = B[0] < B[1]  # increasing (1) / decreasing (0)
    for i, j in enumerate(B[1:-1], start=1):
        if (flg and j < cur) or (not flg and j > cur):
            ans += 1
            flg = B[i] < B[i + 1]
        cur = j
    print(ans + 1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14356
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <cstdlib>
#define INF 998244353

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pi;

const ll MOD = 1e9+7;

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
/*
long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}*/

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool IsPrime(int num)//素数判定
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

map< ll, ll > prime_factor(ll n) {//素因数分解
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

ll calcNumOfCombination(ll n, ll r){
    ll num = 1;
    for(ll i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

int bubblesort(vector<int> array,int size){//バブルソート　転倒数
    int kaisu = 0;
    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size; j++){
            if(array[i] > array[j]){
                int number = array[i];
                array[i] = array[j];
                array[j] = number;
                kaisu++;
            }
        }
    }
    return kaisu;
}

ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = (sum * i)%MOD;
    }
    return sum;
}

// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}



int main() {
 ll A,B,K;
 cin >> A >> B >> K;
 if(A<K){
     K-=A;
     A=0;

 }else{
     A-=K;
     K=0;
 }
 if(B>K){
     B-=K;
 }else{
     B=0;
 }
 cout << A << endl;
 cout << B << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (void){
	int n,tmp, min,cont=1;
	scanf("%d", &n);
	scanf("%d", &min);
	for(int i=1;i<n;i++){
		scanf("%d", &tmp);
		if(tmp>=min){
			cont++;
			if(tmp>min)min=tmp;
		}
	}
	printf("%d\n",cont);
	return 0;
}

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

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef pair<Weight, int> Result;
Result visit(int p, int v, const Graph &g) {
  Result r(0, v);
  for(auto &e: g[v]) if (e.dst != p) {
    Result t = visit(v, e.dst, g);
    t.first += g[v].size()==2; //e->weight;
    if (r.first < t.first) r = t;
  }
  return r;
}
Weight diameter(const Graph &g) {
  Result r = visit(-1, 0, g);
  Result t = visit(-1, r.second, g);
  return t.first; // (r.second, t.second) is farthest pair
}

int main(){
	int V,s,t;
	scanf("%d",&V);
	Graph g(V);
	for(;V>1;V--)scanf("%d%d",&s,&t),s--,t--,g[s].push_back(Edge(s,t,1)),g[t].push_back(Edge(t,s,1));
	printf("%d\n",diameter(g)+count_if(g.begin(),g.end(),[](auto &e){return e.size()==1;}));
}

Measured memory_bytes: 6784
# -*- coding: utf-8 -*-
### 長方形内に円が収まっているかを判定する。
### 治っていれば Yes、いなければNo を出力する。
### 図形は2次元平面上にある。

str_in = raw_input()
int_in = map(int, str_in.split())

rect_W = int_in[0]
rect_H  = int_in[1]
circle_x  = int_in[2]
circle_y = int_in[3]
circle_r = int_in[4]

circle_x_max = circle_x + circle_r
circle_x_min = circle_x - circle_r
circle_y_max = circle_y + circle_r
circle_y_min = circle_y - circle_r

if circle_x_max <= rect_W:
	if circle_x_min >= 0:
		if circle_y_max <= rect_H: 
			if circle_y_min >= 0:
				print ('Yes')
				exit()
print ('No')



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

int main() {
  long long n, k; cin >> n >> k;
  long long ans=0;
  for (long long i = k; i <= n+1; i++) {
    ans += (i*n - i*(i-1) + 1)%1000000007 + 1000000007;
    ans%=1000000007;
  }
  cout << (ans%1000000007 + 1000000007) % 1000000007;
  return 0;
}


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

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

void solve(std::vector<std::string> s) {
  rep(i, 3) cout << (char)(s[i][0] - ' ');
  cout << endl;
}

int main() {
    std::vector<std::string> s(3);
    for(int i = 0 ; i < 3 ; i++){
        std::cin >> s[i];
    }
    solve(std::move(s));
}


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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    s = input()

    if s == "ABC":
        return "ARC"

    return "ABC"


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9052
n,q = (int(num) for num in input().split())
par = [n] * n
visited = [0] * n
val = [0] * n
ab = []
for i in range(n-1):
    a,b = (int(num)-1 for num in input().split())
    par[b] = a
    
for _ in range(q):
    p,x = (int(num) for num in input().split())
    p -= 1
    val[p] += x

for i in range(1,n):
    val[i] += val[par[i]]
    
ans = ""
for num in val:
    ans += str(num) + " "
print(ans)    
    

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

int N;

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

    return rec;
}

int main() {
    cin >> N;

    vector<int> ans;
    for (int i = 2; i <= 55555 && ans.size() != N; i++) {
        if (isPrime(i)) {
            if (i % 5 == 1) {
                ans.push_back(i);
            }
        }
    }

    for (int i = 0; i < ans.size() - 1; i++) {
        cout << ans[i] << " ";
    }
    cout << ans[ans.size() - 1] << endl; 
    
    return 0;
}


Measured memory_bytes: 256
module.exports=function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";var i=r(1);r(2)(i.readFileSync("/dev/stdin","utf8"))},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";var i=r(3),n=r(5);e.exports=function(e){var t=new i(e);n(t)}},function(e,t,r){"use strict";var i=r(4);e.exports=class{constructor(e){var t=e.trim().split(/\s+/g);this.inp=new i(t)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(e,t,r){"use strict";e.exports=class{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=e.length,this.items=e,this.ind=0}enq(e){this.size+=1,this.items.push(e)}deq(){var e=this.items[this.ind];return this.size-=1,this.ind+=1,e}clear(){this.items=[],this.size=0,this.ind=0}}},function(e,t,r){"use strict";var i=r(6);e.exports=function(e){for(var t=e.in(),r=e.in(),n=new Array(t),s=0;s<t;s++){var o=e.inr();n[s]=o.split("")}function u(e,s){var o=0,u=0,a=new i;for(a.enq([e,s]);a.size>0;){var h=a.deq(),l=!0,d=n[h[0]][h[1]];if("+"!=d){"."==d?(u++,l=!1):"#"==d&&o++,n[h[0]][h[1]]="+";for(var c=[[1,0],[-1,0],[0,1],[0,-1]],f=0;f<4;f++){var p=h[0]+c[f][0],v=h[1]+c[f][1];p<0||t<=p||v<0||r<=v||"+"!=n[p][v]&&(l&&"#"==n[p][v]||(l||"."!=n[p][v])&&a.enq([p,v]))}}}return o*u}for(var a=0,h=0;h<t;h++)for(var l=0;l<r;l++)"+"!=n[h][l]&&(a+=u(h,l));console.log(a)}},function(e,t,r){"use strict";e.exports=class{constructor(){this.size=0,this.head={value:void 0,pre:void 0,next:void 0},this.tail={value:void 0,pre:void 0,next:void 0}}enq(e){this.size+=1;var t={value:e,pre:void 0,next:void 0};this.head.next?(this.tail.pre.next=t,t.pre=this.tail.pre,t.next=this.tail,this.tail.pre=t):(this.head.next=t,this.tail.pre=t,t.pre=this.head,t.next=this.tail)}deq(){if(0!=this.size){this.size-=1;var e=this.head.next.value;return this.head.next=this.head.next.next,this.head.next.pre=this.head,e}}top(){return this.head.next.value}deleteFirstX(e){for(var t=this.head.next;t.next;){if(t.value==e)return t.pre.next=t.next,t.next.pre=t.pre,t=void 0,this.size-=1,!0;t=t.next}return!1}getValuesArray(){for(var e=[],t=this.head.next;t.next;)e.push(t.value),t=t.next;return e}}}]);

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

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

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

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

using namespace std;

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

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

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

// Problem Specific Parameter:

int a, b;
int d[11][11];
int val[11][11];

using edge = tuple<int, int, int>;
vector<edge> graph;

using edge2 = tuple<int, int, char>;
vector<edge2> graph2;

void trial(int alimit, int blimit) {
	graph.clear();
	graph2.clear();
	rep(i, a)rep(j, b) val[i][j] = 1010;

	const int n = alimit * blimit + 1;
	const int s = 0, t = n - 1;

	rep(ca, alimit)rep(cb, blimit) {
		int tmp[11][11];
		rep(x, a)rep(y, b) tmp[x][y] = ca * (x + 1) + cb * (y + 1);
		int cmax = 0;
		rep(x, a)rep(y, b) chmax(cmax, d[x][y] - tmp[x][y]);
		if (cmax > 100) continue;

		rep(x, a)rep(y, b) chmin(val[x][y], tmp[x][y] +  cmax);
		const int idx = blimit * ca + cb;
		graph.push_back(edge(idx, t, cmax));
	}

	rep(ca, alimit - 1) {
		graph2.push_back(edge(blimit * ca, blimit * (ca + 1), 'X'));
	}

	rep(ca, alimit)rep(cb, blimit - 1) {
		graph2.push_back(edge(blimit * ca + cb , blimit * ca + cb + 1, 'Y'));
	}

	rep(x, a)rep(y, b) if (val[x][y] != d[x][y]) return;

	puts("Possible");
	const int m = graph.size() + graph2.size();
	cout << n << " " << m << endl;
	for (auto &it : graph) {
		int a, b, c;
		tie(a, b, c) = it;
		cout << a + 1 << " " << b + 1 << " " << c << endl;
	}

	for (auto &it : graph2) {
		int a, b;
		char  c;
		tie(a, b, c) = it;
		cout << a + 1 << " " << b + 1 << " " << c << endl;
	}

	cout << s + 1 << " " << t + 1 << endl;
	exit(0);
}


int main(void) {
	cin >> a >> b;
	rep(i, a)rep(j, b) cin >> d[i][j];

	rep(one, 1, 18) {
		const int other = 299 / one;
		trial(one, other);
		trial(other, one);
	}


	puts("Impossible");
	return 0;
}

Measured memory_bytes: 256
import collections

nil = -1

def preParse(u):
    if u == nil:
        return None
    print(' {}'.format(u), end='')
    preParse(tree[u]['left'])
    preParse(tree[u]['right'])

def inParse(u):
    if u == nil:
        return None
    inParse(tree[u]['left'])
    print(' {}'.format(u), end='')
    inParse(tree[u]['right'])

def postParse(u):
    if u == nil:
        return None
    postParse(tree[u]['left'])
    postParse(tree[u]['right'])
    print(' {}'.format(u), end='')

if __name__ == '__main__':
    n = int(input())
    tree = collections.defaultdict(dict)
    roots = list()
    for _ in range(n):
        id_num, left, right = [int(x) for x in input().split()]
        tree[id_num]['left'] = left
        tree[id_num]['right'] = right
        if left != nil:
            tree[left]['parent'] = id_num
        if right != nil:
            tree[right]['parent'] = id_num
    
    for key, val in tree.items():
        if not 'parent' in tree[key]:
            roots.append(key)
    
    print('Preorder')
    preParse(roots[0])
    print()
    print('Inorder')
    inParse(roots[0])
    print()
    print('Postorder')
    postParse(roots[0])
    print()


Measured memory_bytes: 6012
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
int solve()
{
	int n,r;
	cin>>n>>r;
	if(n>=10)
		cout<<r;
	else
		cout<<100*(10-n)+r;		



}
signed main()
{
	fastio;
	clock_t start, end;
//	test
	{
		start=clock();
		solve();
		end=clock();
		double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
//		cout<<time_taken<<endl;
	}
}


Measured memory_bytes: 256