akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        //modをかける場所がわからない
        int N = int.Parse(Console.ReadLine());
        long[] A = new long[N];
        string[] str = Console.ReadLine().Split();
        for (var i = 0; i < N; i++)
        {
            A[i] = long.Parse(str[i]);
        }
        
        long ans = 0;
        int mod = (int)1e9 + 7;

        // bit列60桁分をすべて走査する
        for (int k = 0; k < 60; k++)
        {
            long x0 = 0;
            long x1 = 0;
            for (int i = 0; i < N; i++)
            {
                // k桁目をビット演算で取り出す
                var x = (A[i] >> k) & 1;
                // k桁目が 0, 1 のどちらかを数えておく
                if (x == 0) x0 += 1;
                else x1 += 1;
            }

            long p = 1;
            for (int i = 0; i < k; i++)
            {
                p *= 2;
                p %= mod;
            }
            // x0 * x1 が 0, 1 の組み合わせ数
            var count = (x0 * x1) % mod; //ここでmodしているのは2の0乗分を計算している
            ans += count * p; //modは2の1乗分から
            ans %= mod;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 50120
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
#define REP(i,m,n) for(LL i=(m);i<(n);i++)

int main(){
  LL n,x,t;
  cin >> n >> x >> t;
  
  if(n%x == 0){
    cout << (n/x)*t << endl;
  }
  else{
    cout << ((n/x)+1)*t << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3592
N = int(input())
lists = list(map(int,input().split()))

a = 0
while(True):
	
	b = 0
	for i in lists:
		if i % 2 ==1:
			b += 1
			
	if b == 0:
		a += 1
		lists = [ i / 2 for i in lists]
	else:
		break
print(a)

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <bitset>
#include <string>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <list>
#include <deque>
using namespace std;
#define INF 10000000
#define LLINF 100000000000000
typedef pair<int, int> P;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define VSORT(v) sort(v.begin(), v.end());
#define fi first
#define se second
#define out(x) cout << x << endl;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0,1,0,-1 };
ll MOD = 1000000007;
struct edge {
	ll from, to, cost;
};
int v, e, k;
vector<P> es[100005];
int d[3005] = { 0 };



int main() {
	cin >> v >> e >> k;
	rep(i, v) d[i] = INF;
	int res = 0;
	rep(i, e) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		es[a].push_back(P(b, c));
		es[b].push_back(P(a, c));
	}
	priority_queue<P, vector<P>, greater<P>>que;
	rep(i, k) {
		int s;
		cin >> s;
		s--;
		que.push(P(0, s));
		d[s] = 0;
	}
	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int V = p.second;
		if (d[V] < p.first) continue;
		for (int u = 0; u < es[V].size(); u++) {
			int to = es[V][u].first;
			int cost = es[V][u].second;
			if (d[to] > d[V] + cost) {
				d[to] = d[V] + cost;
				que.push(P(d[to], to));
			}
		}
	}
	rep(i, v) {
		for (int u = 0; u < es[i].size(); u++) {
			int to = es[i][u].first;
			int cost = es[i][u].second;
			int tmp = (d[to] + cost + d[i] + 1) / 2;
			res = max(res, tmp);
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 8248
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int K, T;
  cin >> K >> T;
  vector<int> A(T);
  for (int i = 0; i < T; i++) {
    cin >> A[i];
  }
  sort(all(A));
  cout << max(A.back() - 1 - (K - A.back()), 0) << endl;
  return 0;
}

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

int main(){

    string s;
    cin >> s;
    string t = s;
    reverse(s.begin(), s.end());
    if(s == t) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    A, B = li_input()

    A = A if A != 1 else 14
    B = B if B != 1 else 14

    if A > B:
        print("Alice")
    elif A < B:
        print("Bob")
    else:
        print("Draw")


main()


Measured memory_bytes: 4820
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxx = 110;

int main()
{
	int n, m[maxx][maxx];
	int u, num, v;
	scanf("%d", &n);
	memset(m, 0, sizeof(m));
	for (int i = 1; i <= n; i++) {
		scanf("%d %d", &u, &num);
		for (int j = 1; j <= num; j++) {
			scanf("%d", &v);
			m[u][v] = 1;
		}
	}

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			printf("%d%c", m[i][j], j == n ? '\n' : ' ');
		
	return 0;
}

Measured memory_bytes: 3264
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, p1, p2,x;

            var word = Console.ReadLine().Split(' ');

            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);

            p1 = a * n;
            p2 = b;

            x = p1 - p2;
            if (p1 < p2)
                Console.WriteLine(p1);
            else
                Console.WriteLine(p2);
            

            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11092
while True:
    n, x = map(int, input().split())

    if n == 0 and x == 0:
        break

    ans = 0
    for i in range(1, n+1):
        for j in range(1, n+1):
            tmp = x-(i+j)
            if i+j+tmp == x and 1 <= tmp <= n:
                if i != j and i != tmp and j != tmp:
                    ans += 1
    print(ans//6)



Measured memory_bytes: 5596
#include <cstdio>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

vector<int> G[100010];
vector<bool> serched(100010, false);
map<P, int> color;
vector<P> vp;
vector<int> vc(100010, 0);
int ans = 0;

void bfs(int s)
{
    queue<int> q;
    int p;
    int c;

    q.push(s);

    while (q.size())
    {
        p = q.front();
        q.pop();

        serched[p] = true;

        c = 1;

        for (auto &x : G[p])
        {
            if (serched[x] == false)
            {
                q.push(x);

                if (vc[p] == c)
                {
                    c++;
                }

                color.insert(make_pair(P(p, x), c));
                color.insert(make_pair(P(x, p), c));
                vc[x] = c;
                ans = max(ans, c);
                c++;
            }
        }
    }
}

int main(void)
{
    int n;
    int a, b;
    int i;

    cin >> n;

    rep(i, 1, n)
    {
        cin >> a >> b;

        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a, b);
    }

    bfs(1);

    cout << ans << endl;

    for (auto &x : vp)
    {
        cout << color.at(x) << endl;
    }
}

Measured memory_bytes: 20464
import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
ki =[[] for _ in range(N)]
ab = []
dict = {}
k = 0
def dfs(v, p = 0, ban_color = 0):
    global k
    color = 1
    for i in ki[v]:
        if i == p:
            continue
        if ban_color == color:
            color += 1
        dict[(v, i)] = color
        dfs(i, v, color)
        color += 1
    k = max(k, color - 1)
    return


for i in range(N - 1):
    a, b = map(int, input().split())
    ki[a - 1].append(b - 1)
    ki[b - 1].append(a - 1)
    ab.append((a - 1, b - 1))

dfs(0)
print(k)
for key in ab:
    print(dict[key])

Measured memory_bytes: 91444
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)

A,B,C,D = map(int,input().split())
all_count = B-A+1
c_count = B//C - (A-1)//C
d_count = B//D - (A-1)//D
cd_count = B//lcm(C,D) - (A-1)//lcm(C,D)
ans = all_count - c_count - d_count + cd_count
print(ans)

Measured memory_bytes: 5076
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int a,b,h;cin >> a >> b >> h;
  cout << (a+b)*h/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int K;
    long long ans=0;
    cin >>K;
    for(int i=1;i<=K;i++){
        
        for(int j=1;j<=K;j++){
            
            for(int k=1;k<=K;k++){
                int nGCD= __gcd(i,j);
                int mGCD=__gcd(nGCD,k);
                ans+=mGCD;
            }
        }   
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  #define int ll
  
  int n;cin>>n;
  int a[(int)1e7];rep(i,n)cin>>a[i];
  sort(a,a+n,greater<int>());
  
  int aMax = a[0];
  bool b[(int)1e7];
  rep(i,aMax+100)b[i] = true;
  rep(i,n){
    while(i < n-1 && a[i] == a[i+1]){
      b[a[i++]] = false;
    }

    int tmp = a[i];
    while(tmp <= aMax){
      tmp += a[i];
      b[tmp] = false;
    }
  }

  int cnt = 0;
  rep(i,n){
    if(b[a[i]])cnt++;
  }
  print(cnt);

  return 0;
}


Measured memory_bytes: 6940
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main() {
    input! {
        n: usize,
        h: [i32; n],
    }

    let mut dp = vec![0; n+1];

    dp[1] = (h[1]-h[0]).abs();
    
    for i in 2..n {
        dp[i] = cmp::min(dp[i-1] + (h[i]-h[i-1]).abs(), dp[i-2] + (h[i]-h[i-2]).abs());

    }

    println!("{}", dp[n-1]);

}



Measured memory_bytes: 4352
let is_even n = (n mod 2 = 0)

let () =
	Scanf.scanf "%d %d %d\n" (fun a b c ->
		if List.exists is_even [a; b; c] then
			Printf.printf "0\n"
		else
			List.sort compare [a * b; b * c; c * a]
			|> List.hd
			|> Printf.printf "%d\n"
	)


Measured memory_bytes: 384
#include <cstdio>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

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

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-9;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac & bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}

int main() {
  int n;
  scanf("%d", &n);
  REP(j, n) {
    VP a;
    REP(i, 3) {
      double x,y;
      scanf("%lf %lf", &x, &y);
      a.push_back(P(x,y));
    }
    P M = (a[0]+a[1])/(P)2;
    P N = (a[1]+a[2])/(P)2;
    P M_v = normal_vector(a[0]-a[1]);
    P N_v = normal_vector(a[1]-a[2]);

    P o = crosspoint(M, N, M+M_v, N+N_v);
    
    printf("%.3lf %.3lf %.3lf\n", o.X, o.Y, distPP(o,a[0]));
    a.clear();
  }
  return 0;
}

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

const string YES = "YES";
const string NO = "NO";

void solve(long long A, long long V, long long B, long long W, long long T)
{
    if (V <= W || abs(B - A) > (V - W) * T)
        cout << NO << endl;
    else
        cout << YES << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long A;
    scanf("%lld", &A);
    long long V;
    scanf("%lld", &V);
    long long B;
    scanf("%lld", &B);
    long long W;
    scanf("%lld", &W);
    long long T;
    scanf("%lld", &T);
    solve(A, V, B, W, T);
    return 0;
}


Measured memory_bytes: 3692
import heapq

n = int(input())
abs = [tuple(map(int, input().split())) for _ in range(n)]

pq = []

for ab in abs:
  a,b = ab[0],ab[1]
  heapq.heappush(pq, tuple([b,a]))
  
dl = 0
tc = 0

ans = "Yes"

for i in range(n):
  ba = heapq.heappop(pq)
  dl = ba[0]
  tc += ba[1]
  if dl < tc:
    ans = "No"
    break
print(ans)

Measured memory_bytes: 42960
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
const ll INF = 1e16;

void solver(ll N, ll M, ull &ans){

    if(N > 2){
        if(M > 2) ans = (N-2)*(M-2);
        else if(M == 2) ans = 0;
        else ans = N-2;
    }
    else if(N == 2) ans = 0;
    else{
        if(M > 2) ans = M-2;
        else if(M == 2) ans = 0;
        else ans = 1;
    }

    return;
}

int main(){

    ll N, M;
    cin >> N >> M;

    ull ans;
    solver(N, M, ans);

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

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

bool check(int x,vector<int> vec){
  int input,num;
  input = x;
  while(input!=0){
    num = input%10;
    for(int j=0; j<vec.size(); j++){
      if(vec.at(j)==num) return true;
    }
    input = input/10;
  }
  
  return false;
}
int main(){
  int N,K;
  vector<int> vec;
  cin >> N >> K;
  int num;
  for(int i=0;i<K;i++){
    cin >> num;
    vec.push_back(num);
  }
  bool res = true;
  while(res){
    res = check(N,vec);
    if(res) N++;
  }
  cout << N << endl;
}

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

using namespace std;

int main(void) {
    int N;
    string S;
    cin >> N >> S;
    S.insert(0, "_");

    vector<int> E(N+2), W(N+2);
    for(int i=1; i<=N; i++) {
        if(S[i] == 'W') {
            W[i] = W[i-1] + 1;
        } else {
            W[i] = W[i-1];
        }
    }
    for(int i=N; i; i--) {
        if(S[i] == 'E') {
            E[i] = E[i+1] + 1;
        } else {
            E[i] = E[i+1];
        }
    }

    int ans = numeric_limits<int>::max();
    for(int i=1; i<=N; i++) {
        ans = min(ans, W[i-1] + E[i+1]);
    }

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


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

int main(){
    int N;
    cin >> N;
    int tmp = N-1;
    vector <int> A(N);
    vector <int> B(N);
    vector <int> C(N-1);
    int result = 0;
    // cout << 1 << endl;

    for (size_t i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    // cout << 2 << endl;
    
    for (size_t i = 0; i < N; i++)
    {
        cin >> B.at(i);
    }

    // cout << 3 << endl;

    for (size_t i = 0; i < N-1; i++)
    {
        cin >> C.at(i);
    }

    for (size_t i = 0; i < N; i++)
    {
        result += B.at(A.at(i)-1);
        if(i != 0 && A.at(i) - 1 == A.at(i - 1) - 1 + 1){
            result += C.at(A.at(i-1)-1);
        }
    }
    cout << result << endl;
    

    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n;
    cin >> n;
    string ans = "";
    while(n>0){
        n--;
        char tmp = n%26 + 'a';
        ans = tmp + ans;
        n /= 26;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define int long long

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	int ans = n;
	for (int i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ans = min(ans, i + n / i - 2);
		}
	}
	cout << ans << endl;
}


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

bool used[604];
vector<int> v[604], rv[604];
int k;

int main()
{
    int n, m;
    cin >> n >> m;
    int s[200004], t[200004];
    double d[200004] {0};
    double e[200004] {0};
    for(int i = 0; i < m; i++){
        cin >> s[i] >> t[i];
        s[i]--;
        t[i]--;
        v[s[i]].push_back(t[i]);
        rv[t[i]].push_back(s[i]);
    }
    d[n - 1] = 0;
    for(int i = n - 1; i >= 0; i--){
        for(int pre : rv[i]){
            d[pre] += (d[i] + 1) * 1.0 / (int)v[pre].size();
        }
    }
    double ans = d[0];
    for(int i = n - 2; i >= 0; i--){
        if((int)v[i].size() == 1) continue;
        int arg;
        double ma = 0;
        for(int to : v[i]){
            if(d[to] >= ma){
                ma = d[to];
                arg = to;
            }
        }
        fill(e, e + n, 0.0);
        for(int j = n - 1; j >= 0; j--){
            for(int pre : rv[j]){
                if(pre == i){
                    if(j == arg) continue;
                    e[pre] += (e[j] + 1) * 1.0 / ((int)v[pre].size() - 1);
                }
                else e[pre] += (e[j] + 1) * 1.0 / (int)v[pre].size();
            }
        }
        ans = min(ans, e[0]);
    }
    cout << fixed << setprecision(15) << ans << endl;
}


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

using namespace std;

const int N = 1e3 + 3;

int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
#endif
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	if (abs(a - b) % 2) {
		puts("Borys");
	}else{
		puts("Alice");
	}
	return 0;
}



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

void solve(string c){
	if (c == "a" or c == "e" or c == "i" or c == "o" or c == "u") {
		cout << "vowel" << endl;	
	} else {
		cout << "consonant" << endl;
	}	
}

int main(){	
	string c;
	cin >> c;
	solve(c);
	return 0;
}



Measured memory_bytes: 256
# Vi > Ciのとき、Vi-Ciを全部足す

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i in range(N):
    if V[i] > C[i]:
        ans += V[i] - C[i]

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

void reduce(vector<vector<ll> >& x){ // returns determinant
	int n=x.size(),m=x[0].size();
	int i=0,j=0;//double r=1.;
	while(i<n&&j<m){
		int l=i;
		fore(k,i+1,n)if(abs(x[k][j])>abs(x[l][j]))l=k;
		if(abs(x[l][j])==0){j++;/*r=0.;*/continue;}
		if(l!=i){swap(x[i],x[l]);}
		//r*=x[i][j];
		//for(int k=m-1;k>=j;k--)x[i][k]/=x[i][j];
		fore(k,0,n){
			if(k==i)continue;
			for(int l=m-1;l>=j;l--)x[k][l]=(x[k][l]+x[k][j]*x[i][l])&1;
		}
		i++;j++;
	}
	//return r;
}

ll solve(vector<ll> &a, vector<ll> &b){
	vector<vector<ll>>m;
	for(auto i: a){
		vector<ll> v;
		fore(j,0,60){
			if((1ll<<j)&i)v.pb(1);
			else v.pb(0);
		}
		m.pb(v);
	}
	ll d=0;
	if(SZ(m)){
		reduce(m);
		for(auto i: m){
			ll tot=0;
			for(auto j:i)tot+=j;
			d+=(tot!=0);
		}	
	}
	for(auto i: b){
		vector<ll> v;
		fore(j,0,60){
			if((1ll<<j)&i)v.pb(1);
			else v.pb(0);
		}
		m.pb(v);
	}
	reduce(m);
	for(auto i: m){
		ll tot=0;
		for(auto j:i)tot+=j;
		d-=(tot!=0);
	}
	return d>=0;
}

int main(){FIN;
	ll t; cin>>t;
	while(t--){
		ll n; cin>>n;
		ll a[n];
		fore(i,0,n)cin>>a[i];
		string s; cin>>s;
		vector<ll> v[2];
		ll br=0;
		reverse(ALL(s));
		reverse(a,a+n);
		fore(i,0,n){
			v[s[i]-'0'].pb(a[i]);
			if(i==n-1||(s[i]=='1'&&s[i+1]=='0')){
				if(!solve(v[0],v[1])){
					cout<<1<<"\n"; br++; break;
				}
			}
		}
		if(br)continue;
		cout<<0<<"\n";
	}
	
	return 0;
}

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

ans = 0
for i in range(1, N + 1):
    j = i
    l = []
    while i > 0:
        l.append(i % 10)
        i //= 10

    c = sum(l)
    if c >= A and c <= B:
        ans += j

print(ans)

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
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 II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

factorization(24)

def solve():
    A, B = LI()

    if A == 1 and B == 1:
        print(1)
        return

    a_primes = factorization(A)
    b_primes = factorization(B)

    dprint(a_primes)
    dprint(b_primes)

    print(len(set([x[0] for x in a_primes])&set([y[0] for y in b_primes]))+1)
solve()

Measured memory_bytes: 3064
N, W = map(int, input().split())
v = []
w = []
for _ in range(N):
    a, b = map(int, input().split())
    v.append(a)
    w.append(b)

dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
    for j in range(W+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j+w[i] <= W:
            dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j]+v[i])

print(dp[N][W])


Measured memory_bytes: 41892
#include<stdio.h>
#include<stdlib.h>
#define N 100


void push(int);
int pop(void);
int top=0,in[N];

int main(){

  char ch[N];
  int i,anum,bnum;

  i=0;

  while(scanf("%s",ch)!=EOF){
    if(ch[i]=='+'){
      anum=pop();
      bnum=pop();
      push(anum + bnum);
    }else if(ch[i]=='-'){
      anum=pop();
      bnum=pop();
      push(bnum - anum);
    }else if(ch[i]=='*'){
      anum=pop();
      bnum=pop();
      push(anum * bnum);
    }else{
      push(atoi(ch));
    }
    
  }

  printf("%d\n",pop());

  return 0;
}

void push(int a){
  top++;
  in[top]=a;
}

int pop(void){
  top--;
  return in[top+1];
}



Measured memory_bytes: 2108
A,B,C = (int(i) for i in input().split())

Addition = A+B+C
if Addition != 17:
    haiku = False
else:
    if ((A==5 or A==7) and (B==5 or B==7) and (C==5 or C==7)):
        haiku = True
    else:
        haiku = False
    
if haiku:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
#include <stdio.h>

int main(void) {
    char s[128];
    long k;
    long i;

    fgets(s, 128, stdin);
    scanf("%ld", &k);

    for (i = 0; s[i] == '1'; i++)
        ;

    if (k < i + 1)
        printf("1\n");
    else
        printf("%c\n", s[i]);

    return 0;
}


Measured memory_bytes: 128
'use strict'

const INF = 900719925474099;
function mapint(temp){
  return temp.split(' ').map((v)=>parseInt(v));
}

function Main(input){
  let temp = input.trim();
  let r = parseInt(temp);
  console.log(3*r*r);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 22076
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    
    int n,sum = 0;
    cin >> n;
    
    for(int i = 0; i < 9; i++){
        sum += fmod((n/pow(10,i)),10);
    }
    
    if(n % sum){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int i;
    for(i=1;i<=9;i++){
        printf("1x%d=%d\n",i,1*i);
    }
    for(i=1;i<=9;i++){
        printf("2x%d=%d\n",i,2*i);
    }
    for(i=1;i<=9;i++){
        printf("3x%d=%d\n",i,3*i);
    }
    for(i=1;i<=9;i++){
        printf("4x%d=%d\n",i,4*i);
    }
    for(i=1;i<=9;i++){
        printf("5x%d=%d\n",i,5*i);
    }
    for(i=1;i<=9;i++){
        printf("6x%d=%d\n",i,6*i);
    }
    for(i=1;i<=9;i++){
        printf("7x%d=%d\n",i,7*i);
    }
    for(i=1;i<=9;i++){
        printf("8x%d=%d\n",i,8*i);
    }
    for(i=1;i<=9;i++){
        printf("9x%d=%d\n",i,9*i);
    }
    return 0;
}


Measured memory_bytes: 2148
import java.util.*;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        Map<Integer, Set<Integer>> fathers = new HashMap<>();
        Map<Integer, Set<Integer>> sons = new HashMap<>();
        Set<Integer> roots = new HashSet<>();
        int [] fatherCounts = new int[n + 1];
        for (int i = 1; i <= n; ++i) {
            roots.add(i);
        }
        for (int i = 0; i < n + m - 1; i++) {
            int u = scanner.nextInt();
            int v = scanner.nextInt();
            Set<Integer> descendants = sons.getOrDefault(u, new HashSet<>());
            descendants.add(v);
            sons.put(u, descendants);
            roots.remove(v);
            ++fatherCounts[v];
            Set<Integer> parents = fathers.getOrDefault(v, new HashSet<>());
            parents.add(u);
            fathers.put(v, parents);
        }
        int root = -1;
        for (final int r : roots) {
            root = r;
        }
        int [] reorder = new int[n];
        int numNode = 0;
        reorder[numNode++] = root;
        Map<Integer, Integer> nodeReorder = new HashMap<>();
        nodeReorder.put(root, 0);
        for (int i = 0; i < numNode; ++i) {
            for (int son : sons.getOrDefault(reorder[i], new HashSet<>())) {
                if (--fatherCounts[son] == 0) {
                    reorder[numNode] = son;
                    nodeReorder.put(son, numNode);
                    ++numNode;
                }
            }
        }

        for (int i = 1; i <= n; ++i) {
            if (!fathers.containsKey(i)) {
                System.out.println(0);
                continue;
            }
            int fatherWithMaxReorder = -1;
            for (int father : fathers.get(i)) {
                if (fatherWithMaxReorder == -1 || nodeReorder.get(father) > nodeReorder.get(fatherWithMaxReorder)) {
                    fatherWithMaxReorder = father;
                }
            }

            System.out.println(fatherWithMaxReorder);
        }

    }
}


Measured memory_bytes: 173344
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;#include <stdio.h>
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;


int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================

	int N, K;
	cin >> N >> K;



	cout << N-K+1;

}




Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> f = new ArrayList<Integer>();
		
		long ans = 0;
		
		for(int i = 1; i <= N; i ++) {
			long Y = (int) Math.floor((double) N / i);
			ans += Y * (Y + 1) * i / 2;
		}
		
		System.out.println(ans);
		
	}
}

