akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <string>
#include <cctype>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
  vector<int> word(3);
  int five=0,seven=0;
  for(int i=0;i<3;i++)
    cin>>word[i];
  for(int i=0;i<3;i++){
    if(word[i]==5)
      five++;
    else if(word[i]==7)
      seven++;
  }
  if(five==2&&seven==1)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

ll a[100005],b[100005];

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n;
  cin>>n;
  forn(i,0,n+1){
    cin>>a[i];
  }
  forn(i,0,n){
    cin>>b[i];
  }
  ll sum=0;
  forn(i,0,n){
    if(a[i]>=b[i]){
      a[i]-=b[i];
      sum+=b[i];
      b[i]=0;
    }else{
      sum+=a[i];
      b[i]-=a[i];
      a[i]=0;
      if(a[i+1]>=b[i]){
        a[i+1]-=b[i];
        sum+=b[i];
        b[i]=0;
      }else{
        sum+=a[i+1];
        b[i]-=a[i+1];
        a[i+1]=0;
      }
    }
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
long long int a,b,n,i,max,c,d,e,f,h;
  
  scanf("%lld %lld %lld",&a,&b,&n);

  
  c=a*n/b;
   e=n/b; 
   f=a*e;
  max=c-f;
  
  if(a==b || b>n) 
  {printf("%lld",max);}
  
  
 else{
     
      d=b-1;
     c=(a*d)/b;
     e=d/b;
     f=a*e;
     if(max<(c-f)) max=c-f;
     
      
    printf("%lld",max);}

  
return 0;
}

Measured memory_bytes: 1692
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

use std::cmp::*;

