akhauriyash/Code-Regression huggingface dataset:
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iterator>  // std::back_inserter
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define alf(i) for (char i = 'a';i < 'z'; ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

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

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll n; cin >> n;
  vll a(n), b(n);
  map<ll, ll> flag;
  ll ans = 0;
  rep(i, n)
  {
    ll A;
    cin >> A;
    a[i] = A + 1 + i;
    b[i] = i + 1 - A;
    if(flag.count(b[i])) ans += flag[b[i]];
    if(flag.count(a[i])) flag[a[i]]++;
    else flag[a[i]] = 1;
  }
  fin(ans);
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}


Measured memory_bytes: 19120
//#include "bits/stdc++.h"

#include <iostream>
#include <vector>
// #include <map>
// #include <string>
#include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

int main() {
	vector<int> cnt(26, 0);
	while (1) {
		string s;
		getline(cin, s);
		if (s.size() == 0) {
			break;
		}
		transform(s.begin(), s.end(), s.begin(), ::tolower);
		for (unsigned int i = 0; i < s.size(); i++) {
			cnt[s[i] - 'a']++;
		}
	}
	for (int i = 0; i < 26; i++) {
		cout << char(i + 'a') << " : " << cnt[i] << endl;
	}
	return 0;
}



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

using ll = long long;

ll N, T;
ll t[222222];