Measured memory_bytes: 35836
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <string>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
int main() {
	string s;
	cin >> s;
	if (s[0] != s[1] && s[0] != s[2] && s[1] != s[2])
		puts("Yes");
	else
		puts("No");
	return 0;
}

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

int main(){
    //FILE *inp = freopen("in.txt", "r", stdin);
    char str[100];
    stack<long>st;
    while(scanf("%s", str) != EOF){
        if(strcmp(str, "+")==0){
            long b = st.top();
            st.pop();
            long a = st.top();
            st.pop();
            st.push(a+b);
        }
        else if(strcmp(str, "-")==0){
            long b = st.top();
            st.pop();
            long a = st.top();
            st.pop();
            st.push(a-b);
        }
        else if(strcmp(str, "*")==0){
            long b = st.top();
            st.pop();
            long a = st.top();
            st.pop();
            st.push(a*b);
        }
        else{
            st.push(atoi(str));
        }
    }
    cout << st.top() << endl;
    //fclose(inp);
    return 0;
}

Measured memory_bytes: 3192
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int a = inp.nextInt();
        int b = inp.nextInt();
        if (a == 1) a = 14;
        if (b == 1) b = 14;
        if (a > b) System.out.println("Alice");
        else if (a == b) System.out.println("Draw");
        else System.out.println("Bob");
    }
}

