akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f,g,h,i,j;
    cin>>a;
    bool ar[a];

    for(i=1; i<=a; i++)
    {
        ar[i]=false;

    }
    cin>>b>>c;
    h=c;
    map<int,int>m;
    map<int,int>::iterator it;
    for(i=1; i<=a; i++)
    {
        m[i]=0;
    }
    while(c--)
    {
        int x;

        cin>>x;
        m[x]++;
    }
    vector<int>v;

    for(it=m.begin(); it!=m.end(); it++)
    {
        int k=(*it).second;
        if((b+k)-h>0)
        {
            ar[(*it).first]=true;
        }
    }

    for(i=1; i<=a; i++)
    {
        if(ar[i]==true)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    m.clear();
    return 0;



}



Measured memory_bytes: 5376
from math import factorial
n=int(input())
cnt=[0]*(n+1)
lst=list(map(int,input().split()))
tmp=[0]*(n+1)
change=[0]*(n+1)
for i in lst:
    cnt[i]+=1
ans=0
for i in range(n+1):
    p=cnt[i]
    if p>=2:
        q=factorial(p)//factorial(p-2)//2
        ans+=q
        tmp[i]=q
    if p>=3:
        change[i]=factorial(p-1)//factorial(p-3)//2
for i in range(n):
    print(ans-tmp[lst[i]]+change[lst[i]])

Measured memory_bytes: 158168
import java.util.Scanner;

public class Main {

	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
	
	public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			int n;
			String  s;
			int k;
			String result="";
			n = sc.nextInt();
			s = sc.next();
			k = sc.nextInt();
			sc.close();
			
			int index;
			String s1,target;
			target=s.substring(k-1,k);
			
			for (index=0;index<n;index++) {
				s1=s.substring(index,index+1);
				if(s1.equals(target)) {
					result=result+target;
				}
				else {
					result=result+"*";
				}
			}

			// 出力

			System.out.println(result);
	}
}

Measured memory_bytes: 23508
#include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define mset(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
struct edge
{
	int a,c;
};
vector<list<edge> >adj;
const int maxn=1e5+10;
ll ans[maxn];
bool touch[maxn];

void dfs(int v,ll x)
{
	touch[v]=1;
	ans[v]=x;
	for(auto e:adj[v])
	{
		if(touch[e.a])continue;
		dfs(e.a,x+e.c);
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	adj.resize(n+3);
	for(int i=0;i<n-1;++i)
	{
		int x,y,z;
		cin>>x>>y>>z;
		edge ee;
		ee.c=z;
		ee.a=y;
		adj[x].pb(ee);
		ee.a=x;
		adj[y].pb(ee);
	}
	int q,k;
	cin>>q>>k;
	dfs(k,0);
	while(q--)
	{
		int x,y;
		cin>>x>>y;
		cout<<ans[x]+ans[y]<<'\n';
	}
}




















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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    int x, y; cin >> x >> y;
    if ((y - 2*x)%2 == 0 && (y - 2*x)/2 >= 0 && x - (y - 2*x)/2 >= 0) {
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3640
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>

#include <assert.h>
#include <bitset>

auto& in = std::cin;
auto& out = std::cout;

char S[8]; 

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> S;
	if (S[0] == S[1] && S[1] == S[2]) {
		out << "Yes\n"; return 0;
}
	if (S[3] == S[1] && S[1] == S[2]) {
		out << "Yes\n"; return 0;
	}
	out << "No" << endl;

	return 0;
}
#endif

#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>

auto& in = std::cin;
auto& out = std::cout;

int32_t N;
int64_t arr[100];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;
	arr[0] =2 ;
	arr[1] = 1;
	for (int32_t i = 2; i <= N; i++)
	{
		arr[i] = arr[i - 1] + arr[i - 2];
	}
	out << arr[N] << endl;
	return 0;
}
#endif


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	long long N;
	cin >> N;

	vector<long long> a(N, 0);
	vector<long long> v(N, 0);

	cin >> a[0];
	v[0] = a[0];
	for (long long i = 1; i < N; i++) {
		cin >> a[i];
		v[i] = v[i - 1] + a[i];
	}

	long long min = 0;
	long long val;
	bool jdg = false;
	for (long long i = 0; i < N - 1; i++) {
		val = abs(2 * v[i] - v.back());
		if (val < min || jdg == false) {
			min = val;
			jdg = true;
		}
	}

	cout << min << endl;

	return 0;
}

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

