akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <numeric>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
typedef long long ll;

vector<int> line_to_array(istream& is, const int cnt, const char sep);
vector<string> split(const string &str, const char sep);
string trim(const string& str, const char* trimCharacterList  = " \t\v\r\n");
bool chk_rcsv(int j, int k, char** t, bool** chk_t, string str, int pos);

int N,M;
bool visit[9];
bool path[9][9];

int p_cnt = 0;
int v_cnt = 0;

int traverse(int pos){
    int rtn = 0;
    //未訪問の時
    if(!visit[pos]){
        //現在位置を訪問済とする
        visit[pos] = true;
        v_cnt++;
        
        //すべて訪問済みなので戻り値1を設定する
        if(v_cnt == N){
            rtn = 1;
        }
        //まだ訪問していない場所があるので再帰的に調べる
        else{
            FOR(i, 1, 8){
                if(path[pos][i]){
                    rtn += traverse(i);
                }
            }
        }
        
        //現在位置を訪問未済とする
        v_cnt--;
        visit[pos] = false;
    }
    return rtn;
}

int solve(){
    return traverse(1);
}


int main(){
    //ifstream cin("inputAB54_C.txt");
    REP(i, 9){
        REP(j, 9){
            path[i][j] = false;
        }
        visit[i] = false;
    }
    cin >> N >> M;
    
    REP(i, M){
        int a,b;
        cin >> a >> b;
        path[a][b] = true;
        path[b][a] = true;
    }
    
    int output = solve();
    cout << output << endl;
    
    return 0;
}

vector<int> line_to_array(istream& is, const int cnt, const char sep){
    vector<int> v;
    string str;
    getline(is, str);
    vector<string> words = split(str, sep);
    for (int i=0; i < cnt; i++) {
        v.push_back( atoi(words[i].c_str()) );
    }
    return v;
}

vector<string> split(const string &str, const char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ){
        v.push_back(buffer);
    }
    return v;
}