fn run() {
    input! {
        n: usize,
        p: [(i64, i64); n],
    }
    let mut p = p;
    p.sort();
    let mut left = vec![0; n + 1];
    let mut right = vec![1_000_000_000; n + 1];
    let mut ans = 0;
    for i in (0..n).rev() {
        left[i] = max(left[i + 1], p[i].0);
        right[i] = min(right[i + 1], p[i].1);
        ans = max(ans, p[i].1 - p[i].0 + 1);
    }
    let mut x = vec![0; n + 1];
    let mut y = vec![1_000_000_000; n + 1];
    for i in 0..n {
        x[i + 1] = max(x[i], p[i].0);
        y[i + 1] = min(y[i], p[i].1);
        let mut v = p[i].1 - p[i].0 + 1;
        let l = max(x[i], left[i + 1]);
        let r = min(y[i], right[i + 1]);
        if i + 1 < n {
            v += max(0, r - l + 1);
        }
        ans = max(ans, v);
    }
    for i in 1..n {
        let mut v = 0;
        v += max(0, y[i] - x[i] + 1);
        v += max(0, right[i] - left[i] + 1);
        ans = max(ans, v);
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 12540
#include<bits/stdc++.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[105];
    int flag=1;
    scanf("%s",a);
    int n=strlen(a);
    int i,j;
    for(i=0,j=(n-1)/2-1;i<j;i++,j--)
    {
        if(a[i]!=a[j])
            {flag=0;break;}
    }
    for(i=(n+3)/2-1,j=n-1;i<j;i++,j--)
    {
        if(a[i]!=a[j])
            {flag=0;break;}
    }
    for(i=0,j=n-1;i<j;i++,j--)
    {
        if(a[i]!=a[j])
            {flag=0;break;}
    }
    if(flag)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}






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

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

    int odd_num = 0;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;

        odd_num += A % 2;
    }

    if (odd_num % 2 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <list>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define MAX 100000
typedef long long LL;
typedef unsigned long long ULL;
int check[MAX];
int cmp(const void*v1, const void*v2){
    return *(int*)v1 - *(int*)v2;
}
int main(void){
    int n; scanf("%d", &n);
    rep(i, n) scanf("%d", &check[i]);
    qsort(check, n, 4, cmp);
    int ret = 0;
    int cur = check[0],  num = 1;
    rep1(i, 1, n){
        if(check[i] != cur){
            if(num > cur) ret += num-cur;
            else if(cur > num) ret += num;
            cur = check[i];
            num = 1;
        }
        else num++;
    }
    if(num > cur) ret += num-cur;
    else if(cur > num) ret += num;
    printf("%d", ret);
    return 0;
}    


Measured memory_bytes: 1020
class Array
  def cumsum!(s = 0); map!{|t| s += t } end
end

n, k = gets.to_s.split.map{|t| t.to_i }
a    = gets.to_s.split.map{|t| t.to_i }

ans = []
[k, 45].min.times do |i|
  ans = [0] * n
  a.each_with_index do |t, i|
    
    j = i - t
    if 0 <= j
      ans[j] += 1
    else
      ans[0] += 1
    end
    
    j = i + t + 1
    ans[j] += -1 if j < n
  end
  ans.cumsum!
  a = ans.dup
end

puts ans * ' '

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

int main(void)
{
  char S[100000];
  int  c[100000];

  int N;
  int i,j;
  int RLwidth;
  int Rcount,Lcount;
  int childNum;


  scanf("%s", S);

  N = strlen(S);

  for ( i = 0; i < N; i++)
    c[i] = 0;

  i = 1;

  while ( i < N ){

    RLwidth = 1;
    Rcount = 1;

    while ( S[i] == 'R' ){  // RLの並びが来るまで
      i++;
      Rcount++;
      RLwidth++;
    }

    Lcount = 0;
    while ( S[i] == 'L' ){ // LRの並びが来るまで
      i++;
      Lcount++;
      RLwidth++;
    }

    if ( RLwidth % 2 == 0 ){
      c[ i - Lcount ] = RLwidth / 2;
      c[ i - Lcount - 1 ] = RLwidth / 2;
    }
    else{
      if ( Rcount % 2 == 0 ){
        c[ i - Lcount ] = RLwidth / 2 + 1;
        c[ i - Lcount - 1 ] = RLwidth / 2;
      }
      else{
        c[ i - Lcount ] = RLwidth / 2;
        c[ i - Lcount - 1 ] = RLwidth / 2 + 1;
      }
    }
    i++;

  }
  
  for ( i = 0; i < N-1; i++)
    printf("%d ",c[i]);
  printf("%d\n",c[N-1]);

  return 0;
}

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

using namespace std;

const int MAXN = 100009;
const int BIG = 1000000009;

vector<vector<long long>> ans;
long long w[101], v[101];

int main() {
	int n, W, best_j = 0;
	long long take;
	cin >> n >> W;	

	ans.resize(n); for (int i = 0;i < n;i++) ans[i].assign(MAXN, BIG);
	
	for (int i = 0;i < n;i++) cin >> w[i] >> v[i];
	
	ans[0][v[0]] = w[0];
	best_j = v[0];

	for (int i = 1;i < n;i++) {
		for (int j = 0;j < MAXN;j++) {
			if (j - v[i] < 0 || (long long)(ans[i - 1][j - v[i]] + w[i]) > W) take = BIG; else take = (long long)(ans[i - 1][j - v[i]] + w[i]);			
			ans[i][j] = min(take, ans[i - 1][j]);
			if (j == v[i]) ans[i][j] = min(ans[i][j], w[i]);
			if (ans[i][j] != BIG && j > best_j) best_j = j;
		}
	}	
	
	cout << best_j;
}

Measured memory_bytes: 78592
(n, m) = map(int, input().split())

def kouyaku(n, m):
    a = n % m
    if a == 0:
        return m
    return kouyaku(m, a)

s = input()
t = input()

a = kouyaku(n, m)

sn = n // a
sm = m // a

ok = True
for i in range(a):
    if(s[i*sn] != t[i*sm]):
        print(str(-1))
        ok = False
        break

if ok == True:
    print(sn*sm*a)

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

public class Main {

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

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(in.readLine());
      String line = in.readLine();
      int ans = 0;

      int offset=0, next=0;
      char regex = ' ';
      boolean isContinue = true;
      for(int i=0, ai=0; isContinue; i++) {
        if((next = line.indexOf(regex, offset)) == -1) {
          next = line.length();
          isContinue = false;
        }

        ai = Integer.parseInt(line.substring(offset, next));
        ans += Integer.numberOfTrailingZeros(ai);

        offset = ++next;
      }

      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 25428
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    int sum=0;
    for(int i=0; i<N; ++i){
        int l, r;
        cin >> l >> r;
        sum += r - l + 1;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, -1, sizeof(mat))
const int N=100000;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a;
	cin>>a;	
	cout<<48-a<<endl;
	return 0;
}


Measured memory_bytes: 764
package main

import (
    "fmt"
    "sort"
)

type DrinkShop struct {
    Price int
    Stock int
}

type DrinkShops []DrinkShop

func (ds DrinkShops) Len() int {
    return len(ds)
}

func (ds DrinkShops) Swap(i, j int) {
    ds[i], ds[j] = ds[j], ds[i]
}

func (ds DrinkShops) Less(i, j int) bool {
    return ds[i].Price < ds[j].Price
}

func main() {
    var N int = scanInt()
    var M int = scanInt()
    var drink_shops DrinkShops
    for i := 0; i < N; i++ {
        var A int = scanInt()
        var B int = scanInt()
        drink_shops = append(drink_shops, DrinkShop{ Price: A, Stock: B})
    }
    // Go 1.6だと使えないっぽい
    // sort.Slice(drink_shops, func(i, j int) bool { return drink_shops[i].Price < drink_shops[j].Price })
    sort.Sort(drink_shops)
    var total_cost int
    var number_of_drink int
    for i := 0; i < N; i++ {
        if number_of_drink + drink_shops[i].Stock < M {
            total_cost += drink_shops[i].Price * drink_shops[i].Stock
            number_of_drink += drink_shops[i].Stock
        } else {
            total_cost += drink_shops[i].Price * (M - number_of_drink)
            break
        }
    }
    fmt.Println(total_cost)
}

func scanInt() (num int) {
    fmt.Scan(&num)
    return
}

func scanInts(len int) (nums []int) {
    var num int
    for i := 0; i < len; i++ {
        fmt.Scan(&num)
        nums = append(nums, num)
    }
    return
}

func scanString() (str string) {
    fmt.Scan(&str)
    return
}

func scanStrings(len int) (strs []string) {
    var str string
    for i := 0; i < len; i++ {
        fmt.Scan(&str)
        strs = append(strs, str)
    }
    return
}

Measured memory_bytes: 7424
/*	MASTER HAS FAILED MORE TIMES
	THAN BEGINNER HAS EVER TRIED
*/

#include <bits/stdc++.h>

using namespace std;

#define endl            '\n'
#define mem(a, n)       memset(a, n, sizeof(a))
#define repeat(n)       for(int i=0; i<n; i++)
#define Unique(n)       (n).erase(unique(all(n)), (n).end())
#define isPowerOfTwo(n) (n && !(n & (n - 1)))
#define NumofDigits(n)  ((int)log10(n)+1)
#define all(a)          a.begin(), a.end()

long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }
long long lcm(long long a, long long b){ return a*b/gcd(a, b); }