int main() {
  ll a,b,c;
  cin>>a>>b>>c;
  if(a+b<c) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
A,B = map(int,input().split())
def F(X): # 0からXまでの排他的論理和のシグマ
    if X%4 ==0:return X
    elif X%4 == 1:
        return 1
    elif X%4 == 2:
        return 1^X
    else:
        return 0
ans = F(B)^F(A-1)
print(ans)

Measured memory_bytes: 3060
import sys
def main():
    N = int(sys.stdin.readline())
    A = [int(sys.stdin.readline()) for i in range(N)]
    maxa = max(A)
    maxb = sorted(A)[-2]
    if A.count(maxa) > 1:
        for i in range(N):
            print(maxa)
    else:
        for i in range(N):
            if A[i] != maxa:
                print(maxa)
            else:
                print(maxb)
                
main()

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

int main() {
	string s;
	cin>>s;
	if(s[0]!=s[1]&&s[1]!=s[2]&&s[2]!=s[0]){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
dic = {
  ' ' => '101',
  '\'' => '000000',
  ',' => '000011',
  '-' => '10010001',
  '.' => '010001',
  '?' => '000001',
  'A' => '100101',
  'B' => '10011010',
  'C' => '0101',
  'D' => '0001',
  'E' => '110',
  'F' => '01001',
  'G' => '10011011',
  'H' => '010000',
  'I' => '0111',
  'J' => '10011000',
  'K' => '0110',
  'L' => '00100',
  'M' => '10011001',
  'N' => '10011110',
  'O' => '00101',
  'P' => '111',
  'Q' => '10011111',
  'R' => '1000',
  'S' => '00110',
  'T' => '00111',
  'U' => '10011100',
  'V' => '10011101',
  'W' => '000010',
  'X' => '10010010',
  'Y' => '10010011',
  'Z' => '10010000',
}

readlines.each do |l|
  a = ''
  l2 = l.chomp
  l2.each_char do |c|
    a += dic[c]
  end

  if a.length % 5 != 0
    a += "0" * (5 - a.length % 5)
  end

  a2 = a.scan(/.{5}|.+\Z/)

  a2.each do |elem|
    c = ("0b" + elem).oct
    if c < 26 then print (c+65).chr end
    if c == 26
      print ' '
    elsif c == 27
      print '.'
    elsif c == 28
      print ','
    elsif c == 29
      print '-'
    elsif c == 30
      print '\''
    elsif c == 31
      print '?'
    end
  end
  puts
end

Measured memory_bytes: 6136
import sys

inputs = [row.split() for row in sys.stdin.readlines()]

mount_list = inputs[1]
mount_list = [int(height) for height in mount_list]

result_cnt = 0
old_max_height = mount_list[0]
for height in mount_list:
    if old_max_height <= height:
        result_cnt+=1
        old_max_height = max(old_max_height, height)
print(result_cnt)



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

int main() {
    int a, b;
    cin >> a >> b;
    vector<int> vec{a + a - 1, a + b, b + b - 1};
    cout << *max_element(vec.begin(), vec.end()) << endl;
    return 0;
}


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

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long GCM(long x, long y)
        {
            var s = x;
            var t = y;
            if (x < y) GCM(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return s / x * t;
        }



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var c = new long[3][];
            for (int i = 0; i < 3; i++)
            {
                c[i] = Reads();
               
            }
            bool ans = true;
            for (int i = 0; i < 2; i++)
            {
                bool f1 = c[0][i] - c[0][i + 1] == c[1][i] - c[1][i + 1];
                bool f2 = c[0][i] - c[0][i + 1] == c[2][i] - c[2][i + 1];
                if (!f1 || !f2) ans = false;
            }
            for (int i = 0; i < 2; i++)
            {
                bool f1 = c[i][0] - c[i + 1][0] == c[i][1] - c[i + 1][1];
                bool f2 = c[i][0] - c[i + 1][0] == c[i][2] - c[i + 1][2];
                if (!f1 || !f2) ans = false;
            }
            if (ans) Console.WriteLine("Yes");
            else Console.WriteLine("No");



            Console.Out.Flush();
        }
    }
}




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

int main(void){
  long long N, D;
  cin>>N>>D;
  long long D2 = D*D;
  int cnt=0;
  for(int i=0;i<N;i++){
    long long x,y;
    cin>>x>>y;
    if(D2 < x*x+y*y)continue;
    cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <math.h>
#include <string.h>
typedef long long ll;
using namespace std;
char a[1000];
int main()
{
    double n,h,ans;
    scanf("%lf",&n);
    h=n/3.0;
    ans=h*h*h;
printf("%.12lf\n",ans);

    return 0;
}


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

void push(int);
int pop();

int num[1000];
int n=0;

int main(){

 
  int i,x,y,ans;
  char c[100];

  for(i=0 ; i<100 ; i++){
    num[i]=0;
  }


  while(scanf("%s",c)!=EOF){
    if(c[0]=='\n') break;
    //if(c==' ') continue;
    
   
    if(c[0]=='+'){
      x=pop();
      y=pop();
      push(x+y);
    }
      
      else if(c[0]=='-'){
	x=pop();
	y=pop();
	push(y-x);
      }
      else if(c[0]=='*'){
	x=pop();
	y=pop();
	push(x*y);
      }
      else push(atoi(c));
  }
  
  ans=pop();
  printf("%d\n",ans);


  return 0;
}

void push(int x){
  n++;
  num[n]=x;
}

int pop(){
  n--;
  return num[n+1];
}



Measured memory_bytes: 2744
import sys, math
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
s = lines.pop(0)
k, = [int(num) for num in lines.pop(0).split(" ")]
days = 5000 * (10 ** 12)
for n in s:
    log_k = math.log10(k)
    n = int(n)
    log_n_days = math.log10(n) * days
    if log_k > log_n_days:
        k -= n ** days
    else:
        break
print(n)


Measured memory_bytes: 9176
import sys
from heapq import heappush, heappop

x, y, z, K = map(int, sys.stdin.readline().split())
a, b, c = (sorted(map(int, sys.stdin.readline().split()), reverse=True) for _ in range(3))

def main():
    cand = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
    added = set([(0, 0, 0)])
    for _ in range(K):
        s, i, j, k = heappop(cand)
        yield -s
        if i + 1 < x and not (i+1, j, k) in added:
            heappush(cand, (s + a[i] - a[i+1], i+1, j, k))
            added.add((i+1, j, k))
        if j + 1 < y and not (i, j+1, k) in added:
            heappush(cand, (s + b[j] - b[j+1], i, j+1, k))
            added.add((i, j+1, k))
        if k + 1 < z and not (i, j, k+1) in added:
            heappush(cand, (s + c[k] - c[k+1], i, j, k+1))
            added.add((i, j, k+1))

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

Measured memory_bytes: 4980
#include <bits/stdc++.h>  
using namespace std;  
#define INF 0x3f3f3f3f  
typedef long long ll;  
const int N =  1e5 + 10;  
#define FI first
#define SE second
typedef pair<int, int>pii;
int num[N], n;
bool judge(int cnt, int a, int b)
{
	int d = a - b;
	int lcnt = cnt;
	for (int i = 0; i < n; i++)
	{
		ll tmpv = num[i];
		tmpv -= (ll)cnt*b;
		if (tmpv <= 0)
			return true;
		int ct = tmpv / d + (tmpv%d?1:0);
		if (ct > lcnt)
			return false;
		lcnt -= ct;
	}
	return true;
}	
int main()  
{  
  // freopen("in.txt","r",stdin);
   int  a, b;
   while (~scanf("%d%d%d", &n, &a, &b))
   {
   
   	for (int i = 0; i < n; i++)
   	{
   		scanf("%d", num + i);
   	}
   	sort(num, num + n, greater<int>());
   	int l = 0, r = 1e9 + 10;
   	while (l < r)
   	{
   		int mid = l + ((r - l)>>1);
   		if (judge(mid, a, b))
   			r = mid;
   		else
   			l = mid + 1;
   	}
   	printf("%d\n", l);
   }
   
   return 0;  
}  

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
struct Node{int x,y;}A[200000];
int cmp(const Node&A,const Node&B) {return A.x+A.y>B.x+B.y;}
int n;
long long Ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>A[i].x>>A[i].y;
	sort(A+1,A+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(i&1) Ans+=A[i].x;
		else Ans-=A[i].y;
	}
	cout<<Ans<<endl;
}


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

int n, k, c;
const int maxn = 2e5 + 5;
char s[maxn];
int lb[maxn], ub[maxn];

int main(){
    cin >> n >> k >> c;
    scanf("%s", s + 1);
    int cur;
    for(int i = 1;i <= k;i++){
        if(i == 1){
            cur = 1;
        }else{
            cur += c + 1;
        }
        while(s[cur] == 'x')
            cur++;
        lb[i] = cur;
    }
    for(int i = k;i >= 1;i--){
        if(i == k){
            cur = n;
        }else{
            cur = cur - c - 1;
        }
        while(s[cur] == 'x'){
            cur--;
        }
        ub[i] = cur;
    }
    vector<int> ans;
    for(int i = 1;i <= k;i++){
        if(lb[i] == ub[i]){
            ans.push_back(lb[i]);
        }
    }
    for(int i = 0;i < ans.size();i++){
        printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 4212
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int N  = keyboard.nextInt();
		int D  = keyboard.nextInt();
		
		int[]X = new int[N*D];
		
		for(int i = 0; i < N*D; i++) {
				X[i] = keyboard.nextInt();	
		}
		
		int count = 0;
		double a = 0;

		for(int i = 0; i < N*D-D+1; i+=D) {
			for(int j = i+D; j < N*D-D+1; j+=D) {
				for(int k = 0; k < D; k++) {
					a += Math.pow(X[i+k]-X[j+k],2);
				}
				if(Math.sqrt(a)%1.0 == 0.0) {
					count++;
				}
				a = 0;
			}
		}
		
		System.out.println(count);
		keyboard.close();	
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define rg register
#define LL long long 

using namespace std;

const int N=200010;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,a[N];
int l,r,ans;
bool check(int mid){
	for(int i=0;i<n-1;i++){
		if((a[n+i]>mid&&a[n+i+1]>mid)||(a[n-i]>mid&&a[n-i-1]>mid))return false;
		if((a[n+i]<=mid&&a[n+i+1]<=mid)||(a[n-i]<=mid&&a[n-i-1]<=mid))return true;
	}
	return a[1]<=mid;
}
int main()
{
	n=read();
	for(rg int i=1;i<=(n<<1)-1;i++)
		a[i]=read();
	l=1,r=(n<<1)-1;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  string s;
  
  cin>>s[0]>>s[1]>>s[2]>>s[3];
  if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]){
    cout<<"Bad"<<endl;
  }
  else
    cout<<"Good"<<endl;
}
    


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  	long long int a,i,sum=0 ;

	 scanf ("%lld",&a);
	 for(i=1; i<=a; i++){
		if(i%3 != 0 && i%5 != 0){
			sum = sum+i;
		    }
		}
		printf("%lld",sum);
	 }



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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    int A, B;
    cin >> A >> B;
    PRINT(max(A + B, max(A - B, A * B)));
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int x,lol;
    cin>>x;
    lol = x/100;
    if(x >= 100*lol && x <= 105*lol)
        cout<<1<<endl;
    else
        cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



string s;

signed main() {
	cin >> s >> s;
	cout << 'A' << s[0] << 'C' << endl;
}


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

int N;
tuple<string, int, int> A[105];

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N;
	for (int i = 1, b; i <= N; i++) {
		string a;
		cin >> a >> b;
		A[i] = make_tuple(a, b, i);
	}
	sort(A + 1, A + 1 + N, [](const auto &a, const auto &b) {
		if (get<0>(a) != get<0>(b)) return get<0>(b) > get<0>(a);
		return get<1>(a) > get<1>(b);
	});
	for (int i = 1; i <= N; i++)
		cout << get<2>(A[i]) << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == 1)return;for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

