akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    ll n = s.size(), m = t.size();
    vector<vector<int>> index(30);
    for (ll i = 0; i < n; i++)
    {
        index[s[i] - 'a'].push_back(i+1);
    }
    ll ans = 0;
    ll last = 0;

    for (ll i = 0; i < m; i++)
    {
        if (index[t[i] - 'a'].size() != 0)
        {
            ll nextIndex = upper_bound(ALL(index[t[i] - 'a']), last) - index[t[i] - 'a'].begin();
            ll next;
            if (nextIndex == (ll)index[t[i] - 'a'].size())
            {
                next = index[t[i] - 'a'][0];
                ans += n - last;
                last = next;
                ans += last;
            }
            else
            {
                next = index[t[i] - 'a'][nextIndex];
                ans += next - last;
                last = next;
            }
        }
        else
        {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    deque<ll> inter;
    for (int i = 0; i < K; ++i) {
        inter.push_back(A[i]);
    }
    for (int i = K; i < N; ++i) {
        ll first = inter.front(); inter.pop_front();
        ll last = A[i];
        inter.push_back(A[i]);
        if (first < last) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 6424
import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    R, S, P = map(int, input().split())
    T = input().split()
    Ts = ["" for _ in range(K)]
    for i, c in enumerate("".join(T)):
        Ts[i % K] += c

    ans = 0
    for t in Ts:
        c = t[0]
        if c == "r":
            ans += P
        elif c == "s":
            ans += R
        else:
            ans += S
        for i in range(1, len(t)):
            if t[i] == c:
                c = ""
            else:
                c = t[i]
                if c == "r":
                    ans += P
                elif c == "s":
                    ans += R
                else:
                    ans += S
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 6140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String[] input = br.readLine().split(" ");
            int numberA = Integer.parseInt(input[0]);
            int numberB = Integer.parseInt(input[1]);

            int result = numberB - numberA;
            if (numberB % numberA == 0) {
                result = numberA + numberB;
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 21716
//Optional FAST
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
 
//Required Libraries
 

#include <bits/stdc++.h>
//#include<iostream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
 
//Required namespaces
 
using namespace std;
using namespace __gnu_pbds;
//typedef
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//define
#define pb push_back
#define pf push_front
#define fi first
#define se second
//#define endl '\n'
#define forin(i,a,b) for(long long i=a;i<=b;i++)
#define forde(i,a,b) for(long long i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);

ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2) % MOD;
    p = (p * p) % MOD;

    return (y%2 == 0)? p : (x * p) % MOD;
}
ll modInverse(ll a)
{
   return power(a,MOD-2);
}
vector<ll> pr; 
//ll z[1001][11]={0};
int main()
{/*
    #ifndef ONLINE_JUDGE
       freopen ("input.txt" , "r" , stdin);
		// freopen ("OUTPUT.txt" , "w" , stdout);
	#endif
 */
    fio;
    ll n;
    cin>>n;
    ld a;
    cin>>a;
    cout<<ceil(n/a)<<endl;

}


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

int main(void) {
	int n, a, b, c, d;
	char s[200020] = { 0 };
	int flag = 1;
	int max;

	scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
	scanf("%s", s);
	if (c < d)max = d;
	else max = c;
	for (int i = a ; i < max; i++) {
		if (s[i] == '#' && s[i + 1] == '#') {
			flag = 0;
			break;
		}
	}
	if (c > d) {
		for (int i = b - 1; i < d; i++) {
			if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.')
				break;
			else if (i == d - 1)flag = 0;
		}
	}
	if (flag) printf("Yes");
	else printf("No");
	return 0;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N,M,Q=mi()
    
    count = [[0] * (N+1) for _ in range(N+1)]
    for i in range(M):
        L,R=mi()
        count[L][R] += 1
    
    # print(count)
    dp = [[0] * (N+1) for _ in range(N+1)]

    for w in range(1,N+1):
        for h in range(1,N+1):
            l,r=N+1-w,h
            dp[w][h] += dp[w][h-1] + dp[w-1][h] - dp[w-1][h-1] + count[l][r]


    # print(dp)
    for i in range(Q):
        p,q=mi()
        w,h=N+1-p,q
        # print(w,h)
        print(dp[w][h])

            






if __name__ == "__main__":
    main()

Measured memory_bytes: 78096
n, m, k = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

a = [0]
b = [0]
for i in range(len(A)):
    a.append(a[i] + A[i])

for i in range(len(B)):
    b.append(b[i] + B[i])


# print(a)
# print(b)

j_n = m
ans = 0

for i_n in range(len(a)):
    if a[i_n] > k:
        break

    while b[j_n] > k - a[i_n]:
        j_n -= 1

    ans = max(ans, i_n + j_n)

print(ans)


Measured memory_bytes: 47684
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 25;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
int n, m, d[MAXN][MAXN];
char ch[MAXN][MAXN];

int bfs(int row, int col) {
    queue<II> q;
    FOR(i,1,n)
        FOR(j,1,m) d[i][j] = 1000000000;
    d[row][col] = 0;
    q.push(II(row, col));
    int res = 0;
    while (SZ(q)) {
        II r = q.front(); q.pop();
        FOR(i,0,3) {
            int u = r.FI + dx[i];
            int v = r.SE + dy[i];
            if (u >= 1 && u <= n && v >= 1 && v <= m && ch[u][v] != '#')
                if (d[u][v] > d[r.FI][r.SE] + 1) {
                    d[u][v] = d[r.FI][r.SE] + 1;
                    res = max(res, d[u][v]);
                    q.push(II(u, v));
                }
        }
    }
    return res;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n)
        FOR(j,1,m) cin >> ch[i][j];
    int res = 0;
    FOR(i,1,n)
        FOR(j,1,m)
            if (ch[i][j] == '.') res = max(res, bfs(i,j));
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #define cerr if(false)cerr
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> ii;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vii;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vector<ld>> vvld;
typedef vector<bool> vbl;
typedef vector<vbl> mbl;
#define ff first
#define ss second
#define pb emplace_back
#define mp make_pair
#define all(s) (s).begin(), (s).end()
#define minel(a) *min_element(all(a))
#define maxel(a) *max_element(all(a))
#define pq(t) priority_queue<t, vector <t>, greater <t>>
#define pqd(t) priority_queue<t>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))      // Used to iterate over the types

const ll mod = 1e9 + 7;
const ll mx = 1e18;
const ll inf = 1e7;

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// For printing variables and their respective values

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}

template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

auto mods() { return 0; }

template<typename T, typename... Args>
auto mods(T a, Args... args) { return (a + mods(args...) + mod) % mod; }

auto modp() { return 1; }

template<typename T, typename... Args>
auto modp(T a, Args... args) { return ( a * modp(args...) )% mod; }
// ! inputs should be positive and less than `mod`.

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// !Taking `int` input

template<typename T>
T nxt(){
    T x;
    cin >> x;
    return x;
}

//  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

inline void solve()
{
    int k = nxt<int>(), s = 0;
    for (int i = 1; i <= 1e6 + 1; i++)
    {
        s = (s * 10 + 7) % k;
        if (not s)
        {
            cout << i << endl;
            return;
        }
    }
    cout << "-1" << endl;
}

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

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define sz(x) ((int)(x).size())
using namespace std;
typedef long long ll;
const int n = 5e5 + 5;

int N, M, K;

int C[20][20];


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	ll cc = 0;
	for(int i= 0; i < N; ++i){
		long double a; cin >> a;
		a*=1e9;
		ll x = a+0.5;
		//cerr << "x: " << x << endl;
		int c5 = 0, c2 = 0;
		while(x % 5 == 0) c5++, x /= 5;
		while(x % 2 == 0) c2++, x /= 2;
		c5 = min(c5, 18);
		c2 = min(c2, 18);
		//cerr << "c5, c2: " << c5 << " " << c2 << endl;
		for(int j = 18-c5; j <= 18; ++j){
			for(int k = 18-c2; k <= 18; ++k){
				cc += C[j][k];
			}
		}
		C[c5][c2]++;
	}
	cout << cc << endl;
	return 0;
}


Measured memory_bytes: 3732
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(a, n);
    }
    static void getAns(int[] a, int n)
    {
        var pre = a[n - 1];
        var p = n - 2;
        while (p > 0)
        {
            if (a[p] >= a[p + 1] + 2) { Console.WriteLine("No"); return; }
            if (a[p] == a[p + 1] + 1) a[p]--;
            p--;
        }
        Console.WriteLine("Yes");
        return;
    }
}

