akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<cmath>

using namespace std;

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

int a[101];
int ans;


void fact(int x){
    for (int i = 2; i <= x; i++){
        while (x % i == 0){
            a[i]++;
            x /= i;
        }
    }
}

void dfs(int* x, int m, int num){
    if (m == 3){
        rep(i, 2) if(x[i] == x[i+1] && x[i] >= 2) return;
        if(x[2] == 1) return;
        else if (x[1] == 1){
            if (a[x[2]] >= 74){
                ans++;
            }
        }else if(x[0] == 1){
            if (a[x[1]] >= 4 && a[x[2]] >= 14){
                ans++;
            }
            if (a[x[1]] >= 14 && a[x[2]] >= 4){
                ans++;
            }
            if (a[x[1]] >= 2 && a[x[2]] >= 24){
                ans++;
            }
            if (a[x[1]] >= 24 && a[x[2]] >= 2){
                ans++;
            }        
        }else{
            if (a[x[0]] >= 2 && a[x[1]] >= 4 && a[x[2]] >= 4){
                ans++;
            }
            if (a[x[0]] >= 4 && a[x[1]] >= 2 && a[x[2]] >= 4){
                ans++;
            } 
            if (a[x[0]] >= 4 && a[x[1]] >= 4 && a[x[2]] >= 2){
                ans++;
            }
        }        
        return;
    }
    
    int b[3];
    rep(i, 3) b[i] = x[i];
    for (int i = num; i <= 100; i++){
        b[m] = i;
        dfs(b, m + 1, i);
    }
    

}

