akhauriyash/Code-Regression huggingface dataset:
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

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

fn main() {
    input!{
        n: i64,
        delta: i64,
        t: [i64; n],
    }

    let mut ans: i64 = delta;
    for i in 0..n {
        let mut diff: i64 = t[i as usize];
        if i > 0 { diff -= t[(i - 1) as usize]; }
        ans += std::cmp::min(delta, diff);
    }
    println!("{}", ans);
        
}






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

int main() {
    vector<int> A = {};
    rep(i, 4) {
        char c;
        cin >> c;
        A.push_back(c - '0');
    }

    for (int i = 0; i < 1<<3; i++) {

        int tmp = A[0];
        string res = to_string(A[0]);
        for (int j = 0; j < 3; j++) {
            // +のパターン
            if (i & 1<<j) {
                tmp += A[j + 1];
                res += "+" + to_string(A[j + 1]);
            }
            // -のパターン
            else {
                tmp -= A[j + 1];
                res += "-" + to_string(A[j + 1]);
            }
        }

//cout << "tmp: " << tmp << ", " << res << endl;
        if (tmp == 7) {
            cout << res << "=7" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3664
#include <stdio.h>
#include <math.h>
int main(void){
    float a,b,c,d,s,t;
    while(~scanf("%f%f%f%f%f%f",&a,&b,&s,&c,&d,&t)){
        printf("%.3f %.3f\n",floor((s*d-b*t)/(a*d-b*c)*1000+0.5)/1000,(a*t-s*c)/(a*d-b*c));
    }
    return 0;
}

Measured memory_bytes: 1076
import sys
import heapq
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def end(flag):
    if flag:
        print('Yes')
    else:
        print('No')
    exit(0)
n = int(input())
# S = [tuple() for _ in range(n)]
plus = []
minus = []
zero = []
total = 0
for i in range(n):
    s = input()[:-1]
    cnt = 0
    M = 0
    m = 0
    for t in s:
        if t == ')':
            cnt += 1
            M = max(M,cnt)
        else:
            cnt -= 1
            # m = min(m,cnt)
    cnt = 0
    for t in s[::-1]:
        if t == ')':
            cnt += 1
            # M = max(M,cnt)
        else:
            cnt -= 1
            m = min(m,cnt)
    if cnt > 0:
        minus.append((-m,cnt))
    elif cnt == 0:
        zero.append((-m,M))
    else:
        plus.append((M,-cnt))
    S = (M,-cnt)
    total += cnt
if total != 0:
    end(0)
plus.sort()
minus.sort()
cnt = 0
for need,increase in plus:
    if cnt < need:
        end(0)
    else:
        cnt += increase
cnt = 0
for need,increase in minus:
    if cnt < need:
        end(0)
    else:
        cnt += increase
for m,M in zero:
    if m > cnt or M > cnt:
        end(0)
end(1)


Measured memory_bytes: 80404
// A - Frog 1
#include <bits/stdc++.h>
using namespace std;
#define chmin(x,y) x=min(x,y)

int main(){
	int INF = 1e+9;
	int N; cin>>N;
	vector<int> H(N), dp(N, INF);
	for(int i=0; i<N; ++i) cin>>H[i];

	// for(auto x:H)printf("%3d ",x);///
	// puts("");//
	// puts("---");//

	dp[0] = 0;

	for(int i=1; i<=N-1; ++i){

		dp[i] = dp[i-1] + abs(H[i] - H[i-1]);

		if(0 <= i-2)
			dp[i] = min(
				dp[i],
				// dp[i-1] + abs(H[i] - H[i-1]),
				dp[i-2] + abs(H[i] - H[i-2])
				);

		// for(auto x:dp){
		// 	if(x==INF) printf("%3s ","-");///
		// 	else printf("%3d ",x);///
		// }
		// puts("");//

	}

	cout<< dp[N-1] <<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,x; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}

int main() {
	cin >> n >> m;
	vector<bool> ff(n + 1, true);
	rep(i, m) {
		int aa;
		cin >> aa;
		ff[aa] = false;
	}
	vector<ll> dp(n+1);
	dp[0] = 1;
	for (ll now = 0; now < n; now++) {
		for (int next = now + 1; next <= min(n, now + 2); next++) {
			if (ff[next]) {
				dp[next] += dp[now];
				dp[next] %= 1000000000 + 7;
			}
		}
	}

	cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  string S;
  int Q;
  cin >> S >> Q;
  int t, f;
  string c;
  bool rev = true;
  deque<string> de;
  de.push_front(S);
  // char S[5*int(1e5)];
  // int rev_count = 0;
  rep_i(i, Q){
    cin >> t;
    if(t == 1){
      // rev_count++;
      rev = !rev;
    }else{
      cin >> f >> c;
      if(rev){
        if(f == 1){
          // S = c + S;
          de.push_front(c);
        }else{
          // S = S + c;
          de.push_back(c);
        }
      }else{
        if(f == 1){
          // S = S + c;
          de.push_back(c);
        }else{
          de.push_front(c);
          // S = c + S;
        }
      }
    }
  }
  string ans;
  for (auto i = de.begin(); i != de.end(); i++){
    ans += *i;
  }
  
  if(!rev){
    reverse(ans.begin(), ans.end());
  }
  cout << ans << endl;
}

Measured memory_bytes: 12080
#include <iostream>
#include <deque>

using namespace std;

const int MAX = 1e5;

int gcd(int a, int b) {
  if (a < b) swap(a, b);
  while(b != 0) {
    int tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}

int div2(int n) {
  if (n == 0) return 0;
  if (n < 0) n *= -1;
  int ans = 0;
  while((n & 1) == 0) {
    ans++;
    n >>= 1;
  }
  return ans;
}

int main() {
  int N, M; cin >> N >> M;
  deque<int> a;
  for (int i = 0; i < N; i++) {
    int x; cin >> x;
    a.push_back(x / 2);
  }

  auto i = a.begin();
  int num_divisible_by_2 = div2(*i++);
  while (i < a.end()) {
    if (num_divisible_by_2 != div2(*i++)) {
      cout << 0 << endl;
      return 0;
    }
  }

  while(a.size() > 1) {
    long long x = a.front(); a.pop_front();
    long long y = a.front(); a.pop_front();
    long long lcm = (x * y) / gcd(x, y);
    if (lcm > M) {
      cout << 0 << endl;
      return 0;
    }
    a.push_back((int)lcm);
  }

  int res = a.front();
  int ans = (M / res + 1) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 3996
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner (System.in);
        int H=in.nextInt();
        int W=in.nextInt();
        int h=in.nextInt();
        int w =in.nextInt();
        int n=H-h;
        int c=W-w;
        int re=n*c;
        System.out.println(re);
        
        
    }
}

Measured memory_bytes: 21076
if __name__ == '__main__':
    N= int(input())
    A_list = list(map(int, input().split()))

    B_list = []

    for i in range(len(A_list)):
        B_list.append(A_list[i]-(i+1))

    B_list = sorted(B_list)

    if len(B_list)%2 == 1:
        b = B_list[(len(B_list)-1)//2]
    else:
        b = B_list[len(B_list)//2-1]

    answer = 0
    for Bi in B_list:
        answer += abs(Bi-b)
    print(answer)


Measured memory_bytes: 26016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}
std::vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend
#define all(x) (x).begin(),(x).end()
#define size_t ll
const int mod = 1000000007;
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

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

*/
ll h,ans;
int main(){
  cin >> h;
  ll n=log2(h);
  for (ll i = 0; i <= n; i++) {
    ans += pow(2,i);
  }
  cout << ans <<endl;
}


Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))


is_up = False
buy_sell = []
for i in range(N-1):
    if A[i] > A[i+1]:
        if is_up:
            buy_sell.append(A[i])
        is_up = False
    elif A[i] < A[i+1]:
        if not is_up:
            buy_sell.append(A[i])
        is_up = True
    else:
        pass
else:
    if is_up:
        buy_sell.append(A[-1])


ln = len(buy_sell)
money = 1000
stock = 0
for i in range(ln):
    if i % 2 == 0:
        stock = money // buy_sell[i]
        money = money - stock * buy_sell[i]
    else:
        money += stock * buy_sell[i]

print(money)

Measured memory_bytes: 61752
#include<bits/stdc++.h>
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	string a[h];
	vector<bool> ch(h, true);
	vector<bool> cw(w, true);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				ch[i] = false;
				cw[j] = false;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if ((ch[i] || cw[j]) == false)
				cout << a[i][j];
		}
        if (ch[i] == false)
		    cout << endl;
	}
	return 0;
}

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

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int result;
    string substr1,substr2;
    if(N > 1 && N%2 == 0){
        substr1 = S.substr(0,N/2);
        substr2 = S.substr(N/2);
        result = substr1.compare(substr2);
        if(result == 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
def solve():
    N = int(input())
    A = [int(x) for x in input().split()]

    diff = [A[i]-A[i-1] for i in range(1, N)]
    ans = 1

    last = None
    for d in [d for d in diff if d != 0]:
        if d == 0:
            continue
        if last is None:
            last = d
        else:
            if last * d < 0:
                ans += 1
                last = None
            else:
                last = d
    print(ans)


solve()

Measured memory_bytes: 14224
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std ;
typedef long long int ll ;

int main() {
  ios;
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      int x = (j < a) ^ (i < b);
    //  cout<<(j < a)<<" "<<(i <= b)<<" ";
      cout << x;
    }
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// A - Frog 1
int N;
int ans = 0;
int dp[100010];
int h[100010];

int main(){
    cin >> N;
    rep(i, 1, N+1){
        cin >> h[i];
    }
    dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);
    rep(i, 1, N+1){
        dp[i + 2] = min(dp[i] + abs(h[i] - h[i + 2]), dp[i + 1] + abs(h[i+2] - h[i + 1]));
    }

    cout << dp[N] << endl;
    return 0;
}




Measured memory_bytes: 1024
using System;
using System.Collections.Generic;

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{
    public void AtCoder()
    {
        string[] input;
        input = Console.ReadLine().Split(' ');

        int n, k;
        n = int.Parse(input[0]);
        k = int.Parse(input[1]) - 1;

        string s = Console.ReadLine();

        string x = "";
        for(int i=0; i<n; i++)
        {
            if(i == k)
            {
                if (s[i] == 'A') x = "a";
                if (s[i] == 'B') x = "b";
                if (s[i] == 'C') x = "c";
                Console.Write(x);
            }
            else Console.Write(s[i]);
        }

        Console.WriteLine();
    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
// #define mod 998244353
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
// 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);}
const int N=1000001;
// vector<pair<ll, ll> > adj[N];
// bool vis[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;

void solve()
{
    ll n;
    cin>>n;

    ll a = 1, b = 1;

    // ll p = 1, q = 1;

    rep(i, n)
    {
        ll x, y;
        cin>>x>>y;

        ll t;

        if(a%x == 0)
        {
            t = a/x;
        }
        else
        {
            t = a/x + 1;
        }

        if(b%y == 0)
        {
            t = max(t, b/y);
        }
        else
        {
            t = max(t, b/y + 1);
        }

        a = t*x, b = t*y;

    }

    cout<<(a+b)<<endl;

}
 
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // if(t<T)cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

#define int long long

#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

ll mod_pow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % MOD;
		x = x * x % MOD;
		n >>= 1;
	}
	return res;
}

int mod_inv(int x)
{
	return mod_pow(x, MOD - 2);
}


int n;
int a[100010];
int b[100010];
int ans=0;

signed main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin>>n;
    int x=1;
    rep(i,0,n){
        cin>>a[i];
        x*=i+1;
        x%=MOD;
    }
    rep(i,1,n+1){
        b[i]=(mod_inv(i)+b[i-1])%MOD;
    }
    //rep(i,0,n+1)cout<<b[i]<<endl;
    //rep(i,0,n)cout<<x<<" "<<a[i]<<endl;
    rep(i,0,n){
        int cnt=(a[i]*x)%MOD;
        //cout<<cnt<<endl;
        cnt=cnt*(b[i+1]+b[n-i]-b[1])%MOD;
        //cout<<cnt<<endl;
        ans+=cnt;
        ans%=MOD;
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		String[] a = n.split("", 0);
		int ans = 0;
		int tmp = 0;
		for(int i = 0; i < n.length(); i++) {
			if(a[i].equals("A") || a[i].equals("T")) {
				tmp ++;
				ans = Math.max(tmp, ans);
			}else if(a[i].equals("C") || a[i].equals("G")) {
				tmp ++;
				ans = Math.max(tmp, ans);
			}else {
				tmp = 0;
			}
		}
		System.out.println(ans);
		sc.close();
	}
}



Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


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

    int t=1,te=0;
    // cin>>t;
    while(t--){
        int n;
        cin>>n;
        double res;
        if(n%2 == 0){
            res=0.5;
        }
        else{
            if(n==1){
                res=1;
            }
            else{
                res = (n/2);

                res+=1.0;
                res=res/(double)n;
            }
        }
        printf("%.10f\n", res);


        //printf("Case %d: ",++te);
    }
    return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())