Measured memory_bytes: 25052
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B = MAP()

if A <= 5:
	print(0)
elif 6 <= A <= 12:
	print(B//2)
else:
	print(B)
	


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

using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  if ((A % 3 == 0) || (B % 3 == 0) || ((A + B) % 3 == 0)) {
    cout << "Possible";
  } else {
    cout << "Impossible";
  }
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(std::io::stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.read()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item=U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(104_857_600)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}

fn solve() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n = sc.read();
    let mut a: Vec<u32> = sc.vec(n);

    let mut cnt = 0;
    for i in 0..n {
        let mut minj = i;
        for j in i..n {
            if a[j] < a[minj] {
                minj = j;
            }
        }
        if i != minj {
            a.swap(i, minj);
            cnt += 1;
        }
    }

    println!("{}", a.iter().join(" "));
    println!("{}", cnt);
}



Measured memory_bytes: 9080
#include<iostream>
#include<limits.h>
#define maxi 1000000007
#define ll int
#define pb emplace_back
#define mp make_pair
#define tc while(t--)
#define fo(n) for(ll i=0;i<n;i++)
#define foj(m,n) for(ll j=m;j<n;j++)
#define INF 9999999999
#define vp vector<pair<int,int>>
#define vc vector<int>
#define ispow2(x)  x && (!(x&(x-1)))
#define copy(a,b,n) copy_n(a,n,b) 
#define create(a,m,n) iota(a,a+n,m)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define maximum(a,n)  ll* i1,maxi; i1 = std::max_element(a, a+n);maxi=*i1 
#define minimum(a,n)  ll* i1,mini; i1 = std::min_element(a, a+n);mini=*i1 
using namespace std;
int solve()
{
};
int main()
{//fio
ll n,k;
cin>>n>>k;
ll a[n+1];
foj(1,n+1)
cin>>a[j];
ll dp[n+1];
fo(n+1)
dp[i]=INT_MAX;
dp[1]=0;
dp[2]=abs(a[2]-a[1]);
for(ll i=3;i<=n;i++)
{for(ll j=max(1,i-k);j<=i;j++)
{dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));}}
cout<<dp[n]<<endl;
 
 
 
