akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll INF = 1e18;

struct edge {
  ll to, cost;
  edge(ll t, ll c) : to(t), cost(c) {}
};

class Dijkstra {
 public:
  ll n_;
  vector<vector<edge>> G_;
  vl d_;
  vl prev_;

 public:
  Dijkstra(ll n) : n_(n), G_(n), d_(n, INF), prev_(n, -1) {}
  void addEdge(ll v, ll to, ll cost) { G_[v].push_back(edge(to, cost)); }
  void exec(ll s) {
    priority_queue<pll, vector<pll>, greater<pll>> que;
    d_[s] = 0;
    que.push({0, s});

    while (!que.empty()) {
      pll p = que.top();
      que.pop();
      ll v = p.second;
      if (d_[v] < p.first) continue;
      for (auto& e : G_[v]) {
        if (d_[e.to] > d_[v] + e.cost) {
          d_[e.to] = d_[v] + e.cost;
          prev_[e.to] = v;
          que.push({d_[e.to], e.to});
        }
      }
    }
  }
  ll dist(ll g) { return d_[g]; }
  ll prev(ll v) { return prev_[v]; }
};

int main() {
  //
  ll n;
  cin >> n;
  Dijkstra g(n);
  rep(i, n - 1) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    g.addEdge(a, b, 1);
    g.addEdge(b, a, 1);
  }
  // cout << g.G_[0].size() << endl;
  g.exec(0);
  ll dist = g.dist(n - 1);
  // cout << dist << endl;
  ll v = n - 1;
  vl color(n, -1);
  vl path;
  path.emplace_back(n - 1);
  while (v > 0) {
    v = g.prev(v);
    path.emplace_back(v);
  }
  reverse(ALL(path));
  rep(i, path.size()) {
    if (i <= (path.size() - 1) / 2) {
      color[path[i]] = 0;
    } else {
      color[path[i]] = 1;
    }
  }
  // rep(i, n) { cout << color[i] << endl; }
  queue<ll> que;
  rep(i, n) {
    if (color[i] == 0) {
      que.push(i);
    }
  }
  // cout << que.size() << endl;
  while (!que.empty()) {
    ll v = que.front();
    que.pop();
    for (auto& e : g.G_[v]) {
      ll to = e.to;
      if (color[to] == -1) {
        // cout << to << endl;
        color[to] = 0;
        que.push(to);
      }
    }
  }
  ll cnt0 = 0;
  rep(i, n) {
    if (color[i] == 0) {
      cnt0++;
    }
  }
  // cout << cnt0 << endl;
  if (cnt0 > (n - cnt0)) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }
  return 0;
}


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

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

#ifdef __WIN32
#define LLFORMAT "I64"
#define Rand() ((rand() << 15) | rand())
#else
#define LLFORMAT "ll"
#define Rand() (rand())
#endif

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

LL mul(LL b, LL e, LL m)
{
	b %= m;
	e %= m;
	LL t = b * e - LL((long double)b * e / m) * m;
	while (t < 0) t += m;
	while (t >= m) t -= m;
	return t;
}
 
LL Fpm(LL b, LL e, LL m)
{
	LL t = 1;
	for ( ; e; e >>= 1, b = mul(b, b, m))
		if (e & 1) t = mul(t, b, m);
	return t;
}
 
bool witness(int a, LL b)
{
	if (a == b) return 1;
	LL s = b - 1;
	int cnt = 0;
	while (!(s & 1)) s >>= 1, ++cnt;
	LL tmp = Fpm(a, s, b);
	if (tmp == 1) return 1;
	while (cnt)
	{
		if (tmp == b - 1) return 1;
		--cnt;
		tmp = mul(tmp, tmp, b);
		if (tmp == 1) return 0;
	}
	return 0;
}
 
const int p[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}, pn = sizeof(p) / sizeof(p[0]);

bool isprime(LL x)
{
	if (!x) return 0;
	if (x == 1) return 0;
	REP(i, 0, pn) 
	{
		if (!witness(p[i], x)) return 0;
	}
	return 1;
}

set<LL> all;

inline void rho(LL x)
{
	if (isprime(x))
	{
		all.insert(x);
		return;
	}
	if (x <= 100000000)
	{
		for (int i = 2; i * i <= x; ++i)
		{
			if (!(x % i)) all.insert(i);
			while (!(x % i)) x /= i;
		}
		if (x > 1) all.insert(x);
		return;
	}
	while (1)
	{
		LL x0 = 0, x1 = 0;
		int c = Rand();
		LL d = 1;
		int cnt = 0;
		while (d == 1)
		{
			x0 = mul(x0, x0, x);
			(x0 += c) %= x;
			d = __gcd(abs(x0 - x1), x);
			++cnt;
			if (!(cnt & (cnt - 1))) x1 = x0;
		}
		if (d != x)
		{
			rho(d);
			rho(x / d);
			break;
		}
	}
}

inline void decom(LL x)
{
	all.clear();
	REP(i, 0, pn)
	{
		if (!(x % p[i])) all.insert(p[i]);
		while (!(x % p[i])) x /= p[i];
	}
	if (x > 1) rho(x);
}

const int maxn = 100000;

int n;
LL a[maxn + 5];

