akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 1000000007
typedef long long ll;



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

  if(b>=a) cout<<a<<endl;
  else cout<<a-1<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> v(N + 1), w(N + 1);
    REP(i, N) cin >> v[i+1] >> w[i+1];

    vector<vector<int>> dp(N+1, vector<int>(W+1));

    FOR(i, 1, N) {
        REP(j, W+1) {
            if(j - w[i] >= 0) dp[i][j] = max(dp[i-1][j-w[i]] + v[i], dp[i-1][j]);
            else dp[i][j] = dp[i-1][j];
        }
    }

    cout << dp[N][W] << endl;

    return 0;
}


Measured memory_bytes: 6764
package main

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

func solve() {
	as := getIntSlice(3)
	s := sum(as...)

	ans := "win"
	if s >= 22 {
		ans = "bust"
	}
	fmt.Fprintln(wr, ans)
}

func sum(ns ...int) int {
	var sum int
	for _, n := range ns {
		sum += n
	}
	return sum
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>

int main(){
	int a, b;

	std::cin>>a>>b;

	if(a%3==0 || b%3==0 || (a+b)%3==0)
		std::cout<<"Possible"<<std::endl;
	else
		std::cout<<"Impossible"<<std::endl;

	return 0;
}

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

public class Main {

	static int N;
	static int M;


	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		N = Integer.parseInt(tmp[0]);
		M = Integer.parseInt(tmp[1]);

		ArrayList<Edge> e = new ArrayList<Edge>();

		for(int i = 0;i<M;i++){
			tmp = br.readLine().split(" ");
			Edge edge = new Edge(Integer.parseInt(tmp[0]),Integer.parseInt(tmp[1]));
			e.add(edge);
		}

		//1個ずつ辺を消して、橋か確かめる
		int bridge = 0;
		for(int i = 0;i<M;i++){
			ArrayList<Edge> nowBridge = new ArrayList<Edge>(e);
			nowBridge.remove(i);

			if(!ping(nowBridge))bridge++;
		}

		System.out.println(bridge);

	}

	public static boolean ping(ArrayList<Edge> l){
		//全てのノードに到達可能か調べる

		//こいつらにはノード番号が入る
		Stack<Integer> stack = new Stack<Integer>();
		ArrayList<Integer> done = new ArrayList<Integer>();

		//ここに最初のノードで到達できるノードを代入
		int nowNodeID = 1;

		for(int i = 0;i < getArrive(nowNodeID,l).size();i++){
			stack.push(getArrive(nowNodeID,l).get(i));
		}

		while(!stack.isEmpty()){
			nowNodeID = stack.pop();

			for(int i = 0;i < getArrive(nowNodeID,l).size();i++){
				int pushID = getArrive(nowNodeID,l).get(i);
				if(stack.search(pushID) == -1 && !done.contains(pushID)){
					stack.push(pushID);
				}
			}
			done.add(nowNodeID);
		}

//		done.sort(null);
//
//		for(int i = 1;i<=N;i++){
//			if(done.get(i) != i)return false;
//		}

		if(done.size() == N)return true;
		else return false;
	}

	public static ArrayList<Integer> getArrive(int nodeID,ArrayList<Edge> l){
		//iノードから到達可能なノードをListで返す
		ArrayList<Integer> ret = new ArrayList<Integer>();
		for (int i = 0;i<l.size();i++){
			if(l.get(i).a == nodeID){
				ret.add(l.get(i).b);
			}else if(l.get(i).b == nodeID){
				ret.add(l.get(i).a);
			}
		}

		return ret;
	}

	public static class Edge{
		int a;
		int b;

		Edge(int x,int y){
			a = x;
			b = y;
		}
	}
}


Measured memory_bytes: 24440
S = input()
C = set(S)

ans = float('inf')
t = list(S)
for c in C:
    cnt = 0
    while True:
        if len(set(t)) != 1:
            td = []
            cnt += 1
            for i in range(len(t)-1):
                if t[i]==c or t[i+1]==c:
                    td.append(c)
                else:
                    td.append(t[i])
            t = td.copy()
        else:
            ans = min(ans, cnt)
            break
    t = list(S)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <iomanip>