return 0;}

Measured memory_bytes: 1024
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(false);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  string S, T;
  cin >> S >> T;
  int ans = 0;
  rep(i, 0, sz(S)) ans += S[i] != T[i];
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> ans(n);

  for (int i = 0; i < k; i++){
    int d;
    cin >> d;
    int a;
    for (int j = 0; j < d; j++){
        cin >> a;
        ans[a - 1]++;
    }
  }

  int count = 0;
  for (int i = 0; i < n; i++){
    if(ans[i] == 0) count++;
  }
  cout << count << endl;
}



Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
int sort(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}
  
int main(void){
int A,B,M;
  scanf("%d%d%d",&A,&B,&M);
  int a[A+1],b[B+1],x[M+1],y[M+1],c[M+1],amin=100000,bmin=100000;
  for(int i=0;i<A;i++){
	scanf("%d",&a[i]);
    if(amin>a[i])amin=a[i];
  }
  for(int i=0;i<B;i++){
	scanf("%d",&b[i]);
    if(bmin>b[i])bmin=b[i];
  }
  for(int i=0;i<M;i++){
	scanf("%d%d%d",&x[i],&y[i],&c[i]);
  }
  int money[M+1];
  for(int i=0;i<M;i++){
	money[i]=a[x[i]-1]+b[y[i]-1]-c[i];
  }
  money[M]=amin+bmin;
  qsort(money,M+1,sizeof(int),sort);
  printf("%d",money[0]);
  return 0;
}
  

Measured memory_bytes: 2940
import java.lang.Math

val MOD: Int = 1000000000 + 7
val MODL: Long = MOD.toLong()