void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

/*
    Special functions:
        find_by_order(k) --> returns iterator to the kth largest element counting from 0
        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item
*/

int main(){
    quicken();

    int n, k, c=0; cin >> n >> k;
    int arr[n];
    repeat(n) cin >> arr[i], c += (arr[i]>=k);

    cout << c;
    return 0;
}


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

#define pi acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define sf scanf
#define pf printf
#define nl printf("\n")
#define ps(s) printf("%s",s.c_str())
#define	inf (ll)1e15
#define mod 1000000007
#define mem(x,val) memset(x,val,sizeof x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

using namespace __gnu_pbds;
using namespace std;

inline string str_inp(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string line_inp(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;


const int S=100100;
int main()
{
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //#endif
	int n;
	while(~sf("%d",&n))
	{
		int ara[n+5];
		int cnt=0;
		for(int i=1;i<=n;i++)
		{
			sf("%d",&ara[i]);
			if(i%2==1 && ara[i]%2==1)cnt++;
		}
		pf("%d\n",cnt);
	}
    return 0;
}
 






































Measured memory_bytes: 3824
n = int(input())
tax = 1.08

x_min = n / tax
x_max = (n + 1) / tax

for x in range(int(x_min), int(x_max) + 2):
    if n <= (x * 1.08) < n + 1:
        print(x)
        break
else:
    print(":(")

Measured memory_bytes: 38256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}


int gcd(int a,int b){
  if(a%b)return gcd(b,a%b);
  else return b;
}
int main(){
  int n;cin>>n;
  int sm = 0;
  int mx = 0;
  for(int i = 0; n > i; i++){
    int t;cin>>t;
    sm += t;
    mx = max(t,mx);
  }
  if(mx < sm-mx){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
n = int(input())
l = [int(input()) for i in range(n)]
l.sort()

def f():
  ans = 0
  count = 1
  now = l[0]

  if n == 1:
    return 1

  for i in range(1, n):
    if l[i] == now:
      count += 1
    else:
      if not count % 2 == 0:
        ans += 1
      count = 1
      now = l[i]
    
    if i == n-1 and not count % 2 == 0:
      ans += 1
  return ans

print(f())

Measured memory_bytes: 7492
A,B,M=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
x=[0 for i in range(M)]
y=[0 for i in range(M)]
c=[0 for i in range(M)]
for i in range(M):
    x[i],y[i],c[i]=map(int,input().split())
    x[i]-=1;y[i]-=1
ans=[min(a)+min(b)]
for k in range(M):
    ans.append(a[x[k]]+b[y[k]]-c[k])
print(min(ans))

Measured memory_bytes: 27380
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;

using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);
vector<int> e[100005];
map<int, map<int, int>> id;
lli dfs(int u, int p, const lli mask)
{
  lli ans = 1;
  for (auto s : e[u])
  {
    if (s == p)
      continue;
    lli e_id = id[s][u];
    lli a = dfs(s, u, mask);
    if ((mask >> e_id) & 1)
    {
      ans *= a;
    }
    else
    {
      ans *= 2 * a;
    }
  }
  return ans;
}
lli to_root[100005];
void fill_to_root(int u, int p, lli mask)
{
  to_root[u] = mask;
  for (auto s : e[u])
  {
    if (s == p)
      continue;
    fill_to_root(s, u, mask | (1ll << id[u][s]));
  }
}
void solve(long long N, std::vector<long long> a, std::vector<long long> b,
           long long M, std::vector<long long> u, std::vector<long long> v)
{
  rep(i, N - 1) a[i]--, b[i]--;
  rep(i, M) u[i]--, v[i]--;
  rep(i, N - 1) e[a[i]].push_back(b[i]), e[b[i]].push_back(a[i]), id[a[i]][b[i]] = i, id[b[i]][a[i]] = i;
  fill_to_root(0, -1, 0);
  // rep(i, N)
  // {
  //   cout << to_root[i] << endl;
  // }
  lli whole = 0;
  rep(i, 1 << M)
  {

    lli mask = 0;
    rep(j, M)
    {
      if ((i >> j) & 1)
      {
        lli lhs = u[j];
        lli rhs = v[j];
        lli tmp = to_root[lhs] ^ to_root[rhs];
        mask |= tmp;
      }
    }
    lli ans = dfs(0, -1, mask) * (__builtin_popcount(i) & 1 ? -1 : 1);
    //cout << i << " " << mask << " " << dfs(0, -1, mask) << endl;
    whole += ans;
  }
  cout << whole << endl;
}

int main()
{
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N - 1);
  std::vector<long long> b(N - 1);
  for (int i = 0; i < N - 1; i++)
  {
    scanf("%lld", &a[i]);
    scanf("%lld", &b[i]);
  }
  long long M;
  scanf("%lld", &M);
  std::vector<long long> u(M);
  std::vector<long long> v(M);
  for (int i = 0; i < M; i++)
  {
    scanf("%lld", &u[i]);
    scanf("%lld", &v[i]);
  }
  solve(N, std::move(a), std::move(b), M, std::move(u), std::move(v));
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 2560
def resolve():
    import sys

    input = sys.stdin.readline

    n = int(input())
    numbers = list(map(int, input().split()))

    denied = False

    for num in numbers:
        if num % 2 == 0 and num % 3 != 0 and num % 5 != 0 :
            denied = True
            print("DENIED")
            break

    if not denied :
        print("APPROVED")

resolve()

Measured memory_bytes: 38384
s=input()
# ai=max(左にある<の連続数,右にある>の連続数)
n=len(s)+1
dr,dl=[0]*n,[0]*n
# dl[i]:区切りiの左にある<の連続数。dl[0]=0
# dr[i]:区切りiの右にある>の連続数。dl[-1]=0
# ともにlen=n
p=''
cl,cr=0,0
for i in range(n-1):
      if s[i]=='<':
            cl+=1
      else:
            cl=0
      dl[i+1]=cl
      if s[-(i+1)]=='>':
            cr+=1
      else:
            cr=0
      dr[-(i+2)]=cr
ans=0
for i in range(n):
      ans+=max(dl[i],dr[i])
print(ans)


Measured memory_bytes: 51016
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=200010;
int tt,sum,rt,cnt,tp;
bool vis[N];
int head[N],to[N*2],nxt[N*2],s[N*2],sz[N],Mx[N],a[N],pa[N];
struct Dat {
    int x,y;ll z;
    inline bool operator < (const Dat &A) const {return z<A.z;}
} g[N],f[N*20],pre;
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline void get_rt(int x,int fa) {
    sz[x]=1,Mx[x]=0;
    for(int i=head[x];i;i=nxt[i]) {
	int y=to[i];
	if(!vis[y]&&y!=fa) {
	    get_rt(y,x),sz[x]+=sz[y];
	    Mx[x]=max(Mx[x],sz[y]);
	}
    }
    Mx[x]=max(Mx[x],sum-sz[x]);
    rt=(Mx[x]<Mx[rt]?x:rt);
}
inline void get_dep(int x,ll d,int fa) {
    g[++tp]=(Dat){x,0,d+a[x]};
    pre=min(pre,g[tp]);
    for(int i=head[x];i;i=nxt[i])
	if(!vis[to[i]]&&to[i]!=fa) get_dep(to[i],d+s[i],x);
}
inline void solve(int x) {
    vis[x]=1,tp=0,pre=(Dat){0,0,1LL<<60};
    get_dep(x,0,0);
    for(int i=1;i<=tp;i++)
	f[++cnt]=(Dat){pre.x,g[i].x,pre.z+g[i].z};
    for(int i=head[x];i;i=nxt[i]) {
	int y=to[i];
	if(!vis[y]) {
	    sum=sz[y],rt=0;
	    get_rt(y,x),solve(rt);
	}
    }
}
inline int find(int x) {return pa[x]==x?x:pa[x]=find(pa[x]);}
int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi(),pa[i]=i;
    for(int i=1;i<n;i++) {
	int x=gi(),y=gi(),z=gi();
	to[++tt]=y,nxt[tt]=head[x],s[tt]=z,head[x]=tt;
	to[++tt]=x,nxt[tt]=head[y],s[tt]=z,head[y]=tt;
    }
    Mx[0]=sum=n,get_rt(1,0);
    solve(rt);
    sort(f+1,f+1+cnt);
    ll ans=0;
    for(int i=1;i<=cnt;i++) {
	int x=find(f[i].x),y=find(f[i].y);
	if(x!=y) pa[x]=y,ans+=f[i].z;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 71296
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yay!");}else{puts(":(");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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


    if(e-a<=k)yn;
    return 0;
}
 
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1<<28
#define MAX_V 600
struct edge {
  int to,cap,rev;
  edge(){}
  edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
};

vector<edge> G[MAX_V];
map<int,int> M[MAX_V];
int level[MAX_V];
int iter[MAX_V];


void add_edge(int from,int to,int cap){
  M[from][to]=G[from].size();
  M[to][from]=G[to].size();
  G[from].push_back(edge(to,cap,G[to].size()));
  // undirected
  //G[to].push_back(edge(from,cap,G[from].size()-1));
  // directed
  G[to].push_back(edge(from,0,G[from].size()-1));
}

void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int> que;
  level[s]=0;
  que.push(s);
  while(!que.empty()){
    int v=que.front();que.pop();
    for(int i=0;i<(int)G[v].size();i++){
      edge &e = G[v][i];
      if(e.cap>0&&level[e.to]<0){
	level[e.to]=level[v]+1;
	que.push(e.to);
      }
    }
  }
}

int dfs(int v,int t,int f){
  if(v==t) return f;
  for(int &i=iter[v];i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d = dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t,int lim){
  int flow=0;
  for(;;){
    bfs(s);
    if(level[t]<0||lim==0) return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,lim))>0){
      flow+=f;
      lim-=f;
    }
  }
}