map<vector<pair<LL, int> >, int> num;

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	int ret = 0;
	REP(i, 0, n) 
	{
		scanf("%" LLFORMAT "d", a + i);
		decom(a[i]);
		vector<pair<LL, int> > tmp;
		for (auto u : all)
		{
			int cnt = 0;
			while (!(a[i] % u)) a[i] /= u, ++cnt;
			cnt %= 3;
			if (cnt) tmp.pb(mp(u, cnt));
		}
		if (SZ(tmp)) ++num[tmp];
		else ret = 1;
	}
	for (auto u : num) if (u.y)
	{
		vector<pair<LL, int> > tmp;
		for (auto v : u.x) tmp.pb(mp(v.x, 3 - v.y));
		if (num.count(tmp))
		{
			int val = num[tmp];
			ret += max(u.y, val);
			num[tmp] = 0;
		}
		else ret += u.y;
	}
	printf("%d\n", ret);
	return 0;
}


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

using namespace std;
typedef long long ll;

int N,M,Q;
int a[50],b[50],c[50],d[50];
vector<int> v;
int max_v;

void dfs(int dd){
    if(dd == 0){
        for(int i=1;i<=M;i++){
            v.push_back(i);
            dfs(1);
            v.pop_back();
        }
        return;
    }
    if(dd == N){
        int vv = 0;
        for(int i=0;i<Q;i++){
            if(v[b[i]-1] - v[a[i]-1] == c[i]) vv += d[i];
        }
        max_v = max(max_v,vv);
        return;
    }
    for(int i=v[v.size()-1];i<=M;i++){
        v.push_back(i);
        dfs(dd+1);
        v.pop_back();
    }
}

int main(){
    cin >> N >> M >> Q;
    for(int i=0;i<Q;i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
    dfs(0);
    cout << max_v << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define eps 1e-9
#define mp make_pair

char s[100005];
int len,ans;

int main () {
	scanf("%s",s);
	len=strlen(s);
	FOE(i,1,len-1) {
		//printf("%c",s[i]);
		if (s[i]!=s[i-1]) {
			++ans;
		}
	}
	printf("%d\n",ans);
}

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 n, m;
  cin >> n >> m;
  int  t = 1900 * m + 100 * (n-m);
  cout << t * (int)pow(2, m) << endl;
  return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final int K = sc.nextInt();
		
		int[] g_count = new int[10];
		Arrays.fill(g_count, 1);
		
		int[][] data_tmp = new int[10][N+1];
		
		for(int i = 0; i < N; i++){
			final int c = sc.nextInt();
			final int g = sc.nextInt() - 1;
			
			data_tmp[g][g_count[g]++] = c;
		}
		
		int[][] data = new int[10][];
		for(int i = 0; i < 10; i++){
			data[i] = new int[g_count[i]];
			System.arraycopy(data_tmp[i], 0, data[i], 0, g_count[i]);
		}
		
		for(int i = 0; i < data.length; i++){
			Arrays.sort(data[i]);
			
			for(int start = 1; start < (data[i].length + 1) / 2; start++){
				int tmp = data[i][start];
				data[i][start] = data[i][data[i].length - start];
				data[i][data[i].length - start] = tmp;
			}
		}
		/*
		for(int g = 0; g < 10; g++){
			System.out.print(g + " :");
			for(int i : data[g]){
				System.out.printf(" %3d", i);
			}
			System.out.println();
		}
		System.out.println("--------------------------------------");
		*/
		for(int i = 0; i < data.length; i++){
			for(int j = 0; j < g_count[i]; j++){
				if(j == 0){
					continue;
				}
				
				data[i][j] += data[i][j-1];
			}
		}
		
		for(int i = 0; i < data.length; i++){
			for(int j = 0; j < g_count[i]; j++){
				data[i][j] += j * (j - 1);
			}
		}
		/*
		for(int g = 0; g < 10; g++){
			System.out.print(g + " :");
			for(int i : data[g]){
				System.out.printf(" %3d", i);
			}
			System.out.println();
		}
		System.out.println("--------------------------------------");
		*/
		int[][] DP = new int[K + 1][10];
		
		int max = 0;
		for(int g = 0; g < 10; g++){
			if(g == 0){
				final int min = Math.min(g_count[g], DP.length);
				for(int k = 0; k < min; k++){
					DP[k][g] = data[g][k];
					max = Math.max(max, DP[k][g]);
				}
			}else{
				for(int k = 0; k < DP.length; k++){
					for(int pos = k - (g_count[g] - 1); pos <= k; pos++){
						if(pos < 0){
							continue;
						}
						
						DP[k][g] = Math.max(DP[k][g], DP[pos][g-1] + data[g][k - pos]);
						max = Math.max(max, DP[k][g]);
					}
				}
			}
			/*
			for(int k = 0; k < DP.length; k++){
				System.out.print(k + " :");
				for(int i = 0; i < 10; i++){
					System.out.printf(" %3d", DP[k][i]);
				}
				System.out.println();
			}
			System.out.println("------------------------------------");
			*/
		}
		
		System.out.println(max);
		
	}

}

Measured memory_bytes: 28020
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a < 6){
    printf("0\n");
  }else if(a < 13){
    printf("%d\n",b / 2);
  }else{
    printf("%d\n",b);
  }
  return 0;
}

Measured memory_bytes: 128
#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() {
  char N;
  cin >> N;
  if (N >= 'a') {
    cout << "a" << endl;
    return 0;
  }
  
  cout << "A" << endl;
  
}


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