Measured memory_bytes: 23764
n,m = map(int,input().split())
d = [-1 for _ in range(n)]
for i in range(m):
  si,ci = map(int,input().split())
  if d[si-1] == -1:
    d[si-1] = ci
  elif d[si-1] != ci:
    print(-1)
    exit()
if n == 1 and d[0] == 0:
  print(0)
  exit()
if n == 1 and d[0] == -1:
  print(0)
  exit()
s = 0
if d[0] == 0:
  print(-1)
  exit()
if d[0] == -1:
  s += 1*10**(n-1)
else:
  s += d[0]*10**(n-1)
for i in range(1,n):
  if d[i] != -1:
    s += d[i]*10**(n-i-1)
print(s)

Measured memory_bytes: 38384
from math import ceil
P = [int(input()) for _ in range(6)]
N,A,B,C,D,E = P[0],P[1],P[2],P[3],P[4],P[5]
N2,N3,N4,N5,N6 = ceil(N/A),ceil(N/B),ceil(N/C),ceil(N/D),ceil(N/E)

ans = max(N2,N3,N4,N5,N6) + 4
print(ans)

Measured memory_bytes: 3064
n = gets.chomp.to_i
str = gets.chomp
s = str.split('')
sh = ""
if n == 1
  puts "No"
else
  n = n/2
  i = 0
  while i < n
    sh += s[i]
    i += 1
  end
  if sh*2 == str
    puts "Yes"
  else
    puts "No"
  end
