akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; (i)<(n); ++(i))
#define rep1(i, n) for(int i = 1; (i)<(n); ++(i))
#define rev_rep(i, n) for(int i = (n) - 1; (i) >= 0; --(i))
#define range(a, i, b) for(int i = (a); (i) < (b); ++(i))
#define dump(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()
#define readl(N) ll N; cin >> N
#define readlv(N, vec) vector<ll> vec(N); rep(i, N){cin >> vec[i];}
#define greater_than [](ll l, ll r){return l > r;}
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair);
template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair){
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(ll i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::set<T>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

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

ll fact(ll n){
  ll res=1;
  while(n>=0){
    res*=n;
    n--;
  }
  return res;
}
    
ll pow(ll i, ll n){
  ll res=1;
  while(n>=0){
    res*=i;
    n--;
  }
  return res;
}

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  readl(n);
  vector<ll> a;
  rep(i, n){
    ll x;
    cin >> x;
    a.push_back(x);
  }

  map<ll, ll> m;

  rep(i, a.size()){
    m[a[i]]++;
  }
  vector<ll> b, c;
  for(auto&& x:m){
    if(x.second >= 4){
      b.push_back(x.first);
    }
    if(x.second >= 2){
      b.push_back(x.first);
    }
  }

  sort(all(b));

  // dump(b);
  if(b.size() >= 2){
    cout << b[b.size() - 1] * b[b.size() - 2] << endl;
  }else{
    cout << 0 << endl;
  }

  
}
#endif


Measured memory_bytes: 7284
from numba import jit
import math

N, K = map(int,input().split())
h = list(map(int,input().split()))
@jit
def nya(N, K, h):
  dp=[0]*N
  for i in range(1,N):
    value=math.inf
    for j in range(1,K+1):
      if i-j<0:
        break
      value=min(value,dp[i-j]+abs(h[i]-h[i-j]))
    dp[i]=value
  return(dp[N-1])
 
print(nya(N,K,h))

Measured memory_bytes: 117576
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	x, y, z := scanInt(), scanInt(), scanInt()
	fmt.Println(z, x, y)
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
void solve()
{
	//Enter your code here Tanmay:)
	int n,sum=0,flag=0;
	cin>>n;
	string arr[n];int a[n];
	string x;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i]>>a[i];
	}
	cin>>x;
	for(int i=0;i<n;i++)
	{
		if(flag==1)
			sum+=a[i];
		if(arr[i]==x)
		{
			flag=1;
		}
		
	}
	cout<<sum;
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))