int main()
{
  int x, y;
  cin >> x >> y;
  if (x <= 8 && y <= 8) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }



  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main(){
    int a,b,c;
    cin >> a >> b >> c;

    if((a == b && a!=c) || (a==c && a!=b) || (b==c && a!=b)){
        dunk("Yes");
    }

    else{
        dunk("No");
    }
}

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

int main() {
  int N,M;
  cin >> N >> M;
  
  vector<int> vec(M*2);
  
  for(int i=0;i<M*2;i++) cin >>vec.at(i);
  
  for(int i=0;i<N;i++) {
    vector<int> abc(N);
    for(int j=0;j<M*2;j++) {
      if(vec.at(j)==i+1) abc.at(i)++;
    }
    cout <<abc.at(i)<<endl;
  }

}

Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
count = Array.new(n, 0)
m.times do
    a, b = gets.split.map(&:to_i)
    count[a - 1] += 1
    count[b - 1] += 1
end

count.each do |i|
    puts i
end



Measured memory_bytes: 1788
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<string>
#include<iomanip>
using namespace std;
typedef long long LL;
int main(){
	char w[105];
	int flag[26] = {0},vis = 0;
	cin >> w;
	for(int i = 0;w[i] != '\0';i++){
		for(int j = 0;j < 26;j++){
			if(w[i] == 'a'+j)
				flag[j] ++;
		}
	}
	for(int i = 0;i <26;i++)
		if(flag[i]%2 != 0)
			vis = 1;
	if(vis == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()

    val a = (1..n).map { readLine()!!.toInt() }.toTypedArray()
    val b = a.copyOf()
    b.sortDescending()
    val firstMax = b[0]
    val secondMax = b[1]

    for (i in 0 until n) {
        if (a[i] < firstMax) {
            println(firstMax)
        } else {
            println(secondMax)
        }
    }
}

Measured memory_bytes: 64496
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s=="Sunny"){
		cout<<"Cloudy";
	}
	else if(s=="Cloudy"){
		cout<<"Rainy";
	}
	else{
		cout<<"Sunny";
	}
 	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,k[1000],p[1000],i,a;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&k[i],&p[i]);
		if(k[i]>=p[i]){
			a=k[i]%p[i];
			if(a==0){	
				printf("%d\n",p[i]);
			}			
			if(a!=0){
				printf("%d\n",a);
			}
		}
			else if(k[i]<=p[i]){
				printf("%d\n",k[i]);
			}
	}	
	return 0;
}	


Measured memory_bytes: 2040
#include<stdio.h>
#include<math.h>
 
