akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define re register
#define ri re int
#define il inline
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x)
{
	T f=1;x=0;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
	x*=f;
	return x;
}
ll rd(){ll x;rd(x);return x;}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
const int inf=1<<30;

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main()
{
	int n;cin>>n;ll ans=0;
	F(i,1,n) F(j,1,n) F(k,1,n) ans+=gcd(gcd(i,j),k);
	cout<<ans<<endl;
	return 0;
}
/////////////

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std ; 
# define pb push_back
# define ll long long 
# define endl "\n"
const int MOD = 998244353; 

ll power(ll a , ll n)
{
	ll res = 1;
	
	while(n)
	{
		if(n & 1)
			res = (res * a) % MOD;
		
		n >>= 1;
		a = (a * a) % MOD;
	}
	
	return res;
}



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

	int n ; 
	cin >> n ; 
	int a[n+1] ; 
	int cnt = 0 ; 
	for(int  i = 1 ;i <= n ; ++i)
		cin >> a[i] ; 
	for(int i = 1 ; i <= n ; ++i) {
		if(i%2 != 0 && a[i] % 2 != 0)
			++cnt ; 
	}

	cout << cnt ;

   	return 0 ; 
}



Measured memory_bytes: 3648
import heapq
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 0
heap = []
heapq.heappush(heap, -a[0])
for i in range(1, n):
    tmp = heapq.heappop(heap)
    tmp *= -1
    ans += tmp
    heapq.heappush(heap, -a[i])
    heapq.heappush(heap, -a[i])
print(ans)

Measured memory_bytes: 31548
n=int(input())
a=list(map(int,input().split()))
num=0

for i in range(n):
  if a[i]%2==1:
    num+=1
    
if num%2==0:
  print("YES")
