akhauriyash/Code-Regression huggingface dataset:
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define ull unsigned long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while(true) {
		int cnt = 0;
		int n, x;
		cin >> n >> x;
		if(n == 0 && x == 0) break;

		
		FOR(i, 1, n+1) {
			FOR(j, i+1, n+1) {
				FOR(k, j+1, n+1) {
					if(i + j + k == x) cnt++;
				}
			}
		}
		cout << cnt << endl;
	}
}



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

using namespace std;


int main(){

    int N;
    cin >> N;
    vector<pair<int, int>> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i].first;
        a[i].second=i+1;
    }
    sort(a.begin(),a.end());
    for(int i=0;i<N;i++){
        cout<<a[i].second<<' ';
    }
    cout<<endl;
    
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
    int i,n,t,c,d,tt=1001;cin>>n>>t;
    for(i=0;i<n;i++){
        cin>>c>>d;
        if(t>=d && tt>c){
            tt=c;
        }
    }
    cout<<(tt==1001?"TLE":to_string(tt))<<endl;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int res = 3;
  if (a == b)
    res--;
  else if (a == c)
    res--;
  if (b == c)
    res--;
  cout << res << endl;
  
  return 0;
  
}

Measured memory_bytes: 3568
# abc170_c.py
X , N = map(int,input().split())
P = list(map(int,input().split()))
ans = (X,0)
for i in range(1010):
    if P.count(i)==0:
        # print(abs(X-i),i,X,ans)
        if ans[0] > abs(X-i):
            ans = (abs(X-i),i)
print(ans[1])



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

#ifdef SG
	#include <debug.h>
#else
	template<typename T> struct outputer;
	struct outputable {};
	#define PRINT(...)
	#define OUTPUT(...)
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
	#define fbegin(...)
	#define fend
	#define pbegin(...)
	#define pend
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb emplace_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef int64_t ll;
typedef uint64_t ull;
typedef uint32_t ui;
typedef uint16_t us;
typedef uint8_t uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

struct Input {
	ll a, b;
	
	bool read () {
		return !!(cin >> a >> b);
	}

	void init (const Input &input) {
		*this = input;
	}
};

struct Data: Input {
	bool ans;
	
	void write () {
		puts(ans ? "Alice" : "Brown");
	}
};


namespace Main {
	
	struct Solution: Data {
		
		void solve () {
			ans = abs(a - b) > 1;
		}
		
		void clear () {
			*this = Solution();
		}
	};
}


Main::Solution sol;

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);

	#ifdef SG
		freopen((problemname + ".in").c_str(), "r", stdin);
//		freopen((problemname + ".out").c_str(), "w", stdout);
		while (sol.read()) {
			sol.solve();
			sol.write();
			sol.clear();
		}
	#else
		sol.read();
		sol.solve();
		sol.write();
	#endif
	
	/*
	int t;
	cin >> t;
	forn (i, t) {
		sol.read();
		sol.solve();
		sol.write();
		sol.clear();
	}
	*/
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,a[30]={},b[30]={},c[30]={},sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  for(int i=0;i<n-1;i++){
    cin>>c[i];
  }
  for(int i=0;i<n;i++){
    sum+=b[i];
    if(a[i]+1==a[i+1]) sum+=c[a[i]-1];
  }

  cout<<sum;
}


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

int prime[MAX_N];
bool is_prime[MAX_N+1];

int sieve(int n) {
  int p = 0;
  for(int i=0;i<=n;i++) {
    is_prime[i] = true;
  }
  is_prime[0] = is_prime[1] = false;
  for(int i=2;i <= n;i++) {
    if(is_prime[i]) {
      prime[p++] = i;
      for(int j=2 * i;j<= n;j += i) is_prime[j] = false;
    }
  }
  return p;
}

int main() {
  int n;
  while(cin >> n) {
  cout << sieve(n) << endl;
  }
}

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