int main() {
   cin >> N >> T;
   for (int i = 0; i < N; i++) {
      cin >> t[i];
   }

   ll ans = 0;
   for (int i = 0; i < N-1; i++) {
      ans += min(T, t[i+1]-t[i]);
   }

   cout << ans + T << endl;

   return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<stack>
#include<set>
using namespace std ;
using ll = long long ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using pll = pair<ll,ll> ;
ll INF = 1e15 ;
void chmin(ll &a,ll b){if(a>b) a = b ;}
void chmax(ll &a,ll b){if(a<b) a = b ;}
void YorN(bool a){cout << (a?"YES":"NO") << "\n" ;}

void solve(ll n,ll a,ll b){
	if(n==1){
		cout << min(a,b) << "\n" ;
		return ;
	}
	while(a!=b){
		if(a<b) b = (b+n-2)/n ;
		else a = (a+n-2)/n ;
	}
	cout << a << "\n" ;
}

int main(){
	ll n,q ;
	cin >> n >> q ;
	while(q--){
		ll a,b ;
		cin >> a >> b ;
		solve(n,a,b) ;
	}
}

Measured memory_bytes: 3612
use std::io;

#[derive(Default, Debug)]
struct Trie {
    size: usize,
    children: [Option<Box<Trie>>; 26],
    leaf: [bool; 26],
    acc: [usize; 26],
}

impl Trie {
    fn insert(&mut self, x: &[u8]) {
        let target = (x[x.len() - 1] - b'a') as usize;
        self.size += 1;
        if x.len() == 1 {
            self.leaf[target] = true;
        } else {
            if self.children[target].is_none() {
                self.children[target] = Some(Box::new(Trie::default()));
            }
            self.children[target]
                .as_mut()
                .unwrap()
                .insert(&x[..x.len() - 1]);
        }
    }
    fn build_acc(&mut self) {
        for i in 0..26 {
            self.acc[i] = self.leaf[i] as usize;
        }
        for (i, c) in self.children.iter_mut().enumerate() {
            if let Some(c) = c.as_mut() {
                c.build_acc();
                for j in 0..26 {
                    if i != j {
                        self.acc[j] += c.acc[j];
                    } else {
                        self.acc[i] += c.size;
                    }
                }
            }
        }
    }
    fn aggregate(&self) -> usize {
        let mut sum = 0;
        for c in self.children.iter() {
            if let Some(c) = c.as_ref() {
                sum += c.aggregate();
            }
        }
        for i in 0..26 {
            if self.leaf[i] {
                sum += self.acc[i] - 1;
            }
        }
        sum
    }
}

fn main() {
    let mut trie = Trie::default();
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let n: usize = buf.trim_end().parse().unwrap();
    for _ in 0..n {
        buf.clear();
        io::stdin().read_line(&mut buf).unwrap();
        trie.insert(buf.trim_end().as_bytes());
    }
    trie.build_acc();
    println!("{}", trie.aggregate());
}


Measured memory_bytes: 508760
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(b<a) cout<<a-1<<endl;
    else cout<<a<<endl;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int ans = INF;
	int n;
	cin >> n;
	REP(i, n) {
		int a;
		cin >> a;
		int cnt = 0;
		while (a % 2 == 0) {
			cnt++;
			a /= 2;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <climits>
#include <bitset>
#include <fstream>
#include <algorithm>
#include <functional>
#include <stack>
#include <string>
#include <cmath>
#define fi first
#define se second
#define re register
#define ls i << 1
#define rs i << 1 | 1
#define pb push_back
#define pii pair<int,int>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007

#define int long long

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
int tt;
inline int rd(){
  int x = 0, f = 1; char ch = getchar();
  while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return x * f;
}

void out(int a) {
  if (a < 0) putchar('-'), a = -a;
  if (a >= 10) out(a / 10);
  putchar(a % 10 + '0');
}

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}

const int maxn = 1e6+500;

int a[maxn];
int nums[maxn];

int prime[maxn];
int vis[maxn];
int cnt;

void is_prime() {//线性筛
    for (int i = 2; i < maxn; i++) {
        if (!vis[i]) prime[cnt++] = i;
        for (int j = 0; j < cnt && i * prime[j] < maxn; j++ ){
            vis[i * prime[j]] = 1;
            if (i % prime[j] == 0) break;
        }
    }
}


int get_num(int x) {//获得1到x区间内x因数的个数
    int res = 1;
    for (int i = 0; i < cnt && prime[i] * prime[i] <= x; i++) {
        if (x % prime[i] == 0) {
            nums[prime[i]]++;
            int num = 0;
            while (x % prime[i] == 0) {
                num++;
                x /= prime[i];
            }
            res *= (1 + num);
        }
    }
    if (x > 1) nums[x]++;
    return res;
}

void solve() {
  is_prime();
  int n = rd();
  for (int i = 1; i <= n; i++) a[i] = rd(), get_num(a[i]);
  int flag = 1;
  for (int i = 0; i <= cnt; i++) if(nums[prime[i]] > 1) flag = 0;
  if (flag) puts("pairwise coprime");
  else {
    int res = a[1];
    for (int i = 2; i <= n; i++) res = gcd(res, a[i]);
    puts(res == 1 ? "setwise coprime" : "not coprime");
  }
}

signed main(){
//  for (tt = rd(); tt--; )
  solve();
  return 0;
}

Measured memory_bytes: 27500
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n, k;
  cin >> n >> k;
  vector<ll> x(n);
  REP(i, n) cin >> x[i];

  ll ans = (ll)1e18;
  for(ll i = 0; i+k-1 < n; i++){
    ll m = i+k-1;
    if(x[i] < 0 && x[m] > 0) chmin(ans, min(-2*x[i]+x[m], 2*x[m]-x[i]));
    if(x[i] >= 0) chmin(ans, x[m]);
    if(x[m] <= 0) chmin(ans, -x[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Solve s= new Solve();
		s.solve();
	}

}
class Solve{
	 Scanner sc = new Scanner(System.in) ;

	 void solve() {
	 int n=sc.nextInt();
	 int res=0;
	 int[] p= new int[n];
	 
	 for(int i=0;i<n;i++) {
		 p[i]=sc.nextInt();
	 }
	 for(int i=0;i<n-2;i++) {
		 if(p[i+1]<p[i]) {
			 if(p[i+1]>=p[i+2]) {
				 res++;
			 }
		 }
		 if(p[i+1]>=p[i]) {
			 if(p[i+1]<p[i+2]) {
				 res++;
			 }
		 }
	 }
	 System.out.println(res);


	 }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;
void solve(ll N, vector<ll> a){
	map<ll,int> cnt;
	for( auto i : a ) cnt[i]++;
	long long ans = 0;
	for( auto i : cnt ){
		if( i.second < i.first ) ans += i.second;
		else ans += i.second - i.first;
	}
	cout << ans << endl;
}

int main(){	
	ll N;
	scanf("%lld",&N);
	vector<ll> a(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, a);
	return 0;
}



Measured memory_bytes: 7808
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
  ll x;
  cin >> x;
  cout << (x / 500) * 1000 + (x % 500) / 5 * 5 << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 1001001001;

int main(){
	ll a, b, c, k; cin >> a >> b >> c >> k;
	ll ans = 0;
	if (a >= k) {
		cout  << k << endl;
	} else if(a+b >= k) {
		cout << a <<endl;
	} else {
		cout << a - (k - a - b) << endl;
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;

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

Node t[25];
int n,D[25],H[25];

void depth(int v,int d){
    if(v==-1)return;
    D[v]=d;
    depth(t[v].l,d+1);
    depth(t[v].r,d+1);
}

int height(int v){
    int hl,hr;
    hl=hr=0;
    if(t[v].l!=-1)hl=height(t[v].l)+1;
    if(t[v].r!=-1)hr=height(t[v].r)+1;
    return H[v]=max(hl,hr);
}

int sibling(int v){
    if(t[v].p==-1)return -1;
    if(t[t[v].p].l!=v&&t[t[v].p].l!=-1)return t[t[v].p].l;
    if(t[t[v].p].r!=v&&t[t[v].p].r!=-1)return t[t[v].p].r;
    return -1;
}

void print(int v){
    printf("node %d: ",v);
    printf("parent = %d, ",t[v].p);
    printf("sibling = %d, ",sibling(v));
    printf("degree = %d, ",(t[v].l!=-1)+(t[v].r!=-1));
    printf("depth = %d, ",D[v]);
    printf("height = %d, ",H[v]);
    if(t[v].p==-1)puts("root");
    else if(t[v].l==-1&&t[v].r==-1)puts("leaf");
    else puts("internal node");
}

signed main(){
    cin>>n;
    rep(i,n)t[i].p=-1;
    rep(i,n){
        int id,l,r;
        cin>>id>>l>>r;
        t[id].l=l;
        t[id].r=r;
        if(l!=-1)t[l].p=id;
        if(r!=-1)t[r].p=id;
    }
    
    int root;
    rep(i,n)if(t[i].p==-1)root=i;
    depth(root,0);
    height(root);
    rep(i,n)print(i);
    return 0;
}


Measured memory_bytes: 3204
N, *A = map(int, open(0).read().split())
F = True
ans = 0
while F:
    F = False
    for i in range(N-1):
        if A[i] > A[i+1]:
            A[i], A[i+1] = A[i+1], A[i]
            F = True
            ans += 1
print(' '.join(map(str, A)))
print(ans)


Measured memory_bytes: 5600
#include<iostream>
#include<string>
#include <cmath>
#include <ctype.h>
using namespace std;
int a, b;
int main() {
    cin >> a >> b;
    if(a+b>=24) cout << (a+b)%24 << endl;
    else cout << a+b << endl;
    return 0;
}

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

int n;

int main(void){
	cin >> n;
	lli ans = 0;
	rep(i, n){
		lli a;
		cin >> a;
		ans += a-1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3560
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		sc.close();
		long sum=0;
		long dai=0;
		long sho=0;
		if (s[0]=='<') {
			sho++;
		} else {
			dai++;
		}
		for (i = 1; i < s.length; i++) {
			if (s[i]=='<') {
				if(s[i-1]=='>') {
					long n = Math.max(sho, dai);
					long m = Math.min(sho, dai)-1;
					sum+=n*(n+1)/2+m*(m+1)/2;
//					out.printf("<:%d >:%d sum:%d%n", sho, dai, sum);
					sho=0;
					dai=0;
				}
				sho++;
			} else {
				dai++;
			}
		}
		long n = Math.max(sho, dai);
		long m = Math.min(sho, dai)-1;
		sum+=n*(n+1)/2+m*(m+1)/2;
//		out.printf("<:%d >:%d sum:%d%n", sho, dai, sum);
		out.println(sum);
	}
}


Measured memory_bytes: 28704
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  int a = 0;
  cin >> s;
  if(s[0] == 'o') a += 100;
  if(s[1] == 'o') a += 100;
  if(s[2] == 'o') a += 100;
  cout << 700 + a << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
bool cmp(int x, int y)
{
    return x>y;
}

int main()
{
    long long int N, K;
    long long int ti=0;
    int m[200000];
    cin>>N>>K;
    for (int i=0;i<N;i++)
    {
        cin>>m[i];
    }
    sort(m,m+N);
    sort(m,m+N, cmp);
    for (int i=0;i<K;i++)
    {
        m[i] = 0;
    }
    for (int i =0;i<N;i++)
    {
        ti = ti+m[i];
    }
    cout<<ti;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n, ans, m = 1;
vector<Int> a;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	a.resize(n);
	for(auto &i:a) cin >> i;
	for(size_t i=0; i<a.size(); ++i){
		if(a[i] < m) continue;
		if(a[i] == m){
			++m;
		}else{
			ans += (a[i] - 1) / m;
			if(m == 1) ++m;
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 1024
#include<stdio.h>
int search(int A[], int n, int key){
	int i = 0;
	A[n] = key;
	while ( A[i] !=key )i++;
	return i!= n;
}

int main(){
	int i, n, A[10000+1], q, key, sum = 0;
	
	scanf("%d",&n);
	for ( i = 0; i < n; i++ ) scanf("%d",&A[i]);
	
	scanf("%d",&q);
	for ( i = 0; i < q;i++){
		scanf("%d",&key);
		if(search(A,n,key))sum++;
	}
	printf("%d\n",sum);
	
	return 0;
}


	



Measured memory_bytes: 2112
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    s = S()
    if s[2] == s[3] and s[4] == s[5]:
        return 'Yes'

    return "No"


print(main())





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

int main() {
	
    int n;
    scanf("%d", &n);
    char s[n];
    scanf("%s", s);
    int ans = 0;
    for(int i = 0; i < n - 1; i++) {
    	if(s[i] != s[i + 1]) {
    		ans++;
    	}
    } 
    printf("%d\n", ans + 1);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a) for(i = 0 ; i < a ; i++)
#define whln(t) while(t--)
#define whlp(t) while(t++)
ll i=0,j=0;


int main(void){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif
	 // int t ;
	 // cin>>t;
	 // whln(t){
  	ll n;
  	cin>>n;
  	vector<ll>v(n);
  	set<ll>s ;

  	rep(i,n){
  		cin>>v[i];
  		s.insert(v[i]);
  	}

  	if(s.size()!=v.size())
  		cout<<"NO\n";
  	else
  		cout<<"YES\n";
  	
}
//   *****  *******   !
//   *		     *    !
//   ***       *      !
//   *       *        !
//   *****  *******   !

Measured memory_bytes: 13992
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll n;
    cin >> n;
    vector<long long> vec(n+1);
    rep(i, n) cin >> vec[i+1];

    vector<ll> ans(n+1);
    vector<ll> res;

    for(ll i = n; i >= 1; i--){
        
        ll sum = 0;
        for(ll j = i; j <= n; j+=i){
            sum += ans[j];
        }

        //cout << "i = " << i << " sum = " << sum << endl;
        if(sum % 2 == vec[i]){
            ans[i] = 0;
        }else{
            ans[i] = 1;
            res.push_back(i);
        } 
            
    }

    /*
    for(ll i = 1; i <= n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    */


    cout << res.size() << endl;
    rep(i, res.size()){
        cout << res[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4980
while True :
    a,b,c = input().split()
    a = int(a)
    c = int(c)
    
    if (b == "+"):
        print (a+c)
    elif (b == "-"):
        print (a-c)
    elif (b == "*"):
        print (a*c)
    elif (b == "/"):
        print (a//c)
    elif (b == "?"):
        break

Measured memory_bytes: 7700
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef long long ll;
vector <ll> a;
vector<ll> f;
ll n,k;
ll check(ll maxallowed)
{
	ll need = 0;
	for(ll i = 0; i<n ; i++)
	{
		if(a[i]*f[i]<=maxallowed)
			continue;
		else
		{
			need += a[i]-(maxallowed)/f[i];
		}
	}
	if(need <=k)
		return 1;
	else
		return 0;
 
}
int	main()
{
   // ios_base::sync_with_stdio(false); 
   // cin.tie(NULL);
   cin>>n>>k;
   ll x;
   for(ll i=0; i<n ; i++)
   		{
   			cin>>x;
   			a.pb(x);
   		}
   	//cout<<"hey";
   for(ll i =0; i<n ; i++)
   		{
   			cin>>x;
   			f.pb(x);
   		}
   	//cout<<"hu";
   sort(a.begin(),a.end(),greater<ll>());
   sort(f.begin(),f.end());  	
   ll r = 0, l  = 0;
   for(ll i = 0; i<n ; i++)
  		if(a[i]*f[i]>r)
   			r = a[i]*f[i];
   
   	while(r-l>10)
   	{
   		ll mid = (l+r)/2;
   		if(check(mid))
   			r = mid;
   		else
   			l = mid+1;
   	}
   	for(ll i = l ; i<=r ; i++)
   		if(check(i))
   		{
   			r = i;
   			break;
   		}
 
 	cout<<r<<endl;  	
 
 
	return 0;
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,i,n;
    char arr[100],ae[100],dp[200];
    scanf("%s",arr);
    scanf("%s",ae);
    b = strlen(arr);
    c = strlen(ae);
    int p=0,q=0;
    for(i = 0;i < b+c;i++){
        if(p >= b||q >= c){
            if(p >= b){
                dp[i] = ae[q];
                q++;
            }
            else{
                dp[i] = arr[p];
                p++;
            }
        }
        else{
        if(i%2==0){
            dp[i] = arr[p];
            p++;
        }
        else if(i%2!=0){
            dp[i] = ae[q];
            q++;
        }
        }
    }
    
    for(i = 0;i < b+c;i++){
        cout<<dp[i];
    }
}


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

#define read(num) scanf("%d", &num)
#define readll(num) scanf("%lld", &num)
#define read2(num1, num2) scanf("%d%d", &num1, &num2)
#define read3(num1, num2, num3) scanf("%d%d%d", &num1, &num2, &num3)
#define reads(str) scanf("%s", str)
#define readc(ch) scanf("%c", &ch)

#define pb push_back
#define mp make_pair

#define pii pair<int, int>
#define vi vector<int>
#define ll long long


int main()
{
    double r;
    cin>>r;
    double pi=3.1415926535;
    double k=(2*pi*r);
    cout<<setprecision(9)<<k;
}


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

using namespace std;

const int nax=1005;
int p[nax][nax];
int ile[nax][nax];
int czy[nax][nax];
int w,h;
int wsk;
vector<pair<int,int> > a;

void update(int i,int j,int v)
{
    if(i<1 || i>h || j<1 || j>w) return;
    if(czy[i][j]==1) return;
    a.push_back({i,j});
    ile[i][j]=min(ile[i][j],v+1);
    czy[i][j]=true;
}

void bfs()
{
    pair<int,int> akt=a[wsk];
    int i=akt.first;
    int j=akt.second;
    int v=ile[i][j];
    czy[i][j]=1;
    update(i+1,j,v);
    update(i-1,j,v);
    update(i,j+1,v);
    update(i,j-1,v);
    wsk++;

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(czy,0,sizeof czy);
    memset(ile,0,sizeof ile);
    cin>>h>>w;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            char x; cin>>x;
            if(x=='#') p[i][j]=1;
            else p[i][j]=0;
            if(p[i][j]==1) ile[i][j]=0;
            else ile[i][j]=1e9;
        }
    }
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(p[i][j]==1)
            {
                a.push_back({i,j});
                czy[i][j]=1;
            }
        }
    }
    wsk=0;
    while(wsk<a.size()) bfs();
    int res=0;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++) res=max(res,ile[i][j]);
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 22636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  vector<int> dp(n, INT_MAX);
  dp[0] = 0;
  for(int i = 1; i < n; i++){
    for(int j = max(i-k,0); j<i; j++){
      dp[i]=min(dp[i], dp[j]+abs(h[i]-h[j]));
    }
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 1152
/* Author rumoisen */
/* created 2018/10/07 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}
void No(){cout<<"NO"<<endl;exit(0);}
void Yes(){cout<<"YES"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

using namespace std;

int main(void)
{
    int n,x,m[110];
    cin>>n>>x;
    for(int i=0;i<n;i++) cin>>m[i];
    int amt=x,cnt=0;
    for(int i=0;i<n;i++){
        amt-=m[i];
        cnt++;
    }
    sort(m,m+n);
    while(amt>=m[0]){
        amt-=m[0];
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

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

#define INF 10000

using namespace std;

int h,w,dp[50][50];
char map[50][50];

bool getmap(int x,int y) {
    if(x < w && x >= 0 && y < h && y >= 0 && map[x][y] == '.')
        return true;
    else
        return false;
}

void dfs(int x,int y,int cost) {
    if(!getmap(x, y))
        return;
    if(dp[x][y] <= cost)
        return;
    dp[x][y] = cost;
    dfs(x+1,y,cost+1);
    dfs(x-1,y,cost+1);
    dfs(x,y+1,cost+1);
    dfs(x,y-1,cost+1);
}

int main(void) {
    for(int i = 0;i < 50*50;i++) {
        dp[i%50][i/50] = INF;
    }
    cin >> h >> w;
    int w_count = 0;
    for(int y = 0;y < h;y++) {
        for(int x = 0; x < w;x++) {
            cin >> map[x][y];
            if(map[x][y] == '#')
                w_count++;
        }
    }
    dfs(0,0,1);
    if(dp[w-1][h-1] == INF)
        cout << -1 << endl;
    else
        cout << (h * w - w_count) - dp[w-1][h-1] << endl;
    return 0;
}


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


int main(){
    int a,b;
    int answer = 0;
    cin >> a >> b;
    if((b - 1) % (a - 1) == 0){
        answer = (b - 1) / (a - 1);
    }else{
        answer = (b - 1) / (a - 1) + 1;
    }
    
    cout << answer << endl;
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>

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

int a[200000],n,b,i;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    REP(i,n)cin>>a[i];
    REP(i,n)b^=a[i];
    REP(i,n)cout<<(a[i]^b)<<"\n";
    return 0;
}

Measured memory_bytes: 4404
#include <stdio.h>

int int_max(int a[], int count);

int main(void)
{
	int a[100];
	int i, count;
	int max;
	
	for (i = 0; i < 100; i++){
		a[i] = 0;
	}
	
	count = 0;
	while (scanf("%d", &i) != EOF){
		a[i - 1]++;
		count++;
	}
	
	max = int_max(a, count);
	
	for (i = 0; i < count; i++){
		if (a[i] == max){
			printf("%d\n", i + 1);
		}
	}
	
	return (0);
}
int int_max(int a[], int count)
{
	int i, max;
	
	max = 0;
	
	for (i = 0; i < count; i++){
		if (max < a[i]){
			max = a[i];
		}
	}
	
	return (max);
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<int> v(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  vector<int> l(n + 2, 0), r(n + 2, 0);
  for(int i = 1; i < n + 1; ++i) l[i] = max(l[i - 1], v[i - 1]);
  for(int i = n; i > 0; --i) r[i] = max(r[i + 1], v[i - 1]);
  for(int i = 1; i < n + 1; ++i){
    cout << max(l[i - 1], r[i + 1]) << endl;
  }
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;

ll gcd(ll a , ll b){
	return b > 0 ? gcd(b , a % b) : a;	
}

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

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

	int n;
	ll ans = -INF;

	cin >> n;
	
	rep(i , n){
		ll x;
		cin >> x;
		if(ans == -INF){
			ans = x;
		}else{
			ans = lcm(x , ans);
		}
	}
	
	cout << ans;
	return 0;
}

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

int main(){
  
  int a,b,c,k,max=0;
  cin>>a>>b>>c>>k;
  for(int n=1;n<=k;n++){
    if(n<=a) max+=1;
    else if(n-a<=b);
    else if(n-a-b<=c) max-=1;
  }
  cout<<max<<endl;
  return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
class Atkin{
  public:
    int n, sqlim;
    vector<bool> prime;
    Atkin(int N):n(N+1){sqlim=(int)ceil(sqrt(n)); prime=vector<bool>(n,0); calc();}

    void calc(){
        int b;
        for (auto z:{1,5}) for (int y=z; y<=sqlim; y+=6) {
			for (int x=1; x<=sqlim && (b=4*x*x+y*y)<=n; ++x)prime[b].flip();
			for (int x=y+1; x<=sqlim && (b=3*x*x-y*y)<=n; x+=2)prime[b].flip();
		}
        for (auto z:{2,4}) for (int y=z; y<=sqlim; y+=6) {
			for (int x=1; x<=sqlim && (b=3*x*x+y*y)<=n; x+=2)prime[b].flip();
			for (int x=y+1; x<=sqlim && (b=3*x*x-y*y)<=n; x+=2)prime[b].flip();
		}
		for (int y=3; y<=sqlim; y+=6) for (auto z:{1,2}) 
			for (int x=z; x<=sqlim && (b=4*x*x+y*y)<=n; x+=3)prime[b].flip();
		prime[0]=0;
		for(int i=1;i<=sqlim;i++){
		    if(prime[i]==0)continue;
			int zz=i*i;
			for (int k=zz; k<=n; k+=zz)prime[k]=0;
		}
		prime[2]=prime[3]=1;
    }
};
int main(void){
    Atkin atkin(1000000);
    int a,d,n;
    while(cin>>a>>d>>n,n){
        for(int i=0;a<1000000;a+=d)
            if((i+=atkin.prime[a])==n) break;
        cout<<a<<endl;
    }
}

Measured memory_bytes: 3200
a=int(input())
b=list(map(int,input().split()))
money=0
kei=0
cnt1=0
cnt2=0
if a%2==1:
    for i in range(0,a,1):
        kei+=b[i]
    f=0
    while cnt1<=kei/2:
        cnt1+=b[f]
        f+=1
    cnt1-=b[f-1]
    g=a-1
    while cnt2<=kei/2:
        cnt2+=b[g]
        g-=1
    cnt2-=b[g+1]
else:
    for i in range(0,a,1):
        kei+=b[i]
    f=0
    while cnt1<=kei/2:
        cnt1+=b[f]
        f+=1
    cnt1-=b[f-1]
    g=a-1
    while cnt2<=kei/2:
        cnt2+=b[g]
        g-=1
    cnt2-=b[g+1]
if cnt1==kei/2:
    print(0)
else:
    print(abs(b[f-1]-abs(cnt1-cnt2)))

Measured memory_bytes: 26060
#include<bits/stdc++.h>
using namespace std;
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s;
    char c[9];
    for(int i=0;i<9;i++){
        cin>>c[i];
    }
    cout<<c[0]<<c[4]<<c[8];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+10;
const ll mod = 2019;
ll num[2100],f[2100],Hash[maxn];
ll qpow(ll a,ll b,ll mod) {
    ll ans =  1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans;
}
char s[maxn];
int main() {
    ios::sync_with_stdio(0);
    cin>>s+1;
    ll inv = 202;
    int n = strlen(s+1);
    Hash[n]=s[n]-'0';
    for(int i=n-1; i>=1; i--)
        Hash[i]=((s[i]-'0')*qpow(10,n-i,2019)%mod+Hash[i+1])%mod;
    for(int i=n; i>=1; i--)
        num[Hash[i]]++;
    ll ans = num[0];
    for(int i=n; i>1; i--) {
        int a = s[i]-'0';
        num[a]--;
        for(int j=0; j<2019; j++)
            f[(j-a+mod)*inv%mod]=num[j];
        ans+=f[0];
        for(int j=0; j<2019; j++)
            num[j]=f[j];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5324
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

const int MAXN = 5001;
int dp[MAXN][MAXN];

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

	int n;
	string s;
	cin >> n >> s;
	for (int i = 1; i <= n; i++) {
		for (int j = i+1; j <= n; j++) {
			if (s[i-1] == s[j-1])
				dp[i][j] = min(j-i, dp[i-1][j-1]+1);
			else
				dp[i][j] = 0;
		}
	}

	int ans = 0;
	for (int i = 1; i <= n; i++) for (int j = 0; j <= n; j++)
		ans = max(ans, dp[i][j]);
	cout << ans << endl;
}


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

int main(){
  int K,S,count=0;
  cin >> K >> S;
  for(int i=0;i<K+1;i++){
    for(int j=0;j<K+1;j++){
      if(S-K<=i+j && i+j<=S){
        count++;
      }
    }
  }      
  cout << count << endl;
}    

Measured memory_bytes: 256
package main

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

var (
	input  = bufio.NewScanner(os.Stdin)
	tokens []string
)

// genTokens generates tokens from the input, and puts it into the tokens array.
func genTokens() {
	if !input.Scan() {
		panic("No more input")
	}

	nextFields := strings.Fields(input.Text())
	tokens = append(tokens, nextFields...)
}

// nextInt returns next int in its input, or panics if no input.
func nextInt() int {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	ret, err := strconv.Atoi(next)
	if err != nil {
		panic(err)
	}
	return ret
}

// nextInt64 returns next int in its input, or panics if no input.
func nextInt64() int64 {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	ret, err := strconv.ParseInt(next, 10, 64)
	if err != nil {
		panic(err)
	}
	return ret
}

// next returns the next string separated by spaces, or panics if no input.
func next() string {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	return next
}

func main() {
	n := nextInt()
	k := nextInt()

	digits := 0
	for n > 0 {
		n /= k
		digits++
	}
	fmt.Println(digits)
}


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

defeat = lambda Ai, Bi: min(Ai, Bi) 

total = 0
for i in range(len(B)):
    num_of_defeated = defeat(A[i], B[i])
    A[i] -= num_of_defeated
    total += num_of_defeated

    remainder = B[i] - num_of_defeated
    num_of_defeated = defeat(A[i + 1], remainder)
    A[i + 1] -= num_of_defeated
    total += num_of_defeated

print(total)


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

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

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

	int ans = 0;

	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		if (num >= k) {
			ans++;
		}
	}

	cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

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

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

  int a, b;
  cin >> a >> b;

  int ans;
  if(a >= 13) ans = b;
  else if(a >= 6) ans = b / 2;
  else ans = 0;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 888
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int N, M, X, Y;
vector<int> x, y;

int main() {
  cin >> N >> M >> X >> Y;
  x.resize(N);
  y.resize(M);
  for (int i = 0; i < N; i++)
    cin >> x[i];
  for (int i = 0; i < M; i++)
    cin >> y[i];

  int x_max = *max_element(x.begin(), x.end());
  int y_min = *min_element(y.begin(), y.end());
  if (x_max < y_min && x_max < Y && X < y_min)
    cout << "No War" << endl;
  else
    cout << "War" << endl;

  return 0;
}


Measured memory_bytes: 3628
// AOJ ITP2_10_D Bit Mask
// 2019.3.8 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in()   // 非負整数の入力
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(unsigned long long n)   // 非負整数の表示、最後に改行あり
{
	int i;
	char ob[20];

	if (!n) pc('0');
	else {
		i = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(ob[i]);
	}
	pc('\n');
}

int bitcount64(unsigned long long x)
{
	x = ((x & 0xAAAAAAAAAAAAAAAAULL) >> 1) + (x & 0x5555555555555555ULL);
	x = ((x & 0xCCCCCCCCCCCCCCCCULL) >> 2) + (x & 0x3333333333333333ULL);
	x = ((x & 0xF0F0F0F0F0F0F0F0ULL) >> 4) + (x & 0x0F0F0F0F0F0F0F0FULL);
	x = ((x & 0xFF00FF00FF00FF00ULL) >> 8) + (x & 0x00FF00FF00FF00FFULL);
	x = ((x & 0xFFFF0000FFFF0000ULL) >> 16) + (x & 0x0000FFFF0000FFFFULL);
	x = ((x & 0xFFFFFFFF00000000ULL) >> 32) + (x & 0x00000000FFFFFFFFULL);
	return (int)x;
}

int N;
unsigned long long mask[12];

int main()
{
	int i, q, c;
	unsigned long long n, m;

	N = in();
	for (i = 0; i < N; i++) {
		c = in();
		while (c--) mask[i] |= 1LL << in();
	}
	q = in(), n = 0;
	while (q--) {
		c = gc() & 0xf, gc(), i = in(), m = mask[i];
		switch (c) {
		case 0: pc((n & (1LL << i)) ? '1' : '0'), pc('\n'); break;
		case 1: n |= m; break;
		case 2: n &= ~m; break;
		case 3: n ^= m; break;
		case 4: pc((n & m) == m ? '1' : '0'), pc('\n'); break;
		case 5: pc((n & m)? '1' : '0'), pc('\n'); break;
		case 6: pc(!(n & m) ? '1' : '0'), pc('\n'); break;
		case 7: out(bitcount64(n & m)); break;
		case 8: out(n & m); break;
		}
	}
	return 0;
}


Measured memory_bytes: 2088
#include<iostream>
#include<vector>
using namespace std;
#include<atcoder/segtree>
using namespace atcoder;

int op(int a, int b) {
  return max(a,b);
}

int e() {
  return 0;
}

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

  segtree<int,op,e> sg(300001);
  for (i=0;i<N;i++) {
    int l = max(a[i]-K, 0);
    int r = min(a[i]+K, 300000);
    sg.set(a[i], sg.prod(l,r+1) + 1);
  }
  cout<<sg.all_prod()<<endl;
  return 0;
}


Measured memory_bytes: 9180
// Problem : A - Lucky 7
// Contest : AtCoder - AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

int main()
{
	int n;cin>>n;
	while(n)
	{
		if(n%10 == 7){
			cout<<"Yes"<<endl;
			return 0;
		}
		n/=10;
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
long long n,c[202020],ans[202020],sz[202020],d[202020];
vector<int>v[202020];
int dfs(int x,int y)
{
	sz[x]=1;
	int cc=c[x],lw=0,xx;
	for(int i=0;i<v[x].size();i++)
	{
		int z=v[x][i];
		if(z==y)
		{
			continue;
		}
		xx=d[cc];
		int nw=dfs(z,x);
		sz[x]+=nw;
		xx=d[cc]-xx;
		lw+=xx;
		long long hs=nw-xx;
		ans[cc]+=hs*(hs+1)/2;
	}
	d[cc]+=sz[x];
	d[cc]-=lw;
	return sz[x];
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
	}
	for(int i=0;i<n-1;i++)
	{
		int a,b;
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	dfs(1,-1);
	for(int i=1;i<=n;i++)
	{
		long long nd=n-d[i];
		cout<<n*(n+1)/2-ans[i]-nd*(nd+1)/2<<endl;
	}
	return 0;
}

Measured memory_bytes: 39564
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=200002 ;
ll  power(ll  i,ll  j)
{
    if(j==0)
    return 1 ;
    ll t=power(i,j/2)%maa ;
    if(j%2==0)
    return (t%maa*t%maa)%maa ;
    else
    return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
}
vector<ll>v ;
ll n ;
ll ans;
void fun(ll i,ll j)
{
    if(j>=n)
            ans=min(ans,j) ;


    if(i==0)
    {


    }
    else
    {

        for(ll k:v)
        {

                fun(i-1,j*10+k) ;
        }
    }
}
int main()
{
   fast ;
   ll k ;
   cin>>n>>k ;
   ll c[10] ;
   memset(c,0,sizeof(c)) ;
   for(ll i=0;i<k;i++)
   {
       ll x ;
       cin>>x ;
       c[x]=1 ;
   }
   for(ll i=0;i<10;i++)
   {
       if(c[i]==0)
       {
           v.pb(i) ;
       }
   }
    ans=INT_MAX ;
   fun(6,0) ;


   cout<<ans ;




}


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

unsigned long dp[100][8 + 2] = {{0}};
int fib[] = {1, 1, 2, 3, 5, 8, 13, 21};

int main(){
  short H, W, K;

  cin >> H >> W >> K;

  dp[0][1] = 1;
  for(int i = 1; i <= H; ++i){
    for(int j = 1; j <= W; ++j){
      dp[i][j] =   dp[i - 1][j - 1] * fib[j - 2] * fib[W - j]
                   + dp[i - 1][j]      * fib[j - 1] * fib[W - j]
                   + dp[i - 1][j + 1] * fib[j - 1] * fib[W - j - 1];
      dp[i][j] %= 1000000007;
    }
  }

  cout << dp[H][K] << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
string s;
long mod=1e9+7,dp[3333][3333];
int n;
main()
{
	cin>>n>>s;
	dp[0][0]=1;
	for(int i=1;i<n;i++)
	{
		if(s[i-1]=='<')
		{
			long now=0;
			for(int j=1;j<=i;j++)
			{
				now=(now+dp[i-1][j-1])%mod;
				dp[i][j]=now;
			}
		}
		else
		{
			long now=0;
			for(int j=i;j>=0;j--)
			{
				now=(now+dp[i-1][j])%mod;
				dp[i][j]=now;
			}
		}
	}
	long ans=0;
	for(int i=0;i<n;i++)ans=(ans+dp[n-1][i])%mod;
	cout<<ans<<endl;
}

Measured memory_bytes: 78464
#include <iostream>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

struct agg{
  int sol,tim,num;
  int wrg[11];
};

class ctr{
public:
  bool operator()(const agg& left,const agg& right)const{
    if(left.sol == right.sol && left.tim == right.tim){
      return left.num > right.num;
    }
    else if(left.sol == right.sol) return left.tim < right.tim;
    else return left.sol > right.sol; 
  }
};

void init(int n,vector<agg> *trg){
  for(int i=1;i<n+1;i++){
    (*trg)[i].sol = 0;
    (*trg)[i].tim = 0;
    (*trg)[i].num = i;
    memset((*trg)[i].wrg,0,sizeof((*trg)[i].wrg));
  }
}

int main(){
  int M,T,P,R;
  while(cin >> M >> T >> P >> R,M||T||P||R){
    vector<agg>info(T+1);
    init(T,&info);

    while(R--){
      int m,t,p,j;
      cin >> m >> t >> p >> j;
      if(j == 0){
	info[t].tim += info[t].wrg[p] * 20 + m;
	info[t].sol++;
      }
      else info[t].wrg[p]++;
    }

    sort(info.begin()+1,info.end(),ctr());
    for(int i=1;i<T;i++){
      cout << info[i].num;
      cout << (info[i].sol == info[i+1].sol && info[i+1].tim == info[i].tim ? '=' : ',');
    }
    cout << info[T].num <<  endl;
  }
}
      

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


    class A
    {
        public static void Main(string[] args)
        {
            var c = new ConsoleInput(Console.In);

            int N = c.ReadInt;
            int M = c.ReadInt;

            if (N == M)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }

Measured memory_bytes: 27892
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int a,b,c; 
    cin>>a>>b>>c;
    if(a>b) swap(a,b); 
    if(a>c) swap(a,c); 
    if(b>c) swap(b,c);

    int ans;
    if((2*c-a-b)%2==0){
        ans=(2*c-a-b)/2;
    }
    else{
        ans=(2*c-a-b+3)/2;
    }
    cout<<ans<<endl;
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()
 
using namespace std;

int main() {		
	ll res = 0;
	int k;
	scanf ("%d", &k);
	rep(i, 1, k)
		rep(j, 1, k)
			rep(g, 1, k)
				res += __gcd(i, __gcd(j, g));
	printf ("%lld\n", res);
	
	
	return 0;
}


Measured memory_bytes: 3840