end

Measured memory_bytes: 14220
#include<stdio.h>

void PrintRectangle(int H ,int W)
{
	int i,j;
	
	for(i=1;i<=H;i++){
		for(j=1;j<=W;j++){
			printf("#");
		}
		printf("\n");
	}
	printf("\n");
}

int main(void)
{
	int H,W;
	int i,j;
	
	while(1){
		scanf("%d %d", &H, &W);
		if(H == 0 && W == 0){
			break;
		}
		PrintRectangle(H,W);
	}
	return 0;
}

Measured memory_bytes: 572
#include<cstdio>
#include<cmath>
#define ll long long
#define N 100010
using namespace std;

double n,A,B;
double c[N],h[N];

bool judge(double x){
  for(int i=1;i<=n;i++){
    c[i]=h[i]-x*B;
  }
  double ret=0;
  for(int i=1;i<=n;i++){
    if(c[i]>0){
      ret+=ceil(c[i]/(A-B));
    }
  }
  return ret<=x;
}

int main(){
  scanf("%lf%lf%lf",&n,&A,&B);
  for(int i=1;i<=n;i++) scanf("%lf",&h[i]);
  ll l=0,r=n*1e9+1000,ans,mid;
  while(l<=r){
    mid=(l+r)>>1;
    if(judge(mid)){
      ans=mid;
      r=mid-1;
    }else{
      l=mid+1;
    }
  }
  printf("%lld\n",(long long)ans);
  return 0;
}

