akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 10

using namespace std;

char mp[SIZE][SIZE];

int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++) scanf("%s",&mp[i]);
	int px=0,py=0;
	while(1)
	{
		mp[px][py]='.';
		if(px+1<n&&mp[px+1][py]=='#') px++;
		else if(py+1<m&&mp[px][py+1]=='#') py++;
		else break;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(mp[i][j]!='.')
			{
				puts("Impossible");
				return 0;
			}
		}
	}
	puts("Possible");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define LL long long
using namespace std;
int Cnt, A[1000001];
LL N;
LL h, t;

inline void dfs (LL x)
{
	if (x == 1) {h = 1000, t = 999;return ;}
	if (x % 2) 
	{
		dfs(x - 1);
		A[--h] = ++Cnt;
	}
	else
	{
		dfs(x / 2);
		A[++t] = ++Cnt;
	}
}

int main()
{
#ifdef hk_cnyali
	freopen("C.in", "r", stdin);
	freopen("C.out", "w", stdout);
#endif
	scanf("%lld", &N);
	dfs(N + 1);
	cout<<Cnt * 2<<endl;
	for (int i = h; i <= t; ++i)
		cout<<A[i]<<" ";
	for (int i = 1; i <= Cnt; ++i)
		cout<<i<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		
		try {
			while((line = br.readLine()) != null) {
				line = line.trim();
				String[] values = line.split("\\s");
				if(values.length != 2) System.exit(-1);
				
				int[] value = new int[2];
				int i = 0;
				for(String s : values) {
					value[i] = Integer.parseInt(s);
					if(value[i] > 2000000000 || value[i] < 0) System.exit(-2);
					i++;
				}
				int a = value[0];
				int b = value[1];

				int lcm = getLCM(a, b);
				
				System.out.println(getLCM(a, b) + " " + a * (b / lcm));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	static int getLCM(int a, int b){
		int i = a;
		int j = b;
		while(i != j) {
			if(i > j) i -= j;
			else j -= i;
		}
		return i;
	}

}

Measured memory_bytes: 16928
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b; cin >> a >> b;
    int N=a.size();
    vector<int> A(N),B(N),one;
    bool zeroa=true,zerob=true;
    for (int i=0;i<N;++i){
        A[i]=a[i]-'0'; B[i]=b[i]-'0';
        if (B[i]) zerob=false,one.emplace_back(i);
        if (A[i]) zeroa=false;
    }
    if (zerob){
        cout << (zeroa?0:-1) << '\n';
        return 0;
    }
    int n=one.size();
    for (int i=0;i<n;++i) one.emplace_back(one[i]+N);
    for (int i=0;i<n;++i) one.emplace_back(one[i]+2*N);
    int ans=INF;
    for (int i=0;i<N;++i){
        for (int _=0;_<2;++_){
            int cnt=0;
            priority_queue<pair<int,int>> pq;
            for (int j=0;j<N;++j){
                if (A[(!_?(j-i+N)%N:(j+(N-1-i))%N)]==B[j]) continue;
                ++cnt;
                int l=(!_?j-i:j)+N,r=(!_?j:j+(N-1-i))+N;
                int exr=upper_bound(one.begin(),one.end(),r)-one.begin();
                int exl=lower_bound(one.begin(),one.end(),l)-one.begin();
                if (exr-exl) continue;
                int r_r=one[exr],l_l=one[--exl];
                pq.emplace(2*(r_r-r),2*(l-l_l));
            }
            int Min=(!pq.empty()?pq.top().first:0),Maxl=0;
            while(!pq.empty()){
                auto p=pq.top(); pq.pop();
                Maxl=max(Maxl,p.second);
                Min=min(Min,(!pq.empty()?pq.top().first:0)+Maxl);
            }
            ans=min(ans,(!_?i:N-1-i)+cnt+Min);
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 384
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;


#define int long long
#define all(v) v.begin() , v.end()
#define pb push_back
#define endl '\n' 
template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

string s ; 

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> s ;
	int v = ( int ) s . size ( ) % 2 + ( s [ 0 ] == s . back ( ) ) ;
	cout << ( v % 2 == 0 ? "Second" : "First" ) << '\n' ; 
}


Measured memory_bytes: 512
s = int(input())
a = set([s])
i = 1

while True:
  if s % 2 == 0:
    s = s // 2
    if s in a:
      break
    a.add(s)
  else:
    s = 3 * s + 1
    if s in a:
      break
    a.add(s)
  i += 1

print(i+1)

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

using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;


typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	//ifstream in("in.txt");
	//cin.rdbuf(in.rdbuf());

	int N, K;
	cin >> N >> K;
	vector<double> each(N);

	double ans = 0;
	FOR(i, 1, N + 1) {
		
		int score = i;
		int flip_time = 0;
		while (score < K)
		{
			score = score << 1;
			flip_time++;
		}
		ans += pow(0.5, flip_time) / (double)N;
	}

	cout << setprecision(16) << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e9+7;
ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ii,ll>
#define f(i,a,b) for(long long i = a;i < b;i++)
#define rf(i,a,b) for(long long i=a;i>=b;i--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define w(t) while(t--)
#define c(n); cin>>n;
#define p(n) cout<<n;
#define pl(n) cout<<n<<endl;
#define ps(n); cout<<n<<" ";
#define F first
#define S second
#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()
#define ull unsigned long long
#define vll vector<ll>
#define vii vector<ii>
#define mkp make_pair
#define ld long double
#define arrin(a,n) f(i,0,n){cin>>a[i];}
#define arrout(a,n) f(i,0,n){cout<<a[i]<<" ";}
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define PI (2*acos(0))
const long long N = 1e6+5;
vll visit,dist,taken;
vector<vll> adj;
vector<vii> adj2;
priority_queue<ii,vector<ii>, greater<ii> > pq;
ll bit[N]={0};
ll siz;
ll res = 0;
ll lcm(ll a,ll b){return (a * b) / __gcd(a,b);}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll power(ll a,ll b){if(b == 0)return 1;if(b == 1)return a;ll ans = power(a,b/2) % MOD;ans *= ans;ans %= MOD;if(b % 2 == 1)ans *= a;return ans%MOD;}
ll inverse(ll x){x%=MOD;return power(x,MOD-2);}
void BITup(ll k, ll x){while(k <= siz){bit[k]+=x;k += k & -k;}}
ll BITq(ll k){ll s=0;while(k>=1){s+=bit[k];k -= k &-k;}return s;}
struct node{ll lazy,val;}seg[4000000];
struct point{ll x,y;};
void dfs(ll v){visit[v] = 1;for(auto x:adj2[v]){if(!visit[x.F])dfs(x.F);}}
void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();q.pop();for(auto x:adj[u]){if(!visit[x])q.push(x);}}}
void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}}
ll mst(ll s){taken.assign(N, 0);prim(s);ll cost = 0;while(!pq.empty()){ii front = pq.top();pq.pop();ll w = front.first;ll u = front.second;if(taken[u]==0)cost += w;prim(u);}return cost;}
void YESNO(ll a){if(!!a){pl("Yes");}else{pl("No");}}
void filesin(void){freopen("input.txt","r",stdin);}
void filesout(void){freopen("output.txt","w",stdout);}
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///AtCoder Beginner Contest 159
int main(void){
    fastio;
    ld n;
    c(n);
    ld num = n/3;
    ld ans = num * num * num;
    cout<<setprecision(10)<<fixed<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int main(void){
    int A;
    cin >> A;
    
    if(A%10==3){
        cout << "bon" << endl;
    }else if(A%10==0||A%10==1||A%10==6||A%10==8){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
int sq(int,int,int);
int sq(int N,int K,int a){
  if(N==0){
    return a;
  }else{
    if(a>K){
      return sq(N-1,K,a+K);
    }else{
      return sq(N-1,K,a+a);
    }
  }
}

int main(){
  int N,K;
  scanf("%d",&N);
  scanf("%d",&K);
  printf("%d",sq(N,K,1));
  return 0;
}


Measured memory_bytes: 128
/*
 * 	Roses are red
 * 		Violets are blue
 * 			I cried
 * 				And so did you
 */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=2e18;
const int infi=1e9;
const int mod=998244353;
//const int mod=1000000007;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void solve() {
	int n;
	string s;
	cin>>s;
	n=sz(s);
	if(s[0]=='0'||s[n-1]=='1') {
		cout<<-1<<endl;
		return;
	}
	for(int i=0; i+1<n; i++)
		if(s[i]!=s[n-i-2]) {
			cout<<-1<<endl;
			return;
		}
	int len=1;
	vector<pii> a;
	a.pb({0,0});
	for(int i=1; i<n/2; i++) {
		if(s[i]=='1') {
			a.pb({i+1,i-a.back().fi});
			len++;
		}
	}
	for(int i=1; i<len; i++)
		cout<<i<<" "<<i+1<<endl;
	int cntr=len+1;
	for(int i=1; i<len; i++) {
		for(int j=0; j<a[i].se; j++) {
			cout<<i<<" "<<cntr<<endl;
			cntr++;
		}
	}
	while(cntr<=n) {
		cout<<len<<" "<<cntr<<endl;
		cntr++;
	}
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 2372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,h[100005],c;
bool t=true;
int main(void){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	for(int i=1;i<n;i++){
		if(h[i-1]>h[i]){
			c++;
		}
		if(h[i-1]<h[i]){
			c=0;
		}
		if(h[i-1]-1>h[i]){
			t=false;
		}
		if(c>=2){
			t=false;
		}
	}
	if(t){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void)
{
	int N;
	int count = 0;
	int number = 0;
	scanf("%d", &N);
	for (int i = 1; i <= N; i += 2) {
		for (int j = 1; j <= i; j++) {
			if (i % j == 0)
				count++;
		}
		if (count == 8)
			number++;
		count = 0;
	}
	printf("%d", number);
		
	return 0;

}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-

def get_input() -> str:
    """
    標準入力を取得する.

    Returns:\n
        str: 標準入力
    """
    S = input()

    return S


def main(S: str) -> None:
    """
    メイン処理.

    Args:\n
        S (str): 天気の記録（|S| = 3, Sの各文字は"S"または"R"）
    """
    # 求解処理
    ans = S.count("R") - (S == "RSR")

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    S = get_input()

    # メイン処理
    main(S)


Measured memory_bytes: 9060
#include<bits/stdc++.h>
#define MAX 110
#define inf 1<<28
#define f first
#define s second
#define mp make_pair
using namespace std;

int w,h,n,si,sj,gi,gj;
bool grid[MAX][MAX]={};
int Y[4]={1,0,-1,0};
int X[4]={0,1,0,-1};
int d[MAX][MAX];

int bfs(){
  for(int i=0;i<MAX;i++){
    for(int j=0;j<MAX;j++)d[i][j]=inf;
  }
  d[si][sj]=0;
  queue<pair<int,int> > q;
  q.push(mp(si,sj));

  while(q.size()){
    pair<int,int> u=q.front();
    q.pop();
    if(u.f==gi && u.s==gj)return d[gi][gj];

    for(int k=0;k<4;k++){
      int a=u.f+Y[k],b=u.s+X[k];
      if(grid[a][b])continue;
      a+=Y[k];
      b+=X[k];
      if(d[a][b]==inf){
	d[a][b]=d[u.f][u.s]+1;
	q.push(mp(a,b));
      }
    }
  }
  return -1;
}

int main()
{
  int a,b,c,d;
 
  cin>>w>>h>>n;

  for(int i=0;i<=h*2;i++)grid[i][0]=grid[i][w*2]=true;
  for(int i=0;i<=w*2;i++)grid[0][i]=grid[h*2][i]=true;

  for(int i=0;i<n;i++){
    cin>>a>>b>>c>>d;
    for(int j=min(a,c)*2;j<=max(a,c)*2;j++){
      for(int k=min(b,d)*2;k<=max(b,d)*2;k++)grid[k][j]=true;
    }
  }
  cin>>sj>>si>>gj>>gi;
  si=si*2+1;
  sj=sj*2+1;
  gi=gi*2+1;
  gj=gj*2+1;

  int dis=bfs(),ans=0;

  for(int i=2;i<=h*2-2;i+=2){
    for(int j=1;j<=w*2-1;j+=2){
      if(grid[i][j])continue;
      grid[i][j]=true;
      ans=max(bfs()-dis,ans);
      grid[i][j]=false;
    }
  }
  for(int i=1;i<=h*2-1;i+=2){
    for(int j=2;j<=w*2-2;j+=2){
      if(grid[i][j])continue;
      grid[i][j]=true;
      ans=max(bfs()-dis,ans);
      grid[i][j]=false;
    }
  }
  cout<<ans<<endl;  

  return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int n; std::cin >> n;
    int ans = 1;
    while (ans * 2 <= n) {
        ans *= 2;
    }
    std::cout << ans << "\n";
}


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[][] plan = new int [n][3];
   		int[] planlog = new int [3];

   		for(int i=0;i<n;i++) {
   			plan[i][0] = Integer.parseInt(sc.next());
   			plan[i][1]=Integer.parseInt(sc.next());
   			plan[i][2]=Integer.parseInt(sc.next());
   		}
   		sc.close();
    
   		for(int i=0;i<n;i++) {
   			//time,X,Y差分
   			int absT = plan[i][0] - planlog[0];
   			int absX = Math.abs(plan[i][1] - planlog[1]);
   			int absY = Math.abs(plan[i][2] - planlog[2]);
   			//時間内に移動できるか && とどまることができるか
   			if(absT>=absX+absY&&absT%2==(absX+absY)%2) {
   				//System.out.println(absT+" "+absX+" "+absY);
   				planlog[0]=absT;
   				planlog[1]=absX;
   				planlog[2]=absY;
   			}else{
   				System.out.println("No");
   				return;
   			}
   		}
   		System.out.println("Yes");
   	}
    
}

Measured memory_bytes: 64652
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

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

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll h,w,k; cin >> h >> w >> k;
    ll ans = 0;
    vector<string> s(h);
    rep(i,0,h)cin >> s[i];
    rep(i,0,(1LL << h))rep(j,0,(1LL << w)){
        vector<string> t = s;
        rep(ii, 0, h)if((i >> ii) & 1){
            rep(jj, 0, w)t[ii][jj] = 'w';
        }
        rep(jj, 0, w)if((j >> jj) & 1){
            rep(ii, 0, h)t[ii][jj] = 'w';
        }
        ll sum = 0;
        rep(ii,0,h)rep(jj,0,w){
            if(t[ii][jj] == '#')sum++;
        }

        if(sum == k)ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define ll long long
//map<key,value>

int main(){
  int l,r;
  ll mini = 2020;
  cin >> l >> r;
  for(ll i=l;i<=r-1;i++){
    for(ll j=i+1;j<=r;j++){
      mini = min(mini,((i%2019)*j)%2019);
      if(i%2019 == 0 || j%2019 == 0){
        cout << 0;
        return 0;
       }
    }
  }
  cout << mini;
  return 0;
}


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

#define mp(x, y) make_pair((x), (y))

typedef long long ll;

int n;
int x[100005];

ll mod=1000000007;

ll ans=1;

int main()
{
	scanf("%d", &n);
	for(int i=0; i<n; i++) scanf("%d", &x[i]);
	int empty=0;
	int cur=0;
	for(int i=0; i<n; i++) {
		empty+=(i==0 ? x[i]-1 : x[i]-x[i-1]-1);
		cur++;
		if(cur-empty>=2) {
			ans=(ans*cur)%mod;
			cur--;
			empty++;
		}
	}
	while(cur>0) {
		ans=(ans*cur)%mod;
		cur--;
	}
	printf("%lld\n", ans);

	return 0;
}

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

int main() {
    int h,n;
    cin>>h>>n;
    int a[n],b[n];
    rep(i,n) cin>>a[i]>>b[i];

    vector<vector<ll>> dp(n+1,vector<ll>(h+1,1LL<<60));
    dp[0][0]=0;

    for(int i=0;i<n;i++){
        for(int j=0;j<=h;j++){
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            dp[i+1][min(j+a[i],h)]=min(dp[i+1][min(j+a[i],h)],dp[i+1][j]+b[i]);
        }
    }

    cout<<dp[n][h]<<endl;
}




Measured memory_bytes: 78592
import java.util.Scanner;

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

		int n = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();

		int count = 0;

		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			if(h <= a && w <= b) {
				count++;
			}
		}

		System.out.println(count);

		sc.close();
	}

}