fun main(args: Array<String>)
{
    val (k, x)  = read().split(" ").map{it.toInt()}
    println(if (500 * k >= x) "Yes" else "No")
}

fun read(): String = readLine()!!


Measured memory_bytes: 38048
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int r;
    cin>>r;
    if(r<1200)cout<<"ABC"<<endl;
    else if(r<2800)cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;

    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cmath>
#include <vector>
#include<string>
#include <cctype>
using namespace std;
int main(){
string s;
int low =0 ,c =0;
cin >> s;
for (int i =2 ;i<s.length()-1;i++ ){
        if (s[i]  =='C' )c+=1; }
for (int i =1;i<s.length();i++){
    if (islower(s[i] )) low++;   }
if (s[0]=='A' && c==1&& low == s.length()-2  )cout << "AC"<<endl;
else cout << "WA"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n, a;
    cin >> n;
    map<ll, ll> m;
    rep1(i, n){
        cin >> a;
        if (m[a]==0) m[a] = 1;
        else m[a] = 0;
    }
    ll ans = 0;
    for (auto x: m){
        if (x.second == 1) ans++;
    }
    cout << ans << endl;
    //printf("%.12f", ans);
}


Measured memory_bytes: 9872
def caddi18b_b():
    N, H, W = map(int, input().split())
    P = [tuple(map(int, input().split())) for _ in range(N)]

    ans = 0
    for a, b in P:
        if H <= a and W <= b: ans += 1
    print(ans)

caddi18b_b()

Measured memory_bytes: 3188
from operator import sub

def main():
    ans = 0

    N = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))

    sub_list = list(map(sub, v, c))

    for i in sub_list:
        if i > 0 :
            ans += i 

    print(ans)


if __name__ == '__main__' :
    main()

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

int main()
{
    int a,b,res;
    cin >> a >> b;
    if((a==1 && b==2) || (b==1 && a==2))
    {
        res=3;
    }
    else if((a==2 && b==3) || (a==3 && b==2))
    {
        res=1;
    }
    else if((a==1 && b==3) || (a==3 || b==1))
    {
        res=2;
    }
    cout << res << endl;

    return 0;
}


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

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a.at(i);
    sort(a.begin(), a.end());

    if(n==2) {
        cout << a.at(n-1) << " " << a.at(0) << endl;
        return 0;
    }

    ll mid = a.at(n-1)/2;
    ll r, l;
    for(int i=0; i<n-1; i++){
        if(a.at(i)<mid) l = a.at(i);
        else {
            r = a.at(i);
            break;
        }
    }

    if((ll)abs(r-mid)<=(ll)abs(mid-l)){
        cout << a.at(n-1) << " " << r << endl;
    }
    else cout << a.at(n-1) << " " << l << endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
typedef long long ll;

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> x(m);
	rep(i,m) cin >> x[i];
	sort(x.begin(),x.end());
	vector<int> kukans(m-1);
	rep(i,m-1){
		kukans[i] = x[i+1]-x[i];
	}
	sort(kukans.begin(),kukans.end());
	ll sum = 0;
	rep(i,m-n){
		sum += kukans[i];
	}
	cout << sum;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define rn return
#define fi first
#define se second
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;