//CODE
void solve(void)
{
  char A;
  int ANS = 0;
  for (int i = 0; i < 3; i++)
  {
    cin>>A;
    if(A == '1') ANS++;
  }
  cout<<ANS<<endl;
  
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
#define ote(x) cout<<(x)<<endl

int main(){
	string a,b,c;
	cin>>a>>b>>c;
	string ans;
	if(a[a.size()-1]==b[0]
	 && b[b.size()-1]==c[0])
		ans = "YES";
	else ans = "NO";
	ote(ans);
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

const int maxn = 2e5 + 5;

int n, k;
int a[maxn];

int add[maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    while(k--){
        memset(add, 0, sizeof(add)); 
        for(int i = 1;i <= n;i++){
            int l = max(1, i - a[i]);
            int r = min(n, i + a[i]);
            add[l]++;
            add[r+1]--;
        }
        for(int i = 1;i <= n;i++){
            add[i + 1] += add[i];
        }
        bool flag = false;
        for(int i = 1;i <= n;i++){
            a[i] = add[i];
            if(a[i] < n){
                flag = true;
            }
        }
        if(!flag){
            break;
        }
    }
    for(int i = 1;i <= n;i++){
        cout << a[i] << (i == n ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 5208
n = input()
if len(n) == 6: print("90909")
elif len(n) == 5: print(909 + int(n) - 9999)
elif len(n) == 4: print("909")
elif len(n) == 3: print(9 + int(n) - 99)
elif len(n) == 2: print("9")
else: print(int(n))

Measured memory_bytes: 9056
using System;

namespace AOJ.Volume0
{
    public class CalculationOfArea
    {
        public static int Main()
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) { break; }

                int pos = input.IndexOf(' ');
                int a = int.Parse(input.Substring(0, pos));
                int b = int.Parse(input.Substring(pos + 1));

                int area = a * b;
                double tubo = area / 3.305785;
                Console.WriteLine(tubo);
            }
            return 0;
        }
    }
}

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

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector< vector<int> > parts(3,vector<int>(N));
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < N; ++j) {
			int temp;
			cin >> temp;
			parts[i][j] = -temp;
		}
		sort(parts[i].begin(),parts[i].end());
	}
	vector< vector<int> > counter(2,vector<int>(N));
	for (int i = 0; i < 2; ++i) {
		int nc = 0;
		int ind = 0;
		for (int j = 0; ind < N && j < N; ++j) {
			if (parts[i][ind] <= parts[i+1][j]) {
				counter[i][ind] = nc;
				if (ind > 0) {
					counter[i][ind] += counter[i][ind-1];
				}
				nc = 0;
				++ind;
				--j;
			}
			else {
				++nc;
			}
		}
		if (ind < N) {
			int sn = nc;
			if (ind != 0) {
				sn += counter[i][ind-1];
			}
			for (int j = ind; j < N; ++j) {
				counter[i][j] = sn;
			}
		}
	}

	int nind = 0;
	long long res = 0;
	long long now,sum = 0;
	for (int i = 0; i < N; ++i) {
		now = 0;
		for (int j = nind; j < counter[0][i]; ++j) {
			now += counter[1][j];
			++nind;
		}
		sum += now;
		res += sum;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2552
#include<stdio.h>
int main()
{
  int x=0,y=0;
  scanf("%d%d",&x,&y);
  
  if(y%2!=0)
  {
    printf("No");
  }else if(y<x*2||y>4*x){
    printf("No");
  }else{
    printf("Yes");
  };
  return 0;
           };
    

Measured memory_bytes: 1732
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;
const double pi = 3.141592653589793238;

int main() {
	while (1) {
		int a, b, k[100005];
		cin >> a >> b;
		if (a == 0 && b == 0) { break; }
		for (int i = 0; i < a; ++i) {
			cin >> k[i];
			k[i] += k[i - 1];
		}
		int ans = 0;
		for (int i = b; i < a; ++i) {
			ans = max(ans, k[i] - k[i - b]);
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 3448
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	int N, M; 
	cin >> N >> M; 
	int A[200010] = {}; 
	for(int i = 0; i < M; i++){
		int a, b; 
		cin >> a >> b; 
		if(a == 1){A[b] ++;}
		if(b == N){A[a] ++;}
	}
	bool possible = false; 
	for(int i = 1; i < N; i++){
		if(A[i] == 2){possible = true;}
	}
	if(possible){cout << "POSSIBLE" << endl;}
	else{cout << "IMPOSSIBLE" << endl;}
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>
using namespace std;
typedef long long ll;


int main(){
        string S;
        cin >> S;
        ll K;
        cin >> K;
        vector<ll> A;
        int Count=1;
        for(int i=0; i < S.size(); i++){
                if(i == 0){
                        continue;
                }
                if(S[i-1] == S[i]){
                        Count++;
                }
                else{
                        A.push_back(Count);
                        Count = 1;
                }
        }
        A.push_back(Count);
        ll AllCount = 0;
        if(S[0] != S[S.size()-1]){
                for(int i=0; i<A.size(); i++){
                        if(A[i] > 1)AllCount += A[i]/2;
                }
        cout << AllCount*K;
        }

        else{
                for(int i=1; i<A.size()-1; i++){
                        if(A[i] > 1)AllCount += A[i]/2*K;
                }
                if(A.size() > 1){
                        AllCount += A[0]/2+A[A.size()-1]/2 +(A[0]+A[A.size()-1])/2*(K-1);
                }
                else AllCount += A[0]*K/2;
        cout << AllCount;
        }
}


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

using namespace std;

int main(){
	double a,b,c,degree,S;
	scanf("%lf %lf %lf",&a,&b,&degree);
	S = (0.5)*a*b*sin(M_PI*degree/180);
	c = sqrt(a*a+b*b-2*a*b*cos(M_PI*degree/180));
	printf("%.8lf\n",S);
	printf("%.8lf\n",a+b+c);
	printf("%.8lf\n",2*S/a);
}


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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int tmp = 0;
  for (int i = 0; i < N - 1; i++) {
    tmp += L[i];
  }

  cout << (L[N -1] < tmp ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	ll N,A,B,ANS=0;
	cin >> N >> A >> B;
	ANS=ANS+(N/(A+B))*A;
	if(N%(A+B)<A){
		ANS=ANS+N%(A+B);
	}
	else{
		ANS=ANS+A;
	}
	cout << ANS << endl;
}

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

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



Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int res = 0;
		for (int i = 0; i < N; i++) {
			res += sc.nextInt() -1;
		}
		System.out.print(res);
	}
}


Measured memory_bytes: 25676
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>

using namespace std;

typedef long long ll;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

const int sz = 1e5 + 1;
const ll mod = 1e9 + 7;

int n;
vector<int> g[sz];
ll dp[sz][2];

void dfs(int v, int pred) {
	for (int to : g[v]) {
		if (to ^ pred)
			dfs(to, v);
	}
	dp[v][0] = 1;
	dp[v][1] = 1;
	for (int to : g[v]) {
		if (to ^ pred) {
			dp[v][0] *= (dp[to][0] + dp[to][1]);
			dp[v][0] %= mod;
			dp[v][1] *= dp[to][0];
			dp[v][1] %= mod;
		}
	}
}

void solve() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0, -1);
	cout << (dp[0][0] + dp[0][1]) % mod;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << endl;
	}
}

