akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s:Vec<char> = read::<String>().chars().collect();
    let mut v = vec![0; 3];
    for c in s {
        match c {
            'a' => v[0] += 1,
            'b' => v[1] += 1,
            _ => v[2] += 1
        }
    }
    println!("{}", if v.iter().max().unwrap() - v.iter().min().unwrap() <= 1 {"YES"} else {"NO"});
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
ll sz(string &s) {return (ll)s.size(); } 
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }

int main(){
    ll n,m;
    cin >> n >> m;
    ll sum[n+1] = {};
    rep(i,0,m){
        ll l,r;
        cin >> l >> r;
        sum[l]++;
        if(r+1 <= n) sum[r+1]--;
    }
    ll cnt = 0;
    rep(i,1,n+1){
        sum[i] += sum[i-1];
        if(sum[i] == m) cnt++;
    }
    cout << cnt << endl;
    return 0;
}



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

int main()
{
  int a,b;
  cin >> a >> b;
  int tmp;
  tmp = a+b;
  tmp = max(tmp,2*a-1);
  tmp = max(tmp,2*b-1);
  cout << tmp << endl;
  return 0;
}


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

using namespace std;

map<pair<int, int>, int> freq;

pair<int, int> f(int x){
    int a = x % 10;
    int b = 0;
    while(x){
        b = x % 10;
        x /= 10;
    }
    return make_pair(a, b);
}