int main(){
    int N;cin >> N;
    vector<int> a(N);
    map<int,int> cnt;
    rep(i,N) {cin >> a[i];cnt[a[i]]++;}
    if (cnt[0] == N) { cout << "Yes"; rn 0;}
    if (N%3!=0) { cout << "No"; rn 0;}
    
    vector<int> all;
    for(auto& e:cnt){
        rep(i,e.second/(N/3)) all.emplace_back(e.first);
    }
    if (all.size() == 3 && (all[0]^all[1]^all[2]) == 0){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    
    rn 0;
}


Measured memory_bytes: 4224
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
S = str(input())

ans = 0
left = ""
for s in S:
    if left != s:
        ans += 1
        left = s
    else:
        pass
print(ans)


Measured memory_bytes: 8132
s=input()
oddtap="RUD"
evetap="LUD"

odd=True
for c in s:
    if odd:
        if c in oddtap:
            odd=False
        else:
            print("No")
            break
    else:
        if c in evetap:
            odd=True
        else:
            print("No")
            break
else:
    print("Yes")
    
    

Measured memory_bytes: 2940
#include <stdio.h>

int main(void) {
    int n, y, i, j;
    scanf("%d%d", &n, &y);
    for(i = 0; i <= n; i++) {
        for(j = 0; j + i <= n; j++) {
            if(y == 10000 * i + 5000 * j + 1000 *(n - i - j) && n - i - j >= 0) {
                printf("%d %d %d\n", i, j, n - i - j);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}


Measured memory_bytes: 128
import sys

from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索

#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    total = 1e+6
    for i in range(N+1):
        a = i
        b = N - i
        c = 0
        while a > 0:
            d = a % 6
            c += d
            a = int(a / 6)
        while b > 0:
            d = b % 9
            c += d
            b = int(b / 9)
        if total > c:
            total = c
    print(total)

main()


Measured memory_bytes: 40812
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int a,b,k,i;
  cin >> a >> b >> k;
  if (k*2>=b-a+1){
    for (i=a;i<=b;i++) cout << i << endl;
    return 0;
  }
  for (i=0;i<k;i++) cout << i+a << endl;
  for (i=0;i<k;i++) cout << b-k+i+1 << endl;
  return 0;
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			w = scanner.nextInt();
			h = scanner.nextInt();
			if ((w | h) == 0)
				break;
			map = new boolean[h][w];
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++)
					map[i][j] = scanner.nextInt() == 0;
			ans = 0;
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++) {
					if (map[i][j])
						continue;
					map[i][j] = true;
					dfs(i, j, 1);
					map[i][j] = false;
				}
			System.out.println(ans);
		}
	}

	private void dfs(int y, int x, int depth) {
		ans = Math.max(ans, depth);
		for (int[] m : move) {
			int ny = y + m[0];
			int nx = x + m[1];
			if (!isOK(ny, nx))
				continue;
			if (map[ny][nx])
				continue;
			map[ny][nx] = true;
			dfs(ny, nx, depth + 1);
			map[ny][nx] = false;
		}

	}

	private boolean isOK(int y, int x) {
		if (0 <= y && y < h && 0 <= x && x < w)
			return true;
		return false;
	}

	int h, w;
	int[][] move = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
	boolean[][] map;
	int ans;
}

Measured memory_bytes: 36164
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int k,x;
  cin>>k>>x;
  k*=500;
  if(k<x) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //c
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  char prv = '?';
  for (char c : s) {
    if (c != prv) ans++;
    prv = c;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 640
import bisect
# from collections import Counter, defaultdict, deque, namedtuple
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    a = list(map(int,ipti().split()))

    count = 0

    for i in range(n):
        while a[i] % 2 == 0:
            count += 1
            a[i] //= 2

    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 40560
#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>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int N = 1e5 + 7;

int a[N];
vector<int> g[N];

int dfs(int cur, int p) {
	int sm = 0;
	vector<int> sv;
	for (auto t : g[cur]) {
		if (t != p) {
			int v = dfs(t, cur);
			sm += v;
			sv.push_back(v);
		}
	}
	if (sv.empty()) {
		return a[cur];
	}
	sort(sv.begin(), sv.end());
	int tot = sm;
	if (2 * sv.back() > sm) tot = 2 * (sm - sv.back());
	// if (cur == 1) {
	// 	cerr << tot << endl;
	// }
	tot /= 2;
	int P = sm - a[cur];
	if (P < 0 || P > tot || sm - 2 * P < 0) {
		cout << "NO\n";
		exit(0);
	}
	return sm - 2 * P;
}

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

	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i + 1 < n; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int rt = -1;
	for (int i = 0; i < n; i++) {
		if ((int)g[i].size() > 1) {
			rt = i;
		}
	}
	cerr << rt + 1 << endl;
	if (rt == -1) {
		assert(n == 2);
		if (a[0] == a[1]) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
		return 0;
	}
	int v = dfs(rt, -1);
	if (v == 0) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define maxn 200005
#define ll long long

#define DEBUG
#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << "  "
#else
#define debug(x) ;
#endif

int n, k;
int a[maxn];

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

    cin >> k >> n;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);
    int mx = a[0]+k-a[n-1];
    for (int i = 1; i < n; i++)
        mx = max(mx, a[i] - a[i - 1]);
    cout << k - mx;

    return 0;
}