/*}}}*/
ll MOD = 1e9+7;
int main() {
  ll n;
  cin >> n;
  string s,t;
  cin >> s >> t;
  ll ans = 1;
  REP(i,n){
    if(i==0){
      if(s[i]==t[i]) ans = 3;
      else {
        ans = 6;
        i++;
      }
    }else{
      if(s[i]!=t[i]){
        if(s[i-1]!=t[i-1]){
          // aacc
          // bbdd
          ans *= 3;
          ans %= MOD;
        }else{
          // acc
          // add
          ans *= 2;
          ans %= MOD;
        }
        i++;
      }else{
        if(s[i-1]!=t[i-1]){
          // aac
          // bbc
          ans *= 1;
          ans %= MOD;
        }else{
          // ab
          // ab
          ans *= 2;
          ans %= MOD;
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main implements Runnable {
	
    public static void main(String[] args) {
    	new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }
    
    public void run() {
        FastScanner sc = new FastScanner();
        char[] c = sc.next().toCharArray();
        
        int sum = 0;
        
        for(char i:c){
        	if(i=='o'){
        		sum ++;
        	}
        }
        
        sum += 15-c.length;
        
        if(sum>=8){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }
        
    }

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 21332
A, B, C, X, Y = map(int, input().split())

cost = min(A+B, 2*C)*min(X, Y)

if X<Y:
    cost+=min(B, 2*C)*(Y-X)
    print(cost)
elif Y<X:
    cost+=min(A, 2*C)*(X-Y)
    print(cost)
else:
    print(cost)

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

""" Input
S = input().rstrip()
N = int(input())
A = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""

A, B, C = map(int, input().split())

ans = 0
amari = A - B
if amari > C:
    print(ans)
else:
    print(C - amari)


# def main():

# if __name__ == '__main__':
#     main()


Measured memory_bytes: 3572
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include<complex>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;


int main(){
	int a, b, c;
	cin >> a >> b >> c;
	rep(i, a*b) {
		if (i%a == 0 && i%b == c) {
			cout << "YES";
			return 0;
		}
	}
	cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	ll ans=1;
	while(n>0){
		if(ans<k) ans*=2;
		else ans+=k;
		n--;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
use std::collections::*;
use std::io::*;
struct StdinReader<R: BufRead> {
    pub reader: R,
    pub buf: String,
}
impl<R: BufRead> StdinReader<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf: String::new(),
        }
    }
}
macro_rules! get {
    ($r:expr, $t:ty) => {
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($r:expr, $($t:ty),*) => {
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($r:expr, $t:ty; $n:expr) => {
        // items in n lines
        (0..$n).map(|_|
                    get!($r, $t)
                   ).collect::<Vec<_>>()
    };
    ($r:expr, $($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($r, $($t),*)
                   ).collect::<Vec<_>>()
    };
    ($r:expr, $t:ty ;;) => {
        // items in a line
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($r:expr, $t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($r, $t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let reader = stdin();
    let mut reader = StdinReader::new(reader.lock());
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    let D = get!(reader, i64);
    let c = get!(reader, i64;;);
    let s = get!(reader, i64;;D);
    let t = get!(reader, usize;D);
    let mut last: [i64; 26] = [0; 26];
    let mut sum: i64 = 0;
    for i in 1..=D {
        last[t[i as usize - 1] - 1] = i;
        sum += s[i as usize - 1][t[i as usize - 1] - 1];
        let mut down: i64 = 0;
        for j in 0..26 {
            down += c[j] * (i - last[j]);
        }
        sum -= down;
        writeln!(out, "{}", sum);
    }
}


Measured memory_bytes: 2248
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i=0;i< int (n);i++)

int main(void)
{
    int  A, B;
    
    cin >> A >> B;
    rep(i, 1100)    
    {
        if (((i * 8 / 100) == A) && (i / 10 == B))
        {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
int main()
{
    ll ans = 0, a, b, c, k;
    cin >> a >> b >> c >> k;
    if(a + b >= k)ans = min(a, k);
    else ans = 2*a + b - k;
    cout << ans << endl;

    return 0;
}

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

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	int n;
	cin >> n;
	string s[n][10];
	
	for(int i=0;i<n;i++){
		cin >> s[i][0];
	}
	
	for(int i=0;i<n-1;i++){
		if(s[i][0][s[i][0].length()-1]!=s[i+1][0][0]){
			cout << "No" << endl;
			return 0;
		}
	}
	
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			if(s[i][0]==s[j][0]){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	
	cout << "Yes" << endl;
	return 0;
}


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

#define ran 505505

char s[ran];

int main() {
	scanf("%s", s);
	
	int n = strlen(s);
	int det = 202202;
	for(int i=0;i<n;i++)
		s[i+det] = s[i];
	int l = det, r = det+n-1;
	
	int f = 0, q;
	scanf("%d", &q);
	for(int i=0;i<q;i++) {
		int op;
		scanf("%d", &op);
		if(op==1) f = 1-f;
		else {
			int dir;
			char t[11];
			scanf("%d%s", &dir, t);
			if(dir-1==f) {
				l--;
				s[l] = t[0];
			} else {
				r++;
				s[r] = t[0];
			}
		}
	}
	
	if(f==0) for(int i=l;i<=r;i++) putchar(s[i]);
	else for(int i=r;i>=l;i--) putchar(s[i]);
	puts("");
	
	return 0;
}

Measured memory_bytes: 896
S = str(input())
S = S[:-1]

hantei = False
while hantei == False:
    if len(S) % 2 == 1:
        S = S[:-1]
    else:
        half = int(len(S)/2)
        last = int(len(S))
        if S[0:half] == S[half:last]:
            print(last)
            hantei = True
        else:
            S = S[0:-1]


Measured memory_bytes: 3060
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.util.*;
/**
 *
 * @author arvin
 */
public class Main {
 
    static double dp[][],a[];
    static int n;
    
    static double rec(int x,int y)
    {
        if((n&1)==1 && y>n/2)
            return 0.0;
         if((n&1)==0 && y>=n/2)
            return 0.0;
        if(x==n)
            return 1.0;
        if(dp[x][y]!=2.0)
            return dp[x][y];
        double ab,ch;
        if(dp[x+1][y]==2.0)
        {
            //System.out.print((x+1)+" "+y+" "+a[x]+" ");
            ab=a[x]*rec(x+1,y);
        }
        else
            ab=a[x]*dp[x+1][y];
        if(dp[x+1][y+1]==2.0)
            ch=(1-a[x])*rec(x+1,y+1);
        else
            ch=(1-a[x])*dp[x+1][y+1];
        dp[x][y]=ab+ch;
        //System.out.print(ab+" "+ch);
        return dp[x][y];
    }
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        dp=new double[n+1][n/2+5];
        a=new double[n];
        for(int i=0;i<=n;i++)
            Arrays.fill(dp[i],2.0);
        sc.nextLine();
        String abc[]=sc.nextLine().split(" ");
        for(int i=0;i<n;i++)
            a[i]=Double.parseDouble(abc[i]);
        System.out.println(rec(0,0));
        
        sc.close();
    }
}


Measured memory_bytes: 84924
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

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

    pair<ll, ll> x[n];

    rep(i, 0, n){
        ll t1, t2;
        cin >> t1 >> t2;
        x[i].first = t1 - t2;
        x[i].second = t1 + t2;
    }

    sort(x, x + n);
    ll end = -10000000000;
    ll count = 0;
    rep(i, 0, n){
        if(x[i].first >= end){
            count++;
            end = x[i].second;
        }else{
            end = min(end, x[i].second);
        }
    }

    cout << count << endl;
    return 0;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

vector<int> ch[28];

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

    string s;
    int K;

    cin >> s;
    cin >> K;

    for(int i=0; i<s.size(); i++){
        ch[s[i]-'a'].pb(i);
    }

    set<string> small;

    for(int i=0; i<26; i++){
        for(int j=0; j < ch[i].size(); j++){
            for(int k=ch[i][j]; k<min(ch[i][j]+5, (int)s.size()); k++){
                string cand = s.substr(ch[i][j], k-ch[i][j]+1);
                //cout << cand << endl;
                //cout << small.size() << endl;
                small.insert(cand);
            }
        }

        if(small.size() >= K){
            int cnt = 0;
            for(auto it=small.begin(); it!=small.end(); it++){
                cnt++;

                if(cnt == K){
                    cout << *it << endl;
                    return 0;
                }
            }
        }
    }


    
    return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[] ab = {a+b, a-b, a*b};
        System.out.println(maxInt(ab));
    }

    private static int maxInt(int[] array) {
        int max = array[0];
        for (int i = 1; i < array.length; i++) {
            if (max < array[i]) max = array[i];
        }
        return max;
    }

    private static long maxLong(long[] array) {
        long max = array[0];
        for (int i = 1; i < array.length; i++) {
            if (max < array[i]) max = array[i];
        }
        return max;
    }

    private static int minInt(int[] array) {
        int min = array[0];
        for (int i = 1; i < array.length; i++) {
            if (min > array[i]) min = array[i];
        }
        return min;
    }

    private static long minLong(long[] array) {
        long min = array[0];
        for (int i = 1; i < array.length; i++) {
            if (min > array[i]) min = array[i];
        }
        return min;
    }

}


Measured memory_bytes: 21844
n, w = map(int, input().split())
dp = [[0 for _ in range(w+1)] for _ in range(n+1)]


for i in range(n):
    wi, vi = map(int, input().split())
    sum_w = 0
    while sum_w <= w:
        if sum_w - wi >= 0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - wi] + vi)
        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])
        sum_w += 1

print(dp[n][w])

Measured memory_bytes: 171528
N = int(input())
cnt1 = 0 # 正の約数を数える
cnt2 = 0 # ちょうど8個のものを数える
for i in range(1, N+1, 2):
  for j in range(1, i+1, 2):
    if i % j == 0:
      cnt1 += 1
    else:
      pass
  if cnt1 == 8:
    cnt2 += 1
  else:
    pass
  cnt1 = 0
print(cnt2)

Measured memory_bytes: 3060
N,W= map(int,input().split())
w=[0]*N
v=[0]*N

for i in range(N):
  w[i],v[i]=map(int,input().split())
  
dp=[[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(1,N+1):
  for j in range(0,W+1):
    if j<w[i-1]:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max( dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1] )
      
print(dp[N][W])

Measured memory_bytes: 171400
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


int main()
{
string n;
cin>>n;
for(int i=0; i<3; i++)
{
    if(n[i]=='1'){cout<<'9'; }
    else if(n[i]=='9'){cout<<'1'; }
}
    return  0;
}

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

signed main()
{
    set<int> s;
    int cnt=0;
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int hoge,piyo;
    cin >> hoge;
    for(int i=0;i<hoge;++i)
    {
        cin >> piyo;
        if(piyo >= 3200)
        {
            ++cnt;
        }
        else
        {
            s.insert( piyo/400);
//            cout << piyo/400 << endl;
        }
    }
    int a = (s.size() == 0);
    cout << a + s.size() << " "<<s.size() + cnt << endl;
}


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

int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; i ++) {
    int tmp; cin >> tmp;
    mp[tmp] ++;
  }

  int ans = 0;
  for (auto m: mp) {
    if (m.second % 2 == 1) ans ++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 4992
s = input()
q = int(input())

prev = ""
aft = ""
rev = 0
for i in range(q):
	g = input()
	if len(g) == 1:
		rev += 1
	else:
		f = int(g[2])
		c = g[4]
		if f == 2:
			if rev%2 == 1:
				prev = c + prev
			else:
				aft = aft + c
		else:
			if rev%2 == 0:
				prev = c + prev
			else:
				aft = aft + c
if rev%2 == 1:
	print(aft[::-1]+s[::-1]+prev[::-1])
else:
	print(prev+s+aft)

Measured memory_bytes: 4476
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
	int a,b;
  	
  	cin >> a>>b;
 // cout<<b<<endl;
  	if (a>=13){
    	cout<<b<<endl;
    }
  	else if(5<a&&a<13){
    	cout<<b/2<<endl;
    }
  	else{
    	cout<<"0"<<endl;
    }
      
  	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, ll> p;
 
#define MOD 1000000007

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

    ll N, D, A;
    cin >> N >> D >> A;

    vector<p> k(N);
    vector<ll> s(N);

    ll S = 0;

    for(int i = 0; i < N; i++) {
        ll X, H;
        cin >> X >> H;
        k[i] = make_pair(X, H);
    }

    sort(k.begin(), k.end());

    vector<ll> x(N);
    vector<ll> h(N);

    for(int i = 0; i < N; i++) {
        x[i] = k[i].first;
        h[i] = k[i].second;
    }

    ll ans = 0;

    for(int i = 0; i < N; i++) {
        h[i] -= S;
        if(h[i] > 0) {
            ll a = h[i] / A;
            if(a * A < h[i]) {
                a++;
            }
            ans += a;
            S += a * A;
            ll pos = upper_bound(x.begin(), x.end(), x[i] + 2 * D) - x.begin() - 1;
            s[pos] += a * A;
        }
        S -= s[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 11068
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello
{
    public static void Main()
    {
        //商品の値段を保持する
        var price = int.Parse(Console.ReadLine());
        //最小限のお金1000円
        var min = 1000;
        var ans = 0;
        //おつりがプラスで戻ってくるまでループし続ける
        for (var cnt = 1; cnt <= 10; cnt++)
        {
            if (0 <= min - price)
            {
                //おつりがプラスで戻ってきたらループを抜ける
                ans = min - price;
                break;
            }
            min += 1000;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 27516
#include <iostream>
using namespace std;
#define ll long long int 
ll a[10001];
int main() {
	// your code goes here
	ll i,j,k,n;
	cin>>n;
	for(i=1;i<=n;i++){
	    for(j=1;j<=n;j++){
	        if(i*i+j*j+i*j > n) break;
	        for(k=1;k<=n;k++){
	            ll cv = i*i + j*j + k*k + i*j+j*k+k*i;
	            if(cv > n) break;
	            a[cv]+=1;
	        }
	    }
	}
	//for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=1;i<=n;i++)cout<<a[i]<<"\n";
	
    
	return 0;
}


Measured memory_bytes: 3664
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <list>
#include <string>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;

int main()
{
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    ll ret = 0;
    for (int r = 0; r <= 3000; r++)
    {
        if (r * R > N)
            break;
        for (int g = 0; g <= 3000; g++)
        {
            ll tmp = r * R + g * G;
            if (tmp > N)
                break;

            if ((N - tmp) % B == 0)
                ret++;
        }
    }

    cout << ret << endl;
}

void cheatsheet()
{
    // loop
    // vector<int> vec(10);
    vector<int> vecloop;
    REP(i, 10)
    {
        vecloop.push_back(i);
    }

    // swap
    int a = 1;
    int b = 5;
    swap(a, b); // -> a = 5, b = 1

    // sort
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    sort(arr, arr + 9, greater<int>()); // 9 8 7 6 5 4 3 2 1

    // lower
    vector<int> vec(arr, end(arr));
    sort(vec.begin(), vec.end());
    cout << lower_bound(vec.begin(), vec.end(), 2)[0]; // 2

    // map
    map<Pll, ll> m;
    m[Pll(10, 100)] = 100;
}

Measured memory_bytes: 256
N = int(input())
array = []
for i in range(N):
  a = int(input())
  array.append(a)
n = 1
c = 0
while n != 2:
  n = array[n-1]
  c += 1
  if c > (10 ** 5):
    break
if c > (10 ** 5):
  print("-1")
else:
  print(c)

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

int main(){
  int p,q,r;
  int min;

  scanf("%d %d %d", &p, &q, &r);

  min = p + q;

  if(min > r + q) min = r + q;
  if(min > p + r) min = p + r;

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


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

int main(void){
    int n, x;
    cin >> n >> x;
    vector<int> jump(n);
    int cnt = 1, sum = 0;
    for (int i = 0; i < n; i++){
        cin >> jump.at(i);
        sum += jump.at(i);
        if(sum<=x){
            cnt++;
        }
    }
    printf("%d\n", cnt);

    return 0;
    }

Measured memory_bytes: 256
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = LLONG_MAX, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;
typedef pair<Pa, ll> info;

vector<int> strcompress(string S, int N){
    int count = 1;
    char c = S[0];
    vector<int> vec; 
	rep(i, N-1){
		if(c == S[i+1]){
			count++;
		}else{
			vec.push_back(count);
			count = 1;
			c = S[i+1];
		}
	}
	vec.push_back(count);
    return vec;
}

int main() {
    cin >> N;
    string s;
    cin >> s;
    vector<int> vec = strcompress(s, N);
    cout << vec.size();
}


Measured memory_bytes: 1148
#include<bits/stdc++.h>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
typedef long long ll;
using namespace std;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N,ans=0;
  cin>>N;
  vector<int> V(N),C(N);
  REP(i,N)cin>>V[i];
  REP(i,N)cin>>C[i];
  REP(i,N){
    if(V[i]>=C[i]){
      ans+=V[i]-C[i];
    }
  }
  cout<<ans;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <math.h>
#include <stdlib.h>
#include <numeric>


int main(){
	int n;
	std::cin >> n;
	std::cout << std::min(std::max(n - 0, 0), 9) + std::min(std::max(n - 99, 0), 900) + std::min(std::max(n - 9999, 0), 90000) << std::endl;
	return 0;
}


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

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

    int N;
    cin >> N;
    string s;
    cin >> s;
    
    if(N % 2 == 0){
        string first = "", second = "";
        rep(i,N/2){
            first += s[i];
            second += s[i + N/2];
        }
        
        if(first == second){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string A,B;
  int ans=0;
  cin >> A >> B;
  for(int i=0;i<3;i++){
    if(A[i]==B[i]){
      ans++;
    }
  }
    cout << ans <<endl;
}


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

int main() {
    int n; cin >> n;
    vector<int> a(n);

    int max1=-1, max2=0;
    rep(i, a.size()) {
        cin >> a.at(i);
        if (i==0) {
            max1 = i;
        }
        else if (i == 1) {
            if (a.at(max1)> a.at(i)) {
                max2 = i;
            }
            else {
                max2 = max1;
                max1 = i;
            }
        }
        else {
            if (a.at(i) > a.at(max1)) {
                int tmp;
                tmp = max1;
                max1 = i;
                max2 = tmp;
            }
            else if (a.at(i) > a.at(max2)) {
                max2 = i;
            }
        }
    }

    rep(i, a.size()) {
        if (i == max1) {
            cout << a.at(max2) << endl;
        }
        else
            cout << a.at(max1) << endl;
    }
    return 0;
}

Measured memory_bytes: 2432
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
x, y = map(int, input().split())
if x == 1 and(y == 2 or y == 4):
    print('Yes')
    exit()
for i in range(x+1):
    tmp = 2*(x-i)+i*4
    if tmp == y:
        print('Yes')
        exit()
print('No')


Measured memory_bytes: 72820
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001001
#define mp make_pair
#define pb push_back

int N,D,A;
int X[200005],H[200005];
pair<int,int> XH[200005];
signed main(){
    scanf("%lld %lld %lld",&N,&D,&A);
    rep(i,N){
        scanf("%lld %lld",&X[i],&H[i]);
        XH[i]=mp(X[i],H[i]);
    }
    sort(XH,XH+N);
    int ans=0;
    int BOMBED[200100];
    rep(i,N)BOMBED[i]=0;
    rep(itr,N){
        if(itr>0){//累積和をまくる
            BOMBED[itr]+=BOMBED[itr-1];
            //すでに爆破された分の体力を引く
            XH[itr].second-=A*BOMBED[itr];
        }
        if(XH[itr].second>0){
            //自分を減らす
            int b=XH[itr].second/A+(XH[itr].second%A>0);
            //自分以降の減少累積和に一を足しておく
            BOMBED[itr+1]+=b;
            ans+=b;
            //printf("%lld\n",ans);
            int upperbomitr=upper_bound(XH,XH+N,mp(XH[itr].first+2*D+1,(int)-LLINF))-XH;
            if(upperbomitr<N)BOMBED[upperbomitr]-=b;
        }
    }
    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 7936
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,c,d; string s; int count=0;
  cin>>n>>a>>b>>c>>d>>s; string ans="Yes";
  for(int i=a-1;i<max(c-1,d-1)-1;i++){if(s.at(i)=='#'&&s.at(i+1)=='#'){ans="No"; break;}}
  if(ans=="Yes"&&c>d){for(int i=b-2;i+1<d;i++){if(s.at(i)=='.'&&s.at(i+1)=='.'&&s.at(i+2)=='.'){break;} else if(i==d-2){ans="No"; break;}}}
  cout<<ans<<endl;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll k,a,b;
    cin>>k>>a>>b;
    
    if(a%k==0)
    {
        cout<<"OK"<<endl;
        return 0;
    }
    else{
        ll n=a/k;
        ll p=(n+1)*k;
        if(p>=a && p<=b)
            cout<<"OK"<<endl;
        else cout<<"NG"<<endl;
    }
    
    return 0;
}


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

namespace TYC
{
	typedef pair<int, int> pii;
	const int N = 2005;

	int n, A[N], size[N];
	char str[N];
	vector<int> E[N];

	pii dfs(const int u, const int f)
	{
		size[u] = A[u];
		int val = 0, cnt = 0;
		for (int v : E[u])
			if (v != f)
			{
				pii tmp = dfs(v, u);
				int p = tmp.first; 
				size[u] += size[v];
				if (val >= p)
				{
					val -= p;
					int t = min(val >> 1, tmp.second);
					val -= t << 1;
					cnt += p + t + tmp.second;
				}
				else
				{
					p -= val;
					int t = min(p >> 1, cnt);
					p -= t << 1;
					cnt += t + val + tmp.second;
					val = p;
				}
			}
		return pii(size[u] + val, cnt);
	}

	void work()
	{
		scanf("%d%s", &n, str + 1);
		int tot = 0;
		for (int i = 1; i <= n; i++)
			if (str[i] == '1')
				A[i] = 1, ++tot;
		for (int i = 1, u, v; i < n; i++)
		{
			scanf("%d%d", &u, &v);
			E[u].push_back(v);
			E[v].push_back(u);
		}
		int mn = INT_MAX;
		for (int i = 1; i <= n; i++)
		{
			pii res = dfs(i, 0);
			if (res.first == tot)
				mn = min(mn, res.second);
		}
		printf("%d\n", mn == INT_MAX ? -1 : mn);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

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

	if(a + b >= c){
		cout << "Yes" << endl;	
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    ll all =0;
    vll a(n);
    rep(i,0,n){
        cin>>a[i];
        all^=a[i];
    }
    rep(i,0,n){
        ll ans=all^a[i];
        cout<<ans<<" ";
    }
    cout<<endl;
    return 0;
}




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



//xi未満の塗りつぶし
void xinf(int x,int y,int W,int H,bool xy[][101]){

    for(int i = 0;i <= x;i++){
        for(int j = 0;j <= H;j++){
            xy[i][j] = false;
        }
    }
}

//xi超過の塗りつぶし
void xsup(int x,int y,int W,int H,bool xy[][101]){
    for(int i = x+1;i <= W;i++){
        for(int j = 0;j <= H;j++){
            xy[i][j] = false;
        }
    }
}

void yinf(int x,int y,int W,int H,bool xy[][101]){
    for(int i = 0;i <= W;i++){
        for(int j = 0;j <= y;j++){
            xy[i][j] = false;
        }
    }
}

void ysup(int x,int y,int W,int H,bool xy[][101]){
    for(int i = 0;i <= W;i++){
        for(int j = y+1;j <= H;j++){
            xy[i][j] = false;
        }
    }
}

int main(void)
{
    int W,H,N,cnt = 0,x,y,a;
    bool xy[101][101];

    cin >> W >> H >> N;

    for(int i = 0;i <= W;i++){
        for(int j = 0;j <= H;j++){
            xy[i][j] = true;
        }
    }

    

    rep(i, N){
        cin >> x >> y >> a;

        switch (a)
        {
        case 1:
            xinf(x,y,W,H,xy);
            break;
        
        case 2:
            xsup(x,y,W,H,xy);
            break;

        case 3:
            yinf(x,y,W,H,xy);
            break;

        default:
            ysup(x,y,W,H,xy);
            break;
        }

    }

    for(int i = 1;i <= W;i++){
        for(int j = 1;j <= H;j++){
            if(xy[i][j] == true)
                cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void puts_all(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int N, R;
  while(cin >> N >> R){
    if(N >= 10){
      puts_all(R);
    }else{
      puts_all(R + 100*(10-N));
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define sz size()
#define pb push_back
#define bg begin()
#define ed end()
#define fi first()
#define se second()
using namespace std;
using ll = long long;
using vint = vector<int>;
using pint = pair<int,int>;
using vpint = vector<pint>;
template <typename T>
T sq(T x){
  return x * x;
}
ll mod = 1e9 + 7;

signed main (){
  int N;
  int used = 0; 
  cin >> N;
  rep(i,N){
    int l , r;
    cin >> l >> r;
      used += (r - l +1); 
  }
  cout << used << endl;
  return 0;
}


Measured memory_bytes: 3576
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if(A * C <= B) {
			System.out.println(C);
		} else {
			System.out.println(B / A);
		}
	}
}


Measured memory_bytes: 23124
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int X, A;
    cin >> X >> A;
    if (X < A) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    return 0;
}

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

#define PB push_back
#define MP make_pair
#define FF first
#define SS second

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

typedef long long LL;
typedef long long int64;

typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<PII> VII;

const int MAX_N = (1e4) + 7;
const int MAX_E = (1e6) + 7;
const int MOD   = (1e9) + 7;

string a,b;
char str [MAX_N];
int cnt, prev;
int main() {
#ifdef SANIM
    freopen("input.txt", "r", stdin);
#endif
    while (cin >> str) {
        prev = (str [0] - '0');
        cnt = 0;
        for (int i = 1; ; i++) {
            if ((str [i] - '0') == prev) {
                cnt++;
            } else {
                //cout << prev << " " << cnt << endl;
                if (prev == 0) {
                    if (cnt >= 1) {
                        for (int i = 1; i <= cnt; i++) cout << " ";
                    }
                } else if (prev == 1) {
                    cnt %= 5;
                    if (cnt == 0) cout << "'";
                    else if (cnt == 1) cout << ',';
                    else if (cnt == 2) cout << '.';
                    else if (cnt == 3) cout << '!';
                    else if (cnt == 4) cout << '?';
                } else if (prev == 2) {
                    cnt %= 6;
                    if (cnt <= 2) cout << (char) ('a' + cnt);
                    else cout << (char) ('A' + cnt - 3);
                } else if (prev == 3) {
                    cnt %= 6;
                    if (cnt <= 2) cout << (char) ('d' + cnt);
                    else cout << (char) ('D' + cnt - 3 );
                } else if (prev == 4) {
                    cnt %= 6;
                    if (cnt <= 2) cout << (char) ('g' + cnt);
                    else cout << (char) ('G' + cnt - 3);
                } else if (prev == 5) {
                    cnt %= 6;
                    if (cnt <= 2) cout << (char) ('j' + cnt);
                    else cout << (char) ('J' + cnt - 3);
                } else if (prev == 6) {
                    cnt %= 6;
                    if (cnt <= 2) cout << (char) ('m' + cnt);
                    else cout << (char) ('M' + cnt - 3 );
                } else if (prev == 7) {
                    cnt %= 8;
                    if (cnt <= 3) cout << (char) ('p' + cnt);
                    else cout << (char) ('P' + cnt - 4 );
                } else if (prev == 8) {
                    cnt %= 6;
                    if (cnt <= 2) cout << (char) ('t' + cnt);
                    else cout << (char) ('T' + cnt - 3 );
                } else if (prev == 9) {
                    cnt %= 8;
                    if (cnt <= 3) cout << (char) ('w' + cnt);
                    else cout << (char) ('W' + cnt - 4 );
                }

                if (str [i]) {
                    prev = str [i] - '0';
                    cnt = 0;
                } else break;
            }
        }

        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1140
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,a;
    bool ans=true;
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>a;
        if(a%2==0&&(a%5!=0&&a%3!=0))
            ans=false;
    }
    cout<<(ans?"APPROVED":"DENIED")<<endl;
}


Measured memory_bytes: 3572
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	
	int a,b,ab;
	int x,y;
	
	cin >> a >> b >> ab;
	cin >> x >> y;
	
	int cost_A= a*x;
	int cost_B= b*y;
	int total_cost=cost_A + cost_B;
	int cost_AB;
	
	for(int i=2;i<=2*max(x,y);i=i+2){
		
		cost_A=max(0,a*(x-i/2));
		cost_B=max(0,b*(y-i/2));
		cost_AB=ab*i;
		
		int now_cost=cost_A + cost_B + cost_AB;
		
		total_cost=min(total_cost,now_cost);
	}
	
	cout << total_cost << endl;
	
	return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    AN = map(int, input().split())

    ans = "APPROVED"
    for A in AN:
        if A % 2 == 0:
            if not (A % 3 == 0 or A % 5 == 0):
                ans = "DENIED"
                break

    print(ans)


main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int a[105];
int sum1[105],sum2[105];
int main()
{
    int n;

    {
        int a,p;
        scanf("%d%d",&a,&p);
        p+=a*3;
        printf("%d\n",p/2);







    }




    return 0;
}
//孙洪嘉好讨厌


Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.array, std.algorithm;
void main()
{
  int b=0;
  while(1){
    auto a = readln.split.map!(to!int);
    if(a[0]==0) break;
    if(b) writeln();
    int flag=0;
    for(uint i=a[0];i<=a[1];++i){
      if(i%4==0){
	if(i%100==0){
	  if(i%400==0){
	    flag=1;
	    i.writeln();
	  }
	}else{
	  flag=1;
	  i.writeln();
	}
      }
    }
    if(!flag) writeln("NA");
    b=1;
  }
}

Measured memory_bytes: 2384