xs = []
ys = []
for i in range(N):
    x,y = map(int,input().split())
    xs.append((x,y,i))
    ys.append((y,x,i))
xs.sort()
ys.sort()

x_order = {}
for xo,p in enumerate(xs):
    x,y,i = p
    x_order[i] = xo

cums = [[0 for j in range(N+1)] for i in range(N+1)]
for i in range(N):
    y,x,pi = ys[i]
    xo = x_order[pi]
    for j in range(N+1):
        cums[i+1][j] = cums[i][j] + (1 if j > xo else 0)

ans = float('inf')
for x1 in range(N-1):
    for x2 in range(x1+1,N):
        for y1 in range(N-1):
            for y2 in range(y1+1,N):
                if cums[y2+1][x2+1] - cums[y2+1][x1] - cums[y1][x2+1] + cums[y1][x1] < K:
                    continue
                area = (xs[x2][0] - xs[x1][0]) * (ys[y2][0] - ys[y1][0])
                ans = min(ans, area)
print(ans)

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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for (int i = 0; i < H; i++) {
        cin >> S.at(i);
    }

    const vector<int> dx = { 1, 0, -1, 0, 1, -1, -1, 1 };
    const vector<int> dy = { 0, 1, 0, -1, 1, 1, -1, -1 };

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S.at(i).at(j) == '#')
                continue;

            int num = 0;
            for (int d = 0; d < 8; d++) {
                const int ni = i + dy[d];
                const int nj = j + dx[d];

                if (ni < 0 or ni >= H)
                    continue;
                if (nj < 0 or nj >= W)
                    continue;

                if (S.at(ni).at(nj) == '#')
                    num += 1;
            }
            S.at(i).at(j) = char(num + '0');
        }
    }

    for (int i = 0; i < H; i++) {
        cout << S.at(i) << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define fo(i,n)         for(i=0; i<n; i++)
#define fo1(i,n)        for(i=1; i<=n; i++)
#define Fo(i,k,n)       for(i=k; k<=n?i<=n:i>=n; k<=n?i++:i--)
#define all(x)          x.begin(), x.end()
#define rall(x)         x.rbegin(), x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x, 0, sizeof(x))
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define pii             pair<int, int>
#define mk(arr,n,type)  type *arr = new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int, int>
#define umii            unordered_map<int, int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y) / gcd(x, y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x){cout<<x;}
void __print(float x){cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x){cout <<'\''<<x<<'\'';}
void __print(const char *x){cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}void _print() {cout << "]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base, int exp){ int res = 1; base %= mod; while(exp > 0){ if(exp & 1) res = (res * base) % mod; base = (base * base) % mod; exp = exp >> 1; } return res; }
int inv(int x){ return power(x, mod - 2) % mod; }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N = 1e6 + 6, M = N;
int i, j;

void solve(){
    
    int n; cin>>n;
    n=n%10;
    if(n==2 or n==4 or n==5 or n==7 or n==9) cout<<"hon\n";
    else if(n==0 or n==1 or n==6 or n==8) cout<<"pon\n";
    else if(n==3) cout<<"bon\n";
    
    
    
}




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

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int n,m,k;
char hyadainnzugeeto[500];
char sekaisen[5][500];

char hg_tenkai[1000000];
char* now_tenkaisaki;

void moziretu_tenkai(const char* moziretu,int length,int repeat) {
	int i,j;
	char* initial_tenkaisaki=now_tenkaisaki;
	int tenkaiLength,repeatNumModify;
	for(i=0;i<length;i++) {
		if(isalpha(moziretu[i])) {
			*(now_tenkaisaki++)=moziretu[i];
		} else if(isdigit(moziretu[i])) {
			int startPos;
			int kakkoNum;
			int repeatNum;
			for(j=i;isdigit(moziretu[j]);j++);
			startPos=j+1;
			kakkoNum=1;
			for(j=startPos;kakkoNum>0;j++) {
				if(moziretu[j]=='(')kakkoNum++;
				else if(moziretu[j]==')')kakkoNum--;
			}
			sscanf(&moziretu[i],"%d",&repeatNum);
			moziretu_tenkai(&moziretu[startPos],j-1-startPos,repeatNum);
			i=j-1;
		}
	}

	tenkaiLength=(int)(now_tenkaisaki-initial_tenkaisaki);
	repeatNumModify=(m+tenkaiLength-1)/tenkaiLength;
	if(repeatNumModify<=1)repeatNumModify=2;
	if(repeatNumModify>repeat)repeatNumModify=repeat;
	if(repeatNumModify>1 && tenkaiLength>(m-1)*2+1) {
		char* tenkaisaki_last=now_tenkaisaki;
		strncpy(now_tenkaisaki,initial_tenkaisaki,m-1);
		now_tenkaisaki+=m-1;
		*(now_tenkaisaki++)='*';
		strncpy(now_tenkaisaki,tenkaisaki_last-(m-1),m-1);
		now_tenkaisaki+=m-1;
	} else {
		for(i=1;i<repeatNumModify;i++) {
			strncpy(now_tenkaisaki,initial_tenkaisaki,tenkaiLength);
			now_tenkaisaki+=tenkaiLength;
		}
	}
}

int main(void) {
	int i,j;
	int sekaisencount;
	int max,maxsekaisen;

	scanf("%d%d%d",&n,&m,&k);
	scanf("%s",hyadainnzugeeto);
	for(i=0;i<k;i++)scanf("%s",sekaisen[i]);

	now_tenkaisaki=&hg_tenkai[0];
	moziretu_tenkai(hyadainnzugeeto,n,1);
	*now_tenkaisaki=0;

	max=maxsekaisen=0;
	for(sekaisencount=0;sekaisencount<k;sekaisencount++) {
		char buffer[500]={0};
		int count=0;
		char* nowpointer;
		int complete=0;
		buffer[0]=sekaisen[sekaisencount][0];
		for(i=0,j=1;i<m && !complete;i++) {
			nowpointer=hg_tenkai;
			while(1) {
				nowpointer=strstr(nowpointer,&buffer[i]);
				if(nowpointer==NULL)break;
				while(j<m && nowpointer[j-i]==sekaisen[sekaisencount][j]) {
					buffer[j]=sekaisen[sekaisencount][j];
					j++;
				}
				if(j<m) {
					buffer[j]=sekaisen[sekaisencount][j];
					j++;
				} else {
					complete=1;
					break;
				}
			}
			count+=j-i-1;
			if(complete)count++;
		}
		count+=(j-i)*(j-i+1)/2;
		if(count>max) {
			max=count;
			maxsekaisen=sekaisencount;
		}
	}
	printf("%d %d\n",maxsekaisen+1,max);
	return 0;
}

Measured memory_bytes: 704
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner yomi = new Scanner(System.in);
        byte a = yomi.nextByte();
        byte b = yomi.nextByte();
        int kai=0;
        for (byte i=0;i<2;i++){
            if (a>b){
                kai=kai+a;
                a--;
            }else {
                kai = kai + b;
                b--;

            }
        }
        System.out.println(kai);

        }

    }

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

