akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>    
#define inf 100000000
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
double dmax(double a,double b){
    return a>b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

int main(void){
    int m,a,b,p[200],t,ans,i;
    while(1){
        m=in(),a=in(),b=in();
        if(!m)break;
        rep(i,m)p[i]=in();
        t=0;
        sort_r(p,m);
        rep(i,m-1){
            if(p[i]-p[i+1]>=t&&a<=i+1&&i+1<=b){
                ans=i+1;
                t=p[i]-p[i+1];
            }
        }
        print(ans);
    }
    return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int  long long
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mod 998244353
// order_of_key and *find_by_order
#define N 100001
int32_t main() {
	fast;
	int a = 0, b = 0, c = 0, d = 0;
	int t; cin >> t;
	while (t--) {
		string s;
		cin >> s;
		if (s == "AC")
			a++;
		else if (s == "TLE") {
			b++;
		}
		else if (s == "WA")
			c++;
		else
			d++;
	}
	cout << "AC x " << a << "\n";
	cout << "WA x " << c << "\n";
	cout << "TLE x " << b << "\n";
	cout << "RE x " << d << "\n";


}











Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
#endif

  int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
  return 0;
}

Measured memory_bytes: 3572
function Main(s){
  s = s.split("\n");
  var n = +s[0];
  var t = s[1].split(" ").map(a=>+a);
  var v = s[2].split(" ").map(a=>+a);
  var l = Array(n*400+2).fill(0);
  var k = 0;
  for(var i = 0; i < n; i++){
    for(var j = 0; j < t[i]*2; j++){
      k++;
      if(l[k-1] < v[i])l[k] = l[k-1] + 0.5;
      else if(l[k-1] > v[i])l[k] = v[i];
      else l[k] = l[k-1];
    }
  }
  l[k] = 0;
  for(i = n-1; i >= 0; i--){
    for(j = 0; j < t[i]*2; j++){
      k--;
      if(l[k+1] < v[i])l[k] = Math.min(l[k+1] + 0.5, l[k]);
      else if(l[k+1] > v[i])l[k] = Math.min(v[i], l[k]);
      else l[k] = Math.min(l[k+1], l[k]);
    }
  }
  var ans = 0.125;
  for(i = 1; l[i]; i++)ans += (l[i] + l[i+1]) * 0.25;
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;

ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}

//__builtin_popcount ();
char arr[MAXN];
int main() {
    FAST
    string h;
    cin >> h;
    list<char>mylist(h.begin(),h.end());
    int q;
    cin >> q;

    string pre, suf;
    int cp = 0;
    int a;
    int c = 0;
    while (q--) {
        cin >> a;
        if (a == 1) {
            c++;
          swap(pre,suf);
        } else {
            int b;
            char l;
            cin >> b >> l;
            if (b == 1) {
                pre.push_back(l);
            } else
                suf.push_back(l);
        }

    }
reverse(pre.begin(),pre.end());


if(c%2==1)
     reverse(h.begin(),h.end());
string ans = pre + h + suf;
    cout << ans << endl;

    return 0;
}

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

int main(){
  int n, h;
  bool xy[500][500], xz[500][500], yz[500][500];
  while(cin >> n >> h, n){
    fill_n( *xy, 500 * 500, false);
    fill_n( *xz, 500 * 500, false);
    fill_n( *yz, 500 * 500, false);
    int ret = n * n * n;

    while(h--){
      string s;
      int a, b;
      cin >> s >> a >> b;
      a--, b--;
      if(s == "xy"){
        xy[a][b] = true;
        for(int i = 0; i < n; i++){
          if(!(xz[a][i]|yz[b][i])) ret--;
        }
      } else if(s == "xz"){
        xz[a][b] = true;
        for(int i = 0; i < n; i++){
          if(!(xy[a][i]|yz[i][b])) ret--;
        }
      } else {
        yz[a][b] = true;
        for(int i = 0; i < n; i++){
          if(!(xy[i][a]|xz[i][b])) ret--;
        }
      }
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 1944
def male_or_female(seat,m_max,m_min,seat_0):
    print(seat)
    s=input()

    if (seat%2==0 and s==seat_0) or (seat%2==1 and s!=seat_0):
        m_min=seat
        seat=int(0.5*(m_max+seat))
            
    else :
        m_max=seat
        seat=int(0.5*(m_min+seat))

    male_or_female(seat,m_max,m_min,seat_0)

n=int(input())
print(0)
male_or_female(int(0.5*n), n, 0, input())


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <tuple>

using namespace std;

using ll =  long long;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

struct Segment {
    ll x1, x2, y1, y2;
    Segment(ll a,  ll b, ll c, bool is_vertical) {
        if(is_vertical) {
            x1 = a;
            x2 = b;
            y1 = y2 = c;
        } else {
            x1 = x2 = a;
            y1 = b;
            y2 = c;
        }
    }
};

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

    vector<Segment> segs;
    set<ll> xs, ys;
    xs.insert(0);
    ys.insert(0);
    for(int i=0;i<n+m;++i) {
        cin >> a >> b >> c;
        segs.push_back(Segment(a, b, c, i < n));
        xs.insert(segs.back().x1);
        xs.insert(segs.back().x2);
        ys.insert(segs.back().y1);
        ys.insert(segs.back().y2);
    }

    int nx = xs.size()*2+1, ny = ys.size()*2+1;

    map<ll, ll> mpx, mpy;   // 圧縮後の座標への変換
    vector<ll> widthx(nx, 0), widthy(ny, 0);  // 変換後のフィールドでの各マスの幅
    {
        int i = 0;
        ll prev = -INF;
        for(ll x: xs) {
            mpx[x] = i*2+1;
            widthx[i*2] = (prev == -INF) ? INF : (x - prev);
            prev = x;
            i++;
        }
        widthx[i*2] = INF;
        i = 0;
        prev = -INF;
        for(ll y: ys) {
            mpy[y] = i*2+1;
            widthy[i*2] = (prev == -INF) ? INF : (y - prev);
            prev = y;
            i++;
        }
        widthy[i*2] = INF;
    }

    vector<vector<bool>> matrix(nx, vector<bool>(ny, true)); // 変換後の草原
    vector<vector<bool>> used(nx, vector<bool>(ny, false));
    for(int i=0;i<n+m;++i) {
        // x と y のいずれかは単一の値しか取らないはず
        for(ll x=mpx[segs[i].x1];x<=mpx[segs[i].x2];++x) {
            for(ll y=mpy[segs[i].y1] ;y<=mpy[segs[i].y2] ;++y) {
                matrix[x][y] = false;
            }
        }
    }

    // 変換後の草原の上で BFS
    ll ans = 0LL;
    queue<Pii> que;
    que.emplace(mpx[0], mpy[0]);
    used[mpx[0]][mpy[0]] = true;
    {
        ll x, y;
        while(!que.empty()) {
            tie(x, y) = que.front(); que.pop();
            if(widthx[x] == INF || widthy[y] == INF) {
                ans = -1;
                break;
            }
            ans += widthx[x] * widthy[y];
            for(int k=0;k<4;++k) {
                ll xx = x + dyx[k][0], yy = y + dyx[k][1];
                if(0 <= xx && xx < nx && 0 <= yy && yy < ny && !used[xx][yy] && matrix[xx][yy]) {
                    que.emplace(xx, yy);
                    used[xx][yy] = true;
                }
            }
        }
    }

    if(ans == -1) {
        cout << "INF" << endl;
        return 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 13448
#include <iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int sum=0,num=0;
    if (a==5)
        sum++;
    if (b==5)
        sum++;
    if (c==5)
        sum++;
    if (a==7)
        num++;
    if (b==7)
        num++;
    if (c==7)
        num++;
    if (sum==2 && num==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <climits>
using namespace std;
 
class Node
{
    public:
        int id, x, y;
};
 
bool xsort(Node a, Node b)
{
    return a.x < b.x ? true : false;
}
bool ysort(Node a, Node b)
{
    return a.y < b.y ? true : false;
}
 
void build_table(vector<Node>& nodes, vector<vector<pair<int, int> > >& cost)
{
    vector<Node> sorted(nodes);
    sort(sorted.begin(), sorted.end(), xsort);
    for (auto itr = sorted.begin(); itr != sorted.end(); ++itr) {
        if (itr != sorted.begin())
            cost.at(itr->id).push_back(make_pair(itr->x - (itr - 1)->x, (itr - 1)->id));
        if (itr != (sorted.end() - 1))
            cost.at(itr->id).push_back(make_pair((itr + 1)->x - itr->x, (itr + 1)->id));
    }
    sort(sorted.begin(), sorted.end(), ysort);
    for (auto itr = sorted.begin(); itr != sorted.end(); ++itr) {
        if (itr != sorted.begin())
            cost.at(itr->id).push_back(make_pair(itr->y - (itr - 1)->y, (itr - 1)->id));
        if (itr != (sorted.end() - 1))
            cost.at(itr->id).push_back(make_pair((itr + 1)->y - itr->y, (itr + 1)->id));
    }
}
 
bool on[1000000];
 
unsigned long long prim(vector<vector<pair<int, int> > >& cost)
{
    unsigned long long sum = 0;
    //bool on[cost.size()];
    for (int i = 0; i < cost.size(); i++) {
        on[i] = false;
    }
    // pair<cost, node>
    priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > PQ;
    PQ.push(make_pair(0, 0));
    while (!PQ.empty()) {
        pair<int, int> edge = PQ.top();
        PQ.pop();
	if(edge.second >= cost.size()){
		return -1;
	}
        if (on[edge.second]) continue;
        on[edge.second] = true;
        sum += edge.first;
        for (auto itr = cost[edge.second].begin(); itr != cost[edge.second].end(); ++itr) {
            if (on[itr->second]) continue;
            PQ.push(*itr);
        }
    }
    return sum;
}
 
int main()
{
    int n;
    cin >> n;
 
    vector<Node> nodes;
    // pair<cost, dst>
    vector<vector<pair<int, int> > > cost(n);
    Node node;
    for (int i = 0; i < n; i++) {
        node.id = i;
        cin >> node.x >> node.y;
        nodes.push_back(node);
    }
    build_table(nodes, cost);
    cout << prim(cost) << endl;
    return 0;
}

Measured memory_bytes: 11232
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=5000;
const int MAXM=200;

int n,m;
int d[MAXN-1];
int x[MAXN][MAXM];

int stck[MAXM][MAXN],nstck[MAXM];

ll sval[MAXN];
void smod(int pos,ll val) {
	sval[pos]+=val;
}
ll sgetmxsuff() {
	ll ret=0,cur=0;
	for(int i=n-1;i>=0;--i) {
		cur+=sval[i];
		if(cur>ret) ret=cur;
	}
	return ret;
}

void run() {
	scanf("%d%d",&n,&m);
	REP(i,n-1) scanf("%d",&d[i]);
	REP(i,n) REP(j,m) scanf("%d",&x[i][j]);
	//n=MAXN,m=MAXM; REP(i,n-1) d[i]=rand(); REP(i,n) REP(j,m) x[i][j]=rand();

	ll ret=0;
	REP(k,m) nstck[k]=0;
	REP(i,n) sval[i]=0;
	REP(i,n) {
		REP(k,m) {
			int was=0;
			while(nstck[k]>0) {
				int j=stck[k][nstck[k]-1];
				if(x[j][k]>x[i][k]) {
					smod(j,-(x[i][k]-was));
					break;
				} else {
					smod(j,-(x[j][k]-was));
					was=x[j][k];
					--nstck[k];
				}
			}
			stck[k][nstck[k]++]=i;
		}
		ll only=0; REP(k,m) only+=x[i][k]; smod(i,+only);
		ll cur=sgetmxsuff();
		if(cur>ret) ret=cur;
		if(i!=n-1) smod(i,-d[i]);
	}
	printf("%lld\n",ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;

int main(){
  ll a,b,c=0,d=0,e,g,h,n,m;
  cin>>n;
  ll x[n]={},y[n];
  rep(i,0,n){
    cin>>a;
    y[i]=a;
    x[a-1]++;
  }
  rep(i,0,n) c+=x[i]*(x[i]-1)/2;
  
  rep(i,0,n){
    a=x[y[i]-1];
    b=a-1;
    if(a>=2){
      a=a*(a-1)/2;
      b=b*(b-1)/2;
      a-=b;
      co(c-a);
    }
    else co(c);
  }
    
  return 0;
}

Measured memory_bytes: 5760
def f(n):#nC2の関数
    if n==0:
        return 0
    return n*(n-1)/2
N=int(input())
A=list(map(int,input().split()))
d=dict()
e=dict()
ans=0
for i in range(N):#辞書を作る
    if A[i] not in d:
        d[A[i]]=0
    d[A[i]]+=1

for j in d:#それぞれのキーの個数をnC2として保存
    e[j]=f(d[j])
    ans+=e[j]#nC2の総和をとる

for i in A:
    print(int(ans-d[i]+1))

Measured memory_bytes: 34848
#include <stdio.h>

int main(void){
	double n1,n2;
	int map[4][2]={0},i,o;
	while(scanf("%lf%lf",&n1,&n2) != EOF){
		if(n1 >= 1.1)
			map[0][0]++;
		else if(n1 >= 0.6)
			map[1][0]++;
		else if(n1 >= 0.2)
			map[2][0]++;
		else
			map[3][0]++;
		if(n2 >= 1.1)
			map[0][1]++;
		else if(n2 >= 0.6)
			map[1][1]++;
		else if(n2 >= 0.2)
			map[2][1]++;
		else
			map[3][1]++;
	}
	for(i=0;i<4;i++){
		for(o=0;o<2;o++){
			printf("%d",map[i][o]);
			if(o != 1)
				printf(" ");
		}printf("\n");
	}
	return 0;
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
typedef long long ll;

vector<int> G[MAXN];
int indegs[MAXN];

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

  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    G[x].push_back(y);
    indegs[y]++;
  }

  queue<int> q;
  for (int i = 0; i < n; ++i) {
    if (indegs[i] == 0) q.push(i);
  }

  vector<ll> dp(n, 0);
  while (!q.empty()) {
    int cur = q.front(); q.pop();
    for (int next: G[cur]) {
      indegs[next]--;
      if (indegs[next] == 0) {
	q.push(next);
	dp[next] = max(dp[cur] + 1, dp[next]);
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) ans = max(ans, dp[i]);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n,k,h;
    cin >> n >> k;
    int count = 0;
    for(int i = 0;i < n;i++)
    {
        cin >> h;
        if(h >= k)
        {
            count++;
        }
    }
    cout << count;

    return 0;
}

Measured memory_bytes: 256
import math
import collections
import sys

input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

a,b,t=MI()
ans=int((t+0.5)/a)*b
print(ans)
    


    
        


Measured memory_bytes: 3316
N, M, Q = map(int, input().split())
abcd_list = [list(map(int, input().split())) for _ in range(Q)]
Alist = []
def dfs(array):
    if len(array) == N:
        Alist.append(array)
    else:
        if not array:
            for i in range(1, M+1):
                dfs(array[:] + [i])
        else:
            for i in range(array[-1], M+1):
                dfs(array[:] + [i])
dfs([])
ans = 0
for A in Alist:
    res = 0
    for a, b, c, d in abcd_list:
        if A[b-1] - A[a-1] == c:
            res += d
    ans = max(ans, res)
print(ans)

Measured memory_bytes: 94584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
ll n;
ll p[10000];
ll pp=0;
ll ans=100000000000000000;
map<ll,ll> prime_factor(ll n){
    map<ll,ll> res;
    for(ll i=2;i*i<=n;i++){
        bool w=true;
        while(n%i==0){
            res[i]++;
            n=n/i;
            if(w){
                w=false;
                p[pp]=i;
                pp++;
            }
        }
    }
    if(n!=1){
        res[n]=1;
        p[pp]=n;
        pp++;
    }
    return res;
}
ll extgcd(ll a,ll b,ll& x,ll& y){
    ll d=a;
    if(b!=0){
        d=extgcd(b,a%b,y,x);
        y-=(a/b)*x;
    }else{
        x=1; y=0;
    }
    return d;
}
int main(void){
    cin>>n;
    if(n==1){
        cout<<1<<endl;
        return 0;
    }
    if(n==2){
        cout<<3<<endl;
        return 0;
    }
    n=n*2;
    map m=prime_factor(n);
    ll a=1,b=1;
    for(int bit=0;bit<(1<<pp);bit++){
        a=1;
        b=1;
        for(int i=0;i<pp;i++){
            if(bit&(1<<i)){
                for(int j=0;j<m[p[i]];j++){
                    a*=p[i];
                }
            }else{
                for(int j=0;j<m[p[i]];j++){
                    b*=p[i];
                }
            }
        }
        ll x,y;
        extgcd(a,b,x,y);
        //cout<<x<<" "<<y<<endl;
        if(x<0&&y>0){
            ans=min(ans,abs(a*x));
        }else if(x>0&&y<0){
            ans=min(ans,abs(b*y));
        }
    }
    cout<<ans<<endl;
    
}


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

int main(){
  	int n;
  	cin >> n;	
  	int a[n];
  	rep(i,0,n) cin >> a[i];
  	sort(a,a+n);
  	
  	cout << a[n-1] - a[0] << endl;
  
  	
  	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_right
n = int(input())
A = [-int(input()) for _ in range(n)]

B = []
for a in A:
  b = bisect_right(B,a)  
  if len(B) == b:    
    B.append(a)    
  else:
    B[b] = a    
    
print(len(B))    

Measured memory_bytes: 7836
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=3005;
int dp[N][N],go[N][N];
char s[N],t[N];
int main()
{
int n,m;
scanf("%s %s",s+1,t+1);
n=strlen(s+1);
m=strlen(t+1);
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{
dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
if(s[i]==t[j])
{
dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
if(dp[i][j]==dp[i-1][j-1]+1)
go[i][j]=1;
}
}
string ans;
int i=n,j=m;
while(i>0 && j>0)
{
if(go[i][j])
{
ans+=s[i];
i--;
j--;
}
else
{
if(dp[i][j-1]==dp[i][j]) j--;
else i--;
}
}
reverse(ans.begin(),ans.end());
cout<<ans;
return 0;
}

Measured memory_bytes: 70784
N = int(input())
elist = []
for i in range(N):
    a,b = map(int,input().split())
    elist.append([b,a])
elist.sort()

time = 0
flg = "Yes"
for b,a in elist:
    time = time + a
    if time > b:
        flg = "No"
        break

print(flg)

Measured memory_bytes: 35616
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    int A[100010];
    cin >> N;
    rep(i,0,N){
        cin >> A[i];
    }
    sort(A, A+N);
    ll ans = 0;
    int cnt = 1;
    ll now_num = A[0];
    rep(i,1,N){
        if(A[i] == now_num){
            cnt++;
        }else{
            now_num = A[i];
            if(cnt % 2 == 1){
                ans++;
            }
            cnt = 1;
        }
    }
    if(cnt % 2 == 1){
        ans++;
    }
    print(ans);

}


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

class UnionFind {
	vector<int> data;
	vector<ll> val;
	int root(int a) {
		return data[a] < 0 ? a : root(data[a]);
	}
public:
	UnionFind(int n) : data(n, -1), val(n, 0) {}
	bool Find(int a, int b) {
		return root(a) == root(b);
	}
	void Union(int a, int b, ll v) {
		v += dis(a);
		a = root(a);
		v -= dis(b);
		b = root(b);
		if (a == b) return;
		if (data[a] < data[b]) {
			data[a] += data[b];
			data[b] = a;
			val[b] = v;
		}
		else {
			data[b] += data[a];
			data[a] = b;
			val[a] = -v;
		}
	}
	ll dis(int a) {
		return data[a] < 0 ? 0 : val[a] + dis(data[a]);
	}
	int Size(int a) {
		return -data[root(a)];
	}
};

int main()
{
	cin.sync_with_stdio(false);
	int N, M, a, b, w;
	char c;
	while (cin >> N >> M, N | M) {
		UnionFind uf(N);
		for (int i = 0; i < M; i++) {
			cin >> c >> a >> b; a--; b--;
			if (c == '!') {
				cin >> w;
				uf.Union(a, b, w);
			}
			else if (uf.Find(a, b)) {
				printf("%lld\n", uf.dis(b) - uf.dis(a));
			}
			else {
				puts("UNKNOWN");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 4304
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>


int main(int argc, char *argv[])
{
	string s;
	cin >>s;
	

	cout<<(s[2]==s[3]&& s[4]==s[5] ?"Yes": "No")<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, k;
    cin >> n >> m >> k;
    string s, t;
    cin >> s >> t;
    vector<int> a(s.begin(), s.end()), b(t.begin(), t.end());
    for (int &i : a)
        i -= '0';
    for (int &i : b)
        i -= '0';
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    n = max(n, m);
    a.resize(n);
    b.resize(n);
    vector<int> stk, foo;
    for (int i = n - 1; i >= 0; --i) {
        if (a[i] + b[i] == 1) {
            stk.push_back(i);
            continue;
        }
        if (a[i] + b[i] == 0)
            continue;
        int xa = 1, xb = 1;
        int z = k - 1;
        a[i] = b[i] = 0;
        int j = i + 1;
        while (z >= 0) {
            if ((stk.empty() || j != stk.back()) && (xa != 1 || xb != 1)) {
                if ((int)a.size() <= j)
                    a.resize(j + 1);
                if ((int)b.size() <= j)
                    b.resize(j + 1);
                a[j] = xa;
                b[j] = xb;
                stk.push_back(j);
                break;
            }
            int step = min(z, stk.empty() ? z : stk.back() - j);
            j += step;
            z -= step;
            if (stk.empty() || stk.back() > j) {
                assert(z == 0);
                if ((int)a.size() <= j)
                    a.resize(j + 1);
                if ((int)b.size() <= j)
                    b.resize(j + 1);
                a[j] = b[j] = 1;
                break;
            }
            assert(j == stk.back());
            stk.pop_back();
            if (a[j] == 1) {
                a[j] = 0;
                if (xa == 0) {
                    if (z == 0) {
                        a[j] = b[j] = 1;
                        break;
                    }
                    --z;
                    xa = xb = 1;
                } else {
                    b[j] = xb;
                    if (xb == 1)
                        foo.push_back(j);
                    xb = 0;
                }
            } else {
                b[j] = 0;
                if (xb == 0) {
                    if (z == 0) {
                        a[j] = b[j] = 1;
                        break;
                    }
                    --z;
                    xa = xb = 1;
                } else {
                    a[j] = xa;
                    if (xa == 1)
                        foo.push_back(j);
                    xa = 0;
                }
            }
            ++j;
        }
        while (!foo.empty()) {
            stk.push_back(foo.back());
            foo.pop_back();
        }
    }
    while (a.back() == 0)
        a.pop_back();
    while (b.back() == 0)
        b.pop_back();
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    for (int i : a)
        cout << i;
    cout << "\n";
    for (int i : b)
        cout << i;
    cout << "\n";
    return 0;
}

Measured memory_bytes: 29968
#(38)ICP得点集計ソフトウェア
while True:
    n=int(input())
    
    if n==0:
        break
    
    s=[int(input()) for i in range(n)]
    
    a=max(s)
    b=min(s)
    c=sum(s)
    y=(c-a-b)//(n-2)
    
    print(y)


Measured memory_bytes: 5604
import sys
from collections import Counter
from math import isinf


def warshall_floyd(matrix):
    """ ワーシャルフロイド
    :param matrix:  隣接行列(到達不能はfloat("inf"))
    :return matrix
    """
    # 到達不能をfloat("inf")にしておけば余計なチェックを入れなくても
    # inf > inf+(-1) のような到達不能＋負辺が繋がってしまうことはない
    V = len(matrix)  # 頂点数
    for i in range(V):
        for j, c2 in enumerate(row[i] for row in matrix):
            for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
                if c1 > c2+c3:
                    matrix[j][k] = c2+c3  # min(c1, c2+c3)
    return matrix


def init_matrix(V: int):
    """:param V: 頂点数
    """
    return [[float('inf')]*V for _ in range(V)]


H, W = map(int, input().split())
V = 10
matrix = init_matrix(V)
for i in range(10):
    c = map(int, input().split())
    for j, cj in enumerate(c):
        matrix[i][j] = cj

warshall_floyd(matrix)
costs = [matrix[i][1] for i in range(10)]

l = []
for _ in range(H):
    l.extend(list(map(int, input().split())))
c = Counter(l)
ans = 0


for k, v in c.items():
    if k == -1:
        continue
    ans += costs[k]*v
print(ans)


Measured memory_bytes: 3760
import Data.List
import Data.Maybe

main = do
  s <- readLn :: IO Int
  print $ collatz s [] 

collatz :: Int -> [Int] -> Int
collatz s [] = 1 + collatz  s [s]
collatz s xs 
  | isJust $ f s xs = 1
  | otherwise = 1 + collatz (m s) (s:xs)
  where 
    m n = if even n then n`div`2 else 3*n+1
    f n xs = find (==(m n)) xs

Measured memory_bytes: 508
#!/usr/bin/env python3
import sys


def solve(H: "List[int]", M: "List[int]", K: int):
    hi = 0
    m = M[1] - M[0]
    
    if m < 0:
        hi = 1
        m = m+60

    h = H[1] - H[0] - hi
    if h < 0:
        h+=24
    
    print(h*60+m-K)


    return



# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = [int()] * (2)  # type: "List[int]"
    M = [int()] * (2)  # type: "List[int]"
    for i in range(2):
        H[i] = int(next(tokens))
        M[i] = int(next(tokens))
    K = int(next(tokens))  # type: int
    solve(H, M, K)

if __name__ == '__main__':
    main()


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> D(M);
  vector<int> k(M);
  for (int i = 0; i < M; i++) {
    cin >> k.at(i);
    for (int j = 0; j < k.at(i); j++) {
      int s;
      cin >> s;
      D.at(i).push_back(s);
    }
  }
  vector<int> p(M);
  for (int i = 0; i < M; i++) {
    cin >> p.at(i);
  }
  int ans = 0;
  for (int tmp = 0; tmp < (1 << N); tmp++) {
    bitset<10> s(tmp);
    bool ok = true;
    for (int i = 0; i < M; i++) {
      int c = 0;
      for (int j = 0; j < k.at(i); j++) {
        if (s.test(D.at(i).at(j) - 1)) {
          c++;
        }
      }
      if (c % 2 != p.at(i)) {
        ok = false;
      }
    }
    if (ok) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int Sx,Sy,Tx,Ty;cin>>Sx>>Sy>>Tx>>Ty;
    int dx=abs(Tx-Sx); int dy=abs(Ty-Sy);
    string ans;
    rep(i,0,dy)ans+="U";
    rep(i,0,dx)ans+="R";

    rep(i,0,dy)ans+="D";
    rep(i,0,dx)ans+="L";

    ans+="L";
    rep(i,0,dy+1)ans+="U";
    rep(i,0,dx+1)ans+="R";
    ans+="D";

    ans+="R";
    rep(i,0,dy+1)ans+="D";
    rep(i,0,dx+1)ans+="L";
    ans+="U";
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int n = Integer.parseInt(sc.nextLine());
            int[] a = Stream.of(sc.nextLine().split(" "))
                    .mapToInt(Integer::parseInt)
                    .toArray();
            selectionSortThenPrint(a);
        } catch (NoSuchElementException | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static void selectionSortThenPrint(int[] a) {
        int swapped = 0;
        for (int i = 0; i < a.length; i++) {
            int minIndex = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < a[minIndex]) {
                    minIndex = j;
                }
            }
            if (i != minIndex) {
                int tmp = a[i];
                a[i] = a[minIndex];
                a[minIndex] = tmp;
                ++swapped;
            }
        }
        System.out.println(Arrays.stream(a)
                .boxed()
                .map(Object::toString)
                .collect(Collectors.joining(" ")));
        System.out.println(swapped);
    }
}



Measured memory_bytes: 32432
#include<iostream>
using namespace std;
int main(void)
{
	int h,w,i,j;
	while(1){
		cin>>h>>w;
		if(h==0 && w==0) break;
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(i==0 || i==h-1 || j==0 || j==w-1){
					cout<<"#";
				}
				else{
					cout<<".";
				}
			}
		cout<<"\n";
		}
	cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <queue>

using namespace std;

#define ll long long
constexpr ll inf = 1e9+7;

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

    ll X, Y, Z;
    cin>>X>>Y>>Z;
    cout<<(X - Z) / (Y + Z)<<endl;

    return 0;
}

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

int main(void){
    ios_base::sync_with_stdio(false); cin.tie(0);
    string s1, s2;
    cin>>s1>>s2;
    for(int i=0; s1[i]!='\0';i++){
    	if(s1[i])cout<<s1[i];
    	if(s2[i])cout<<s2[i];
    }
}

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

int main(){
 int n,p1 = 0,p2 = 0;
 string card1, card2;

 cin >> n;

 for(int i = 0; i < n; i++){
  cin >> card1 >> card2;

  if(card1 == card2) {
   p1++;
   p2++;
  } else if(card1 < card2) {
   p2 += 3;
  } else {
   p1 += 3;
  }
 }

 cout << p1 << " " << p2 << endl;

 return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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() {
  int n;
  cin >> n;
  map<string, int> m;
  rep(i, n) {
    string s;
    cin >> s;
    m[s] = 1;
  }
  cout << m.size() << endl;
  return 0;
}

Measured memory_bytes: 19180
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=1005;
//i_am_noob
int n,k,a[maxn],ans=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n >> k;
    rep(n) cin >> a[i];
    sort(a,a+n);
    rep(k) ans+=a[i];
    print1(ans);
	return 0;
}


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32, int32> pii;
typedef pair<int64, int64> pll;

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

template<typename T>
struct FenwickTree {
    vector<T> fenwick;
    int n;

    FenwickTree(int n) :
        fenwick(vector<T>(n+1, 0)), n(n) {}

    T sum(int i) {
        if (!i) return 0;
        return fenwick[i] + sum(i-(i&-i));
    }

    T sum(int i, int j) {
        // half-open Terval
        return sum(j-1) - sum(i-1);
    }

    void add(int i, T x) {
        if (i > n) return;
        fenwick[i] += x;
        add(i+(i&-i), x);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n, q;
    cin >> n >> q;
    vector<int32> c(n);
    REP(i, n)cin >> c[i];
    vector<pair<pii, int32>> lr(q);
    REP(i, q) {
        cin >> lr[i].fi.se >> lr[i].fi.fi;
        lr[i].se = i;
    }
    sort(all(lr));
    REP(i, q)swap(lr[i].fi.fi, lr[i].fi.se);

    vector<int32> pre(n+1, -1);
    FenwickTree<int32> ft(n+1);
    vector<int32> ans(q);

    // int32 cur = 1;
    // REP(i,q){
    //     auto [l,r] = lr[i].fi;
    //     while(cur <= r){
    //         if(pre[c[cur-1]] != -1)
    //             ft.add(pre[c[cur-1]],1);
    //         pre[c[cur-1]] = cur;
    //         ++cur;
    //     }
    //     ans[lr[i].se] = r - l + 1 - ft.sum(l,r);
    // }

    // int32 qi = 0;
    // FOR(x,1,n+1){
    //     if(pre[c[x-1]] != -1){
    //         ft.add(pre[c[x-1]],1);
    //     }
    //     pre[c[x-1]] = x;
    //     while(qi < q && lr[qi].fi.se == x){
    //         auto [l,r] = lr[qi].fi;
    //         ans[lr[qi].se] = r - l + 1 - ft.sum(l,r);
    //         ++qi;
    //     }
    // }

    int32 cur = 1;
    REP(i,q) {
        auto [l, r] = lr[i].fi;
        while (cur <= r) {
            if (pre[c[cur-1]] != -1)
                ft.add(pre[c[cur-1]], -1);
            ft.add(cur, 1);
            pre[c[cur-1]] = cur;
            ++cur;
        }
        ans[lr[i].se] = ft.sum(l, r+1);
    }

    REP(i, q)ANS(ans[i]);
    return 0;
}

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

int A[101];

void output(int n){
  for(int i=0;i<n;i++){
    cout << A[i];
    if(i<n-1) cout << " ";
    else cout << endl;
  }
}

void insertsort(int n){
  for(int i=0;i<n;i++){
    // int v=A[i];
    int j=i-1;

    while(j>-1 && A[j]>A[j+1]/*v*/){
      int v=A[j+1];
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
    }
    output(n);
  }
}

int main()
{
  int n;
  cin >> n;
  for(int i=0;i<n;i++) cin >> A[i];
  insertsort(n);
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    int X;
    X = N / 1.08;
    if (floor(X * 1.08) == N) {
        cout << X << endl;
    } else if (floor((X + 1) * 1.08) == N) {
        cout << X + 1 << endl;
    } else {
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
a,b,c,d=input()
kotae="No"
kai=0
if (a==b and c==d):
        kotae="Yes"
        kai+=1
if (a==c and b==d):
        kotae="Yes"
        kai+=1
if (a==d and b==c):
        kotae="Yes"
        kai+=1
if(kai!=1):
    kotae="No"
print(kotae)

Measured memory_bytes: 3060
// D - Lucky PIN
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N; string S; cin>>N>>S;
	long long ans = 0;
	for(int i=0; i<1000; i++){
		char c1 = i/100 +'0', c2 = (i%100)/10 +'0', c3 = i%10 +'0';
		int ix;
		for(ix=0; ix<N && S[ix]!=c1; ix++); if(ix==N) continue;
		for(++ix; ix<N && S[ix]!=c2; ix++); if(ix==N) continue;
		for(++ix; ix<N && S[ix]!=c3; ix++); if(ix==N) continue;
		ans++;
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 5010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
//LL A[SIZE],B[SIZE],C[SIZE];
LL solve(){
	cin >>N;
	string s;
	cin >> s;
	LL ans=0;
	LL minium=INF;
	LL rs=0;
	REP(i,N){
		if(s[i]=='R') rs++; 
	}
	minium=ans;
	REP(i,rs){
		if(s[i]=='W') ans++;
	}
	return ans;
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;

	REP(i,T){
		DEFAULT;
	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


Measured memory_bytes: 15524
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	rep(i,n) {
		char c;
		std::cin >> c;
		if(c=='o') a[i] = 0;
		else a[i] = 1;
	}
	// test all 0, 1
	rep(x0,2) rep(x1,2) {
		std::vector<int> b(n);
		b[0] = x0; b[1] = x1;
		for(int i=2;i<n;i++) {
			b[i] = b[i-1]^b[i-2]^a[i-1];
		}
		if(b[0]^b[n-1]^b[n-2]==a[n-1] && b[0]^b[1]^b[n-1]==a[0]) {
			for(int x:b) {
				if(x==0) std::cout << 'S';
				else std::cout << 'W';
			}
			std::cout << ENDL;
			return 0;
		}
	}
	print(-1);

	return 0;
}


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


int main() {
	int64_t N,tmp,ans=10e11;
	cin >> N;
	for (int64_t i = 1; i*i <= N ; i++)
	{
		if (N%i==0)
		{
			tmp = max(i, N / i);
			ans = min(ans, tmp);
		}
	}
	
	string a = to_string(ans);
	
	cout << a.size() << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    priority_queue<int> q;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        q.push(a[i]);
    }
    int fir = q.top();
    q.pop();
    int sec = q.top();
    q.pop();
  
    for(int i = 0;i < n;i++){
        if(a[i] == fir){
            cout << sec << endl;
        }else{
            cout << fir << endl;
        }
    }
}

Measured memory_bytes: 3316
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n, k, r, s, p;
    cin >> n >> k >> r >> s >> p;
    string t;
    cin >> t;
    int ans = 0;

    rep(i,k) {
        int last = i;
        for (int now = i; now<n; now+=k) {
            if (last == now-k && t[last] == t[now]) continue;
            switch(t[now]) {
                case 'r': ans += p; break;
                case 's': ans += r; break;
                case 'p': ans += s; break;
            }
            last = now;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s1,s2;
    cin>>s1>>s2;
    long long int ct=0;
    for(int i=0;i<3;i++){
       if(s1[i]==s2[i]) ct++;
    }
    cout<<ct<<endl;
}

Measured memory_bytes: 256
import collections

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

if d_list[0] != 0:
  print(0)
elif 0 in d_list[1:]:
  print(0)
else:
  d_count_dict = collections.Counter(d_list)
  start_num = -1
  answer = 1
  last = 1
  for num, cnt in d_count_dict.items():
    if num != start_num + 1:
      answer = 0
    else:
      answer *= ((last ** cnt)%998244353)
      last = cnt
      start_num = num
  print(answer % 998244353)

Measured memory_bytes: 19936