int main() {
    int n, m;
    cin >> n;
    string s[n];
    for (int i = 0; i < n; i++) cin >> s[i];
    cin >> m;
    string t[m];
    for (int i = 0; i < m; i++) cin >> t[i];
    int max = 0;
    for (int i = 0; i < n; i++) {
        int money = 0;
        for (int j = 0; j < n; j++) {
            if (s[i] == s[j]) money++;
        }
        for (int j = 0; j < m; j++) {
            if (s[i] == t[j]) money--;
        }
        if (max < money) max = money;
    }
    cout << max << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;


int main()
{
	int a[] = { 0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
	int x, y;
	cin >> x >> y;
	if (a[x] == a[y]) {
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
// ABC150C.cpp :
//#include "pch.h"
#include <iostream>
#include<vector>
#include<algorithm>
#include"math.h"
using namespace std;
int main()
{
    int N;
	cin >> N;
	int num = 0;
	vector<int>v(N);
	for (int i = 0; i < N; i++)
	{
		v.at(i) = i+1;
	}
	vector<int>P(N);
	int p = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> P.at(i);
		p += P.at(i)*(int)pow(10, N - i - 1);
	}

	vector<int>Q(N);
	int q = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> Q.at(i);
		q += Q.at(i)*(int)pow(10, N - i - 1);
	}

	int count = 0;
	int a = 0;
	int b = 0;
	do
	{
		int num = 0;
		for (int i = 0; i < N; i++)
		{
			num+= v.at(i) * (int)pow(10, N - i - 1);
		}
		count++;
		if (num==p)
		{
			a = count;
		}
		if (num==q)
		{
			b = count;
		}
	} while (next_permutation(v.begin(),v.end()));
	cout << abs(a - b) << endl;
}



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

vector<int> dp(50,-1);

int fib(int n) {
    if (n == 0 || n == 1) {
        return dp[n] = 1;
    }
    if (dp[n] != -1) {
        return dp[n];
    }
    return dp[n] = fib(n-1) + fib(n-2);
}

int main() {
    int n;
    scanf("%d", &n);
    printf("%d\n", fib(n));
}


Measured memory_bytes: 3232
n, k = list(map(int, input().split()))
a = [0] * n
for i in range(k):
    _ = input()
    aa = list(map(int, input().split()))
    for aaa in aa:
        a[aaa - 1] += 1
s = 0
for i in range(n):
    if a[i] == 0:
        s+=1
print(s)

Measured memory_bytes: 9192
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <climits>

using namespace std;

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

const ll MOD = 1000000007;
const ll INF = LLONG_MAX;
const ll MAX_N = 100000;
const double EPS = 10e-8;

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

ll n, a[200002],b[200002];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int j=0;
	for (int i = n - 1; i >= 0; i--) {
		if (i % 2) {
			b[j] = a[i];
			j++;
		}
	}
	for (int i = 0; i*2 < n; i++,j++) {
		b[j] = a[i*2];
	}
	
	if (n % 2)reverse(b, b + n);
	for (int i = 0; i < n - 1; i++)cout << b[i] << " ";
	cout << b[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 5248
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,i,s;
  s=0;
    scanf("%d",&n);
    int a[n-1];
    for(i=0;i<n;i++)
    {
         scanf("%d",&a[i]);
      if(a[i] % 2 == 1 && (i+1) % 2 == 1)  
      {
            s++;
        }
    }
    printf("%d",s);

return 0;
}

Measured memory_bytes: 1728
A, B, C, D = map(int, input().split())

if A >= C:
    if D >= B:
        ans = B - A
    else:
        ans = D - A
elif C > A:
    if D >= B:
        ans = B - C
    else:
        ans = D - C

if ans < 0:
    print(0)
else:
    print(ans)


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

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;

    static long x;
    static void input()
    {
        cin = new Scanner();
        x = cin.nextLong();
    }
    static void solve()
    {
        input();
        long ans = x / 11 * 2;
        ans += x % 11 == 0 ? 0 : x % 11 > 6 ? 2 : 1;
        WriteLine(ans);
    }

    
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

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

using Graph=vector<vector<int>>;
int main(){
  int n;
  cin>>n;
  vector<int> upper(n+1);
  vector<int> self(n+1);
  self[n]=true;

  Graph g(n);
  for(int i=0;i<n;i++){
    int m;
    cin>>m;
    while(m--){
      int x;
      cin>>x;
      x--;
      if(x==i) self[i]=true;
      if(x<i) g[x].push_back(i);
      if(i<x) upper[i]=true;
    }
  }
  vector<int> flag(n);
  int res=0;
  int l=0;
  for(int i=0;i<=n;i++){
    if(self[i] || flag[i]){
      res++;
      while(l<i){
	for(auto to:g[l]) flag[to]=false;
	l++;
      }
    }
    else if(upper[i]){
      for(auto to:g[i]) flag[to]=true;
    }
    else{
      while(l<i){
	for(auto to:g[l]) flag[to]=false;
	l++;
      }
    }
  }
  cout<<res-1<<endl;
  
  return 0;
}



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

const int MAX = 1e5 + 5;

int n, m;
bool can[MAX];
int out[MAX];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	can[1] = 1;
	while(m--) {
		int u, v; cin >> u >> v;
		--out[v]; ++out[u];
		if (!can[u]) continue;
		can[v] = 1;
		if (out[u] > 0) can[u] = 0; 
	}

	int ans = 0;
	for (int i = 1; i <= n; ++i) ans += can[i];

	cout << ans << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int a; cin >> a;
    string s; cin >> s;
    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    vi g={-1,1,3,1,2,1,2,1,1,2,1,2,1};
    int x,y;cin>>x>>y;
    cout<<((g[x]==g[y])?"Yes":"No")<<endl;
}

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

int main(){
  int L,R;scanf("%d%d",&L,&R);
  int qL=L/2019,rL=L%2019;
  int qR=R/2019,rR=R%2019;
  while(true){
    if(rR<=rL || 0==rL || qL<qR){printf("0\n"); break;}
    int ans=3333;
    for(int i=rL;i<rR;i++){
      for(int j=i+1;j<=rR;j++){ 
        ans=min(ans,(i*j)%2019);
      }
    }
    printf("%d\n",ans);break;
  }
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>

using namespace std;

int u[400],v[400];
string w[400];

int main(){
    int n,m,s,e;
    char str[7];
    string dist[40];
    bool visited[40],change,inf;
    
    while(true){
        scanf("%d %d %d %d",&n,&m,&s,&e);
        
        if(n == 0) break;
        
        for(int i = 0;i < m;++i){
            scanf("%d %d %s",&u[i],&v[i],str);
            w[i] = string(str);
        }
        
        memset(visited,0,sizeof visited);
        
        dist[e] = "";
        visited[e] = true;
        change = true;
        inf = false;
        
        for(int it = 0;it <= 6*n && change;++it){
            change = false;
            
            for(int i = 0;i < m;++i){
                if(visited[ v[i] ]){
                    string aux = w[i] + dist[ v[i] ];
                    
                    if(!visited[ u[i] ] || aux < dist[ u[i] ]){
                        dist[ u[i] ] = aux;
                        change = true;
                        if(it >= n - 1 && u[i] == s) inf = true;
                    }
                    
                    visited[ u[i] ] = true;
                }
            }
        }
        
        if(inf || !visited[s]) puts("NO");
        else puts(dist[s].c_str());
    }
    
    return 0;
}

Measured memory_bytes: 1384
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string N;
    int K;
    cin >> N >> K;
    
    long long dp[200][2][200];
    rep(i, 200) rep(j, 2) rep(k, 200) dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    rep(i, N.size()) {
        rep(j, 2) {
            rep(k, 200) {
                rep(x, j ? 10 : N[i] - '0' + 1) {
                    dp[i + 1][j || x < N[i] - '0'][k + (x != 0)] += dp[i][j][k];
                }
            }
        }
    }
    cout << dp[N.size()][0][K] + dp[N.size()][1][K] << endl;
    return 0;
}


Measured memory_bytes: 896
#include <stdio.h>
#include <string.h>

int main(void)
{
	char o[50] ,e[50];
	int i, length, counti = 0, countj = 0;
	gets(o);
	gets(e);
	length = strlen(o) + strlen(e);
	for(i = 1; i <= length; i++){
		if(i % 2 == 1){
			counti++;
			printf("%c", o[counti - 1]);
		}
		else {
			countj++;
			printf("%c", e[countj - 1]);
		}
	}
	return 0;	
}

Measured memory_bytes: 128
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        S: [chars; 3],
    }
    println!("A{}C", S[1][0]);
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

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