string S[1000006];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> S[i];
    }

    bool e = false;
    REP(i, N) {
        if (S[i][S[i].length() - 1] == ')')
            e = true;
    }
    if (!e) {
        cout << "No" << endl;
        return 0;
    }

    vector<pll> v, t, u;
    REP(i, N) {
        ll d = 0;
        pll tmp(0, 0);
        REP(j, S[i].length()) {
            if (S[i][j] == '(')
                d++;
            else
                d--;
            tmp.first = std::min(tmp.first, d);
        }
        tmp.second = d;
        if (tmp.second >= 0)
            v.push_back(tmp);
        else if (S[i][S[i].length() - 1] == '(')
            u.push_back(tmp);
        else
            t.push_back(tmp);
    }
    sort(v.begin(), v.end(),
         [](pll a, pll b) { return a.first == b.first ? a.second > b.second : a.first > b.first; });
    
    {
        ll d = 0;
        REP(i, v.size()) {
            if (d + v[i].first < 0) {
                cout << "No" << endl;
                return 0;
            }
            d += v[i].second;
        }
        REP(i, u.size()) {
            if (d + u[i].first < 0) {
                cout << "No" << endl;
                return 0;
            }
            d += u[i].second;
        }
        REP(i, t.size()) {
            if (d + t[i].first < 0) {
                cout << "No" << endl;
                return 0;
            }
            d += t[i].second;
        }
        if (d != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 50272
#include <iostream>
#include <array>
#include <cmath>

int count (int top, int bottom, int N);

auto get_top = [](int n){
                 if (n<10) return n;
                 while ((n=n/10)>9);
                 return n;
               };

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

  int ans = 0;

  //std::cout << get_top(N) <<std::endl;

  for (int topA=1; topA<=9; topA++)
    {
      for (int bottomA=1; bottomA<=9; bottomA++)
        {
          ans += count(topA, bottomA, N) * count(bottomA, topA, N);
        }
    }

  std::cout << ans <<std::endl;

  return 0;
}

int count (int top, int bottom, int N)
{
  int ans = 0;

  for (int i=1; i<=N; i++)
    {
      auto b1 = (i%10 == bottom);

      auto b2 = (get_top(i) == top);

      //std::cout << i%10 << " " << get_top(i) << std::endl;

      if (b1 && b2)
        ans++;
    }

  return ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
#define F first 
#define S second
const int N = 1e5+1;
signed main()
{
    fast;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x = 1.08*i;
        if(x == n)
        {
            cout<<i;
            return 0;
        }
    }
    cout<<":(";
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto a = (b); (a) < (c); ++(a))
#define F0R(a, b) FOR (a, 0, (b))
#define CEIL(a, b) ((a) + (b)-1) / (b)
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << mt(__VA_ARGS__) << "] "
template <typename T>
struct IsC {
  template <typename C>
  static char test(typename C::const_iterator*);
  template <typename C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream&, const C&);
template <typename T1, typename T2>
ostream& operator<<(ostream&, const pair<T1, T2>&);
template <typename... T> using TS = tuple_size<tuple<T...>>;
template<size_t idx, typename... T>
typename enable_if<TS<T...>::value == idx + 1, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return o << ", " << get<idx>(t) << ')';
}
template<size_t idx, typename... T>
typename enable_if<0 < idx && idx + 1 < TS<T...>::value, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << ", " << get<idx>(t), t);
}
template<size_t idx = 0, typename... T>
typename enable_if<1 < TS<T...>::value && !idx, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << '(' << get<idx>(t), t);
}
template<typename T>
ostream& operator<<(ostream& o, const tuple<T>& t) {
  return o << get<0>(t);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p) {
  return o << mt(p.fi, p.se);
}
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '[';
  for (auto it = c.cbegin(); it != c.cend(); ++it)
    o << *it << (next(it) != c.cend() ? ", " : "");
  return o << ']';
}
template <typename T>
void tprint(vector<vector<T>>& v, size_t width = 0, ostream& o = cerr) {
  if (!DEBUG) return;
  for (const auto& vv : v) {
    for (const auto& i : vv) o << setw(width) << i;
    o << endl;
  }
}

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

  int n; string s; cin >> n >> s;
  int best = min(count(ALL(s), 'R'), count(ALL(s), 'W'));
  int cnt = 0;
  for (int l = 0, r = n - 1; l < r;) {
    if (s[l] == 'R') {
      ++l;
    } else if (s[r] == 'W') {
      --r; 
    } else {
      ++cnt;
      ++l; --r;
    }
  }
  cout << min(cnt, best) << endl;

  
  return 0;
}


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