int max_flow(int s,int t){
  return max_flow(s,t,INF);
}

//cap==1 only
bool back_edge(int s,int t,int from, int to){
  for(int i=0;i<(int)G[from].size();i++) {
    edge& e=G[from][i];
    if(e.to==to) {
      if(e.cap==0&&max_flow(from,to,1)==0) {
	max_flow(from,s,1);
	max_flow(t,to,1);
	return 1;
      }
    }
  }
  return 0;
}

signed main(){
  int V,E;
  cin>>V>>E;
  for(int i=0;i<E;i++){
    int u,v,c;
    cin>>u>>v>>c;
    add_edge(u,v,c);
  }
  cout<<max_flow(0,V-1)<<endl;
  return 0;
}

/*
verified on 2017/04/22
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A&lang=jp
*/

Measured memory_bytes: 3332
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  string s; cin >> s;
  cout << s.substr(0, 3) << '\n';
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

struct Node {
  int p, l, r, d, h;
};

int get_sibling(vector<Node> &T, int u) {
  if (T[u].p == -1) return -1;
  auto p = T[u].p;
  return (T[p].l == u) ? T[p].r : T[p].l;
}

void print(vector<Node> &T, int u) {
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "sibling = " << get_sibling(T, u) << ", ";
  cout << "degree = " << ((T[u].l != -1) + (T[u].r != -1)) << ", ";
  cout << "depth = " << T[u].d << ", ";
  cout << "height = " << T[u].h << ", ";

  if (T[u].p == -1)
    cout << "root";
  else if (T[u].l == -1 && T[u].r == -1)
    cout << "leaf";
  else
    cout << "internal node";
  cout << endl;
}