int main() {

	int n, ball;
	cin >> ball >> n;

	ball -= n;

	if (n == 1)
		cout << 0;
	else
		cout << ball;
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = []
index = list(range(1, n+1))
dic_a = dict(zip(a, index))
#print(dic_a)
sorted_dic_a = dict(sorted(dic_a.items()))
for i in sorted_dic_a.values():
    print(i,end=" ")
print()

Measured memory_bytes: 36700
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  ll n;
  cin >> n;
  ll count = 0;
  count += 2 * floor(n / 11);
  n = n % 11;
  if (n > 0 && n <= 6) {
    count++;
  } else if (n > 0 && n <= 11) {
    count += 2;
  }
  cout << count << endl;

  return 0;
}

Measured memory_bytes: 3512
/***

   Author : Md. Jashim Uddin
   From   : RMSTU

 ***/
#include<bits/stdc++.h>
using namespace std;
#define     sf(a)           scanf("%d",&a)
#define     sff(a,b)        scanf("%d %d",&a,&b)
#define     sfff(a,b,c)     scanf("%d %d %d",&a,&b, &c)
#define     pb              push_back
#define     ll              long  long int
#define     fast            ios_base :: sync_with_stdio(false);cin.tie(0)
#define     pi              2*acos(0)
#define     sp              fixed<<setprecision
#define     lcm(a,b)        (a*b)/gcd(a,b)
#define     gcd(a,b)        _gcd(a,b)
#define     forn(i,n)       for(int i=1;i<=n;i++)
#define      m               1000000
int main()
{
   int a,b;
   cin>>a>>b;

   if((a==1 && b==2) || (a==2 && b ==1))cout<<"3"<<endl;
   else if((a==2 && b == 3) || (a==3 && b==2))cout<<"1"<<endl;
   else if((a==1 && b == 3) || (a==3 && b ==1))cout<<"2"<<endl;


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
     char suit;
     int value;
     };

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];
void merge(struct Card A[], int n, int left, int mid, int right) {
    int i, j, k;
     int n1 = mid - left;
     int n2 = right - mid;
     for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
     for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
     L[n1].value = R[n2].value = SENTINEL;
     i = j = 0;
     for ( k = left; k < right; k++ ) {
         if ( L[i].value <= R[j].value ) {
             A[k] = L[i++];
             } else {
                 A[k]=R[j++];
                 }
         }
     }

 void mergeSort(struct Card A[], int n, int left, int right) {
    int mid;
     if( left+ 1<right){
         mid = (left + right) /2;
         mergeSort(A, n, left, mid);
         mergeSort(A, n, mid, right);
         merge(A, n, left, mid, right);
     }
 }

