akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    int a,b,c,k;
    cin >> a >> b >> c >>k;
    //a<b<cにする
    int count=0;
    while(!(a<b)){
        b*=2;
        count++;
    }
    while(!(b<c)){
        c*=2;
        count++;
    }
    string ans="Yes";
    if(k<count)ans="No";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
from collections import deque
box = deque()
n = int(input())
for _ in range(n):
    a, b, *c = map(int, input().split())
    if a == 0:
        if b == 0:
            box.appendleft(c[0])
        else:
            box.append(c[0])
    elif a == 1:
        print(box[b])
    else:
        if b == 0:
            box.popleft()
        else:
            box.pop()


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

int main(){
  int N;
  cin >> N;
  int num = 0;
  
  if(N >= 10){
    num += 9;
    if(N >= 100){
      if(N >= 1000){
        num += 900;
        if(N >= 10000){
          if(N >= 100000){
          	num += 90000;
          }else{
            num += (N-9999);
          }
        }
      }else{
        num += (N-99);
      }
    }
  }else{
    num += N;
  }
  
  cout << num << endl;
  
  return 0;
}


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

int main()
{
    char s[10];
    scanf("%s", s);
    for(int i=0; s[i+1]; i++)
    {
        if(s[i]=='A' && s[i+1]=='C')return 0*printf("Yes\n");
    }
    printf("No\n");
}


Measured memory_bytes: 764
#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>;

int main(){
  int n;
  cin >>n;
  for(int a=1;a<=9;++a){
    for(int b=1;b<=9;b++){
      if(a*b==n){
        puts("Yes");return 0;
      }
    }
  }
  
  puts("No");
return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
}

Measured memory_bytes: 50712
#include <iostream>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <vector>
#include <math.h>
#include <stack>
#include <deque>

int get_gcd(int a,int b)
{
	if(b==0) 
		return a;
	return get_gcd(b,a%b);
}

int main()
{
	int n,k,a,gcd,max;
	scanf("%d %d",&n,&k);
	scanf("%d",&gcd);
	max = gcd;
	for(int i = 1; i < n; ++i)
	{
		scanf("%d",&a);
		gcd =get_gcd(gcd,a);
		if(max < a)
			max = a;
	}
	if(max < k)
		printf("IMPOSSIBLE");
	else if(k % gcd == 0)
		printf("POSSIBLE");
	else
		printf("IMPOSSIBLE");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();

		if (s.equals("AAA") || s.equals("BBB")) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 22996
// this program solves bipartite matching using 
// maximum flow algorithm

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

const int N = 220;
const int M = 22000;

struct Edge {
	int to, cap, next;
} es[M];

int S, T;  // source, sink
int SIZE = 0; // number of edges
int h[N]; // pointer to edge list
int dist[N], queue[N]; // for calculating shortest path

// add forward and backtracked edge
void add(int u, int v, int cap) {
	int i = SIZE++;
	es[i].to = v;
	es[i].cap = cap;
	es[i].next = h[u];
	h[u] = i; 
	int j = SIZE++;
	es[j].to = u;
	es[j].cap = 0;
	es[j].next = h[v];
	h[v] = j; 
}

// returns whether find a path from S to T
bool bfs() {
	int front = 0, back = 0;
	memset(dist, -1, sizeof(dist));
	queue[back++] = S;
	dist[S] = 0;
	while (front < back) {
		int x = queue[front++];
		for (int i = h[x]; i != -1; i = es[i].next)
			if (es[i].cap > 0) {
				int y = es[i].to;
				if (dist[y] == -1) {
					dist[y] = dist[x] + 1;
					queue[back++] = y;
				}
			}
		if (dist[T] != -1)
			return true;
	}
	return false;
}

// returns the flow pushed from x to T
int dfs(int x, int flow) {
	if (x == T) return flow;
	int dy = dist[x] + 1, ret = 0;
	for (int i = h[x]; i != -1 && flow > 0; i = es[i].next) {
		int y = es[i].to;
		if (dist[y] != dy) continue;
		int f = dfs(y, std::min(flow, es[i].cap));
		if (f != 0) {
			es[i].cap -= f;
			es[i^1].cap += f;
			ret += f;
			flow -= f;
		}
	}
	if (flow > 0)
		dist[x] = -1;
	return ret;
}

void run() {
	int n1, n2, m, u, v;
	scanf("%d%d%d", &n1, &n2, &m);
	memset(h, -1, sizeof(h));
	S = 0, T = n1 + n2 + 1;
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &u, &v);
		u++, v++;
		add(u, n1 + v, 1);
	}
	for (int i = 1; i <= n1; i++)
		add(S, i, 1);
	for (int i = 1; i <= n2; i++)
		add(n1 + i, T, 1);
	int flow = 0;
	while (bfs())
		flow += dfs(S, 0x3fffffff);
	printf("%d\n", flow);
}