vector<int>getPrime(int n){
  vector<bool>used(n+1,0);

  for(int i=2;i*i<=n;i++)
    if(!used[i])
      for(int j=2;j<=n/i;j++)used[i*j]=1;

  vector<int> res;
  for(int i=2;i<=n;i++)if(!used[i])res.push_back(i);

  return res;
}

bool isPrime(ll n){
  for(ll i=2;i*i<=n;i++)
    if(n%i==0) return 0;
  return 1;
}

int main(){
  int n;
  cin>>n;
  int ans=0,a;
  vector<int> P=getPrime(1e7);
  set<int> S;
  for(int i=0;i<P.size();i++)S.insert(P[i]);
  while(n--){
    cin>>a;
    if(a<=1e7) ans+=S.count(a);
    else ans+=isPrime(a);
  }
  cout<<ans<<endl;
  

  return 0;
}

Measured memory_bytes: 36492
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

struct node{int y1, x1, y2, x2;};
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<node> v;
    int a[h][w];
    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    		cin >> a[i][j];
    	}
    }
    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    		if(a[i][j] & 1){
    			if(j == w-1) {
    				if(i == h-1) continue;
    				else{
    					a[i+1][j]++;
    					v.push_back({i+1, j+1, i+2, j+1});
    				}
    			}else{
    				a[i][j+1]++;
    				v.push_back({i+1, j+1, i+1, j+2});
    			}
    		}
    	}
    }
    cout << v.size() << endl;
    for(auto& i: v){
    	cout << i.y1 <<" "<< i.x1 << " " << i.y2 <<" "<< i.x2 << endl;
    }
    return 0;
}