int main(){
    int n;
    cin >> n;
    rep(i, n-1) fact(i+2);
    int x[3];
    dfs(x, 0, 1);
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n=0, sum=0;
  cin >> n;
  vector<int>t(n+1,0),x(n+1,0),y(n+1,0);
  for(int i=1;i<=n;i++){
    cin >> t[i] >> x[i] >> y[i];
  }
  for(int i=1;i<=n;i++){
    sum=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
    if(sum>(t[i]-t[i-1])){
      cout << "No" << endl;
      return 0;
    }
    if(sum%2 != (t[i]-t[i-1])%2){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 4580
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    string s;
    cin >> s;
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
        cout << "Bad";
    else
        cout << "Good";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ


			//Scannerクラスのインスタンスの生成
			Scanner sc = new Scanner(System.in);
//			int num = sc.nextInt();
//	        String str = Integer.toString(num);
			String str = sc.next();
	        String []r = str.split("");

	        if (r[0].equals(r[1]) || r[1].equals(r[2]) || r[2].equals(r[3])) {
	        	System.out.println("Bad");
	        } else {
	        	System.out.println("Good");
	        }

	}


}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<ll>>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
void a(){

}

void b(){
    string s;cin >> s;
    string sf = s.substr(0,s.size()/2);
    string bsf = sf;
    reverse(bsf.begin(),bsf.end());
    string sb = s.substr((s.size()+1)/2);
    string bsb = sb;
    reverse(bsb.begin(),bsb.end());
    if(sf==bsf&&bsf==sb&&sb==bsb){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
}


void c(){
    double l;
    cin >> l;
    cout << fixed << setprecision(10)<<l/3*l/3*l/3;
}

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


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N;

    scanf("%d", &N);

    int a[N];

    int min = 1000, max = 0;

    for(int i = 0; i < N; i++){
        scanf("%d", &a[i]);
        if(a[i] < min){
            min = a[i];
        }
        if(a[i] > max){
            max = a[i];
        }
    }

    printf("%d\n", max-min);

    return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong sum = 0, sum2 = 0, cnt[26];
string s;

int main(){
    cin >> s;
    for (int i = 0; i < s.size(); i ++){
        cnt[s[i] - 'a'] ++;
    }for (int i = 0; i < 26; i ++){
        if(cnt[i] > 1){
            cout << -1;
            return 0;
        }
    }string alph = "zyxwvutsrqponmlkjihgfedcba";
    if(s == alph){
        cout << -1;
        return 0;
    }if(s.size() < 26){
        string z;
        for (int i = 0; i < 26; i ++){
            if(cnt[i] == 0){
                z = i + 'a';
                cout << s << z;
                return 0;
            }
        }
    }else{
        char z = 'z';
        for (int i = s.size() - 2; i >= 0; i --){
            if(s[i] < s[i + 1]){
                for (int j = 0; j < i; j ++){
                    cout << s[j];
                }z = 'z';
                for (int j = i + 1; j < s.size(); j ++){
                    if(s[j] > s[i]){
                        z = min(z, s[j]);
                    }
                }cout << z;
                return 0;
            }
        }
    }return 0;
}


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

int main()
{
    int N, T, A;
    std::cin >> N;
    std::cin >> T >> A;
    std::array<int, 2000> height;
    std::cin >> height.at(0);
    int ans = 0;
    double min = std::abs(T - 0.006 * height.at(0) - A);
    double tmp;
    for (int i = 1; i < N; i++) {
        std::cin >> height.at(i);
        tmp = std::abs(T - 0.006 * height.at(i) - A);
        if (tmp < min) {
            ans = i;
            min = tmp;
        }
    }
    std::cout << ans + 1 << std::endl;
}

Measured memory_bytes: 3560
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
a.sort()
a.append(10 ** 9 + 7)
a.append(10 ** 9 + 7)

memo = [0] * (N + 1)
memo[0] = 1

idx = 0
for pos in range(1, N + 1):
    if a[idx] == pos:
        memo[pos] = 0
        for i in range(idx, N):
            if a[i] > pos: break
        idx = i
        continue
    else:
        if pos > a[idx]:
            for i in range(idx, N):
                if a[i] > pos: break
            idx = i
        #
        if pos == 1:
            memo[1] = (memo[0]) % (10 ** 9 + 7)
        else:
            memo[pos] = (memo[pos - 2] + memo[pos - 1]) % (10 ** 9 + 7)

# print("#", memo)
print(memo[-1])

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

#define ull unsigned long long int
#define ll long long int
#define vll vector<ll>
#define vi vector<int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define itr vll::iterator
#define all(c) c.begin(),c.end()
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define inf 1000000000000000001

#define rep(i, n)      for(ll i = 0; i <  n; ++i)
#define repA(i, a, n)  for(ll i = a; i <= n; ++i)
#define repD(i, a, n)  for(ll i = a; i >= n; --i)

using namespace std;

bool func(const pll &a, const pll &b){
    return a.s < b.s;
}

ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}

void solve(){
    string s;
    cin >> s;
    if(s == "ABC") cout << "ARC";
    else cout << "ABC";
}

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

    int t, tmp = 0;
    // cin >> t;
    t = 1;
    while(t--){
        // cout << "Case #" << ++tmp << ": ";
        solve();
        if(t) cout << "\n";
    }
    cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3776
use std::collections::*;
use std::io::*;
use std::*;
macro_rules! get {
    ($($t:tt),*; $n:expr) => {
        {
            let stdin = std::io::stdin();
            let ret = std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
                let line = line.unwrap();
                let mut it = line.split_whitespace();
                _get!(it; $($t),*)
            }).collect::<Vec<_>>();
            ret
        }
    };
    ($($t:tt),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut it = line.split_whitespace();
            _get!(it; $($t),*)
        }
    };
}
macro_rules! _get {
    // iterator(splitted input-string) => iterator(output-type)
    ($it:ident; [char]) => {
        _get!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; usize1) => {
        $it.next().unwrap().parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap().parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_get!($it; $t)),*)
    };
}

fn main() {
    let n = get!(usize);
    let mut a = vec![0; n];
    let mut state = vec![vec![(0, 0); 0]; n];
    for i in 0..n {
        a[i] = get!(i32);
        state[i] = get!(usize1, i32;a[i] as usize);
    }
    let mut ans = 0;
    for i in 0..(1 << n) {
        let mut isok = true;
        for j in 0..n {
            if i & 1 << j != 0 {
                for (x, y) in state[j].iter() {
                    if (i & 1 << x != 0) != (*y == 1) {
                        isok = false;
                    }
                }
            }
        }
        if isok {
            ans = ans.max((i as i32).count_ones());
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2104
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

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

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/

const ll MOD=1000000007;

ll min(ll a, ll b){
	if(a>=b){
		return b;
	}
	else{
		return a;
	}
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

ll Factorial(ll n)
{
	ll a=1;
	for (ll i = 1; i <= n; i++)
	{
		a *= i;
		a %= MOD;
	}
	return a;
}
void solve()
{
	ll n;
	cin >> n;
	ll ans = 0;
	bool check = false;
	ll m = (ll)sqrt(n);
	
	for (ll i = 1; i <= m; i++)
	{
		ll r;
		if (n % i == 0)
		{
			r = n / i;
		}
		else{
			r = n / i + 1;
		}
		for (ll j = i; j < r;j++){
			ans++;
			if(i!=j){
				ans++;
			}
		}
	
	}
	cout << ans << endl;
	
}

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

Measured memory_bytes: 3672
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		
		String n = scan.next();
		String[] s = n.split("");
		
		int total = 0;
		
		for(int i = 0; i < s.length; i++) {
			total += Integer.parseInt(s[i]);
		}
		
		if(total % 9 == 0) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}
	}

}


Measured memory_bytes: 65268
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
 
int main() {
 int n,m;
 while(cin >> n >> m, n) {
  vector<int> code(m), value(n);
  for (int i = 0; i < m; i++)
   cin >> code[i];
  for (int i = 0; i < n; i++)
   cin >> value[i];
  vector<vector<int> > dp(n+1, vector<int>(256, 1000000000));
  dp[0][128] = 0;
  for (int i = 0; i < n; i++) {
   for (int j = 0; j < 256; j++) {
    for (int k = 0; k < m; k++) {
     int val = min(255,max(0,j+code[k]));
     dp[i+1][val] = min(dp[i+1][val], dp[i][j] + (val -value[i]) * (val - value[i]));
    }
   }
  }
  int ans = 1000000000;
  for (int i = 0; i < 256; i++) {
   ans = min(ans, dp[n][i]);
  }
  cout << ans << endl;
 }
 return 0;
}

Measured memory_bytes: 22000
#include <iostream>
#include <string>

using namespace std;

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

    if ((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3])) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
