akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define display(v,c) for(auto x:v) cout<<x<<c;
#define P_Q priority_queue<ll>
#define p_q priority_queue<ll,vi(ll),greater<ll>>
#define loop(i,x,y,z) for(int i=x; i<=y; i+=z)
#define vi(type) vector<type>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    IOS
    int n;
    cin>>n;
    if(n>81)    cout<<"No";
    else
    {
        int i;
        for(i=1;i<10;i++)
        {
            if(n%i==0 && (n/i)>=1 && (n/i)<=9)
            {
                cout<<"Yes";
                break;
            }
        }
        if(i==10)   cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007



int main() {
	int x, t;
	cin >> x >> t;
	print(max(x - t, 0));





	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(shoki,i,n) for(int i=shoki; i<n; i++)
#define _GLIBCXX_DEBUG
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vector<int>>;

int main(){
    int n; cin>>n;
    vi d(n);
    rep(0,i,n) cin>>d[i];

    sort(d.begin(),d.end());
    int count = 1;
    rep(1,i,n){
        if(d[i]!=d[i-1]){
            count++;
        }
    }
    cout << count << endl;
}

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

#define pb push_back
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(),(X).end()
#define ll long long
#define pi pair<int,int>
const int N=3e5+5,MOD=1e9+7;

using namespace std;

int n;
int a[N],seg[4*N];
void build(int indx,int l,int r){
	if(l==r){
		seg[indx]=a[l];
		return;
	}
	build(indx*2,l,(l+r)/2);
	build(indx*2+1,(l+r)/2+1,r);
	seg[indx]=__gcd(seg[indx*2],seg[indx*2+1]);
}
int get(int indx,int l,int r,int i,int j){
	if(l>j || r<i || i>j)return 0;
	if(l>=i&&r<=j)return seg[indx];
	return __gcd(get(indx*2,l,(l+r)/2,i,j),get(indx*2+1,(l+r)/2+1,r,i,j));
}
int main()
{
	//freopen("tst.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);


	scanf("%d",&n);

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

	build(1,0,n-1);
	int ans = 0;
	for(int i=0;i<n;i++){
			ans = max(ans,__gcd(get(1,0,n-1,0,i-1),get(1,0,n-1,i+1,n-1)));
	}
	printf("%d\n",ans );
 
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mpp make_pair
#define PI 3.14159265
using namespace std;
const int N =2e5+5;

ll a[N],b[N],k,n;

bool fun(ll x)
{
	ll sum=0,i;
	for(i=0;i<n;i++)
	{
		if(a[i]*b[i]>x)
		{
			sum=sum + (a[i]-x/b[i]);
		}
	}
	if(sum<=k)
		return true;
	return false;
}

int main()
{
	ll i;

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

	sort(a,a+n);
	sort(b,b+n);
	reverse(b,b+n);

	ll low=0;
	ll high=1e18;

	ll mid;
		ll ans=0;
		
	while(high>=low)
	{
		mid=(high+low)/2;
		if(fun(mid))
		{
			high=mid-1;
			ans=mid;
		}
		else
			low=mid+1;
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	LL N;
	cin >> N;
	string S = to_string(N);
	bool flg = true;
	int ans1 = 0;
	for(int i=0; i<S.size(); i++){
		if(S[i] != '9') flg = false;
		ans1 += S[i]-'0';
	}
	if(flg) cout << max(ans1,9*(int)S.size()) << endl;
	else cout << max(ans1,9*((int)S.size()-1)+(S[0]-'1')) << endl;

	return 0;
}


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

#define ll long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define all(v) (v).begin(), (v).end()

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

    int n, t;
    cin >> n;
    vi v(n, 0);
    rep(i, 0, n-1)
    {
        cin >> t;
        v[t - 1]++;
    }
    for (int i : v)
        cout << i << '\n';
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 2e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
ll a, b, c;

int main() {
	//sqrt(a) + sqrt(b) < sqrt(c)
	//a + b + 2sqrt(ab) < c
	//2sqrt(ab) < c - a - b
	//4ab < (c - a - b) ^ 2
	cin >> a >> b >> c;
	if(a + b >= c) puts("No");
	else {
		ll dd = (c - a - b) * (c - a - b);
		if(4ll * a * b < dd) puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007


void solve()
{
	string s;
	cin>>s;
	ll ans=0;
	for(ll i=0;i<s.size()/2;i++)
	{
		if(s[i]!=s[s.size()-i-1])
			ans++;
	}
	cout<<ans;
    return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int ll;
#define forn(i,p,n); for(long long i=p;i<n;++i)
#define pb push_back

void solve(){
	ll n,k;
	cin >> n >> k;
	vector<ll> a(n);
	forn(i,0,n){
		cin >> a[i];
	}
	ll dp[n];
	dp[0] = 0;
	//dp[n-2] = abs(a[n-2]-a[n-1]);
	forn(i,1,n){
		dp[i] = INT_MAX;
		for(int j=1;j<=k&&(i-j)>=0;++j){
			int temp = abs(a[i]-a[i-j]);
			dp[i] = min(dp[i],dp[i-j]+temp);
		}
	}
	cout<<dp[n-1];
	return ;
}

int main()
{
	fast;
	// int test;
	// cin >> test;
	// while(test--){
		solve();
	// 	cout<<"\n";
	// }
}

Measured memory_bytes: 4792
#include<bits/stdc++.h>
#define FOR(i,x,y) for(int i=(x),i##END=(y);i<=i##END;++i)
#define DOR(i,x,y) for(int i=(x),i##END=(y);i>=i##END;--i)
template<typename T,typename _T>inline bool chk_min(T &x,const _T y){return y<x?x=y,1:0;}
template<typename T,typename _T>inline bool chk_max(T &x,const _T y){return x<y?x=y,1:0;}
typedef long long ll;
const int P=998244353;
int f[305][90005];
int g[305][90005];
int a[305];
int n,S;

int Pow(int a,int p)
{
	int res=1;
	for(;p>0;a=1ll*a*a%P,p>>=1)if(p&1)res=1ll*res*a%P;
	return res;
}
void pls(int &x,const int y)
{
	x+=y;
	if(x>=P)x-=P;
}
void mns(int &x,const int y)
{
	x-=y;
	if(x<0)x+=P;
}

int main()
{
	scanf("%d",&n);
	FOR(i,1,n)scanf("%d",&a[i]),S+=a[i];
	int ans=((Pow(3,n)-3ll*Pow(2,n))%P+P)%P;
	f[0][0]=1;
	g[0][0]=1;
	FOR(i,0,n-1)FOR(j,0,S)if(f[i][j])
	{
		pls(f[i+1][j+a[i+1]],f[i][j]);
		pls(f[i+1][j],2ll*f[i][j]%P);
		pls(g[i+1][j+a[i+1]],g[i][j]);
		pls(g[i+1][j],g[i][j]);
	}
	FOR(i,(S+1)/2,S)
	{
		mns(ans,3ll*f[n][i]%P);
		pls(ans,6ll*g[n][i]%P);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 211328
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main() 
{
	int a,b,c,k;
  	cin >> a >> b >> c >> k;
	cout << a+b+c+max({a,b,c})*(pow(2,k)-1) << endl;
	return 0;
}


Measured memory_bytes: 256
S = int(input())

def ansgen(a):
  val = 0
  if a % 2 == 0:
    val = int(a/2)
  else:
    val = 3 * a + 1
  return val

list = []
list.append(S)

for i in range(2,1000000):
  S = ansgen(S)
  if S in list:
    print(i)
    exit()
  list.append(S)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
struct mat
{
	long long a[2][2];
	inline mat(){a[0][0]=a[0][1]=a[1][0]=a[1][1]=0;}
	inline mat(const mat &rhs){a[0][0]=rhs.a[0][0];a[0][1]=rhs.a[0][1];a[1][0]=rhs.a[1][0];a[1][1]=rhs.a[1][1];}
	inline mat operator*(const mat &rhs)const
	{
		mat ret;
		ret.a[0][0]=(a[0][0]*rhs.a[0][0]+a[0][1]*rhs.a[1][0])%MOD;
		ret.a[0][1]=(a[0][0]*rhs.a[0][1]+a[0][1]*rhs.a[1][1])%MOD;
		ret.a[1][0]=(a[1][0]*rhs.a[0][0]+a[1][1]*rhs.a[1][0])%MOD;
		ret.a[1][1]=(a[1][0]*rhs.a[0][1]+a[1][1]*rhs.a[1][1])%MOD;
		return ret;
	}
	inline mat operator*=(const mat &rhs)
	{
		return *this=*this*rhs;
	}
};
inline int poww(long long x,long long y)
{
	long long ret=1;
	while(y)
	{
		if(y&1)ret*=x,ret%=MOD;
		x*=x,x%=MOD;
		y>>=1;
	}
	return ret;
}
inline mat poww(mat x,long long y)
{
	mat ret;
	ret.a[0][0]=ret.a[1][1]=1;
	while(y)
	{
		if(y&1)ret*=x;
		x*=x;
		y>>=1;
	}
	return ret;
}
int n,m;
long long k;
char s[1111][1111];
int main()
{
	scanf("%d%d%lld",&n,&m,&k);
	int tot=0,hor=0,ver=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
		for(int j=1;j<=m;j++)if(s[i][j]=='#')tot++;
	}
	for(int i=1;i<=n;i++)if(s[i][1]=='#'&&s[i][m]=='#')hor++;
	for(int i=1;i<=m;i++)if(s[1][i]=='#'&&s[n][i]=='#')ver++;
	if(hor&&ver)
	{
		printf("1\n");
		return 0;
	}
	if(!hor&&!ver)
	{
		printf("%d\n",poww(tot,k-1));
		return 0;
	}
	if(ver)
	{
		for(int i=1;i<=max(n,m);i++)
		{
			for(int j=i+1;j<=max(n,m);j++)
			{
				swap(s[i][j],s[j][i]);
			}
		}
		swap(n,m);
		swap(hor,ver);
	}
	//now hor!=0, ver==0
	int o=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<m;j++)
		{
			if(s[i][j]=='#'&&s[i][j+1]=='#')
				o++;
		}
	}
//	cerr<<tot<<' '<<o<<' '<<hor<<endl;
	mat mul,ans;
	mul.a[0][0]=tot,mul.a[0][1]=(MOD-o)%MOD,mul.a[1][1]=hor;
	ans=poww(mul,k-1);
	printf("%lld\n",(ans.a[0][0]+ans.a[0][1])%MOD);
	return 0;
}

Measured memory_bytes: 1280
def resolve():
    A, B, C, D = map(int, input().split())
    TA = C // B if C % B == 0 else C // B + 1
    AA = A // D if A % D == 0 else A // D + 1
    if TA > AA:
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    resolve()

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

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var NW = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var (N, W) = (NW[0], NW[1]);
            var w = new long[N];
            var v = new long[N];
            for (var i = 0; i < N; i++)
            {
                var wv = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                (w[i], v[i]) = (wv[0], wv[1]);
            }
            var dp = (new long[2][]).Select(x => x = new long[W + 1]).ToArray();
            var t = 1;
            for (var i = 0; i < N; i++)
            {
                t ^= 1;
                for (var j = 0; j <= W; j++)
                {
                    if (j < w[i])
                    {
                        dp[t ^ 1][j] = dp[t][j];
                    }
                    else
                    {
                        dp[t ^ 1][j] = Math.Max(dp[t][j], dp[t][j - w[i]] + v[i]);
                    }
                }
            }

            Console.WriteLine(dp[t ^ 1][W]);
        }
    }
}


Measured memory_bytes: 29752
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    for(int i=0;i<100;i++){
        if((i*(a%b))%b==c){
            cout <<"YES";
            return 0;
        }
    }
    cout << "NO";
}

Measured memory_bytes: 256
(defn patterns
  [s]
  (let [s-len (count s)
        half (Math/floor (/ s-len 2))]
    (loop [n 1, acc []]
      (if (> n half)
        (if (empty? acc)
          0
          (apply max acc))
        (let [pattern (take n s)
              pattern-cycle (cycle pattern)
              it (take s-len pattern-cycle)]
          (if (and (= it s)
                   (= (count it) (* 2 (count pattern))))
            (do
;;               (println s)
;;               (println pattern)
;;               (println (take s-len pattern-cycle))
              (recur (inc n)
                     (cons s-len acc)))
            (recur (inc n)
                   acc)))))))

(defn search-part-s
  [s]
  (loop [part-s (seq s), acc []]
    (if-not (> (count part-s) 0)
      (apply max acc)
      (let [maxlen (patterns part-s)]
;;         (when-not (zero? maxlen)
;;           (println part-s)
;;           (println maxlen))
        (recur (butlast part-s)
               (cons maxlen acc))))))

(let [args (-> (line-seq (java.io.BufferedReader. *in*))
               first
               butlast)]
  (println (search-part-s args)))


Measured memory_bytes: 108624
#include <bits/stdc++.h>
constexpr int MAX = 50000;
bool isprime[MAX+1];
int main()
{
	std::fill(isprime,isprime+MAX+1,true);
	std::vector<int> prime;
	for(int i = 2;  i<=MAX; i++){
		if(not isprime[i]){continue;}
		prime.push_back(i);
		for(int j= 2; i*j<=MAX; j++){
			isprime[i*j]=false;
		}
	}
	for(int m, a, b;;){
		std::cin >> m >> a >> b;
		if(m == 0 and a == 0 and b == 0){break;}
		int ans = 0;
		for(const int p:prime){
			const int upper = std::min(m/p, b*p/a);
			if(upper < p){break;}
			const int q = *(std::upper_bound(prime.begin(),prime.end(),upper)-1);
			ans = std::max(ans, p*q);
		}
		for(int i = 2; i *i <= ans; i++){
			if(ans% i ==0){std::cout << i << " " << ans / i << std::endl;}
		}
	}
	return 0;
}


Measured memory_bytes: 3156
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
#define INF 2<<29

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  printf("%d\n",min(b/a,c));
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> vl;
typedef vector<vector<ll>> vll;
typedef vector<bool> vb;
typedef set<int> si; 
typedef queue<int> qi;
typedef stack<int> sti;
typedef priority_queue<int> pqi;
#define fori(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,b,a) for(int i = (b); i >= (a); --i)
#define all(a) (a).begin(), (a).end()
//#define __builtin_popcountll bitCountLL
//#define __builtin_popcount bitCount
//__builtin_ctz 末尾0的个数, __builtin_clz 前导0的个数
//__builtin_ffs 最后一个1的位置
#define maxn 2000005
#define Mod 1000000007
const int INF = 2e9;
const ll ML = 4e18;

 struct trieNode{
     int val;
     int sum;
     bool isWord;
     int next[26], count[26];
    trieNode() {
        memset(next,-1,sizeof(next));
        memset(count,0,sizeof(count));
        sum = val = 0;
        isWord = false;
    }
 }N[maxn * 2];
 int cnt;
void insert(string word) {
    if(!word.size()) return;
    int cur = 0;
    fori(i,0,word.size()) {
        int v = word[i] - 'a';
        if(N[cur].next[v] == -1) {
            N[cur].next[v] = cnt++;
        }
        cur = N[cur].next[v];
        N[cur].val = v;
    }
    N[cur].isWord = true;
}
ll res;
void dfs(int i) {
    fori(k,0,26) {
        int cur = N[i].next[k];
        if(cur != -1) {
            dfs(cur);
            N[i].sum += N[cur].sum;
            fori(j,0,26) {
                N[i].count[j] += N[cur].count[j];
            }
        }
    }
    fori(k,0,26) {
        int cur = N[i].next[k];
        if(cur != -1 && N[cur].isWord) {
            res += N[i].count[k] - N[cur].count[k];
        }
    }
    if(N[i].isWord) {
        res += N[i].sum;
        N[i].sum++;
    }
    N[i].count[N[i].val] = N[i].sum;
}

void solve() {
    int n;
    cin >> n;
    vector<string> a(n);
    cnt = 1;
    fori(i,0,n) {
        cin >> a[i];
        reverse(all(a[i]));
        insert(a[i]);
    }
    res = 0;
    dfs(0);
    cout << res << endl;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
//	freopen("D:\\data_in.txt", "r", stdin);
   
    solve();
   
    /*
    clock_t start,finish;
    start = clock();
    
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

/***************************************************************
 question:
 idea:
 tag:
 record:
 ***************************************************************/


Measured memory_bytes: 939600
_ = raw_input()
four = two = one = 0
for i in raw_input().split(' '):
    if int(i)%4 == 0:
        four+=1
    elif int(i)%2 ==0:
        two+=1
    else:
        one+=1
if one>four+1 or (one==four+1 and two!=0):
    print('No')
else:
    print('Yes')

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

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

	int v[N];

	for (int i = 0; i < N; i++){
		cin >> v[i];
	}

	int tmp;

	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			if (v[i] > v[j])
			{
				tmp = v[i];
				v[i] = v[j];
				v[j] = tmp;
			}
		}
	}

	double ans = v[0];

	for (int i = 1; i < N; i++)
	{
		ans = (ans + v[i])/2.0;
	}
	cout << ans << endl;

	return 0;
}

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


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;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    double N; cin >> N;
    double a=N/3.0;
    cout << a*a*a << endl;
}




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

