akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    string s, t; cin >> s >> t;
    int len = t.size();

    vector<string> strings;
    rep(i, s.size()){
        if(i+len > s.size())break;
        string u = s; bool fg = true;
        rep(j, len){
            if(s[i+j] == t[j] || s[i+j] == '?') u[i+j] = t[j];
            else{
                fg = false; break;
                }
        }
        rep(j, u.size()){
            if(fg && u[j] == '?') u[j] = 'a'; 
        }
        if(fg) strings.push_back(u);
    }
    sort(all(strings));
    if(strings.empty()) cout << "UNRESTORABLE" << ln;
    else cout << strings[0] << ln;
}

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

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ALL(a) begin(a), end(a)
#define SZ(a) ((int)(a).size())

#define REP(a, b) for (int a = 0; a < (b); a++)
#define FOR(a, b, c) for (int a = (b); a <= (c); a++)
#define REPD(a, b) for (int a = (b) - 1; a >= 0; a--)
#define FORD(a, b, c) for (int a = (b); a >= (c); a--)

#define MIN(a, b) (a) = min((a), (b))
#define MAX(a, b) (a) = max((a), (b))

#ifdef __DEBUG
#define debug if (true)
#else
#define debug if (false)
#endif

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2> &p) {
  return is >> p.fi >> p.se;
}

const int N = 2e5 + 5;

const ll INF = LLONG_MAX / 2;

struct Node {
  ll mx, lazy;
};

Node tree[4 * N];

void push(int x, int l, int r) {
  if (tree[x].lazy == 0) {
    return;
  }
  tree[x].mx += tree[x].lazy;
  if (l != r) {
    tree[2 * x].lazy += tree[x].lazy;
    tree[2 * x + 1].lazy += tree[x].lazy;
  }
  tree[x].lazy = 0;
}

void update(int x, int l, int r, int ql, int qr, int delta) {
  push(x, l, r);
  if (l > qr || r < ql) return;
  if (l >= ql && r <= qr) {
    tree[x].lazy += delta;
    push(x, l, r);
    return;
  }
  int mid = (l + r) / 2;
  update(2 * x, l, mid, ql, qr, delta);
  update(2 * x + 1, mid + 1, r, ql, qr, delta);
  tree[x].mx = max(tree[2 * x].mx, tree[2 * x + 1].mx);
}

void update2(int x, int l, int r, int qp, ll value) {
  push(x, l, r);
  if (l > qp || r < qp) return;
  if (l == r) {
    debug assert(tree[x].lazy == 0);
    tree[x].mx = value;
    return;
  }
  int mid = (l + r) / 2;
  update2(2 * x, l, mid, qp, value);
  update2(2 * x + 1, mid + 1, r, qp, value);
  tree[x].mx = max(tree[2 * x].mx, tree[2 * x + 1].mx);
}