int partition(struct Card A[], int n, int p, int r){
 int i, j;
 struct Card t, x;
 x = A[r];
 i = p - 1;
 for ( j = p; j < r; j++ ) {
     if ( A[j].value <= x.value ) {
         i++;
         t = A[i]; 
         A[i] = A[j]; 
         A[j] = t;
         
     }
 }
    t = A[i + 1];
    A[i + 1] = A[r];
    A[r] = t;
    return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r) {
    int q;
    if ( p < r ) {
        q = partition(A, n, p, r);
        quickSort(A, n, p, q - 1);
        quickSort(A, n, q + 1, r);
    }
}

int main(){
    int n, i, v;
    struct Card A[MAX],B[MAX];
    char S[10];
    int stable=1;
    
    scanf("%d",&n);
    
    for(i=0; i<n; i++){
        scanf("%s%d", S, &v);
        A[i].suit = B[i].suit= S[0];
        A[i].value = B[i].value =v;
    }
    mergeSort(A, n, 0, n);
    quickSort(B, n, 0, n-1);
    
    for(i=0; i<n; i++){
        // マージソートとクイックソートの結果を比べる
        if(A[i].suit != B[i].suit) stable=0;
    }
    if(stable ==1) printf("Stable\n");
    else printf("Not stable\n");
    for(i=0; i<n; i++){
        printf("%c %d\n", B[i].suit, B[i].value);
    }
    return 0;
}

    




Measured memory_bytes: 4104
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: u64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let h: usize = sc.cin();
    let w: usize = sc.cin();
    let k: usize = sc.cin();

    let mut memo = vec![vec![0_u64; w]; h + 1];
    memo[0][0] = 1;

    let mut table = vec![-1; w];

    for i in 1..h+1 {
        for p in 0..1<<(w-1) {
            let edges: Vec<usize> = (0..w-1).filter(|j| p & (1 << j) > 0).collect();
            let mut valid = true;
            if edges.len() >= 2 {
                for i in 0..edges.len() - 1 {
                    if edges[i] + 1 == edges[i+1] {
                        valid = false;
                        break;
                    }
                }
            }
            if !valid { continue }
            for u in 0..w { table[u] = 0; }
            for &u in edges.iter() {
                table[u] = 1;
                table[u+1] = -1;
            }
            for u in 0..w {
                memo[i][u] +=
                    match table[u] {
                        1 => memo[i-1][u+1],
                        -1 => memo[i-1][u-1],
                        _ => memo[i-1][u]
                    };
                memo[i][u] %= M;
            }
        }
    }
    put!(memo[h][k-1]);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("b.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N, L;
    cin >> N >> L;


    int apple_max = 0;
    int apple_abs_min = 0xFFFFFFF;
    int apple_all = 0;
    for (int i= 1; i <= N; i++)
    {
        apple_all += L + i -1;
    }


    for (int bite = 1; bite <= N; bite++)
    {
        int apple = 0;
        for (int i = 1; i <= N; i++)
        {
            int taste = L + i -1;
            if (i == bite)
            {
            }
            else
            {
                apple += taste;
            }
        }
        if (abs(apple_all - apple) < apple_abs_min)
        {
            apple_abs_min = abs(apple_all - apple);
            apple_max = apple;
        }
    }

    cout << apple_max;


    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] s = new String[n];
        Arrays.setAll(s, i -> sc.next());
        sc.close();

        // 主処理
        Set<String> set = new HashSet<>(Arrays.asList(s));
        boolean judge = set.size() == 3;
        String result = judge ? "Three" : "Four";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 26708