Measured memory_bytes: 16120
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N, A, B;
	cin >> N >> A >> B;
	int first = 0, second = 0, third = 0;
	rep(i, N) {
		int num;
		cin >> num;
		if (num <= A)first++;
		else if (num >= A + 1 && num <= B)second++;
		else if (num >= B + 1)third++;
	}
	int ans = min({ first,second,third });
	cout << ans << endl;
}

Measured memory_bytes: 256
def problem():
    s = str(input())
    print(algorithm(s))

def algorithm(s: str):
  counter1 = 0
  counter2 = 0

  for index in range(len(s)):
    if index % 2 == 0:
      if s[index] == '0':
        counter1 += 1
    else:
      if s[index] == '1':
        counter1 += 1

  for index in range(len(s)):
    if index % 2 == 0:
      if s[index] == '1':
        counter2 += 1
    else:
      if s[index] == '0':
        counter2 += 1   

  return counter1 if counter1 < counter2 else counter2

problem()

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

class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        char a = input[0];

        if(Char.IsUpper(a))
        {
            Console.WriteLine("A");
        }
        else
        {
            Console.WriteLine("a");
        }
    }
}

Measured memory_bytes: 25684
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, A;
    map<int, int> mii;
    cin >> N;
    REP(i, N) {
        cin >> A;
        mii[A]++;
    }
    int ans = 0;
    for (auto p : mii) {
        if (p.second % 2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4864
#include <cstdio>
#include <cstring>

using namespace std;

char c[1000001] = {0};

int main()
{
    for (;;) {
        int n, a, b;

        scanf("%d %d %d", &n, &a, &b);
        if (n == 0 && a == 0 && b == 0)
            break;

        memset(c, 0, sizeof(c));
        c[0] = 1;
        for (int i = 0; i <= n; ++i) {
            if (c[i] == 1) {
                if (i + a <= n)
                    c[i + a] = 1;
                if (i + b <= n)
                    c[i + b] = 1;
            }
        }

        int t = 0;
        for (int i = 1; i <= n; ++i)
            if (c[i] == 0)
                ++t;

        printf("%d\n", t);
    }

    return 0;
}

Measured memory_bytes: 2012
#include <iostream>
#include <map>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(void){
  map<int,int> s1,s2;
  string s;
  while(getline(cin,s),s!=""){
    int num,date;
    sscanf(s.c_str(),"%d,%d",&num,&date);
    if(s1.find(num)!=s1.end()) ++s1[num];
    else s1[num]=1;
  }
  while(getline(cin,s)){
    int num,date;
    sscanf(s.c_str(),"%d,%d",&num,&date);
    if(s2.find(num)!=s2.end()) ++s2[num];
    else s2[num]=1;
  }
  for(map<int,int>::iterator it=s1.begin();it!=s1.end();++it){
    if(s2.find(it->first)!=s2.end())cout<<(it->first)<<" "<<(it->second+s2.find(it->first)->second)<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif


static void ABC107C_Candles();

#if 1
int main()
{
	ABC107C_Candles();

	fflush(stdout);
	return 0;
}
#endif

template <class _Ty> inline _Ty tp_abs(const _Ty& a)
{
	//	usage:  tp_abs<type name>(a);

	return ((a < 0) ? (a * -1) : a);

}

static void ABC107C_Candles()
{
	L_LONG ABC107C_INF = 1000000000LL;
	int N, K, selCnt;

	scanf(" %d %d", &N, &K);
	
	selCnt = K;
	auto xpoint = new L_LONG[N + 1];

	for (int i = 0; i < N; i++) {
		scanf(" %lld", &xpoint[i]);
	}

	L_LONG minDist = ABC107C_INF;
	for (int r, l = 0; (r = l + K - 1) < N; l++) {
		L_LONG tmp = 0;
		tmp = tp_abs<L_LONG>(xpoint[l]) + tp_abs<L_LONG>(xpoint[r] - xpoint[l]);
		if (minDist > tmp) minDist = tmp;

		tmp = tp_abs<L_LONG>(xpoint[r]) + tp_abs<L_LONG>(xpoint[l] - xpoint[r]);
		if (minDist > tmp) minDist = tmp;
	}

	printf("%lld\n", minDist);

	delete[] xpoint;
}


Measured memory_bytes: 1024
N,M=map(int,input().split())
H=list(map(int,input().split()))
O=[1]*N
for i in range(M):
    A,B=map(int,input().split())
    if H[A-1] > H[B-1] :
        O[B-1]=0
    elif H[A-1] < H[B-1]:
        O[A-1]=0
    elif H[A-1] == H[B-1]:
        O[A-1]=0
        O[B-1]=0
print(sum(O))

Measured memory_bytes: 20116
#include <iostream>
#include <vector>
#include <algorithm>
using ll = long long;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rep2(i, s, n) for(ll i = s; i < n; i++)
using namespace std;

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  while(1){
    vector<ll> b;
    b.push_back(a[0]);
    rep2(i, 1, n){
      ll x;
      x = a[i] % a[0];
      if (x != 0) b.push_back(x);
    }
    sort(b.begin(), b.end());
    a = b;
    n = a.size();
    if (n == 1) break;
  }
  cout << a[0] << endl;
  
  return 0;
}

Measured memory_bytes: 5012
#include <stdio.h>

int main()
{
    int i, j;

    int n[3];
    for( i = 0; i < 3; ++i )
        scanf("%d", &n[i]);

    int tmp;
    for( i = 0; i < 3; ++i )
        for( j = i+1; j < 3; ++j )
            if( n[j] < n[i] ){
                tmp = n[i];
                n[i] = n[j];
                n[j] = tmp;
            }

    for( i = 0; i < 3; ++i ){
        printf("%d", n[i]);
        if( i < 2 ) printf(" ");
        else printf("\n");
    }

    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int inadj[210][2], outadj[210][2], n, h;
int inadj2[210][2], outadj2[210][2];
pair<int, int> thing(int a, int b)
{
	pair<int, int> ans;
	if (b) ans = { b, 0 };
	else ans = { a, 1 };
	return ans;
}
vector<pair<int, int> > adj[210][2];
int seen[210][2], c;
vector<pair<int, int> > components[500];
void dfs(int a, int b, int d)
{
	if (seen[a][b]) return;
	seen[a][b] = 1;
	components[d].push_back({ a, b });
	for (auto c : adj[a][b]) dfs(c.first, c.second, d);
}

int main()
{
	scanf("%d%d", &n, &h);
	for (int i = 0; i < n; i++)
	{
		int a, b, c, d;
		scanf("%d%d%d%d", &a, &b, &c, &d);
		pair<int, int> in, out;
		in = thing(a, c);
		out = thing(b, d);
		out.second = !out.second;
		outadj[in.first][in.second]++;
		inadj[out.first][out.second]++;
		adj[in.first][in.second].push_back(out);
		adj[out.first][out.second].push_back(in);
	}
	for (int i = 1; i <= h; i++)
	{
		for (int j = 0; j < 2; j++)
		{
			if (adj[i][j].size() && !seen[i][j]) dfs(i, j, c++);
		//	printf("%d:%d - in %d, out %d\n", i, j, inadj[i][j], outadj[i][j]);
		}
	}
	bool works = 1;
	for (int i = 0; i < c; i++)
	{
		for (int i = 0; i <= h; i++) inadj2[i][0] = inadj2[i][1] = outadj2[i][0] = outadj2[i][1] = 0;
		for (auto b : components[i])
		{
			inadj2[b.first][b.second] += inadj[b.first][b.second];
			outadj2[b.first][b.second] += outadj[b.first][b.second];
		}
		for (int i = 0; i <= h; i++)
		{
		//	printf("%d %d - %d %d\n", inadj2[i][0], outadj2[i][0], inadj2[i][1], outadj2[i][1]);
			if (inadj2[i][0] - outadj2[i][0] > 0 && inadj2[i][1] - outadj2[i][1] < 0 && 0) 
			{
			//	printf("%d\n", i);
				inadj2[i][0]--; 
				outadj2[i][1]--;
			//	printf(" %d %d - %d %d\n", inadj2[i][0], outadj2[i][0], inadj2[i][1], outadj2[i][1]);
			}
		}
		int extra = 0;
		bool fails = 0;
		for (int i = 0; i <= h; i++)
		{
			for (int j = 0; j < 2; j++)
			{
				extra += abs(inadj2[i][j] - outadj2[i][j]);
				if (!j && inadj2[i][j] - outadj2[i][j] < 0) fails = 1;
				if (j && inadj2[i][j] - outadj2[i][j] > 0) fails = 1;
			}
		}
		//printf("%d\n", extra);
		if (extra % 2 || !extra || fails) works = 0;
	}
//	printf("Components %d\n", c);
	if (works) printf("YES\n");
	else printf("NO\n");
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
class mint {
 private:
  ll _num,_mod;
  mint set(ll num){ 
      _num = num ;
      if(_num<0){
          if(_num>=-_mod)_num=_mod+_num;
          else _num=_mod-(-_num)%_mod;
      }
      else if(_num>=_mod) _num%=_mod;
      return *this;
  }
  ll imod()const{
    ll n=_mod-2;
    ll ans = 1,x=_num;
    while(n != 0){
        if(n&1) ans = ans*x%_mod;
        x = x*x%_mod;
        n = n >> 1;
    }
    return ans;
  }
 public:
  explicit mint(ll num=0,ll M=1000000007){
      _mod=M;
      _num=num;
      if(_num<0){
          if(_num>=-_mod)_num=_mod+_num;
          else _num=_mod-(-_num)%_mod;
      }
      else if(_num>=_mod) _num%=_mod;
  }
  mint(const mint &cp){_num=cp._num;_mod=cp._mod;}
  
  mint operator+ (const mint &x)const{ return mint(_num + x._num , _mod); }
  mint operator- (const mint &x)const{ return mint(_num - x._num , _mod);}
  mint operator* (const mint &x)const{ return mint(_num * x._num , _mod); }
  mint operator/ (const mint &x)const{ return mint(_num * x.imod() , _mod);}
  
  mint operator+=(const mint &x){ return set(_num + x._num); }
  mint operator-=(const mint &x){ return set(_num - x._num); }
  mint operator*=(const mint &x){ return set(_num * x._num); }
  mint operator/=(const mint &x){ return set(_num * x.imod());}

  mint operator= (const ll x){ return set(x); }
  mint operator+ (const ll x)const{return *this + mint(x,_mod); }
  mint operator- (const ll x)const{ return *this - mint(x,_mod); }
  mint operator* (const ll x)const{ return *this * mint(x,_mod); }
  mint operator/ (const ll x)const{ return *this/mint(x);}

  mint operator+=(const ll x){ *this = *this + x;return *this; }
  mint operator-=(const ll x){ *this = *this - x;return *this; }
  mint operator*=(const ll x){ *this = *this * x;return *this;}
  mint operator/=(const ll x){ *this = *this / x;return *this;}

  bool operator==(const mint &x)const{return _num==x._num;}
  bool operator!=(const mint &x)const{return _num!=x._num;}

  friend mint operator+(ll x,const mint &m){return mint(m._num + x , m._mod);}
  friend mint operator-(ll x,const mint &m){return mint( x - m._num , m._mod);}
  friend mint operator*(ll x,const mint &m){return mint(m._num * (x % m._mod) , m._mod);}
  friend mint operator/(ll x,const mint &m){return mint(m.imod() * (x % m._mod) , m._mod);}

  explicit operator ll() { return _num; }
  explicit operator int() { return (int)_num; }
  
  friend std::ostream& operator<<(std::ostream &os, const mint &x){ os << x._num; return os; }
  friend std::istream& operator>>(std::istream &is, mint &x){ll val; is>>val; x.set(val); return is;}
};
int main(){
    int N,K;
    int a[100];
    cin>>N>>K;
    REP(i,N) cin>>a[i];
    vector<vector<mint>> dp(N+1,vector<mint>(2*K+2));
    dp[N][K]=1;
    for(int i=N-1;i>=0;--i) for(int j=K;j>=0;--j){
        dp[i][j]=dp[i+1][j]+dp[i][j+1]-dp[i+1][j+a[i]+1];
    }
    cout<<dp[0][0]<<endl;
}


Measured memory_bytes: 319360
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

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

typedef long long ll;

int SURP = 1000000007;

int main(){
	int N,C;
	cin >> N >> C;

	int D[C+2][C+2] ={};
	int cc[C+2][3] = {};

	REP(i,C){
		REP(j,C){
			cin >> D[i+1][j+1];
		}
	}

	REP(i,N){
		REP(j,N){
			int col;
			cin >> col;
			cc[col][(i+j+2)%3]++;
		}
	}


	int ret = 1 << 30;
	REPI(i,1,C+1){
		REPI(j,1,C+1){
			REPI(k,1,C+1){
				if(i!=j && j!=k && i!=k){
					int tmp = 0;

					REPI(l,1,C+1){
						tmp += cc[l][0] * D[l][i];
						tmp += cc[l][1] * D[l][j];
						tmp += cc[l][2] * D[l][k];
					}
					if (ret > tmp) ret = tmp;
				}
			}
		}
	}

	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if(a + b == 15){
			System.out.println("+");
		}else if(a * b == 15){
			System.out.println("*");
		}else{
			System.out.println("x");
		}
	}
}


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

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define pr(a, b) pair<a, b>
#define si set<int>
#define sl set<long long>
#define pq prioirty_queue
#define all(v) v.begin(),v.end()
#define left (2*idx)+1
#define right (2*idx)+2
#define frt(i,a,b) for(int i=a; i<b; i++)
#define rew(i,a,b) for(int i=a; i>=b; i--)
#define fre(i,a,b) for(int i=a; i<=b; i++)
#define pb push_back

#define test if(true)

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << "\n";   
    return 0;
}

Measured memory_bytes: 384