ll query(int x, int l, int r, int ql, int qr) {
  if (l > qr || r < ql) return -INF;
  push(x, l, r);
  if (l >= ql && r <= qr) return tree[x].mx;
  int mid = (l + r) / 2;
  return max(query(2 * x, l, mid, ql, qr),
             query(2 * x + 1, mid + 1, r, ql, qr));
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  V<pair<pii, int>> intervals(m);
  VV<int> start(n), finish(n);
  REP(i, m) {
    cin >> intervals[i];
    intervals[i].fi.fi--;
    intervals[i].fi.se--;
    start[intervals[i].fi.fi].pb(i);
    finish[intervals[i].fi.se].pb(i);
  }
  ll cur = 0;
  ll ans = 0;
  REP(i, n) {
    for (int j : start[i]) {
      cur += intervals[j].se;
    }
    ll q = max(0LL, query(1, 0, n - 1, 0, i));
    debug printf("%d: %lld\n", i, cur + q);
    MAX(ans, cur + q);
    update2(1, 0, n - 1, i, q);
    for (int j : finish[i]) {
      cur -= intervals[j].se;
      update(1, 0, n - 1, intervals[j].fi.fi, intervals[j].fi.se, intervals[j].se);
    }
  }
  assert(cur == 0);
  cout << ans << endl;
}


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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int n, m;
    cin >> n >> m;
    vector<int> v(n,0);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        v[a]++;
        v[b]++;
    }

    for(int i = 0; i < n; i++){
        cout << v[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3544
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int n = readint;
    int h = readint;
    int w = readint;

    int ans = (n - h + 1) * (n - w + 1);
    writeln(ans);
}


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

int main(){
    long long x;
    cin >> x;
    long long ans = 0;
    long double y = 100;
    long long z = y;
    while(z < x){
        y += z/100;
        z = y;
        ans++;
        //cout << z << " " << x <<  endl;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;
	public class Main{
	public static void main(String[] args) {
	Scanner sc= new Scanner(System.in);
	int w = sc.nextInt();
	int n = sc.nextInt();
	int[] values = new int[w];
	for(int i= 0;i<values.length;i++)
	{
		values[i]=i+1;
	}
	for(int i=0;i<n;i++)
	{
		String str= sc.next();
		String[] ab = str.split(",");
		int a = Integer.parseInt(ab[0])-1;
		int b = Integer.parseInt(ab[1])-1;
		int t=values[a];
		values[a]=values[b];
		values[b]=t;
	}
	for(int j= 0;j<values.length;j++)
	{
		System.out.println(values[j]);
	}
}

}

Measured memory_bytes: 26308
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >> h >> w;
  
  char data[h + 2][w + 2];
  
  for(int i = 0 ; i <= w + 1 ; i++){
    data[0][i] = '.';
    data[h + 1][i] = '.';
  }
  
  for(int i = 1 ; i <= h ; i++){
    data[i][0] = '.';
    data[i][w + 1] = '.';
    
    string temp;
    cin >> temp;
    
    for(int j = 1 ; j <= w ; j++){
      data[i][j] = temp.at(j - 1);
    }
  }
  
  for(int i = 1 ; i <= h ; i++){
    for(int j = 1 ; j <= w ; j++){
      if(data[i][j] == '.'){
        int cnt = 0;
        if(data[i-1][j-1] == '#')cnt++;
        if(data[i-1][j] == '#')cnt++;
        if(data[i-1][j+1] == '#')cnt++;
        if(data[i][j-1] == '#')cnt++;
        if(data[i][j+1] == '#')cnt++;
        if(data[i+1][j-1] == '#')cnt++;
        if(data[i+1][j] == '#')cnt++;
        if(data[i+1][j+1] == '#')cnt++;
        cout << cnt;
      }else{
        cout << '#';
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
 
int main(){
    int d, t, s; cin >> d >> t >> s;
    if(s*t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3636
import java.util.*;
class MyComp implements Comparator<Long> {

	public int compare(Long o1, Long o2) {
		if(o1 < o2) {
			return 1; 
		}
		else if(o1 > o2) {
			return -1;
		}
		return 0;
	}
	
}

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		Comparator<Long> c = new MyComp();
		PriorityQueue <Long> queJ= new PriorityQueue <Long> (11,c);
		while (true) {
			int n = stdIn.nextInt();
			if(n == 0) {
				break;
			}
			queJ.clear();
			Long sum = 0L;
			for(int i = 0; i < n; i++) {
				sum += stdIn.nextLong();
			}
			for(int i = 0; i < n-1; i++) {
				queJ.add(stdIn.nextLong());
			}
			Long max = 0L;
			for(int i = 0; i < n; i++) {
				if(max < sum *(n-i)) {
					max = sum * (n-i);
				}
				if(i < n - 1) {
					sum += queJ.poll();
				}
			}
			System.out.println(max);
			
			
		}
	}
}

Measured memory_bytes: 103872
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
  c = input()
  if(c=="AC"):
    ac += 1
  elif(c=="WA"):
    wa += 1
  elif(c=="TLE"):
    tle += 1
  elif(c=="RE"):
    re += 1

print("AC", "x", ac)
print("WA", "x", wa)
print("TLE", "x", tle)
print("RE", "x", re)

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

typedef long long ll;

using namespace std;

char ans[]={'A','B','C'};

int main() {
    char d[104]; int len;
    scanf("%d",&len);
    scanf("%s",d);
    int index=0, cnt=0;
    for (int i=0; i<len; i++) {
        if (d[i]==ans[0]) {
            index=1;
        }
        else if (d[i]==ans[1]) {
            if (index==1) index++;
            else index=0;
        }
        else if (d[i]==ans[2]) {
            if (index==2) {
                cnt++; index=0;
            }
            else index=0;
        }
        else index=0;
    }
    printf("%d",cnt);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

int main(){
  string Sd,T;
  cin >> Sd >> T;

  for(int i=Sd.size()-1-(T.size()-1);i>=0;i--){
    bool flag=true;
    for(int j=0;j<T.size();j++){
      if(Sd.at(i+j)=='?')  continue;
      else if(Sd.at(i+j)!=T.at(j)) flag=false;
    }
    if(flag){
      string S;
      for(int k=0;k<Sd.size();k++){
        if(k==i){
          S+=T;
          k+=T.size()-1;
        }
        else if(Sd.at(k)=='?'){
          S+="a";
        }
        else  S+=Sd.at(k);
      }
      cout << S << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;

  return 0;
}


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

int main()
{
    int N;
    int K;
    cin >> N;
    cin >> K;
    int arr[N];
    for(int i = 0; i < N; i++) 
        cin>>arr[i];
    
    long cost[N];

    for(int i=0; i<N; i++){
        cost[i] = 0;
    }
    cost[1] = abs(arr[1] - arr[0]);

    for(int i=2; i<N; i++)
    {   
        long temp_min = INT32_MAX;
        for(int j=1; j<=K; j++)
        {   
            if(i-j < 0) break;
            temp_min = min(temp_min, cost[i-j]+abs(arr[i] - arr[i-j]));
        }
        cost[i] =temp_min;
    }
    cout<<cost[N-1]<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll factorial[100002];
ll mod_factorial[100002];

ll pow(ll factor, ll q) {
  if (q == 1) {
    return factor % mod;
  }
  if (q % 2 == 0) {
    ll sub = pow(factor, q / 2);
    return ((sub % mod) * (sub % mod)) % mod;
  } else {
    return ((factor % mod) * (pow(factor, q - 1) % mod)) % mod;
  }
}
void init() {
  for (ll i = 0; i <= 100001; i++) {
    if (i == 0 || i == 1) {
      factorial[i] = 1;
    } else {
      factorial[i] = ((i % mod) * (factorial[i - 1] % mod)) % mod;
    }
  }
  for (ll i = 0; i <= 100001; i++) {
    if (i == 0 || i == 1) {
      mod_factorial[i] = 1;
    } else {
      mod_factorial[i] = pow(factorial[i], mod -2 ) % mod;
    }
  }
}
ll C(ll n, ll k) {
  if (n < k) {
    return 0;
  }
  ll sub = ((factorial[n] % mod) * (mod_factorial[k] % mod)) % mod;
  return ((sub % mod) * (mod_factorial[n - k] % mod)) % mod;
}

int main() {
  init();

  ll n;
  cin >> n;

  set<ll> box;
  ll second = 0;
  ll first;

  ll a[n + 1];
  for (ll i = 0; i <= n; i++) {
    ll sub;
    cin >> sub;
    if (box.count(sub)) {
      second = i;
    }
    box.insert(sub);
    a[i] = sub;
  }
  for (ll i = 0; i <= n; i++) {
    if (a[i] == a[second]) {
      first = i;
      break;
    }
  }

  for (ll i = 1; i <= n + 1; i ++) {
    if (i == 1) {
      cout << n << endl;
    } else {
      if (i == n + 1) {
        cout << 1 << endl;
      } else {
        ll sub = (C(n + 1, i) % mod + mod - C(first + n - second, i - 1) % mod) % mod;
        cout << sub << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 8192
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(string &a){reverse(a.begin(),a.end()) ;}



int main(){
	ll n ; cin >> n ;
	ll x = 0,y = 0,t = 0 ;
	for(int i=0;i<n;i++){
		ll a,b,c ;
		cin >> a >> b >> c ;
		t = sa(t,a) ;
		x = sa(x,b) ;
		y = sa(y,c) ;
		if(x+y>t||(t-x-y)&1){
			yorn(0) ;
			return 0 ;
		}
		t = a ;
		x = b ;
		y = c ;
	}
	yorn(1) ;
}


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

signed main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M);
    for (int& x : a) cin >> x;

    const int mod = 1e9+7;
    vector<int> dp(N + 5);
    dp[0] = 1;
    for (int x : a) dp[x] = -1;
    for (int i = 0; i < N; i++) {
        if (dp[i] < 0) continue;
        for (int k = 1; k <= 2; k++) {
            if (dp[i + k] < 0) continue;
            (dp[i + k] += dp[i]) %= mod;
        }
    }
    cout << dp[N] << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    ll x; cin >> x;
    ll ans = 0;
    ans += (x/500)*1000; x%=500;
    ans += x-(x%5);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define at(x,i) get<i>(x);
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    while(true){
    ll n,w,h;cin >> n >>w >>h;
    if(n==0&&w==0&&h==0)break;
    vector<pl> v;
    v.pb(mp(w,h));
    rep(i,n){
        ll p,s;cin >> p >>s;p--;
        w=v[p].fi;h=v[p].se;
        v.erase(v.begin()+p);
        s%=2*(w+h);
        ll nw1,nh1,nw2,nh2;
        if(s<w+w+h+h){
            nw1=w;nw2=w;nh1=s-w-w-h;nh2=h-nh1;
        }
        if(s<w+w+h){
            nw1=s-w-h;nw2=w-nw1;nh1=h;nh2=h;
        }
        if(s<w+h){
            nw1=w;nw2=w;nh1=s-w;nh2=h-nh1;
        }
        if(s<w){
            nw1=s;nw2=w-s;nh1=h;nh2=h;
        }
        if(nh1*nw1>nh2*nw2){
            swap(nh1,nh2);swap(nw1,nw2);
        }
        v.pb(mp(nw1,nh1));v.pb(mp(nw2,nh2));
    }
    vl ans;
    rep(i,v.size())ans.pb(v[i].fi*v[i].se);
    sort(all(ans));
    rep(i,ans.size()){
        if(i)cout << " ";
        cout << ans[i];
    }
    cout << endl;
    }
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef pair<ut,ut> prs;
const int SIZE=2005;
const LL p=7+1e9;
const LL INF=1<<30;
const LL INFLL=1LL<<30;
inline void IN(ut &x){cin >> x;}
inline void INA(ut n,ut x[]){REP(i,n) cin >> x[i];}
inline void INE(ut m,VI edges[]){
	ut a,b;
	REP(i,m){
		cin >> a >> b;
		edges[a].PB(b);
		edges[b].PB(a);
	}
}
inline void INEC(ut m,Vpr edges[]){
	ut a,b,c;
	REP(i,m){
		cin >> a >> b >> c;
		edges[a].PB(pr(c,b));
		edges[b].PB(pr(c,a));
	}
}
int main(){
	LL N,sum=0,x;
	LL minium=INF;
	cin >> N;
	REP(i,N) {
		cin >> x;
		if(x%10) minium=min(x,minium);
		sum+=x;
	}
	if(minium==INF) cout << 0 << endl;
	else if(sum%10==0) cout << sum-minium << endl;
	else cout << sum << endl;
	return 0;
}

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


/*  
    
*/

void test_case(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll res = -1e18 - 10;
    if( a <= 0 && b >= 0)
        res = 0;
    if( c <= 0 && d >= 0)
        res = 0;
    cout<< max({a*c,b*d,a*d,b*c,res})<<endl;
}

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

    int t; t = 1;
    //~ cin >> t;
    while(t--)
        test_case();
    return 0;
}


Measured memory_bytes: 3616
#include <iostream> 
#include <cstdlib>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 

int main() {
    int H, W;
    cin >> H >> W;
    
    string s[H];
    for (int i = 0; i < H; i++) {
        cin >> s[i];
    }
    
    for (int i = 0; i < W+2; i++) {
        cout << "#";
    }
    cout << endl;
    for (int i = 0; i < H; i++) {
        cout << "#" << s[i] << "#" << endl;
    }
    for (int i = 0; i < W+2; i++) {
        cout << "#";
    }
    cout << endl;
}



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

int main(){
  int n;
  cin >> n;
  int a[n];
  REP(i, n) cin >> a[i];
  int b[n];
  
  REP(i, n){
    b[a[i]-1] = i+1;
  }
  REP(i, n) cout << b[i] << ' ';
  
  return 0;
}

Measured memory_bytes: 1536
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut l: usize = iterator.next().unwrap().parse().unwrap();
    for _ in 0..(n - 1) {
        let t: usize = iterator.next().unwrap().parse().unwrap();
        l = l / gcd(l, t) * t;
    }
    return l.to_string();
}

fn gcd(mut p: usize, mut q: usize) -> usize {
    while q != 0 {
        let r = p % q;
        p = q;
        q = r;
    }
    return p;
}


Measured memory_bytes: 4352
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((ll)2e6+5)
#define MOD ((ll)1e9 + 7)
#define INF ((ll)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<ll,ll>
#define mid ((l+r)/2)
ll a,b;
ll ans = 1;
ll sieve[MAXN];
void setup()
{
	sieve[1] =  1;
	for (ll i = 2; i < MAXN; ++i)
		if(sieve[i]==0)
			for (ll j = 2*i; j < MAXN; j+=i)
				sieve[j] = 1;
}
ll gcd(ll a, ll b){return (a == 0) ? b : gcd(b%a, a);}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> a >> b;
	setup();
	ll gc = gcd(a,b);

	for (ll i = 2; i*i <= gc; ++i)
		if(sieve[i]==0 && gc%i==0)
		{
			ans++;
			while(gc%i==0) gc/=i;
		}
	if(gc > 1)
		ans++;

	cout << ans << endl;

}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

const int MAX=4100000;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    ll sum=0;
    rep(i,N){
        cin >> A[i];
        sum+=A[i];
    }
    bitset<MAX> bit(1);
    rep(i,N){
        bit|=(bit<<A[i]);
    }
    rep2(i,(sum+1)/2,MAX){
        if (bit.test(i)){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1792
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.next()

  var sum = 0L
  for (c in n) {
    val tmp = c.toInt() - '0'.toInt()
    sum += tmp.toLong()
  }
  
  if (sum % 9 == 0L) {
    println("Yes")
    return
  }
  println("No")


}


Measured memory_bytes: 41092
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		private const int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			//System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start();
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string str = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];
			int k = vs[2];

			int[,] count = new int[n, 2];
			UnionFind friends = new UnionFind(n);
			for (int i = 0; i < m; i++) {
				vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
				int a = vs[0] - 1;
				int b = vs[1] - 1;
				count[a, 0]++;
				count[b, 0]++;
				friends.Unite(a, b);
			}
			for (int i = 0; i < k; i++) {
				vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
				int c = vs[0] - 1;
				int d = vs[1] - 1;
				if (friends.Same(c, d)) {
					count[c, 1]++;
					count[d, 1]++;
				}
			}
			//System.Diagnostics.Debug.WriteLine($"0:{count[0]}, {friends.Size(0)} { (blocks.ContainsKey(0) ? blocks[0].Count : 0) } ");
			for (int i = 0; i < n; i++) {
				int g = friends.Size(i);
				int f = count[i, 0];
				int b = count[i, 1];
				Console.Write($"{g - f - b - 1} ");
			}
			Console.WriteLine();


			Console.Out.Flush();
			//System.Diagnostics.Debug.WriteLine(stopwatch.Elapsed);
		}
	}

	#region Union-Find木 UnionFind
	public class UnionFind
	{
		private readonly UnionFindNode[] _Parent;

		/// <summary>
		/// Union-Find木
		/// </summary>
		/// <param name="n">サイズ</param>
		public UnionFind(int n)
		{
			_Parent = new UnionFindNode[n];
			for (int i = 0; i < n; i++) {
				_Parent[i] = new UnionFindNode(i, 1);
			}
		}

		public int Find(int x)
		{
			if (_Parent[x].Parent == x) {
				return _Parent[x].Parent;
			}
			return _Parent[x].Parent = Find(_Parent[x].Parent);
		}

		public int Size(int x)
		{
			return _Parent[Find(x)].Size;
		}

		/// <summary>
		/// xとyの木を併合
		/// </summary>
		/// <param name="x"></param>
		/// <param name="y"></param>
		public void Unite(int x, int y)
		{
			int rx = Find(x);
			int ry = Find(y);
			if (rx != ry) {
				_Parent[ry].Parent = rx;
				_Parent[rx].Size += _Parent[ry].Size;
			}
		}

		/// <summary>
		/// x, yが同じ木に属している
		/// </summary>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <returns></returns>
		public bool Same(int x, int y)
		{
			int rx = Find(x);
			int ry = Find(y);
			return rx == ry;
		}

		public override string ToString()
		{
			return string.Join(" ", _Parent.Select(p => $"({p.Parent},{p.Size})"));
		}
	}
	public class UnionFindNode
	{
		public int Parent;
		public int Size;
		public UnionFindNode(int parent, int size)
		{
			Parent = parent;
			Size = size;
		}
	}
	#endregion

}


Measured memory_bytes: 23564
//QWsin
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)

using namespace std;

const int INF=1<<30;

const int maxn=500+10;

int mx[maxn][maxn];

struct Node{
	int a,b,c,d;	
	Node(int a=0,int b=0,int c=0,int d=0):a(a),b(b),c(c),d(d){}
	inline void output(){printf("%d %d %d %d\n",a,b,c,d);}
};

vector<Node>vc;

inline void output(int a,int b,int c,int d){
	vc.push_back(Node(a,b,c,d));
	--mx[a][b];++mx[c][d];
}

int main()
{
	int n,m;cin>>n>>m;
	rep(i,1,n) rep(j,1,m) scanf("%d",mx[i]+j);
	rep(i,1,n) rep(j,1,m){
		if(mx[i][j]&1)	
		{
			if(j<m)output(i,j,i,j+1);	
			else if(i<n) output(i,j,i+1,j);
		}
	}
	
	cout<<vc.size()<<endl;
	repvc(i,vc) vc[i].output();
	return 0;
}


Measured memory_bytes: 5232
n=int(input())
a=list(map(int,input().split()))
d={}
l=[]
ll=[]
for i in range(len(a)):
    d[a[i]]=d.get(a[i],0)+1
for i in d.keys():
    if d[i]>=2:
        l.append(i)
    if d[i]>=4:
        ll.append(i)

l.sort(reverse=True)
ll.sort(reverse=True)
if len(l)>=2 and len(ll)>=1:
    print(max(l[0]*l[1],ll[0]**2))
elif len(l)>=2:
    print(l[0]*l[1])
elif len(ll)>=1:
    print(ll[0]**2)
else:
    print(0)


Measured memory_bytes: 68760
n,m,l = gets.split.map(&:to_i)
b = readlines.map{|i| i.chomp.split.map(&:to_i)}
a = b.slice!(0,n)
n.times do |i|
  l.times do |j|
    print ' ' if (j != 0)
    c = 0
    m.times do |k|
      c += a[i][k]*b[k][j]
    end
    print c
  end
  puts
end

Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N(0), A(0);
  cin >> N >> A;
 
  if( N % 500 <= A )
  {
   	 cout << "Yes" << endl;
  }
  else
  {
   	cout << "No" << endl; 
  }
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n ;
    cin >>n ;
    if(n%2==0){
        cout << n <<endl ;
    }
    else{
        cout << 2*n <<endl ;
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define RREP(i, a, b) for (int i = (a); i >= (b); --i)

using namespace std;
using ll = long long;

ll solve_1 (int N, int P, vector<int> S) {
  ll cnt = 0;

  RREP(i, N - 1, 0)
    if (S[i] % P == 0) cnt += i + 1;

  return cnt;
}

ll solve_2 (int N, int P, vector<int> S) {
  ll cnt = 0;
  vector<int> table(P, 0);
  int U_i = 0;
  int ten = 1;

  // 2.
  // この1は、U_i自体が（つまりiから最右端までの列が）割り切れる場合をカウントするために使われる。
  table[0] = 1;

  RREP(i, N - 1, 0) {
    U_i = (U_i + S[i] * ten) % P;

    // 1.
    // table[U_i]には（具体的なjがどこかという情報は落ちているものの）U_{j+1} ≡ U_i であるようなjの個数が保存されている。
    // そのようなjを右端、iを左端とする列はPで割り切れる。
    // なぜならば、 U_{j+1} ≡ U_i より U - U_{j+1} はPで割り切れるため、解説PDFのいう条件が成り立つからである。
    cnt += table[U_i];

    table[U_i]++;
    ten = (ten * 10) % P;
  }

  return cnt;
}

/**
 * main
 */
int main () {
  int N, P; cin >> N >> P;
  string S_; cin >> S_;

  vector<int> S(N);
  REP(i, 0, N) S[i] = (S_[i] - '0') % P;

  cout << ((P == 2 || P == 5) ? solve_1(N, P, S) : solve_2(N, P, S))
       << '\n';
}


Measured memory_bytes: 2180
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

fn main() {
    let k: usize = read();

    let mut memo: Vec<Vec<i64>> = vec![vec![1; k + 1]; k + 1];
    let mut ans = 0;

    for i in 0..k + 1 {
        for j in 0..k + 1 {
            memo[i][j] = gcd(i as i64, j as i64)
        }
    }

    for a in 1..k + 1 {
        for b in 1..k + 1 {
            for c in 1..k + 1 {
                let d = memo[a][b];
                ans += memo[d as usize][c];
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2428
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n; cin >> n;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin >> h[i];
    int count=0;
    int max=0;
    for(int i=0; i<n-1; i++){
        if(h[i]>=h[i+1]) count+=1;
        if(h[i]<h[i+1]) count=0;
        if(max<count) max=count;
    }
    cout << max <<endl;
    return 0;
}


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

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

    long long num = 0;
    for(int i=0; i<n-1; i++){
        num += 1 + num/(k - 1);
    }
    cout << num << endl;
  
  return 0;
}

Measured memory_bytes: 3096
N = int(input())
List = [0]
count = 1
for i in range(N):
    List.append(int(input()))
List.pop(0)
List.sort()
i = 1
for j in range(N - 1):
    if List[i] != List[i - 1]: count += 1
    i += 1
print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)

const int MAX = 1000000;
// graph //
int V,E,from,to,weight;

struct Edge{
    int to,cost;
    Edge(int to,int cost) : to(to),cost(cost){}
};

vector<vector<Edge> > G;

pair<int,int> dist(int v,int pv){
    pair<int,int> ret(0,v); // dist & index
    for(auto e : G[v]){
        if(e.to==pv) continue;
        auto tmp = dist(e.to,v); // dist returns 
        tmp.first += e.cost;
        if(tmp.first > ret.first) ret = tmp;
    }
    // vから辿れる最大距離が返る
    return ret;
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> V;
    G.resize(V);
    REP(i,V-1){
        cin >> from >> to >> weight;
        G[from].emplace_back(to,weight);
        G[to].emplace_back(from,weight);
    }

    auto a = dist(0,-1);
    auto b = dist(a.second,-1);
    cout << b.first << '\n';
    return 0;
}


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

int main(){
	string b;
	
	cin >> b;

	string out;
	if (b == "A")
		out = "T";
	else if (b == "T")
		out = "A";
	else if (b == "C")
		out = "G";
	else if (b == "G")
		out = "C";
	cout << out;
	return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

const int G = 5;
const int MD = 924844033;
const int MN = 200010;
const int MB = 19;
int n;
V<int> g[MN];
int cnt[MN];
int rev[1<<MB], fac[MN], ifac[MN];

int pow_mod(int x, int n) {
    int r = 1;
    while (n) {
        if (n&1) r = ll(r)*x%MD;
        x = ll(x)*x%MD;
        n >>= 1;
    }
    return r;
}

int dfs(int v, int p) {
    int sz = 1;
    for (auto &u : g[v]) {
        if (u == p) continue;
        int csz = dfs(u, v);
        sz += csz;
        cnt[csz]++;
    }
    cnt[n-sz]++;
    return sz;
}

void first() {
    fac[0] = 1;
    for (int i = 1; i < MN; i++) fac[i] = ll(i) * fac[i-1] % MD;
    for (int i = 0; i < MN; i++) ifac[i] = pow_mod(fac[i], MD-2);
    for (int i = 0; i < (1<<MB); i++) {
        rev[i] = (rev[i>>1]>>1)|((i&1)<<(MB-1));
    }
}

void ntt(V<int> &a) {
    int n = int(a.size());
    int s = MB - __builtin_ctz(n);
    for (int i = 0; i < n; i++) {
        int r = rev[i]>>s;
        if (i < r) swap(a[i], a[r]);
    }

    V<int> roots(n/2);
    roots[0] = 1;
    for (int k = 1; k < n; k *= 2) {
        ll r = pow_mod(G, (MD-1)/(2*k));
        for (int i = 0; i < k-1; i++) {
            roots[i+1] = r*roots[i]%MD;
        }
        for (int i = 0; i < n; i += 2*k) {
            for (int j = 0; j < k; j++) {
                int l = a[i+j];
                int r = ll(a[i+j+k]) * roots[j] % MD;
                a[i+j] = (l+r)%MD;
                a[i+j+k] = (l-r+MD)%MD;
            }
        }
    }
}

V<int> pmul(V<int> a, V<int> b) {
    int A = int(a.size()), B = int(b.size());
    int n = 1;
    while (n < A+B-1) n *= 2;
    a.resize(n); ntt(a);
    b.resize(n); ntt(b);
    ll in = pow_mod(n, MD-2);
    for (int i = 0; i < n; i++) {
        a[i] = in * a[i] % MD * b[i] % MD;
    }
    reverse(a.begin()+1, a.end());
    ntt(a); a.resize(A+B-1);
    return a;
}

int C(int x, int y) {
    if (x < y || x < 0 || y < 0) return 0;
    return ll(fac[x]) * ifac[y] % MD * ifac[x-y] % MD;
}

int main() {
    first();
    scanf("%d", &n);
    for (int i = 0; i < n-1; i++) {
        int a, b;
        scanf("%d %d", &a, &b); a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(0, -1);

    V<int> x(n+1), y(n+1);
    for (int i = 0; i <= n; i++) {
        x[i] = ll(fac[i])*cnt[i]%MD;
    }
    for (int i = 0; i <= n; i++) {
        y[i] = ifac[n-i];
    }
    x = pmul(x, y);

    for (int i = 1; i <= n; i++) {
        int ans = ll(n) * C(n, i) % MD - ll(x[n+i]) * ifac[i] % MD;
        if (ans < 0) ans += MD;
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 30180
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int dp[33][33][33][33];
int dp2[33][33][33][33];
int tb[32][32];
int sum[33][33];

pair<int,int> mg(pair<int,int> l,pair<int,int> r){
  return make_pair(l.first+r.first,min(l.second,r.second));
}

pair<int,int> dfs(int t,int l, int b, int r, int nd) {
  if(dp[t][l][b][r] >= 0) return make_pair(dp[t][l][b][r], dp2[t][l][b][r]);
  int sm = sum[b][r] - sum[t][r] - sum[b][l] + sum[t][l];
  if (sm >= nd) {
    pair<int,int> res(1,sm-nd);
    for(int i=t+1;i<b;++i){
      auto fst = dfs(t,l,i,r,nd);
      auto snd = dfs(i,l,b,r,nd);
      if(fst.first==0||snd.first==0)continue;
      res=max(res,mg(fst,snd));
    }
    for(int i=l+1;i<r;++i){
      auto fst = dfs(t,l,b,i,nd);
      auto snd = dfs(t,i,b,r,nd);
      if(fst.first==0||snd.first==0)continue;
      res=max(res,mg(fst,snd));
    }
    dp[t][l][b][r] = res.first;
    dp2[t][l][b][r] = res.second;
    return res;
  } else {
    dp[t][l][b][r] = 0;
    dp2[t][l][b][r] = 0;
    return make_pair(0,0);
  }
}

int main() {
  while(1){
    int h,w,s;
    cin>>h>>w>>s;
    if(!h)break;
    REP(i,h+1)REP(j,w+1)REP(k,h+1)REP(l,w+1){
      dp[i][j][k][l]=-1;
      dp2[i][j][k][l]=-1;
    }
    REP(i,h)REP(j,w)cin>>tb[i][j];
    int sm=0;
    REP(i,h)REP(j,w)sm+=tb[i][j];
    int nd=sm-s;
    REP(i,w+1)sum[0][i]=0;
    REP(i,h){
      sum[i+1][0]=0;
      REP(j,w){
        sum[i+1][j+1]=tb[i][j]+sum[i][j+1]+sum[i+1][j]-sum[i][j];
      }
    }
    auto res = dfs(0,0,h,w,nd);
    cout << res.first << ' ' << res.second << endl;
  }
  return 0;
}

Measured memory_bytes: 10440
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    map<ll, ll> cnt;
    rep(i, n){
        ll d; cin >> d;
        cnt[d]++;
    }
    ll m; cin >> m;
    bool ans = true;
    rep(i, m){
        ll t; cin >> t;
        cnt[t] >= 1 ? cnt[t]-- : ans = false;
        if(!ans) break;
    }
    ans ? YES() : NO();
}

Measured memory_bytes: 16032
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    vector<int> x(3);
    for(int i=0; i<3; i++){
        cin >> x.at(i);
    }
    sort(x.begin(), x.end());
    int cnt = 0;
    cnt+=x.at(2)-x.at(1);
    if((x.at(2)-(x.at(0)+cnt))%2==1){
        cnt+=(x.at(2)-(x.at(0)+cnt))/2+2;
    }else{
        cnt+=(x.at(2)-(x.at(0)+cnt))/2;
    }
    cout << cnt << endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n;
ll t, ans = 1;

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

ll lcm(ll a, ll b) {
	return a / gcd(a,b) * b;
}

int main() {
	cin >> n;
	rep(i,n) {
		cin >> t;
		ans = lcm(ans, t);
	}
	cout << ans << ln;
}

Measured memory_bytes: 256
fn main() {
    let (a, b, c): (i64, i64, i64) = (read(), read(), read());
    if c - a - b > 0 && 4 * a * b < (c - a - b).pow(2) {
        println!("Yes");
    } else {
        println!("No");
    }
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 4352
#include<stdio.h>
#include<cmath>
//#include<algorithm>
int main()
{
    int n,tmp,count=0,limit;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&tmp);
        limit=sqrt(tmp);
        for(int j=2;j<=limit;j++)
        {
            if(tmp%j==0)
            {
                count++;
                break;
            }
        }
    }
    printf("%d\n",n-count);
}


Measured memory_bytes: 2720
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

struct qwq{
	int id;
	int have;
}a[100005];
int n;

inline bool cmp(qwq x,qwq y){
	return x.have<y.have;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		a[i].id=i;
		scanf("%d",&a[i].have);
	}
	stable_sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++){
		printf("%d ",a[i].id);
	}
	return 0;
}

Measured memory_bytes: 1656
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

vector<ll> primes;
void make_primes(){
    primes.pb(2);
    for(ll n = 3; n <= 2200; n++){ // 2200^3 > 10^10
        bool isPrime = true;
        for(ll i = 0; primes[i] * primes[i] <= n && i < primes.size(); i++){
            if(n % primes[i] == 0) {
                isPrime = false;
                break;
            }
        }
        if(isPrime) primes.pb(n);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    make_primes();
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) {
        cin >> A[i];
        for(ll prime: primes){
            while(1){
                if(A[i] % (prime * prime * prime) == 0){
                    A[i] /= prime * prime * prime;
                }
                else{
                    break;
                }
            }
        }
    }
    sort(all(A));
    vector<pair<ll, int>> C;
    map<ll, int> M;
    ll num = -1;
    rep(i, N){
        if (num == A[i]){
            C.back().second++;
        }
        else{
            C.pb(mp(A[i], 1));
            M[A[i]] = (int)C.size(); // index + 1
        }
        num = A[i];
    }
    
    vector<int> vis(C.size(), 0); // チェックしたか
    int ret = 0;
    
    // a*b^2 and a^2*b
    rep(i, C.size()){
        if(vis[i] > 0) continue;
        ll a = C[i].first;
        ll b = 1;
        for(ll prime: primes){
            if(a % (prime * prime) == 0){
                a /= (prime * prime);
                b *= prime;
            }
        }
        if(a == 1) continue;
        if(M[a * a * b] > 0){
            ret += max(C[i].second, C[M[a * a * b] - 1].second);
            vis[i] = 1, vis[M[a * a * b] - 1] = 1;
        }
        else{
            ret += C[i].second;
            vis[i] = 1;
        }
    }
    
    // a and a^2
    rep(i, C.size()){
        if(C[i].first > 100000) break; // (10^5)^2=10^10
        if(vis[i] > 0 || C[i].first == 1) continue;
        ll a = C[i].first;
        ll b = a * a;
        if(M[b] > 0){
            ret += max(C[i].second, C[M[b] - 1].second);
            vis[i] = 1, vis[M[b] - 1] = 1;
        }
        else{
            ret += C[i].second;
            vis[i] = 1;
        }
    }
    
    rep(i, C.size()){
        if(vis[i] == 0){
            if(C[i].first == 1) ret++;
            else ret += C[i].second;
        }
    }
    
    output(ret, 0);
    
    return 0;
}

Measured memory_bytes: 15472
#include <stdio.h>

int main() {
  int number_of_cakes, number_of_donuts, money;
  scanf("%d", &money);
  for(number_of_cakes = 0; number_of_cakes * 4 <= money; number_of_cakes++) {
    for(number_of_donuts = 0; number_of_donuts * 7 + number_of_cakes * 4 <= money; number_of_donuts++) {
      if(number_of_donuts * 7 + number_of_cakes * 4 == money) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL-1
double EPS=1e-9;
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef complex<double> P;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
long long int MOD=1000000007;
int n;
int h,w;
map<pii,int> hoge;
ll ans[10]={0};
int main(){
	cin>>h>>w>>n;
	int x,y;
	//vector<pii> a(n);
	for(int i=0;i<n;i++){
		cin>>x>>y;x--,y--;
		for(int k=max(0,x-2);k<=min(x,h-3);k++){
			for(int j=max(0,y-2);j<=min(y,w-3);j++){
				hoge[mp(k,j)]++;
			}
		}
	}
	map<pii,int>::iterator itr=hoge.begin();
	ll sum=0;
	while(itr!=hoge.end()){
		int fuga=(*itr).second;
		ans[fuga]++;
		sum++;
		++itr;
	}
	ans[0]=(ll)(h-2)*(ll)(w-2)-sum;
	rep(i,10)cout<<ans[i]<<endl;
	
}

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

#define int long long
#define REP(i, n) for ( int i = 0; i < (n); i++ )

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

  string s;
  cin >> s;

  for ( int i = 0; i < (int)s.size(); i++ ) {
    cout << 'x';
  }

  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256