Measured memory_bytes: 1792
//Let's join Kaede Takagaki Fan Club !!
//明日は高垣楓さんの誕生日！おめでとうございます！！！
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}

int main(){
	string s; cin >> s;
	rep(i, 3) cout << s[i] ;
	cout << endl;
}

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

#define int long long
#define fs first
#define sc second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define len(v) ((int)v.size())
#define vc vector
#define pr pair
#define endl "\n"
#define endd "\n"; return 0;
#define all(v) v.begin(), v.end()

using namespace std;

const int MAXN = 1e5;
const int INF = 1e10;
const int MOD = 1e9 + 7;

main() {
    ios_base::sync_with_stdio(0);
    string a, b, c;
    cin >> a >> b >> c;
    if (a[len(a) - 1] == b[0] && b[len(b) - 1] == c[0]) {
        cout << "YES";
    } else {
        cout << "NO";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using boost::multiprecision::cpp_int;
using namespace std;
#define ll long long int
#define F first
#define S second
//#define endl "\n"
//#define nl cout<<endl;
#define pb push_back
#define ull unsigned long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define mod 100000007
#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 
bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
    return false;
}
bool cmp(int n, pair<int, int> const& p)
{
    return (p.first < n);
}
//me
ll const mod = 1e9+7;//998244353;
ll const inf = 1e18;
ll const maxn = 1e5+1;


void solve()
{    
     
     ll a; cin >> a;
     cout << (a^1);

}

int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/ 
        
          ll t;
          /**/t=1;
          /*/cin>>t;/**/
          f(testcases,0,t){
               //cout << "Case #" <<testcases+1<<": ";
               solve();
          }
 
 
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		double r = sc.nextDouble();

		sc.close();

		double pi = Math.PI;

		double area = r * r * pi;
		double cir = 2 * pi * r;

		System.out.println(String.format("%.6f", area) + " " + String.format("%.6f", cir));

	}

}



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