int main() {
	run();
}

Measured memory_bytes: 2892
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    string s,t=""; cin>>s;
    
    ll i=0;
    while(i<sz(s)){
        if(s[i]=='B' && s[i+1]=='C'){
            t+="D";
            i+=2;
        }
        else{
            t+=s[i];
            i++;
        }
    }
    
    
    ll ans=0,stock=0;
    rep(i,sz(t)){
        if(t[i]=='A') stock++;
        else if(t[i]=='D') ans+=stock;
        else stock=0;
    }
    
    cout<<ans<<endl;
}



Measured memory_bytes: 3920
N,T = map(int,input().split())
t = list(map(int,input().split()))

res = T
now = 0
for i in range(N):
    if  i == 0:
        now = t[i]
        continue
    if now+T <= t[i]:
        res += T
        now =  t[i]
    else:
        res += t[i]-now
        now = t[i]
print(res)

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

#define ff first
#define ss second
#define pb push_back
#define ll long long
#define mod 1000000007
#define ull unsigned long long
#define mst(ss,b) memset(ss,b,sizeof(ss));
#define pl(x) cout << #x << "= " << x << endl;
const int inf=0x3f3f3f3f;
const int N=3e5+10;



int  main(){
    ll n;
    cin>>n;
    cout<< (n/11*2 + ((n%11==0) ? 0:((n%11<=6)?1:2)) )<<endl;
    return 0;
}

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

int main(){
  int x1,x2,x3,x4,y1,y2,y3,y4;cin >> x1 >> y1 >> x2 >> y2;
  int X = x2-x1,Y = y2-y1;
  x3 = x2-Y;y3 = y2+X;x4 = x1-Y;y4 = y1+X;
  printf("%d %d %d %d\n",x3,y3,x4,y4);
  return 0;
}

Measured memory_bytes: 256
from collections import Counter, defaultdict
H, W = map(int, input().split(' '))
d = defaultdict(int)
for i in range(H):
    for k, v in Counter(input()).items():
        d[k] += v
if H % 2 == 0 and W % 2 == 0:
    for i in d.values():
        if i % 4 != 0:
            print('No')
            exit()
    print('Yes')
elif H % 2 == 0 or W % 2 == 0:
    cnt = H//2 if not H % 2 else W//2
    for i in d.values():
        if i % 4 == 0:
            continue
        elif i % 2 == 0:
            cnt -= 1
            if cnt >= 0:
                continue
        print('No')
        exit()
    print('Yes')
else:
    odd = 1
    cnt = (H+W-2)//2
    for i in d.values():
        if i % 2 != 0 and odd:
            odd -= 1
            continue
        elif i % 4 == 0:
            continue
        elif i % 2 == 0 and cnt:
            cnt -= 1
            continue
        else:
            print('No')
            exit()
    print('Yes')


Measured memory_bytes: 3316
#include <stdio.h>

int linear(int *,int,int);

int main(){
  int sum=0,len1,len2,i,A[10000],elem;

  scanf("%d",&len1);
  for(i=0;i<len1;i++){
    scanf("%d",&A[i]);
  }
  
  scanf("%d",&len2);
  for(i=0;i<len2;i++){
    scanf("%d",&elem);
    sum+=linear(A,elem,len1);
  }

  printf("%d\n",sum);
  
  return 0;
}

int linear(int A[],int elem,int len){
  int i;
  for(i=0;i<len;i++){
    if(A[i]==elem) return 1;
  }
  return 0;
}



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

int main(){
    int n;
    cin>>n;
    int cnt=0;
    int minv=1000005;
    
    rep(i,n){
        int p;
        cin>>p;
        if(p<minv){
            cnt++;
            minv=min(minv,p);
        }
    }
    
    cout<<cnt<<endl;
    
    return 0;
}

Measured memory_bytes: 3560
N,M = map(int,input().split())
li = []

for i in range(M):
  li.append(list(map(int,input().split())))

for x in range(N):
  y = x + 1
  ans = 0
  for index, s in enumerate(li):
    if y == s[0]:
      ans += 1
    
    if y == s[1]:
      ans += 1
  
  print(ans)

Measured memory_bytes: 3060
def main():
    n,m = map(int,input().split())
    
    lm = 1
    rm = n
    for i in range(m):
        l,r = map(int,input().split())
        lm = max(lm,l)
        rm = min(rm,r)
    
    print(max(0,rm-lm+1))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}