elif num%2==1 and n==num:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 14104
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#define SF scanf
#define PF printf
#define Mkp make_pair
#define MAXN 810
using namespace std;
typedef pair<int,int> pii;
char s[MAXN][MAXN];
int h,w,k;
int vis[MAXN][MAXN],dist[MAXN][MAXN];
queue<pair<int,int> > q;
bool allow(int x,int y){
	if(x<=0||y<=0||x>h||y>w||s[x][y]=='#'||vis[x][y]==1)
		return 0;
	return 1;	
}
int t[6][4]={{0,1},{0,-1},{1,0},{-1,0}};
void bfs(int x,int y){
	vis[x][y]=1;
	q.push(Mkp(x,y));
	while(!q.empty()){
		pii newq=q.front();
		q.pop();
		if(dist[newq.first][newq.second]==k)
			break;
		for(int i=0;i<4;i++){
			int xx=newq.first+t[i][0];
			int yy=newq.second+t[i][1];
			if(allow(xx,yy)==0)
				continue;
			vis[xx][yy]=1;
			dist[xx][yy]=dist[newq.first][newq.second]+1;
			q.push(Mkp(xx,yy));
		}
	}
}
int mindist(int x,int y){
	return min(min((x+k-2)/k,(y+k-2)/k),min((h-x+k-1)/k,(w-y+k-1)/k));	
}
int main(){
	int stx,sty;
	SF("%d%d%d",&h,&w,&k);
	for(int i=1;i<=h;i++)
		SF("%s",s[i]+1);
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			if(s[i][j]=='S'){
				stx=i;
				sty=j;
			}
	bfs(stx,sty);
	int ans=1+mindist(stx,sty);
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			if(vis[i][j]==1){
				ans=min(ans,1+mindist(i,j));
			}
	PF("%d",ans);
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 1000000000;

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

using namespace std;
int main() {
	int n; cin >> n;

	vector<int>a(n);
	rep(i, n)cin >> a[i];

	map <int , int> mp;

	rep(i, n) {
		mp[a[i]]++;
	}

	int count = 0;
	for (pair<int, int>p : mp) {
		if (p.second % 2 == 1) {
			count++;
		}
	}
	cout << count << endl;
}

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

int main(){
  int N;
  int valuer=0;
  string s;
  cin >> N;
  cin >> s;
  for(int i = 0; i < N; i++){
    if(s[i] =='R'){
      valuer++;
    }
  }
  valuer*=2;
  if(valuer > N){
    cout <<"Yes"<<endl;
  }
  else{
    cout <<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define mp make_pair
#define F first
#define S second
#define B begin
#define E end
#define PB push_back
#define endl "\n"

#define FORS(i, j, k, step) for (int i=j; i<k; i+=step)
#define FOR(i, j, k) for (int i=j; i<k; i++) 
#define RFORS(i, j, k, step) for (int i=j; i>=k; i-=step)
#define RFOR(i, j, k, step) for(int i=j; i>=k; i--)
#define REP(i, k) for(int i = (0); i < (k); i++ )
#define RREP(i, k) for(int i = j; i >= (k); i-- )

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

template<typename T>
void read_vec(vector<T>& v, int n){
    T tmp;
    REP(i, n){
        cin>>tmp;
        v.push_back(tmp);
    }
}

void solve(){
	int d, t, s;
	cin>>d>>t>>s;
	if((float)d/s <= (float)t){
		cout<<"Yes"<<endl;
	}	
	else cout<<"No"<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int TC =1;
    //cin>>TC;

    REP(tc, TC){
    	solve();
    }

}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define ms memset
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define lower_bound lb
#define upper_bound ub

int main()
{
    int cnt = 0;
    int l, r; cin >> l >> r;
    int d; cin >> d;
    for (int i = l; i <= r; i++){
        if (i % d ==0) cnt++;
    }
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <algorithm>

using namespace std;
typedef long long llong;

#define MAX 1000

int main()
{
  int k, n;
  int P[MAX];
  llong ans = 0;

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

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

  sort(P, P + n);

  for (int i = 0; i < k; i++)
  {
    ans += P[i];
  }

  printf("%lld", ans);

  return 0;
}

Measured memory_bytes: 1708
import itertools as it
n,c= map(int,input().split())
dtab = []
dtab.append([0 for _ in range(c+1)])
for i in range(c):dtab.append([0] + list(map(int,input().split())))
ctab = []
ctab.append([0 for _ in range(n+1)])
for i in range(n):ctab.append([0]+list(map(int,input().split())))
ssd = [{},{},{}]
for i in range(1,n+1):
    for j in range(1,n+1):
        temp = (i+j)%3
        temp2 = ctab[i][j]
        ssd[temp][temp2] = ssd[temp].get(temp2,0) + 1
e = [i+1 for i in range(c)]
cpm = it.permutations(e, 3)
ming=999999999
for f in cpm:
    fl=list(f)
    cg = 0
    for i in range(3):
        for p in ssd[i].keys():cg += dtab[p][fl[i]] * ssd[i][p]
    ming = min(ming,cg)
print(ming)

Measured memory_bytes: 7156
/*siddharth goyal*/
#include<bits/stdc++.h>
using namespace std;
#define   pb              push_back
#define   REP(i,n)        for(int i=1;i<=n;i++)
#define   FOR(i,a,b)      for(int i=a;i<=b;i++)
#define   all(v)          v.begin(),v.end()
#define   F               first
#define   S               second
#define   vl              vector<LL>
#define   itr             ::iterator it
#define   lb              lower_bound
#define   ub              upper_bound
#define   LL              long long
#define   ULL             unsigned long long
#define   ret             return 
#define   sz(x)           (LL)x.size()
LL n,i,j ; 
string ans ;
string s,t ;
LL dp[3000+4][3004] ;  
int main()
{   // Read the constraints,highlights,Time Limit,Test Cases
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s>>t ; 
    LL n = (LL)s.length(),m = sz(t) ; 
    s = "X" + s ; 
    t = "T" + t ; 
    for(int i=1;i<=n;i++)
    {  for(int j=1;j<=m;j++)
         if(s[i]==t[j]) dp[i][j] = dp[i-1][j-1] + 1 ; 
          else dp[i][j] = max(dp[i-1][j],dp[i][j-1]) ;  
    }
    LL I = n,J = m ; 
    while(I>0 and J>0)
    {  if(s[I]==t[J]) ans.pb(s[I]),I--,J-- ; 
       else 
       {  if(dp[I-1][J]>=dp[I][J-1]) I-- ; 
          else J-- ;   
       }
    }
    reverse(all(ans)) ; 
    cout<<ans<<endl; 
}
//Check for 0,1 and other corner cases.

Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
priority_queue <string> Q;
string s;
int k;
map <string, bool> M;
int main()
{
	cin >> s >> k;
	for(int i = 0; s[i]; ++ i){
		int rear = i;
		string p = "";
		while(Q.size() < k && s[rear])
			if(! M[p = p + s[rear ++]]){
				Q.push(p);
				M[p] = true;
			}
		while(s[rear] && Q.top() > (p = p + s[rear ++]))
			if(! M[p]){
				Q.pop();
				Q.push(p);
				M[p] = true;
			}
	}
	cout << Q.top();
	return 0;
}

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

int64_t gcd(int64_t a, int64_t b)
{
    if (a < b)
    {
        swap(a, b);
    }
    while (b != 0)
    {
        int64_t t = a % b;
        a = b;
        b = t;
    }
    return a;
}

int count(int x)
{
    int res = 0;
    while (x % 2 == 0)
    {
        res++;
        x >>= 1;
    }
    return res;
}

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a.at(i);
        a.at(i) /= 2;
    }

    int c = count(a.at(0));
    for (int i = 0; i < N; i++)
    {
        if (count(a.at(i)) != c)
        {
            cout << 0 << endl;
            return 0;
        }
        a.at(i) >>= c;
    }
    M >>= c;

    int64_t l = 1;
    for (int i = 0; i < N; i++)
    {
        int64_t g = gcd(l, a.at(i));
        l = l / g * a.at(i);
        if (l > M)
        {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << (M / l + 1) / 2 << endl;
    return 0;
}


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

using namespace std;

typedef vector<int> vi;

int dfs(int u, int dest, const vector<vi> &adj, vector<bool> &vis)
{
	if(u == dest)
		return 1;
	vis[u] = true;
	int ret = 0;
	for(auto v: adj[u])
	{
		if(!vis[v])
			ret += dfs(v,dest,adj,vis);
	}
	return ret;
}

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	// freopen("input.txt", "r", stdin);

	int n, m;
	while(cin >> n >> m)
	{
		int u, v;
		vector<vi> adj(n);
		for(int i=0; i<m; i++)
		{
			cin >> u >> v;
			u--;
			v--;
			adj[u].push_back(v);
			adj[v].push_back(u);
		}
		
		bool ok = true;

		vi fours;
		int mores = 0;
		for(int i=0; i<n; i++)
		{
			if(adj[i].size()&1)
			{
				ok = false;
				break;
			}
			if(adj[i].size() == 4)
				fours.push_back(i);
			else if(adj[i].size() > 4)
				mores++;
		}

		if(!mores)
		{
			if(fours.size() < 2)
			{
				ok = false;
			}
			else if(fours.size() == 2)
			{
				vector<bool> vis(n);
				ok = ok && (dfs(fours[0],fours[1],adj,vis) == 2);
			}
		}

		if(ok)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 7680
using System;

namespace B_Ordinary_Number
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var p = new int[n];
            var a = 0;
            for (var i = 0; i < n; i++)
            {
                p[i] = int.Parse(input[i]);
            }
            for (var j = 1; j < n - 1; j++)
            {
                if ((p[j - 1] < p[j] && p[j] < p[j + 1]) || (p[j - 1] > p[j] && p[j] > p[j + 1]))
                {
                    a++;
                }
            }
            Console.WriteLine(a);
        }
    }
}

Measured memory_bytes: 13140
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0

for i in range(1, n):
    if (x[i]-x[i-1])*a <= b:
        ans += (x[i]-x[i-1])*a
    else:
        ans += b
print(ans)

Measured memory_bytes: 14252
// AOJ 0558: Cheese
// 2017.10.3 bal4u@uu

#include <stdio.h>
#include <ctype.h>

#define QMAX 2000000
typedef struct { int r, c, s; } Q;
Q q[2000005]; int top, end;
char map[1002][1002]; int h, w;
int sr[10], sc[10];
int mv[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};
int mk[1002][1002];

int bfs(int sr, int sc, int gr, int gc)
{
	int r, c, s, i, r2, c2;
	static int v = 0;

	mk[sr][sc] = ++v;
	q[0].r = sr, q[0].c = sc, q[0].s = 0, top = 0, end = 1;
	while (top < end) {
		r = q[top].r, c = q[top].c, s = q[top].s; if (++top == QMAX) top = 0;
		if (gr == r && gc == c) return s;
		for (i = 0; i < 4; i++) {
			r2 = r + mv[i][0], c2 = c + mv[i][1];
			if (r2 < 0 || r2 >= h || c2 < 0 || c2 >= w || map[r2][c2] == 'X') continue;
			if (mk[r2][c2] == v) continue;
			mk[r2][c2] = v;
			q[end].r = r2, q[end].c = c2, q[end].s = s+1; if (++end == QMAX) end = 0;
		}
	}
	return 0;
}

int main()
{
	int n, i, r, c, ans;
	char a;

	scanf("%d%d%d", &h, &w, &n);
	for (r = 0; r < h; r++) {
		scanf("%s", map[r]);
		for (c = 0; c < w; c++) {
			if (map[r][c] == 'S')
				sr[0] = r, sc[0] = c, map[r][c] = '.';
			else if (isdigit(a = map[r][c]))
				sr[a-'0'] = r, sc[a-'0'] = c, map[r][c] = '.';
		}
	}
	for (ans = 0, i = 0; i < n; i++) ans += bfs(sr[i], sc[i], sr[i+1], sc[i+1]);
	printf("%d\n", ans);
}

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

long long a, b, c, ans = 0;

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

    cin >> a >> b >> c;
    if(a%2 || b%2 || c%2){
            cout<<0;
            return 0;
    }
    long long a_ = a, b_ = b, c_ = c;
    while(1)
    {

         int aa = (b+c)/2;
         int bb = (a+c)/2;
         int cc = (a+b)/2;
         a=aa; b=bb; c=cc;
         if(a == a_ && b == b_ && c == c_){
            cout<<-1;
            break;
         }
         ans++;
         if(a%2 || b%2 || c%2){
            cout<<ans;
            break;
         }

    }
    return 0;
}


Measured memory_bytes: 256
//I Guds namn
#include <algorithm>
#include <iostream>
#include <set>

using namespace std;

int main()
{
	int n; cin >> n;
	int free = 0;
	set<int> cols;
	for(int i = 0;i < n;i++)
	{
		int a; cin >> a; a /= 400;
		if(a > 7)
			free++;
		else
			cols.insert(a);
	}
	int ans = cols.size();
	cout << max(ans, 1) << ' ';
	ans += free;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define MAX_V 100005



int main(void){
	ll n,a;
	cin>>n;
	ll ans=0;
	rep(i,n){
		cin>>a;
		while(a%2 == 0){
			ans++;
			a /= 2;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int dp[100000];
int arr[12] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};

int solve(int i) {

  if (dp[i] >= 0) return dp[i];

  int tmp = 999999999;

  for (int j = 0; j < 12; j++) {
    int k = arr[j];

    if (i < k) break;
    tmp = min(solve(i-k) + 1, tmp);
  }

  return dp[i] = tmp;

}

int main() {
  int N;

  cin >> N;

  for (int i=0; i < N+1; i++)
    dp[i] = -1;
  dp[0] = 0;

  cout << solve(N);

  return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test lli t;cin>>t;while(t--)
#define vll vector<lli>
#define mll map<lli,lli>
#define vvll vector<vector<lli>>
#define vpll vector<pair<lli,lli>>
#define vvpll vector<vector<pair<lli,lli>>>
#define mpll map<pair<lli,lli>,lli>
#define pll pair<lli,lli>
#define sll stack<lli>
#define qll queqe<lli>
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define mod 1000000007
#define ma 1000000000000000000
#define mi -1000000000000000000
lli vis[100001]={0};
vll adj[100001];
queue<lli>q;
void explore(lli n)
{
	while(!q.empty())
	{
		lli s=q.front();
		q.pop();
	for(auto i:adj[s])
	{
		if(vis[i]==0)
		{
			vis[i]=1;
		   q.push(i);
		}
	}
	}
}

int main()
{
 
  fastio
  lli n,m,i,j,u,v,d=0,a;
  cin>>n>>m;
  for(i=0;i<m;i++)
  {
  	cin>>u>>v;
  	adj[u].pb(v);
  	adj[v].pb(u);
  }
 
 
  for(i=1;i<=n;i++)
  {
  	if(vis[i]==0)
  	{
		vis[i]=1;
		q.push(i);
  		explore(i);
  		d++;
  	}
  
}
  cout<<d-1;
	return 0;
}

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

long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

long ansget(long ans, long mod){
    long temp;
    if(ans >= 0)
        return ans % mod;
    else{
        temp = -ans;
        temp /= mod;
        return ans + (temp + 1) * mod;
    }
}

int main()
{
    int N, K;
    long A[100005], seki[100005], sho[100005], cb[100005];
    long mod = 1000000007, ans, temp, temp1;
    cin >> N >> K;
    REP(i, N)
        cin >> A[i];
    sort(A, A+N);
    if(K==1)
        cout << 0 << endl;
    else{
        seki[0] = 1;
        sho[0] = 1;
        REP(i, N){
            seki[i+1] = (long)(i + 1) * seki[i];
            seki[i+1] %= mod;
            sho[i+1] = modinv((long)(i+1), mod) * sho[i];
            sho[i+1] %= mod;
        }
        cb[N-K] = A[N-1] - A[0];
        cb[N-K] = ansget(cb[N-K], mod);
        for(int i = 1; i <= N-K; i++){
            cb[N-K-i] = cb[N-K-i+1] + A[N-i-1];
            cb[N-K-i] = ansget(cb[N-K-i], mod);
            cb[N-K-i] -= A[i+1-1];
            cb[N-K-i] = ansget(cb[N-K-i], mod);
        }
        ans = 0;
        REP(i, N-K+1){
            temp = seki[K+i-2] * sho[i];
            temp = ansget(temp, mod);
            temp *= sho[K-2];
            temp = ansget(temp, mod);
            temp *= cb[i];
            temp = ansget(temp, mod);
            ans += temp;
            ans = ansget(ans, mod);
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3072
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
s=s2(n)

from collections import Counter
c=Counter(s)
d=dict(c.most_common())
m=max(d.values())
a=[x for x,y in d.items() if y==m]
[print(x) for x in sorted(a)]

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


#define fast_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
typedef long long int lli;
typedef long long ll;
typedef long double ld;


signed main(){
    fast_IO;
    int t=1;
    //cin>>t;
    while(t--){
        char a;
        cin>>a;
        if(isupper(a))
            cout<<"A";
        else
            cout<<"a";
    }   
    return 0;
}


Measured memory_bytes: 3648
import copy

n=int(input())
org_set=set([i for i in range(1,10**5)])
edges=[]
relations={}
nodes=[]
for i in range(n-1):
    a,b=map(int,input().split(" "))
    edges.append([a,b])
    relations.setdefault(a,[]).append(b)
    nodes.append([])
nodes.append([])
nodes.append([])

max_color=0
for start in range(1,n+1):
    targets=relations.get(start,[])
    color=1
    for target in targets:
        if color in nodes[start]:
            color+=1
        else:
            pass
        nodes[target].append(color)
        if color>=max_color:
            max_color=color
        color+=1

print(max_color)
for edge in edges:
    print(nodes[edge[1]][0])

Measured memory_bytes: 96808
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
#define ld long double
using namespace std;

int main()
{ 


fast;

string s,t;
cin>>s>>t;

ll n=s.length();
ll n2=t.length();

if(n2==n+1)
{
  bool f=1;
  for(int i=0;i<n;i++)
    if(s[i]!=t[i])
    {
      f=0;
      break;
    }
    if(f)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
}
else
  cout<<"No";




}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
# define ll long long int
using namespace std;
const int maxn=100000+5;
ll n1=0,n2=0;
ll root(ll arr[],ll a)
{  
    while(arr[a]!=a)
    {
        arr[a]=arr[arr[a]];
        a=arr[a];
    }
    return a;
}
void unioun(ll arr[],ll size[],ll a,ll b)
{
    int roota,rootb;
    roota=root(arr,a);
    rootb=root(arr,b);
    if (size[roota]<size[rootb])
    {
        arr[roota]=arr[rootb];
        n1=size[roota];
        n2=size[rootb];
        size[rootb]+=size[roota];
        size[roota]=0;
        
    }
    else
    {
        arr[rootb]=arr[roota];
        n1=size[roota];
        n2=size[rootb];
        size[roota]+=size[rootb];
    }
}
bool find(ll arr[],ll a,ll b)
{
    int roota,rootb;
    roota=root(arr,a);
    rootb=root(arr,b);
    if (roota==rootb)
    {
        return true;
    }
    return false;
}
int main() {
	ll size[maxn],a[maxn],count[maxn],ans[maxn],i,x,y,n,m;
	cin>>n>>m;
	vector<pair<int,int> >v;
	for(i=1;i<n+1;i++)
	{
	    a[i]=i;
	    size[i]=1;
	    count[i]=1;
	}
//	v.push_back(make_pair(0,0));
	for(i=0;i<m;i++)
	{
	    cin>>x>>y;
	    v.push_back(make_pair(x,y));
	}
	//cout<<v[m-1].first<<' '<<v[m-1].second<<endl;
	ans[m-1]=n*(n-1)/2;
	for(i=m-2;i>=0;i--)
	{
		if(!find(a,v[i+1].first,v[i+1].second))
		{
			unioun(a,size,v[i+1].first,v[i+1].second);
			ans[i]=ans[i+1]-n1*n2;
		}
		else
		{
			ans[i]=ans[i+1];
			//cout<<"anudeep"<<' '<<i;
		}
	}
	for(i=0;i<m;i++)
	{
		cout<<ans[i]<<endl;
	}

}

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
int INF = 1e9+7;

int main() {
    int N;
    cin >> N;
    vi A(N);
    for (int i=0; i<N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    int Alice=0;
    int Bob=0;
    for (int i=0; i<N; i++) {
        if (i%2==0) Alice+=A[i];
        else Bob+=A[i];
    }
    cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,l,r,mid,i;
map<int,int> mp;
int q(int x)
{
	string s;
	if(mp.find(x)!=mp.end()) return mp[x];
	printf("%d\n",x);
	fflush(stdout);
	cin>>s;
	if(s=="Vacant") exit(0);
	return mp[x]=(s=="Male"); 
}
int main()
{
	cin>>n;
	l=0; r=n-1;
	while(r-l>=2)
	{
		mid=(l+r)/2;
		if((q(mid)^(mid%2))!=(q(l)^(l%2)))
		 r=mid;
		else l=mid;
	}
	for(i=l;i<=r;i++) q(i);
	return 0;
}

Measured memory_bytes: 852
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long a = in.nextLong(), b = in.nextLong(), c = in.nextLong();
			int ans = 0;
			while (true) {
				if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
					out.println(ans);
					return;
				}
				if (a == b && b == c) {
					out.println(-1);
					return;
				}

				long ta = a;
				long tb = b;
				long tc = c;

				ans++;
				a = (tb + tc) / 2;
				b = (tc + ta) / 2;
				c = (ta + tb) / 2;
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


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

int main(){
  
  int ans = 0;
  string s, t;

  cin >> s >> t;
  
  rep(i, s.length()){
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;
  
  return 0;
  
}

Measured memory_bytes: 3912
N = gets.to_i
a = gets.split(" ").map(&:to_i)
ans = 0
flag = true

while flag == true do
    N.times do |i|
        if a[i] % 2 == 0
            a[i] /= 2
        else
            flag = false
            break
        end
    end
    if flag == true
        ans += 1
    end
end

puts ans 


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

typedef long long ll;

int main() {
  int n;
  ll c;
  cin >> n >> c;
  vector<ll> lx(n);
  vector<ll> lv(n);
  for (int i = 0; i < n; ++i) {
    cin >> lx[i] >> lv[i];
    // cout << lx[i] << " " << lv[i] << endl;
  }
  vector<ll> lmax(n);
  vector<ll> rmax(n);
  ll best_l = 0;
  ll v_l = 0;
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    v_l += lv[i];
    best_l = max(best_l, v_l-lx[i]);
    lmax[i] = best_l;
    ans = max(ans, best_l);
  }
  ll v_r = 0;
  ll best_r = 0;
  for (int i = n-1; i >= 0; --i) {
    v_r += lv[i];
    best_r = max(best_r, v_r-(c-lx[i]));
    rmax[i] = best_r;
    ans = max(ans, best_r);
  }
  v_l = 0;
  for (int i = 0; i < n-1; ++i) {
    v_l += lv[i];
    ans = max(ans, v_l-2*lx[i]+rmax[i+1]);
  }
  v_r = 0;
  for (int i = n-1; i > 0; --i) {
    v_r += lv[i];
    ans = max(ans, v_r-2*(c-lx[i])+lmax[i-1]);
  }
  cout << ans << endl;
}



Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], *di = dn, dt;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint(), M = getint(), Q = getint();
	bool S[2001][2001];
	rep1(i, N) {
		if (ci - cn + M + 5 > cm) rep1(j, M) S[i][j] = getcha() - '0';
		else rep1(j, M) S[i][j] = *ci++ - '0';
		getcha();
	}
	int B[2001][2001], C[2001][2001], D[2001][2001];
	rep(i, M + 1) {
		B[0][i] = 0;
		C[0][i] = 0;
		D[0][i] = 0;
	}
	rep(i, N + 1) {
		B[i][0] = 0;
		C[i][0] = 0;
		D[i][0] = 0;
	}

	rep1(i, N) {
		rep1(j, M) {
			B[i][j] = B[i][j - 1] + S[i][j];
			if (i != 1) C[i][j] = C[i][j - 1] + (S[i - 1][j] & S[i][j]);
			if (j != 1) D[i][j] = D[i][j - 1] + (S[i][j - 1] & S[i][j]);
		}
	}
	rep1(j, M) rep1(i, N) {
		B[i][j] += B[i - 1][j];
		C[i][j] += C[i - 1][j];
		D[i][j] += D[i - 1][j];
	}
	
	rep(q, Q) {
		int a = getint(), b = getint(), c = getint(), d = getint();

		int kotae = B[c][d] - B[c][b - 1] - B[a - 1][d] + B[a - 1][b - 1] - C[c][d] + C[c][b - 1] + C[a][d] - C[a][b - 1] - D[c][d] + D[c][b] + D[a - 1][d] - D[a - 1][b];
		putint(kotae);

	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 54400
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007

using namespace std;

int main()
{

   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    int ans = 15;
    int x, i = 5;
    while (i--)
    {
        cin >> x;
        ans -= x;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3592
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=2e5+10;
const int inf=1e9;
int n,k,c;
char s[N];
int L[N],R[N];
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>k>>c;
	cin>>s+1;
	int pre=-inf,j=0;
	for(int i=1;i<=n;i++){
		if(s[i]=='o'&&i-pre-1>=c){
			pre=i;
			L[++j]=i;
		}
	}
	pre=inf,j=k+1;
	for(int i=n;i>=1;i--){
		if(s[i]=='o'&&pre-i-1>=c&&j>=1){
			pre=i;
			R[--j]=i;
		}		
	}
	for(int i=1;i<=k;i++){
		//cout<<L[i]<<" "<<R[i]<<endl;
		if(L[i]==R[i]) cout<<L[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <assert.h>
#include <memory.h>
#include <queue>
using namespace std;

#define N 200002

vector<int >edge[N];

char s[N];
int vis[N][4];
char t[4] ={'A','A','B','B'};
bool dfs(int node,int ord) {
  if(vis[node][ord]==2) {
    return false;
  }
  else if(vis[node][ord]==1) {
    return true;
  }
  vis[node][ord] = 1;
  char tt = t[(ord+1)%4];
  for(int i=0;i<edge[node].size();++i) {
    int ch = edge[node][i];
    char g = s[ch];
    if(tt==g) {
      if(dfs(ch,(ord+1)%4)) {
        return true;
      }
    }
  }
  vis[node][ord] = 2;
  return false;
}
void solve() {
  int n,m;scanf("%d %d",&n,&m);
  scanf(" %s",s+1);
  for(int i=n;i;--i) {
    if(s[i]=='B') {
      vis[i][0] = 2;
    }
  }
  for(int i=m;i;--i) {
    int a,b;scanf("%d %d",&a,&b);
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for(int i=1;i<=n;++i) {
    if(!vis[i][0] && s[i]=='A') {
      if(dfs(i,0)) {
        printf("Yes\n" );
        return;
      }
    }
  }
  printf("No\n");
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  int k2 = k;
  for (int i = 0; i < 100; i++) {
    if (n % k2 == n) {
      cout << i + 1 << endl;
      break;
    }
    k2 *= k;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,Q;
ll a[100000];

ll solve(ll S){
  ll sum=0,ans=0,k=0;
  for(int i=0;i<N;i++){
    sum+=a[i];
    while(sum>S){
      sum-=a[k];
      k++;
    }
    ans+=(i-k+1);
  }
  return ans;
}

int main(){
  cin>>N>>Q;
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<Q;i++){
    ll x;
    cin>>x;
    cout<<solve(x)<<endl;
  }

  return 0;
}

Measured memory_bytes: 3872
import sys
readline = sys.stdin.readline
from collections import Counter

def solve():
    N = int(readline())
    A = list(map(int, readline().split()))

    c = Counter(A)
    A = set(A)

    f = [0] * (10 ** 6 + 10)

    for a in A:
        for b in range(a * 2, len(f), a):
            f[b] = 1
    
    count = 0
    for a in A:
        if f[a] == 0 and c[a] == 1:
            count += 1

    print(count)

solve()

Measured memory_bytes: 155152
#include<stdio.h>
#include<string.h>

int main()
{
    char str[10000];
    int cnt=0,k;
    scanf("%s",str);
    int len=strlen(str);
    if(str[0]=='A'&&str[len-1]>='a'&& str[len-1]<='z'&& str[1]>='a'&&str[1]<='z'){
        for(k=2;k<=len-2;k++){
            if(str[k]=='C')cnt++;
        }
        if(cnt==1)printf("AC\n");
        else printf("WA\n");
    }
    else printf("WA\n");
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int W[30],V[30],D,p,i,j,q=0,dp[30],l,r=0;
char c[3];
int main()
{
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	scanf("%d",&D);
	for(i=2;i--;)
	{
		scanf("%d",&j);
		l+=j;
		for(;j--;)
		{
			scanf("%s%d\n",c,&p);
			if(strcmp(c,"DD")*strcmp(c,"D")==0)
			{
				W[q]=strlen(c);
				V[q++]=p;
			}
		}
	}
	for(i=0;i<q;i++)
	{
		for(j=D;j>=W[i];j--)
			if(dp[j-W[i]]>=0)
			{
				dp[j]=dp[j]<dp[j-W[i]]+V[i]?dp[j-W[i]]+V[i]:dp[j];
				r=r>dp[j]?r:dp[j];
			}
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <locale>

using namespace std;

int main()
{
  string s;
  getline(cin, s);

  locale loc;
  char c;
  for (string::size_type i = 0; i < s.length(); i++)
  {
    c = s[i];
    if (isupper(c, loc))
      c = tolower(c, loc);
    else if (islower(c, loc))
      c = toupper(c, loc);
    std::cout << c;
  }

  cout << endl;
  return 0;
}

Measured memory_bytes: 3172
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)


	max := max(a,b,c)
	sum := a+ b+c
	cnt := 0
	if 3 *max % 2 ==  sum %2 {
		for ; max*3 != sum; sum += 2 {
			cnt++
		}

	} else {
		for ; (max+1) * 3 != sum; sum += 2 {
			cnt++
		}
	}

	fmt.Println(cnt)
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}


Measured memory_bytes: 1772
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

int main() {
    int n = 0, a = 0;
    cin >> n >> a;
    vector<int> x(n);
    for (int i=0; i<n; i++) {
        cin >> x.at(i);
    }
    for (int i=0; i<n; i++) {
        x.at(i) -= a;
    }
    vector<vector<ll>> dp(n+1, vector<ll>(2*n*a+1));
    for (int j=0; j<=n; j++) {
        for (int i=0; i<=2*n*a; i++) {
            if (j == 0) {
                if (i == n*a) {
                    dp.at(j).at(i) = 1;
                }
                else {
                    dp.at(j).at(i) = 0;
                }
            }
            else {
                if (i - x.at(j-1) >= 0 && i - x.at(j-1) <= 2*n*a) {
                    dp.at(j).at(i) = dp.at(j-1).at(i) + dp.at(j-1).at(i - x.at(j-1));
                }
                else {
                    dp.at(j).at(i) = dp.at(j-1).at(i);
                }
            }
        }
    }
    cout << dp.at(n).at(n*a) - 1 << endl;
    return 0;
}


Measured memory_bytes: 2304
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		long n = nl();
		long result = 0;
		
		if(n % 2 == 0) {			
			long tmpn5 = n / 10;
			result += tmpn5;
			while(tmpn5 > 0) {
				tmpn5 /= 5;
				result += tmpn5;
			}
		}
		System.out.println(result);
	}
	

	//Find greatest common divisor
	static long gcd (long a, long b) {
		return b > 0 ? gcd(b, a%b) : a;
	}
	//Find least common multiple
	static long lcm (long a, long b) {
		return a * b / gcd(a, b);
	}
	//Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath)))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(scanner.nextLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
template<class T>
T gcd(T a, T b)
{
	if (b == 0) return a;
	a %= b;
	return gcd(b, a);
}
int main() {
	ll A, B, C, D;
	cin >> A >> B >> C >> D;
	ll total = B - A + 1;
	ll Cdiv = B / C - ((A - 1) / C);
	ll Ddiv = B / D - ((A - 1) / D);
	ll LCM = C * D / gcd(C, D);
	ll CDdiv = B / LCM - ((A - 1) / LCM);
	ll ans = total - Cdiv - Ddiv + CDdiv;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)

{
int A, B, c, d, e,max;
 
scanf("%d" , &A);
scanf("%d" , &B);

c = A + B;
d = A - B;
e = A * B;

max = c;

if (d > max) {
	max = d;
}
if (e > max) {
	max = e;
}

printf("%d", max);

return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod =  998244353;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976
const double PI = 3.1415926535897932;

int main()
{
    int n,m; cin >> n >>m;
    vector<int> G[100005];
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int ans[n];
    bool v[n]; 
    rep(i,n) v[i] = false;
    queue<P> q;
    q.push({0,-1});
    while(!q.empty()){
        P p = q.front(); q.pop();
        int now = p.first, par = p.second;
        v[now] = true;
        ans[now] = par;
        for(auto i : G[now]){
            if(i != par && !v[i]){
                q.push({i,now});
                v[i] = true;
            }
        }
    }
    cout << "Yes" << endl;
    rep(i,n){
        if(i != 0) cout << ans[i]+1 << endl;
    }   
}


Measured memory_bytes: 11248
from itertools import permutations

def input_list():
    return list(map(int, input().split()))

def main():
    n, m, r = input_list()
    rlist = input_list()
    rlist = [r-1 for r in rlist]
    d = [[float('inf')]*n for i in range(n)]
    for i in range(n):
        d[i][i] = 0
    
    for i in range(m):
        a, b, c = input_list()
        d[a-1][b-1] = c
        d[b-1][a-1] = c

    for k in range(n):
        for i in range(n):
            for j in range(n):
                distance = d[i][k]+d[k][j]
                if d[i][j] > distance:
                    d[i][j] = distance

    ans = float('inf')
    for p in permutations(rlist):
        distance = 0
        for i in range(r-1):
            distance += d[p[i]][p[i+1]]

        if ans > distance:
            ans = distance

    print(ans)

main()
        


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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  vector<pair<string, int>> inp(n);
  for (auto&pa : inp) cin >> pa.first >> pa.second;
  string sleep;
  cin >> sleep;
  int acc = 0;
  for (auto&pa : inp) {
    acc += pa.second;
    if (pa.first == sleep) {
      acc = 0;
    }
  }
  cout << acc << endl;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define NL endl
#define pi 2.0*acos(0.0)
#define INTM 1e18
#define mod 1e9+7
#define FOR(i,j,n)    for(ull i=j;i<n;i++)
#define RFOR(i,j,n)    for(ll i=j;i>=n;i--)

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

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

    ll a,b;
    cin>>a>>b;
    if(a >= b){
        FOR(i,0,a) cout<<b;
        cout<<endl;
    }
    else{
        FOR(i,0,b) cout<<a;
        cout<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
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<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }
 
int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
 
map<ll, ll> memo;
ll a, b, c, d;
 
ll calc(ll n){
    if (memo.count(n)) return memo[n];
    if (n == 0) return 0;
    if (n == 1) return d;
    ll ret = 1e18;
    if (n < 1e9) chmin(ret, n * d);
    double tmp = (double)n * d;
    if (tmp < 1e18) chmin(ret, n * d);
    if (n % 2 == 0) chmin(ret, calc(n / 2) + a);
    else{
        chmin(ret, calc(n / 2) + a + d);
        chmin(ret, calc(n / 2 + 1) + a + d);
    }
    if (n % 3 == 0){
        chmin(ret, calc(n / 3) + b);
    }else{
        int r = n % 3;
        chmin(ret, calc(n / 3) + b + r * d);
        chmin(ret, calc(n / 3 + 1) + b + (3 - r) * d);
    }
    if (n % 5 == 0){
        chmin(ret, calc(n / 5) + c);
    }else{
        int r = n % 5;
        chmin(ret, calc(n / 5) + c + r * d);
        chmin(ret, calc(n / 5 + 1) + c + (5 - r) * d);
    }
    return memo[n] = ret;
}
 
ll solve(){
    ll n;
    cin >> n >> a >> b >> c >> d;
    memo.clear();
    return calc(n);
}
 
int main(void){
    int t;
    cin >> t;
    REP(i,t){
        cout << solve() << endl;
    }
 
    return 0;
}

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

int main(){
	int n, a[100], i;
	cin >> n;

	for(i=0; i<n; i++){
		cin >> a[i];
	}
	for(i=n-1; i>=0; i--){
		if(i == n-1) cout << a[i];			
		else cout << " " << a[i];	
	}
	
	cout << endl;

	return 0;
		
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int b[30], a[30][30];

bool check(int a[30][30], int b[30], int m, int c, int i){
    int sum = 0;
    for(int j = 1; j <= m; ++j){
        sum += a[i][j] * b[j];
    }
    if(sum + c > 0)
        return true;
    else
        return false;
}

int main(){
    int n, m, c;
    cin >> n >> m >> c;


    for(int j = 1; j <= m; ++j){
        cin >> b[j];
    }
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= m; ++j){
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; ++i){
        if(check(a, b, m, c, i))
            ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld s, w;
	cin >> s;
	cin >> w;
	if (w >= s)
		cout << "unsafe";
	else
		cout << "safe";
	return 0;
}

Measured memory_bytes: 3636
// Problem : C - Connect Cities
// Contest : AtCoder - ACL Beginner Contest
// URL : https://atcoder.jp/contests/abl/tasks/abl_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

void DFSUtil(int v,vector<int> adj[], int visited[]) 
{ 
    visited[v] = 1;
    vector<int>::iterator i; 
    for(i = adj[v].begin(); i != adj[v].end(); ++i) 
        if(!visited[*i]) 
            DFSUtil(*i,adj, visited); 
}

int connectedComponents(int visited[],vector<int> v[],int n) 
{ 
  	int cnt=0;
    for (int i=1; i<=n; i++) 
    { 
        if (visited[i] == 0) 
        { 
            DFSUtil(i,v, visited); 
            cnt++;
        } 
    } 
    return cnt;
} 
 

int main() {
	fast;
	int n,m;
	cin>>n>>m;
	vector<int> v[n+1];
	int x,y;
	while(m--){
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}  
	int visited[n+1];
	memset(visited,0,sizeof visited);
	cout<<connectedComponents(visited,v,n)-1;
	return 0;
}






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

int n, dp[4001];

int main(){
    fill(dp, dp+4001, 0);
    dp[0] = 1;
    for(int x = 0; x < 4; x++){
        for(int y = 4000; y >= 0; y--){
            int lim = min(1000, y);
            for(int z = 1; z <= lim; z++){
                dp[y] += dp[y-z];
            }
        }
    }
    while(scanf("%d", &n) != EOF){
        printf("%d\n", dp[n]);
    }
    return 0;
}

Measured memory_bytes: 1204