using namespace std;
long long n,a,b,c,d,i,j;
int main()
{
	cin>>n>>a>>b>>c>>d;
	d-=c;
	n--;
	for (i=0;i<=n;i++)
	{
		j=n-i;
		if (b-a>=-d*j+i*c-j*c&&b-a<=d*i+i*c-j*c)
		{
			cout<<"YES";
			return 0;
		}
	} 
	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
n, m, k= map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))

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

for i in range(1, m+1):
    b[i] += b[i-1]

ans = 0

b_cnt = m

for a_cnt in range(n+1):
    if a[a_cnt] > k:
        continue

    while a[a_cnt] + b[b_cnt] > k:
        b_cnt -= 1
    
    ans = max(ans, a_cnt + b_cnt)
        

print(ans)

Measured memory_bytes: 39812
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	S := readInt()
	H := S / 100
	L := S % 100
	//eprintln(x, y)

	if mm(H) && mm(L) {
		println("AMBIGUOUS")
		return
	}
	if mm(L) {
		println("YYMM")
		return
	}
	if mm(H) {
		println("MMYY")
		return
	}
	println("NA")
}

func mm(a int) bool {
	if 1 <= a && a <= 12 {
		return true
	}
	return false
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

vector<int> dist(100001,0);
vector<int> v[100001];
int n,m;
int visited[100001] = {0};

int recur(int i) {
    if(visited[i] == 1) {
        return dist[i];
    }
    visited[i] = 1;
    for(int j=0; j<v[i].size(); j++) {
        dist[i] = max(recur(v[i][j]) + 1, dist[i]);   
    }
    return dist[i];
}

int main()
{
    int x,y;
    cin>>n>>m;
    for(int i=0; i<m; i++) {
        cin>>x>>y;
        v[x].push_back(y);
    }
    int max_dist = 0;
    for(int i=1; i<=n; i++) {
        if(visited[i]==0)
        max_dist = max(max_dist,recur(i));
    }
    cout<<max_dist;
    return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
const ll INF = 1LL<<60;
const ll mod = 998244353;

int main()
{
  ll n, s; cin >> n >> s;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  vector<vector<ll>> dp(n+1, vector<ll>(s+1, 0));
  ll ans = 0;
  for (int i=0; i<n; i++) {
    (dp[i][0] += 1) %= mod;
    dp[i+1] = dp[i];
    rep(j, s+1-a[i]) {
      (dp[i+1][j+a[i]] += dp[i][j]) %= mod;
    }
    (ans += dp[i+1][s]) %= mod;
  }
  cout << ans << endl;

  return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

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;

#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 REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#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() );

#define pb push_back
#define mp make_pair

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


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;

char G[100][100];

int main() {
    i64 H, W; cin >> H >> W;
    REP(i, H) REP(j, W) cin >> G[i][j];

    vector<bool> skipr(H, false);
    vector<bool> skipc(W, false);
    REP(i, H) {
        bool any = false;
        REP(j, W) {
            if (G[i][j] == '#') {
                any = true;
                break;
            }
        }
        if (any) continue;
        skipr[i] = true;
    }

    REP(i, W) {
        bool any = false;
        REP(j, H) {
            if (G[j][i] == '#') {
                any = true;
                break;
            }
        }
        if (any) continue;
        skipc[i] = true;
    }

    REP(i, H) {
        if (skipr[i]) continue;
        REP(j, W) {
            if (skipc[j]) continue;
            cout << G[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3644
def solve():
  s=list(input())
  if(len(s)<2 or len(s)%2==1):
      print("No")
      return
  for i in range(len(s)):
      if (i%2==0 and s[i]!='h'):
          print("No")
          return
      elif(i%2==1 and s[i]!='i'):
          print("No")
          return
  print("Yes")

solve()


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

struct UnionFind {
    vector<int> data;
    int sz;
    UnionFind(int sz) : data(sz, -1), sz(sz) { }
    bool unionSet(int x, int y) {
        if ((x = root(x)) == (y = root(y))) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y]; data[y] = x; sz--;
        return true;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() { return sz; }
};

int main() {
    int n, m; cin >> n >> m;
    vector<int> p(n);
    for (auto &pi: p) cin >> pi, pi--;
    UnionFind uf(n);
    while (m--) {
        int x, y; cin >> x >> y; x--, y--;
        uf.unionSet(x, y);
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) cnt += uf.root(i) == uf.root(p[i]);
    cout << cnt << endl;
    return 0;
}


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

using namespace std;

#define int long long
//#define cerr if(false)cerr
#define watch(x) cerr << (#x) << " is " << (x) << endl
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cint int t;cin>>t;while(t--)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define N 100005
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
int mod=998244353;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define mp make_pair

int32_t main() {
    faster;

    int n;
    cin>>n;

    int ans=0;
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0){
            continue;
        }
        ans+=i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3668
#D_Coloring Dominoes

def ColoringDominoes(N, S1, S2):

    pattern = list()
    i = 0
    while True:
        if S1[i] == S2[i]:
            pattern.append(True)
            i += 1
        else:
            pattern.append(False)
            i += 2
        if i >= N:
            break

    if pattern[0]:
        n_pattern = 3
    else:
        n_pattern = 6
    for i in range(1, len(pattern)):
        if pattern[i-1] and pattern[i]:
            n_pattern *= 2
        elif pattern[i-1] and not(pattern[i]):
            n_pattern *= 2
        elif not(pattern[i-1]) and not(pattern[i]):
            n_pattern *= 3

    return n_pattern % 1000000007




if __name__ == "__main__":
    N = int(input())
    S1 = list(str(input()))
    S2 = list(str(input()))
    print(ColoringDominoes(N, S1, S2))

Measured memory_bytes: 3064
#002_C
n, l = map(int, input().split())
a = list(map(int, input().split()))

flg = False
ans = []
for i in range(n-1):
    if a[i] + a[i+1] >= l:
        ans = [j for j in range(1, i+1)] + [j for j in range(n-1, i+1, -1)] + [i+1]
        flg = True
        break
    
if flg:
    print('Possible')
    print(*ans, sep='\n')
else:
    print('Impossible')

Measured memory_bytes: 14052
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc079/tasks/abc079_c

string abcd;
string OP;

static bool dfs(int sum, string op) {
    if (op.length() == 3) {
        OP = op;
        return sum == 7;
    }

    if (dfs(sum + (abcd[op.length()+1] - '0'), op+"+")) return true;
    if (dfs(sum - (abcd[op.length()+1] - '0'), op+"-")) return true;
    return false;
}

int main() {
    cin >> abcd;
    if (dfs(abcd[0] -'0', "")) {
        printf("%c%c%c%c%c%c%c=7\n", abcd[0], OP[0], abcd[1], OP[1], abcd[2], OP[2], abcd[3]);
    }

    return 0;
}


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

int main(){
  int a;
  cin >> a;
  vector<int> m(a);
  rep(i,a){cin >> m[i];}
  
  sort(m.begin(),m.end());
  m.erase(unique(m.begin(),m.end()),m.end());
  
  cout << m.size() << endl;
}

Measured memory_bytes: 3620
N,T= map(int, input().split())
c =[]
t =[]
for i in range(N):
    c1, t1 = [int(i) for i in input().split()]
    c.append(c1)
    t.append(t1)

flag = False
for i in range(N):
    if t[i] <= T:
        flag = True

if flag == False:
    print("TLE")

min = 10000
for i in range(N):
    if t[i] <= T and c[i] < min:
        min = c[i]

if flag == True:
    print(min)


Measured memory_bytes: 3064
#include<stdio.h>

#define N 100
#define K 100000

int a[N+1];		//石をとれる個数の集合
int dp[K+1];	//=1勝ち状態,=0負け状態

int main(void)
{
	int i;
	int j;	//for文を回す用のi,j
	int k;	//山石の個数
	int n;  //Aの要素数

	/*入力*/
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++){
		scanf("%d", &a[i]);
	}

	/*処理*/
	//dp[0] = 0;
	for(i=1; i<=k; i++){
		dp[i] = 0;
		for(j=1; j<=n; j++){
			if( ((i-a[j]) >= 0) && ((dp[i-a[j]]) == 0)){
				dp[i] = 1;
			}
		}
	}

	/*出力*/
	if(dp[k] == 1){
		printf("First\n");
	}else{
		printf("Second\n");
	}

	return 0;
}

Measured memory_bytes: 512
import numpy as np
from collections import Counter
import collections
round = lambda x:(x*2+1)//2
a = list(map(float,input().split()))
a = np.array(a)
N = a[0]
A = a[1]
B = a[2]
b = np.array([])
for i in range(int(N+1)):
  l = [int(x) for x in list(str(i))]
  l = sum(l)
  if l >= A and l <= B:
    b = np.append(b,i)
print(int(sum(b)))

Measured memory_bytes: 12648
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
#define ull unsigned long long
ull l,r,qwq,sit,sit1,ans,fen,ano;
int main(){
//	freopen("random.in","r",stdin);
//	freopen("bf.out","w",stdout);
	scanf("%llu%llu",&l,&r);
	if(l==r){
		printf("1");
		return 0;
	}
	while(1){
		ull q1=l;
		sit=sit1=0;
		while(q1) q1>>=1,sit++;
		q1=r;
		while(q1) q1>>=1,sit1++;
//		cout<<sit<<' '<<sit1<<endl;
		if(sit!=sit1) break;
		r-=(ull)(1)<<sit-1;
		l-=(ull)(1)<<sit-1;
	}
	sit=sit1=0;
//	cout<<l<<' '<<r<<endl;
	ull q1=r;
	while(q1) q1>>=1,sit++;
	sit--;
	fen=(ull)(1)<<sit;
	qwq=r-fen;
	ans=((ull)(1)<<sit+1)-l;
//	cout<<sit<<' '<<fen<<' '<<qwq<<' '<<ans<<endl;
	q1=qwq;
	while(q1) q1>>=1,sit1++;
	sit1--;
	ano=((ull)(1)<<sit1+1)-1;
//	cout<<ano<<endl;
	if(ano<l)ans-=(l-1-ano);
	printf("%llu",ans);
}

Measured memory_bytes: 3808
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a*b%2 == 0 ? "No" : "Yes");
        sc.close();

    }

}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
#include <iomanip>
using namespace std;
typedef long long ll;

int Tmax, V, E, u, v, d, Nnew, new_id, dst, order[11111], check[444], par[444], sum = 0;
vector<vector<pair<int, int>>> li(444);
queue<pair<int, int>> route;
queue<int> store;
queue<int> car;

void dfs(int now, int distance) {
	route.push(make_pair(now, distance));
	sum += distance * 2;
	for (auto &e : li[now]) {
		if (par[e.first] == now) {
			dfs(e.first, e.second);
			route.push(make_pair(now, e.second));
		}
	}
}

int main() {
	cin >> V >> E;
	for (int i = 0; i < E; i++) {
		cin >> u >> v >> d;
		li[u].push_back(make_pair(v, d));
		li[v].push_back(make_pair(u, d));
	}
	cin >> Tmax;
	for (int i = 0; i < Tmax; i++) {
		cin >> Nnew;
		if (Nnew)
			cin >> new_id >> order[i];
		else
			order[i] = -1;
	}
	for (int i = 1; i <= V; i++)
		check[i] = 0;
	priority_queue<pair<pair<int, int>, int>, vector<pair<pair<int, int>, int>>, greater<pair<pair<int, int>, int >>> que;
	que.push(make_pair(make_pair(0, 1), -1));
	while (!que.empty()) {
		int now = que.top().first.second, npar = que.top().second;
		que.pop();
		if (!check[now]) {
			check[now]++;
			par[now] = npar;
			for (auto &e : li[now]) {
				int next = e.first, dnext = e.second;
				if (!check[next])
					que.push(make_pair(make_pair(dnext, next), now));
			}
		}
	}
	dfs(1, 0);
	route.pop();
	int count = 0, ndst=1, check_store = 1;
	for (int i=0; i < Tmax; i++) {
		if (order[i] > 0)
			store.push(order[i]);
		if (ndst == 1 && !count)
			check_store = 1;
		if (check_store) {
			while (!store.empty()) {
				car.push(store.front());
				store.pop();
			}
		}
		if (check_store&&car.size() < 10)
			cout << "-1" << endl;
		else {
			check_store = 0;
			if (!count) {
				queue<int> keep;
				while (!car.empty()) {
					if (car.front() != ndst)
						keep.push(car.front());
					car.pop();
				}
				while (!keep.empty()) {
					car.push(keep.front());
					keep.pop();	
				}
				int nowp = ndst;
				ndst = route.front().first;
				count = route.front().second;
				route.pop();
				route.push(make_pair(ndst, count));
				if (car.empty()) {
					while (ndst != par[nowp]) {
						ndst = route.front().first;
						count = route.front().second;
						route.pop();
						route.push(make_pair(ndst, count));
					}
				}
			}
			cout << ndst << endl;
			count--;
		}
	}
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int a, b;
	char op;
	do{
		scanf("%d %c %d", &a, &op, &b);
		switch(op){
			case '+': printf("%d\n",a+b);
				break;
			case '-': printf("%d\n",a-b);
				break;
			case '*': printf("%d\n",a*b);
				break;
			case '/': printf("%d\n",a/b);
				break;
		}
	}while(op!='?');
	
	return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, m, x, y, q, k;
string s[2005], t;

// <------------- Implement Functions Here ----------> //

ll l[4000][4000];
ll r[4000][4000];
ll u[4000][4000];
ll d[4000][4000];

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n>>m;
	for(ll i=1;i<=n;i++) {
		cin>>s[i];
		s[i] = '#' + s[i];
		for(ll j=1;j<=m;j++) {
			l[i][j] = u[i][j] = d[i][j] = r[i][j] = (s[i][j] == '.');
		}
	}

	for(ll i=2;i<=n;i++) {
		for(ll j=1;j<=m;j++) {
			if(u[i][j]) {
				u[i][j] += u[i-1][j];
			}
		}
	}

	for(ll i=n-1;i>=1;i--) {
		for(ll j=1;j<=m;j++) {
			if(d[i][j]) {
				d[i][j] += d[i+1][j];
			}
		}
	}

	for(ll i=1;i<=n;i++) {
		for(ll j=2;j<=m;j++) {
			if(l[i][j]) {
				l[i][j] += l[i][j-1];
			}
		}
	}

	for(ll i=1;i<=n;i++) {
		for(ll j=m-1;j>=1;j--) {
			if(r[i][j]) {
				r[i][j] += r[i][j+1];
			}
		}
	}

	ll maxi = 0;

	for(ll i=1;i<=n;i++) {
		for(ll j=1;j<=m;j++) {
			if(s[i][j]=='.')
				maxi = max(maxi,u[i-1][j] + d[i+1][j] + l[i][j-1] + r[i][j+1] + 1);
		}
	}

	cout<<maxi;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 165440
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d,e,f,g,h;
    cin>>a>>b>>c>>d;
    cin>>e>>f>>g>>h;
    if(a+b+c+d<e+f+g+h){
        cout<<e+f+g+h<<endl;
    }
    else{
        cout<<a+b+c+d<<endl;
    }
   
    
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define FORre(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
const int mod = 1000000007;

int main(void){
  int x, a;
  cin >> x >> a;
  if(x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    
    int score = 0;
    rep(i, n-1) {
        if(s[i] == s[i+1]) {
            score++;
        }
    }

    int ans = min(n-1, score + 2*k);

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

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

int main() {

  vector<vector<int>> A(3, vector<int>(3));
  vector<vector<bool>> check(3, vector<bool>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  
  int N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    int b;
    cin >> b;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (A[i][j] == b){
          check[i][j] = true;
        }
      }
    }
  }

  for (int i = 0; i < 3; i++) {
    if (check[i][0] && check[i][1] && check[i][2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  for (int i = 0; i < 3; i++) {
    if (check[0][i] && check[1][i] && check[2][i]){
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  if (check[0][0] == true && check[1][1] == true && check[2][2] == true) {
    cout << "Yes" << endl;
    return 0;
  }

  if (check[0][2] == true && check[1][1] == true && check[2][0] == true) {
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	int ans = 0;
	rep(i,n){
		while(a.at(i) % 2 == 0){
			ans++;
			a.at(i) /= 2;
		}
	}
	cout << ans << endl;
}


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

using namespace std;

int main(){

  int A,B,i,s,t;
  bool can;
  can=true;

  cin>>A>>B;

  for(i=1;i<100001;i++){
    s=i*0.08;
    t=i*0.1;
    if(s==A and t==B){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<"-1"<<endl;  
  return 0;
}


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

    if(a=='A')cout<<"T"<<endl;
    if(a=='T')cout<<"A"<<endl;
    if(a=='C')cout<<"G"<<endl;
    if(a=='G')cout<<"C"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int ans = 0;
		if(b >= a*c){
			ans = c;
		}else{
			ans = b/a;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
void solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

void solve() {
	string S;
	cin >> S;
	while (S.size() > 0) {
		if (S.size() >= 7) {
			if (S.substr(S.size() - 7, 7) == string("dreamer")) {
				S.erase(S.size() - 7, 7);
				continue;
			}
		}
		if (S.size() >= 5) {
			if (S.substr(S.size() - 5, 5) == string("dream")) {
				S.erase(S.size() - 5, 5);
				continue;
			}
		}
		if (S.size() >= 6) {
			if (S.substr(S.size() - 6, 6) == string("eraser")) {
				S.erase(S.size() - 6, 6);
				continue;
			}
		}
		if (S.size() >= 5) {
			if (S.substr(S.size() - 5, 5) == string("erase")) {
				S.erase(S.size() - 5, 5);
				continue;
			}
		}
		break;
	}
	if (S == string(""))cout << "YES" << endl;
	else cout << "NO" << endl;
	return;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    int ans=0;
    int tmp=0;
    for(int i=0;i<S.length();i++){
        if(S[i]=='A' || S[i]=='T' || S[i]=='G' || S[i]=='C'){
            tmp++;
            ans=max(tmp,ans);
        }
        else tmp=0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1e18
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,pair<ll,ll> >
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b,ll m){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a) % m;  a = (a * a) % m;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 2e5 + 2;
ll n;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    cout<<180 * (n - 2);
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
s = input().split()

b = []

for item in s:
    b.append(int(item))

my_dict = dict()

for i in range(len(b)):
    my_dict[b[i]] = i+1

out = []
for i in range(len(b)):
    out.append(str(my_dict[i+1]))

print(" ".join(out))


Measured memory_bytes: 31208
#include <iostream>
#include <sstream>
#include <fstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include<iomanip>
#define sqr(x) (x)*(x)
#define ll long long
using namespace std;
ll num[300001],l[300001],r[300001],ans=-1152921504606846976,n,i,j;
priority_queue<int,vector<int>,greater<int>/**/> le;
priority_queue<ll> ri;
int main()
{
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>num[i];
		l[n]+=num[i];
		le.push(num[i]);
	}
	for (i=n+1;i<=n*2;i++)
	{
		cin>>num[i];
	}
	for (i=n*2+1;i<=n*3;i++)
	{
		cin>>num[i];
		r[2*n+1]+=num[i];
		ri.push(num[i]);
	}
	for (i=n+1;i<=n+n;i++)
	{
		l[i]=l[i-1];
		if (le.top()<num[i])
		{
			l[i]=l[i]-le.top()+num[i];
			le.pop();
			le.push(num[i]);
		}
	}
	for (i=n+n;i>n;i--)
	{
		r[i]=r[i+1];
		if (ri.top()>num[i])
		{
			r[i]=r[i]-ri.top()+num[i];
			ri.pop();
			ri.push(num[i]);
		}
	}
	for (i=n;i<=2*n;i++)
	{
		if (ans<l[i]-r[i+1]) ans=l[i]-r[i+1];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7284
#include <iostream>
#include <vector>

int main()
{
	int N;
	std::cin >> N;
	std::vector<int> A(N);

	for( auto &a : A ){
		std::cin >> a;
	}

	for( int i = N-1; i >= 0; i-- ){
		std::cout << A[i] << ( i!=0? " ":"" );
	}

	std::cout << std::endl;
}


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

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

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

	sort(a.begin(), a.end(), greater<int>());

	ll ans = 0;
	
	for (int i = 0; i < n; i++) {
		ans += a[1 + (i) * 2];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>

int main(void)
{
    char c;
    scanf("%c", &c);
    switch(c){
        case 'A':
            puts("T");
            break;
        case 'T':
            puts("A");
            break;
        case 'C':
            puts("G");
            break;
        case 'G':
            puts("C");
            break;
        }
    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;
using P = pair<string,int>;

int main() {
int h,w;
cin >> h >> w;
vector<string> a(h);
vector<vector<int>> d = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}};
rep(i,h) cin >> a.at(i);
rep(i,h)rep(j,w)if(a.at(i).at(j) == '.'){
    int cnt = 0;
    rep(k,8){
      int x = i +d.at(k).at(0);
      int y = j +d.at(k).at(1);
      if(x >= 0 && x < h && y >= 0 && y < w && a.at(x).at(y) == '#') cnt++;     
      }
      a.at(i).at(j) = '0' + cnt;
    }

rep(i,h) cout << a.at(i) << endl;
 }


Measured memory_bytes: 3644
#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/

int main()
{
	cin >> n >> k;
	h = abs(n);
	w = abs(k);
	if (h < w)
	{
		if (n < 0) ans++;
		if (k < 0) ans++;
		cout << w - h + ans << endl;
	}
	else if (h == w)
	{
		cout << 1 << endl;
	}
	else
	{
		if (n > 0) ans++;
		if (k > 0) ans++;
		cout << h - w + ans << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<map>

using namespace std;

int main(){
    long long n;
    cin >> n;
    map<long long, long long> nums;
    for(long long i = 0; i < n; i++){
        long long input;
        cin >> input;
        nums[input] += 1;
    }

    long long q;
    cin >> q;
    long long ans = 0;
    for(map<long long, long long>::iterator itr = nums.begin(); itr != nums.end(); itr++){
        ans += itr->first * itr->second;
    }
    for(long long i = 0; i < q; i++){
        long long b, c;
        cin >> b >> c;
        ans += c*nums[b] - b*nums[b];
        nums[c] += nums[b];
        nums.erase(nums.find(b));
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 7500
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n, v[100];
  ld sum;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> v[i];
  sort(v, v + n);
  sum = v[0];
  for (int i = 1; i < n; ++i) sum = (sum + v[i]) / 2.0;
  cout << fixed << setprecision(15) << sum;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++) cin >> A.at(i);
    int counter = 0;
    while (true) {
        for (int i=0; i<N; i++) {
            if (A.at(i)%2 == 0) A.at(i) /= 2;
            else goto end;
        }
        counter++;
    }
end:
    cout << counter << endl;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, A, B;
    scan(N, A, B);
    if (B < A)
        swap(A, B);
    if ((B - A) % 2 == 0)
    {
        ((B - A) / 2).writeln();
        return;
    }
    long a = N - A;
    long b = B - 1;
    long c = ((B - A) - 1) / 2 + (A); // 1で折り返す
    long d = (N - (A + N - B + 1)) / 2 + (N - B + 1); // Nで折り返す
    // writeln(a, " ", b, " ", c, " ", d);
    min(a, b, c, d).writeln();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define A 0
#define B 1
#define C 2
#define MAX 3

int main(){
  string str[MAX];
  for(int i=A ; i<MAX ; i++)
    cin >> str[i];
  str[A]+='A';
  str[B]+='B';
  str[C]+='C';
  
  int turn=A;
  while(str[turn].size()>1){
    if(str[turn][0]=='a'){
      str[turn]=str[turn].substr(1);
      turn=A;
    }else if(str[turn][0]=='b'){
      str[turn]=str[turn].substr(1);
      turn=B;
    }else if(str[turn][0]=='c'){
      str[turn]=str[turn].substr(1);
      turn=C;
    }
  }
  cout << str[turn] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int maxn = 100100;
typedef long long ll;
int ok[maxn];
int n;
std::vector<int> p;
inline ll factor(ll x) {
	for(ll j : p) {
		ll o = j * j * j;
		if(o > x) return x;
		for(;x % o == 0;x /= o);
	}
	exit(1);
}
inline ll rev(ll x) {
	static const ll none = 1145141919810;
	ll y = 1;
	for(ll j : p) {
		if(j > 10000) break;
		if(x % j == 0) {
			int c = 0;
			for(;x % j == 0;++ c) x /= j;
			if(c <= 2) y *= j;
			if(c <= 1) y *= j;
		}
	}
	ll p = round(sqrtl(x));
	if(p * p == x) y *= p, x = 1;
	if((long double) x * x <= 1e11) y *= x * x, x = 1;
	return x == 1 ? y : none;
}
std::map<ll, int> map;
int main() {
	for(int i = 2;i < maxn;++i) if(!ok[i]) {
		p.push_back(i);
		for(int j = i;j < maxn;j += i) ok[j] = 1;
	}
	std::ios::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n;
	for(int i = 1;i <= n;++i) {
		ll x; std::cin >> x, ++ map[factor(x)];
	}
	int ans = 0;
	for(auto i = map.begin();i != map.end();i = map.erase(i)) {
		if(i -> first == 1) { ++ ans; continue; }
		auto it = map.find(rev(i -> first));
		if(it != map.end()) {
			ans += std::max(i -> second, it -> second);
			map.erase(it);
		} else {
			ans += i -> second;
		}
	}
	std::cout << ans << '\n';
}


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

int main(void) {

	long long N, r = 0, g = 0, b = 0, t = 0;
	cin >> N;
	vector<char> S(N);
	rep(i, N) {
		cin >> S[i];
		if (S[i] == 'R')  r++;
		else if (S[i] == 'G') g++;
		else if (S[i] == 'B') b++;
	}

	if (N < 4) {
		cout << 0 << endl;
	}
	else {
		for (int i = 1; i < N - 1; i++) {
			for (int j = 1; i - j >= 0 && i + j < N; j++) {
				char x = S[i - j], y = S[i], z = S[i + j];
				if (x != y && x != z && y != z) t++;
			}
		}
		cout << r * g * b - t << endl;
	}
	return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,0,n) cin >> a[i];
    sort(all(a));
    bool ok = true;
    rep(i,1,n){
        if(a[i-1] == a[i]) ok = false;
    }
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 1024
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)

#s[i] is linked with t[len(s)-i-1]
def main():
	a,b,c = map(int,input().split())
	print(min(b//a,c))

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Measured memory_bytes: 63980
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define rep(i, a, b) for(re int i = (a); i <= (b); ++ i)
#define drep(i, a, b) for(re int i = (b); i >= (a); -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define int long long
#define D double
#define inf 1023456789
#define mod 1000000007
#define lb(x) (x)&(-(x))
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
#define ls k * 2
#define rs k * 2 + 1
#define maxn 2333
namespace Graph {
	int head[maxn], cnt;
	struct edge { int v, next; }e[maxn << 1];
	il void add(int u, int v) { e[++ cnt] = (edge){v, head[u]}, head[u] = cnt; }
}
//using namespace Graph;
int n, m;
char c[maxn];
signed main() {
	scanf("%s", c);
	if(c[1] == 'R') puts("ABC");
	else puts("ARC");
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    
    vector<vector<vector<int>>> info(4, vector<vector<int>>(3, vector<int>(10, 0)));

    int a, b, c, d;

    for(int i = 0; i < n; i++) {
        cin >> a >> b >> c >> d;

        info.at(a-1).at(b-1).at(c-1) += d;
    }

    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 10; k++) {
                cout << ' ' << info.at(i).at(j).at(k);
                if(k == 9) cout << endl;
            }
        }

        if(i != 3) cout << "####################" << endl;
    }
}


Measured memory_bytes: 3124