std::vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend
#define all(x) (x).begin(),(x).end()
int n,k;
std::vector<int> a;
int main(){
  cin >> n >> k;
  a.resize(n);
  for (size_t i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << roundup((n-1),(k-1)) << endl; 
}


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

using namespace std;

int main() {

	vector<int> vec(3);

	for (auto &a : vec)
		cin >> a;

	sort(vec.begin(), vec.end());

	cout << vec[0] << ' ' << vec[1] << ' ' << vec[2] << endl;

	return 0;

}

Measured memory_bytes: 3108
n,m = map(int,input().split())
stus, ps = [], []
ans = []
for i in range(n):
    stus.append(list(map(int,input().split())))
for i in range(m):
    ps.append(list(map(int,input().split())))

for i in range(n):
    tmp = -1
    ans.append('')
    for j in range(m):
        dist = abs(ps[j][0] - stus[i][0]) + abs(ps[j][1] - stus[i][1])
        if tmp == -1 or dist < tmp:
            tmp = dist
            ans[i] = j+1

print('\n'.join(list(map(str,ans))))

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) c.begin(), c.end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int a, b;
    cin >> a >> b;
    if (a + b < 10) cout << a + b << endl;
    else cout << "error" << endl;
    return 0;
}

Measured memory_bytes: 256
K, N = gets.chomp.split(" ").map(&:to_i)
A = gets.chomp.split(" ").map(&:to_i)
A.sort!

longest = 0

A.each_with_index do |a, i|
  n1 = (a - A[(i - 1) % N]) % K
  longest = n1 if longest < n1

  n2 = (A[(i + 1) % N] - a) % K
  longest = n2 if longest < n2
end

puts(K - longest)


Measured memory_bytes: 18288
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cassert>
using namespace std;

const int N = 1000;
int n,m,arga,argb;

int main()
{
	scanf("%d%d%d%d",&n,&m,&arga,&argb);
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=m; j++)
		{
			printf("%d",(i<=argb)^(j<=arga));
		} puts("");
	}
	return 0;
}

Measured memory_bytes: 1280
import scala.io.StdIn.readLine

object Main extends App {
  def read(e:Double,n:Double,angle:Double):(Double,Double) = {
    val l = readLine.split(",").map(_.toDouble);val x=l(0);val y=l(1)
    if(x==0 && y==0) (e,n)
    else read(e+x*Math.cos(Math.toRadians(angle)),n+x*Math.sin(Math.toRadians(angle)),angle-y)
  }
  val (e,n) = read(0,0,90)
  println(e.toInt)
  println(n.toInt)
}

Measured memory_bytes: 43732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();

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

    int m;
    map<int, int> ans;
    for (int x=1; x*x <= 2*n; ++x){
    for (int y=1; y*y <= 2*n; ++y){
    for (int z=1; z*z <= 2*n; ++z){
        m = x*x + y*y + z*z + x*y + y*z + z*x;
        ++ans[m];
    }
    }
    }
    rep(i, n){
        cout << ans[i+1] << endl;
    }
    return 0;
}

Measured memory_bytes: 7432
input_lst = input().split()
a=int(input_lst[0])
b=int(input_lst[1])
k=int(input_lst[2])
count = 0
for i in range(a):
  if (a%(a-i)==0 and b%(a-i)==0):
    if count+1 == k:
      print(a-i)
      break
    else:
      count += 1

Measured memory_bytes: 3064
while True:
    h,w=map(int,input().split())
    if h==0 and w==0:
        break
    for i in range(h):
        for j in range(w):
            if (i+j)%2==0:
                print("#",end="")
            else :
                print(".",end="")
        print("")
    
    print("")


Measured memory_bytes: 7012
#include <stdio.h>

