akhauriyash/Code-Regression huggingface dataset:
import Data.Bits
import Data.Char

solve :: [Int] -> Int -> Int -> Int
solve [] _ acc = acc
solve [x] _ acc = acc + x
solve (x:y:xs) b acc
    | b .&. 1 == 1 = solve ((x*10+y):xs) (shiftR b 1) acc
    | otherwise = (solve (y:xs) (shiftR b 1)) (acc+x)

main = do
    s <- getLine
    let bit = (2 ^ (length s - 1)) - 1
    print $ sum $ map (\b -> solve (map digitToInt s) b 0) [0..bit]

Measured memory_bytes: 508
# B - Increment Decrement 
def main():
    n = int(input())
    s = input()
    cnt = 0
    ans = 0

    for i in range(n):
        if s[i] == 'I':
            cnt = cnt+1
            ans = max(cnt, ans)
        else:
            cnt = cnt-1
    else:
        print(ans)


if __name__ ==  "__main__":
    main()

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    int N;
    vector<int> num = {5, 7, 5, 7, 7};

    while (cin >> N, N) {
        vector<string> S(N);
        rep(i, N) cin >> S[i];

        rep(i, N) {
            int tmp_len = 0;
            int num_idx = 0;
            bool ok = false;
            
            for (int j=i; j<N; j++) {
                if (tmp_len < num[num_idx]) {
                    tmp_len += S[j].size();
                }

                if (tmp_len == num[num_idx]) {
                    num_idx++;
                    tmp_len = 0;
                } else if (tmp_len > num[num_idx]) {
                    break;
                }

                if (num_idx == 5) {
                    ok = true;
                    break;
                }
            }
            if (ok) {
                cout << i+1 << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 3112
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;
static const double EPS = 1e-5;
int main(){
    int N,M;
    cin >> N >> M;
    int ans = 1;
    for(int i = 1; i*i <= M; i++){
        if( M%i == 0 ){
            if(i<=M/N){
                ans = max(ans,i);
            }
            if(M/i <=M/N){
                ans = max(ans,M/i);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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


int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = -pow(10, 18);
    ans = max(ans, a * c);
    ans = max(ans, a * d);
    ans = max(ans, b * d);
    ans = max(ans, b * c);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

using int64 = long long;

int main()
{
  int N;
  cin >> N;
  map< int, int > mp;
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    ++mp[x];
  }
  int ret = 0;
  bool all = false;
  for(auto &s : mp) {
    ++ret;
    all ^= (s.second - 1) & 1;
  }
  cout << ret - all << endl;
}

Measured memory_bytes: 4992
package main

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

var (
	totalW int
	n      int
	v      [1000]int
	w      [1000]int
	memo   [1000][100000]int
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t := strings.Split(scanner.Text(), " ")
	n, _ = strconv.Atoi(t[0])
	totalW, _ = strconv.Atoi(t[1])

	i := 0
	for scanner.Scan() {
		t := strings.Split(scanner.Text(), " ")
		v[i], _ = strconv.Atoi(t[0])
		w[i], _ = strconv.Atoi(t[1])
		i++
	}
	// maxV := 0
	fmt.Println(search(0, totalW))
}

func search(i, u int) int {
	if memo[i][u] != 0 {
		return memo[i][u]
	}

	if i == n {
		return 0
	} else if u < w[i] {
		return search(i+1, u)
	} else {
		r1 := search(i+1, u)

		r2 := search(i+1, u-w[i]) + v[i]
		if r1 < r2 {
			memo[i][u] = r2
			return r2
		}
		memo[i][u] = r1
		return r1
	}
}



Measured memory_bytes: 78964
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

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

int main() {
	int n;
	cin >> n;
	vector<int> b(n - 1);
	rep(i, n - 1) cin >> b[i];
	int ans = b[0] + b[n - 2];
	rep(i, n - 2) {
		ans += min(b[i], b[i + 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i, c) for(long long i=0; i<(long long)c; i++)
const ll INF=1000000000000001;
//146813779479510
//1000000000000001
int main() {
	ll n;
	int ans=0;
	cin>>n;
	ans = n+n*n+n*n*n;
	cout <<ans << endl;
	return 0;
}


Measured memory_bytes: 3632
package main

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

func readStringIntArray(rd *bufio.Reader, n int) ([]int, error) {
	nums := make([]int, 0, n)
	s, _, err := rd.ReadLine()
	if err != nil {
		return nums, err
	}

	arr := strings.Split(string(s), " ")
	for _, i := range arr {
		n, err := strconv.Atoi(i)
		if err != nil {
			return nums, err
		}
		nums = append(nums, n)
	}
	return nums, nil
}

func main() {

	rd := bufio.NewReader(os.Stdin)
	nums, err := readStringIntArray(rd, 1)
	if err != nil {
		panic(err)
	}
	n := nums[0]

	house := make([][]int, 4)
	for i, _ := range house {
		house[i] = make([]int, 10*3)
	}

	for i := 0; i < n; i++ {
		nums, err = readStringIntArray(rd, 4)
		b := nums[0]
		f := nums[1]
		r := nums[2]
		v := nums[3]
		house[b-1][(f-1)*10+r-1] += v
	}

	for i, h := range house {
		for j, r := range h {
			fmt.Printf(" %d", r)
			if (j+1)%10 == 0 {
				fmt.Println()
			}
		}
		if i < len(house)-1 {
			fmt.Println("####################")
		}
	}
}



Measured memory_bytes: 1128
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        int[] us = new int[N+1];
        for(int i=0;i<=N;i++){
            us[i] = -1;
        }
        int p = -1;
        int q = -1;
        for(int i=0;i<=N;i++){
            if(us[int.Parse(str[i])] != -1){
                p = us[int.Parse(str[i])];
                q = i;
                break;
            }
            us[int.Parse(str[i])] = i;
        }
        Fact F = new Fact(N+1);
        for(int i=1;i<=N+1;i++){
            long count = 0;
            if(i != 1){
                count += F.GetConv(N-1,i-2);
            }
            if(i != N+1){
                count += 2*F.GetConv(N-1,i-1);
                int X = N-q+p;
                if(X >= i-1){
                    count += Define.mod - F.GetConv(X,i-1);
                }
            }
            if(i != N && i != N+1){
                count += F.GetConv(N-1,i);
            }
            count %= Define.mod;
            sb.Append(count+"\n");
        }
    }
}
class Fact{
    public long[] f;
    public long[] rf;
    public Fact(int N){
        f = new long[N+1];
        rf = new long[N+1];
        for(int i=0;i<N+1;i++){
            if(i == 0){
                f[i] = 1;
            }
            else{
                f[i] = (f[i-1]*i)%Define.mod;
            }
        }
        for(int i=N;i>=0;i--){
            if(i == N){
                rf[i] = pow(f[N],Define.mod-2);
            }
            else{
                rf[i] = rf[i+1]*(i+1)%Define.mod;
            }
        }
    }
    public long pow(long N,long K){
        if(K == 0){
            return 1;
        }
        else if(K % 2 == 0){
            long t = pow(N,K/2);
            return t*t%Define.mod;
        }
        else{
            return N*pow(N,K-1)%Define.mod;
        }
    }
    public long GetFact(int N){
        return f[N];
    }
    public long GetConv(int N,int R){
        return ((f[N]*rf[R])%Define.mod*rf[N-R])%Define.mod;
    }
}
public static class Define{
    public const long mod = 1000000007;
}

Measured memory_bytes: 30168
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
template <class T> bool chmax(T &a,const T &b) {if(a<b) {a=b;return 1;} return 0;}
template <class T> bool chmin(T &a,const T &b) {if(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

int ans=0;
int n;
vector<int> a;
void dfs(int i,int p) {
    if(i==n) {
        if(p%2==0) ans++;
        return;
    }
    for(int j=-1;j<=1;j++) {
        dfs(i+1,p*(a[i]+j));
    }
}
signed main() {
    cin>>n;
    a=vector<int>(n);
    cin>>a;
    dfs(0,1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int m=in.nextInt();
			int n=in.nextInt();
			if((m|n)==0)
				return;
			LinkedList<Integer> Li=new LinkedList<Integer>();
			for(int i=1;i<=m;i++)
				Li.add(i);
			int cnt =1;
			int now=0;
			for(int i=0;i<n;i++)
			{
				String x=in.next();
				if(Li.size()==1)
					continue;
				if(cnt%15==0)
				{
					if(!x.equals("FizzBuzz"))
					{
						Li.remove(now);
						now--;}
				}
				else if(cnt%5==0)
				{
					if(!x.equals("Buzz"))
					{
						Li.remove(now);
						now--;
					}
				}
				else if(cnt%3==0)
				{
					if(!x.equals("Fizz"))
					{
						Li.remove(now);
						now--;
					}
				}
				else
				{
					if(!x.equals(String.valueOf(cnt)))
					{
						Li.remove(now);
						now--;
					}
				}
				cnt++;
				now++;
				now%=Li.size();
			}
			int j=0;
			for(int i=0;i<Li.size();i++)
			{
				if(j==1)
					System.out.print(" "+Li.get(i));
				else
					System.out.print(Li.get(i));
				j=1;
			}
			System.out.println();
		}
	}
}

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

#define ll long long int
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i))
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'



#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
/*typedef tuple<ll,ll,ll>tpl;

ll bigmod(ll n,ll pow)
{
    if(pow==0)
        return 1;
    if(pow==1)
        return n%MOD;

    ll ans=bigmod(n,pow/2);
    ans=(ans*ans)%MOD;

    if(pow%2==1)
    {
        ans=(ans*n)%MOD;
    }
    return ans%MOD;
}

ll fact[1000005];

ll nCr(ll n,ll r)
{

    ll ans=fact[n];
    ans=(ans*bigmod(fact[r],MOD-2))%MOD;
    ans=(ans*bigmod(fact[n-r],MOD-2))%MOD;
    return ans;
} */

ll ar[100005];
int main()
{
    _fastio
    ll n;
    cin>>n;
    if(n>=30) cout<<"Yes"<<en;
    else cout<<"No"<<en;
}


Measured memory_bytes: 3648
fn input_c() -> std::io::Cursor<String> {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).unwrap();
	std::io::Cursor::new(s.trim().to_owned())
}
 
fn input_nt<T: std::str::FromStr>(n: usize) -> Vec<T> {
	use std::io::{BufRead, Read};
	let mut v = Vec::with_capacity(n);
	let     i = std::io::stdin();
	let mut l = i.lock();
	let mut r = l.by_ref();
	for _ in 0..n {
		let mut s = String::new();
		r.read_line(&mut s).unwrap();
		v.push(s.trim().parse().ok().unwrap());
	}
	v
}
 
fn read_t<T: std::str::FromStr>(r: &mut std::io::Read) -> T {
	use std::io::Read;
	use std::iter::Iterator;
	r.bytes().map(|b| b.ok().unwrap() as char).skip_while(|c| c.is_whitespace() == true).take_while(|c| c.is_whitespace() == false).collect::<String>().parse().ok().unwrap()
}

fn main() {
	let mut c  = input_c();
    let     n  = read_t::<usize>(&mut c);
    let     k  = read_t::<usize>(&mut c);
    let     q  = read_t::<usize>(&mut c);
    let     xs = input_nt::<usize>(q);
    let mut ys = Vec::with_capacity(n + 1);
    
    ys.resize(n + 1, 0);
    
    for x in &xs {
    	ys[*x] += 1;
    }
    
    for y in &ys[1..(n + 1)] {
    	println!("{}", if 0 < (k as i32) + y - (q as i32) { "Yes" } else { "No" });
    }
}

Measured memory_bytes: 4732
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, h, w, a, b, cnt = 0;
    scanf("%d%d%d", &n, &h, &w);
    for (int i = 0; i < n; i++){
        scanf("%d%d", &a, &b);
        if (a >= h && b >= w)
            cnt++;
    }

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

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll N;
    string S;
    cin >> N;
    cin >> S;
    ll ans = true;
    if(N % 2 == 1){
        ans = false;
    } else {
        for (int i = 0; i < S.size()/2; i++) {
            if(S[i] != S[S.size()/2+i]){
                ans = false;
            }
        }
    }
    Yes(ans);
}

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

int main() {
    int N;
    cin >> N;
    if(N%100%10 == 3) {
        cout << "bon" << endl;
    }
    else if(N%100%10 == 0 || N%100%10 == 1){
        cout << "pon" << endl;
    }
    else if(N%100%10 == 6 || N%100%10 == 8){
        cout << "pon" << endl;
    }
    else {
        cout << "hon" << endl;
    }
}

Measured memory_bytes: 3588
#include <iostream>
#include <stdio.h>
#include <string>
#include <list>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;//print
using namespace std;

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int x,a,b;
    cin >> x >> a >> b;
    int aa = x-a;
    int bb = x-b;
    if(aa<0) aa=-aa;
    if(bb<0) bb=-bb;
    if(aa<bb){
        cout << "A" << endl;
    }else{
        cout << "B" << endl;
    }
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<ll> cnt(3);
    rep(i, N) {
        if (S[i] == 'R') cnt[0] += 1;
        if (S[i] == 'G') cnt[1] += 1;
        if (S[i] == 'B') cnt[2] += 1;
    }
    ll ans = cnt[0]*cnt[1]*cnt[2];
    rep(j, N) rep(i, j) {
        int k = 2*j - i;
        if (k < N) {
            if (S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) ans -= 1;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

constexpr int N{50000}, M{1000000000};
constexpr int di[]{1, -1, 0, 0}, dj[]{0, 0, 1, -1};

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

    int n;
    array<string, N> s;
    // string s, t;
    // bool can;

    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> s[i];

    int c_btw = 0;
    int fb = 0, ba = 0, fbba = 0;

    for (int i = 0; i < n; i++)
    {
        int c_now = 0;
        int pos = s[i].find("AB");
        while (pos != string::npos)
        {
            pos = s[i].find("AB", pos + 2);
            c_now++;
        }
        c_btw += c_now;
        bool front_is_b = s[i].front() == 'B';
        bool back_is_a = s[i].back() == 'A';
        fb += front_is_b;
        ba += back_is_a;
        fbba += front_is_b & back_is_a;
    }

    int c_connect = min(fb, ba);
    if (fbba == fb && fbba == ba)
        c_connect--;
    if (c_connect < 0)
        c_connect = 0;

    cout << c_btw + c_connect << endl;
    // if (can)
    //     cout << "Yes" << endl;
    // else
    //     cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<sstream>
#include<math.h>
#include<queue>
#include<stack>
#include<list>
#include<vector>
#include<map>
#include<set>
#define FOR(i,a) for(int i=0;i<a;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define ll long long
using namespace std;

int n;
int a[100000];
int ans = 0;;
int main() {
	cin >> n;
	FOR(i, n)cin >> a[i];
	sort(a, a+n);
	int flg = 1;
	int count = 0;
	FOR(i, n) {
		if (flg != a[i]) {
			if (flg <= count) {
				ans += count - flg;
			}
			else {
				ans += count;
			}
			flg = a[i];
			count = 1;
		}
		else {
			count++;
		}
	}
	if (flg <= count) {
		ans += count - flg;
	}
	else {
		ans += count;
	}
	cout << ans << endl;
	return 0;
}

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

#define max 51

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}
int int_sort( const void * a , const void * b ) {
  return strcmp(( char * )a , ( char * )b );
}

int main()
{
    int n, k;
    char s[max];

    scanf("%d%d%s", &n, &k, s);
    s[k-1]+=0x20;
    
    printf("%s", s);
    
    return 0;
}



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

int N;
int T[100010],X[100010],Y[100010]; 
int main(){
	while(cin >> N){
		for(int i=1;i<=N;i++){
			cin >> T[i] >> X[i] >> Y[i];
		}
		bool judge = true;
		for(int i=1;i<=N;i++){
			T[i] = T[i]-T[i-1];
			X[i] = X[i]-X[i-1];
			Y[i] = Y[i]-Y[i-1];
		}
		for(int i=1;i<=N;i++){
			if(!(T[i]-X[i]-Y[i]>=0 && (T[i]-X[i]-Y[i])%2==0)) judge = false;
		}
		if(judge) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 1408
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Thu Jul 11 07:33:32 2019
//
package main

import "fmt"

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	fmt.Println(min(n*a, b))
}


Measured memory_bytes: 512
//ヘッダファイル
#include<stdio.h>
#include<math.h>

//マクロ定義
#define FIRST 1
#define BORDER_LINE 600

#define compile 0
main()
{
	int i = 0, d = 0, area = 0;
	int n = FIRST;
	while(scanf("%d", &d) != EOF)
	{
		for(i = d; i < BORDER_LINE; i += d)
		{
			area += d * pow(n * d, 2);
			
#if compile == 1
			printf("i = %d\t", i);
			printf("area_sum = %d\n", area);
#endif
			n++;
		}
		printf("%d\n", area);
		area = 0;
		n = FIRST;
	}
	return 0;
}

Measured memory_bytes: 592
<?php
//??????????????\???
$up=1;
$south=2;
$east=3;
$west=4;
$north=5;
$down=6;
$ans=1;
$tmp;
$count=0;
//?????§??§5???????????????????????????????????????
while($count<5){
    //??????????????°??????????????????
    $stdin=trim(fgets(STDIN));
    //??????????????°???0??????break
    if($stdin==0){
        break;
    }
    if($stdin<=10000){
        //??????????????°???????????????
        for($i=0;$i<$stdin;$i++){
            $diceRoll=trim(fgets(STDIN));
            //??????????????§??????????????????
            switch($diceRoll){
                case"North":
                    $tmp=$up;
                    $up=$south;
                    $south=$down;
                    $down=$north;
                    $north=$tmp;
                    break;
                case"South":
                    $tmp=$up;
                    $up=$north;
                    $north=$down;
                    $down=$south;
                    $south=$tmp;
                    break;
                case"West":
                    $tmp=$up;
                    $up=$east;
                    $east=$down;
                    $down=$west;
                    $west=$tmp;
                    break;
                case"East":
                    $tmp=$up;
                    $up=$west;
                    $west=$down;
                    $down=$east;
                    $east=$tmp;
                    break;
                case"Right":
                    $tmp=$south;
                    $south=$east;
                    $east=$north;
                    $north=$west;
                    $west=$tmp;
                    break;
                case"Left":
                    $tmp=$south;
                    $south=$west;
                    $west=$north;
                    $north=$east;
                    $east=$tmp;
                    break;
                default:
            }
            //??????????????°????????????
            $ans+=$up;
        }
        //????????????
        echo $ans."\n";
        //?????????
        $up=1;
        $south=2;
        $east=3;
        $west=4;
        $north=5;
        $down=6;
        $ans=1;
        //????????????????????°????????????
        $count++;
    }
}

Measured memory_bytes: 15404
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
#define rn(i,n) for(int i=1;i<=n;i++)



int main (){
  ll n,a,b;
  cin>>n;

  ll root=sqrt(n);
  //cout<<root<<endl;
  for(ll i=root+1;i>0;i--){
    if(n%i==0){
      a=i;
      b=n/a;
      break;
    }
  }

if(a<b)swap(a,b);

ll cnt=0;
while(a!=0){
  a/=10;
  cnt++;
}
cout<<cnt<<endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

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

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

    int x, y;
    cin >> x >> y;

    for(int i = 0; i <= x; ++i)
    {
        if(2 * i + (x-i) * 4 == y)
        {
            cout << "Yes";
            exit(0);
        }
    }

    cout << "No";
}


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

using namespace std;


void solve() {
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    for (auto& x: a) {
        cin >> x;
    }
    for (auto& x: b) {
        cin >> x;
    }
    for (int i = 1; i < n; i++) {
        cin >> c[i];
    }
    int sum=0; int las = -2;
    for (int i = 0; i < n; i++) {
        int k = a[i];
        sum += b[k-1];
        if (las == k-1) sum += c[k-1];
        las = k;
    }
    cout << sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

int main(){
    int H,W,A,B;
    cin >> H >> W >> A >> B;
    rep(i,H){
        rep(j,W){
            if((j<A && i<B)||(j>=A && i>=B) )cout << 0;
            else cout <<1;
        }
        cout << endl;
    }

}

Measured memory_bytes: 1280
using System;

namespace ConsoleApplication36
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string s = Console.ReadLine();
                string[] ss = s.Split(' ');
                int H = int.Parse(ss[0]);
                int W = int.Parse(ss[1]);
                int j;
                int x;
                if (H == 0 && W == 0)
                {
                    break;
                }
                else
                {
                    for (x = 0; x < H; x++)
                    {
                        for (j = 0; j < W; j++)
                        {
                            Console.Write("#");
                        }
                        Console.WriteLine("");
                    }
                    Console.WriteLine("");
                }
            }
        }
    }
}

Measured memory_bytes: 8736
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

ll pow(ll a, ll b, ll m)
{
    ll  ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int main()
{
	IOS;
	int t=1; //cin>>t;
	while(t--){
	  int n; cin>>n;
	  int a[n]; int sum[n];
	  for(int i=0;i<n;i++){
	      cin>>a[i];
	      sum[i]=0;
	  }
	  sum[0]=0;
	  
	  if(n==1) cout<<a[0];
	  else{
	      sum[1]=abs(a[1]-a[0]);
	      for(int i=2;i<n;i++){
	        sum[i]=min(sum[i-1]+abs(a[i]-a[i-1]),sum[i-2]+abs(a[i]-a[i-2]));  
	      }
	      cout<<sum[n-1];
	  }
	  cout<<"\n";
	}    

}

Measured memory_bytes: 4404
/*Code by Codercjh*/
#include<bits/stdc++.h>
#define fr(i,a,b) for(int i=(a);i<=(b);++i)
#define rf(i,a,b) for(int i=(a);i>=(b);--i)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
using namespace std;
typedef long long ll;
template<typename T>
inline void read(T &x){
	char c=getchar();T fh=0;bool f=false;
	while(!isdigit(c))f|=(c=='-'),c=getchar();
	while(isdigit(c))fh=(fh<<1)+(fh<<3)+(c^48),c=getchar();
	x=f?-fh:fh;
	return;
}
char s[4005];
int n,cnt[105];
ll ans;
int main(){
    read(n);
    cin>>s+1;
    fr(i,1,n)++cnt[s[i]-'A'];
    ans=1ll*cnt['R'-'A']*cnt['G'-'A']*cnt['B'-'A'];
    fr(i,1,n){
    	int i1=i-1,i2=i+1;
    	while(i1&&i2<=n){
    		if(s[i1]!=s[i2]&&s[i2]!=s[i]&&s[i1]!=s[i])--ans;
    		--i1,++i2;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	
	int ans = 0;
	const int slen = s.length();
	
	for (int i = 1; i < slen; i++)
	{
		if (s[i] != s[i-1]) ans++;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
s = input()
l = len(s)
for i in range(1,l):
    if s[i] == s[i-1]:
        print(i,i+1)
        break
else:
    for i in range(2,l):
        if s[i] == s[i-2]:
            print(i-1,i+1)
            break
    else:
        print(-1,-1)

Measured memory_bytes: 9184
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var answer = 0;
            for (var i = 0; i < A.Length; i += 2)
            {
                if (A[i] % 2 == 1) answer++;
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28156
#include <iostream>
#include <vector>
#include <array>

using namespace std;

long minimum_product(const vector<int>& vec, int p, int q, vector<vector<int>>& dp){
    if(q-p <= 1){
        return 0;
    }
    if(dp[p][q]){
        return dp[p][q];
    }
    int ret = 2000000000;
    for(int i = p+1; i < q; ++i){
        int product = vec[p]*vec[q]*vec[i] + minimum_product(vec, p, i, dp)
                    + minimum_product(vec, i, q, dp);
        if(product < ret){
            ret = product;
        }
    }
    return dp[p][q] = ret;
}

int main(){
    vector<int> vec {};
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i){
        int a, b;
        cin >>  a >> b;
        if(i == 0){
            vec.push_back(a);
        }
        vec.push_back(b);
    }
    vector<vector<int>> dp {n+1, vector<int>(n+1, 0)};
    cout << minimum_product(vec, 0, n, dp) << endl;
}

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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

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

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

int main()
{
  ll A, B, C;
  cin >> A >> B >> C;
  if (A+B < C){
    cout << "NO" << endl;
  }else if (A > C){
    cout << "NO" << endl;
  }else if (A + B > C){
    cout << "YES" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
N, M = [int(s) for s in input().split()]

def main():
    n = N
    s = []
    g = []
    for m in range(M):
        a, b = [int(s) for s in input().split()]
        if a == 1:
            s.append(b)
        if b == n:
            g.append(a)
    ans = 'POSSIBLE' if len(set(s) & set(g)) > 0 else 'IMPOSSIBLE'
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 21840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
int h, w;
int a, b, c, d;
int f = 0;
//set < pair<int, int>> se1;
void dfs(vector<string> &grid, int i, int j, vector<VI> &vis, set < pair<int, int>> &se) {
	if (i < 0 || i >= h || j < 0 || j >= w)return;
	if (vis[i][j] || grid[i][j]=='#')return ;
	if (i == c&&j == d) {
		f = 1;
		return;
	}
	se.insert({ i,j });
	vis[i][j] = 1;
	dfs(grid, i + 1, j, vis,se);
	dfs(grid, i - 1, j, vis,se);
	dfs(grid, i, j+1, vis,se);
	dfs(grid, i, j-1, vis,se);
}
void solve() {
	
	cin >> h >> w;
	
	cin >> a >> b >> c >> d;
	a--;
	b--;
	c--;
	d--;
	vector<string> grid;
	rep(i, 0, h) {
		string s;
		cin >> s;
		grid.push_back(s);
	}
	queue<pair<int, int> > q;
	q.push({ a,b });
	int ans = 0;
	vector<VI> vis(h, VI(w, 0));
	//for (auto poi : se1)q.push(poi);
	while (!q.empty()) {
		int m = q.size();
		set < pair<int, int>> se1;
		rep(kk, 0, m) {
			f = 0;
			pair<int, int> poi = q.front();
			q.pop();
			set < pair<int, int>> se;
			dfs(grid, poi.first, poi.second, vis,se);
			if (f == 1) {
				cout << ans << endl;
				return;
			}
			for (auto poi : se)se1.insert(poi);
		}
		for (auto poi : se1) {
			int x = poi.first, y = poi.second;
			for (int i = -2; i <= 2; i++) {
				for (int j = -2; j <= 2; j++) {
					if (x + i >= 0 && x + i < h&&y + j >= 0 && y + j < w && !vis[x + i][y + j] && grid[x + i][y + j] == '.') {
						q.push({ x + i,y + j });
					}
				}
			}
		}
		ans++;
	}
	cout << -1 << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}



Measured memory_bytes: 9252
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {

	int a=7;
	string s;
	cin >> s;
	rep(i,3)
	if (s.at(i)=='o') {
		a++;
	}
	cout << a*100 << endl;
}


Measured memory_bytes: 256
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
# 列ベクトルとかの受け取り
lists = [int(input()) for _ in range(n)]
arr = np.array(lists)

maxnum = max(lists)
filter = arr == maxnum
maxarr = arr[filter]
filt2 = arr < maxnum
nextmaxnum = max(arr[filt2]) if len(arr[filt2])!=0 else maxnum

if len(maxarr)>1:
    for _ in range(n):
        print(maxnum)
else:
    for num in arr:
        if num != maxnum:
            print(maxnum)
        else:
            print(nextmaxnum)

Measured memory_bytes: 26936
#include <iostream>
#include <string>
#include <map>

int main(){
    std::string inp;
    std::map<std::string, int> occ;
    std::string maxLen, maxOcc;
    while(std::cin >> inp){
        (occ[inp])++;
        if(occ[maxOcc] < occ[inp])
            maxOcc = inp;
        if(maxLen.size() < inp.size())
            maxLen = inp;
    }
    std::cout << maxOcc << ' ' << maxLen << std::endl;    
}

Measured memory_bytes: 1192
import sys
input = sys.stdin.readline
INF = 100100100100100


def main():
    N, M, L = map(int, input().split())
    graph = [[INF]*N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        graph[A-1][B-1] = C
        graph[B-1][A-1] = C
    for i in range(N):
        graph[i][i] = 0
    for k in range(N):
        for i in range(N):
            if graph[i][k] == INF:
                continue
            for j in range(N):
                if graph[k][j] == INF:
                    continue
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
    newGraph = [[INF]*N for _ in range(N)]
    for i in range(N):
        newGraph[i][i] = 0
        for j in range(i+1, N):
            if graph[i][j] <= L:
                newGraph[i][j] = 1
                newGraph[j][i] = 1
    for k in range(N):
        for i in range(N):
            if newGraph[i][k] == INF:
                continue
            for j in range(N):
                if newGraph[k][j] == INF:
                    continue
                newGraph[i][j] = min(newGraph[i][j], newGraph[i][k] + newGraph[k][j])
    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        if newGraph[s-1][t-1] == INF:
            print(-1)
        else:
            print(newGraph[s-1][t-1]-1)


if __name__ == '__main__': main()


Measured memory_bytes: 55900
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

#ifdef LOCALCODE
signed solve()
#else
signed main()
#endif
{
	auto S = IN<string>();
	int ans = 700;
	REP(i, SIZE(S))
	{
		if (S.substr(i, 1) == "o")
			ans += 100;
	}
	print(ans);
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env runghc
import Control.Applicative
import System.IO (isEOF)

calc r i n = do
	let x = n-(div (i*(i-1)) 2)
	if x>=i then do
		if (mod x i)==0 then
			calc (r+1) (i+1) n
		else
			calc r (i+1) n
	else
		r

main = do
	eof <- isEOF
	if not eof then do
		n <- readLn
		if n>0 then do
			putStrLn $ show $ calc 0 2 n
			main
		else return()
	else return ()

Measured memory_bytes: 4156
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    String column[] = line.split(" ");
    int card1 = Integer.parseInt(column[0]);
    int card0 = Integer.parseInt(column[1]);
    int draw = Integer.parseInt(column[3]);
    
    if(card1 >= draw){
      System.out.println(draw);
    }else if(card1 + card0 >= draw){
      System.out.println(card1);
    }else{
      System.out.println(card1 - (draw - card1 -card0));
    }
  }
}


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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define M 1000000007

ll powll(ll x, ll y) {
    ll re=1;
    rep(i, y) {
        re = re * x % M;
    }
    return re;
}


int main() {

    int n,m;
    cin >> n>>m;

    vector<ll> step(n+1, 0);
    vector<bool> bstep(n+1, true);

    rep(i, m) {
        int x;
        cin >> x;
        bstep[x] = false;
    }

    step[0] = 1;
    if (bstep[1] == true) {
        step[1] = 1;
    }

    for (int i = 2; i <= n; i++) {
        if (bstep[i] == true) {
            step[i] = (step[i - 1] + step[i - 2] )% M;
        }
    }
    cout << step[n];

    return 0;
}

Measured memory_bytes: 4052
a=int(input())
b=int(input())
if a==1:
  if b==2:
    print(3)
  else:
    print(2)
elif a==2:
  if b==1:
    print(3)
  else:
    print(1)
else:
  if b==1:
    print(2)
  else:
    print(1)

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

#define M 1000005
#define MOD 1000000007
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;

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

//    freopen("input.txt","rt",stdin);

    int n;
    cin>>n;
    
    set<string> st;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        
        st.insert(s);
    }
    
    cout<<(int)st.size()<<"\n";

}



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

int main()
{   
	int a[3][3];
	int n;

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin>>a[i][j];
		}
	}

	cin>>n;

	int b[n];
	set<int> s;

	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		s.insert(b[i]);
	}

	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
				if(s.count(a[i][j]) == 1)
				{
					a[i][j]=1;
				}
				else
				{
					a[i][j]=0;
				}
		}
	}

	// for(int i=0;i<3;i++)
	// {
	// 	for(int j=0;j<3;j++)
	// 	{
	// 		cout<<a[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }


	if(a[0][0]+a[1][1]+a[2][2] == 3)
	{
		cout<<"Yes";
		return 0;
	}
	if(a[0][2]+a[1][1]+a[2][0] == 3)
	{
		cout<<"Yes";
		return 0;
	}

	for(int i=0;i<3;i++)
	{
		int sum=0; int sum2=0;
		for(int j=0;j<3;j++)
		{
			sum+=a[i][j];
			sum2+=a[j][i];
		}
		if(sum==3 || sum2==3)
		{
		cout<<"Yes";
		return 0;
		}
	}

	cout<<"No";

return 0;
}

Measured memory_bytes: 256
n = int(input())
A = [int(a) for a in input().split()]

ans = 0
s = A[0]

if s <= 0:
    ans -= s-1
    s = 1
for i in range(1, n):
    if s > 0:
        s += A[i]
        if s >= 0:
            ans += s+1
            s = -1
    elif s < 0:
        s += A[i]
        if s <= 0:
            ans -= s-1
            s = 1

s = A[0]
c = 0
if s >= 0:
    c += s+1
    s = -1
for i in range(1, n):
    if s > 0:
        s += A[i]
        if s >= 0:
            c += s+1
            s = -1
    elif s < 0:
        s += A[i]
        if s <= 0:
            c -= s-1
            s = 1
ans = min(ans, c)
print(ans)

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

using ll = long long;
int h, w, k;
char s[12][10010];



int main () {
  scanf("%d %d %d", &h, &w, &k);
  for(int i = 0; i < h; i++) 
    scanf(" %s", s[i]);

  int ans = h * w;
  for(int mask = 0; mask < (1 << h); mask+=2) {
    int cnt[12] = {0}, here = 0, ok = 1;
    for(int j = 0; j < w; j++) {
      int p = 0;
      int add[12] = {0};
      for(int i = 0; i < h; i++) {
        if(i && (mask >> i & 1)) p++;
        add[p] += s[i][j] - '0';
      }
      bool split = false;
      for(int i = 0; i <= p; i++) 
        if(cnt[i] + add[i] > k) 
          split = true;
      if(split) {
        here++;
        for(int i = 0; i <= p; i++) 
          cnt[i] = add[i];
      } else {
        for(int i = 0; i <= p; i++)
          cnt[i] += add[i];
      }
      for(int i = 0; i <= p; i++) 
        if(cnt[i] > k) {
          ok = 0;
          break;
        }
      if(!ok) break;
    }
    if(ok) ans = min(ans, here + __builtin_popcount(mask));
  } printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
#define _DEBUG
     
int main() {
  int a, b, n=1, ans=0;
  cin >> a >> b;

  for (; n<b; ) {
    n = n - 1 + a;
    ++ans;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()

left_w = [0 for i in range(n + 2)]
right_e = [0 for i in range(n + 2)]

for idx, ch in enumerate(s, 1):
    if ch == 'E':
        right_e[idx] = 1
    else:
        left_w[idx] = 1

for i in range(1, n + 2):
    left_w[i] += left_w[i - 1]

for i in range(n, -1, -1):
    right_e[i] += right_e[i + 1]

min_turn = n
for i in range(1, n + 1):
    turn = left_w[i - 1] + right_e[i + 1]
    min_turn = min(min_turn, turn)

print(min_turn)


Measured memory_bytes: 27296
#include <bits/stdc++.h>
#define endl '\n'

#define SZ(x) ((int)x.size())
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back

using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int x;

void read() {
	cin >> x;
}

int gcd(int x, int y) {
	while(x) {
		int r = y % x;
		y = x;
		x = r;
	}

	return y;
}

void solve() {
	int p = x * 360 / gcd(x, 360);
	cout << p / x << endl;
}

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

	read();
	solve();
	return 0;
}



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

  char o[51]={},e[51]={};
  int i;

  scanf("%s%s",o,e);

  //  for(i = 0; i < a; i++) printf("%c",o[i]);                                                       
  for(i = 0; o[i] != '\0' || e[i] != '\0'; i++){

    printf("%c",o[i]);

    if(e[i] != '\0') printf("%c",e[i]);

  }

  printf("\n");

  return 0;

}



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

int main(){
    int n, dig, count=0;
    cin >> n;
    dig = log10(n);
    //cout << dig << endl;
    if(dig%2==0) count += n-pow(10,dig)+1;
    for(int i=1;i<=dig;i+=2){
        count += pow(10, i)-pow(10,i-1);
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main{

    public static void main(String[] args) {
 
        int n1,n2,n3;
        String str1,str2,str3;
 
		Scanner in = new Scanner(System.in);
 
        str1 = in.next();
        str2 = in.next();
        str3 = in.next();
 
        n1 = Integer.parseInt(str1);
        n2 = Integer.parseInt(str2);
        n3 = Integer.parseInt(str3);
        
        if(n1 < n2 && n2 < n3) System.out.println("Yes");
        else System.out.println("No");
 
        in.close();
    }
}

Measured memory_bytes: 26104
from fractions import gcd
a,b=map(int,input().split())
g=gcd(a,b)
l=[]
for i in range(2,int(g**0.5)+1):
  while g%i==0:
    l.append(i)
    g//=i
if g>1:
  l.append(g)
print(len(set(l))+1)

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

using namespace std;

int main() {
  uint64_t a,b,c,k;
  cin >> a >> b >> c >> k;
  
  int64_t sum =0;
  
  if(a>=k)
    sum +=k;
  else{
    sum+=a;
    if(b>=k-a)
      sum+=0;
    else
      sum-=(k-a-b);
  }
  cout << sum << endl;
}


Measured memory_bytes: 3632