using namespace std;
using ll = long long;

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

vector<int> abcd(4);
vector<char> op(4);

bool flag = false;

int rec(int x, int round) {
    if (round == 4) {
        if (x == 7) {
            return 1;
        }
        return 0;
    } 
    if (flag) return 0;

    op.at(round - 1) = '+';
    if (rec(x + abcd.at(round), round + 1)) {
        cout << abcd.at(0) << op.at(0) << abcd.at(1) << op.at(1) << abcd.at(2) << op.at(2) << abcd.at(3) << "=7" << endl;
        flag = true;
        return 0;
    }
    op.at(round - 1) = '-';
    if (rec(x - abcd.at(round), round + 1)) {
        cout << abcd.at(0) << op.at(0) << abcd.at(1) << op.at(1) << abcd.at(2) << op.at(2) << abcd.at(3) << "=7" << endl;
        flag = true;
        return 0;
    }

    return 0;
}

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

    int x; cin >> x;
    abcd.at(3) = x %10;
    abcd.at(2) = (x / 10) % 10;
    abcd.at(1) = (x / 100) % 10;
    abcd.at(0) = (x / 1000) % 10;

    rec(abcd.at(0), 1);

    return 0;
}

Measured memory_bytes: 256
/*
 * ALDS1_4_C.cpp
 *
 *  Created on: Apr 26, 2018
 *      Author: 13743
 */