from functools import cmp_to_key

x, n = map(int, input().split())
p = set(map(int, input().split()))
for d in range(100):
    if (x - d) >= -101 and (x - d) not in p:
        print(x - d)
        break
    elif (x + d) <= 101 and (x + d) not in p:
        print(x + d)
        break


Measured memory_bytes: 67408
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000000+7
typedef long long int lint;

int main (){
  int R;
  cin >> R;
  if(R < 1200){co("ABC");}
  else if(R < 2800){co("ARC");}
  else{co("AGC");}
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

const int N=300010,P=1e9+7,z=1000;

char a[N];
int ans,n,tot,pw[N],p[N];
int f[N][3][2];

inline void add(int &x,int y){
	x=x+y>=P?x+y-P:x+y;
}

int main(){
	scanf("%s",a+1); n=strlen(a+1);
	if(n==1) return puts(a[1]!='0'?"1":"0"),0;
	pw[0]=1; for(int i=1;i<=n;i++) pw[i]=2*pw[i-1]%P;
	for(int i=n;i;i--) p[i]=p[i+1]+(a[i]=='?');
	f[0][0][0]=1; int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=0;j<3;j++)
			for(int k=0;k<2;k++){
				if(!f[i-1][j][k]) continue;
				if(a[i]!='1') add(f[i][j+1<3?j+1:1][k],f[i-1][j][k]);
				if(a[i]!='0'){
					if(j) add(f[i][j-1][k],f[i-1][j][k]);
					else if(!k) add(f[i][0][1],f[i-1][j][k]);
					else add(ans,1LL*f[i-1][j][k]*pw[p[i+1]]%P);
				}
			}
	printf("%d\n",(ans+f[n][0][1])%P);
	return 0;
}

Measured memory_bytes: 9856
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(){
    int N,K;
    cin>>N>>K;
    vector<int> h(N);
    for(int i=0;i<N;i++){
        cin>>h.at(i);
    }
    sort(h.begin(),h.end());
    int mn=1000000001;
    for(int i=0;i<=N-K;i++){
        chmin(mn,h.at(i+K-1)-h.at(i));
    }
    cout<<mn<<endl;
}

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

int main() {
  int64_t K, A, B;
  cin >> K >> A >> B;
  int64_t sa = B-A;
  int64_t ans =0;
  if(sa >2 && K>=A+1){
    ans = (K-A+1)/2*sa + (K-A+1)%2 +A;
  }
  else ans = K+1;
  
  cout << ans << endl;
}

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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

double H, A;