int main(){
	int a = 0;
	int b = 0;
	scanf("%d%d",&a,&b);//入力
	int area=a*b;
	int rect=(2*a)+(2*b);
	printf("%d%s%d\n",area," ",rect);//出力
	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

int main( void )
{
	int S, h, m, s;
	scanf("%d", &S);
	h = S / 3600;
	m = (S % 3600) / 60;
	s = (S % 3600) % 60;
	printf("%d:%d:%d\n", h,m,s);
	return 0;
}
	


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

#define printl(s) cout << s << endl;
#define print(s) cout << s << endl; return 0;
#define yes cout << "Yes" << endl; return 0;
#define no cout << "No" << endl; return 0;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)
#define birep(i,n) for (int i = 0; i < (1<<(n));i++)
#define isOne(bit,i) (bit & (1 << i))
using ll = long long;
using pint = pair<int, int>;

const ll modseed = pow(10,9) + 7;

template <typename T>
vector<T> getValues(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
int N,M,cnt;

int main(){
  cin >> N >> M;
  vector<bitset<10>> swis(M);
  vector<int> ps(M);
  rep(i,M){
    int k; cin >> k;
    bitset<10> swi;
    rep(j,k){
      int s;
      cin >> s;
      bitset<10> b("0000000001");
      swi = swi | (b<<(s-1)); 
    }
    swis.at(i) = swi;
  }
  rep(i,M){
    cin >> ps.at(i);
  }

  birep(i,N){
    bitset<10> b(i);
    int ri = 0;
    rep(j,M){
      bitset<10> res = b & swis.at(j);
      if(res.count()%2==ps.at(j)){
        ri++;
      }
    }
    if(ri==M){
      cnt++;
    }
  }
  print(cnt);
}


Measured memory_bytes: 3588
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int main() {
	int A, B;

	cin >> A >> B;

	cout << max(A + B, max(A - B, A * B)) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
    /*static class Fast
    {
        BufferedReader br;
        StringTokenizer st;
 
        public Fast()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }*/
    public static void main(String args[] ) throws Exception {
        //Fast in=new Fast();
        Scanner in=new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out); 
	    int a=in.nextInt(),b=in.nextInt(),c=in.nextInt();
	    out.println(a==b?c:a==c?b:a);
	
        out.close();
    }
}



Measured memory_bytes: 26836
#include<bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
int32_t main()
{
        int n,i;
        cin>>n;
        int h[n],dp[n];
        for(i=0;i<n;i++)
        {
            cin>>h[i];
        }
        dp[0]=0;
        dp[1]=abs(h[1]-h[0]);
        for(i=2;i<n;i++)
        {
            dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
        }
        cout<<dp[n-1]<<"\n";
    return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int C = 0;
  for (int i = A; i <= B; i++){
    int s1 = i / 10000 % 10;
    int s2 = i / 1000 % 10;
    int s4 = i / 10 % 10;
    int s5 = i % 10;
    if (s1 == s5 && s2 == s4){
      C += 1;
    }
  }
  cout << C << endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include <cstdio>
#include<cstring>
#include <cstdlib>  
#include<cmath>   
#include <cctype>
#include<string>
#include<set>
#include <iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility>
#define LEN 100005
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) {if (x % y == 0) return y;else return LGCD(y, x % y);}
ll LLCM(ll x, ll y) {return x * y / LGCD(x, y);}

int GCD(int x, int y) {if (x % y == 0) return y;else return GCD(y, x % y);}
int LCM(int x, int y) {return x * y / GCD(x, y);}
ll dp[10000][10000];
ll combination(ll n, ll r) {
         if (n == r){dp[n][n] = 1;}
	else if (r == 0) {return dp[n][0] = 1;}
	else if (r == 1) {return dp[n][1]=n;}
	else {dp[n][r]=dp[n - 1][r - 1] % 1000000007 + dp[n - 1][r] % 1000000007;
	return dp[n][r]=combination(n - 1, r - 1) % 1000000007 + combination(n - 1, r) % 1000000007;}
}
int main() {
	int a, b;
	cin >> a>>b;
	for (int i = b - a + 1;i <= b + a - 1;i++)cout << i << " ";
	


	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

int main() {
  string S;
  cin >> S;
  i64 Q;
  cin >> Q;
  i64 now = 0;
  deque<char> dq;
  for(auto c: S) {
    dq.push_back(c);
  }
  while(Q--) {
    i64 t;
    cin >> t;
    if(t == 1) {
      now ^= 1;
    }
    else {
      i64 f;
      cin >> f;
      f--;
      char c;
      cin >> c;
      if((f ^ now) == 0) {
        dq.push_front(c);
      }
      else {
        dq.push_back(c);
      }
    }
  }
  vector<char> vec(dq.begin(), dq.end());
  if(now == 1) {
    reverse(all(vec));
  }
  for(auto c: vec) {
    cout << c;
  }
  cout << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned char ubyte;

const ld EPS = 1e-9;
const ld PI = acos(-1.0);
const int INF = (int)1e9 + 5;
const ll LINF = (ll)1e18 + 5;

bool eq(double a, double b) {
	return fabs(a - b) < EPS;
}

template<class T>
T sqr(const T & x) { return x * x; }

template<class T> 
ll abs(const T & x) { return x < 0 ? -x : x; }

template<class T>
ll myround(const T & x) { return x < 0 ? x - 0.5 : x + 0.5; }

template<class T> 
bool chmin(T & x, const T & y) {
	if (y < x) {
		x = y;
		return true;
	}
	return false;
}

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
	os << "{";
	for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
		os << *it;
		if ((it + 1) != v.end()) os << ", ";
	}
	os << "}";
	return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template<class T> 
bool chmax(T & x, const T & y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

#define all(a) (a).begin(), (a).end()

const int N = 110000;

bool pp[N];
int primes[N], primesCnt;

void sieve() {
	for (int i = 2; i < N; i++) {
		if (!pp[i]) {
			for (int j = i + i; j < N; j += i) {
				pp[j] = true;
			}
		}
	}
	for (int i = 2; i < N; i++) {
		if (!pp[i]) {
			primes[primesCnt++] = i;
		}
	}
}

map<ll, int> cnt;
map<pair<ll, ll>, int> cnt2;
ll p[60], q[60], zz;

void getPrimeDivisors(ll x) {
	zz = 0;
	for (int i = 0; 1LL * primes[i] * primes[i] <= x; i++) {
		int cur = primes[i];
		if (x % cur == 0) {
			int z = 0;
			while (x % cur == 0) {
				++z;
				x /= cur;
			}
			p[zz] = cur;
			q[zz] = z;
			zz++;
		}
	}
	if (x != 1) {
		p[zz] = x;
		q[zz] = 1;
		zz++;
	}
}

pair<ll, ll> normalize(ll x) {
	getPrimeDivisors(x);
	ll prod = 1, prod2 = 1;
	for (int i = 0; i < zz; i++) {
		int tmp = q[i];
		q[i] %= 3;
		while (q[i]--) {
			prod *= p[i];
		}
		q[i] = tmp;
		q[i] = (3 - q[i] % 3) % 3;
		while (q[i]--) {
			if (prod2 != -1 && ll(1e12) / prod2 / p[i] > 0) prod2 *= p[i];
			else prod2 = -1;
		}
	}
	return make_pair(prod, prod2);
}

int main() {
	//srand(time(0));
#ifdef LOCAL 
	freopen("input.txt", "r", stdin);
#else
#endif

	sieve();

	int n;
	scanf("%d", &n);

	int res = 0;

	while (n--) {
		ll x;
		scanf("%lld", &x);
		cnt[x]++;
	}
	
	cerr << "read" << endl;

	for (auto it : cnt) {
		cnt2[normalize(it.first)] += it.second;
	}

	cerr << "normalized" << endl;

	for (auto it : cnt2) {
		ll cur = it.first.first;
		ll inv = it.first.second;
		if (cur < inv && cnt2.count({inv, cur})) {
			res += max(it.second, cnt2[make_pair(inv, cur)]);
		}
		else if (cnt2.count({inv, cur}) == 0) {
			res += it.second;
		}
		else if (cur == inv) {
			res++;
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 13056
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  ll h,n;
  cin >> h >> n;
  vector<ll> a(n);
  ll ans = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    ans += a[i];
  }
  if(ans < h) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void){
    string S,T;
    cin >> S >> T;
    int N=S.size();
    int ans=0;
    for(int i=0;i<N;i++){
        if(S.at(i)!=T.at(i)){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3908
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

typedef struct {
    int xMin = 0;
    int xMax = 0;
    int yMin = 0;
    int yMax = 0;
} rect;

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

    int W, H, N; cin >> W >> H >> N;

    rect r;
    r.xMax = W; r.yMax = H;

    rep(i, 0, N) {
        int x, y, a; cin >> x >> y >> a;

        switch(a) {
            case 1: r.xMin = max(r.xMin, x); break;
            case 2: r.xMax = min(r.xMax, x); break;
            case 3: r.yMin = max(r.yMin, y); break;
            case 4: r.yMax = min(r.yMax, y); break;
        }
    }

    int res = max(0, (r.xMax-r.xMin)) * max(0, (r.yMax-r.yMin));
    cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int a,b,c,mi,ma;
int main(){
	scanf("%d%d%d",&a,&b,&c);
	mi=ma=a;
	if (b<mi) mi=b;
	if (c<mi) mi=c;
	if (b>ma) ma=b;
	if (c>ma) ma=c;
	printf("%d\n",ma-mi);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>　　　
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int a[33]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51} ;
int k;
int main(){
	cin>>k;
	cout<<a[k];
}

Measured memory_bytes: 256
#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;

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

	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	vector<int> b(n + 1);
	for (int i = n; i > 0; i--) {
		int c = 0;
		for (int j = 2 * i; j <= n; j += i) {
			c ^= b[j];
		}
		b[i] = (c ^ a[i]);
	}
	vector<int> tk;
	for (int i = 1; i <= n; i++) {
		if (b[i]) tk.push_back(i);
	}
	cout << tk.size() << endl;
	for (auto t : tk) {
		cout << t << ' ';
	}
	cout << endl;
}


Measured memory_bytes: 3192
module Main where

import Control.Applicative
import Text.Printf

getInt :: IO Int
getInt = head <$> getInts

getInts :: IO [Int]
getInts = map read . words <$> getLine

main :: IO ()
main = do
  { ss <- getInt
  ; let (q , s ) = divMod ss 60
  ; let (h , m ) = divMod q 60
  ; putStrLn(show h ++ ":" ++ show m ++ ":" ++ show s)
  }


Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[M];
        int[] b = new int[M];
        for (int i = 0; i < M; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }

        int ans = solve(N, M, a, b);

        System.out.println(ans);
    }

    private static int solve(int N, int M, int[] a, int[] b) {
        int count = 0;

        int[][] g = new int[N][N];
        for (int i=0; i<M; i++) {
            g[a[i]-1][b[i]-1] = 1;
        }

        /* debug print graph
        for (int i=0; i<N; i++) {
            for (int j=0; j<N; j++) {
                System.out.print(g[i][j] + " ");
            }
            System.out.println();
        }
        */

        for (int i=0; i<M; i++) {
            if (!isConnected(N, M, a, b, g, i)) {
                count++;
            }
        }

        return count++;
    }

    /*
     * i番目の辺を除外したときもグラフは連結か
     */
    private static boolean isConnected(int N, int M, int[] a, int[] b, int[][] g, int i) {
        boolean[] f = new boolean[N];

        dfs(N, g, a[i]-1, b[i]-1, f, 0);
        
        /* debug print flag
        for (int j=0; j<N; j++) {
            System.err.print(" " + f[j]);
        }
        System.err.println();
        */

        boolean result = true;
        for (int j=0; j<N; j++) {
            result &= f[j];
        }

        return result;
    }

    private static void dfs(int N, int[][] g, int a, int b, boolean[] f, int pos) {
        if (f[pos]) return;
        f[pos] = true;

//        System.err.println("dfs: pos=" + pos);
        for (int i=0; i<N; i++) {
//            System.err.println("[debug] check move to " + i);
            if (i == pos || f[i]) {
//                System.err.println("\talready checked");
                continue;
            }

            if (g[pos][i] == 1 || g[i][pos] == 1) {
//                System.err.println("\toriginally reachable node: " + i);
                if (a == pos && b == i || a == i && b == pos) {
//                    System.err.println("\texcluded for this condition: " + a + ", " + b);
                    continue;
                }

//                System.err.println("\tnext node: " + i);
                dfs(N, g, a, b, f, i);
            }
        }
    }
}

Measured memory_bytes: 23124
#include <iostream>

using namespace std;

int main(void){
  int year;
  int a;
  int b;

  cin >> year;
  if(year == 1) {
    cout << "Hello World" << endl;
  } else if(year == 2) {
    cin >> a;
    cin >> b;
    cout << a+b << endl;
  }
}
  


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

using namespace std;
using ll = long long int;

int main() {
    ll N, a;
    cin >> N;
    vector<ll> A = vector<ll>();
    vector<ll> A2 = vector<ll>();
    for(int i = 0; i < N; i++){
        cin >> a;
        A.emplace_back(a);
        A2.emplace_back(a);
    }
    sort(A.begin(), A.end());
    ll max1 = A[N-1];
    ll max2 = A[N-2];
    for(int i = 0; i < N; i++){
        if (A2[i] == max1){
            cout << max2 << endl;
        }else{
            cout << max1 << endl;
        }
    }
    return 0;
}

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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T&a,const T&b){if(b<a){a=b;return true;}return false;}

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    int a, b, x, y, n, m, h;
    string s;
    
    cin >> a >> b >> h >> m;
    
    double C = abs((h * 30.0 + m * 0.5) - m * 6.0);
    double c = sqrt(a * a + b * b - 2 * a * b * cos(C * PI / 180));
    cout << c;
    
    return 0;
}


Measured memory_bytes: 4200
#include<stdio.h>
#define MAX 100000

int a[MAX],n;

int partition(int p,int r){
  int x,i,j,t;
  x=a[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(a[j]<=x){
      i++;
      t=a[i];
      a[i]=a[j];
      a[j]=t;
    }
  }
  t=a[i+1];
  a[i+1]=a[r];
  a[r]=t;

  return i+1;
}

int main(){
  int i,q;

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

  q=partition(0,n-1);

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

  return 0;
}



Measured memory_bytes: 2140
#include<cstdio>

int m,n,c[10][10],x,y,cnt,xxx[10],yyy[10];
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};

int dfs(int x,int y,int z){
  int ret = 0;
  for(int i=0;i<4;i++){
    int nx = x, ny = y;
    while(true){
      nx += dx[i];
      ny += dy[i];
      if(nx<0||nx>=n||ny<0||ny>=m) break;
      if(c[nx][ny]==2){
        if(z==cnt) return 1;
      }else if(c[nx][ny]==1){
        c[nx][ny] = -1;
        ret += dfs(nx,ny,z+1);
        c[nx][ny] = 1;
        break;
      }
    }
  }
  return ret;
}

bool solve(){
  scanf("%d %d",&m,&n);
  if(m==0&&n==0) return false;
  for(int i=0;i<10;i++){
    xxx[i] = yyy[i] = 0;
  }
  cnt = 0;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      scanf("%d",&c[i][j]);
      if(c[i][j]!=0){
        xxx[i]++;
        yyy[j]++;
      }
      if(c[i][j]==1) cnt++;
      else if(c[i][j]==2){
        x = i;
        y = j;
      }
    }
  }
  printf("%d\n",dfs(x,y,0));
  return true;
}