#include<cstdio>

using namespace std;

const int SIZE = 1045527;
int table[SIZE];

int getKey(char* s) {
	int key = 0;
	int exp = 1;
	for(int i=0; s[i]!='\0'; i++) {
		switch(s[i]) {
		case 'A': key += 4 * exp; break;
		case 'C': key += 3 * exp; break;
		case 'G': key += 2 * exp; break;
		default: key += 1 * exp; break;
		}
		exp *= 5;
	}
	return key;
}

void insert(char* s) {
	int key = getKey(s);
	int hash = key % SIZE;
	while(true) {
		if(table[hash] == 0 || table[hash] == key) {
			table[hash] = key; break;
		}
		hash = (hash + (1 + (key%(SIZE-2)))) % SIZE;
	}
}

bool find(char* s) {
	int key = getKey(s);
	int hash = key % SIZE;
	int i=0;
	while(true) {
		if(table[hash] == key) {
			return true;
		}
		else if(table[hash] == 0) {
			return false;
		}
		hash = (hash + (1 + (key%(SIZE-2)))) % SIZE;
	}
	return false;
}

int main() {
	int n;
	scanf("%d", &n);
	char d[10];
	char s[13];
	for(int i=0; i<n; i++) {
		scanf("%s %s", d, s);;
		if(d[0] == 'i') {
			insert(s);
		}
		else {
			if(find(s)) printf("yes\n");
			else printf("no\n");
		}
	}
}





Measured memory_bytes: 6588
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){int a,b,c;
cin>>a>>b>>c;
if(a>b)swap(a,b);
if(b>c)swap(b,c);
if(a>b)swap(a,b);
if(a==5&&b==5&&c==7)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            int n = S.length();
            long ans = 0;
            long[] a = new long[n + 1];
            for (int i = 0; i < n; i++) {
                if (S.charAt(i) == '<') {
                    a[i + 1] = a[i] + 1;
                }
            }
            for (int i = n - 1; i >= 0; i--) {
                if (S.charAt(i) == '>') {
                    if (a[i + 1] >= a[i]) {
                        a[i] = a[i + 1] + 1;
                    }
                }
            }

            // 出力
            for (long num : a) {
                ans += num;
            }
            out.println(ans);

        }

    }
}



Measured memory_bytes: 46412