int main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    int i, min = y, max = x;
    for(i = 0; i < n; i++){
        int a;
        cin >> a;
        if(a > max) max = a;
    }
    for(i = 0; i < m; i++){
        int b;
        cin >> b;
        if(b <= min) min = b;
    }
    // cout << max << min << endl;

    if(max+1 <= min) cout << "No War" << endl;
    else cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n;
	bool sol = false;
	cin >> n;
	while(n){
		int prev = n;
		int k = n%10;
		if(k == 7)
			sol = true;
		n /=10;
		
	}
	if(sol)
		cout << "Yes" <<'\n';
	else 
		cout << "No" << '\n';
}


Measured memory_bytes: 3056
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		int s = in.nextInt();
      	int g = in.nextInt();
      	int k = in.nextInt();
      
      for(int i = s;i <= g;i++){
        if(s+k>i||g-k<i){System.out.println(i);}
      }
	}
}

Measured memory_bytes: 22608
#include "vector"
#include "set"
#include "map"
#include "unordered_map"
#include "string"
#include "iostream"
#include "algorithm"
#include "queue"

using namespace std;

#define ll long long
#define INF 2e9
#define MOD 998244353

typedef vector<int> vi;
typedef pair<int, int> pii;


template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    bool first = true;
    for (const auto& j: v) {
        if (!first) {
            os << " ";
        }
        first = false;
        os <<j;
    }
    return os;
}