int main(){
	
	int N,i;
	long long int j=1000000007,power=1;
	
	scanf("%d",&N);
	
	for(i=1;i<=N;i++){
		power*=i;
		power%=j;
	}
	
	
	printf("\n%lld\n",power);
	
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
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 (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int Q, H, S, D, N; cin >> Q >> H >> S >> D >> N;
	int q8 = 2 * 4 * Q, h4 = 2 * 2 * H, s2 = 2 * S;

	int m = min(q8, min(h4, min(s2, D)));

	int ans = N / 2 * m;

	if (N % 2 == 1) {
		int x = min(q8 / 2, min(h4 / 2, S));
		ans += x;

	}

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

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
void fast() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}
void ran() {
	srand(chrono::steady_clock::now().time_since_epoch().count());
}
long long get_rand() {
	long long a = rand();
	long long b = rand();
	return a * (RAND_MAX + 1ll) + b; 
}
// #define endl '\n'
// #define double long double
#define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;

signed main() {
	
	ran(); fast();
	
	int a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	
	if (a == b) {
		cout << "YES" << endl;
	}
	else if (a > b) {
		int diff = a - b;
		int spee = v - w;
		if (spee > 0) {
			if (spee * t >= diff) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
		}
		else {
			cout << "NO" << endl;
		}
	}
	else {
		int diff = b - a;
		int spee = v - w;
		if (spee > 0) {
			if (spee * t >= diff) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
		}
		else {
			cout << "NO" << endl;
		}
	}
	
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <utility>
#include <map>
#include <set>
using namespace std;

void insertionSort(int *A, int N){
    int i, j, k;
    int v;
    for(i = 1; i < N; i++){
        v = A[i];
        j = i-1;
        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        
        for(k = 0; k < N-1; k++){
            cout << A[k] << " ";
        }
        cout << A[N-1] << endl;
    }
}

int main(){
    int n;
    cin >> n;
    int i = 0;
    int a[n];
    
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    
    for(i = 0; i < n-1; i++){
        cout << a[i] << " ";
    }
    cout << a[n-1] << endl;
    
    insertionSort(a, n);
}



Measured memory_bytes: 3028
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)

for a in A:
    cnt[a] = 1 if cnt[a] % 2 else 2

ans = len(cnt.keys()) - len([c for c in cnt.values() if c == 2]) % 2
print(ans)

Measured memory_bytes: 18656
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    string s;
    cin >> s;
    char cur='a';
    ll right =0;
    ll left = 0;
    ll sum = 0;
    //cout<<s<<endl;

    rep(i,0,s.size()){
        if(cur=='>'&&s[i]=='<'){
            //cout<<"a";
            ll M = max(right,left);
            ll m = min(right,left);
            sum += M*(M+1)/2+(m-1)*m/2;
            right=1;
            left=0;
            cur='<';
        }else{
            //cout<<"w";
            if(s[i]=='<'){
                right++;
                cur='<';
            }else{
                left++;
                cur='>';
            }
        }

    }
    ll M = max(right,left);
    ll m = min(right,left);
    sum += M*(M+1)/2+m*(m-1)/2;

    cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 4288
#include <iostream>

using namespace std;

int main() {
    const int s = 10;
	int paper[10+s+s][10+s+s] = {};
	int x, y, siz;
	char c;
	while (cin >> x >> c >> y >> c >> siz) {
        x += s; y += s;
		switch (siz) {
			case 3:
				paper[y-2][x] ++;
				paper[y][x-2] ++;
				paper[y][x+2] ++;
				paper[y+2][x] ++;
			case 2:
				paper[y-1][x-1] ++;
				paper[y-1][x+1] ++;
				paper[y+1][x-1] ++;
				paper[y+1][x+1] ++;
			case 1:
				paper[y-1][x] ++;
				paper[y][x-1] ++;
				paper[y][x] ++;
				paper[y][x+1] ++;
				paper[y+1][x] ++;
		}
	}
	int empty = 0, mx = 0;
	for (int i=s; i<s+10; ++i) {
		for (int j=s; j<s+10; ++j) {
			empty += !paper[i][j];
			mx = max(mx, paper[i][j]);
		}
	}
	cout << empty << endl;
	cout << mx << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
    ll a, b;
    char c;
    while (cin >> a >> c >> b) {
        if (c!='?') {
            if (c == '+') cout << a+b << endl;
            if (c == '-') cout << a-b << endl;
            if (c == '*') cout << a*b << endl;
            if (c == '/') cout << a/b << endl;
        }
    }
}


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


int main(){
  int x;
  vector<int> vec(4);
  vector<char> op(3);

  
    cin >> x;
    for(int i = 0;i < 4;++i){
      vec.push_back(x%10);
      x /= 10;
    }
 reverse(vec.begin(),vec.end());
int sum = vec.at(0);
    for(int tmp = 0;tmp < (1<<3);tmp++){
      bitset<3> s(tmp);
     sum =vec.at(0);
      for(int i = 0; i<3;++i){
        if(s.test(i)){
          sum += vec.at(3-i);
          op.at(2-i) = '+';
        }else{
          sum -= vec.at(3-i);
          op.at(2-i) = '-';
        }
      }
            if(sum == 7){
            cout << vec.at(0) << op.at(0) << vec.at(1) << op.at(1) << vec.at(2) << op.at(2) << vec.at(3) << "=7" <<endl;
          return 0;
        }
    }
  }

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

int main(){
  string s;
  cin>>s;
  
  int ans=700;
  
  if(s[0]=='o')
    ans+=100;
  
  
  if(s[1]=='o')
    ans+=100;
  
  
  if(s[2]=='o')
    ans+=100;
  
  cout<< ans << endl;

}



Measured memory_bytes: 256
N,X=map(int,input().split())
x=[int(i) for i in input().split()]
inf=float("inf")
S=[0]
for i in range(N):
  S.append(S[-1]+x[i])

ans=inf
for m in range(1,N+1):
  E=(m+N)*X
  for i in range(N//m+1):
    if i==0:
      E+=5*(S[N-m*i]-S[max(N-m*(i+1),0)])
    else:
      E+=(2*i+3)*(S[N-m*i]-S[max(N-m*(i+1),0)])
  ans=min(ans,E)
print(ans)


Measured memory_bytes: 98128
while True:
    n, p = map(int, input().split())
    if n == p == 0:
        break
    l = [0] * n
    i = 0
    bowl = p
    while True:
        i = i % n
        if bowl == 0:
            bowl = l[i]
            l[i] = 0
        else:
            bowl -= 1
            l[i] += 1
        if l[i] == p:
            break
        i += 1
    print(i)

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

int main(){
    ll a,b,n;
    cin >> a >> b >> n;
    cout << a*min(b-1,n)/b;
}   


Measured memory_bytes: 3632
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()

    val w = (1..n).map { readLine()!! }

    for(i in 1 until n){
        if(w[i].first() != w[i-1].last()){
            println("No")
            return
        }

        for(j in 0 until i){
            if(w[i] == w[j]){
                println("No")
                return
            }
        }
    }

    println("Yes")
}

Measured memory_bytes: 33788
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
using pii = std::pair<int, int>;
using vi = std::vector<int>;
using vd = std::vector<double>;
using vc = std::vector<char>;
using vb = std::vector<bool>;
using vs = std::vector<std::string>;
using vpii = std::vector<pii>;
using vvi = std::vector<vi>;
using vvb = std::vector<vb>;
using vvpii = std::vector<vpii>;
template<typename A> using fn = std::function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
using namespace std;

template<typename MonoidTrait> class SegTree {
  using Monoid = MonoidTrait;
  using T = typename Monoid::value_type;

public:
  Monoid m;
  std::vector<T> data;
  int size = 1;

  // public:
  SegTree(const int &n = 0) {
    m = Monoid();
    while (size < n) size *= 2;
    data.assign(size * 2, m.id());
  }

  template<typename InputIterator> SegTree(InputIterator first, InputIterator last) {
    m = Monoid();
    int n = std::distance(first, last);
    while (size < n) size *= 2;
    data.resize(size * 2, m.id());
    std::copy(first, last, data.begin() + size);
    for (int i = size - 1; i >= 1; --i) data[i] = m(data[i * 2], data[i * 2 + 1]);
  }

  T fold(int l, int r) const {
    T acc = m.id();
    for (l += size, r += size; l < r; l >>= 1, r >>= 1) {
      if (l & 1) acc = m(acc, data[l++]);
      if (r & 1) acc = m(acc, data[--r]);
    }
    return acc;
  }

  void update(int i, const T &x) {
    data[i += size] = x;
    while (i /= 2) data[i] = m(data[i * 2], data[i * 2 + 1]);
  }

  const T &operator[](int i) const { return data[i + size]; }
};

template<typename T, T upperInf = std::numeric_limits<T>::max()> struct minMonoid {
  using value_type = T;
  constexpr T id() const { return upperInf; }
  T operator()(const T &a, const T &b) const { return std::min(a, b); }
};

main {
  using RMQ = SegTree<minMonoid<int, 2147483647>>;
  int n, q;
  cin >> n >> q;
  RMQ t(n);
  while (q--) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com) {
      cout << t.fold(x, y + 1) << endl;
    } else {
      t.update(x, y);
    }
  }
}