Measured memory_bytes: 4436
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String[] str1 = sc.nextLine().split(" ");
    int n = Integer.parseInt(str1[0]);
    int k = Integer.parseInt(str1[1]);

    String[] str2 = sc.nextLine().split(" ");

    int[] int1 = new int[n];
    for(int i = 0; i < n;i++) {
      int1[i] = Integer.parseInt(str2[i]);
    }

    Arrays.sort(int1);
    int count = 0;

    for(int i = 0; i <= k-1;i++) {
      count += int1[i];
    }

    System.out.println(count);

  }

}


Measured memory_bytes: 37148
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;

int main(){
  int n,m;
  int a[150],b[150];
  int suma = 0;
  int sumb = 0;
  int check[5];
  int min;
  while(cin >> n >> m){
    if(n == 0 && m == 0){
      break;
    }
    min = -1;
    suma = 0;
    sumb = 0;
    for(int i = 0; i < n;i++){
      cin >> a[i];
      suma += a[i];
    }

    for(int i = 0;i < m;i++){
      cin >> b[i];
      sumb += b[i];
    }

    for(int i = 0;i < n;i++){
      for(int j = 0;j < m;j++){
        check[1] = sumb - b[j];
        check[0] = suma - a[i];
        check[0] += b[j];
        check[1] += a[i];
        if(check[0] == check[1]){
          if(min == -1|| min > a[i] + b[i]){
            check[2] = a[i];
            check[3] = b[j];
            min = a[i] + b[j];
          }
        }
        

      }
    }

    if(min == -1){
      cout << min <<  endl;
    }else{
      cout << check[2] << " "  << check[3] << endl;
    }


  }
}
    
    

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int main(){
    int h, w, i, j, k, l, mx = 0;
    int dh[4] = {0, 1, 0, -1}, dw[4] = {1, 0, -1, 0}; 
    cin >> h >> w;
    string s[h];
    for(i=0; i<h; i++){
        cin >> s[i];
    }
    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            if(s[i][j] == '#') continue;
            int d[h][w] = {};
            queue<P> q;
            for(k=0; k<h; k++){
                for(l=0; l<w; l++){
                    d[k][l] = -1;
                }
            }
            d[i][j] = 0;
            q.push(P(i, j));
            while(!q.empty()){
                P now = q.front();
                q.pop();
                for(k=0; k<4; k++){
                    int new_h = now.first + dh[k], new_w = now.second + dw[k];
                    if(0 <= new_h && new_h < h && 0 <= new_w && new_w < w && s[new_h][new_w] == '.' && d[new_h][new_w] == -1){
                        q.push(P(new_h, new_w));
                        d[new_h][new_w] = d[now.first][now.second] + 1;
                        mx = max(d[new_h][new_w], mx);
                    }
                }
            }
        }
    }
    cout << mx << "\n";
    return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    int ans = N / 2;
    if (N % 2) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define vvi vector<vector<int>>
#define vec vector<int>
#define un unsigned
#define dbl double
#define wking(t) cout<<"Working "<<t<<endl;
#define loop(i,s,n) for(auto i=s;i!=n;i++)
#define eps 0.000000001
using namespace std;

ll f(int n,int W,int w[],ll v[],vector<vector<ll>> &dp)
{
    if(n==0 || W==0) return 0;
    if(dp[n][W]!=-1) return dp[n][W];
    if(W-w[n]>=0) dp[n][W] = max(v[n]+f(n-1,W-w[n],w,v,dp), f(n-1,W,w,v,dp));
    else  dp[n][W] = f(n-1,W,w,v,dp);
    return dp[n][W];
}

ll calc(int n,int W,int w[],ll v[])
{
    vector<vector<ll>> dp(n+1,vector<ll> (W+1,-1));
    dp[0][0] = 0;
    return dp[n][W] = f(n,W,w,v,dp);
}