template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& elem : v) {
        is >> elem;
    }
    return is;
}


void solve() {
    int n;
    cin >> n;

    int ans = 0;
    while (n > 0) {
        ans += n % 10;
        n /= 10;
    }
    if (ans == 1) {
        ans = 10;
    }

    cout << ans;
}

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


    if (0) {
        int tests;
        cin >> tests;
        while (tests--) {
            solve();
            cout << endl;
        }
    } else {
        solve();
        cout << endl;
    }

    return 0;
}

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

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;


struct edge{int u,v,cost;};
struct vertex{int p,x,y;};

bool Compx (const vertex& e1,const vertex& e2){
    return e1.x < e2.x;
}
bool Compy(const vertex& e1,const vertex& e2){
    return e1.y < e2.y;
}
bool Compcost(const edge& e1,const edge& e2){
    return e1.cost < e2.cost;
}


struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
const int MAX_V = 100100;
int N,E;
edge Edge[2*MAX_V];
vertex Ver[MAX_V];

int kruskal(){
    std::sort(Edge,Edge+E,Compcost);
    UnionFind uf(N);

    int res=0;
    for(int i=0;i<E;i++){
        edge e = Edge[i];
        if(!uf.issame(e.u,e.v)){
            uf.merge(e.v,e.u);
            res+=e.cost;
        }
    }
    return res;
}