Measured memory_bytes: 4956
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
    string s,t; cin >> s >> t;
    vector<char> S(s.size()),T(t.size());
    rep(i,s.size()){
        S[i] = s[i];
    }
    rep(i,t.size()){
        T[i] = t[i];
    }
    sort(S.begin(),S.end());
    sort(T.begin(),T.end(),greater<char>());
    rep(i,min(S.size(),T.size())){
        if(S[i] < T[i]){
            cout << "Yes" << endl;
            return 0;
            
        }
        if(S[i] > T[i]){
           cout << "No" << endl;
           return 0;
        }     
    }
    if(S.size() < T.size()) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
const int N = 200005;
struct edge{
	int to, next;
}e[N];
int val[N], i, n, q, first[N], cnt, x, y;
bool root[N];
void add(int u, int v){
	cnt++;
	e[cnt].next = first[u];
	first[u] = cnt;
	e[cnt].to = v; 
}
void Dfs(int now){
	for(int u = first[now]; u; u = e[u].next){
		val[e[u].to] += val[now];
		Dfs(e[u].to);
	}
}
int main(){
	cin>>n>>q;
	for(i = 1; i < n; i++){
		scanf("%d%d", &x, &y);
		add(x, y); root[y] = true;
	}
	for(i = 1; i <= q; i++){
		scanf("%d%d", &x, &y);
		val[x] += y;
	}
	for(i = 1; i <= n; i++){
		if(!root[i]){
			Dfs(i); break;
		}
	}
	for(i = 1; i <= n; i++)
	    cout<<val[i]<<" ";
	return 0;
}

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

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

	for(int i=0;i<n;i++)	cin >> a[i];

	int ans=INT_MAX;

	for(int i=-100;i<=100;i++){
		int sum=0;
		for(int j=0;j<n;j++)
			sum+=(a[j]-i)*(a[j]-i);
		ans=min(sum,ans);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<map>
#include<queue>
#include<vector>
#include<stack>
#include<set>
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pb push_back

using namespace std;

inline ll read()
{
	long long f=1,sum=0;
	char c=getchar();
	while (c<'0' || c>'9')
	{
		if (c=='-')	f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9')
	{
		sum=sum*10+c-'0';
		c=getchar();
	}
	return sum*f;
}
const int MAXN=15;
char s[MAXN][MAXN];
string ss[MAXN];
int h[MAXN],l[MAXN],n,m;
void dfs_l(int x,bool odd)
{
	if (x==m+1)
	{
		printf("YES");
		exit(0);
	}
	else if (l[x])
		dfs_l(x+1,odd);
	else
	{
		for (int i=x+1;i<=m;i++)
		{
			if (l[i]) continue;
			int j;
			for (j=1;j<=n;j++)
				if (s[j][x]!=s[h[j]][i])
					break;
			if (j==n+1)
			{
				l[x]=i,l[i]=x;
				dfs_l(x+1,odd);
				l[x]=0,l[i]=0;
			}
		}	
	}
	if (odd)
	{
		int i;
		for (i=1;i<=n;i++)
			if (s[i][x]!=s[h[i]][x])
				break;
		if (i==n+1)
		{
			l[x]=x;
			dfs_l(x+1,false);
			l[x]=0;
		}
	}
}
void dfs_h(int x,bool odd)
{
	if (x==n+1)
		dfs_l(1,(bool)m&1);
	else if (h[x])
		dfs_h(x+1,odd);
	else
	{
		for (int i=x+1;i<=n;i++)
		{
			if (h[i]) continue;
			if (ss[i]!=ss[x]) continue;
			h[i]=x,h[x]=i;
			dfs_h(x+1,odd);
			h[i]=0,h[x]=0;
		}
	}
	if (odd)
	{
		h[x]=x;
		dfs_h(x+1,false);
		h[x]=0;
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
		scanf("%s",s[i]+1);
	for (int i=1;i<=n;i++)
	{
		string tmp;
		tmp.clear();
		for (int j=1;j<=m;j++)
			tmp+=s[i][j];
		sort(tmp.begin(),tmp.end());
		ss[i]=tmp;
	}
	dfs_h(1,(bool)n&1);
	printf("NO");
	return 0;
}


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

namespace AC {
#define ll long long
#define PLL pair<ll, ll>
#define PDD pair<double, double>
#define PDPLL pair<double, PLL>
#define PLPLL pair<ll, PLL>
#define pb push_back
#define fi first
#define se second
#define ls rt << 1
#define rs rt << 1 | 1

    const ll N = 1e7 + 66;

    ll BUGS = 1;

    inline ll read(){
        ll x = 0;    bool flag = 1;   char ch = getchar();
        while(ch < '0' || ch > '9') { if(ch == '-') flag = 0; ch = getchar(); }
        while(ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); }
        if(flag) return x;  return (~(x - 1));
    }

    inline void read(ll arr[], ll s, ll e) { for(ll i = s; i <= e; ++i) arr[i] = read(); }

    inline void write(ll x){
        if(x < 0) { x = ~(x - 1); putchar('-'); }
        if(x > 9) write(x / 10); putchar(x % 10 + '0');
    }

    inline void print(ll x) { write(x); puts(""); }

    inline void print(ll arr[], ll s, ll e) {
        for(ll i = s; i <= e - 1; ++i) write(arr[i]), putchar(' ');
        write(arr[e]); puts("");
    }

    inline ll max3(ll a, ll b, ll c) { return max(a, max(b, c)); }

    inline ll min3(ll a, ll b, ll c) { return min(a, min(b, c)); }

    inline void debugNum(ll num, string ss) { cout << "BUGS" << BUGS++ << " : " << ss << " : " << num << endl; }

    inline void debugArr(ll arr[], ll s, ll e, string ss) {
        cout << "BUGS" << BUGS++ << " : " << ss << " : " << endl;
        for(ll i = s; i <= e; ++i) cout << "i : " << i << " val : " << arr[i] << endl;
    }

    inline void IO() {
        //ios::sync_with_stdio(false), cout.tie(0), cin.tie(0);
        //cout << setiosflags(ios::fixed) << setprecision(1); //保留小数点后1位
        //cout << setprecision(1); //保留1位有效数字
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    }
}using namespace AC;

int minp[N], p[N], tot;
long long fac[N];
bool flg[N];

void getFac(int n)
{
    fac[1] = 1, minp[1] = 0;
    for(int i = 2;i <= n;i++)
    {
        if(!flg[i])  p[++tot] = i, fac[i] = 2, minp[i] = 1;
        for(int j = 1; j <= tot && 1ll * i * p[j] <= n;j++)
        {
            flg[i*p[j]] = 1;
            if(i % p[j] == 0)
            {
                fac[i*p[j]] = fac[i] / (minp[i]+1) * (minp[i]+2);
                minp[i*p[j]] = minp[i] + 1;
                break;
            }
            else
            {
                fac[i*p[j]] = fac[i] * 2;
                minp[i*p[j]] = 1;
            }
        }
    }
    for(long long i = 1; i < N; ++i) {
        fac[i] = fac[i - 1] + fac[i] * i;
    }
}


int main() {
    //IO();
    long long n;
    getFac(N - 1);
    while(~scanf("%lld", &n)) {
        printf("%lld\n", fac[n]);
    }
    return 0;
}



Measured memory_bytes: 133380
#include<bits/stdc++.h>
using namespace std;
long long q,x,y,i=0; 
main(){
  cin>>q;
  while(i<q){
    cin>>x>>y;
    if(x>y)swap(x,y);
    long double k=sqrt(x*y-0.75)-x+0.5;
    cout<<(int)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
    i++;
  }
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==5 && b==7 && c==5){
        cout << "YES" << endl;
    }else if(a==7 && b==5 && c==5){
        cout << "YES" << endl;
    }else if(a==5 && b==5 && c==7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}




Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input = scan.nextLine();
		scan.close();

		int x = Integer.parseInt(input);
		for(int i=1; i<10; i++) {
			int a = i*100+i*10+i;
			if(x<=a) {
				System.out.println(a);
				return;
			}
		}
	}
}