void set_depth(vector<Node> &T, int u, int d) {
  if (u == -1) return;
  T[u].d = d;
  set_depth(T, T[u].l, d + 1);
  set_depth(T, T[u].r, d + 1);
}

int set_height(vector<Node> &T, int u) {
  int h1 = 0, h2 = 0;
  if (T[u].l != -1) h1 = set_height(T, T[u].l) + 1;
  if (T[u].r != -1) h2 = set_height(T, T[u].r) + 1;
  return T[u].h = max(h1, h2);
}

int main() {
  int n, root;
  cin >> n;
  vector<Node> T(n);
  REP(i, n) T[i].p = -1;
  REP(i, n) {
    int id, l, r;
    cin >> id >> l >> r;
    T[id].l = l;
    T[id].r = r;
    if (l != -1) T[l].p = id;
    if (r != -1) T[r].p = id;
  }
  REP(i, n)  if (T[i].p == -1) root = i;
 
  set_depth(T, root, 0);
  set_height(T, root);
  REP(i, n) print(T, i);
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	double xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2;
	while(1){
		cin>>xa1>>ya1>>xa2>>ya2>>xb1>>yb1>>xb2>>yb2;
		if(cin.eof()) break;
		if(xa1<=xb2 && xb1<=xa2 && yb1<=ya2 && ya1<=yb2) o("YES");
		else o("NO");
	}
}