int main(){
  while(true) if(!solve()) break;
}

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

using namespace std;
typedef long long ll;
const int M=510;
int sg[M][M];
int SG(int x, int y) {
    if (!x&&!y) return sg[x][y]=0;
    if (sg[x][y]!=-1) return sg[x][y];
    set<int> vis;
    for (int i=1; i*2<=x; i++) {
        vis.insert(SG(x-2*i, y+i));
    }
    for (int i=1; i*2<=y; i++) {
        vis.insert(SG(x+i, y-2*i));
    }
    for (int i=0; ; i++) if (!vis.count(i)) return sg[x][y]=i;
}
int main()
{

#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#else
#endif // LOCAL
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    memset(sg, -1, sizeof(sg));
//    for (int i=0; i<10; i++) {
//        for (int j=0; j<10; j++) {
//            memset(sg, -1, sizeof(sg));
//            cout << SG(i, j) << " ";
//        }
//        cout << endl;
//    }
    ll n, m;
    cin >> n >> m;
    if (abs(n-m)<=1) cout << "Brown";
    else cout << "Alice";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <iomanip> //cout << fixed << setprecision(12) << ans << endl;
using namespace std;
 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define loop(i, l, r) for(int i = l; i < r; i++)
#define rloop(i, l, r) for(int i = l; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vec_i;

const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const int INF = 1e9;
const int MOD = 1e9+7;

int main()
{
	int n;
	cin >> n;
	vec_i v(n);
	rep(i, n) cin >> v[i];

	v[0]--;
	loop(i, 1, n){
		if(v[i]<v[i-1]){
			cout << "No" << endl;
			return 0;
		}
		if(v[i]>v[i-1]) v[i]--;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 640
import math
N = 100000
prime = [True]*(N+1)
prime[0] = prime[1] = False
for i in range(N+1):
    if prime[i]:
        for j in range(2*i, N+1, i):
            prime[j] = False

n = int(input())
f = math.factorial(n)
res = 1

i = 2
while f!=1:
    if prime[i]:
        cc = 1
        while f%i==0:
            f=f//i
            cc+=1
        res*=cc
    i+=1
print(res%1000000007)

Measured memory_bytes: 3828
import java.util.*;
import java.lang.*;

public class Main {
	static long sum;
	static String s;
	static int n;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		s = sc.next();
		n = s.length();
		sum = 0;
		dfs(0, 0, s, 0);
		System.out.println(sum);
	}
	static void dfs(int count, int len, String s, long su) {
		if (count == n - 1) {
			su += Long.valueOf(s);
			sum += su;
			return;
		}
		dfs(count + 1, len + 1, s, su);
		String kiri = s.substring(0, len + 1);
		long po = Long.valueOf(kiri);
		dfs(count + 1, 0, s.substring(len + 1), su + po);
	}
}

Measured memory_bytes: 23252
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n >= 64)
            System.out.println(64);
        else if (n >= 32)
            System.out.println(32);
        else if (n >= 16)
            System.out.println(16);
        else if (n >= 8)
            System.out.println(8);
        else if (n >= 4)
            System.out.println(4);
        else if (n >= 2)
            System.out.println(2);
        else
            System.out.println(1);
    }
}