Measured memory_bytes: 27344
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int n;
	cin >> n;
	vector<P> a(n);
	rep(i, n) cin >> a[i].second >> a[i].first;
	sort(all(a));
	int A = a[n-1].second, B = a[n-1].first;
	for(int i = n-1; i >= 0; i--) {
		if(a[i].first == B) A = a[i].second;
		//cout << a[i].second << " " << a[i].first << endl;
	}
	cout << A << " " << B << endl;
 	return 0;
}


Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        int ans = solve(S);
        System.out.println(ans);

    }

    private static int solve(String s) {
        int ans = 0;
        char[] sn = s.toCharArray();
        for (int i = 1; i < s.length(); i++) {
            if (sn[i - 1] == sn[i]) {
                ans++;
                sn[i] = sn[i] == '0' ? '1' : '0';
            }
        }
        return ans;
    }

}


Measured memory_bytes: 28324
//In the name of ALLAH the most merciful the most beneficial

#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<fstream>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e6+7;
static const int INF = 0x3f3f3f3f;
static const int MOD = 1e9+7;


int val(int n){
    
    if(n%2 == 0)
        return n/2;
    return 3*n+1;
}

int main(){
/*
    clock_t start,end;
    start = clock();*/
    
    int arr[con];
    int n;cin >> n;
    map<int,int> mp;//val,ind
    arr[1] = n;
    mp[n] = 1;
    FOR(i,2,con){
        
        arr[i] = val(arr[i-1]);
        if(mp.count(arr[i])){
            
            cout << i;
            return 0;
        }
        else{
            mp[arr[i]] = i;
        }
    }
        
/*  end = clock();
    double time = double(end-start)/(double)CLOCKS_PER_SEC;
    cout <<fixed<< time/1000 << "sec";*/
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        char[] cs = {'A', 'C', 'G', 'T'};
        int count = 0;
        int current = 0;
        for (int i = 0; i < s.length(); i++) {
            char t = s.charAt(i);
            boolean continuous = false;
            for (char c : cs) {
                if (t == c) {
                    current++;
                    continuous = true;
                }
            }
            if (!continuous) {
                count = Math.max(count, current);
                current = 0;
            }
        }

        if (current != 0) {
            count = Math.max(count, current);
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define MAX 100010

struct city {
    int yea, bel;
    int num;
    int ans_rank;
    
    bool operator < (const city& rhs) const {
        return yea < rhs.yea;
    }
}a[MAX];

bool cmp(city xx, city yy) {
    return xx.num < yy.num;
}

int n, m;
int siz[MAX];

int main() {
    memset(siz, 0, sizeof(siz));
    
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> a[i].bel >> a[i].yea;
        a[i].num = i;
    }
    sort(a, a + m);
    
    for (int i = 0; i < m; i++) {
        siz[a[i].bel]++;
        a[i].ans_rank = siz[a[i].bel];
    }
    sort(a, a + m, cmp);
    
    for (int i = 0; i < m; i++) {
        cout << setw(6) << setfill('0') << a[i].bel;
        cout << setw(6) << setfill('0') << a[i].ans_rank;
        cout << '\n';
    }
    return 0;
}


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

int main() {
  int A,B; cin >> A >> B;
  if ( A % 3 == 0 || B % 3 == 0 || (A+B) % 3 == 0 )cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
l = list( map(int, input().split()) )

import sys
if l.count(0) > 0:
    print(0)
    sys.exit()

ans = 1
for x in l:

    ans = ans * x

    if ans > 1000000000000000000:
        print(-1)
        sys.exit()

print(ans)


Measured memory_bytes: 21472
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn=5e5+10;
main(){
    int l,r,d;
    cin>>l>>r>>d;
    l=(l-1)/d;
    r/=d;
    cout<<(r-l)<<endl;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define ncr(n,r) fact[n]*modInv(fact[r])*modInv(fact[n-r])
#define mod 1000000007
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) cin>>x>>y; f0(i,0,k){int x,y; adj[x].pb(y); adj[y].pb(x);}
#define test int t;cin>>t;while(t--)

vector<int> divs(10000001);

signed main()
{
    fast

    int n;
    cin>>n;

    f1(i,1,sqrt(n)){
        divs[i*i]--;
        for(int j = i*i; j<=n; j+=i){
            divs[j]+=2;
        }
    }
    int ans = 0;
    f1(i,1,n) ans += divs[i]*i;
    cout<<ans;
}

Measured memory_bytes: 81248
m, d = map(int, input().strip().split(' '))
p = 0
for i in range(m):
  i = i+1
  for j in range(d):
    j = j+1
    if j//10 >= 2 and j%10 >= 2 and j//10 * (j%10) == i:
      p = p + 1
print(p)

Measured memory_bytes: 3060
#include <iostream>
#include<list>
#include<vector>
using namespace std;
vector<list<long long>>v;
int main()
{
    int n,T,t,flag,s,x,ans;
    list<long long>::iterator it;
    cin>>n>>T;
    v.resize(n);
    while(T--)
    {
        cin>>flag;
        switch(flag)
        {
        case 0:
            cin>>t>>x;
            v[t].insert(v[t].end(),x);
            break;
        case 1:
            cin>>t;
            if(v[t].empty()!=true)
            for(ans=0,it=v[t].begin();it!=v[t].end();it++,ans++)
            {
                if(ans!=0)cout<<" ";
                cout<<*it;
            }
            cout<<endl;
            break;
        case 2:
            cin>>s>>t;
            v[t].splice(v[t].end(),v[s]);
            break;
        }
    }

     return 0;
}



Measured memory_bytes: 18728
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int arrayLeng = sc.nextInt();
        int[] insSort = new int[arrayLeng];
        
        for(int i = 0; i < insSort.length; i++){
            insSort[i] = sc.nextInt();
        }
        
        InsertionSort is = new InsertionSort(insSort);
        is.insSortOutPut();
        is.numOfChange();
    }
}