Measured memory_bytes: 5232
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from itertools import permutations, combinations,combinations_with_replacement,product
from fractions import Fraction as frac
import bisect
import heapq

import logging
logging.basicConfig(level=logging.DEBUG)

import sys
#input = sys.stdin.readline().rstrip

setrecursionlimit(1000000)

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

def main():
    N=int(input())

    flag=False
    for A in range(1,10):
        if N % A == 0:
            B = N // A
            if 0 < B and B < 10:
                flag=True
    if flag:
        print("Yes")
    else:
        print("No")
main()


Measured memory_bytes: 67876
#include <array>
#include <iostream>

using namespace std;
constexpr uint64_t mod = 1e9 + 7;

template <int N> constexpr array<int, N + 1> factorial_table() {
  array<int, N + 1> ans;
  ans[0] = 1;
  for (uint64_t i = 1; i <= N; i++)
    ans[i] = i;
  for (uint64_t i = 2; i <= N; i++) {
    ans[i] = (ans[i] * ans[i - 1]) % mod;
  }
  return ans;
}

constexpr uint64_t mod_pow(uint64_t num, uint64_t p) {
  uint64_t ans = 1;
  num %= mod;
  while (0 < p) {
    if (p & 1) {
      ans = (ans * num) % mod;
    }
    num = (num * num) % mod;
    p >>= 1;
  }
  return ans;
}