int main() {
    
    cin >> N;
    for(int i=0;i<N;i++){
        int x,y;
        cin >> x >> y;
        Ver[i]={i,x,y};
    }
    std::sort(Ver,Ver+N,Compx);
    for(int i=0;i<N-1;i++){
        Edge[i]={Ver[i].p,Ver[i+1].p,abs(Ver[i].x-Ver[i+1].x)};
    }
    std::sort(Ver,Ver+N,Compy);
    for(int i=0;i<N-1;i++){
        Edge[N-1+i]={Ver[i].p,Ver[i+1].p,abs(Ver[i].y-Ver[i+1].y)};
    }
    E=2*N-2;
    ll ans = kruskal();
    std::cout << ans << endl;

    return 0;
}

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

int n,h,m;
double a1,a2,aa;

int main(){
	for(scanf("%d",&n);n>0;n--){
		scanf("%d:%d",&h,&m);
		a1=m*6;
		a2=h*30+m*0.5;
		aa=fabs(a1-a2);
		if(aa>180)aa=fabs(a1-a2+360);
		if(aa>180)aa=fabs(a1-a2-360);
		if(aa<30)printf("alert\n");
		else if(aa<90)printf("warning\n");
		else printf("safe\n");
	}
	return 0;
}

Measured memory_bytes: 580
N, K = map(int, input().split())
A = list(map(int, input().split()))
Asum = sum(A)