Measured memory_bytes: 1220
#include<cstdio>
#include<utility>
#include<queue>
#include<vector>
#include<functional>
#define INF 99999999
using namespace std;
struct CITY
{
	int id,cost,range,used;
	vector<CITY*> root;
	vector<CITY*> event_root;
};
int city_num,root_num;
int *city_cost;
CITY *city;
void input()
{
	scanf("%d %d",&city_num,&root_num);
	city=new CITY[city_num];
	city_cost=new int[city_num];
	fill(city_cost,city_cost+city_num,INF);
	for(int f1=0;f1<city_num;f1++){
		scanf("%d %d",&city[f1].cost,&city[f1].range);
		city[f1].id=f1;city[f1].used=0;
	}
	for(int f1=0;f1<root_num;f1++){
		int buf1,buf2;
		scanf("%d %d",&buf1,&buf2);
		buf1--;buf2--;
		city[buf1].root.push_back(&city[buf2]);
		city[buf2].root.push_back(&city[buf1]);
	}
}
void connect(CITY *start)
{
	int *dist;
	dist=new int[city_num];
	fill(dist,dist+city_num,INF);
	queue<CITY*> que;
	que.push(start);
	dist[start->id]=0;
	while(!que.empty()){
		CITY *temp;
		temp=que.front();que.pop();
		if(dist[temp->id]>start->range)break;
		for(unsigned int f1=0;f1<temp->root.size();f1++){
			if(dist[temp->root[f1]->id]==INF){
				dist[temp->root[f1]->id]=dist[temp->id]+1;
				que.push(temp->root[f1]);
			}
		}
	}
	for(int f1=0;f1<city_num;f1++){
		if(dist[f1]<=start->range&&f1!=start->id){
			start->event_root.push_back(&city[f1]);
		}
	}
	delete []dist;
}
int main(void)
{
	input();
	for(int f1=0;f1<city_num;f1++)connect(&city[f1]);
	//
	priority_queue<pair<int,CITY*>,vector<pair<int,CITY*> >,greater<pair<int,CITY*> > > que;
	que.push(make_pair(0,&city[0]));
	city_cost[0]=0;
	while(!que.empty()){
		pair<int,CITY*> temp;
		temp=que.top();que.pop();
		if(temp.second->id==city_num-1)break;
		for(unsigned int f1=0;f1<temp.second->event_root.size();f1++){
			if(temp.second->event_root[f1]->used==0){
				if(temp.first+temp.second->cost<city_cost[temp.second->event_root[f1]->id]){
					city_cost[temp.second->event_root[f1]->id]=temp.first+temp.second->cost;
					que.push(make_pair(temp.first+temp.second->cost,temp.second->event_root[f1]));
				}
			}
		}
		temp.second->used=1;
	}
	printf("%d\n",city_cost[city_num-1]);
	return 0;
}

Measured memory_bytes: 126208
n = int(input(""))

f=0

for i in range(1,10):
    for j in range(i,10):

        #print(i,j,i*j)
        a= i*j

        if n == (i*j) :
            
            print("Yes")
            f = 1
            break
        else:
            None

    if f == 1 :
        break

if f != 1 :
    print ("No")

    


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int N, A, B;
    cin >> N >> A >> B;

    vector<int> X(N);
    for (auto &i : X) cin >> i;

    ll ans = 0;
    rep(i, N-1) {
        ll a = (ll)(X[i+1] - X[i]) * A;
        if (a < B) ans += a;
        else ans += B;
    }

    cout << ans << endl;
}

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

#define mygc(c) (c)=getchar()

int ri() {
	int c,s=0,r=0;
	for(;;){ mygc(c); if(c=='-'){s=1;break;} if(c<='9'&&c>='0'){r=c-'0';break;}}
	for(;;){ mygc(c); if(c>'9'||c<'0')break; r= r* 10 + c-'0';}
	if(s)r=-r;
	return r;
}