template <int N>
constexpr array<int, N + 1> inv_table(const array<int, N + 1> &fct) {
  array<int, N + 1> ans;
  ans[N] = mod_pow(fct[N], mod - 2);
  for (int i = N - 1; 0 <= i; i--)
    ans[i] = ((uint64_t)ans[i + 1] * (i + 1)) % mod;
  return ans;
}

template <typename table>
uint64_t comb(const table &factorial, const table &inv, uint64_t x,
              uint64_t y) {
  if (x == 0 || y == 0)
    return 1;
  return (((uint64_t)factorial[x] * inv[y]) % mod) * inv[x - y] % mod;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  const auto table = factorial_table<200005>();
  const auto inv = inv_table<200005>(table);

  uint64_t h, w, a, b;
  cin >> h >> w >> a >> b;

  uint64_t count = 0;
  auto combination = [&](uint64_t x, uint64_t y) {
    return comb(table, inv, x + y, y);
  };

  for (uint64_t i = 1; i <= w - b; ++i) {
    uint64_t left_upper = combination(h - a - 1, b + i - 1);
    uint64_t right_bottom = combination(w - b - i, a - 1);
    count = (count + left_upper * right_bottom) % mod;
  }

  cout << count << "\n";
}


Measured memory_bytes: 1792
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