div = set()
for i in range(1, int(Asum ** 0.5 + 0.5) + 1):
    if Asum % i == 0:
        div.add(i)
        div.add(Asum//i)

ans = 1
for d in div:
    now = 10 ** 18
    R = [a % d for a in A]
    R.sort()
    Rsum = sum(d - r for r in R)
    Lsum = 0
    for r in R:
        Lsum += r
        Rsum -= d - r
        now = min(now, max(Lsum, Rsum))

    if now <= K:
        ans = max(ans, d)

print(ans)


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int max = Math.max(a, b);
        max = Math.max(max, c);

        if (max == a) {
            System.out.println(b + c);
            return;
        }

        if (max == b) {
            System.out.println(a + c);
            return;
        }

        System.out.println(a + b);

    }
}

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

int N;
int A[100001];
int main(void) {
    cin >> N;
    rep(i, N) scanf("%d", &A[i]);
    long long int ans = 0;
    for(int i=0; i<N-1; ++i) {
        ans += A[i]/2;
        if(A[i]%2==1 && A[i+1]>=1) {
            ans++;
            A[i+1]--;
        }
    }
    ans += A[N-1]/2;
    cout << ans << endl;
}

Measured memory_bytes: 640
INF = float("INF")
n,m = map(int,input().split())
A = [0]*m
C = [0]*m
for i in range(m):
    a,b = map(int,input().split())
    A[i] = a
    for j in map(int,input().split()):
        j -= 1
        C[i] += 1<<j 

dp = [[INF]*(m+1) for _ in range(1<<n)]
dp[0][0] = 0
for i in range(1<<n):
    for j in range(m):
        dp[i][j+1] = min(dp[i][j],dp[C[j]&i^i][j] + A[j])

# for i in range(1<<n): print(dp[i])
print(dp[-1][-1] if dp[-1][-1] != INF else -1)

Measured memory_bytes: 137304
#include <algorithm>
#include <cstdio>

using namespace std;

int N, X[100005], L, Q;

int dp[17][131072];

void solve() {
    X[N+1] = 0x7fffffff;
    for (int i = 1; i <= N; i++) {
        dp[0][i] = lower_bound(X+1, X+N+2, X[i]+L+1)-X-1;
    }
    int maxk = 0;
    for (int k = 1; k < 17; k++) {
        for (int i = 1; i <= N; i++)
            dp[k][i] = dp[k-1][dp[k-1][i]];
    }
    for (int q = 0; q < Q; q++) {
        int a, b;
        scanf("%d%d", &a, &b);
        if (a > b) swap(a, b);
        int ans = 0;
        for (int k = 16; k >= 0; k--) {
            if (dp[k][a] < b) ans += (1<<k), a = dp[k][a];
        }
        while (a < b) ans++, a = dp[0][a];
        printf("%d\n", ans);
    }
}

int main() {
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) scanf("%d", X+i);
    scanf("%d", &L);
    scanf("%d", &Q);
    solve();
    return 0;
}

Measured memory_bytes: 7808
#!/usr/bin/ruby
class Card
	attr_reader :n, :s
	def initialize(s,n)
		@s=s;@n=n
	end
	def <=(o)
		@n<=o.n
	end
	def ==(o)
		@s==o.s&&@n==o.n
	end
	def to_s
		@s+' '+@n.to_s
	end
end
def partition(a,p,r)
	x=a[r]
	i=p
	p.step(r-1){|j|
		if a[j]<=x
			a[i],a[j]=a[j],a[i]
			i=i+1
		end
	}
	a[i],a[r]=a[r],a[i]
	return i
end
def quicksort(a,p,r)
	if p<r
		q=partition(a,p,r)
		quicksort(a,p,q-1)
		quicksort(a,q+1,r)
	end
end
def merge(a,left,mid,right)
	n1=mid-left
	n2=right-mid
	l=a[left,n1]
	r=a[mid,n2]
	l<<Card.new('',9999999999)
	r<<Card.new('',9999999999)
	i=0
	j=0
	left.step(right-1){|k|
		if l[i]<=r[j]
			a[k]=l[i]
			i=i+1
		else
			a[k]=r[j]
			j=j+1
		end
	}
end
def mergesort(a,left,right)
	if left+1<right
		mid=(left+right)/2
		mergesort(a,left,mid)
		mergesort(a,mid,right)
		merge(a,left,mid,right)
	end