string trim(const string& str, const char* trimCharacterList)
{
    string result;
    string::size_type left = str.find_first_not_of(trimCharacterList);
    
    if (left != string::npos)
    {
        string::size_type right = str.find_last_not_of(trimCharacterList);
        result = str.substr(left, right - left + 1);
    }
    return result;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

void get() {}

template <class Head, class... Tail>
void get(Head& head, Tail&... tail) {
  cin >> head;
  get(tail...);
}

template <class T>
void getv(vector<T>& vec) {
  for (int i = 0; i < vec.size(); ++i)
    cin >> vec[i];
}

int main() {
	string s;
	int K;
  get(s,K);
  priority_queue<pair<string,int>,vector<pair<string,int>>,greater<pair<string,int>>> q;
  FOR(i,s.size()){
    q.push(pair<string,int>(s.substr(i,1),i));
  }
  set<string> list;
  while(1){
    pair<string,int> p=q.top();
    q.pop();
    string str=p.first;
    int pos=p.second;
    if(!list.count(str)){
      list.insert(str);
      K--;
    }
    if(K==0){
      print(str);
      break;
    }else{
      if(pos+str.size()<s.size()){
        q.push(pair<string,int>(s.substr(pos,str.size()+1),pos));
      }
    }
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll k, a, b, ans = 0;
  cin >> k >> a >> b;

  if (a >= b - 1) {
    ans = k + 1;
  } else {
    ans = (k - a + 1) / 2 * (b - a) + a + (k - a + 1) % 2;
  }

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {
			int x = sc.nextInt();
			if(x == 2) {
				System.out.println(2);
				return;
			}
			for(int i = x ; true ; i++) {
				int max = i / 2 + 1;
				int j = 2;
				for(; j <= max ; j++) {
					if(i % j == 0) {
						break;
					}
				}
				if(j == max + 1) {
					System.out.println(i);
					break;
				}
			}

		}

	}

}


Measured memory_bytes: 22740
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;


public class Prog
{
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    public static void Solve()
    {
        int N = NextInt();
        int[] A = LineInt();
        int[] MAX = new int[N];
        int min = A[0];
        int ans = 0;
        for (int i = 0; i < N; i++)
        {
            if (A[i] <= min) ans++;
            min = Math.Min(min, A[i]);
        }
        Console.WriteLine(ans);
    }
    public static long GCD(long a, long b)
    {
        if (a < b) GCD(b, a);
        long d = a % b;
        while (b != 0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }
    public static long LCM(long a, long b)
    {
        return a / GCD(a, b) * b;
    }

    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 33884
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
ll X,Y,Z,N;
typedef struct hito{
	ll a,b;
	bool operator<(const hito&key)const{
		ll vl=this->a-this->b;
		ll vr=key.a-key.b;
		return vl>vr;
	}
}hito;
ll kin[100010],gin[100010];
int main(){
	cin>>X>>Y>>Z;
	N=X+Y+Z;
	vector<hito> v;
	ll base=0;
	rep(i,N){
		ll a,b,c;
		cin>>a>>b>>c;
		base+=c;
		a-=c,b-=c;
		v.push_back((hito){a,b});
	}
	sort(all(v));
	priority_queue<ll,vector<ll>,greater<ll> > PQ;
	ll sum=0;
	rep(i,N){
		PQ.push(v[i].a);
		sum+=v[i].a;
		if(PQ.size()>X){
			sum-=PQ.top();
			PQ.pop();
		}
		kin[i]=sum;
	} 
	while(!PQ.empty())PQ.pop();
	sum=0;
	for(int i=N-1;i>=0;i--){
		PQ.push(v[i].b);
		sum+=v[i].b;
		if(PQ.size()>Y){
			sum-=PQ.top();
			PQ.pop();
		}
		gin[i]=sum;
	}
	ll ans=-1e17;
	for(int i=X-1;i<=N-Y-1;i++){
		chmax(ans,kin[i]+gin[i+1]);
	}
	ans+=base;
	cout<<ans<<endl;
}





Measured memory_bytes: 5104
#include<iostream>
#include<stdio.h>
int main(){
	
	int n,i,a,b,okane=100000;

    std::cin>>n;
	for(i=0;i<n;i++){	
		okane=okane*1.05;
		if(okane%1000!=0){
			a=okane%1000;
			b=1000-a;
			okane=okane+b;
			}

		}
    std::cout<<okane<<std::endl;

	return 0;
}

Measured memory_bytes: 1160
//https://www.cnblogs.com/TetrisCandy/p/ABC169.html
//质因数分解 
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxx=1000010;

bool tot[maxx];
ll cnt,phi[maxx],num[maxx];

void print(){//质因数分解 
	for(ll i=2;i<=1000000;i++){
		if(tot[i])continue;
		phi[++cnt]=i;//记录质数 
		for(ll j=2;j<=1000000/i;j++)
		tot[i*j]=1;
	}
}

signed main()
{
	ll n;cin>>n;
	print();
	ll ans=0;
	for(ll i=1;i<=cnt;i++){
		ll p=phi[i];
		while(n%p==0)//统计幂次 
		n/=p,num[i]++;
		ll a=sqrt(num[i]*2);//反解x 
		if(a*(a+1)>num[i]*2)a--;//大了说明应该取x-1 
		ans+=a;
	}
	if(n!=1)ans++;//最后判断一下能否再用第三个条件 
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5288
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
const int maxn = 5e5 + 5,maxm = 1e6 + 5;;

int N,M,Q,MOD,f[maxn],t[maxn],v[maxn];
int fa[maxm * 6],z,g;
bool able[2][maxm];
int id(int u,int p,int q) {
    return (u - 1) * 6 + p * 3 + q + 1;
}
int gcd(int a,int b) {
    return b == 0 ? a : gcd(b,a % b);
}
int getfa(int u) {
    return u == fa[u] ? u : fa[u] = getfa(fa[u]);
}
void Merge(int u,int v) {
    fa[getfa(u)] = getfa(v);
}
void Init() {
    read(N);read(M);read(Q);read(MOD);
    read(f[1]);read(t[1]);read(v[1]);
    g = MOD;
    for(int i = 2 ; i <= M ; ++i) {
	read(f[i]);read(t[i]);read(v[i]);
	g = gcd(g,abs(v[i] - v[1]));
    }
    MOD = gcd(MOD,3 * g);
    z = v[1] % g;
    int T = id(N,1,2);
    for(int i = 1 ; i <= T; ++i) fa[i] = i;
    for(int i = 1 ; i <= M ; ++i) {
	int w = (v[i] / g) % 3;
	for(int p = 0 ; p < 2 ; ++p) {
	    for(int q = 0 ; q < 3 ; ++q) {
		Merge(id(f[i],p,q),id(t[i],p ^ 1,(q * 2 + w) % 3));
		Merge(id(t[i],p,q),id(f[i],p ^ 1,(q * 2 + w) % 3));
	    }
	}
    }
    for(int i = 0 , j = z ; i < MOD ; ++i , j = j * 2 % MOD) able[i & 1][j] = 1;
}
void Solve() {
    int s,t,r;
    for(int i = 1 ; i <= Q ; ++i) {
	read(s);read(t);read(r);
	bool res = 0;
	for(int p = 0 ; p < 2 ; ++p) {
	    for(int q = 0 ; q < 3 ; ++q) {
		if(getfa(id(t,0,0)) == getfa(id(s,p,q))) {
		    if(able[p][(r + z + (3 - q) * g) % MOD]) res = 1;
		}
	    }
	}
	if(res) puts("YES");
	else puts("NO");
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
}


Measured memory_bytes: 10624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		if(k==1) {
			System.out.println(0);
		}else {
			System.out.println(n-k);
		}
	}

}


Measured memory_bytes: 21844
def is_approved(x):
    if x % 2 == 1:
        return True
    else:
        if x % 3 == 0 or x % 5 == 0:
            return True
        else:
            return False

n = int(input())
list_a = list(map(int, input().split()))

flag_app = True

for x in list_a:
    if is_approved(x) is False:
        flag_app = False

if flag_app is True:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

template<int mod>
struct Modint{
    int x;
    Modint():x(0){}
    Modint(int64_t y):x((y%mod+mod)%mod){}

    Modint &operator+=(const Modint &p){
			if((x+=p.x)>=mod)
				x -= mod;
			return *this;
		}

		Modint &operator-=(const Modint &p){
			if((x+=mod-p.x)>=mod)
				x -= mod;
			return *this;
		}

		Modint &operator*=(const Modint &p){
			x = (1LL * x * p.x) % mod;
			return *this;
		}

		Modint &operator/=(const Modint &p){
			*this *= p.inverse();
			return *this;
		}

		Modint operator-() const { return Modint(-x); }
		Modint operator+(const Modint &p) const{
			return Modint(*this) += p;
		}
		Modint operator-(const Modint &p) const{
			return Modint(*this) -= p;
		}
		Modint operator*(const Modint &p) const{
			return Modint(*this) *= p;
		}
		Modint operator/(const Modint &p) const{
			return Modint(*this) /= p;
		}

		bool operator==(const Modint &p) const { return x == p.x; }
		bool operator!=(const Modint &p) const{return x != p.x;}

		Modint inverse() const{//非再帰拡張ユークリッド
			int a = x, b = mod, u = 1, v = 0;
			while(b>0){
				int t = a / b;
				swap(a -= t * b, b);
				swap(u -= t * v, v);
			}
			return Modint(u);
		}

		Modint pow(int64_t n) const{//繰り返し二乗法
			Modint ret(1), mul(x);
			while(n>0){
				if(n&1)
					ret *= mul;
				mul *= mul;
				n >>= 1;
			}
			return ret;
		}

		friend ostream &operator<<(ostream &os,const Modint &p){
			return os << p.x;
		}
};

using modint = Modint<mod>;

Modint<998244353> dp[3005][3005][3];

void solve()
{
	ll n, s;
	cin >> n >> s;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	memset(dp, 0, sizeof(dp));
	dp[0][0][0] = 1;
	for (ll i = 0; i < n;++i)
	{
		rep(j,s+1){
			if(j-a[i]>=0){
				dp[i + 1][j][1] += dp[i][j - a[i]][0]*(i+1);
				dp[i + 1][j][1] += dp[i][j - a[i]][1];
				dp[i + 1][j][2] += dp[i][j - a[i]][1] * (n - i);
				dp[i + 1][j][2] += dp[i][j - a[i]][0]* (i + 1) * (n - i);
			}
			dp[i + 1][j][0] += dp[i][j][0];
			dp[i + 1][j][1] += dp[i][j][1];
			dp[i + 1][j][2] += dp[i][j][2];
		}
	}
	cout << dp[n][s][2];
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}

Measured memory_bytes: 106240
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------
using P = pair<int, int>;

P transformBattleID(int x, int y)
{
    if (x > y)
    {
        swap(x, y);
    }
    return P(x, y);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n - 1));
    vector<pair<int, int>> node;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - 1; j++)
        {
            cin >> a[i][j];
            a[i][j]--;
            node.emplace_back(transformBattleID(i, a[i][j]));
        }
    }
    sort(ALL(node));
    node.erase(unique(ALL(node)), node.end());
    map<P, int> BattleIDtoBattle;
    int V = node.size();
    for (int i = 0; i < V; i++)
    {
        BattleIDtoBattle[node[i]] = i;
    }
    vector<vector<int>> g(V);
    vector<int> h(V, 0); // 入次数
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - 2; j++)
        {
            P pu = transformBattleID(i, a[i][j]);
            P pv = transformBattleID(i, a[i][j + 1]);
            int u = BattleIDtoBattle[pu];
            int v = BattleIDtoBattle[pv];
            g[u].emplace_back(v);
            h[v]++;
        }
    }
    vector<bool> seen(V, false);
    vector<int> d(V, -INF);
    vector<int> toposorted;
    stack<int> st;
    for(int i=0;i<V;i++) if(h[i] == 0) st.push(i);
    while(st.size()){
        int i = st.top(); st.pop();
        toposorted.emplace_back(i);
        for(auto& j:g[i]){
            h[j]--;
            if(h[j]==0) st.push(j);
        }
    }

    if(toposorted.size() != V){
        cout << -1 << endl;
        return 0;
    }
    
    function<int(int)> dfs = [&](int v){
        if(d[v]!=-INF)return d[v];
        int res = 1;
        for(auto u:g[v]){
            chmax(res, dfs(u) + 1);
        }
        return d[v] = res;
    };

    int ans = 0;
    for(int i=0;i<V;i++){
        chmax(ans, dfs(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 78568
#include <stdio.h>
#include <math.h>
 
int main()
{
    double x1,x2,x3,y1,y2,y3,r,xp,yp;
    int n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        xp=((y2-y3)*(x1*x1+y1*y1)+(y3-y1)*(x2*x2+y2*y2)+(y1-y2)*(x3*x3+y3*y3))/(2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)));
        yp=((x2-x3)*(x1*x1+y1*y1)+(x3-x1)*(x2*x2+y2*y2)+(x1-x2)*(x3*x3+y3*y3))/(2*(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2)));
        r=sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
        printf("%.3lf %.3lf %.3lf\n",xp,yp,r);
    }
    return 0;
}