void solve() {
    cin >> H >> A;
    cout << ceil(H / A);
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3768
N = int(input())

XY = []

for i in range(N):
    Xi, Yi = map (float, input().split())
    XY.append([Xi,Yi])

Z  = 0
for i in range(N-1):
    for j in range(i + 1, N):
        Z += ((XY[i][0] - XY[j][0])**2 + (XY[i][1] - XY[j][1])**2 ) ** 0.5

print(Z * 2 / N)

Measured memory_bytes: 3188
/*Shivam Bhalla */
  /* f2016941@pilani.bits-pilani.ac.in */



  #include <iostream>
  #include <cstdio>
  #include <cstring>
  #include <cstdlib>
  #include <cctype>
  #include <algorithm>
  #include <map>
  #include <vector>
  #include <list>
  #include <set>
  #include <queue>
  #include <deque>
  #include <stack>
  #include <iostream>
  #include <string>
  #include <cmath>
  #include <cassert>
  #include <bits/stdc++.h>
  #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
  using namespace std;
  long long maxv = 1e9;


  int main()
  {
    fast_cin();
    int N,D;
    cin>>N>>D;
    int arr[N][D];
    for(int i=0;i<N;i++){
      for(int j=0;j<D;j++)
        cin>>arr[i][j];
    }
    int total=0;
    int dist;
    int dist1;
    for(int i=0;i<N-1;i++){
      for(int j=i+1;j<N;j++){
        dist=0;
        for(int k=0;k<D;k++){
          dist+=(arr[i][k]-arr[j][k])*(arr[i][k]-arr[j][k]);
        }
        dist1=sqrt(dist);
        if(dist1*dist1==dist)
          total++;
      }
    }
    cout<<total;
    return 0;
  }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string>
#include <string.h>
#include <math.h>
#include <iomanip>
using namespace std;

#define int64 long long
#define pii pair <int64, int64>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

int a;
string s;

int main(){
    cout << setprecision(2) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> a >> s;
    if (a < 3200) cout << "red"; else cout << s;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
//int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
	char a,b;
	cin>>a>>b;
	if(b=='H')cout<<a<<endl;
	else{
		if(a=='H')cout<<'D'<<endl;
		else cout<<'H'<<endl;
	}
	return 0;
}

Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=e-1; i>=s; i--)