class InsertionSort{
    int[] insSort;
    public InsertionSort(int[] insSort){
        this.insSort = insSort;
    }
    
    public void numOfChange(){
        int minNum = 0;
        for(int i = 0,j; i < insSort.length; i++){
            if( i == 0 ){
                continue;
            }
            minNum = insSort[i];
            j = i - 1;
            while( j >= 0 && insSort[j] > minNum){
                insSort[j + 1] = insSort[j];
                j--;
            }
            insSort[j + 1] = minNum;
            insSortOutPut();
        }
    }
    
    public void insSortOutPut(){
        System.out.print(insSort[0]);
        for(int i = 1; i < insSort.length; i++){
            System.out.print(" " + insSort[i]);
        }
        System.out.print("\n");
    }
}


Measured memory_bytes: 30804
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef queue<pii> qp;

const int X = 1e9+1;

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

    int n, m;
    cin >> n >> m;
    int a[n], b[n], c[n];
    vi mx, my;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i] >> c[i];
        mx.push_back(a[i]);
        mx.push_back(b[i]);
        my.push_back(c[i]);
    }
    int d[m], e[m], f[m];
    for (int i = 0; i < m; i++) {
        cin >> d[i] >> e[i] >> f[i];
        mx.push_back(d[i]);
        my.push_back(e[i]);
        my.push_back(f[i]);
    }

    mx.push_back(-X);
    mx.push_back(0);
    mx.push_back(X);
    my.push_back(-X);
    my.push_back(0);
    my.push_back(X);

    sort(mx.begin(), mx.end());
    mx.resize(unique(mx.begin(), mx.end()) - mx.begin());
    sort(my.begin(), my.end());
    my.resize(unique(my.begin(), my.end()) - my.begin());

    int xsz = mx.size() - 1, ysz = my.size() - 1;
    bool s[xsz][ysz], down[xsz][ysz], right[xsz][ysz];
    fill(s[0], s[xsz], false);
    fill(down[0], down[xsz], false);
    fill(right[0], right[xsz], false);

    for (int i = 0; i < n; i++) {
        int xa = lower_bound(mx.begin(), mx.end(), a[i]) - mx.begin();
        int xb = lower_bound(mx.begin(), mx.end(), b[i]) - mx.begin();
        int yc = lower_bound(my.begin(), my.end(), c[i]) - my.begin();

        for (int j = xa; j < xb; j++) {
            right[j][yc-1] = true;
        }
    }

    for (int i = 0; i < m; i++) {
        int xd = lower_bound(mx.begin(), mx.end(), d[i]) - mx.begin();
        int ye = lower_bound(my.begin(), my.end(), e[i]) - my.begin();
        int yf = lower_bound(my.begin(), my.end(), f[i]) - my.begin();

        for (int j = ye; j < yf; j++) {
            down[xd-1][j] = true;
        }
    }

    int x0 = lower_bound(mx.begin(), mx.end(), 0) - mx.begin();
    int y0 = lower_bound(my.begin(), my.end(), 0) - my.begin();

    qp q;
    q.emplace(x0, y0);
    s[x0][y0] = true;
    while (!q.empty()) {
        int x = q.front().first, y = q.front().second;
        q.pop();

        if (x < xsz - 1 && !down[x][y] && !s[x+1][y]) {
            s[x+1][y] = true;
            q.emplace(x + 1, y);
        }
        if (x >= 1 && !down[x-1][y] && !s[x-1][y]) {
            s[x-1][y] = true;
            q.emplace(x - 1, y);
        }
        if (y < ysz - 1 && !right[x][y] && !s[x][y+1]) {
            s[x][y+1] = true;
            q.emplace(x, y + 1);
        }
        if (y >= 1 && !right[x][y-1] && !s[x][y-1]) {
            s[x][y-1] = true;
            q.emplace(x, y - 1);
        }
    }

    ll ans = 0;
    for (int i = 0; i < xsz; i++) {
        for (int j = 0; j < ysz; j++) {
            if (s[i][j]) {
                if (i == 0 || i == xsz - 1 || j == 0 || j == ysz - 1) {
                    cout << "INF" << endl;
                    return 0;
                }

                ans += 1ll * (mx[i+1] - mx[i]) * (my[j+1] - my[j]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 30140
#include <set>
#include <map>
#include <ctime>
#include <cmath>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define lowbit(x) (x&(-x))
#define PII pair<LL,LL>
#define FOR(i,a,b) for (LL i=(a);i<=(b);++i)
#define ROF(i,b,a) for (LL i=(b);i>=(a);--i)
typedef long long LL;
inline LL read(){
	LL x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}

const LL MAXN=500005,lx=50000;
LL n,m,x,y,z,a,b;
LL exgcd(LL x,LL y,LL &a,LL &b){
	if (y==0) { a=1; b=0; return x; }
	LL tmp=exgcd(y,x%y,b,a); b-=a*(x/y); return tmp;
}
int main(){
	n=read();
	while (n--) {
		x=read(); y=read(); z=exgcd(x,y,a,b);
		//cout<<a<<' '<<b<<endl;
		if (a<0) a=-a;
		if (b<0) b=-b;
		if (z<=lx) {
			cout<<3<<endl;
			cout<<0<<' '<<0<<endl;
			cout<<x<<' '<<y<<endl;
			cout<<b<<' '<<a<<endl;
		}
		else {
			cout<<4<<endl;
			cout<<0<<' '<<0<<endl;
			cout<<x<<' '<<y-1<<endl;
			cout<<x/z<<' '<<y/z<<endl;
			cout<<x-1<<' '<<y<<endl;
		}
	}
	return 0;
}

/*
1
208580387 17780549

*/

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

int main() {
    int n, x;
    cin >> n >> x;
    int m[n];
    rep(i, n) cin >> m[i];

    int sum = 0, ans = n;
    rep(i, n) sum += m[i];
    ans += (x - sum) / *min_element(m, m + n);

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


Measured memory_bytes: 256
n = int(input())
als = ["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n",
      "o","p","q","r","s","t","u","v","w","x","y"]
ans = []
if n == 1:
  print("a")
  exit()
  
while n > 1:
  amari = n%26
  if amari==0 : n-=1
  alp = als[amari]
  n = n//26
  alp = als[amari]
  ans.append(alp)
  if (n == 1):
    alp = als[n%26]
    ans.append(alp)
print("".join(reversed(ans)))

Measured memory_bytes: 9220
x = int(input())
if (400<=x<=599):
  print(8)
elif (600<=x<=799):
  print(7)
elif (800<=x<=999):
  print(6)
elif(1000<=x<=1199):
  print(5)
elif(1200<=x<=1399):
  print(4)
elif(1400<=x<=1599):
  print(3)
elif(1600<=x<=1799):
  print(2)
elif(1800<=x<=1999):
  print(1)

Measured memory_bytes: 9196
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from itertools import accumulate
n,k = li()
s = ns()

prev = '0'

zeros = []
ones = []

cur = 0
for si in s:
    if si == prev:
        cur += 1
        
    else:
        if prev == '0':
            zeros.append(cur)
            prev = '1'
        else:
            ones.append(cur)
            prev = '0'
        cur = 1
        
if prev == '0':
    zeros.append(cur)
else:
    ones.append(cur)
    zeros.append(0)

if len(ones) == 0 or len(zeros) == 0:
    ans = n

else:
    ans = 0
    zero_cum = [0] + list(accumulate(zeros))
    one_cum = [0] + list(accumulate(ones))
    
    if len(zeros) <= k:
        ans = n
    
    else:
        for i in range(len(zeros)-k+1):
            tmp = (zero_cum[i+k] - zero_cum[i])\
                    + (one_cum[min(len(ones), i+k)] - one_cum[max(0, i-1)])
            ans = max(ans, tmp)
        
print(ans)

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

const int G = 2e5;
vector<int> e[G+1];
bool used[G+1];

const int yBase = 1e5;

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

  rep(i,N) {
    int x, y;
    cin >> x >> y;
    e[x].push_back(yBase+y);
    e[yBase+y].push_back(x);
  }

  ll ans = 0;
  queue<int> q;
  for(int i = 1; i <= G; i++) {
    if(used[i]) continue;

    ll nx, ny, ne;
    nx = ny = ne = 0;
    q.push(i);
    used[i] = true;
    while(!q.empty()) {
      int u = q.front(); q.pop();
      if(u <= yBase) {
        nx++;
      } else {
        ny++;
      }

      for(auto v: e[u]) {
        ne++;
        if(used[v]) continue;
        q.push(v);
        used[v] = true;
      }
    }
    if(nx >= 2 && ny >= 2) ans += nx * ny - ne/2;
  }

  cout << ans << endl;

  return 0;
}


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


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

///priority_queue< int, vector< int >, greater< int > > minHeap;

void mor(){cout<<"NO"; exit(0);}


int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;
    int n;
    scn(n);

    int a = n/100 , b = n%100;

    if((a>12 || a==0) && b<=12 && b>0)cout<<"YYMM";
    else if((b>12 || b==0) && a<=12 && a>0)cout<<"MMYY";
    else if(a>0 && b>0 && a<=12 && b<=12)cout<<"AMBIGUOUS";
    else cout<<"NA";

    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

    string st,sd;
    cin>>st;
    sd=st;
    int n;
    n=st.size();
    reverse(st.begin(),st.end());
    if(!n%2){cout<<"No";return 0;}
    for(int i=0;i<n;i++){
        if(st[i]=='b')st[i]='d';
        else if(st[i]=='d')st[i]='b';
        else if(st[i]=='p')st[i]='q';
        else if(st[i]=='q')st[i]='p';
    }
    if(st==sd)cout<<"Yes"; else cout<<"No";
        
    
    return 0;
}

Measured memory_bytes: 512
# ABC054C
# 方針：階乗の全探索

import itertools
N, M = map(int, input().split())
# Graph の作成
graph = [[] * N for _ in range(N)]
for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

# パターンの全列挙
num_lst = [_ for _ in range(0, N)]
search_list = itertools.permutations(num_lst)

ans = 0
for lst in search_list:
    flag = True
    if lst[0] != 0:    # 1度でも先頭が0以外ならそれ以降は全てダメ
        break
    for i in range(N-1):
        if lst[i+1] in graph[lst[i]]:   # 今の数字が次の数字と繋がっているかどうか
            pass
        else:
            flag = False
            break
    if flag:
        ans += 1

print(ans)

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

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

    for (int32_t i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);

    for (int32_t i = 0; i < n; i++) {
        x -= a[i];
        if (x < 0) {
            cout << i << endl;
            return 0;
        }
    }
    if (x == 0) {
        cout << n << endl;
    } else {
        cout << n - 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)

bool table[26];
int main() {
    string S;cin>>S;
    int N = S.size();
    REP(i,N) table[S[i]-'a'] = true;
    if(N < 26){
        cout << S;
        for(char c = 'a'; c <= 'z';++c){
            if(!table[c-'a']){
                cout << c << '\n';
                return 0;
            }
        }
    } else {
        for(int i=N-2;i>=0;--i){
            table[S[i+1]-'a'] = false;
            for(int c = 'a'; c <= 'z'; ++c){
                if(table[c-'a']) continue;
                if(c > S[i]){
                    cout << S.substr(0,i) << (char)c << '\n';
                    return 0;
                }
            }
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
class Main {
 
	//最大公約数・最小公倍数（セットで使う）
static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
static int lcm (int a, int b) {return a*b/gcd(a,b);}
   //整数かどうかを判定する
 static boolean isInteger(double number){return Math.ceil(number) == Math.floor(number); }

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 
		int n = sc.nextInt();
		int x = sc.nextInt();
		int t = sc.nextInt();

		int ans = 0;
		while(n > 0){
			n -= x;
			ans += t;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 35732
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,r) RFOR(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define lower(a,x) lower_bound(all(a), x) - a.begin();
#define COUNT(a,x)  upper_bound(all(a), x) - lower_bound(all(a), x);
#define MCOUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x);
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end());
#define scan(x) scanf("%lld",&x);
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 5555555555555555555;
const ll mod = 1000000007;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool ok, flag;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111


int main(void) {
  cin >> n;
  vll a(n + 2), b(n + 2);
  rep(i, n) {
	cin >> tmp;
	a[tmp] += n + i;
	b[tmp] += n + i;
  }
  rep(i, n) a[i + 1] += a[i];
  rrep(i, n) b[i] += b[i + 1];
  rep(i, n + 1) a[i] += i;
  rep(i, n + 1) a[i] += n - i + 1;
  rep(i, n) cout << a[i + 1] << " ";
  cout << endl;
  rep(i, n) cout << b[i + 1] << " ";
  cout << endl;

  return 0;
}

Measured memory_bytes: 896
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
B=[int(input()) for i in range(N)]
for i in range(3):
  for j in range(3):
    if A[i][j] in B:
      A[i][j]=0
for i in range(3):
  if A[i][0]+A[i][1]+A[i][2]==0 or A[0][i]+A[1][i]+A[2][i]==0:
    print('Yes')
    exit(0)
if A[0][0]+A[1][1]+A[2][2]==0 or A[0][2]+A[1][1]+A[2][0]==0:
    print('Yes')
    exit(0)
print('No')

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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  transform(a.begin(),a.end(),a.begin(), ::toupper);
  transform(b.begin(),b.end(),b.begin(), ::toupper);
  transform(c.begin(),c.end(),c.begin(), ::toupper);
  cout << a.at(0) << b.at(0) << c.at(0);
  cout << endl;
} 


Measured memory_bytes: 256
#include <stdio.h>

long long int getlcm(long long int,long long int);
long long int getgcd(long long int,long long int);

int main(void)
{
    int n;
    long long int lcm=1,num=0;
    scanf("%d",&n);
    while(n>0)
    {
        scanf("%lld",&num);
        lcm=getlcm(lcm,num);
        n--;
    }
    printf("%lld",lcm);
    return 0;
}

long long int getlcm(long long int a,long long int b)
{
    return a/getgcd(a,b)*b;
}

long long int getgcd(long long int m,long long int n)
{
    if(n==0) return m;
    return getgcd(n,m%n);
}



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

int main() {
	int x, y;
	while (1) {
		cin >> x >> y;
		if (x == 0 && y == 0) break;
		if (x > y)cout << y << " " << x << endl;
		else cout << x <<" "<< y << endl;

	}
	return 0;

}

Measured memory_bytes: 3048
#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;
const ll MOD = 998244353;

vector<vector<int>> divs(1010101, vector<int>{});
vector<vector<int>> A_div(1010101, vector<int>{});
ll sum_AiAj[1010101];
vector<int> a(202020);

ll mod_pow(ll x, ll n){
    ll ret = 1;
    while(n!=0){
        if(n & 1){
            ret = ret * x % MOD;
        }
        x = x * x % MOD;
        n = n >> 1;
    } 
    return ret;
}

int main() {
    int n; cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=1; i<1000001; i++){
        for(int j=1; i * j < 1000001; j++){
            divs[i * j].push_back(i);
        }
    }

    for(auto& v:a){
        for(auto& w:divs[v]){
            A_div[w].push_back(v);
        }
    }

    ll inv_mod2 = mod_pow(2, MOD-2);

    for(int i=0; i<1000001; i++){
        if((int)A_div[i].size() == 0){continue;}
        ll square_sum = 0;
        ll sum = 0;
        for(auto& v:A_div[i]){
            square_sum += 1LL * v * v;
            sum += v;
        }
        square_sum %= MOD;
        sum %= MOD;
        sum_AiAj[i] = (sum * sum - square_sum + MOD) % MOD;
        sum_AiAj[i] *= inv_mod2; 
        sum_AiAj[i] %= MOD;
    }

    ll ans = 0;
    for(int i=1000000; i>0; i--){
        ll val = sum_AiAj[i];
        for(int j=2; i * j<1000001; j++){
            val = (val - sum_AiAj[i*j] + MOD) % MOD;
        }
        sum_AiAj[i] = val;
        if(val == 0){continue;}
        ans += val * mod_pow(i, MOD-2);
        ans %= MOD;
    }
    cout << (ans + MOD) % MOD << endl;
    return 0;
}

Measured memory_bytes: 186632