Measured memory_bytes: 664
#![allow(dead_code)]
#![allow(non_snake_case)]
// Original macro is in https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// Thanks @tanakh :bow:
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// for adhoc read (ex. https://atcoder.jp/contests/abc112/tasks/abc112_a)
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn gcd(a: i32, b: i32) -> i32 {
    if a < b { return gcd(b, a); }
    let r = a%b;
    if r == 0 { return b; }
    return gcd(b, r);
}

fn main() {
    input! { N: usize, a: [i32; N] }

    let ret = a.iter().fold(0, |acc, ele| { 
        if acc == 0 { *ele } else { gcd(acc, *ele) }
    });

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


Measured memory_bytes: 4352
N = int(input())
S = input()
Sr = Sg = Sb = 0
for c in S:
    if c == 'R':
        Sr += 1
    elif c == 'G':
        Sg += 1
    else:
        Sb += 1
A = Sr * Sg * Sb
for sep in range(1,(N+1)//2):
    for i in range(N-2*sep):
        if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]:
            A -= 1
print(A)


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

vector<int> sieve_of_eratosthenes(int n) {
  vector<int> primes(n);
  for (int i = 2; i < n; ++i)
    primes[i] = i;
  for (int i = 2; i*i < n; ++i)
    if (primes[i])
      for (int j = i*i; j < n; j+=i)
        primes[j] = 0;
  return primes;
}

int main(){
  int N;
  cin>>N;
  vector<int> a(N);

  int count=0;
  vector<int> V;
  V=sieve_of_eratosthenes(55555);
  for(int i=0;i<55555;++i){
    if(V.at(i)>0 && i%5==1){
      a.at(count)=i;
      ++count;
    }
    if(count>=N){
      break;
    }
    
  }

  for(int i=0;i<N;++i){
    cout<<a.at(i)<<" ";
  }
  
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
 
using namespace std;
 
int main(void)
{
    int N, i;
    string S;
 
    cin >> N >> S;
 
    if(N % 2 == 1){
        cout << "No" << endl;
    }
 
    else{
        if(S.substr(0,N/2) == S.substr(N/2,N/2)){
            cout << "Yes" << endl;
        }
 
        else{
            cout << "No" << endl;
        }
    }
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int n;
  cin >> n;

  vector<ll> a(n);
  map<ll, ll> mp;
  for (int i = 0; i < n; i++) {
    cin >> a[i];

    mp[a[i]]++;
  }

  ll ans = 1;
  int c = 0;

  sort(a.rbegin(), a.rend());
  for (int i = 0; i < n; i++) {
    if (mp[a[i]] >= 2) {
      mp[a[i]] -= 2;
      ans *= a[i];
      c++;
    }

    if (c == 2) {
      break;
    }
  }

  if (c < 2) {
    ans = 0;
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
    int n;
    scanf("%d",&n);
    long long ans = 1, m = 1e9 + 7;

    for(long long i=0; i<n; i++){
        ans *= i + 1;
        ans %= m;
    }
    
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 3820
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
  }

  return sum;
}

/*考えを書くスペース
xxxxxxxxxx  0000000000 最初のsearchで
xoooooooxx  0111111100
xxoooooxxx  0011111000
xxxoooxxxx  0001110000
xxxxoxxxxx  0000100000
xxxxxxxxxx  0000000000
xxxxoxxxxx  0000200000
xxxoooxxxx  0002220000
xxoooooxxx  0022222000
xxxxxxxxxx  0000000000
*/
//main.cpp----------------------------
#define max_n 100

void solve();

ll n;
ll a[max_n+1];

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

  solve();

  return 0;
}

void solve() {

  ll cnt = 0;
  bool flag = false;
  for(int i=0; i<n; ++i) {
    if(flag) {
      cnt += 1;
      flag = false;
    }else if(a[i]==a[i+1]) {
      flag = true;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdlib>
#include<stack>
#include<climits>
#include<vector>
#include<string>
#include<map>
using namespace std;
int a[101], n;
int main(){
    while(~scanf("%d", &n)){
        int ans=0, maxans=1<<29;
        for(int i=1; i<=n; i++)
            scanf("%d",&a[i]);
        for(int j=-100; j<=100; j++){
            ans=0;
            for(int i=1; i<=n; i++)
                ans+=((a[i]-j)*(a[i]-j));
            maxans=min(ans, maxans);
        }
        printf("%d\n", maxans);
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int D = N % 10;
    N /= 10;
    int C = N % 10;
    N /= 10;
    int B = N % 10;
    N /= 10;
    int A = N % 10;
    
    String ans = "";
    if(A+B+C+D == 7){
      ans = A+"+"+B+"+"+C+"+"+D+"=7";
    }else if(A+B+C-D==7){
      ans = A+"+"+B+"+"+C+"-"+D+"=7";
    }else if(A+B-C+D==7){
      ans = A+"+"+B+"-"+C+"+"+D+"=7";
    }else if(A-B+C+D==7){
      ans = A+"-"+B+"+"+C+"+"+D+"=7";
    }else if(A+B-C-D==7){
      ans = A+"+"+B+"-"+C+"-"+D+"=7";
    }else if(A-B+C-D==7){
      ans = A+"-"+B+"+"+C+"-"+D+"=7";
    }else if(A-B-C+D==7){
      ans = A+"-"+B+"-"+C+"+"+D+"=7";
    }else if(A-B-C-D==7){
      ans = A+"-"+B+"-"+C+"-"+D+"=7";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
h, n = (int(x) for x in input().split())
a = list((int(x) for x in input().split()))
a.sort()
k = 0
for num in a:
  h -= num
  k += 1
  if k == n:
    break
if h <= 0:
  print('Yes')
else:
  print('No')

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

int imos[31][100010];

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

    int N, C, t_max = 0;
    cin >> N >> C;

    for(int i = 0; i < N; i++){
        int s, t, c;
        cin >> s >> t >> c;
        imos[c - 1][s - 1]++;
        imos[c - 1][t]--;
        t_max = max(t_max, t);
    }

    for(int i = 0; i < C; i++){
        for(int j = 1; j < t_max + 1; j++){
            imos[i][j] += imos[i][j - 1];
        }
    }

    for(int i = 0; i < C; i++){
        for(int j = 0; j < t_max + 1; j++){
            if(imos[i][j] > 1) imos[i][j] = 1;
        }
    }

    int ans = 0;
    for(int i = 0; i < t_max + 1; i++){
        int cnt = 0;
        for(int j = 0; j < C; j++){
            cnt += imos[j][i];
        }
        ans = max(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	int n,k; cin>>n>>k;
	vl a(n);
	rep(i,0,n)cin>>a[i];
	rep(i,k,n){
		if(a[i]>a[i-k])cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
		
	
	
	return 0;
}

Measured memory_bytes: 4832
#include <iostream>

int main(int argc, char **argv)
{
  int a,b,c;
  std::cin >> a >> b >> c;
  int n = 0;
  for(int i=a; i<=b; i++){
    if(c%i==0) n += 1;
  }
  std::cout << n << std::endl;
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
static const int MAX_H = 1001;
static const int MAX_W = 1001;
static const int INF = 20000001;

ll d[MAX_H][MAX_W];

int H, W;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

//int m[] = {-2, -1, 0, 1, 2};

void start_up() {
    for (int i = 0; i < MAX_H; i++) {
        for (int j = 0; j < MAX_W; j++) {
            d[i][j] = INF;
        }
    }
}

ll bfs(vector<vector<char>> input, P s, P g){
    
    priority_queue<array<int, 3>> q;//, t;
    q.push({0, s.first, s.second});
    //t.push(s);
    d[s.first][s.second] = 0;
    //bool flag = true;
    
    //while (flag) {
        //flag = false;
    while(q.size()) {
        array<int, 3> cur = q.top();
        q.pop();
        P tmp = {cur[1], cur[2]};
        //if (tmp.first == g.first && tmp.second == g.second) return d[g.first][g.second];
        //bool flag = true;
        for (int i = 0; i < 4; i++) {
            int x = tmp.first + dx[i];
            int y = tmp.second + dy[i];
            // 今回は、inputが'.'のときが"通れる場所"としている
            if (x >= 0 && x < H && y >= 0 && y < W && d[x][y] > d[tmp.first][tmp.second] && input.at(x).at(y) == '.') {
                d[x][y] = d[tmp.first][tmp.second];
                q.push({-d[x][y], x, y});
                //t.push({x, y});
            }
        }
        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                int x = tmp.first + i;
                int y = tmp.second + j;
                // 今回は、inputが'.'のときが"通れる場所"としている
                if (x >= 0 && x < H && y >= 0 && y < W && d[x][y] > d[tmp.first][tmp.second] + 1 && input.at(x).at(y) == '.') {
                    //if (d[tmp.first][tmp.second] + 1 < d[g.first][g.second]) q.push({x, y});
                    d[x][y] = d[tmp.first][tmp.second] + 1;
                    q.push({-d[x][y], x, y});
                    //t.push({x, y});
                    //flag = true;
                }
            }
        }
    }
    //}
    return d[g.first][g.second];
}


int main() {
    start_up();
    cin >> H >> W;
    P s, g;
    ll s_x, s_y, g_x, g_y;
    cin >> s_x >> s_y >> g_x >> g_y;
    s_x--; s_y--; g_x--; g_y--;
    s = {s_x, s_y};
    g = {g_x, g_y};
    vector<vector<char>> S(H, vector<char>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> S.at(i).at(j);
        }
    }
    ll ans = bfs(S, s, g);
    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13440
#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y){
    if(x < y) swap(x, y);
    if(x % y == 0) return y;
    return gcd(y, x % y);
}
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    int amax= 0;
    set<int> s;
    int flag2 = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        amax = max(amax, A[i]);
        if(s.count(A[i]) && A[i] != 1) flag2 = 1; 
        s.insert(A[i]);
    }
    sort(A.begin(), A.end());
    vector<int> used(amax + 1, 0);
    int flag = 0;
    for(int i = 2; i <= amax; i++){
        if(used[i] == 1) continue;
        used[i] = 1;
        int t = i * 2;
        if(s.count(i))flag = 1;
        else flag = 0;
        while(t <= amax){
            used[t] = 1;
            if(s.count(t)){
                if(flag == 0) flag = 1;
                else if(flag == 1) flag = 2;
                else break;
            }
            t += i;
        }
        if(flag == 2) break;
    }
    if((flag == 0 || flag == 1) && flag2 != 1){
        cout << "pairwise coprime" << endl;
        return 0;
    }
    int g = A[0];
    for(int i = 0; i < N; i++){
        g = gcd(g, A[i]);
    }
    if(g == 1){
        cout << "setwise coprime" << endl;
        return 0;
    }
    cout << "not coprime" << endl;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


typedef pair<int, int> p;

int main(){
  int h, w, d;
  scanf("%d %d %d", &h, &w, &d);

  vector<p> v(h * w + 1);
  int a;
  REP (i, h) REP (j, w) {
    scanf("%d", &a);
    v[a] = make_pair(i + 1, j + 1);
  }

  vector<int> dist(h * w + 2);
  REP (i, h * w + 2) {
    if (i <= d) dist[i] = 0;
    else
      dist[i] = dist[i - d] + abs(v[i].first - v[i - d].first) + abs(v[i].second - v[i - d].second);
  }

  int q;
  int l, r;
  scanf("%d", &q);
  vector<int> ans(q);
  REP (i, q) {
    scanf("%d %d", &l, &r);
    ans[i] = dist[r] - dist[l];
  }

  REP (i, q) {
    printf("%d\n", ans[i]);
  }
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {

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

    for (int i = 0; i < n; i++) {
      data[i] = sc.nextInt();
      data[i] = Math.abs(a-(t-data[i]*0.006));
    }

    double min = data[0];
    int m = 0;

    for (int i = 1; i < n; i++) {
      if (min > data[i]) {
        min = data[i];
        m = i;
      }
    }

    System.out.println(m+1);

  }

}


Measured memory_bytes: 24936
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    final long K = sc.nextLong();
    sc.close();
    if((A-K)>=0) {
    	System.out.println((A-K)+" "+B);
    }else if((A-K)<0 && (B+(A-K))>=0) {
    	System.out.println("0 "+(B+(A-K)));
    }else {
    	System.out.println("0 0");
    }
  }
}

Measured memory_bytes: 23764
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String S_[] = new String[S.length()];
        for (int i=0;i<S.length();i++){
            S_[i] = String.valueOf(S.charAt(i));
        }
        String cmp = "1";
        int zero = 0;
        int one = 0;
        for (int i=0;i<S.length();i++){
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        }
        System.out.println(Math.min(zero,one));
    }
}

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

using namespace std;

bool exitFriendships() {
    int n, k;
    cin >> n >> k;

    if (((n - 1) * (n - 2) / 2) < k) return false;

    int m = n * (n - 1) / 2;
    vector<vector<bool>> adj(n, vector<bool>(n, true));
    for (int v = 1; 0 < k && v < n; ++v) {
        for (int u = 1; 0 < k && u < n; ++u) {
            if (v != u && adj[v][u]) {
                --k; --m;
                adj[v][u] = adj[u][v] = false;
            }
        }
    }

    cout << m << endl;
    for (int v = 0; v < n; ++v)
        for (int u = v + 1; u < n; ++u)
            if (adj[v][u]) cout << v + 1 << " " << u + 1 << '\n';

    return true;
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    if (!exitFriendships()) cout << "-1\n";

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#define INF (1e9)
#define N 100001
using namespace std;

int main(){
  int n,p[N],dp[N];
  cin>>n;
  for(int i=0;i<n;i++) cin>>p[i];
  for(int i=0;i<n;i++) dp[i]=INF;
  dp[n-1]=0;
  for(int i=n-1;i>=0;i--){
    if(p[i]>0) dp[i]=min(dp[i],dp[i+p[i]]);
    if(!p[i])
      for(int j=1;j<=6;j++)
	if(i+j<=n-1)
	  dp[i]=min(dp[i],dp[i+j]+1);
  }
  while(1){
    int f=0;
    for(int i=n-1;i>=0;i--){
      if(p[i]>0)
	if(dp[i]>dp[i+p[i]]) dp[i]=dp[i+p[i]],f=1;
      if(!p[i])
	for(int j=1;j<=6;j++)
	  if(i+j<=n-1)
	    if(dp[i]>dp[i+j]+1) dp[i]=dp[i+j]+1,f=1;
      if(p[i]<0)
	if(dp[i]>dp[i+p[i]]) dp[i]=dp[i+p[i]],f=1;
    }
    if(!f) break;
  }
  cout<<dp[0]<<endl;
  return 0;
}

Measured memory_bytes: 1940
import sys
sys.setrecursionlimit(4000)

def dfs(now):
  v[now]=0
  for i in edge[now]:
    if v[i]:
      point[i]+=point[now]
      dfs(i)

n,q=map(int,input().split())
edge=[[] for _ in range(n)]
point=[0]*n
for i in range(n-1):
  a,b=map(int,input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
for i in range(q):
  p,x=map(int,input().split())
  point[p-1]+=x
v=[1]*n
queue=[0]
v[0]=0
while queue:
  now=queue.pop()
  for i in edge[now]:
    if v[i]:
      v[i]=0
      queue.append(i)
      point[i]+=point[now]
print(*point)

Measured memory_bytes: 132040
///-----Bismillahir Rahmanir Rahim-----///

#include<bits/stdc++.h>
using namespace std;

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///------String/Char Related Functions-----///
string makeintString(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
string makellString(ll x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
char cpp(char c)
{
    return static_cast<char>(c + 1);
}

///------------Sorting STL----------///
struct func
{
    //this is a sample overloading function for sorting stl
    bool operator()(pii const &a, pii const &b)
    {
        if(a.F==b.F)
            return (a.S<b.S);
        return (a.F<b.F);
    }
};

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
int cnt[100];
int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        int n=s.size(),ev=0;
        for(int i=0; i<n; i++)
        {
            int val=s[i]-'0';
            //cout<<val<<" ";
            cnt[val]++;
        }
        for(int i=49; i<=74; i++)
        {
            //cout<<cnt[i]<<" ";
            if(cnt[i]%2==1)
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3640
s = input()
t = input()

def match(i):
  for j in range(len(t)):
    if not s[i+j] == '?' and s[i+j] != t[j]:
      return False
  return True

for i in range(len(s) - len(t), -1, -1):
  if not match(i):
    continue

  for j in range(i):
    print('a' if s[j] == '?' else s[j], end='')
  print(t, end='')
  for j in range(i+len(t), len(s)):
    print('a' if s[j] == '?' else s[j], end='')
  print()
  exit()
    
print('UNRESTORABLE')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
int max_size = (1<< 9)+1;
int INF = 1<<30;
vector<vector<int> > field;
void myprint(){
  cout << endl;
  cout << "------------------------------" << endl;
  for(int i = field.size()-1;i >= 0;i--){
	for(int j = 0;j < field[0].size();j++){
	  cout << field[i][j] << "\t";
	}
	cout << endl;
  }
}
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> x_vec;
  vector<int> y_vec;
  vector<pair<int,int> > keep;
  x_vec.push_back(INF);
  x_vec.push_back(-1*INF);
  y_vec.push_back(INF);
  y_vec.push_back(-1*INF);
  for(int i = 0;i < n;i++){
	int x,y;
	cin >> x >> y;
	x_vec.push_back(x);
	y_vec.push_back(y);
	keep.emplace_back(x,y);
  }
  
  sort(x_vec.begin(),x_vec.end());
  sort(y_vec.begin(),y_vec.end());
  x_vec.erase(unique(x_vec.begin(),x_vec.end()),x_vec.end());
  y_vec.erase(unique(y_vec.begin(),y_vec.end()),y_vec.end());
  field = vector<vector<int> >(y_vec.size(),vector<int>(x_vec.size(),0));
  for(int i = 0;i < keep.size();i++){
	int cx = keep[i].first;
	int cy = keep[i].second;
	cx = lower_bound(x_vec.begin(),x_vec.end(),cx) - x_vec.begin();
	cy = lower_bound(y_vec.begin(),y_vec.end(),cy) - y_vec.begin();
	field[cy][cx]++;
  }
  //myprint();
  for(int i = 0;i < y_vec.size();i++){
	for(int j = 0;j < x_vec.size()-1;j++){
	  field[i][j+1] += field[i][j];
	}
  }
//  myprint();
  for(int j = 0;j < x_vec.size();j++){
	for(int i = 0;i < y_vec.size()-1;i++){
	  field[i+1][j] += field[i][j];
	}
  }
//  myprint();

  for(int i = 0;i < m;i++){
	int x1,y1,x2,y2;
	int bx1,by1;
	int sum = 0;
	cin >> x1 >> y1 >> x2 >> y2;
	x2 = upper_bound(x_vec.begin(),x_vec.end(),x2) - 1 - x_vec.begin();
	y2 = upper_bound(y_vec.begin(),y_vec.end(),y2) - 1 - y_vec.begin();
	x1 = lower_bound(x_vec.begin(),x_vec.end(),x1) - x_vec.begin() - 1;
	y1 = lower_bound(y_vec.begin(),y_vec.end(),y1) - y_vec.begin() - 1;
	//bx1 = lower_bound(x_vec.begin(),x_vec.end(),x1) - 1 - x_vec.begin();
	//by1 = lower_bound(y_vec.begin(),y_vec.end(),y1) - 1 - y_vec.begin();
/*	cout << "x2 = " <<x2 << " y2=" << y2 << " bx1= "<< bx1 << " y2 = " << y2 << " x2= "<< x2 << " by1 = " << by1 <<" bx1 =  " << bx1 << " by1 = " << by1 << endl;*/
	sum += field[y2][x2] - field[y2][x1] - field[y1][x2] + field[y1][x1];
	cout << sum << endl;
  }
  

  return 0;
}

Measured memory_bytes: 99204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int x; cin >> x;
    cout << 10 - x / 200 << endl;
}

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

///////////////////////////////////////////
const long long int INF = 1000000000000000000LL;
using ll = long long int;
using vi = vector<int>;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
//template <class  T>T max(T x,T y){if(x>y){return x;}else{return y;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return 1; } return 0; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return 1; } return 0; }
///////////////////////////////////////////

ll num[200001];
int dp[200001];
ll pls;

//int rec(int x){
//   // cout<<x<<endl;
//    if(x<0)return pls;
//    if(dp[x]>=0)return dp[x];
//    dp[x] = min(abs(rec(x-1)),abs(rec(x-1)-2*num[x]));
//    return dp[x];
//}

int main(){
    string s;
    cin>>s;
    int ans = 700;
    for(int i=0;i<3;i++){
        if(s[i]=='o')ans+=100;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>void vcin(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(n);
    cill(k);
    LL ans = 0;
    LL min = 0;
    LL max = 0;
    rep(j, k-1){
        min += j;
        max += n - j;
    }
    for (LL i = k; i <= n+1; ++i) {
        min += i-1;
        max += n-(i-1);
        if (min > max){
            continue;
        }
        ans += max - min + 1;
        ans = ans % MOD;
    }
    co(ans);
    return 0;
}

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

void solve() {
    int n,m,k;
    cin >> n >> m >> k;
    vi a(n), b(m);
    fori(i,0,n) cin >> a[i];
    fori(i,0,m) cin >> b[i];
    vll suma(n),sumb(m);
    suma[0] = a[0];
    sumb[0] = b[0];
    fori(i,1,n) suma[i] = suma[i-1] + a[i];
    fori(i,1,m) sumb[i] = sumb[i-1] + b[i];
    int p = upper_bound(all(suma), k) - suma.begin();
    int q = upper_bound(all(sumb),k) - sumb.begin();
    int ans = max(p,q);
    fori(i,0,p) {
        int lft = k - suma[i];
        int r = upper_bound(all(sumb),lft) - sumb.begin();
        ans = max(ans,r + i + 1);
    }
    cout << ans << endl;
}
        int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
	//freopen("D:\\data_in.txt", "r", stdin);
    solve();
    
    /*clock_t start,finish;
    start = clock();
   
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

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


Measured memory_bytes: 7952