int main(){
    int n;
    cin >> n;
    int num = 1, ans = 0;
    for(int i = 1; i <= n; ++i){
        pair<int, int> p = f(i);
        freq[p]++;
    }
    for(int i = 1; i <= n; ++i){
        pair<int, int> p = f(i);
        pair<int, int> q(p.second, p.first);
        ans += freq[q];
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
    int K, A, B, i, count;
    cin>>K>>A>>B;
    count=0;
    for(i=A;i<=B;i=i+1)
    {
        if(i%K==0)
        {
            count=1;
        }
    }
    if(count==0)
    {
        cout<<"NG";
    }
    else
    {
        cout<<"OK";
    }
}

Measured memory_bytes: 3596
import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
    static long INF = 10000000000L;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int W = sc.nextInt();
        int[] w = new int[n];
        int[] v = new int[n];
        int tot = 0;
        for(int i=0;i<n;i++){
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
            tot+=v[i];
        }
        long[] dp = new long[tot+1];
        Arrays.fill(dp, INF);
        dp[0] = 0;
        for(int i=0;i<n;i++){
            for(int j = tot - v[i];j>=0;j--){
                dp[j+v[i]] = Math.min(dp[j+v[i]], w[i]+dp[j]);
            }
        }
        long ans = 0;
        for(int i=0;i<=tot;i++){
            if(dp[i]<=W){
                ans = Math.max(ans, i);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 24148
def subset_sum(n, s, a):
	dp = [[0 for x in range(s+1)] for x in range(n+1)]
	for i in range(n):
		v = a[i]
		for j in range(s+1):
			if v==j or (v<j and dp[i][j-v]>0):
				dp[i+1][j] = dp[i][j] + 1
			else:
				dp[i+1][j] = dp[i][j]
	return dp[n][s] > 0

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))
for i in range(q):
	if subset_sum(n, m[i], a) == True:
		print('yes')
	else:
		print('no')



Measured memory_bytes: 5944
n = gets.chomp.to_i
div = 5
ans = 0

if n.odd?
    puts 0
    exit
else
    while  n > div
        # f(N)では1つ飛ばしの数をかけていくため、2で割って半分にする
        ans += n/(div*2)
        div *= 5
    end
    puts ans
end


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

int main() {
	int n, x, y;
	cin >> n >> x >> y;
	x--; y--;
	vector<vector<int>> dist(n + 1, vector<int>(n + 1));
	rep(i, n)rep(j, n) {
		dist[i][j] = abs(i - j);
	}
	vector<int> ans(100000);
	rep(i, n - 1)for (int j = i + 1; j < n; ++j) {
		dist[i][j] = min(dist[i][j], abs(x - i) + abs(y - j) + 1);
		ans[dist[i][j]]++;
	}
	for (int i = 1; i <= n - 1;++i) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 16384
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N;
string S[56], X;
int t[56];

int main() {

	cin >> N;
	rep(i, N) cin >> S[i] >> t[i];
	cin >> X;

	int ans = 0;
	bool f = false;
	rep(i, N) {
		if (f) ans += t[i];
		if (S[i] == X) {
			f = true;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define next Next
#define y1 _y1
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=100005;
int n,q;
LL m;
struct nd{
	int a,b,c;
}v[N];
int fa[N];
int getf(int x){
	return fa[x]==x?x:fa[x]=getf(fa[x]);
}
int id[N],c[N];
int cnt[N];
int main(){
	n=read(),m=read(),q=read();
	For(i,1,q)
		v[i].a=read()+1,v[i].b=read()+1,v[i].c=read();
	For(i,1,n)
		fa[i]=i;
	For(i,1,q){
		if (v[i].c==0)
			fa[getf(v[i].a)]=getf(v[i].b);
	}
	For(i,1,q)
		if (v[i].c==1&&getf(v[i].a)==getf(v[i].b))
			return puts("No"),0;
	int c1=0;
	For(i,1,n){
		id[i]=getf(i);
		c[id[i]]++;
		if (id[i]!=i)
			c1++;
	}
	if (m<c1)
		return puts("No"),0;
	For(i,1,n)
		fa[i]=i;
	For(i,1,q)
		if (v[i].c==1)
			fa[getf(id[v[i].a])]=getf(id[v[i].b]);
	int s=0;
	For(i,1,n)
		if (id[i]==i)
			cnt[getf(i)]++,s++;
	vector <int> v;
	For(i,1,n)
		if (id[i]==i&&getf(i)==i)
			v.pb(cnt[i]);
	sort(v.begin(),v.end());
	if (v.back()==1)
		return puts(m==n-1?"Yes":"No"),0;
	if (s<=2)
		return puts("No"),0;
	if (m<n||m>(LL)s*(s-1)/2+c1)
		return puts("No"),0;
	puts("Yes");
	return 0;
}

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

int main(){
  string S;
  cin >> S;

  const int half_len = (int)( S.size() / 2 );
  
  int hugCount = 0;

  for( int i = 0; i < half_len; ++i ){
    if( S.at(i) != S.at( S.size()-1 - i ) ){
      ++hugCount;
    }
  }

  cout << hugCount << endl;

}


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

#define For(i, x, y) for (int i = x; i <= (int)(y); ++i)
#define Rep(i, x, y) for (int i = y; i >= (int)(x); --i)
#define mem memset
#define pb push_back
#define mp make_pair
#define in inline 

const int maxn = 3007;

int n, a[maxn];

int main() {
    cin >> n;
    int s = 0;
    For(i, 1, n) cin >> a[i], s += a[i];    
    printf("%d\n", s - n);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)

int main() {
  int n, k;
  cin >> n >> k;

  vector<double> psum(n + 1);
  double sum = 0;
  Rep(i, n) {
    int a;
    cin >> a;
    sum += (double)(a + 1) / 2;
    psum[i + 1] = sum;
  }

  double answer = 0;
  Rep(i, n - k + 1) {
    double sum = psum[i + k] - psum[i];
    answer = max(sum, answer);
  }
  cout << fixed << setprecision(10);
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 1792
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n = input.next().parse::<usize>().unwrap();
    let mut a = vec![0; n];
    let mut max = 0;
    for i in 0..n {
        a[i] = input.next().parse::<usize>().unwrap();
        if max < a[i] {
            max = a[i];
        }
    }
    a.sort();
    let mut ok = false;
    for i in max..max + 2 {
        let mut t = true;
        for j in 0..n {
            let v = if i as i32 + i as i32 - n as i32 > j as i32 {
                i - 1
            } else {
                i
            };
            t &= v == a[j];
        }
        ok |= t;
    }
    println!("{}", if ok { "Yes" } else { "No" });
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next(&mut self) -> String {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap();
    }
}



Measured memory_bytes: 11508
#include <bits/stdc++.h>
#define DEBUG false
#define coutd if(DEBUG) cout
#define debugf if(DEBUG) printf
#define ff first
#define ss second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define FOR(i, x) for(int i=0; i<x; i++)
#define FOR1(i, x) for(int i=1; i<=x; i++)
#define REAP(i, x) for(int i=x-1; i>=0; i--)
#define REAP1(i, x) for(int i=x; i>0; i--)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(){
	ios_base::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	cout << n+1-k << endl;

}



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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        int n; cin >> n;
        vector<int> a(n); cin >> a;

        vector<int> bits(20);
        ll ans = 0;
        for (int l = -1, r = 0; r < n; r++) {
                while (1) {
                        auto temp = bits;
                        bool ok = 1;
                        for (int bit = 0; bit < 20; bit++) {
                                temp[bit] += !!(1 << bit & a[r]);
                                ok &= temp[bit] <= 1;
                        }

                        if (ok) {
                                bits = temp;
                                break;
                        }

                        l++;
                        for (int bit = 0; bit < 20; bit++) {
                                bits[bit] -= !!(1 << bit & a[l]);
                        }
                }

                ans += r - l;
        }

        cout << ans;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


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

using namespace std;
//using namespace __gnu_pbds;

#define ss second
#define ff first
//#define int long long
//#define double long double
#define pb push_back


const int N = 2e5 + 51 + 51, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;

//gp_hash_table<int, int> table;

double dp[3000][3000], a[N], b[N];

signed main() {
    #ifdef Flash
     freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = 1.0 - a[i];
    }
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            dp[i + 1][j + 1]+=  dp[i][j] * a[i];
            dp[i + 1][j]+= dp[i][j] * b[i];
        }
    }
    int k = n /2 + 1;
    double sum = 0;
    for (int i = k; i <= n; i++) sum+= dp[n][i];
    cout << setprecision(30) << fixed << sum;
}


Measured memory_bytes: 71808
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <functional>
using namespace std;

int main() {
	string S;
	cin >> S;
	cout << S.rfind("Z") - S.find("A") + 1<< endl; ;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <utility>
#include <math.h>
#include <algorithm>
using namespace std;
using ll=long long;
ll gcd(ll a,ll b){return (b==0?a:gcd(b,a%b));}
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,n) for(int i=a;i<n;i++)

int main (){
    ll A,B,cnt=0;
    cin >> A >> B;
    ll C=gcd(A,B);
    ll D=C,F;
    Rep(i,2,sqrt(C)+1){
        F=0;
        while(D%i==0){
            D/=i;
            F=1;
        }
        if(F==1){
            cnt++;
        }
    }
    if(D>1){
        cnt++;
    }
    cout << cnt+1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include<unordered_map>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
	double solubility = 100.00000 * E / (E + 100.00000);
	double concentration = 0.00000;
	double water = 0.00000;
	double sugar = 0.00000;
	rep(i, 101) {
		rep(j, 101) {
			rep(k, 101) {
				rep(m, 101) {
				
					double tmpwater = 100.00000 * A*i + 100.00000 * B*j;
					double tmpsugar = C * k + D * m;
					double maxsugar = tmpwater * E / 100.00000;
					if (tmpsugar + tmpwater <= F
						&&tmpsugar+tmpwater!=0
						&&tmpsugar<=maxsugar) {
						double tmp =
							100.00000 * tmpsugar / (tmpsugar+tmpwater);
						if (tmp <= solubility&&
							concentration<=tmp) {
							concentration = tmp;
							water = tmpwater;
							sugar = tmpsugar;
						}
						if (concentration==
							solubility) {
							break;
						}
					}
				}
			}
		}
	}
	if (water == 0) {
		water = 100*A;
	}
	cout << water+sugar << " " << sugar;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
int main(void)
{
    ll n, m;
    cin >> n >> m;
    vector<ll> s(m),c(m);
    rep(i,m) cin >> s[i] >> c[i];
    rep(i,1000){
        string t = to_string(i);
        if(t.size()==n){
            bool ok=true;
            rep(j,m){
                if(t[s[j]-1] != c[j]+'0') ok = false;
            }
            if(ok){
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3692
#include <iostream>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    
    int w[n];
    int m = 0;
    for(int i = 0; i < n; ++i){
        cin >> w[i];
        m += w[i];
    }
    
    int P = 0;
    int j = 0;
    int t = 0;
    int l = 0;
    int r = m;
    while(l < r){
        P = (l + r) / 2;
        while(true){
            int s = 0;
            while(s + w[j] <= P){
                s += w[j];
                j++;
                if(j >= n){
                    break;
                }
            }
            t++;
            if(t > k){
                j = 0;
                t = 0;
                l = P + 1;
                break;
            }
            if(j >= n){
                j = 0;
                t = 0;
                r = P;
                break;
            }
        }
    }
    
    cout << l << endl;
    
    return 0;
}

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Solve.Answer();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var LR = IO_ShortCut.ReadSplitLong;
            var L = LR[0];
            var R = LR[1];

            R = Min(R, L + 2019);
            long ans = 2018;
            for (var i = L; i <= R - 1; i++)
            {
                for (var j = i + 1; j <= R; j++)
                {
                    long x = i * j % 2019;
                    ans = Min(x, ans);
                }
            }
            WriteLine(ans);
        }
    }

    public class IO_ShortCut
    {
        #region Input
        public static string ReadString => ReadLine();
        public static int ReadInt => int.Parse(ReadLine());
        public static long ReadLong => long.Parse(ReadLine());
        public static double ReadDouble => double.Parse(ReadLine());

        public static List<string> ReadSplitString => ReadLine().Split().ToList();
        public static List<int> ReadSplitInt => ReadLine().Split().Select(s => int.Parse(s)).ToList();
        public static List<long> ReadSplitLong => ReadLine().Split().Select(s => long.Parse(s)).ToList();
        public static List<double> ReadSplitdouble => ReadLine().Split().Select(s => double.Parse(s)).ToList();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");

        #endregion
    }

    /// <summary>
    /// 正の数の四則演算のみ対応
    /// </summary>
    public class Mod
    {
        // 割る数の定義
        private readonly static long M = 1000000007;

        // 足し算
        public static long Add(long a, long b) => (a * b) % M;
        // 引き算
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        // 掛け算
        public static long Multi(long a, long b) => (a * b) % M;
    }

    public class MathLib
    {
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define ms(x, n) memset(x,n,sizeof(x));
#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define rep1(i, n) for(int i = 1; i <= (int)n; ++i)
#define pb push_back
#define PI acos(-1.0)
#define LONG_LONG_MAX 9223372036854775807
#define LONG_LONG_MIN -9223372036854775808
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;

int n;

bool check(int x) {
    int cnt = 0;
    while (x > 0) {
        int num = x % 10;
        x /= 10;
        ++cnt;
    }
    if (cnt % 2 == 1) return true;
    return false;
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
        if (check(i)) {
            ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int x; cin >> x;
    if (x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


Measured memory_bytes: 18736
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,l; cin>>n>>l;
	int mn=INT_MAX,tmp,tot=0;
	For(i,1,n)
	{
		if(abs(l+i-1)<mn)
		{
			mn=abs(l+i-1);
			tmp=l+i-1;
		}
		tot+=l+i-1;
	}
	cout<<tot-tmp<<"\n";
	return 0;
}















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

int main(){
	int n;
  	cin >> n;
  
  	bool ans = false;
  	rep(i, 3){
    	if(n % 10 == 7) ans = true;
      	n = n / 10;
    }
  
  	cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element



signed main()
{
	int H1, M1, H2, M2, K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;

	int m1 = H1 * 60 + M1;
	int m2 = H2 * 60 + M2;
	int du = m2 - m1;
	int ans = max(0LL, du - K);

	cout << ans << endl;
}




Measured memory_bytes: 3568
#include <stdio.h>

int main ()
{
  int a, b, c, d, n, ans;
  
  while(scanf("%d", &n) != EOF){
    ans = 0;
    
    for(a = 0; a < 10; a++){
      for(b = 0; b < 10; b++){
        for(c = 0; c < 10; c++){
          for(d = 0; d < 10; d++){
            if(a+b+c+d == n)
              ans++;
          }
        }
      }
    }
    printf("%d\n", ans);
  }
    
  return 0;
}
    

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

int main()
{
  int n, a, ali, bor;
  string ans;
  cin >> n;
  cin >> ali;
  cin >> bor;
  ans = "Alice";
  a =((bor-1)-ali)%2;
  if(a == 0) ans = "Borys";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ull)(1e9)+7)
#define MAX ((ull)(1e9)+1)

int main(){
	int a, b, k;
	cin >> a >> b >> k;
	int cnt=0;
	for(int i=min(a,b); i>=1; i--){
		if(a%i==0 && b%i==0) cnt++;
		if(cnt==k){
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
def checker(x1,y1,x2,y2,xp,yp):
	r = 0
	vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
	if vec > 0:
		r = 1
	elif vec < 0:
		r = -1
	return r

if __name__ == '__main__':
	while True:
		try:
			x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
			r = 0
			r += int(checker(x1,y1,x2,y2,xp,yp))
			r += int(checker(x2, y2, x3, y3, xp, yp))
			r += int(checker(x3, y3, x1, y1, xp, yp))
			if r == 3 or r == -3:
				print("YES")
			else:
				print("NO")
		except EOFError:
			break

Measured memory_bytes: 4272
arr=[]
for i in range(3):
    a,b=map(int, input().split(" "))
    if a in arr:
        arr.remove(a)
    else:
        arr.append(a)
    
    if b in arr:
        arr.remove(b)
    else:
        arr.append(b)

if len(arr)==2:
    print("YES")
else:
    print("NO")


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

ll solve() {
    ll X;
    cin >> X;
    ll num = X / 11, v = 11 * num;
    num *= 2;
    while ( v < X ) {
        if ( num % 2 == 0 ) {
            num++;
            v += 6;
        } else {
            num++;
            v += 5;
        }
    }
    return num;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
d = dict()
for i in arr:
	if (i not in d):
		d[i] = 1
	else:
		d[i] += 1
q = int(input())
for i in range(q):
	b, c = map(int, input().split())
	if (b in d):
		s -= b * d[b]
		s += c * d[b]
		if (c not in d):
			d[c] = d[b]
		else:
			d[c] += d[b]
		d.pop(b)
	print(s)

Measured memory_bytes: 20736
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

const ll INF = (long long)1e16;
/// sa bag curatari mai multe
struct AINT {
    vector<ll> val;
    vector<ll> lazy;

    AINT(int sz) {
        lazy.resize(4 * sz + 5, INF);
    }

    void update(ll val, int from, int to, int node, int le, int ri) {
        if(from <= le && ri <= to)
            lazy[node] = min(lazy[node], val);
        else {
            int mid = (le + ri) / 2;
            if(from <= mid)
                update(val, from, to, node * 2, le, mid);
            if(mid < to)
                update(val, from, to, node * 2 + 1, mid + 1, ri);
        }
    }

    ll query(int x, int node, int le, int ri) {
        if(le == ri)
            return lazy[node];

        int mid = (le + ri) / 2;
        if(x <= mid)
            return min(lazy[node], query(x, node * 2, le, mid));
        else
            return min(lazy[node], query(x, node * 2 + 1, mid + 1, ri));
    }

};

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m;
    cin >> n >> m;
    vector<vector<pair<int, ll>>> v(n + 1);
    for(int i = 1; i <= m; i ++) {
        int l, r, cost;
        cin >> l >> r >> cost;
        v[l].push_back({r, cost});
    }

    AINT aint(n);
    aint.update(0, 1, 1, 1, 1, n);
    for(int i = 1; i <= n; i ++) {
        ll current_cost = aint.query(i, 1, 1, n);

        for(auto &it : v[i])
            aint.update(current_cost + it.second, i + 1, it.first, 1, 1, n);
    }

    ll ans = aint.query(n, 1, 1, n);
    if(ans >= INF)
        ans = -1;
    cout << ans;

    return 0;
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000007LL;

int n;
string S;
long long dp[100005][13];

int main () {

  // 入力受け取り
  cin >> S;
  memset(dp,0,sizeof(dp));
  dp[0][0] = 1;
  int n=S.size();
  
  // 上の桁から順にみていく桁dp
  int c;
  for(int i=0; i<n; i++) {
    if (S[i]=='?') c=-1;
    else c=S[i]-'0';
    for (int k=0; k<10; k++) {
      for (int j=0; j<13; j++) {   
        if (c!=-1 && c!=k) continue;
          dp[i+1][(j*10+k)%13] += dp[i][j];
      }
      for(int j=0; j<13; j++) dp[i+1][j] = dp[i+1][j]%MOD;
    }
  }
  /** 検算
  for(int i=0; i<n+1; i++) {
    for(int j=0; j<13; j++) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }
  */
  
  cout << dp[n][5] << endl;
  return 0;
}

Measured memory_bytes: 10624
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
  int n , m ;
  cin >> n >> m ;
  vector<int> a(n);
  for (int i = 0 ; i < n ; i++){
    cin >> a[i];
  }
  sort((a).begin(),(a).end());
  int ans = 0;
  for (int i = 0 ; i < m ; i++) {
    ans += a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
	
		Scanner scanner = new Scanner(System.in);
	
		int total = scanner.nextInt();
	
		long popular = scanner.nextInt();
	
		int[] target = new int[total];
		
		int tokuhyo;
		
		String result = "Yes";
	
		for (int i = 0; i < total; i++) {
		
			target[i] = scanner.nextInt();
		}
		
		scanner.close();
        
        tokuhyo = java.util.Arrays.stream(target).sum();
        
        target = Arrays.stream(target).boxed()
                .sorted(Comparator.reverseOrder())
                .mapToInt(Integer::intValue)
                .toArray();
        
        long t = 4*popular;
        
  //      System.out.println("t=" + t);
        
        double l = (double)1 / t;
        
  //      System.out.println("l=" + l);
        
        double s = tokuhyo * l;
        
  //      System.out.println("s=" + s);
        
        for (int i = 0; i < popular; i++) {
        	
        	if (target[i] < s) {
        		result = "No";
        	}
        }
        
        System.out.println(result);
	
	}
	

}


Measured memory_bytes: 28756
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }

int n,z,w;
vec a;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------

    cin>>n>>z>>w;
    a.resize(n);
    rep(i,n) cin>>a[i];
    if(n==1){
        cout<<abs(a[0]-w)<<endl;
    }
    else{
        cout<<max(abs(a[n-1]-w),abs(a[n-2]-a[n-1]))<<endl;
    }
    
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = readInt >>= print . foldl mul 1 . map ( fromIntegral . succ . length ) . group . sort . concatMap factorization . flip take [ 1 .. ]

factorization = f 2
	where
		f d x
			| x == 1 = []
			| x `mod` d  == 0 = d : f d ( x `div` d )
			| otherwise = f ( succ d ) x

mul :: Integer -> Integer -> Integer
mul a b = a * b `mod` 1000000007

Measured memory_bytes: 1916
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 2010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
//int n,m;
int a[maxn][maxn],s1[maxn][maxn],s2[maxn][maxn];
int main(){
	int n,k;
	in2(n,k);
	FOR(i,1,n){
		int x,y;
		in2(x,y);
		x%=k*2,y%=k*2;
		char c;
		scanf("%c",&c);
		if(c=='W')s1[x][y]++;
		 else s2[x][y]++;
	}
	int K=k;
	k=k*2-1;
	FOR(i,0,k)
		FOR(j,0,k){
			if(i>0)s1[i][j]+=s1[i-1][j];
			if(j>0)s1[i][j]+=s1[i][j-1];
			if(i>0&&j>0)s1[i][j]-=s1[i-1][j-1];
			if(i>0)s2[i][j]+=s2[i-1][j];
			if(j>0)s2[i][j]+=s2[i][j-1];
			if(i>0&&j>0)s2[i][j]-=s2[i-1][j-1];
		}
	int ans=0;
	FOR(i,0,K-1)
		FOR(j,0,K-1){
			ans=max(ans,s1[i][j]+s2[i][j+K]-s2[i][j]+s2[i+K][j]-s2[i][j]+s1[i+K][j+K]-s1[i][j+K]-s1[i+K][j]+s1[i][j]+s1[k][j]-s1[i+K][j]+s1[i][k]-s1[i][j+K]+s2[k][j+K]-s2[i+K][j+K]-s2[k][j]+s2[i+K][j]+s2[i+K][k]-s2[i+K][j+K]-s2[i][k]+s2[i][j+K]+s1[k][k]-s1[i+K][k]-s1[k][j+K]+s1[i+K][j+K]);
			ans=max(ans,s2[i][j]+s1[i][j+K]-s1[i][j]+s1[i+K][j]-s1[i][j]+s2[i+K][j+K]-s2[i][j+K]-s2[i+K][j]+s2[i][j]+s2[k][j]-s2[i+K][j]+s2[i][k]-s2[i][j+K]+s1[k][j+K]-s1[i+K][j+K]-s1[k][j]+s1[i+K][j]+s1[i+K][k]-s1[i+K][j+K]-s1[i][k]+s1[i][j+K]+s2[k][k]-s2[i+K][k]-s2[k][j+K]+s2[i+K][j+K]);
//			ans=max(ans,s1[i][j]+s2[i][k]-s2[i][j]+s2[k][j]-s2[i][j]+s1[k][k]-s1[i][k]-s1[k][j]+s1[i][j]);
//			ans=max(ans,s2[i][j]+s1[i][k]-s1[i][j]+s1[k][j]-s1[i][j]+s2[k][k]-s2[i][k]-s2[k][j]+s2[i][j]);
		}
	out(ans);
}

Measured memory_bytes: 33024
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

double const toDeg = 1.8e2/std::acos(-1);
double a, b, S;

int main() {
  std::cout << std::setprecision(10) << std::fixed;
  double x; std::cin >> a >> b >> x;
  S = x/a;
  if(S > a*b*0.5) {
    S = a*b-S;
    double h = S*2.0/a;
    fin(std::atan(h/a)*toDeg);
  } else {
    double h = S*2.0/b;
    fin(std::atan(b/h)*toDeg);
  }
  return 0;
}


Measured memory_bytes: 768
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {


		long N=nextLong();
		long M=nextLong();
		long ans = 0;
		if(N==1&&M==1){
			ans=1;
		}else if(N==1){
			ans=M-2;
		}else if(M==1){
			ans=N-2;
		}else{
			ans=Math.max(0,(N-2))*Math.max(0,(M-2));
		}
		System.out.println(ans);
	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21332
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define pi 3.14159265358979323846264338
#define flash_all ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

const int mxN=2e5;

int main()
{
	int a,b;
	cin>>a>>b;
	cout<<a*b<<nl;

	return 0;
}
//Happy Coading.....


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

int main() {
	int a[10];
	rep(i,9){
		cin >> a[i];
	}
	int n;
	cin >> n;

	vector<int>b(n);
	vector<int>c(10);

	rep(i, n) {
		cin >>b[i] ;
	}

	int ans = 0;

	rep(i, n) {
		rep(j, 9) {
			if (b[i]==a[j]) {
				c[j] = 1;
			}
		}
	}
	
	if (c[4]==1) {
		if (c[0]==1&&c[8]==1) {
			ans++;
		}
		if (c[6] == 1 && c[2] == 1) {
			ans++;
		}
		if (c[1] == 1 && c[7] == 1) {
			ans++;
		}
		if (c[3] == 1 && c[5] == 1) {
			ans++;
		}
	}
	
	if (c[0] == 1 && c[1] == 1 &&c[2]==1) {
		ans++;
	}
	if (c[6] == 1 && c[7] == 1 && c[8] == 1) {
		ans++;
	}
	if (c[0] == 1 && c[3] == 1 && c[6] == 1) {
		ans++;
	}
	if (c[2] == 1 && c[5] == 1 && c[8] == 1) {
		ans++;
	}


	if (ans!=0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

using namespace std;
#define ll  long long
#define ld  long double

#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN=1e5 + 5;
int main()
{
    FAST
    int a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a+a-1,b+b-1))<<endl;
    return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int a;
    for(int i = 0; i < n; i++){
        cin >> a;
    }
    cout << (((n - 1) + (k - 1) - 1) / (k - 1)) << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N, M int

type Point struct {
	x, y int
}

func main() {
	sc.Split(bufio.ScanWords)

	N, M = nextInt(), nextInt()
	st := make([]Point, N)
	ch := make([]Point, M)
	for i := 0; i < N; i++ {
		st[i].x, st[i].y = nextInt(), nextInt()
	}

	for i := 0; i < M; i++ {
		ch[i].x, ch[i].y = nextInt(), nextInt()
	}

	for i := 0; i < N; i++ {
		min, id := powInt(10, 9), -1
		for j := 0; j < M; j++ {
			dist := absInt(st[i].x-ch[j].x) + absInt(st[i].y-ch[j].y)
			if min > dist {
				min = dist
				id = j
			}
		}
		fmt.Println(id + 1)
	}
}


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

using namespace std;

int a[10000],i=10000,n;

int main()
{
    for(i=0;;i++)
    {
    cin>>a[i];
    n=i;
if(a[i]==0)
        break;
    }
    for(i=0;i<n;i++)
        cout<<"Case "<<i+1<<": "<<a[i]<<endl;

        return 0;
}



Measured memory_bytes: 3108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP2_5_C
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            string s = ReadSt();
            int[] line = Array.ConvertAll(s.Split(' '), e => int.Parse(e));

            int[] cur = line.OrderBy(x => x).ToArray();
            string[] items = Perm(cur).ToArray();
            int m = items.Count();
            for (int i = 0 ; i < m ; i++)
            {
                if (items[i] == s)
                {
                    if (i > 0) Console.WriteLine(items[i - 1]);
                    Console.WriteLine(items[i]);
                    if (i < items.Count() - 1) Console.WriteLine(items[i + 1]);
                    return;
                }
            }
        }

        static public IEnumerable<string> Perm(IEnumerable<int> items)
        {
            if (items.Count() == 1)
            {
                yield return items.First().ToString();
                yield break;
            }

            foreach (int item in items)
            {
                IEnumerable<int> unused = items.Where(x => x != item);
                foreach (string rightside in Perm(unused))
                {
                    yield return item.ToString() + " " + rightside;
                }
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }
}



Measured memory_bytes: 53144
#include<iostream>

using namespace std;

int main(){
  int x,y;
  cin >> x >> y;

  int a[12]={0,2,0,1,0,1,0,0,1,0,1,0};

  if(a[x-1]==a[y-1])
    cout<<"Yes\n";
  else
    cout<<"No\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
int main(){
	ll A=readll(),B=readll(),C=readll(),k=readll();
	printf("%lld\n",(A-B)*((k&1)?-1:1));
	return 0;
}

Measured memory_bytes: 256