Measured memory_bytes: 23124
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

template<class C>
vector<int> z_algorithm(const C s) {
	int n = s.size();
	vector<int> Z(n);
	Z[0] = n;
	int i = 1, j = 0;
	while(i < n) {
		while(i+j < n and s[j] == s[i+j]) j++;
		Z[i] = j;
		if(!j) {
			i++;
			continue;
		}
		int k = 1;
		while(k < j and k+Z[k] < j) {
			Z[i+k] = Z[k];
			k++;
		}
		i += k;
		j -= k;
	}
	return Z;
}

//head

int n;
vi s;
int ans = 0;

int main() {
  cin >> n;
  s.resize(n);
  rep(i, n) {
    char c;
    if(!i) scanf("\n");
    scanf("%c", &c);
    //printf("%c", c);
    s[i] = (int)c;
  }
  rep(i, n-1) {
    vi z = z_algorithm(s);
    rep(j, n-i-1) {
      chmax(ans, min(z[j+1], j+1));
    }
    rotate(s.begin(), s.begin()+1, s.end());
    s.pop_back();
    //rep(j, n-i-1) cout << s[j] << (j == n-2-i?'\n':' ');
  }
  cout << ans << endl;
}

Measured memory_bytes: 3792
#include<iostream>
using namespace std;
void moveE(int dice[6])
{
	int tmp = dice[0];
	dice[0] = dice[3];
	dice[3] = dice[5];
	dice[5] = dice[2];
	dice[2] = tmp;
}
void moveN(int dice[6])
{
	int tmp = dice[0];
	dice[0] = dice[1];
	dice[1] = dice[5];
	dice[5] = dice[4];
	dice[4] = tmp;
}
void moveS(int dice[6])
{
	int tmp = dice[0];
	dice[0] = dice[4];
	dice[4] = dice[5];
	dice[5] = dice[1];
	dice[1] = tmp;
}
void moveW(int dice[6])
{
	int tmp = dice[0];
	dice[0] = dice[2];
	dice[2] = dice[5];
	dice[5] = dice[3];
	dice[3] = tmp;
}
bool isSame(int dice1[6],int dice2[6])
{
	bool hasSameNum1 = false;
	for (int i = 0; i < 6; i++)
	{
		if (dice2[i] == dice1[0])
		{
			hasSameNum1 = true;
			switch (i)
			{
			case 1:
				moveN(dice2);
				break;
			case 2:
				moveE(dice2);
				break;
			case 3:
				moveW(dice2);
				break;
			case 4:
				moveN(dice2);
				break;
			case 5:
				moveN(dice2);
				moveN(dice2);
				break;
			}
		}
	}
	if (!hasSameNum1)
		return false;
	int tmp[4] = { dice2[1],dice2[2],dice2[4],dice2[3] };
	bool isSame = false;
	for (int i = 0; i < 4; i++)
	{
		if (tmp[i] == dice1[1])
		{
			if (tmp[(i + 1) % 4] == dice1[2] && tmp[(i + 2) % 4] == dice1[4] && tmp[(i + 3) % 4] == dice1[3] && dice1[5] == dice2[5])
			{
				isSame = true;
				break;
			}
		}
	}
	return isSame;
}
int main()
{
	int n;
	cin >> n;
	int dice[100][6];
	bool hasSame = false;
	for(int i = 0;i < 6;i++)
		cin >> dice[0][i];
	for(int i = 1;i < n;i++)
	{
		for (int j = 0; j < 6; j++)
			cin >> dice[i][j];

		for(int j = 0;j < i;j++)
		{
			for(int k = j + 1;k <= i;k++)
			{
				if (isSame(dice[j], dice[k]))
				{
					hasSame = true;
				}
			}
			if(hasSame)
				break;
		}
		if(hasSame)
			break;
	}
	if (hasSame)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}


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