end
a=$<.drop(1).map(&:split)
card=[];card2=[]
a.each{|e|card<<Card.new(e[0],e[1].to_i);card2<<Card.new(e[0],e[1].to_i)}
quicksort(card,0,card.size-1)
mergesort(card2,0,card2.size)
puts card==card2 ? 'Stable' : 'Not stable'
puts card

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

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int a[1000000];

int main(){
	int n=read(),k=read();
	int pos;
	for(int i=1;i<=n;i++){
		a[i]=read();
		if(a[i]==1) pos=i;
	}
	int l=1;
	int ans=0;
	if(pos!=1){
		while(1){
			l=l+k-1;
			ans++;
			if(l>=pos) break;
		}
	}
	if(l>=n){
		cout<<ans;
		return 0;
	}
	while(1){
		l=l+k-1;
		ans++;
		if(l>=n){
			cout<<ans;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int data[n];
  for(int i=0;i<n;i++) cin >> data[i];
  for(int i=n-1;i>=0;i--) cout << (i!=n-1?" ":"") << data[i];
  cout << endl;
}

Measured memory_bytes: 1160
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int D = in.nextInt();
    int N = in.nextInt();
    in.close();
    System.out.println((int)(Math.pow(100, D) * (N + N / 100)));
  }
}

Measured memory_bytes: 21844
#include<iostream>
#include<cmath>
#include<map>

using namespace std;

int main(){

   int A;
   int B;
   int C;
   cin >> A >> B >> C;

   if(A + B >= C){
	   cout << "Yes";
   }else{
	   cout << "No";
   }


    return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        String n = s.next();
        n = n.replaceAll("eraser", "");
        n = n.replaceAll("erase", "");
        n = n.replaceAll("dreamer", "");
        n = n.replaceAll("dream", "");
        
        System.out.println(n.length() == 0 ? "YES": "NO");

    }
}

Measured memory_bytes: 29620
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int cA=0,cB=0;
string s;
  cin>>s;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]=='A')
      cA++;
    else
      cB++;
  }
  if(cA>0 && cB>0)
    cout<<"Yes";
  else
    cout<<"No";
}

Measured memory_bytes: 256
#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(){
    ll n;
    ll ans=1,ans2=1,ans3=1;
    ll mod=1e9+7;
    cin >> n;


    rep(i,n){
        ans*=10;
        ans2*=9;
        ans3*=8;
        ans=ans%mod;
        ans2=ans2%mod;
        ans3=ans3%mod;
        
    }

    ans=ans-ans2*2+ans3;

    while(ans<0){
        ans+=mod;
    }

    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;

int ans=-1;
int n,m,q;
vector<int>a(50);
vector<int>b(50);
vector<int>c(50);
vector<int>d(50);

void dfs(vector<int>A){
	if(A.back()<m){
		auto tmp=A;
		tmp.back()++;
		dfs(tmp);
	}
	if(SZ(A)==n){
		int score=0;
		rep(i,q)if(A[b[i]-1]-A[a[i]-1]==c[i])score+=d[i];
		chmax(ans,score);
		return;
	}
	A.push_back(A.back());
	dfs(A);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n>>m>>q;
	rep(i,q)cin>>a[i]>>b[i]>>c[i]>>d[i];
	vector<int>A={1};
	dfs(A);
	cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
const int maxn=100010;
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,a[maxn],c,x;
int main(){
	n=read();
	FOR(i,1,n) a[i]=read();
	sort(a+1,a+n+1,greater<int>());
	FOR(i,1,n+1) if(a[i]<i){c=i-1;break;}
	if((a[c]-c)&1) return puts("First"),0;
	FOR(i,c+1,n+1){
		if(a[i]<c) return puts(x&1?"First":"Second"),0;
		x++;
	}
}

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

int main()
{
  long long INF=1e13;
  
  int n,w;
  cin>>n>>w;
  
  vector<int> weight(n);
  vector<int> value(n);
  int vsum=0;
  for(int i=0;i<n;i++)
  {
    cin>>weight[i]>>value[i];
    vsum+=value[i];
  }
  
  vector<long long> x(vsum+1);
  for(int i=0;i<=vsum;i++)
    x[i]=INF;
  x[0]=0;
  
  for(int i=0;i<n;i++)
  {
    for(int j=vsum;j>=value[i];j--)
      x[j]=min(x[j],x[j-value[i]]+(long long)weight[i]);
  }
  
  for(int j=vsum;j>=0;j--)
  {
    if(x[j]<=w)
    {
      cout<<j<<endl;
      break;
    }
  }
}


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

ll A[100001];
int main(){
  ll n;
  cin >> n;
  for(int i=0;i<n;i++) cin >> A[i];
  sort(A,A+n);

  ll large_side = 0, small_side = 0;
  for(int i=n-1;i>=1;i--){
    if(A[i] == A[i-1]){
      if(large_side == 0) { large_side = A[i]; i--; }
      else { small_side = A[i]; break; }
    }
  }
  ll ans = large_side * small_side;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 233333
ll f[333][333],t[333][333];
int n,k,MOD;
ll C[333][333];
int main()
{
	cin>>n>>k>>MOD;
	for(int i=0;i<=303;++i)
	{
		C[i][0]=1;
		for(int j=1;j<=i;++j)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
	}
	for(int i=1;i<=k;++i)
		f[1][i]=t[1][i]=i,t[0][i]=1;
	for(int i=2;i<=n;++i)
	{
		int su=0;
		for(int r=1;r<=k;++r)
			(su+=t[i-1][r-1])%=MOD,f[i][r]=su;
		for(int j=1;j<=k;++j)
			for(int a=1;a<=i;++a)
				(t[i][j]+=f[a][j]*t[i-a][j]%MOD*C[i-1][i-a])%=MOD;
	}
	ll ans=t[n][k];ans=(ans%MOD+MOD)%MOD;
	printf("%lld\n",ans);
}


Measured memory_bytes: 2688
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main (String args[]) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Map<String, Integer> map = new HashMap<String,Integer>();
		for(int i = 0; i < n; i++) {
			String s = scan.next();
			if(map.get(s) == null) {
				map.put(s, 1);
			} else {
				int num = map.get(s);
				map.put(s, num + 1);
			}
		}
		int max= 0;
		List<String> list = new ArrayList<String>();
		for(Map.Entry<String, Integer> entry : map.entrySet()) {
			if(max < entry.getValue()) {
				max = entry.getValue();
				list.clear();
				list.add(entry.getKey());
			} else if(max == entry.getValue()){
				list.add(entry.getKey());
			}
		}
		Collections.sort(list);
		
		for(int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}
	}
}