int main(){

    int n; cin >> n;
    ll c[n], s[n], f[n];
    reps(i, 1, n){
        cin >> c[i] >> s[i] >> f[i];
    }

    reps(i, 1, n){
        
        ll t = 0;
        int j = i;    
        t += s[j] + c[j];    
        j++;
        while(j < n){

            if(t < s[j]){
                t = s[j];
            }
            else{
                if(t % f[j] != 0){
                    t += f[j] - (t % f[j]);
                }
            }
            
            t += c[j];
            j++;
        }

        cout << t << endl;
    }

    cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 384
def function(n, s, t)
	s_array = s.split('')
	t_array = t.split('')
	string = ''
	0.upto(n - 1).each { |i|
		string << s_array[i] << t_array[i]
	}
	string
end

n = gets.chomp.to_i
s, t = gets.chomp.split(' ')
puts function(n, s, t)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define RREP(i, a, n) for(int i=n-1; i>=a; --i)

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

    while(k>0){
        if(a>=b){
            b*=2;
        }
        else{
            c*=2;
        }
        k--;
    }

    if(a<b && b<c){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define N 500005
using namespace std;
char s[N], t[N];
int n, flag, pre[N], suf[N], ans = 0;
inline void getfail(int *fail,char *s) {
	fail[0] = -1;
	int j = 0;
	for (int i = 1; i < n; ++i){ 
		while (j && s[i] != s[j]) j = fail[j];
		if (s[i] == s[j]) fail[i + 1] = ++j;
		else fail[i + 1] = 0;
	}
}
inline bool checkpre(int pos) { return pre[pos] == 0 || pos % (pos - pre[pos]); }
inline bool checksuf(int pos) { return suf[pos] == 0 || pos % (pos - suf[pos]); }
int main(){
	scanf("%s",s), n = strlen(s);
	for (int i = 0; i < n; ++i) t[i] = s[n - i - 1];
	getfail(pre, s), getfail(suf, t), t[n] = '\0';
	flag = checkpre(n) ? 1 : 2;
	bool f = true;
	for (int i = 1; i < n; ++i) if (s[i] != s[i - 1]) { f = false; break; }
	if (f) flag = n;
	cout << flag << '\n';
	if (flag != 2) { cout << 1; return 0; }
	for (int i = 0; i < n; ++i) {
		int tmp = n - i - 1;
		if (checkpre(i + 1) && checksuf(tmp)) ++ans;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 5120
import java.io.*;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws Exception {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
                String[] s = line.split(" ");
                int n = Integer.parseInt(s[0]);
                long x = Long.parseLong(s[1]);
                s = br.readLine().split(" ");
                long[] a = new long[n];
                for(int i=0; i<n; i++){
                    a[i] = Integer.parseInt(s[i]);
                }
                long[][] b = new long[n][];
                for(int i=0; i<n; i++){
                    long[] bi = new long[n];
                    for(int k=0; k<n; k++){
                        if(k==0){
                            bi[0] = a[(i-k>=0)?i-k:i-k+n];
                        }else{
                            bi[k] = Math.min(bi[k-1], a[(i-k>=0)?i-k:i-k+n]);
                        }
                    }
                    b[i] = bi;
                }
                long min = Long.MAX_VALUE;
                for(int k=0; k<n; k++){
                    long sum = 0;
                    for(int i=0; i<n; i++){
                        sum+=b[i][k];
                    }
                    if(min>k*x+sum){
                        min=k*x+sum;
                    }
                }
                System.out.println(min);
            }
        }
    }
}

Measured memory_bytes: 88564
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



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

  rep(i, k) {
    if (i % 2 == 0) {
      if (a % 2 == 1) a--;
      a /= 2;
      b += a;
    }
    else {
      if (b % 2 == 1) b--;
      b /= 2;
      a += b;
    }
  }
  cout << a << " " << b << endl;



  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007
//#define mod 998244353

int A,B,Q;
int s[100005];
int t[100005];
int x[100005];
signed main(){
    scanf("%lld %lld %lld",&A,&B,&Q);
    rep(i,A)scanf("%lld",&s[i]);
    rep(i,B)scanf("%lld",&t[i]);
    rep(i,Q){
        scanf("%lld",&x[i]);
        int si2=lower_bound(s,s+A,x[i])-s;//右にある神社のイテレータ
        int si1=si2-1;//左にある神社のイテレータ
        int s1,s2;
        if(si1<0)s1=-LLINF;//左に神社がない
        else s1=s[si1];
        if(si2>=A)s2=LLINF;//右に神社がない
        else s2=s[si2];

        int ti2=lower_bound(t,t+B,x[i])-t;//右にある寺のイテレータ
        int ti1=ti2-1;//左にある寺のイテレータ
        int t1,t2;
        if(ti1<0)t1=-LLINF;//左に寺がない
        else t1=t[ti1];
        if(ti2>=B)t2=LLINF;//右に寺がない
        else t2=t[ti2];

        //printf("[%lld %lld %lld %lld]\n",t1,t2,s1,s2);
        int ans=LLINF;
        ans=min(ans,x[i]-min(t1,s1));//ずっと左に行く
        ans=min(ans,max(t2,s2)-x[i]);//ずっと右に行く
        ans=min(ans,x[i]-t1+s2-t1);//寺は左、神社は右(1)
        ans=min(ans,s2-x[i]+s2-t1);//寺は左、神社は右(2)
        ans=min(ans,x[i]-s1+t2-s1);//寺は右、神社は左(1)
        ans=min(ans,t2-x[i]+t2-s1);//寺は右、神社は左(2)
        printf("%lld\n",ans);
    }
}

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

double eps = 0.00000000001;

int main() {
  double a,b,x;
  cin>>a>>b>>x;
  double th = acos(a / sqrt(a * a + b* b)), lower, upper;
  if(a * b / 2. * a < x){
    lower = eps, upper = th - eps;
    while(upper - lower > eps){
      double mid = (upper + lower) / 2;
      if(((a * b) - a * a * tan(mid) / 2.) * a <= x){
        upper = mid;
      }
      else{
        lower = mid;
      }
    }
  }
  else{
    lower = th + eps, upper = acos(-1) / 2. - eps;
    while(upper - lower > eps){
      double mid = (upper + lower) / 2;
      if(a * b * b / tan(mid) <= x * 2){
        upper = mid;
      }
      else{
        lower = mid;
      }
    }
  }
  cout<<setprecision(10)<<lower * 180. / acos(-1) <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

int main() {
    string s, t; cin >> s >> t;
    long long l = s.length();
    vector<set<int> > p(26);
    for (int i = 0; i < l; i++) 
        p[s[i]-'a'].insert(i);
    
    for (int i = 0; i < t.length(); i++) {
        if (p[t[i]-'a'].empty()) {
            cout << "-1" << endl;
            return 0;
        }
    }
    
    long long cnt = 0, j = 0;
    while (j < t.length()) {
        int k = -1;
        while (j < t.length() && p[t[j]-'a'].upper_bound(k) != p[t[j]-'a'].end()) {
            k = *p[t[j]-'a'].upper_bound(k);
            j++;
        }
        if (j >= t.length()) {
            cout << cnt * l + k + 1<< endl;
            return 0;
        }
        cnt++;
    }

}

Measured memory_bytes: 8532
// https://atcoder.jp/contests/abc074/tasks/arc083_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d, e, f;
    int maxa = 0, maxb = 0;
    double maxv = -10;
    cin >> a >> b >> c >> d >> e >> f;
    // 水を入れる量
    for (int i = 0; i <= 30; i++) {
        for (int j = 0; (a * i + b * j) * 100 <= f; j++) {
            int water = a * i + b * j;
            for (int k = 0; c * k <= water * e; k++) {
                for (int l = 0; c * k + d * l <= water * e; l++) {
                    int suger = c * k + d * l;
                    double nou = (double)suger / (water * 100 + suger);
                    if (nou > maxv && suger + water * 100 <= f) {
                        maxv = nou;
                        maxa = water * 100;
                        maxb = suger;
                    }
                }
            }
        }
    }
    cout << maxa + maxb << " " << maxb << endl;

    return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const int INF=1e9;

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int c[10][10];
int dps[1000+1]; //体力hのときの最小消費魔力
int main(){
  int n;
  cin>>n;

  rep1(k,n){
    int i2=k%10;
    int i1=k;
    while(i1>=10){
      i1=i1/10;
    }
    c[i1][i2]++;
  }
  int ans=0;
  rep(i,10){
    rep(j,10){
      ans+= c[i][j]*c[j][i];
    }
  }

  cout<<ans<<endl;


}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*

 7/10/2020

 9:38-

 */

const int MAX_N=1e6+1;
int N,M,S,T;

const int Inf=1e7;
VI G[MAX_N];
void solve() {
  VV<int> D(N,VI(3,Inf));
  queue<II> Q;
  Q.emplace(S,0),D[S][0]=0;
  while(SZ(Q)) {
    int u,step; tie(u,step)=Q.front(),Q.pop();
    int ss=(step+1)%3;
    FORR(v,G[u]) {
      int dd=D[u][step]+1;
      if(dd<D[v][ss]) {
        Q.emplace(v,ss);
        D[v][ss]=dd;
      }
    }
  }

  if(D[T][0]!=Inf) assert(D[T][0]%3==0);
  int res=D[T][0]/3;
  if(res==Inf/3) res=-1;
  cout<<res<<endl;
}

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

  cin>>N>>M;
  REP(i,M) {
    int u,v; cin>>u>>v;
    --u,--v;
    G[u].push_back(v);
  }
  cin>>S>>T;
  --S,--T;
  solve();

  return 0;
}


Measured memory_bytes: 35096
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

ll lcm(ll a,ll b){
    return (a*b/gcd(a,b));
}

int main(){
    ios::sync_with_stdio(false);
    int a,b,c,x,y; cin >> a >> b >> c >> x >> y;
    int ans=INT_MAX;
    rep(i,max(x,y)+1){
        ans=min(ans,i*2*c+max(0,x-i)*a+max(0,y-i)*b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    V = il()
    odd = collections.Counter(V[0::2]).most_common()
    even = collections.Counter(V[1::2]).most_common()

    odd.append([0, 0])
    even.append([0, 0])

    if odd[0][0] != even[0][0]:
        print(N - (odd[0][1] + even[0][1]))
    else:
        print(min(N - (odd[0][1] + even[1][1]), N - (odd[1][1] + even[0][1])))


if __name__ == '__main__':
    main()


Measured memory_bytes: 20664
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	var N int = nextInt()
	var A = make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}
	var M int = A[0]
	var sum int
	for i := 1; i < N; i++ {
		if A[i] < M {
			sum += M - A[i]
		} else {
			M = A[i]
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 5820
N,M,C = list(map(int, input().split()))
B = list(input().split())
A = list([input().split() for i in range(N)])
count = 0
for i in range(N):
    D_list =[] 
    for j in range(M):
        D =  int(A[i][j])*int(B[j])
        D_list.append(D)
    Sum = sum(D_list)
    if Sum + C > 0:
        count = count + 1
print(count)

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

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    for(int i=0;i<N;i++) cin >> P[i];
    int tmp = 200001, ans = 0;
    for(int i=0;i<N;i++){
        if(tmp >= P[i]) ans++;
        tmp = min(tmp, P[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1024
#!/usr/bin/python3
# -*- coding: utf-8 -*-

a = input().split()
b = ['5', '7', '5']

f = True
for i in a:
    if i in b:
        b.remove(i)
    else:
        f = False
        break

if f:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
int f[45][45][45],a[45][45];
int dfs(int l,int r,int x){
	if(f[l][r][x]!=-1) return f[l][r][x];
	if(l==x && r==x) return 1;
	f[l][r][x]=0;
	for(int j=l;j<x;++j)
		for(int k=r;k>x;--k)
			if(a[j][k]){
				for(int p=j;p<x;++p)
					for(int q=k;q>x;--q)
						f[l][r][x]+=dfs(l,p,j)*dfs(q,r,k)*dfs(p+1,q-1,x);				
			}
	return f[l][r][x];
}
signed main(){
	int n;cin>>n;n<<=1;
	char ch;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			cin>>ch;a[i][j]=ch-'0';
		}	
	int ans=0;
	memset(f,-1,sizeof(f));
	for(int x=2;x<=n;++x)
		if(a[1][x]) ans+=dfs(2,n,x);
	cout<<ans;
	return 0;	
}

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

typedef pair <int, int> P;

const int N = 2e5 + 10;

char s[N];
int cnt[26], a[N], C[N];
vector <int> rec[26];
vector <P> sav;
int n;

int lowbit(int x){
	return x & -x;
}

void add(int x, int d){
	while (x <= n){
		C[x] += d; x += lowbit(x);
	}
}

int sum(int x){
	int ret = 0;
	while (x > 0){
		ret += C[x]; x -= lowbit(x);
	}
	return ret;
}

bool cmp(const P& x, const P& y){
	return x.first > y.first;
}

int main(){
	int flag, sz;
	long long ans;
	scanf("%s", s + 1);
	n = strlen(s + 1);
	memset(cnt, 0, sizeof(cnt));
	for (int i = 1; i <= n; i++){
		cnt[s[i] - 'a']++;
		rec[s[i] - 'a'].push_back(i);
	}
	flag = 0;
	for (int i = 0; i < 26; i++){
		if (cnt[i] % 2){
			if (flag){
				printf("-1\n");
				return 0;
			}
			flag = 1;
		}
	}
	for (int i = 0; i < 26; i++){
		sz = (int)rec[i].size();
		for (int j = 0; j < sz / 2; j++)
			sav.emplace_back(rec[i][j], rec[i][sz - j - 1]);
		if (sz & 1)
			a[rec[i][sz / 2]] = (n + 1) / 2;
	}
	sort(sav.begin(), sav.end());
	for (int i = 0; i < n / 2; i++){
		a[sav[i].first] = i + 1;
		a[sav[i].second] = n - i;
	}
	sav.clear();
	for (int i = 1; i <= n; i++) sav.emplace_back(a[i], i);
	sort(sav.begin(), sav.end(), cmp);
	memset(C, 0, sizeof(C));
	ans = 0;
	for (int i = 0; i < n; i++){
		ans += sum(sav[i].second);
		add(sav[i].second, 1);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 5360
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<string>
#include<math.h>
#define ll long long int 
#define loop(a,b,i) for(int i=a;i<b;i++)
#define loopr(a,b,i) for(int i=n-1;i>=0;i--)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

//bool checkprime(int n) 
//{ 
//    if (n <= 1) 
//        return false; 
//    for (int i = 2; i < n; i++) 
//        if (n % i == 0) 
//            return false; 
//  
//    return true; 
//} 

int main() 
{ 
	int n;
	cin>>n;
	int a[n],b[n];
	int i,cnt=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(i=0;i<n-2;i++)
	{
		if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2])
		{
			cnt++;
		}
	}
	if(cnt>0)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No"<<endl;
	}
	
return 0; 
} 

Measured memory_bytes: 3632
moji = input()
n=len(moji)
mae=moji[0:(n-1)//2]
ato=moji[(n+3)//2-1:n]
moji0 = moji[::-1]
mae0 = mae[::-1]
ato0 = ato[::-1]
if ((moji == moji0) and (mae == mae0) and (ato == ato0)):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#include <math.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 510000;

/*-----Library-----*/

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }
    
    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }
    
    int size(int x){
        return sizeuf[root(x)];
    }
};

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

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*-----Library-----*/

signed main(){
    int n;
    cin>>n;
    cout<<(n-1)/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const p=998244353;
int f[3005][3005],g[3005][3005];
int pw(int x,int y)
{
    int res=1;
    while(y)
    {
        if(y&1)res=1ll*res*x%p;
        x=1ll*x*x%p;
        y>>=1;
    }
    return res;
}
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    f[a][b]=1;
    for(int i=a+1;i<=c;i++)
    {
        for(int j=b;j<=d;j++)
        {
            g[i][j]=1ll*(g[i][j-1]+f[i-1][j-1])*(i-1)%p;
            f[i][j]=(1ll*f[i-1][j]*j+g[i][j])%p;
        }
    }
    int ans=0;
    for(int i=b;i<=d;i++)ans=(ans+1ll*f[c][i]*pw(c,d-i))%p;
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 74132
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct Chien{
  static const int MAX=1<<18;
  int n,dat[2*MAX-1],laz[2*MAX-1];
  Chien(){}
  Chien(int n_){init(n_);}
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    for(int i=0;i<2*n-1;i++) dat[i]=laz[i]=0;
  }
  inline void eval(int len,int k){
    if(k*2+1<n*2-1){
      laz[k*2+1]+=laz[k];
      laz[k*2+2]+=laz[k];
    }
    dat[k]+=laz[k]*len;
    laz[k]=0;
  }
  int update(int a,int b,int x,int k,int l,int r){
    eval(r-l,k);
    if(r<=a||b<=l) return dat[k]+laz[k]*(r-l);
    if(a<=l&&r<=b) return dat[k]+(laz[k]+=x)*(r-l);
    eval(r-l,k);
    return dat[k]=update(a,b,x,k*2+1,l,(l+r)/2)+update(a,b,x,k*2+2,(l+r)/2,r);
  }
  int query(int a,int b,int k,int l,int r){
    eval(r-l,k);
    if(r<=a||b<=l) return 0;
    if(a<=l&&r<=b) return dat[k];
    int vl=query(a,b,k*2+1,l,(l+r)/2);
    int vr=query(a,b,k*2+2,(l+r)/2,r);
    return vl+vr;
  }
  int update(int a,int b,int x){
    return update(a,b,x,0,0,n);
  }
  int query(int a,int b){
    return query(a,b,0,0,n);
  }
};
signed main(){
  int n,q;
  cin>>n>>q;
  Chien ch(n);
  for(int i=0;i<q;i++){
    int c,s,t,x;
    cin>>c;
    if(c){
      cin>>s>>t;
      cout<<ch.query(s-1,t)<<endl;
    }else{
      cin>>s>>t>>x;
      ch.update(s-1,t,x);
    }
  }
}

Measured memory_bytes: 7212
n, w = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]

INF = 10**9 + 100
MAX_V = 10**5 + 100
dp = [INF] * (MAX_V + 1)
dp[0] = 0

for wi, vi in wv:
    for sum_v in range(MAX_V, vi-1, -1):
        dp[sum_v] = min(dp[sum_v - vi] + wi, dp[sum_v])
#print(dp)
ans = 0
for i in range(MAX_V, -1, -1):
    if dp[i] <= w:
        print(i)
        exit()
#print(ans)


Measured memory_bytes: 41580
#include<stdio.h>
int main(){
  
  int x[10001];
  int i = 1;
  
  while(1){
    
    scanf("%d",&x[i]);
    
    if(x[i] == 0){
      break;
    }
    
    printf("Case %d: %d\n",i,x[i]);             
    i++;
    
  }
  return(0);
}



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

using namespace std;

const int N=100005;
vector<int> adj[N];
int ile=0;
vector<int> worek;
vector<int> indeg(N,0);
vector<int> topol;
int main()
{
    int n,m; cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b; cin>>a>>b;
        adj[a].push_back(b);
        indeg[b]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(indeg[i]==0) worek.push_back(i);
    }
    topol.push_back(-555);
    while(ile<worek.size())
    {
        int t=worek[ile]; ile++;
        topol.push_back(t);
        for(int i=0;i<adj[t].size();i++)
        {
            int s=adj[t][i];
            indeg[s]--;
            if(indeg[s]==0) worek.push_back(s);
        }
    }
    vector<int> res(n+1,0);
    for(int i=n;i>=1;i--)
    {
        for(int j=0;j<adj[topol[i]].size();j++)
        {
            int t=adj[topol[i]][j];
            res[topol[i]]=max(res[topol[i]],1+res[t]);
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++) ans=max(ans,res[i]);
    cout<<ans;



    return 0;
}


Measured memory_bytes: 7460
n = int(input())
data = list(map(int, input().split()))
data.sort(reverse=True)
ans = data[0]
idx = 1
n -= 2
while n > 0:
    if n == 1:
        ans += data[idx]
    else:
        ans += data[idx]*2
    n-=2
    idx += 1
print(ans)


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

int main()
{
    long int a,b,add,sub,mul;
    cin>>a>>b;
    add = a+b;
    sub = a-b;
    mul = a*b;
    long int r = max(add,sub);
    long int maxm = max(mul,r);

    cout<<maxm<<"\n";

    return 0;
}



Measured memory_bytes: 256
m, a, b = map(int, input().split())

x = []
for j in range(1, m + 1):
    n = list(str(j))
    l = [int(n[i]) for i in range(len(n))]
    if len(l) == 1:
        l.append(0)
    s = sum(l)
    if a <= s and s <= b:
        x.append(j)
print(sum(x))

Measured memory_bytes: 3292