int main()
{
    int n,W;
    cin>>n>>W;
    int w[n+1];
    ll v[n+1];
    v[0]=w[0]=0;
    loop(i,1,n+1) cin>>w[i]>>v[i];
    cout<<calc(n,W,w,v)<<endl;
    return 0;
}


Measured memory_bytes: 80256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main(){
    int n,k,s=0;
    cin>>n>>k;
    s=k;
    for(int i=1;i<n;i++){
        s=s*(k-1);
    }
    cout<<s;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
 
const int MAXN = 1e6+1;
const int MOD = 998244353; //1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}
#define YES {cout << "Yes\n"; return 0;}

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    LL S;
    cin >> S;

    LL ax=0,ay= 0,bx,by,cx,cy;
    LL a = sqrt(S);
    LL r = S-a*a;
    if (r == 0) {
        bx=a;by=0;
        cx=0;cy=a;
    } else if (r <= 1e9) {
        ay=1;
        bx=a;by=0;
        cx=r;cy=a+1;
    } else {
        a++;
        r = a*a-S;
        assert(r<=1e9);
        bx=a;by=1;
        cx=r;cy=a;
    }

    assert(max({ax,ay,bx,by,cx,cy}) <= 1e9);

    cout << ax << ' ' << ay << ' ';
    cout << bx << ' ' << by << ' ';
    cout << cx << ' ' << cy << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
ll i,j,k;
ll n,m;
ll a[100005],b[100005];
ll ans=0;

int main(){
	cin>>n>>m;
	if(n*m>0){
		if(m>n)ans=m-n;
		else ans=n-m+2;
	}else if(n*m<0){
		ans=abs(abs(m)-abs(n))+1;
	}else{
		if(n==0 && m>0)ans=m;
		else if(n==0 && m<0)ans=1-m;
		else if(m==0 && n>0)ans=1+n;
		else ans=-1*n;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#define pii         pair<int, int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int, int>
#define mii         map<pii, int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define lb          lower_bound
#define ub          upper_bound

#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
int mult(int a,int b, int p=MOD){return ((a%p)*(b%p))%p;}
int add(int a, int b, int p=MOD){return (a + b + p)%p;}
int fpow(int n, int k, int p = MOD) {int r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int b) {a = max(a, b); }
void self_min(int &a, int b) {a = min(a, b); }
void self_add(int &a, int b, int p = MOD) { a += b; if(a >= p) a -= p;}
void self_sub(int &a, int b, int p = MOD) { a -= b; if(a < 0) a += p;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
const int INF = 1e9 + 5;
#define N	    	400001

int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
void solve(){
    int n;
    cin>>n;
    int a[n];
    rep(i, 0, n) {
        cin>>a[i];
    }
    int g = a[0];
    rep(i, 0, n) 
        g = gcd(g, a[i]);
    cout<<g<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


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

int main() {
  int n, a, b, turn=0;
  cin >> n >> a >> b;
  while (true) {
    if (turn == 0) {
      turn = 1;
      if (a + 1 != b) a++;
      else if (a - 1 >=1) a--;
      else break;
    }
    else {
      turn = 0;
      if (b - 1 != a) b--;
      else if (b + 1 <= n) b++;
      else break;
    }
  }
  if (turn == 0) {
    cout << "Alice" << endl;
  }
  else if (turn == 1) {
    cout << "Borys" << endl;
  }
  else cout << "Draw" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define data_type long long
#define endl "\n"

int main()
{
    string s,t;
    cin>>s>>t;
    data_type n=0,i=0;
    while(i<s.size() && i<t.size())
    n+=(s[i]!=t[i]),i++;
    n+=max(s.size()-i,t.size()-i);
    cout<<n<<endl;
    return 0;
}



Measured memory_bytes: 3860
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        ld ans = 0;
        rep(i, 0, N) {
                ld x;
                string u;
                cin >> x >> u;
                if (u == "JPY") {
                        ans += x;
                } else {
                        ans += x * 380000;
                }
        }
        cout << setprecision(21) << ans << endl;
}

Measured memory_bytes: 3824
s = input()
flag = True
for i in range(len(s)):
	if i % 2 == 0:
		if s[i] == 'L':
			flag = False
			break
	elif i % 2 == 1:
		if s[i] == 'R':
			flag = False
			break

if flag:
	print('Yes')
else:
	print('No')


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;


#define NMAX (200000)
pair<int, int> BA[NMAX];

int main()
{
	int N, A, B;
	bool ans = true;
	ll current = 0;

	cin >> N;
	rep(i, N) {
		cin >> A >> B;
		BA[i] = make_pair(B, A);
	}

	sort(BA, BA + N);

	rep(i, N) {
		current += BA[i].second;
		if (current > BA[i].first) {
			ans = false;
			break;
		}
	}

	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll  long long int
#define ff first
#define pb push_back
#define ss second
#define debug 0
#define ff first
#define mp make_pair

using namespace std;

const ll MOD = 1000000007LL;

ll fact[1000006];
ll ifact[1000006];
ll power2[1000006];

int ar[100056];
int br[100056];
vector<int> adj[100005];
set<int> st;

int vis[100005];


bool prime[10000006];

vector<int> primes;



ll powr (ll a, ll  b)
{
    if (b == 0)
        return 1;
    long long int x = powr(a, b/2);
    if (b % 2 == 0)
        return (x*x)%MOD;
    else
        return ((x*x)%MOD*a%MOD)%MOD;
}
 
inline ll inv(ll x) {
  return powr(x, MOD - 2);
}
 
inline ll mulMod(ll a, ll b) {
  return (a%MOD * b%MOD) % MOD;

}
 
inline void process() {
  fact[0] = 1;
  power2[0] = 1;
  for(int i = 1; i < 1003; i++) {
    fact[i] = mulMod(fact[i - 1], i);
    power2[i] = mulMod(power2[i - 1], 2);
  }
  ifact[1002] = inv(fact[1002]);
  for(int i = 1002 - 1; i >= 0; i--) {
    ifact[i] = mulMod(ifact[i + 1], i + 1);
  }
}

inline ll ncr(ll n, ll r) {
  if(n < r) return 0;
  return mulMod(fact[n], mulMod(ifact[r], ifact[(n - r)]));
}

ll solve(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));
 
    C[0] = 1; 
 
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = C[j] + C[j-1];
    }
    return C[k];
}

void solve1(vector<ll> price, ll n, ll S[])
{
   
   stack<ll> st;
   st.push(0);
 
   S[0] = 1;
 
   for (ll i = 1; i < n; i++)
   {

      while (!st.empty() && price[st.top()] <= price[i])
         st.pop();
 

      S[i] = (st.empty())? (i + 1) : (i - st.top());
 
      st.push(i);
   }
}

void sieve()
{
    memset(prime,true,sizeof(prime));
    prime[0]=prime[1]=false;
    
    for(ll i=2;i*i<=100006;i++)
    {
        if(prime[i])
        {
            for(ll j=i*2;j<=100006;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    
    for(int i=2;i<=100005;i++)
    {
    	if(prime[i])
    	primes.pb(i);
	}
}

map<int,int> has[100008],occur[1000005];
bool flag;


void dfs(int s, int sum)
{
	
	vis[s]=1;
	vector<int>::iterator it;
	
	for(it=adj[s].begin();it!=adj[s].end();++it)
	{
		if(!vis[*it])
		{
			ar[*it]=sum+has[s][*it];
			dfs(*it,ar[*it]);
		}
		else if(vis[*it])
		{
			int p=sum+has[s][*it];
			
			//cout<<"vis p="<<p<<"\n";
			
			if(p!=ar[*it])
			{
			flag=1;
			}
		}
	}
}




int main() 
{
    int n,m,t,p,q,s,a,b,c,d,e,f,g,h,sum,res,u,v,i,j,l,k,len,ans=0,tot,rad,ds,rs,x,y,r,z,maxm,minm;
    
    string str,ptr="";
    
    
    cin>>str;
    
    len=str.length();
    
    for(i=0;i<len;i+=2)
    ptr+=str[i];
    
    cout<<ptr;
    
}

Measured memory_bytes: 57856