Measured memory_bytes: 82728
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		if(a % 2 == 1 && b % 2 == 1) {
			System.out.println("Odd");
		} else {
			System.out.println("Even");
		}
	}
}

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

int main(){
string s;
cin>>s;
for (int i = 0; i < s.size(); i++)
{
    /* code */
    s[i]='x';
}
cout<<s<<endl;
}


Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
typedef long long int ll;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define MOD 1000000007
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);  
//*s.find_by_order(p)   returns the value of pth largest starting from 0 
//s.order_of_key(p)   returns no. of items that are strictly < p 
//string bin = bitset<64>(m).to_string();     convert decimal m to binary 
int main()
{
      fast;ll t;t=1;
      while(t--)
      { 
            ll maxi,mini,n,a,b,i,maxi1,mini1;
            cin>>n;
            maxi=0;mini=10e16;
            maxi1=-10e16;mini1=10e16;
            for(i=0;i<n;i++)
            {
                  cin>>a>>b;
                  maxi=max(maxi,a+b);
                  mini=min(mini,a+b);
                  maxi1=max(maxi1,(a-b));
                  mini1=min(mini1,(a-b));
            }
            cout<<max(maxi-mini,maxi1-mini1)<<"\n";
      }
}

Measured memory_bytes: 3588
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int a = Integer.parseInt(br.readLine());
	String s = br.readLine();
	if (a >= 3200)
	    System.out.println(s);
	else
	    System.out.println("red");
    }
}

Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
struct state { ll pos, cnt; };

ll n, m;
ll u, v;
ll s, t;
vector<ll> tmp[100005];
int visit[3][100005];
ll  cost[3][100005];

queue<struct state> que;

int main()
{
    scanf("%lld %lld", &n, &m);

    for (int i = 0; i < m; i++) {
        scanf("%lld %lld", &u, &v);

        tmp[u].push_back(v);
    }
    scanf("%lld %lld", &s, &t);

    que.push((struct state){.pos = s, .cnt = 0});
    visit[0][s] = 1;
    cost[0][s] = 0;

    while (!que.empty()) {
        struct state st = que.front(); que.pop();
        ll pos = st.pos;
        ll cos = st.cnt;

        for (int i = 0; i < tmp[pos].size(); i++) {
            ll npos = tmp[pos][i];
            ll ncos = cos + 1;

            if (!visit[ncos % 3][npos]) {
                que.push((struct state){.pos = npos, .cnt = ncos});
                visit[ncos % 3][npos] = 1;
                cost[ncos % 3][npos] = ncos / 3;
            }
        }
    }

    if (cost[0][t]) {
        printf("%lld\n", cost[0][t]);
    }
    else {
        printf("-1\n");
    }

    return 0;
}


Measured memory_bytes: 9216
#include "bits/stdc++.h"

using namespace std;

constexpr double eps = 1e-9;
using matrix = vector<vector<int>>;

using ll = long long;
constexpr ll mod = 998244353;

template <typename T>
T mypow(T a, T b) {
  if (b == 0) return 1;
  T tmp = mypow(a, b / 2);
  if (b % 2)
    return (((tmp * tmp) % mod) * a) % mod;
  else
    return (tmp * tmp) % mod;
}

int main() {
  ll n, m;
  cin >> n >> m;
  matrix a(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }

  int rank = 0;
  for (int j = 0; j < m; j++) {
    int pivot = -1;
    for (int i = rank; i < n; i++) {
      if (a[i][j]) {
        pivot = i;
        break;
      }
    }
    if (pivot >= 0) {
      if (pivot != rank)
        for (int k = 0; k < m; k++) swap(a[pivot][k], a[rank][k]);
      for (int i = rank + 1; i < n; i++) {
        if (a[i][j])
          for (int k = 0; k < m; k++) a[i][k] ^= a[rank][k];
      }
      rank++;
    }
  }

  ll ret = mypow(2LL, n + m - 1) + mod - mypow(2LL, n + m - rank - 1);
  cout << ret % mod << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <float.h>

using namespace std;

int main(){
  const double num = 0.006;
  int n;
  double t,a;
  double diff = DBL_MAX;
  int ans = 0;
  cin >> n >> t >> a;
  for(int i=0;i<n;i++){
    double h;
    cin >> h;
    if(t-h*0.006==a){
      cout << i+1 << endl;
      return 0;
    }else if(fabs(a-(t-h*num))<diff){
      ans = i+1;
      diff = fabs(a-(t-h*num));
    }
  }
  cout << ans << endl;
}

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

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)