using namespace std;


#define MAXN 53
const int mod = 1e9+7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, ans;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;
  int last = 2;
  for (int i = 0; i < n; ++i) {
    if (s1[i]==s2[i]) {
      if (last==0) ans *= 2;
      else if (last==1) ans *= 1;
      else ans = 3;
      last = 0;
    } else {
      if (last==0) ans *= 2;
      else if (last==1) ans *= 3;
      else ans = 6;
      last = 1;
      ++i;
    }
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
	int n,l;cin>>n>>l;
	vector<string> V;
	for (int i = 0; i < n; ++i)
	{
		string str;cin>>str;
		V.push_back(str);
	}
	sort(V.begin(), V.end());
	for (int i = 0; i < n; ++i)
	{
		cout<<V[i];
	}
	return 0;
}

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

int main(){
    string s[3];
    cin>>s[0]>>s[1]>>s[2];
    if(s[0][s[0].length()-1]==s[1][0]&&s[1][s[1].size()-1]==s[2][0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		
		String S = sc.next();
		
		
		

		String  ans = S.substring(0,K-1)+
				S.substring(K-1,K).toLowerCase()+S.substring(K,N);

		System.out.println(ans);

	}

}


Measured memory_bytes: 22228
def is_ACGT(c):
    if (c == "A") or (c == "C") or (c == "G") or (c == "T"):
        return True
    else:
        return False

def get_ACGT_length(s):
    if len(s) == 0:
        return 0

    if not is_ACGT(s[0]):
        return 0

    return 1 + (get_ACGT_length(s[1:]))


s = str(input())

result = 0
for i, c in enumerate(s):
    if is_ACGT(c):
        result = max(get_ACGT_length(s[i:]), result)

print(result)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define testing 0
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#define dbv(v) cerr << #v << ":"; for (auto i : v) cerr << i << ' '; cerr << endl
#define dbvp(v) cerr << #v << ":"; for (auto i : v) cerr << "{"  << i.f << ',' << i.s << "} "; cerr << endl
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define inf (int)1e9
#define oo (ll)1e18
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "hi\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
typedef tuple<int,int,int> ti3;
string lts(ll x) {stringstream s; s << x; return s.str(); }
ll stl(string x) {stringstream s(x); ll temp; s >> temp; return temp; }
string cts(char x) {string s(1,x); return s;}
const int MOD = 1e9 + 7;
template <typename T> void maxself(T& a, T b) {
	a = max(a, b);
}
template <typename T> void minself(T& a, T b) {
	a = min(a, b);
}
#define MAXN (100005);
#if !testing
	#define cerr if(0)cout
#endif

int32_t main() {
	IAMSPEED
	int n; cin >> n;
	int a; cin >> a;
	n %= 500;
	if (a>=n) cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    ll N,K;
    ll ans;
    cin >> N >> K;
    if(N<=K){
        ans = min(N,abs(K-N));
    }else{
        ll num = N/K;
        N = N-num*K;
        ans = min(N,abs(K-N));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int N,i,tmp;
	
	scanf("%d",&N);
	
	tmp = 0;
	for (i = 1;i <= N;i++) {
		tmp += i;
		if (tmp >= N) {
			break;
		}
	}
	
	for (i = i;i > 0;i--) {
		if (tmp-N != i) {
			printf("%d\n",i);
		}
	}

	return 0;
}


Measured memory_bytes: 128
import Control.Monad
import Data.Char
import qualified Data.Sequence as S

main = do
    [n, k] <- map read <$> words <$> getLine
    s      <- getLine
    putStrLn $ show $ solve n k s

solve :: Int -> Int -> String -> Int
solve n k s = doit 0 (S.fromList $ replicate k 0) 0 s
  where
    doit :: Int -> (S.Seq Int) -> Int -> String -> Int
    doit d start pos []        = n - S.index start 0
    doit 0 start pos ('1' : t) =                               doit 1 (start S.|> pos) (pos + 1) t
    doit 1 start pos ('0' : t) = max (pos - S.index start 0) $ doit 0 (S.drop 1 start) (pos + 1) t
    doit d start pos ( _  : t) =                               doit d  start           (pos + 1) t

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

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

    set<int> A;
    vector<bool> visited(1e6 + 1, true);
    int max_value = -1;
    for (int i = 0; i < N; ++i) {
        int x;
        cin >> x;

        if (A.find(x) != A.end()) {
            visited[x] = false;
            continue;
        }

        A.insert(x);
        if (max_value < x) {
            max_value = x;
        }
    }

    for (int i = 1; i <= max_value; ++i) {
        if (A.find(i) == A.end()) {
            continue;
        }
        for (int j = 2 * i; j <= max_value; j += i) {
            visited[j] = false;
        }
    }

    int count = 0;
    for (int num : A) {
        if (visited[num]) {
            ++count;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 13060
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		x = x - a;
		int n = x / b;
		System.out.println(x - n * b);
	}
}


Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

vector<pair<char, int>> compress(const string &v){
    if(v.empty()) return {};
    vector<pair<char, int>> ret;
    ret.emplace_back(v[0], 0);
    for(const auto &x : v){
        if(x == ret.back().first) ret.back().second ++;
        else ret.emplace_back(x, 1);
    }
    return ret;
}

int main(void){
    Cin(string, s);
    Cin(int, k);
    auto c = compress(s);
    
    if(c.size() == 1){
        Cout((ll)k*s.size()/2);
        return 0;
    }
    
    ll ans = 0;
    for(auto e : c){
        ans += e.second/2;
    }
    ans *= k;
    if(c.front().first == c.back().first){
        ans += (k-1)*(ll)((c.front().second + c.back().second)/2 - c.front().second/2 - c.back().second/2);
    }
    Cout(ans);
}




Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class CNumbersOnACircle {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<ll> a(n), b(n);
      rep(i, n) cin >> a[i];
      rep(i, n) cin >> b[i];

      priority_queue<P> que;
      rep(i, n) {
        if (b[i] < a[i]) {
          cout << -1 << endl;
          return;
        } else if (b[i] > a[i]) {
          que.emplace(b[i], i);
        }
      }
      ll ans = 0;
      while(!que.empty()) {
        P p = que.top(); que.pop();
        auto bnow = p.first;
        auto pos = p.second;
        debug(bnow, pos);
        auto b1 = b[(pos+1)%n];
        auto b2 = b[(pos+n-1)%n];
        auto k = b1+b2;

        auto b3 = max(b1, b2);
        if (a[pos] > b3) {
          auto d = bnow-a[pos];
          if (d%k != 0) {
            cout << -1 << endl;
            return;
          } else {
            ans += d/k;
            b[pos] = a[pos];
          }
        } else {
          auto d = bnow-b3;
          auto r = max((d/k),1LL);
          ans += r;
          b[pos] -= r*k;
          if (b[pos] < a[pos]) {
            cout << -1 << endl;
            return;
          } else if (b[pos] > a[pos]) {
            que.emplace(b[pos], pos);
          }
        }
      }
      cout << ans << endl;
    }
};

signed main() {
  CNumbersOnACircle solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main(){
  int N;
  int type = 0;
  cin >> N;
  for(int i = 0; i < N; i++){
  
    char D;
    cin >> D;
    if(D == 'Y'){
      type += 1;
    }
  }
  if(type == 0){
    cout << "Three" << endl;
  }else{
    cout  << "Four" << endl;
  }
}


Measured memory_bytes: 256
from collections import defaultdict


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

    d = defaultdict(int)
    for aa in a:
        for i in range(-1, 2):
            d[aa+i] += 1

    ans = 0
    for k in d:
        if d[k] > ans:
            ans = d[k]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 93528
import fractions
A,B=map(int,input().split())
gcdlist=[]
pf={}
m=fractions.gcd(A,B)
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
#print(pf)
keys=list(pf.keys())
val=list(pf.values())
ans=1
for i in range(len(keys)):
    gcdlist.append([keys[i],val[i]])
#print(gcdlist)
print(len(gcdlist)+1)

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

int main(){
    int n,count,ans=0,a[200];
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
        while(true){
        count=0;
        for(int i=0;i<n;i++){
            if(a[i]%2!=0)
            count++;
            a[i]/=2;
        }
        if(count!=0)
        break;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256