s64 rs64() {
	int c,s=0;
	s64 r=0;
	for(;;){ mygc(c); if(c=='-'){s=1;break;} if(c<='9'&&c>='0'){r=c-'0';break;}}
	for(;;){ mygc(c); if(c>'9'||c<'0')break; r= r* 10 + c-'0';}
	if(s)r=-r;
	return r;
}

s64 v[50];

int main() {
	int n = ri();
	int a = ri();
	int b = ri();
	
	map<s64, int> num;
	FOR(i,n) v[i] = rs64(), num[v[i]]++;
	sort(begin(v),end(v),greater<s64>());
	
	double r0 = 0;
	FOR(i,a) r0 += v[i];
	printf("%.10f\n", r0 / a);
	
	Comb com(51);
	s64 res = 0;
	if (v[0] == v[a-1]) {
		for (int i = a; i <= b; i++) 
			if (num[v[0]] >= i) res += com.ncr(num[v[0]], i);
	} else {
		int nu = 0;
		DOWN(i,a) if (v[i] == v[a-1]) nu++; else break;
		res = com.ncr(num[v[a-1]], nu);
	}
	
	cout << res << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int l,r,d;
  cin>>l>>r>>d;
  int x=l/d;
  int y=r/d;
  if (l%d==0){
  cout<<y-x+1<<endl;}
  else{cout<<y-x<<endl;}
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define N 1000
bool a[N];
int n,k;
int main(){
    cin>>n>>k;
    for(int i=0;i<k;i++){
        int d;
        cin>>d;
        for(int i=0;i<d;i++){
            int x;
            cin>>x;
            a[x]=1;
        }
    }
    int ans=n;
    for(int i=1;i<=n;i++){
        ans-=a[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);



int main(){
    FIN;

    ll n; cin >> n;
    ll k; cin >> k;
    vector<char> d(k);
    for(int i=0;i<k;i++) cin >> d[i];
    ll ans;

    for(ll i=n;;i++){
        string s;
        s = to_string(i);
        bool ok = true;
        for(int j=0;j<s.size();j++){
            for(int m=0;m<k;m++){
                if(s[j] == d[m]) ok = false;
            }
        }
        if(ok){
            ans = i;
            break;
        }
    }

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


Measured memory_bytes: 3740
#include <stdio.h>
#include <string.h>
#include <iostream>

using namespace std;

int main()
{
	int n,k;
	scanf("%d",&n);
	scanf("%d",&k);
	for(int i = 0; i < k; i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		x--;
		y--;
		x = min(x,n - 1 - x);
		y = min(y,n - 1 - y);
		int l = min(x,y);
		printf("%d\n",l % 3 + 1);
	}
	return 0;
}

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

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


adiv = sorted(set(make_divisors(a[0]) + make_divisors(a[1])),reverse=True)


def is_ok(arg):
    #print(f"index{arg}でーす{adiv[arg]}")
    cnt = 0
    for i in range(n):
        if a[i]%adiv[arg] != 0:
            cnt += 1
            #print(str(a[i])+"×")

        if cnt>=2:
            #print("だめ"+str(a[i])+" iは"+str(i))
            return False
            break    
    else:
        #print("ok-")
        return True

import sys
for i in range(len(adiv)):
    if is_ok(i):
        print(adiv[i])
        sys.exit()

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

struct Node {
  int key;
  struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

Node * treeMinimum(Node *x) {
  while(x->left != NIL)
    x = x->left;
  return x;
}

Node * find(Node *u, int k) {
  while(u != NIL && k != u->key) {
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

Node * treeSuccessor(Node *x) {
  if(x->right != NIL) return treeMinimum(x->right);
  Node *y = x->parent;
  while(y != NIL && x == y->right) {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node *z) {
  Node *y; // 削除する対象
  Node *x; // yの子

  // 削除する節点を決める
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  // yの子xを決める
  if(y->left != NIL) {
    x = y->left;
  } else {
    x = y->right;
  }

  if(x != NIL) {
    x->parent = y->parent;
  }

  if(y->parent == NIL) {
    root = x;
  } else {
    if(y == y->parent->left) {
      y->parent->left = x;
    } else {
      y->parent->right = x;
    }
  }

  if(y != z) {
    z->key = y->key;
  }
}

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node *)malloc(sizeof(Node));
  z->key   = k;
  z->left  = NIL;
  z->right = NIL;
  
  while(x != NIL) {
    y = x;
    if(z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if(y == NIL) {
    root = z;
  } else {
    if( z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
  
int main(void) {
  int n, i, x;
  char com[16];
  scanf("%d",&n);
  
  for(i=0;i<n;i++) {
    scanf("%s",com);
    if(!strcmp(com,"find")) {
      scanf("%d",&x);
      Node *t = find(root,x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    } else if(!strcmp(com,"insert")) {
      scanf("%d",&x);
      insert(x);
    } else if(!strcmp(com,"print")) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if(!strcmp(com,"delete")) {
      scanf("%d",&x);
      treeDelete(find(root,x));
    }
  }

  return 0;
}


Measured memory_bytes: 25152
import java.util.PriorityQueue;
import java.util.Scanner;

class Activity implements Comparable<Activity> {
    int s;
    int t;

    Activity(int s, int t) {
        this.s = s;
        this.t = t;
    }

    public int compareTo(Activity act) {
        return t - act.t;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        PriorityQueue<Activity> que = new PriorityQueue<>();
        for(int i = 0; i < n; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            que.add(new Activity(s, t));
        }

        int res = 0;
        int time = 0;
        while(!que.isEmpty()) {
            Activity act = que.poll();
            if(time >= act.s) continue;

            res++;
            time = act.t;
        }

        System.out.println(res);
 
        sc.close();
    }
}


Measured memory_bytes: 103688
#include<bits/stdc++.h>
using namespace std;
long long a[100005];
long long gcd(long long a, long long b) {
	return b?gcd(b,a%b):a;
}
int main() {
	long long n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++) {
		long long tmp; 
        cin>>tmp;
		a[i]=tmp/2;
	}
	long long lcm=1LL;
	for (int i=0;i<n;i++) {
		lcm=lcm*a[i]/gcd(lcm,a[i]);
		if(lcm>m)
		{ 
		cout<<'0';
		return 0;
		}
	}
	for (int i=0;i<n;i++) {
		if(((lcm/a[i])%2)==0) 
		{
			cout<<'0';
			return 0;
		}
	}
	long long ans=(m/lcm+1)/2;
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
count = 0

for a in range(1,k+1):
    for b in range(a,k+1):
        for c in range(b,k+1):
            if a == b and b == c:
                count += gcd(a,b,c)
            elif a == b:
                count += gcd(a,b,c)*3
            elif b == c:
                count += gcd(a,b,c)*3
            else:
                count += gcd(a,b,c)*6
        
print(count)

Measured memory_bytes: 9636
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
  
  string s;
  cin>> s;
  
  int ret;
  int st=-1,en=0;
  for(int i=0;i<s.length();i++)
  {
    
    if(st==-1&&s[i]=='A')st=i;
    if(s[i]=='Z')en=i;
  }
  ret=en-st+1;
  cout<< ret<< endl;
  return 0;
}


Measured memory_bytes: 640
// kill it - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define f(i,x,n) for(int i=x;i<n;++i)


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


void solve(){	
	int n; cin>>n;
	int a[n+1];
	f(i,1,n+1) cin>>a[i];
	map<int,int> mp,mp1;
	f(i,1,n+1){
		 mp[a[i]-i]++;
		 mp1[(a[i]+i)*(-1)]++;
	 }
	int ans=0;
	for(auto it : mp){
		ans+=(it.second*(mp1[it.first]));
	}
	cout<<ans<<"\n";
}

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


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;


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

    // 素数である
    return true;
}


int Gcd(int x,int y)              //最大公約数
{
  int large = max(x,y);
  int small = min(x,y);

  while(small!=0){
      int amari =large%small;

      large = small;

      small = amari;  
  }
  return large;
}

const int MOD = 1000000007;




//メイン関数--------------------------------------------



int main(){

string s;
cin>>s;
int n=s.size();
if(s[n-1] == 's'){
    s+="es";
}
else{
    s+="s";
}
cout<<s<<endl;



}

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

using namespace std;

int main() {
    int N, A[2][200], tmp;
    cin >> N;
    tmp = 0;
    cin >> A[0][0];
    for (int i=1; i<N; i++) {
        cin >> tmp;
        A[0][i] = A[0][i-1] + tmp;
    }
    cin >> A[1][0];
    A[1][0] += A[0][0];
    for (int i=1; i<N; i++) {
        cin >> tmp;
        A[1][i] = max(A[1][i-1], A[0][i])+tmp;
    }
    cout << A[1][N-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 4e5 + 5, mod = 998244353;



int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    char a[5][5];
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
        }
    }
    if(a[0][0] != a[1][2] || a[0][1] != a[1][1] || a[0][2] != a[1][0]) cout << "NO";
    else cout << "YES";


    return 0;

}




Measured memory_bytes: 256