akhauriyash/Code-Regression huggingface dataset:
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
cin>>head;
CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>

#define pb(a) push_back(a)
#define mp make_pair

int main(){

  CIN(n,m);
  V a(m);V b(m);VECIN2(a,b);
  vector<V> vec(n,V(n,0));
  REP(i,m){
    vec[a[i]-1][b[i]-1]=1;
    vec[b[i]-1][a[i]-1]=1;
  }
  V vv(n-1);
  iota(ALL(vv),1);
  ll count=0;
  do{
    V v(1,0);
    v.insert(v.end(),ALL(vv));
    REP(i,n-1){
      if(vec[v[i]][v[i+1]]==0)break;
      if(i==n-2)count++;
    }

  }while(next_permutation(ALL(vv)));
  COUT(count);


  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace abc081b{
    class Program{
        static void Main (string[] args){
            var n = Convert.ToInt16(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(s=>int.Parse(s)).ToArray();
            int ans = 0;
            bool flg=true;
            while(true){
                for(int i = 0;i < n;i++){
                    if(a[i]%2!=0)flg=false;
                    a[i]=a[i]/2;
                }
                if(flg)ans++;
                else break;
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
const int maxn=1;
int main()
{
    int a,b,c,k,res,x,i;

    scanf("%d%d%d%d",&a,&b,&c,&k);
    x=res=max(max(a,b),c);
    for(i = 1;i<=k;i++)
    {
        res*=2;
    }
    res=res+a+b+c-x;
    printf("%d\n",res);
}


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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

char C;
signed main() {
    cin >> C;
    cout << (char)(C + 1) << endl;
}

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

using namespace std;

long long getAns(long long a, long long b,long long c,long long d){
    
    if(a<0 && c<0){
        return max(a*c, b*d);
    }else if(a*c < 0){      // one of a , c is -ve
        return max(b*c, max(b*d, a*d));
    }
    
    return b*d;
}

int main()
{
    long long a,b,c,d;
    cin >> a>>b>>c>>d;
    
    cout << getAns(a,b,c,d);

    return 0;
}


Measured memory_bytes: 3620
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

def bs(ok, ng, solve):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if solve(mid):
            ok = mid
        else:
            ng = mid
    return ok

ans = bs(n, 0, lambda x: x * 1.08 >= n)
if int(ans * 1.08) == n:
    print(ans)
else:
    print(':(')


Measured memory_bytes: 61960
K = input()
A = K.split()
for i in range(len(A)):
    A[i] = int(A[i])

L = input()
B = L.split()
for i in range(len(B)):
    B[i] = int(B[i])
sortedb = sorted(B)

count = 0
summin = 0 
for i in range(len(B)):
    if count < A[1]:
        summin += sortedb[i]
        count += 1
print(summin)
    

Measured memory_bytes: 9224
#include<stdio.h>

int main(void){
    int N,K;
    char S[10]={};
    scanf("%d",&N);
    scanf("%s",S);
    scanf("%d",&K);
    char c = S[K-1];
    for(int i=0;i<N;i++){
        if(c==S[i]){
            printf("%c",S[i]);
        }else{
            printf("*");
        }
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int x = sc.nextInt();
		
		if(500*k>=x){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int lcm(int x, int y){
	int g = gcd(x,y);
	return x/g*y;
}

int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum = (sum%MOD*i%MOD)%MOD;
    }
    return sum;
}

int main(){
	ll n; cin>>n;
	ll count = 0;
	ll s = 0;
	while (true){
		if (s >= n){
			break;
		}else{
			count++;
			s += count;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  long long n, a[10000];
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  cout << *min_element( a, a + n) << " "
       << *max_element( a, a + n) << " "
       << accumulate( a, a + n, 0LL) << endl;
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100
#define MAXK 100000

int N, K, a[MAXN + 3];
bool dp[MAXK + 3];

int main() {
    cin >> N >> K;
    for (int i = 1; i <= N; i++)
        cin >> a[i];

    dp[0] = false;
    for (int i = 1; i <= K; i++) {
        bool canWin = false;
        for (int j = 1; j <= N; j++) {
            if (i - a[j] >= 0 && dp[i - a[j]] == false)
                canWin = true;
        }

        dp[i] = canWin;
    }

    
    if (dp[K])
        cout << "First\n";
    else
        cout << "Second\n";
}


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

int main(){
    int n,c=0;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    for(int i=0; i<n; i++){
        if(i%2==0&&a.at(i)%2==1) c++;
    }
    cout << c << endl;
    
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

vector<bool> Eratosthenes(int n) {
    vector<bool> prime(n, true);
    prime[0] = prime[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (!prime[i]) continue;
        for (int j = 2; i * j <= n; j++) {
            prime[i * j] = false;
        }
    }
    return prime;
}

int main() {
    auto primes = Eratosthenes(pow(10, 5) + 1);

    vector<int> primelike(pow(10, 5) + 1, 0);
    REP(i, 1, pow(10, 5) + 1) {
        primelike[i] = primelike[i - 1];
        if (i % 2 == 1 && primes[i] && primes[(i + 1) / 2]) primelike[i]++;
    }

    int q; cin >> q;
    REP(i, 0, q) {
        int l, r; cin >> l >> r;
        cout << primelike[r] - primelike[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
int n;
char s[100005];
bool a[3], t[2];
int main(){
  scanf("%d %s", &n, s);
  for(int i = 0; i < n; i++) a[i%3] ^= s[i] == 'o';
  if(n%3 == 0 && !(a[0] == a[1] && a[1] == a[2])) printf("-1");
  else for(int i = 0; i < n; i++){
    if(i < 2) t[i] = a[i]^a[(n+i)%3]^(i && s[0] == 'o');
    else t[i&1] = t[0]^t[1]^(s[i-1] == 'o');
    printf("%c", t[i&1] ? 'S' : 'W');
  }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> s = a;
  sort(s.rbegin(), s.rend());
  rep(i,n) {
    int ans = s[0];//s[0]は最大値
    if (s[0] == a[i]) ans = s[1];//s[1]は二番目に大きい数
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

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

	int N;
	int max = 0;
	string input;
	map<string, int> dict;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> input;
		if (dict.insert({ input, 1 }).second == false)
			dict[input]++;
		if (dict[input] > max)
			max = dict[input];
	}
	for (pair<string, int> p: dict) {
		if (p.second == max)
			cout << p.first << "\n";
	}
}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int ll
typedef pair<int, int> pii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)

signed main() {
    ios::sync_with_stdio(false);cin.tie(0);
    int n, p;
    cin >> n >> p;
    if (n == 1) {
        cout << p << endl;
        return 0;
    }
    if (p == 1) {
        cout << 1 << endl;
        return 0;
    }
    int i = 2;
    int ans = 1;
    while (i * i <= p) {
        int count = 0;
        while (p % i == 0) {
            count++;
            p /= i;
        }
        if (count >= n) {
            REP(j, count/n) {
                ans *= i;
            }
        }
        i++;
    }
    cout << ans << endl;
}

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

x=a[0]

if 0 not in a:
    for i in range (1,n):
        x=x*a[i]
        if x > pow(10,18):
            print(-1)
            exit()           
    print(x)         
else:
    print(0)


Measured memory_bytes: 21784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define ALL(i) (i.begin(),i.end())
#define MEM(i,n) memset(i,(n),sizeof(i))
#define SZ(i) (int(i.size())) 
#define X first 
#define Y second
#define eb emplace_back
#define pb push_back
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template <typename T> void _do(T &&x){
	cerr<<x<<endl;
}
template <typename T,typename ...S> void _do(T &&x,S &&...tail){
	cerr<<x<<", ";
	_do(tail...);
}
#else
#define debug(...)
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#endif

const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1000000007;
typedef pair<ll,vector<char>> data;
map<data,ll> dp;

bool valid(vector<char> v) {
	REP (j,SZ(v)) {
		if (j >= 2 && v[j] == 'C' && v[j-1] == 'G' && v[j-2] == 'A') {
			return false;
		}
	}
	REP (i,SZ(v)-1) {
		swap(v[i],v[i+1]);
		REP (j,SZ(v)) {
			if (j >= 2 && v[j] == 'C' && v[j-1] == 'G' && v[j-2] == 'A') {
				return false;
			}
		}
		swap(v[i],v[i+1]);
	}
	return true;
}
ll n;
char c[4] = {'A','C','G','T'};
int main () {
	IOS();
	cin >> n;
	
	
	REP (i,4) {
		REP (j,4) {
			REP (k,4) {
				vector<char> v = {c[i],c[j],c[k]};
				if (valid(v)) {
					dp[data(2,v)] = 1;
				} else {
					dp[data(2,v)] = 0;

				}
			}
		}
	}
	
	for (ll d=3;d<n;d++) {
		REP (i,4) {
			REP (j,4) {
				REP (k,4) {
					REP (l,4) {
						vector<char> v = {c[i],c[j],c[k],c[l]};
						vector<char> pre = {c[i],c[j],c[k]};
						vector<char> cur = {c[j],c[k],c[l]};
						if (valid(v)) {
							dp[data(d,cur)] = (dp[data(d,cur)] + dp[data(d-1,pre)]) % MOD;
						}	
					}
				}
			}
		}
	}
	
	
	ll ans = 0;
	REP (i,4) {
		REP (j,4) {
			REP (k,4) {
				vector<char> v = {c[i],c[j],c[k]};
				if (valid(v)) {
					ans = (ans + dp[data(n-1,v)]) % MOD;
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

signed main(){
	vint v(5);
	rep(i,5)cin>>v[i];
	
	cout<<find(all(v),0)-v.begin()+1<<endl;
    return 0;
}


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

int main() {
	
	int n, k, s;
	cin >> n >> k >> s;
	int inf = 1000000000;
	if(s == inf) inf--;
	vector<int> a(n, inf);
	rep(i, n){
		if(i < k) cout << s;
		else cout << inf;
		printf("%c", (i == n-1) ? '\n' : ' ');
	}
	
	return 0;
}

Measured memory_bytes: 1664
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    if len(S) == len(set(S)):
        print('yes')
    else:
        print('no')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61972
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;

int main() {
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cout << (i < n / 2 + 1 ? 0 : m);
		cout << (i + 1 < n ? ' ' : '\n');
	}
}

Measured memory_bytes: 1160
//ABC118C
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include<stdio.h>
using namespace std;

int main(){
	long long int n;
	cin >> n;
	vector<int> a(n,0);
	for(long long int i=0;i<n;i++){
		cin >> a.at(i);
	}
	int left = a.at(0);
	for(long long int i=1;i<n;i++){
		int right = a.at(i);
		left = __gcd(left,right);
	}
	cout << left << endl;
}

Measured memory_bytes: 640
use std::io::stdin;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect()
}

fn main() {
    let _n: u32 = read();
    let a: Vec<i32> = read_vec();
    let (t, a) = (a[0], a[1]);
    let h: Vec<i32> = read_vec();
    let (ans, _) = h
        .iter()
        .enumerate()
        .min_by_key(|&(_, &x)| (t * 1000 - x * 6 - a * 1000).abs())
        .unwrap();

    println!("{}", ans + 1);
}


Measured memory_bytes: 4352
/*
 *  * main.cpp
 *   *
 *    */

#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<set>
#include<cstring>
#include<string>
#include<cassert>
using namespace std;

long long dp[200003][3];
int a[101];
int b[101];
int r[1003];
int c[1003];
int grid[1003][1003];
int main() {

    char s[10005];
    int N;
    scanf("%d %s", &N, s);

    int n = strlen(s);
    for (int i = 0; i < n; ++i) {
        if (s[i] + N > 'Z') {
            s[i] = 'A' + (N - 1 - ('Z' - s[i]));
        } else s[i] = s[i] + N;
    }
    

    printf("%s\n", s);


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
queue<int> q;
int read()
{
	char ch=getchar();int f=0;
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') {f=f*10+(ch^48);ch=getchar();}
	return f;
}
int n,m,head[200005],tot,dis[200005];bool vis[200005];
struct node
{
	int from;
	int to;
	int next;
	int w;
}edge[400005];
void add(int u,int v)
{
	edge[tot].from=u;
	edge[tot].to=v;
	edge[tot].w=1;
	edge[tot].next=head[u];
	head[u]=tot++;
}
void spfa()
{
	q.push(1);
	dis[1]=0;
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		vis[x]=0;
		for(int i=head[x];i!=-1;i=edge[i].next)
		{
			if(dis[edge[i].to]>dis[x]+edge[i].w)
			{
				dis[edge[i].to]=dis[x]+edge[i].w;
				if(!vis[edge[i].to])
				{
					vis[edge[i].to]=1;
					q.push(edge[i].to);
				}
			}
		}
	}
}

int main()
{
	memset(head,-1,sizeof(head));
	memset(dis,0x7f7f7f7f,sizeof(dis));
	n=read(),m=read();
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read();
		add(u,v);
	}
	spfa();
	if(dis[n]<=2)
	printf("POSSIBLE");
	else printf("IMPOSSIBLE");
}


Measured memory_bytes: 6528
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 05/31/20 18:19:57
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);

  int a,b; cin>>a>>b;
  cout << a*b << endl;

  return 0;
}


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

int main() {
    int H, W;
    int h, w;
    cin >> H >> W;
    cin >> h >> w;

    int ans = H * W - (h*W + H*w - h*w);
    cout << ans << endl;
 
    return 0;
}

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

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	bool res = true;
	vector<int> tmp(n,11);
	for(int i=0;i<m;++i){
		int a,b;
		cin >> a >> b;
		if(n > 1 && a == 1 && b == 0){
			res = false;
		}else if(tmp[a-1] == 11){
			tmp[a-1] = b;
		}else if(tmp[a-1] != b){
			res = false;
		}
	}
	if(res){
		for(int i=0;i<n;++i){
			if(tmp[i]==11){
				if(i==0 && n != 1)cout << 1;
				else cout << 0;
			}
			else cout << tmp[i];
		}
	}else{
		cout << -1;
	}
	cout << endl;
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		setIO();

		StringTokenizer st = nl();
		int N = ni(st), D = ni(st);
		int ans = 0;
		for (int i = 0; i < N; i++) {
			st = nl();
			int x = ni(st), y = ni(st);
			if ((long) x * x + (long) y * y <= (long) D * D) {
				ans++;
			}
		}
		out.println(ans);
		
		f.close();
		out.close();
	}

	static final int MOD = 1000000007;

	static BufferedReader f;
	static PrintWriter out;

	static int ni(StringTokenizer st) {
		return Integer.parseInt(st.nextToken());
	}

	static int ni() throws IOException {
		return Integer.parseInt(f.readLine());
	}

	static StringTokenizer nl() throws IOException {
		return new StringTokenizer(f.readLine());
	}

	static int[] nia(int N) throws IOException {
		StringTokenizer st = nl();
		int[] A = new int[N];
		for (int i = 0; i < N; i++)
			A[i] = ni(st);
		return A;
	}

	static void setIO(String s) throws IOException {
		f = new BufferedReader(new FileReader(s + ".in"));
		out = new PrintWriter(new FileWriter(s + ".out"));
	}

	static void setIO() {
		f = (new BufferedReader(new InputStreamReader(System.in)));
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	}
}


Measured memory_bytes: 54684
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;

int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	int a, b, c;
 	set <int> s;
 	cin >> a >> b >> c;
 	s.insert(a); s.insert(b); s.insert(c);
 	if(sz(s)==2) cout << "Yes\n";
 	else cout << "No\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace __gnu_pbds;
using namespace std;
//typedef
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
//constants
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
// gcd of a and b
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
// distance between (a,b) and (c,d)
long double dis(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
// simple prime check
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
// fast expo
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
// modular inverse
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	assert(_gcd==1);
	return mpow(a,mod-2,mod);
}

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*
ll dx[]={1,0,-1,0,1,1,-1,-1};
ll dy[]={0,-1,0,1,1,-1,-1,1};
*/

/*
void sieve(int N){
	for(int i=0;i<=N;i++){
		spf[i]=i;
	}
	for(int i=2;i*i<=N;i++){
		if(spf[i]==i){
			for(int j=i*i;j<=N;j+=i){
				spf[j]=min(spf[j],i);
			}
		}
	}
	return;
}
*/

/*
void nCr(ll n,ll k){
	ll i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=min(i,k);j++){

			if(j==0 or j==i)C[i][j]=1LL;
			else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

		}
	}
	return;
}
*/
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll n,m;
vl g[100005];
ll vis[100005];
ll done[100005][5];
ll s,t;
queue<ll>q;
void dfs(ll u,ll p,ll d){
	if(!vis[u] and d==3){
		q.push(u);
		vis[u]=vis[p]+1;
		if(u == t){
			cout<<vis[u]-1;
			exit(0);
		}
	}
	if(d == 3 or done[u][d])return;
	for(auto v:g[u]){
		dfs(v,p,d+1);
	}
	done[u][d]=1;
}
int main(){FAST;
cin>>n>>m;
for(ll i=0;i<m;i++){
	ll u,v;cin>>u>>v;
	g[u].pb(v);
}
cin>>s>>t;
q.push(s);
vis[s]=1;
while(!q.empty()){
	ll u = q.front();q.pop();
	dfs(u,u,0);
	done[u][0]=1;
}
cout<<vis[t]-1;
return 0;
}

Measured memory_bytes: 10368
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>

using namespace std;

int main(void){

  string str;
  int arr[26];
  char c=0;

  cin >> str;

  //cout << str.length() << endl;
  for(int i=0;i<26;i++){
    arr[i]=0;
  }

  for(int i=0;i<str.length();i++){
    //cout << str[i] << endl;
    arr[str[i]-'a']=1;
  }

  for(int i=0;i<26;i++){
    //cout << arr[i] << endl;
    if(arr[i] == 0){
      c='a'+i;
      break;
    }
  }

  if(c==0){
    //cout << "zero" << endl;
    if(str=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 << endl;
    }
    else{
      char pre;
      pre=str[25];
      for(int i=24;i>=0;i--){
	//cout << pre << "," << str[i] << endl;	
	if(pre > str[i]){
	  char add_c=0;
	  //pre=str[i]+1;
	  ///*
	  //cout << i << endl;
	  //cout << str[i] << endl;
	  for(int j=0;j<26;j++){
	    if(j < str[i]+1-'a') arr[j]=1;
	    else arr[j]=0;
	  }
	  for(int j=0;j<i;j++){
	    //cout << str[j] << endl;
	    arr[str[j]-'a']=1;
	  }
	  for(int j=0;j<26;j++){
	    //cout <<j <<"," <<arr[j] << endl;
	  }	  
	  for(int j=0;j<26;j++){
	    //arr[str[j]-'a']=1;
	    //cout << arr[j] << endl;
	    if(arr[j] == 0){
	      add_c=j+'a';
	      //cout << add_c << endl;
	      break;
	    }
	  }
	  //*/	  
	  cout << str.substr(0,i)+add_c << endl;
	  break;
	}
	else pre=str[i];
      }
    }
  }
  else{
    //cout << c << endl;
    cout << str+c << endl;
    //for(int i=0;i<str.length();i++){
    //if(str[i])
    //}
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void){
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  const int MAX_N = 100;
  int       n;
  cin >> n;
  int     factor[MAX_N + 1] = {};
  for(int num_begin         = 1; num_begin <= n; num_begin++){
    int num = num_begin;
    while(num > 1){
      for(int div = 2; div < MAX_N; div++){
        if(num % div == 0){
          num /= div;
          factor[div]++;
          break;
        }
      }
    }
  }

  int dp[76][MAX_N + 1] = {};
  dp[1][1] = 1;
  for(int i = 2; i <= n; i++){
    if(factor[i]==0){
      for(int j    = 1; j <= 75; j++){
        dp[j][i] = dp[j][i - 1];
      }
    }else{
      for(int j    = 1; j <= 75; j++){
        dp[j][i] = dp[j][i - 1];
      }
      for(int used = 1; used <= factor[i]; used++){
        for(int prev = 1; prev * (used+1) <= 75; prev++){
          dp[prev * (used+1)][i] += dp[prev][i - 1];
        }
      }
    }



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

  return 0;
}


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

int main() {
  int n;
  int j = 0;

  int sum = 0;

  cin >> n;

  vector<int> d(n);

  rep(i,n){
    cin >> d.at(i);
  }

  for(int i=0;i<n; i++){
    j=i+1;
    while(j<n){
      sum += d.at(i)*d.at(j);
      j++;
    }
  }

  cout << sum;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

const int MaxN = 2e5;
int n, m, cnt[MaxN + 5];

bool Check()
{
	for (int i = 1; i <= n; i++) 
		if (cnt[i] & 1) return false;
	return true;
}

int main()
{
	while (~scanf("%d%d", &n, &m)) {
		memset(cnt, 0, sizeof(cnt));
		for (int i = 1; i <= m; i++) {
			int u, v;
			scanf("%d%d", &u, &v);
			cnt[u]++; cnt[v]++;
		}
		if (Check()) printf("YES\n");
			else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dump(X) cout << #X << ' ' << X << endl
#define pe(X) cout << X << endl
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int main(){
	ll x;
	cin >> x;
	cout << 0  << ' ' << 0  <<  ' ';
	if(x<=1000000000ll){
		cout << x  << ' ' << 0  <<  ' ';
		cout << 0  << ' ' << 1  <<  endl;
	}else if(x<1000000000000000000ll){
			ll y = x/1000000000ll+1ll;
			cout << 1000000000ll <<  ' ' << 1 << ' ';
			cout << 1000000000ll*y-x << ' ' << y << endl;
	
	}else{
		cout << 1000000000ll << ' ' << 0 << ' ';
		cout << 0 << ' ' << 1000000000ll << endl;
	}
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h> 
using namespace std; 
int main(){
	int a,b;
	cin>>a>>b;
	int flag = 0;
	if(a == 1 && b !=1){
		cout<<"Alice"<<endl;
		flag = 1;
	}else if(b == 1 && a !=1){
		cout<<"Bob"<<endl;
		flag = 1;
	}else if(a==1 && b==1){
		cout<<"Draw"<<endl;
		flag = 1;
	}
	if(flag == 0){
		if(a > b){
			cout<<"Alice"<<endl;
		}else if(b > a){
			cout<<"Bob"<<endl;
		}else{
			cout<<"Draw"<<endl;
		}
	}
	
}


Measured memory_bytes: 3588
//    https://youtu.be/N3oCS85HvpY

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))

int main()
{
    fast;
    llu ans=5000000000000000000;
    ll t,n,m,i,j,l,k,temp,flag,x,y,x1,x2,y1,y2;
    cin>>n>>k;
    vector<pair<ll,ll> >v;
    vector<ll>X,Y;
    for(i=0; i<n; i++)
    {
        cin>>x>>y;
        v.pb({x,y});
        X.pb(x);
        Y.pb(y);
    }
//    sort(all(X));
//    sort(all(Y));
    for(j=0; j<n; j++)
    {
        for(x=j+1; x<n; x++)
        {
            for(y=0; y<n; y++)
            {
                for(t=y+1,temp=0; t<n; t++)
                {
                    x1=min(X[j],X[x]);
                    x2=max(X[j],X[x]);
                    y1=min(Y[y],Y[t]);
                    y2=max(Y[y],Y[t]);
                    for(l=0,temp=0; l<n; l++)
                    {
                        if(v[l].ff>=x1 && v[l].ff<=x2 && v[l].ss>=y1 && v[l].ss<=y2)
                            temp++;
                    }
                    if(temp>=k)
                    {
                        if(ans>((llu)abs(x1-x2))*((llu)abs(y1-y2)))
                            ans=((llu)abs(x1-x2))*((llu)abs(y1-y2));
                    }
                }
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int N,A,n,k;
  cin>>N;
  for(int i=0;i<N;i++){
      n=0;
    cin>>A;
    for(int j=0;true;j++){
      if(A%2==0){
        n++;
        A/=2;
      }
      else{
        break;
      }
    }
     if(i==0){
        k=n;
      }
      else{
        if(k>n){
          k=n;
        }
      }
  }
  cout<<k<<endl;
}
  



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

using std::pair;
using std::vector;
using std::string;

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 200000;

int n, m, c;
std::set<int> s[N + 5];

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n), read(m), read(c);
    for(int i = 1; i <= c; ++i) {
        int x, y;
        read(x), read(y), s[y].insert(x);
    }
    for(int i = 1; i <= m; ++i) s[i].insert(n + 1);

    c = 1;
    int ans = oo;

    for(int i = 1; i <= m && c <= n; ++i) {
        chkmin(ans, *s[i].upper_bound(c) - 1);
        if(*s[i].upper_bound(c) != c + 1) ++ c;

        if(i < m) {
            while(*s[i+1].begin() < c) s[i+1].erase(s[i+1].begin());
            while(*s[i+1].begin() == c) ++ c, s[i+1].erase(s[i+1].begin());
        }
    }
    printf("%d\n", ans);
    
    return 0;
}



Measured memory_bytes: 28416
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(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=1LL<<60;
//set<int>::iterator it;


int main(void){
    
    ll a,j,n,i;
	ll ans=0;
    cin>>n;
    ll cumsum[n+2];
    cumsum[n+1]=INF;
    cumsum[0]=0;
    for(i=1;i<=n;i++){
    	cin>>a;
    	cumsum[i]=a+cumsum[i-1];
	}
	sort(cumsum,cumsum+n+2);
	for(i=0;i<n+1;i++){
		j=i+1;
		while(j<n+2&&cumsum[i]==cumsum[j])j++;
		ans+=(j-i-1)*(j-i)/2;
		i+=j-i-1;
	}
    
    cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
 
double count=0;
 
int S[200000],L[100001],R[100001];

void margesort(int *S,int left,int right){
  int mid;
  if(left+1 < right){ 
    mid = (left + right)/2;
    margesort(S,left,mid);
    margesort(S,mid,right);
    marge(S,left,mid,right);
  }
}
void marge(int *S,int left,int mid,int right){
  int n1,n2;
  int i,j=0,k;
 
  n1 = mid - left;
  n2 = right - mid;
 
  for(i=0;i<n1;i++) L[i] = S[left+i];
  L[n1]=-1;
  for(i=0;i<n2;i++) R[i] = S[mid+i];
  R[n2]=-1;
 
  i=0;
  for(k=left;k<right;k++){
  if(L[i] > R[j]){  
    S[k] = L[i];
    i++;
    count += n2 - j;
  }
  else{
    S[k] = R[j];
    j++;
  }
  }
} 
int main(){
  FILE* p;
  int n,i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
     scanf("%d",&S[i]);
   
   margesort(S,0,n);
   printf("%.0f\n",count); 
 
   return 0;
}

Measured memory_bytes: 2192
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	int N, K, Q;
	cin >> N;
	cin >> K;
	cin >> Q;
	vector<int> p(N + 1, K);
	for (int i = 1; i <= Q; i++)
	{
		int A;
		cin >> A;
		p[A]++;
	}
	for (int i = 1; i <= N; i++)
	{
		if (p[i]-Q<=0)
		{
			cout << "No" << endl;
		}
		else
		{
			cout << "Yes" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
	long long n,i,k,j,sum=0,count=0,ans=0,m,w,mx=0,l,r;
	 cin>>n;
	 k=n/500;
	 ans+=k*1000;
	 n=n-k*500;
	 ans+=(n/5)*5;
	 cout<<ans;
	
}

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

int main(){
  int n;
  int value[101]={},a=0;

  while(cin>>n){
    value[n]++;
  }

  for(int i=0;i<101;i++){
    if(value[i]>a){
      a=value[i];
    }
  }

  for(int i=0;i<101;i++){
    if(value[i]==a){
      cout << i << endl;
    }
  }

}

Measured memory_bytes: 1160
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>

#define INF 100000000000000
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong N;
    string S;
    cin >> N;
    cin >> S;
    llong idx=0;
    llong ans=0;
    //greedyアルゴリズム
    while(idx<S.size()){
        if( idx<S.size()-1 && ((S[idx]=='O'&&S[idx+1]=='X') || (S[idx]=='X'&&S[idx+1]=='O'))){
            ans++;
            idx = idx + 2;
            continue;
        }
        idx = idx+1;
    }
    cout << ans << endl;
    return 0;
}






Measured memory_bytes: 3312
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	int g=a*1+b*5+c*10+d*50+e*100+f*500;
	if(g>=1000){cout<<'1'<<endl;}
	else{cout<<'0'<<endl;}
}

Measured memory_bytes: 1152
# -*- coding: utf-8 -*-

import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for k in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for k in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 998244353

class SegTree:
    """
    セグメント木
    1.update:  i番目の値をxに更新する
    2.query: 区間[l, r)の値を得る
    """

    def __init__(self, n, func, intv, A=[]):
        """
        :param n: 要素数(0-indexed)
        :param func: 値の操作に使う関数(min, max, add, gcdなど)
        :param intv: 要素の初期値(単位元)
        :param A: 初期化に使うリスト(オプション)
        """
        self.n = n
        self.func = func
        self.intv = intv
        # nより大きい2の冪数
        n2 = 1
        while n2 < n:
            n2 <<= 1
        self.n2 = n2
        self.tree = [self.intv] * (n2 << 1)
        # 初期化の値が決まっている場合
        if A:
            # 1段目(最下段)の初期化
            for i in range(n):
                self.tree[n2+i] = A[i]
            # 2段目以降の初期化
            for i in range(n2-1, -1, -1):
                self.tree[i] = self.func(self.tree[i*2], self.tree[i*2+1])

    def update(self, i, x):
        """
        i番目の値をxに更新
        :param i: index(0-indexed)
        :param x: update value
        """
        i += self.n2
        self.tree[i] = x
        while i > 1:
            self.tree[i >> 1] = x = self.func(x, self.tree[i ^ 1])
            i >>= 1
 
    def query(self, a, b):
        """
        [a, b)の値を得る
        :param a: index(0-indexed)
        :param b: index(0-indexed)
        """
        l = a + self.n2
        r = b + self.n2
        s = self.intv
        while l < r:
            if r & 1:
                r -= 1
                s = self.func(s, self.tree[r])
            if l & 1:
                s = self.func(s, self.tree[l])
                l += 1
            l >>= 1
            r >>= 1
        return s

    def get(self, i):
        """ 一点取得 """
        return self.tree[i+self.n2]

    def all(self):
        """ 全区間[0, n)の取得 """
        return self.tree[1]

N, M = MAP()
LRC = []
for i in range(M):
    l, r, c = MAP()
    l -= 1
    r -= 1
    LRC.append((l, r, c))

LRC.sort()
st = SegTree(N, min, INF)
st.update(0, 0)
for l, r, c in LRC:
    mn = st.query(l, r+1)
    st.update(r, min(st.get(r), mn+c))

ans = st.get(N-1)
if ans != INF:
    print(st.get(N-1))
else:
    print(-1)


Measured memory_bytes: 83036
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,M;
    cin>>N>>M;
    int sum;
    if(N>=0&&N<=100&&M>=0&&M<=100)
    {
        if((N+M)>=2)
        {
            if(N==1&&M==1)
                cout<<0<<endl;
            else if(N==1&&M==2)
                cout<<1<<endl;
            else if(N==2&&M==1)
                cout<<1<<endl;
            else
            {
                sum=(N*(N-1)/2)+(M*(M-1)/2);
                cout<<sum<<endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC099
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = int.Parse(Console.ReadLine());
            int x = input;
            for (int i = 0; i <= input; i++)
            {
                int cc = 0;
                int t = i;
                while (t > 0)
                {
                    cc += t % 6;
                    t /= 6;
                }
                t = input - i;
                while (t > 0)
                {
                    cc += t % 9;
                    t /= 9;
                }
                x = Math.Min(x, cc);
            }
            Console.WriteLine(x);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cstdio>

#include<string>
using namespace std;
bool REVERSE(string s){
//	cout<<s<<endl;
	string t=s;
	reverse(s.begin(),s.end());
	return s==t;
}
int main(){
	string s;
	cin>>s;
	if(REVERSE(s)&&REVERSE(s.substr(0,(s.size()-1)/2))&&REVERSE(s.substr((s.size()+3)/2-1))){
		puts("Yes");
	}
	else{
		puts("No");
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FOR(i, a) for (int i = 0; i < (a); i++)

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    int W, H, w, h;
    scanf("%d %d %d %d", &W, &H, &w, &h);
    printf("%f ", (double(W)*double(H))/2.f);
    if(w*2 == W && h*2 == H) printf("1\n");
    else printf("0\n");
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


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

int main()
{
  int n;
  cin >> n;
  
  cout << setprecision(20) << 2 * n * M_PI<< endl;
}

Measured memory_bytes: 3772
# Union Find 木
from sys import setrecursionlimit


def find(parent, diff_weight, i):
    t = parent[i]
    if t < 0:
        return i
    t = find(parent, diff_weight, t)
    diff_weight[i] += diff_weight[parent[i]]
    parent[i] = t
    return t


def weight(parent, diff_weight, i):
    find(parent, diff_weight, i)
    return diff_weight[i]


def unite(parent, diff_weight, i, j, d):
    d -= weight(parent, diff_weight, j)
    d += weight(parent, diff_weight, i)
    i = find(parent, diff_weight, i)
    j = find(parent, diff_weight, j)
    if i == j:
        return
    diff_weight[j] = d
    parent[i] += parent[j]
    parent[j] = i


setrecursionlimit(10 ** 6)

N, M = map(int, input().split())
LRD = [tuple(map(int, input().split())) for _ in range(M)]

parent = [-1] * (N + 1)
diff_weight = [0] * (N + 1)
for L, R, D in LRD:
    i = find(parent, diff_weight, L)
    j = find(parent, diff_weight, R)
    if i != j:
        unite(parent, diff_weight, L, R, D)
    else:
        if weight(parent, diff_weight, L) + D != weight(parent, diff_weight, R):
            print('No')
            exit()
print('Yes')


Measured memory_bytes: 39100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200010
const ll mod=1e9+7;

int n,m;
ll ans;
ll fac[N],inv[N];

ll C(int x,int y) {
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}

ll power(ll x,ll y) {
	ll ans=1;
	for (;y;x=x*x%mod,y>>=1)
		if (y&1) ans=ans*x%mod;
	return ans;
}

int main()
{
	fac[0]=1; for (int i=1;i<=200000;i++) fac[i]=fac[i-1]*i%mod;
	inv[200000]=power(fac[200000],mod-2);
	for (int i=199999;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	scanf("%d%d",&n,&m);
	for (int i=1;i<m;i++)
		for (int j=1;j<=m-i;j++)
		{
			if ((m-i)+(m-i-j)>n) continue;
			ans=(ans+C(m-1,i-1)*C(m-i-1,j-1)%mod*C(n-(m-i)-(m-i-j)+2,2)%mod)%mod;
		}
	ans+=(n+1);
	printf("%lld\n",ans%mod);
	return 0;
}

Measured memory_bytes: 3328
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
    ans = 0
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            break
if ans <= 10**18:
    print(ans)
else:
    print(-1)

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

#define rep(i,a,b) for(long long i = (a); i < (b); i++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define pb push_back
using ll = long long;



void solve()
{

int d,t,s;
cin>>d>>t>>s;
int x=d/s;
if(d<=t*s){
	cout<<"Yes";
	return ;
}
cout<<"No";


}



int  main(){


ll t;
//cin>>t;
t=1;
while(t--){
		solve();
		cout<<endl;

}

}

Measured memory_bytes: 3632
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function euc(a,m)
	b = m
	x = 1
	u = 0
	while b>0
		q = div(a,b)
		tmp = u
		u = x-q*u
		x = tmp
		tmp = b
		b = a-q*b
		a = tmp
	end
	x<0?x+abs(m):x
end

function main()
	p = 10^9+7
	n,k = readline() |> split |> parseMap
	a = readline() |> split |> parseMap |> sort
	kck = zeros(Int,n-k+1)
	kck[1] = 1
	for i in 2:n-k+1
		kck[i]=(kck[i-1]*euc(i-1,p)%p)*(k+i-2)%p
	end
	s = 0
	for i in 1:n-k+1
		s = mod(s-a[i]*kck[n-k+2-i],p)
		s = mod(s+a[n+1-i]*kck[n-k+2-i],p)
	end
	println(s)
end

main()

Measured memory_bytes: 121996