const int nmax=8;
bool graph[nmax][nmax];

int dfs(int v,int n,bool visited[nmax]){
  bool all_visited = true;
  
  REP(i,n){
    if(visited[i]==false) all_visited=false;
  }
  
  if(all_visited) return 1;
  
  int ret=0;
  
  REP(i,n){
    if(graph[v][i]==false) continue;
    if(visited[i]) continue;
    
    visited[i]=true;
    ret+=dfs(i,n,visited);
    visited[i]=false;
  }
  return ret;
}

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

  cin >> n >> m;
  REP(i,m){
    int a,b;
    cin >> a >> b;
	graph[a-1][b-1] = graph[b-1][a-1] = true;
  }
  bool visited[nmax];
  REP(i,n) visited[i] = false;
  
  visited[0] = true;
  cout << dfs(0,n,visited) << endl;
}

Measured memory_bytes: 256
l = int(input())
c = 0

for i in range(l):
  m = list(map(int, input().split()))
  if m[0] == m[1]:
    c+=1
  else:
    c=0
  if c == 3:
    print("Yes")
    break
  
if c != 3:
  print("No")




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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int x,n,ld=1e9+10,ans;
	cin>>x>>n;
	set<int> st;
	for(int i=0,a;i<n;++i){
		cin>>a;
		st.insert(a);
	}
	for(int i=(-2*x);i<=2*x;++i){
		if(!st.count(i) && abs(x-i) < ld){
			ld = abs(x-i);
			ans=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3620
n=int(input())
d=[list(map(int,input().split())) for i in range(n)]
cnt=0
ans=0
for i in d:
    if i[0]==i[1]:
        cnt+=1
    else:
        cnt=0
    if cnt==3:
        ans=1
if ans==1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 62484
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <cinttypes>

#define fi first
#define se second


using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

#define int ll

const int INF = 1e18 + 10;

int n;

const int MAX_N = 100010;
vector<int> G[MAX_N];

struct Search {
  int color;
  int v;
  Search(int c, int v): color(c), v(v) { }
};
signed main() {
  cin >> n;

  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  static int color[MAX_N] = { 0 };

  queue<Search> que;

  color[1] = -1;
  color[n] = -1;
  que.push(Search(1, 1));
  que.push(Search(2, n));

  while (!que.empty()) {
    Search s = que.front(); que.pop();
    for (auto u : G[s.v]) {
      if (color[u] == 0) {
        color[u] = s.color;
        que.push(Search(s.color, u));
      }
    }
  }

  int fennec = 0, snuke = 0;
  for (int i = 1; i <= n; i++) {
    if (color[i] == 1) {
      fennec++;
    }
    if (color[i] == 2) {
      snuke++;
    }
  }

  if (fennec > snuke) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }

  return 0;
}

Measured memory_bytes: 7424
#include<stdio.h>
#define MAX 200000
#define EMAX 1000000010

int A[MAX];
int LEFT[MAX / 2 + 2], RIGHT[MAX / 2 + 2];

long long Devide(int A[], int sp, int mid, int ep) {
	int pos_L = 0, pos_R = 0;
	long long addCount = 0;
	for (int i = 0; i < mid - sp; i++) LEFT[i] = A[sp + i];
	LEFT[mid - sp] = EMAX;
	for (int i = 0; i < ep - mid; i++) RIGHT[i] = A[mid + i];
	RIGHT[ep - mid] = EMAX;
	for (int i = 0; i < ep - sp; i++) {
		if (LEFT[pos_L] >= RIGHT[pos_R]) {
			A[sp + i] = RIGHT[pos_R];
			addCount += mid - sp - pos_L;
			pos_R++;
		}
		else if (LEFT[pos_L] < RIGHT[pos_R]) {
			A[sp + i] = LEFT[pos_L];
			pos_L++;
		}
	}
	return addCount;
}

long long countInv(int A[], int sp, int ep) {
	long long count = 0;
	if (ep - sp != 1) {
		count += countInv(A, sp, (sp + ep) / 2);
		count += countInv(A, (sp + ep) / 2, ep);
		count += Devide(A, sp, (sp + ep) / 2, ep);
	}
	return count;
}


int main() {
	int N;
	long long ans;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	ans = countInv(A, 0, N);
	printf("%lld\n", ans);

	return 0;
}



Measured memory_bytes: 3360
#include<bits/stdc++.h>
using namespace std;
int main() {
    vector<int> v;
    int T;
    cin >> T;
    while (T--) {
        int t;
        cin >> t;
        if (t==0) {int x;cin >> x;v.push_back(x);}
        if (t==1) {int x;cin >> x;printf("%d\n", v[x]);}
        if (t==2) {v.pop_back();}
    }
    return 0;
}


Measured memory_bytes: 3936
using System;
using System.Collections.Generic;
class Program
{

    static void Main()
    {
        string S = Console.ReadLine();
        string T = Console.ReadLine();
        int a = 0;
        char s = S[0];
        char t = T[0];

        for(int i=0;i<S.Length;i++)
        {
            if(S[i]==T[i])
            {
            }
            else
            {
                a++;
            }
        }
        

        Console.WriteLine(a);

    }

}

Measured memory_bytes: 27296
n = int(input())
a = list(map(int, input().split()))
a_min = min(a)
alice = 0
bob = 0
while max(a) != 0:
    alice += max(a)
    for i in range(len(a)):
        if a[i] == max(a):
            a[i] = 0
            break
    bob += max(a)
    for i in range(len(a)):
        if a[i] == max(a):
            a[i] = 0
            break
if alice > bob:
    print(alice-bob)
else:
    print(bob-alice)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n;
	cin>>n;
	int i,left;
	for(i=1;i<=n;i++){
		left=(7+left*10)%n;
		if(left==0){
			break;
		}
	}
	if(!left){
		cout<<i;
	}
	else{
		cout<<-1;
	}
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int c[111];

signed main() {

    int n, k;

    cin >> n >> k;

    int d, a;
    int ans = n;
    for(int i = 0; i < k; i++) {
        cin >> d;
        for(int j = 0; j < d; j++) {
            cin >> a;
            if(!c[a]) ans--;
            c[a]++;
        }
    }

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



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


int main() {
    int n,k;
    cin>>n>>k;
    k--;
    string s;
    cin>>s;
    rep(i,n)cout << (i==k? (char)((int)s[i]-'Z'+'z'):s[i]);
}

Measured memory_bytes: 256