//package src.com.jetman.atcoder;

import java.util.*;

/**
 * @description:
 * @author: Jetman
 * @create: 2020-08-29 14:39
 **/
public class Main {

    Scanner sc = new Scanner(System.in);

    long MOD = 1000000000 + 7;

    long dp[][];

    private void slove() {

        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }

        boolean ans = false;
        for (int i = 2; i < n; i++) {
            if (a[i] != b[i]) continue;
            if (a[i-1] == b[i-1] && a[i-2] == b[i-2]) {
                ans = true;
                break;
            }
        }

        System.out.println(ans?"Yes":"No");



    }

    private void build(Map<Integer, List<Integer>> edge, int l, int r) {
        List<Integer> list = edge.getOrDefault(l, new ArrayList<>());
        list.add(r);
        edge.put(l,list);
    }


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


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

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

    ll a, b, c, d;

    cin >> a >> b >> c >> d;

    ll arr[4];

    arr[0] = a*d;

    arr[1] = a*c;

    arr[2] = b*c;

    arr[3] = b*d;

    sort(arr, arr+4);

    cout << arr[3];


}









Measured memory_bytes: 3632
#include<iostream>
using namespace std;
	int main(){
	int a,b;int sum=0;
	int sums[5000];int k=0;
	while(cin>>sum){
	if(sum==0)break;
	for(int i=0;i<9;i++){
		cin>>b;
		sum-=b;
	}
	cout<<sum<<endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main(){
	int A, B, C;
	int count_7 = 0;
	int count_5 = 0;

	cin >> A >> B >> C;

	if(A == 7){
		count_7++;
	}else if(A == 5){
		count_5++;
	}

	if(B == 7){
			count_7++;
		}else if(B == 5){
			count_5++;
	}

	if(C == 7){
			count_7++;
		}else if(C == 5){
			count_5++;
	}


	if(count_5 == 2 && count_7 == 1){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

odd={}
even={}
total={}

for i in range(n):
    t=a[i]
    if i%2==0:
        if t in odd:
            odd[t]+=1
        else:
            odd[t]=1
    else:
        if t in even:
            even[t]+=1
        else:
            even[t]=1
    if t in total:
        total[t]+=1
    else:
        total[t]=1

l=len(odd)+len(even)

odd=sorted(odd.items(),key=lambda x: x[1],reverse=True)
even=sorted(even.items(),key=lambda x: x[1],reverse=True)
total=sorted(total.items(),key=lambda x: x[1],reverse=True)

ans=0

if len(total)==1:
    print(n//2)
    exit(0)

ans=n
cnt1=0
for i in odd:
    if cnt1==2:
        break
    cnt2=0
    for j in even:
        if cnt2==2 or i[0]==j[0]:
            continue
    
        ans=min(ans,n-i[1]-j[1])
        cnt2+=1
    cnt1+=1

print(ans)

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

int N;
int max_cnt;
map<string, int> M;

int main(void) {
	cin >> N;
	max_cnt = 0;
	for (int i = 0; i < N; ++i) {
		string str;
		cin >> str;
		++(M[str]);
		if (M[str] > max_cnt)
			max_cnt = M[str];
	}

	map<string, int>::iterator itr;
	for (itr = M.begin(); itr != M.end(); ++itr) {
		if (itr->second == max_cnt)
			cout << itr->first << '\n';
	}
	return 0;
}


Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int a[N], b[N], c[N], n, m ,q, ans, tmp[12], d[N];
int check()
{
	int res = 0;
	for (int i = 1; i <= q; i++)
		if (tmp[b[i]] - tmp[a[i]] == c[i])
			res += d[i];
	return res;
}
void dfs(int maxx, int x)
{
	if (x > n)
	{
		ans = max(ans, check());
		return;
	}
	for (int i = maxx; i <= m; i++)
	{
		tmp[x] = i;
		dfs(i, x + 1);
	}
}
int main() 
{
	cin>>n>>m>>q;
	for (int i = 1; i <= q; i++)
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	dfs(1, 1);
	cout<<ans;
    return 0;
}


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

int main(){
    int N, ans=0, left=-1, right;
    string S;
    cin >> S ;
    for(int i=0; i<S.size(); i++){
	if(left==-1 && S[i]=='A')
	    left = i;
	if(S[i]=='Z')
	    right = i;
    }
    ans = right - left + 1;
    cout << ans << endl;
}


Measured memory_bytes: 640
import fractions


def lcm(a, b):
    return a*b//fractions.gcd(a, b)


a, b, c, d = map(int, input().split())
e = lcm(c, d)
x = a if (a % c) == 0 else a-(a % c)+c
y = a if (a % d) == 0 else a-(a % d)+d
z = a if (a % e) == 0 else a-(a % e)+e
ans = b-a+1
if x <= b:
    ans -= (b-x)//c+1
if y <= b:
    ans -= (b-y)//d+1
if z <= b:
    ans += (b-z)//e+1
print(ans)


Measured memory_bytes: 5048
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
  	int N = 3;
	vector<vector<int>> c(N, vector<int>(N));
  	rep(i,N){
		rep(j,N){
    		cin >> c[i][j];
        }
	}
  
  	vector<int> u(N);
  	iota(u.begin(),u.end(),0);
	
  	int sum, temp, i;
  	int flag = 0;
  	do {
      	i = 0;
      	temp = 0;
        for(auto x : u) {
        	temp += c[i][x];
        	i++;
        }
      	if(flag == 0) { 
          sum = temp; 
          flag = 1;
        }
      	else{
          	if(sum != temp) { 
              	puts("No");
            	return;
            }
        } 
    } while( next_permutation(u.begin(), u.end()) );   
  	puts("Yes");
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
tmp=[0]*n
wtmp=[0]*n
for _ in range(m):
    P,s=map(str,input().split())
    p=int(P)
    p-=1
    if not tmp[p]==0:
        continue
    if s=='AC':
        tmp[p]=1
    else:
        wtmp[p]+=1
ans1=sum(tmp)
ans2=0
for i in range(n):
    if tmp[i]==1:
        ans2+=wtmp[i]
print(ans1,ans2)



Measured memory_bytes: 4596
N=int(input())
#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合
S = [[0]*3 for i in range(100010)]
 
            
def chmax(a,b):
    if a>b:
        return a
    else:
        return b
 
for i in range(N):
    A,B,C=map(int,input().split())
    S[i+1][0]=A
    S[i+1][1]=B
    S[i+1][2]=C
 
DP=[[0 for j in range(3)] for i in range(100010)]
 
DP[0][0]=0
DP[0][1]=0
DP[0][2]=0
DP[1][0]=S[1][0]
DP[1][1]=S[1][1]
DP[1][2]=S[1][2]
 
if N==1:
    print(max(DP[1]))
    exit()
 
for k in range(2,N+1):
    for i in range(3):
        for j in range(3):
            if i!=j:
                DP[k][i]=chmax(DP[k-1][j]+S[k][i],DP[k][i])
                DP[k][j]=chmax(DP[k-1][i]+S[k][j],DP[k][j])
print(max(DP[N]))
 

Measured memory_bytes: 48524
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
ans = sum(b)
for i in range(n-1):
  if a[i+1]==a[i]+1:
    idx = a[i]-1
    ans += c[idx]
print(ans)

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

vector<int> g[100010];
int d[100010],k,n;
pair<int,int> edge[100010];
set<pair<int,int> > s;

int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<n;i++){
		int x,y;
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
		edge[i]=make_pair(x,y);
	}
	memset(d,-1,sizeof(d));
	cin>>k;
	for(int i=1;i<=k;i++){
		int p,v;
		cin>>p>>v;
		d[p]=v;
		s.insert(make_pair(v,p));
	}
	while(!s.empty())
	{
		int u=s.begin()->second;
		s.erase(s.begin());
		for(int i=0;i<g[u].size();i++){
			if(d[g[u][i]]==-1){
				d[g[u][i]]=d[u]+1;
				s.insert(make_pair(d[g[u][i]],g[u][i]));
			}
		}
	}
	for(int i=1;i<n;i++){
		if(abs(d[edge[i].first]-d[edge[i].second])!=1){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<=n;i++) cout<<d[i]<<endl;
	return 0;
}

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

using ll = long long;


int main(int argc, char **argv)
{

    int l, c, r;
    int N;
    string S;

    cin >> N;
    cin >> S;

    vector<int> vec{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

    int ans = 0;
    for (char l: vec){
        auto it_l = S.find(l);
        if (it_l == std::string::npos) continue;

        for (char c: vec){
            auto it_c = S.find(c, it_l + 1);
            if (it_c == std::string::npos) continue;

            for (char r: vec){
                auto it_r = S.find(r, it_c + 1);
                if (it_r != std::string::npos)
                    ans++;
                
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

D, N = map(int, input().split())

val = 100**D
if N<100:
    print(val*N)
else:
    print(val*N + val)




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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N, L;
    cin >> N >> L;
    vector<string> s;
    s.resize(N);
    REP(i, N) {
        cin >> s[i];
    }
    sort(ALL(s));
    REP(i, N) {
        cout << s[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  ll ans = 1;
  ll q = (ll)1000000000000000000L;
  vector<ll> a(n);
  rep(i,n){ cin >> a[i]; }
  sort(a.begin(),a.end());
  rep(i,n){
    ll x = a[i];
    int a=0,b=0;
    ll tmpa=ans, tmpb=x;
    while(tmpa>9){ a++; tmpa/=10; }
    while(tmpb>9){ b++; tmpb/=10; }
    if(a+b>18){ ans=-1; break; }
    if(a+b==18 && tmpa*tmpb>=10){ ans=-1; break; }
    ans *= x;
    if(ans>q){ ans=-1; break; }
  }
  if(ans>q){ ans=-1; }
  cout << ans << endl;
  return 0;
}

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

ll gcd(ll a, ll b){
  if(a % b == 0) 
    return b;
  return gcd(b, a % b);  
}

int main(){
  ll a, b;
  cin >> a >> b;
  ll c = gcd(a,b);
    
  vector<int> v; //答えを格納する
  
  v.push_back(1); //1は答えに含まれる
  
  for(int i = 2; 1LL*i*i <= c; i++){
    if(c % i == 0){
      v.push_back(i);
    }
    while(c % i == 0){
      c /= i;
    }
  }
  
  if(c > 1){
    v.push_back(c);
  }
  
  cout << v.size() << endl;
}

Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 100000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

map <ll, ll> Msz;

map <ll, ll> Mch;

vector <int> son[100050];
ll dep[100050];
ll sz[100050];
ll par[100050];
void DFS(int n) {
	sz[n] = 1;
	for (auto it : son[n]) {
		par[it] = n;
		dep[it] = dep[n] + 1;
		DFS(it);
		sz[n] += sz[it];
	}
}

ll in[100050];
ll oin[100050];
int main() {
	int N, i, j;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%lld", &in[i]);
		Mch[in[i]] = i;
		Msz[in[i]] = 1;
		oin[i] = in[i];
	}

	sort(in + 1, in + N + 1);
	for (i = N; i > 1; i--) {
		ll t = Msz[in[i]];
		if (2 * t - N >= 0) return !printf("-1\n");

		ll p = in[i] + (2 * t - N);
		if (!Msz.count(p)) return !printf("-1\n");
		Msz[p] += t;

		son[Mch[p]].push_back(Mch[in[i]]);
	}

	int r = Mch[in[1]];
	DFS(r);

	ll s = 0;
	for (i = 1; i <= N; i++) {
		if (sz[i] == 0) return !printf("-1\n");
		s += dep[i];
	}

	if (s != oin[r]) return !printf("-1\n");

	for (i = 1; i <= N; i++) {
		if (i == r) continue;
		if (oin[i] - oin[par[i]] != N - 2 * sz[i]) return !printf("-1\n");
	}

	for (i = 1; i <= N; i++) {
		if (i == r) continue;
		printf("%lld %d\n", par[i], i);
	}
	return 0;
}

Measured memory_bytes: 25600
ls = list(map(int, input().split()))
a, b, c = sorted(ls)
count = 0
s = sum(ls)

if s % 2 == (3 * c) % 2:
    while s < 3 * c:
        count += 1
        s += 2
else:
    while s < (c + 1) * 3:
        count += 1
        s += 2

print(count)

Measured memory_bytes: 3060
#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( void )
{
    int a,b,c;
    cin >> a >> b >> c;
    
    if ( max(a,c) - b == b - min(a,c) )
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r;
    cin >> r;
    cout << std::fixed << std::setprecision(15) << 2*r*M_PI << endl;
    return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()

#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;

#define bit(k) (1LL<<(k))

typedef long long ll;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

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

    int N,M;
    cin>>N>>M;
    vector<int> ans(N, -1);
    bool nott = false;
    rep(i,M){
        int a,b;
        cin>>a>>b;
        a--;
        if(ans[a] == -1){
            ans[a] = b;
        }
        else{
            if(ans[a] != b){
                nott = true;
            }
        }
    }
    //print(ans);
    if(nott){
        cout<<-1<<endl;
        return 0;
    }
    if(N != 1 && ans[0] == 0){
        cout<<-1<<endl;
        return 0;
    }
    if(N == 1){
        if(ans[0] == -1){
            cout<<0<<endl;
        }
        else{
            cout<<ans[0]<<endl;
        }
        return 0;
    }
    rep(i,N){
        if(ans[i] == -1){
            if(i == 0)cout<<1;
            else cout<<0;
        }
        else cout<<ans[i];
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  int N;
  double ans=0.0 ,A;
  
  cin >> N;
  
  for(int i=0;i < N;++i){
    cin >> A;
    ans += 1.0 / A;
  }

  cout << (1.0/ans) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

vector<ll> findDivisor(ll n) {
	vector<ll> divisor;
	
	ll i = 1;
	for (; i * i <= n; i++) if (n % i == 0) divisor.push_back(i);
	i--;
	if (i * i == n) i--;
	for (; i >= 1; i--) if (n % i == 0) divisor.push_back(n / i);
	
	return divisor;
}

int main() {
	ll N;
	cin >> N;
	
	vector<ll> v = findDivisor(N);
	
	ll ans = longINF;
	for (ll cur : v) chmin(ans, (cur - 1) + (N / cur - 1));
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 384
n, k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

plus = [0]
minus = []
zeroExist = 0

for i in range(n):
    if x[i] > 0:
        plus.append(x[i])
    elif x[i] == 0:
        zeroExist = 1
    else:
        minus.append(-x[i])
minus.append(0)
minus = list(reversed(minus))

if zeroExist == 1:
    k -= 1

cost = 10**9
for i in range(k + 1):
    if i < len(plus) and k - i < len(minus):
        # print("i:{} k-i:{}".format(i, k-i))
        if i == 0 or i == k:
            cost = min(cost, plus[i] + minus[k - i])
        else:
            cost = min(cost, plus[i] + minus[k - i]
                       + min(plus[i], minus[k - i]))
            # print("{}:{}".format(i, cost))
print(cost)


Measured memory_bytes: 14480
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int INF = 1000100000;
#define rep(i,n) for(int i=0;i<n;++i)


int main(){
  int n,t;
  cin >>n >> t;
  ll ans=0;
  int sw[n];
  int sa[n]={};
  rep(i,n)cin >> sw[i];
  rep(i,n-1){
    sa[i]=sw[i+1]-sw[i];
  }
  sort(sa,sa+n,greater<int>());
  rep(i,n-1){
    if(sa[i]>=t){
      ans+=t;
    }else{
      ans+=sa[i];
    }
  }
  ans+=t;//last
  cout << ans << endl;
}


Measured memory_bytes: 1792
#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;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;

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

	string s;
	cin >> s;
	auto t = s;
	reverse(t.begin(), t.end());
	if (s != t) {
		cout << "No\n";
		return 0;
	}
	auto u = s.substr(0, s.size() / 2);
	auto v = u;
	reverse(v.begin(), v.end());
	if (u != v) {
		cout << "No\n";
		return 0;
	}
	auto w = s.substr(s.size() - s.size() / 2, s.size() / 2);
	auto x = w;
	reverse(x.begin(), x.end());
	if (w != x) {
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    double a, b ;
    cin >> a >> b ;
    //*/

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a == 3 || a == 5 || a == 7 ){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    //*/
    
    cout << a / b << endl;

    return 0; 
}


Measured memory_bytes: 3776