#define nl '\n'
#define ioi exit(0);

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

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
//~ const int mod = (int)1e9 + 7;
const int mod = 998244353;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

string conv(int a){stringstream ss;ss << a;string str = ss.str();return str;}
string conv(char a){stringstream ss;ss << a;string str = ss.str();return str;}
int conv(string a){stringstream geek(a); int x = 0; geek >> x;   return x;}

struct node 
{ 
   int minimum; 
   int maximum; 
}; 
  

int getMid(int s, int e) {  return s + (e -s)/2;  } 
  
struct node MaxMinUntill(struct node *st, int ss, int se, int qs, 
                         int qe, int index) 
{ 
    
    struct node tmp,left,right; 
    if (qs <= ss && qe >= se) 
        return st[index]; 
  
    
    if (se < qs || ss > qe) 
    { 
       tmp.minimum = INT_MAX; 
       tmp.maximum = INT_MIN; 
       return tmp; 
     } 
  
    int mid = getMid(ss, se); 
    left = MaxMinUntill(st, ss, mid, qs, qe, 2*index+1); 
    right = MaxMinUntill(st, mid+1, se, qs, qe, 2*index+2); 
    tmp.minimum = min(left.minimum, right.minimum); 
    tmp.maximum = max(left.maximum, right.maximum); 
    return tmp; 
} 
  
 
struct node MaxMin(struct node *st, int n, int qs, int qe) 
{ 
    struct node tmp; 
  
    if (qs < 0 || qe > n-1 || qs > qe) 
    { 
        printf("Invalid Input"); 
        tmp.minimum = INT_MIN; 
        tmp.minimum = INT_MAX; 
        return tmp; 
    } 
  
    return MaxMinUntill(st, 0, n-1, qs, qe, 0); 
} 
  
void constructSTUtil(int arr[], int ss, int se, struct node *st, int si) 
{ 
    if (ss == se) 
    { 
        st[si].minimum = arr[ss]; 
        st[si].maximum = arr[ss]; 
        return ; 
    } 
  
    int mid = getMid(ss, se); 
    constructSTUtil(arr, ss, mid, st, si*2+1); 
    constructSTUtil(arr, mid+1, se, st, si*2+2); 
  
    st[si].minimum = min(st[si*2+1].minimum, st[si*2+2].minimum); 
    st[si].maximum = max(st[si*2+1].maximum, st[si*2+2].maximum); 
} 
  
struct node *constructST(int arr[], int n) 
{ 
    int x = (int)(ceil(log2(n))); 
  
    int max_size = 2*(int)pow(2, x) - 1; 
  
    struct node *st = new struct node[max_size]; 
  
    constructSTUtil(arr, 0, n-1, st, 0); 
  
    return st; 
} 



int main() 
{ 
	int a, b, c; cin>> a >> b >> c;
	cout<< min(min(a+b, a+c), b+c);
	return 0; 
} 


Measured memory_bytes: 256
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	a,b = map(int,input().split())
	print(a*b//gcd([a,b]))

def factorization(n):
	if n<2:
		return []
	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])

	if temp!=1:
		arr.append([temp, 1])

	if arr==[]:
		arr.append([n, 1])

	return arr

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(numbers):
	return reduce(fractions.gcd, numbers)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()



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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  
  for (int i=0; i<N; i++) {
    cin >> a.at(i);
  }
  
  int b=0, c=0;
  while (1) {
    c++;
    b=a.at(b)-1;
    if (b==1) {
      break;
    }
    if (c>N) {
      c=-1;
      break;
    }
  }
  cout << c << endl;
}

Measured memory_bytes: 3784
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))

(defun calc-digit (n)
  (if (= 0 (floor n 10))
      1
      (1+ (calc-digit (floor n 10)))
      ))

(defun ans (num)
  (if (zerop num)
      0
      (if (oddp (calc-digit num))
          (1+ (ans (1- num)))
          (ans (1- num))
          )
   ))

(print (ans (read)))

Measured memory_bytes: 23484
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int E, Y;   //歴の種類、歴での年
    cin >> E >> Y;
    if(E==0){
        if(1868<=Y&&Y<=1911)
            cout << "M" << (Y-1868+1) <<endl;
        else if(1912<=Y&&Y<=1925)
            cout << "T" << (Y-1912+1) <<endl;
        else if(1926<=Y&&Y<=1988)
            cout << "S" << (Y-1926+1) << endl;
        else
            cout <<"H" <<(Y-1989+1) << endl;
    }
    else if(E==1)
        cout << (Y+1868-1) << endl;
    else if(E==2)
        cout << (Y+1912-1) << endl;
    else if(E==3)
        cout << (Y+1926-1) << endl;
    else
        cout << (Y+1989-1) <<endl;
} 


Measured memory_bytes: 3100