Measured memory_bytes: 23636
import sys,bisect

from sys  import stdin,stdout

from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right

from math import gcd,ceil,floor,sqrt

from collections import Counter,defaultdict,deque,OrderedDict

from queue import Queue,PriorityQueue

from string import ascii_lowercase

sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 998244353
mod = 10**9+7

def isPrime(n):
    
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n%2 == 0 or n%3 == 0):return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n%i==0 or n%(i+2)==0):
            return False
    return True


def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

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

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")
    
def DFS(dictionary,vertex,visited):
    visited[vertex]=True
    stack=[vertex]
    print(vertex)
    while stack:
        a=stack.pop()
        for i in dictionary[a]:
            if not visited[i]:
                print(i)
                visited[i]=True
                stack.append(i)


def BFS(dictionary, vertex,visited):
    visited[vertex]=True
    q=deque()
    q.append(vertex)
    while q:
        a=q.popleft()
        for i in dictionary[a]:
            if not visited[i]:
                visited[i]=True
                q.append(i)
                print(i)

                


def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    n,x,t=mp()
    if n<=x:
        pr(t)
    else:
        a=x
        b=t
        while a<n:
            a+=x
            b+=t
        pr(b)

    




for _ in range(1):
    solve()
    


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

int main() {
    char a; cin >> a;
    int flag = 0;
    for (char c = 'A'; c <= 'Z'; c++) {
        if (c == a) flag = 1;
    }
    if (flag) cout << "A" << endl;
    else cout << "a" << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int N, M;
bool visited[50];
bool graph[50][50];
bool ALL;

void DFS(int v){
  ALL=true;
  visited[v] = true;
  rep(v2, N){
    if(!(graph[v][v2])) continue;
    if(visited[v2]) continue;
    DFS(v2);
  }
  rep(i, N){if(!(visited[i])) ALL=false;}
}
  


int main(){
  cin >> N >> M;
  int a[M], b[M];
  rep(i, 51){
    graph[i][i]=false;
  }
  rep(i, M){
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    graph[a[i]][b[i]]=true;
    graph[b[i]][a[i]]=true;
  }
  int cnt = 0;
  rep(i, M){
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=false;
    for (int j = 0;j< N; ++j) visited[j] = false;
    DFS(0);
    if(!(ALL)) cnt++;
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      
      	System.out.println(Math.min(a*n, b));
    }
}

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

# Set max recursion limit
sys.setrecursionlimit(10000)


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


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


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


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

dp = None


def main():
    alphabets = "abcdefghijklmnopqrstuvwxyz"

    S = input()

    if len(set(S)) == 26:
        print("None")
        return

    for a in alphabets:
        if a not in S:
            print(a)
            return


main()


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

int main() {
  int N;
  cin >> N;
  int A[200];
  int count = 0;
  for(int i = 0; i < N; i ++) cin >> A[i];
  
  while(true) {
    bool exist_odd = false;
    for (int i = 0; i < N; i ++) {
      if(A[i] % 2 != 0) exist_odd = true;
    }
    
    if(exist_odd) break;
    
    for(int i = 0; i < N; ++i) {
      A[i] /= 2;
    }
    ++count;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    string res;
    if(s == "A")res = "T";
    else if(s == "T")res = "A";
    else if(s == "C") res = "G";
    else res = "C";
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
vector<int> h;
int main(){
  cin >> N;
  h.resize(N);
  int result = 0;
  for(int i=0;i<N;i++){
    cin >> h[i];
  }


  while(true){
    int i = 0;
    if(*max_element(h.begin(),h.end()) == 0){
      break;
    }
    while(i < N){
      if(h[i] == 0){
        i++;
      }
      else{
        result++;
        while(i < N && h[i] > 0){
          h[i]--;
          i++;
        }
      }
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int a,b,c,x;
int main()
{
	cin>>a>>b>>c;
	for(int i=1;i<=10000;i++) 
	{
		x=a*i;
		if(x%b==c)
		{
			cout<<"YES"<<endl;
			return 0;
		}	
	}
	cout<<"NO"<<endl;
	return 0;
}

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

int	compare_for_sort(const void *a, const void *b)
{
	return (int)strcmp((char *)a, (char *)b);
}

int	main(void)
{
	int		i;
	int		n;
	int		num_max;
	int		*count;
	char	str[200000][11];

	scanf("%d", &n);
	count = (int *)malloc(sizeof(int) * n);
	i = -1;
	while (++i < n)
	{
		count[i] = 0;
		scanf("%s", str[i]);
	}
	qsort(str, n, 11, compare_for_sort);
	i = -1;
	num_max = 0;
	while (++i < n - 1)
	{
		if (!strcmp(str[i], str[i + 1])){
			count[i + 1] = count[i] + 1;
			if (count[i + 1] > num_max)
				num_max = count[i + 1];
		}
	}
	i = -1;
	while (++i < n)
	{
		if (count[i] == num_max)
			printf("%s\n", str[i]);
	}
}


Measured memory_bytes: 5244
n, a, b = gets.split.map(&:to_i)

if (b - a).even?
  puts (b - a) / 2
else
  puts [a - 1 + 1 + (1 + b - a - 2) / 2, n - b + 1 + (n - (a + (n - b + 1))) / 2, b - 1, n - a].min
end


Measured memory_bytes: 1788