akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define nax 1009
#define FOR(i,n,m) for(int i =(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define pb push_back

typedef long long ll;

int main(){
	ll mod = 1000000007LL;
	int h,w; cin>>h>>w;
	char tab[nax][nax];
	ll dp[nax][nax];

	REP(i,h){
		REP(j,w){
			cin>>tab[i][j];
		}
	}

	dp[0][0] = 1;
	REP(i,h){
		REP(j,w){
			if(i==0&&j==0) continue;
			dp[i][j] = 0;
			if(tab[i][j]=='#') continue;
			if(i>0) dp[i][j] += dp[i-1][j];
			if(j>0) dp[i][j] += dp[i][j-1];
			dp[i][j] %= mod;
		}
	}

	cout<<dp[h-1][w-1];

	return 0;
}

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

int main(){
  int x;
  cin >> x;
  cout << 10-(x/200) << "\n";
  
  return 0;
}

Measured memory_bytes: 3636
use std::io;
use std::f32::consts::PI;

fn main() {
    let n: f32 = read::<f32>();

    println!("{}", n * 2.0 * PI);
}

fn read<T: std::str::FromStr>() -> T {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    line.trim().parse().ok().unwrap()
}

Measured memory_bytes: 2156
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#define VIZ2 {printf("graph G{\n"); for(int i=1;i<=n;i++) for es(i,e) if(vb[e]>=i)printf("%d--%d;\n",i,vb[e]); puts("}");}
#define SZ 666666
int n,m,q;
char s[2333][2333];
int q1[2333][2333];
int q2[2333][2333];
int q3[2333][2333];
template<class T>
int sum(T x,int x1,int y1,int x2,int y2)
{
	if(x1<=x2&&y1<=y2)
	return x[x2][y2]+x[x1-1][y1-1]
	-x[x1-1][y2]-x[x2][y1-1];
	return 0;
}
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
		for(int j=1;j<=m;j++)
			q1[i][j]=s[i][j]-48;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			q2[i][j]=q1[i][j]&&q1[i+1][j],
			q3[i][j]=q1[i][j]&&q1[i][j+1];
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			q1[i][j]+=q1[i][j-1]+q1[i-1][j]-q1[i-1][j-1],
			q2[i][j]+=q2[i][j-1]+q2[i-1][j]-q2[i-1][j-1],
			q3[i][j]+=q3[i][j-1]+q3[i-1][j]-q3[i-1][j-1];
	while(q--)
	{
		int x1,y1,x2,y2;
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		int ans=sum(q1,x1,y1,x2,y2)
		-sum(q2,x1,y1,x2-1,y2)-
		sum(q3,x1,y1,x2,y2-1);
		printf("%d\n",ans);
	}
}


Measured memory_bytes: 66048
/*
ID: lit20182
TASK: beads
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define mp make_pair
#define fi first
#define si second
#define pb push_back
#define all(name) (name.begin(), name.end())
#define fact(n) vector<ll> ft(1, 1LL);rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) power(a, mod-2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cout << #x << " " << x << endl;
#define int ll


ll power(ll x, ll y) {
    ll res = 1;x %= mod;
    while (y > 0) {
        if (y & 1)res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
/*_____________________________________________________________________________________________________*/





vector<int> arr[2000001];
signed main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	int t = 1;
	// cin >> t;
    next :
	while(t--){
        int a, b, c;
        cin >> a >> b >> c;
        cout << c << " " << a  << " " << b;
    }
} 









Measured memory_bytes: 47104
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var s = cin.next();

            var dict = new Dictionary<string, string>();
            dict.Add("A", "T");
            dict.Add("C", "G");
            dict.Add("G", "C");
            dict.Add("T", "A");

            Console.WriteLine(dict[s]);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N+ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }   

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 11104
#include "bits/stdc++.h"
using namespace std;
const int N = 1e5 + 5;
const int C = 10;
int n;
int arr[N];
int op[N];
char tmp[5];
long long dp[N][C];
bool calc[N][C];
long long solve(int pos , int open){
	if(pos > n){
		return 0;
	}
	if(calc[pos][open]){
		return dp[pos][open];
	}
	long long res = -1LL << 50;
	if(op[pos + 1] == 1){
		res = max(res , solve(pos + 1 , open) + ((open & 1) ? -1 : 1) * arr[pos]);
		if(open){
			res = max(res , solve(pos + 1 , open - 1) + ((open & 1) ? -1 : 1) * arr[pos]);
		}
	}
	else{
		if(open + 1 < C){
			res = max(res , solve(pos + 1 , open + 1) + ((open & 1) ? -1 : 1) * arr[pos]);
		}
		if(open){
			res = max(res , solve(pos + 1 , open) + ((open & 1) ? -1 : 1) * arr[pos]);
		}
	}
	calc[pos][open] = 1;
	return dp[pos][open] = res;
}
int main(){
	scanf("%d" , &n);
	scanf("%d" , arr + 1);
	for(int i = 2 ; i <= n ; ++i){
		scanf("%s" , tmp);
		op[i] = (tmp[0] == '-') ? -1 : 1;
		scanf("%d" , arr + i);
	}
	printf("%lld\n" , solve(1 , 0));
}


Measured memory_bytes: 16000
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int Q;
  cin >> Q;
  long long B = 0;
  priority_queue<long long, vector<long long>, less<long long>> L;
  priority_queue<long long, vector<long long>, greater<long long>> R;
  long long SL = 0;
  long long SR = 0;
  while (Q--) {
    int type;
    cin >> type;
    if (type == 1) {
      long long a, b;
      cin >> a >> b;
      B += b;
      if (L.empty()) {
        L.push(a);
        SL += a;
      } else if (L.top() < a) {
        R.push(a);
        SR += a;
      } else {
        L.push(a);
        SL += a;
      }
      while (L.size() >= R.size() + 2) {
        SL -= L.top();
        SR += L.top();
        R.push(L.top());
        L.pop();
      }
      while (R.size() >= L.size() + 1) {
        SR -= R.top();
        SL += R.top();
        L.push(R.top());
        R.pop();
      }
    } else {
      long long x = L.top();
      long long ans = B;
      ans += x * L.size() - SL;
      ans += SR - x * R.size();
      cout << L.top() << ' ' << ans << '\n';
    }
  }
}


Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>

using namespace std;

int main()
{
	int n=-1;
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < s.size() - t.size()+1; i++) {
		bool B=true;
		for (int j = 0; j < t.size(); j++) {
			if (s[i + j] != '?'&&s[i + j] != t[j]) B = false;
		}
		if (B == true) n = i;
	}
	if (n >= 0) {
		for (int i = 0; i < s.size(); i++) {
			if (i<n || i>n + t.size() - 1) {
				if (s[i] == '?') cout << 'a';
				else  cout << s[i];
			}
			else cout << t[i-n];
		}
	}
	else cout << "UNRESTORABLE" << endl;
    return 0;
}



Measured memory_bytes: 256
n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

tt = []
prev = 0
for e in t:
    if e > prev:
        tt.append([e, e])
        prev = e
    else:
        tt.append([1, e])

aa = []
prev = 0
for e in a[::-1]:
    if e > prev:
        aa.append([e, e])
        prev = e
    else:
        aa.append([1, e])
aa = aa[::-1]

ans = 1
for et, ea in zip(tt, aa):
    mn = max(et[0], ea[0])
    mx = min(et[1], ea[1])
    ans *= max(0, mx - mn + 1)
    ans %= mod

print(ans)


Measured memory_bytes: 32368
#include "bits/stdc++.h"
using namespace std;

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define ll      long long

void solve() {
        int n;
        cin >> n;
        int ans = 0;
        for (int i = 0; i < n; i ++) {
                int a, b;
                cin >> a >> b;
                ans += b - a + 1;
        }
        cout << ans << endl;
        return;
}

int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        solve();
        return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <complex>

using namespace std;

typedef complex<double> point_t;

point_t input[55];


int main(){
    int i=1,n;

    while (scanf("%d",&n)&&n){
        for(int k=1;k<=n;k++){
            double a,b;
            scanf("%lf%lf",&a,&b);
            input[k]=point_t(a,b);
        }

        double area=0.;
        for(int k=0;k<n;k++){
            const auto &first=input[k+1],&second=input[(k+1)%n+1];
            auto diff=second-first;
            auto incr=diff.real()*(first.imag()+second.imag());
            area+=incr;
        }

        printf("%d %.1lf\n",i++,area/2.);
    }



    return 0;
}


Measured memory_bytes: 2568
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String x = "keyence";
        int n = s.length();
        int m = x.length();
        String ans = "NO";
        for(int i = 0; i <= 7; i++){
            boolean bl = true;
            boolean flag = false;
            int cnt = -1;
            for(int j = 0; j < i; j++){
                if(n >= m && s.charAt(j) != x.charAt(++cnt)){
                    bl = false;
                }
                flag = true;
            }
            for(int j = n + i - 7; j < n; j++){
                if(n >= m && s.charAt(j) != x.charAt(++cnt)){
                    bl = false;
                }
                flag =true;
            }
            if(bl && flag) ans = "YES";
        }
        if(s.compareTo(x) == 0) ans = "YES";
        System.out.println(ans);
    }
}

Measured memory_bytes: 22612
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <random>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;

ll n, k, c, l[200010], r[200010];
string s;

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> k >> c >> s;

  for(int i = 0; i < n; ++i) {
    if (s[i] == 'o') {
      l[i + 1]++;
      i += c;
    }
  }
  for(int i = n - 1; i >= 0; --i) {
    if (s[i] == 'o') {
      r[i]++;
      i -= c;
    }
  }
  REP(i, n) l[i + 1] += l[i];
  for(int i = n; i >= 1; --i) r[i - 1] += r[i];
  
  // check: 
  for(int i = 0; i < n; ++i) {
    if(l[i] + r[i + 1] < k) {
      cout << i + 1 << '\n';
    }
  }
  return 0;
}



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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

// nCkをパスカルの三角形を利用して求める O(N^2)
const int MAX_N = 100;
ll C[MAX_N][MAX_N];

void comb_table(int N){
  for(int i=0;i<=N;++i){
    for(int j=0;j<=i;++j){
      if(j == 0 || j == i){
        C[i][j] = 1;
      }else{
        C[i][j] = C[i-1][j-1] + C[i-1][j];
      }
    }
  }
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, p; cin >> n >> p;
    ll a[n];
    ll ne = 0, no = 0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(a[i] %2 == 0) ne++;
        else no++;
    }
    comb_table(50);
    ll all = 0;
    for(int i=0;i<=n;i++) all += C[n][i];
    ll sume = 0, sumo = 0;
    for(int i=0;i<=ne;i++) sume += C[ne][i];
    for(int i=0;i<=no;i+=2) sumo += C[no][i];
    if(p == 0) cout << sume * sumo << endl;
    else cout << all - sume * sumo << endl;
}

Measured memory_bytes: 256
a,b,m=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

r=min(A)+min(B)
for i in range(m):
  x,y,c=map(int,input().split())
  r=min(r,A[x-1]+B[y-1]-c)

print(r)

Measured memory_bytes: 18608
#include<iostream>
#include<string>
#include<stack>
using namespace std;
//string casc(string s){
//	string t; int l = s.size();
//	if(l==0) return t;
//	for(int i=0; i<l; i++){
//		if(i+1<l && s[i]!=s[i+1]){
			//s.erase(s.begin()+i, s.begin()+i+1);
//			++i;
//		}
//		else t = t+s[i];
//	}
//	return t;
//}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s; cin>>s; stack<int> st; st.push(s[0]-'0');
	int l = s.length(), d=l, x=0;
	for(int i=1; i<l; i++){
		if(!st.empty() && st.top()!=s[i]-'0'){
			st.pop();
			x+=2;
		}
		else st.push(s[i]-'0');
	}
	cout<<x<<endl;
	//while(d!=x){
		//cout<<s<<' ';
	//	d = s.length();
	//	s = casc(s);
	//	x = s.length();
		//cout<<s<<endl;
	//}
	//cout<<l-d<<endl;
	return 0;
}


Measured memory_bytes: 720
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        System.out.println(Math.max(0,c-Math.max(0,a-b)));
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>P;
int d[111111],n,m,s,a,b,c;
vector<P>v[111111];
int main(){
	for(int i=0;i<111111;i++) d[i]=2e9;
	cin>>n>>m>>s;
	while(m--){
		cin>>a>>b>>c;
		v[a].emplace_back(P(b,c));
	}
	priority_queue<P,vector<P>,greater<P> > q;
	q.push(P(0,s));
	d[s]=0;
	while(!q.empty()){
		P p=q.top();q.pop();
		int cur=p.second;
		int cost=p.first;
		if(d[cur]<cost) continue;
		for(auto &e:v[cur]){
			int nex=e.first;
			int ncos=cost+e.second;
			if(d[nex]<=ncos) continue;
			d[nex]=ncos;
			q.push(P(ncos,nex));
		}
	}
	for(int i=0;i<n;i++){
		if(d[i]==2e9)cout<<"INF"<<endl;
		else cout<<d[i]<<endl;
	}
}


Measured memory_bytes: 13304
#include<bits/stdc++.h>
#define SYNC ios::sync_with_stdio(false); cin.tie(NULL); cerr.tie(NULL);
using namespace std;
int main(){
  SYNC;
  int n;
  cin >> n;
  if(n<=999) cout << "ABC";
  else if(n>=1000) cout << "ABD";
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
amax=max(a)+1

s=[0]*amax
for ii in range(n):
    s[a[ii]]=s[a[ii]]+1

ss=0
for ii in range(amax):
    ss=ss+((s[ii]-1)*s[ii])//2

for ii in range(n):
    if s[a[ii]]==0:
        print(ss)
    else:
        sai=s[a[ii]]
        t=ss-(sai*(sai-1))//2+((sai-1)*(sai-2))//2
        print(t)
        

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

int main(void){
  
 	int N,A,B;
  	cin >> N >> A >> B;
  
  	int num = 0;
  	int sum = 0;
  	int temSum = 0;
  	bool flg = false;
  
  	for(int i = 1; i <= N; i++){
      num = i;
      temSum = 0;
     	
      while(num >= 10){
      	temSum += num % 10;
        num /= 10;
      }
      temSum += num;
      
      if(A <= temSum && B >= temSum){
       	sum += i;
      }
    }
  
  	cout << sum << endl;
  
  
  return 0;
}

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

int main(){
  double st[40];
  int level[6]={},n;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>st[i];
    if(st[i]<165){
      level[0]++;
    }else if(st[i]<170){
      level[1]++;
    }else if(st[i]<175){
      level[2]++;
    }else if(st[i]<180){
      level[3]++;
    }else if(st[i]<185){
      level[4]++;
    }else{
      level[5]++;
    }
  }

  for(int i=0;i<6;i++){
    cout << i+1 << ":";
    for(int j=0;j<level[i];j++){
      cout << "*";
    }
    cout << endl;
  }

}

Measured memory_bytes: 1232
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

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

        int result = 0;
        for (int i = 0; i < s.length() / 2; i++) {
            result = s.charAt(i) != s.charAt(s.length() - 1 - i) ? result + 1 : result;
        }

        System.out.println(result);

        sc.close();
    }
}


Measured memory_bytes: 25044
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	string S;
	cin >> S;
	if (S[0] == S[2])cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
int main(){
	int n;
	while(std::cin >> n, n){
		std::string s[n];
		for(int i=0;i<n;i++){
			std::cin >> s[i];
		}

		int maxside[n][n], max = 0;//(i,j)ðEºÆµ½Æ«Â­êéÅåÌ³û`ÌPÓ
		memset(maxside, 0, sizeof(maxside));
		for(int i=0;i<n;i++){
			maxside[0][i] = s[0][i]=='*'?0:1;
			maxside[i][0] = s[i][0]=='*'?0:1;
		}
		for(int i=1;i<n;i++){
			for(int j=1;j<n;j++){
				if(s[i][j] == '*')maxside[i][j] = 0;
				else{maxside[i][j] = std::min(maxside[i-1][j-1],
																 std::min(maxside[i-1][j],
																					maxside[i][j-1]))+1;}
				max = std::max(max, maxside[i][j]);
			}
		}
		 
		std::cout << max << std::endl;
	}
}

Measured memory_bytes: 4084
import sys
from collections import Counter
p=[tuple(map(int,l.split(","))) for l in sys.stdin]
d=[i for i in p if len(i)==2][:-1]

rank=sorted(Counter([i[1] for i in d]).keys(),reverse=True)
m=sorted(d,key=lambda x:x[1],reverse=True)
tix=[i[0] for i in p if len(i)==1]
[print(rank.index(k[1])+1) for k in [i for i in m for j in tix if i[0]==j]]



Measured memory_bytes: 6000
#include <stdio.h>
#include <string.h>

int main()
{
  int j;
  char str[100];
  while (scanf("%s",str)!=EOF){
    int len=strlen(str);
    int i=0;
    while (i<len){
      if (str[i]=='@'){
        for (j=0;j<(str[i+1]-'0');j++)
          printf("%c",str[i+2]);
        i+=3;
      }
      else{
        printf("%c",str[i]);
        i++;
      }
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 520
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

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

	cout << min((n % a ? n / a + 1 : n / a) * b, (n % c ? n / c + 1 : n / c) * d) << endl;
}


Measured memory_bytes: 3120
import java.util.*;

class Main
{
	public static void main(String[] args)
	{
		String S,str1,str2,Ans;
		int N,K;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		K = sc.nextInt();
		S = sc.next();
		
		char c;
		c = S.charAt(K-1);
		c+=32;
		
		str1 = S.substring(0,K-1);
		str2 = S.substring(K);
		
		Ans = str1 + String.valueOf(c) + str2;
		System.out.println(Ans);
	}
}

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


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i, n) {
        cin >> a[i];
        b[a[i] - 1] = i + 1;
    }

    rep(i, n) cout << b[i] << " ";
}


Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define up(i,x,y) for(long long i=x;i<y;i++)
#define down(i,x,y) for(long long i=x;i>=y;i--)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout)  	
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f;
const int maxn = 1e6 + 5;
const double pi = acos(-1.0);
using namespace std;
ll qpow(ll a, ll b) { ll s = 1; while (b > 0) { if (b & 1)s = s * a % mod; a = a * a % mod; b >>= 1; }return s; }
ll read()     //输入外挂
{
    ll res = 0, ch, flag = 0;
    if ((ch = getchar()) == '-')
        flag = 1;
    else if (ch >= '0' && ch <= '9')
        res = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9')
        res = res * 10 + ch - '0';
    return flag ? -res : res;
}
ll a[maxn];
bool cmp(ll aa, ll b) {
    return aa > b;
}
int main() {
    ll n, m,sum=0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n, cmp);
    for (int i = 0; i < m; i++) {
        a[i] = 0;
    }
    for (int i = 0; i < n; i++) {
        sum += a[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 1792
N = int(input())
A = [list(map(int,input().split())) for l in range(N)]
B = [list(map(int,input().split())) for l in range(N)]
A.sort()
B.sort()
for i in range(N):
    a = -5
    b = -1
    for j in range(len(A)):
        if A[j][0]<B[i][0] and A[j][1]<B[i][1]:
           if a<A[j][1]:
              a = A[j][1]
              b = j
    if b!=-1:
        del A[b]
print(N-len(A))

Measured memory_bytes: 3064
#include<algorithm>
#include<cassert>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<iomanip>
#include<map>
#include<numeric>
#include<queue>
#include<vector>
#include<set>
#include<string>
#include<stack>
#include<sstream>
#include<complex>

#define pb push_back
#define clr clear()
#define sz size()
#define fs first
#define sc second

#define rep(i,a) for(int i=0;i<(int)(a);i++)
#define rrep(i,a) for(int i=(int)(a)−1;i>=0;i−−)
#define all(a) (a).begin(),(a).end()
#define EQ(a,b) (abs((a)−(b)) < EPS)
#define INIT(a) memset(a,0,sizeof(a))

using namespace std;
typedef double D;
typedef pair<D,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const D EPS = 1e-7;
const D INF = 1e9;
const D PI = acos(-1);

//辺の定義。必要に応し&#12441;て削る。
struct edge{
  int from,to,cap,rev;
  edge(int a=0,int b=0,int d=0,int e=0):from(a),to(b),cap(d),rev(e){}
};
int v; //ク&#12441;ラフの頂点数
vector<edge> G[210]; //ク&#12441;ラフの隣接リスト表現

//辺の追加。2つ目の辺の追加はフローアルコ&#12441;リス&#12441;ムの残余ク&#12441;ラフ用。 
void AddEdge(int s,int g,int p){
  G[s].pb(edge(s,g,p,G[g].sz));
  G[g].pb(edge(g,s,0,G[s].sz-1));
}

int level[210]; //まて&#12441;の距離 s
int iter[210]; //と&#12441;こまて&#12441;調へ&#12441;終わったか

void bfs(int s){
  memset(level,-1,sizeof(level));
  level[s] = 0;
  queue<int> q;
  q.push(s);
  while(q.sz){
    int u = q.front(); q.pop();
    rep(i,G[u].sz){
      edge &e = G[u][i];
      if(e.cap > 0 && level[e.to] < 0){
	level[e.to] = level[u] + 1;
	q.push(e.to);
      }
    }
  }
}

int dfs(int u, int t, int f){
  if(u==t)return f;
  for(int &i = iter[u];i<(int)G[u].sz;i++){
    edge &e = G[u][i];
    if(e.cap > 0 && level[u] < level[e.to]){
      int d = dfs(e.to,t,min(f,e.cap));
      if(d > 0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int dinic(int s, int t){
  int res = 0;
  for(;;){
    bfs(s);
    if(level[t]<0)return res;
    INIT(iter);
    int f;
    while((f=dfs(s,t,INF))>0)res += f;
  }
}

int n,m;
int a[10010],b[10010];

int main(){
  cin >> n >> m;
  v = 2*n + 1;

  rep(i,m){
    cin >> a[i] >> b[i]; a[i]--; b[i]--;
    rep(j,v)G[j].clr;

    rep(j,n)AddEdge(2*j,2*j+1,1);
    rep(j,i){
      AddEdge(2*a[j]+1,2*b[j],1);
      AddEdge(2*b[j]+1,2*a[j],1);
    }
    AddEdge(2*a[i]+1,v-1,1);
    AddEdge(2*b[i]+1,v-1,1);

    int flow = dinic(1,v-1);
    if(flow==2)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1600
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int N, M;
	while(cin >> N >> M, N || M)
	{
		vector<P> Vec(N);
		for(int i = 0; i < N; ++i)
		{
			cin >> Vec[i].second >> Vec[i].first;
		}
		sort(Vec.begin(), Vec.end(), greater<P>() );
		for(int i = 0; i < N; ++i)
		{
			if(Vec[i].second < M)
			{
				M -= Vec[i].second;
				Vec[i].second = 0;
			}
			else
			{
				Vec[i].second -= M;
				M = 0;
				break;
			}
		}
		int sum = 0;
		for(int i = 0; i < N; ++i)
		{
			sum += Vec[i].first * Vec[i].second;
		}
		cout << sum << endl;
	}
}

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

Measured memory_bytes: 988
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

const int RLEN=1<<18|1;
inline char nc() {
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
	char ch=nc(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
	return i*f;
}

const int N=8e5+50;
int n,k,len,a[N],b[N],l[N],r[N],mn[N];
LL f[N],sum;
vector <int> val;
inline int Min(int x,int y) {return (!x) ? y : ((!y) ? x : min(x,y));}
inline void inc(int k,int l,int r,int L,int R,int v) {
	if(L>R) return;
	if(L<=l && r<=R) {mn[k]=Min(mn[k],v); return;}
	int mid=(l+r)>>1;
	if(R<=mid) inc(k<<1,l,mid,L,R,v);
	else if(L>mid) inc(k<<1|1,mid+1,r,L,R,v);
	else inc(k<<1,l,mid,L,R,v), inc(k<<1|1,mid+1,r,L,R,v); 
}
inline int ask(int k,int l,int r,int p) {
	if(l==r) return mn[k];
	int mid=(l+r)>>1;
	if(p<=mid) return Min(mn[k],ask(k<<1,l,mid,p));
	else return Min(mn[k],ask(k<<1|1,mid+1,r,p));
}
int main() {
	n=rd(), k=rd();
	for(int i=1;i<=n;i++) {
		a[i]=rd(), b[i]=rd();
		if(b[i]==1 && 2*a[i]>k) return puts("-1"),0;
		sum+=a[i]; a[i]=(a[i]+a[i-1])%k; 
	}
	for(int i=1;i<=n;i++) {
		if(b[i]==1) l[i]=2*(k-a[i-1]), r[i]=2*(k-a[i]);
		else l[i]=0, r[i]=k-1;
		val.push_back(l[i]%=k); val.push_back(r[i]%=k);
	}
	sort(val.begin(),val.end());
	val.erase(unique(val.begin(),val.end()),val.end());
	len=val.size()-1;
	for(int i=1;i<=n;i++) {
		l[i]=lower_bound(val.begin(),val.end(),l[i])-val.begin();
		r[i]=lower_bound(val.begin(),val.end(),r[i])-val.begin();
	}
	for(int i=n;i>=1;i--) {
		int t=ask(1,0,len,l[i]);
		if(!t) f[i]=0;
		else f[i]=f[t]+(val[l[t]]-val[l[i]]+k)%k;
		if(l[i]<=r[i]) inc(1,0,len,0,l[i]-1,i), inc(1,0,len,r[i]+1,len,i);
		else inc(1,0,len,r[i]+1,l[i]-1,i);
	}
	LL ans=0x3f3f3f3f3f3f3f3f;
	for(int i=0;i<=len;i++) {
		LL t=ask(1,0,len,i);
		if(!t) t=0;
		else t=f[t]+(val[l[t]]-val[i]+k)%k;
		ans=min(ans,t);
	} cout<<ans+2*sum<<'\n';
}

Measured memory_bytes: 12532
#include <stdio.h>
#include <math.h>

int main(){
	int n;
	int a;
	int min = 999999999, max = 0;

	scanf("%d", &n);

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

		min = fmin(min, a);
		max = fmax(max, a);
	}

	int ans = max - min;
	printf("%d", ans);

	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second


const ll MOD = 1e9+7;
 
template <ll MOD>
struct modint{
    ll x;
    modint() : x(0) {}
    modint(ll a): x((a % MOD + MOD) % MOD) {}
    
    
 
    bool operator!() const{return !x;}
 
    bool operator<(const modint &a) const{
        modint res(*this);
        return res.x < a.x;
    }
    
    bool operator>(const modint &a) const{
        modint res(*this);
        return res.x > a.x;
    }
 
    modint &operator+=(const modint &a){
        if((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
 
    modint &operator-=(const modint &a){
        if((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
 
    modint &operator*=(const modint &a){
        (x *= a.x) %= MOD;
        return *this;
    }
 
    modint &operator/=(const modint &a){
        *this *= a.inv();
        return *this;
    }
 
    modint &operator%=(const modint &a){
        x %= a.x;
        return *this;
    }
 
    modint operator-() const{ return modint(-x); }
 
    modint operator+(const modint &a) const{ return modint(*this) += a; }
    modint operator-(const modint &a) const{ return modint(*this) -= a; }
    modint operator*(const modint &a) const{ return modint(*this) *= a; }
    modint operator/(const modint &a) const{ return modint(*this) /= a; }
    modint operator%(const modint &a) const{ return modint(*this) %= a; }
    bool operator==(const modint &a) const{ return x == a.x; }
    bool operator!=(const modint &a) const{ return x != a.x; }
 
 
    modint pow(ll n) const{
        modint res(1), a(x);
        while(n > 0){
            if(n & 1) res *= a;
            a *= a;
            n /= 2;
        }
        return res;
    }
 
    modint inv() const{
        return this->pow(MOD-2);
    }
 
    friend ostream &operator<<(ostream &os, const modint &m){
        return os << m.x;
    }
 
    friend istream &operator>>(istream &is, modint &m){
        ll t;
        is >> t;
        m = modint<MOD>(t);
        return (is);
    }
    
    static ll get_mod(){ return MOD; }
};
using mint = modint<MOD>;

int main(){
    ll n;
    cin >> n;

    mint dp[n] = {};
    ll c[n] = {};
    dp[0] = 1;
    map<ll,ll> m;

    rep(i,0,n){
        cin >> c[i];
        if(m.count(c[i]) == 0){
            if(i != 0) dp[i] = dp[i-1];
            m[c[i]] = i;
        }
        else{
            if(m[c[i]] == i-1) dp[i] = dp[i-1];
            else dp[i] = dp[i-1] + dp[m[c[i]]];
            m[c[i]] = i;
        }
    }
    cout << dp[n-1] << endl;
}




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


int main(){
    int A,B; cin >> A >> B;
    for (int i=1; i<=1009; i++){
        if (floor(i*0.08)==A && floor(i*0.1)==B){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const ll mod = 1e9+7;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        ll n,k ; cin >> n >> k;
        vll p(n+1,0);
        rep(i,n){
            cin >> p[i+1];
            p[i+1] +=p[i];
        }
        ll ans=0;
        repA(i,k,n){
            ans = max(ans, p[i]-p[i-k]);
        }
        // cout << ans << endl;
        cout << fixed << setprecision(10) << (ld)((ans+k)/2.0) << endl;

    }
}


Measured memory_bytes: 1792
fun main(args:Array<String>) {
  val t = readLine()!!.toLong()
  val a = (1..Math.pow(t.toDouble(), 0.5).toInt()).map { x ->
    if( t%x == 0L ) {
      Pair(t/x, x)
    } else {
      null
    }
  }.filter { x ->
    x != null
  }.map { x ->
    val m = x!!.toList().map { x -> x.toString().length }.max()
    m!!.toInt()
  }.toList()
  println(a.min())
}

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

const int MAX=21;
const int SIZ=1<<21; 
vector<vector<int>> a;
vector<vector<int>> dp(SIZ,vector<int>(MAX,-1));
const int MOD=1000000007;
int n;
int add(int a,int b){
	int s=a+b;
	if(s>=MOD){
		s-=MOD;
	}
	return s;
}

int compute(bitset<21> bt,int id,int val){ 
	if(dp[val][id]!=-1){ 
		return dp[val][id]; 
	} 

	if(id==n-1){ 
		for(int i=0;i<n;i++){ 
			if(!bt.test(i) and a[i][id]==1){
				return dp[val][id]=1;
			} 
		}
		return dp[val][id]=0; 
	} 
	int s=0;
	for(int i=0;i<n;i++){ 
		if(!bt.test(i) and a[i][id]==1){ 
			bt.set(i);
			val+=1<<i;
			s=add(s,compute(bt,id+1,val));
			bt.reset(i); 
			val-=1<<i; 
		}
	}
	return dp[val][id]=s; 
}



int main(){ 
	cin>>n; 
	a.resize(n); 
	for(int i=0;i<n;i++){
		a[i].resize(n); 
		for(int j=0;j<n;j++){ 
			cin>>a[i][j]; 
		} 

	}
	bitset<21> bt; 
	cout<<compute(bt,0,0); 
	return 0;
}





Measured memory_bytes: 246016
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...) \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
   public:
    vector<pi> V[66];
    vector<int> P[22];
    int sink;
    void solve() {
        int n;
        cin >> n;
        for (int i = 1; i < n; ++i) {
            int u, v;
            cin >> u >> v;
            V[u].emplace_back(v, i);
            V[v].emplace_back(u, i);
        }
        int m;
        cin >> m;
        for (int i = 0; i < m; ++i) {
            int u, v;
            cin >> u >> v;
            sink = v;
            dfs(u, u, i);
        }
        i64 ans = 0;
        for (int i = 0; i < (1 << m); ++i) {
            memset(c, 0, sizeof c);
            int cnt = 0;
            for (int j = 0; j < m; ++j) {
                if (i >> j & 1) {
                    for (int ii : P[j]) c[ii] = 1;
                    cnt++;
                }
            }
            int count = 0;
            for (int ii = 1; ii < n; ++ii)
                if (!c[ii])
                    count++;
            if (cnt & 1)
                ans -= 1ll << count;
            else
                ans += 1ll << count;
        }
        cout << ans << '\n';
    }
    bool c[66];
    bool dfs(int u, int f, int id) {
        if (u == sink) {
            return true;
        }
        for (auto v : V[u]) {
            if (v.first == f)
                continue;
            if (dfs(v.first, u, id)) {
                P[id].push_back(v.second);
                return true;
            }
        }
        return false;
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	int sum = abs(a[0]);
	for (int i = 0; i < n - 1; i++) sum += abs(a[i + 1] - a[i]);
	sum += abs(0 - a[n - 1]);

	vector<int> diff(n);
	diff[0] = abs(a[1]) - abs(a[1] - a[0]) - abs(a[0]);
	diff[n - 1] = abs(0 - a[n - 2]) - abs(a[n - 1] - a[n - 2]) - abs(0 - a[n - 1]);
	for (int i = 1; i <= n - 2; i++) {
		diff[i] = abs(a[i + 1] - a[i - 1]) - abs(a[i + 1] - a[i]) - abs(a[i] - a[i - 1]);
	}

	for (int i = 0; i < n; i++) cout << sum + diff[i] << endl;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#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 rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n;
    cin >> n;
    int ans[510*510];
    int x[510];

    vector<pair<int,pair<int,int>>> p; // position, number, count.
    vector<pair<int,pair<int,int>>> q;

    srep(i,1,n+1){
        cin >> x[i];
        ans[x[i]] = i;
        pair<int,pair<int,int>> p_;
        p_.first = x[i];
        p_.second.first = i;
        p_.second.second = i - 1;
        p.push_back(p_);
        p_.second.second = n - i;
        q.push_back(p_);
    }

    sort(p.begin(), p.end());
    sort(q.begin(), q.end(), greater<pair<int,pair<int,int>>>());

    int now = 1;
    rep(i,n){
        rep(j,p[i].second.second){
            while(true){
                if(p[i].first <= now){
                    cout << "No" << endl;
                    return 0;
                }
                if(ans[now] == 0){
                    ans[now] = p[i].second.first;
                    break;
                }
                now++;
            }
        }
    }

    now = n*n;
    rep(i,n){
        rep(j,q[i].second.second){
            while(true){
                if(now <= q[i].first){
                    cout << "No" << endl;
                    return 0;
                }
                if(ans[now] == 0){
                    ans[now] = q[i].second.first;
                    break;
                }
                now--;
            }
        }
    }

    cout << "Yes" << endl;
    srep(i,1,n*n+1){
        cout << ans[i] << ' ';
    }
    cout << endl;
    return 0;
}
 
 



Measured memory_bytes: 2176
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def is_num(x):
    if '0' <= x <= '9':
        return True
    return False
def err():
    print('No')
    quit()

a,b = inpl()
s = input()
for i,x in enumerate(s):
    if i == a:
        if x != '-':
            err()
    else:
        if not is_num(x):
            err()
print('Yes')

Measured memory_bytes: 77372
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int INFTY=1<<29;

int main()
{
	for(int n;cin>>n,n;){
		vector<vector<int>> dist(1<<n,vector<int>(n,INFTY));
		for(int i=0;i<n;i++){
			int t; cin>>t;
			for(int j=0;j<(1<<n);j++)
				dist[j][i]=t;
			for(int j=0;j<n && cin>>t;j++)
				for(int k=0;k<(1<<n);k++)
					dist[k|1<<j][i]=min(dist[k|1<<j][i],t);
		}
		vector<int> dp(1<<n,INFTY);
		dp[0]=0;
		for(int i=0;i<(1<<n);i++)
			for(int j=0;j<n;j++) if(!(i&1<<j))
				dp[i|1<<j]=min(dp[i|1<<j],dp[i]+dist[i][j]);
		cout<<dp.back()<<endl;
	}
	
	return 0;
}

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

// DATA TYPES
typedef long long ll;
#define double long double
//

// CONTAINERS
#define vec vector
#define pb push_back
#define ALL(x) begin(x), end(x)
#define SZ(x) (int)x.size()
#define mp make_pair
#define ii pair<int, int>
#define F first
#define S second
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U> &L, const std::pair<T,U> &R) {
  return {L.first + R.first, L.second + R.second};
}
//

// LOOP
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
//

// BIT
#define bitcount(n) __builtin_popcountll(n)
//

// DEBUG
#define format(x) << #x << ": " << (x)
#define com << ", "
#define ndl << "\n"
#define debug1(x) cerr format(x) ndl;
#define debug2(x, y) cerr format(x) com format(y) ndl;
#define debug3(x, y, z) cerr format(x) com format(y) com format(z) ndl;
void debug_out() { cerr << "\n"; }
template <typename H, typename... T> 
void debug_out(H h, T... t) { cerr << " " << (h); debug_out(t...); }
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
// 

// CONSTANTS
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
//

// NUMERICAL OPERATIONS
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

int norm(int a) {
  return ((a % MOD) + MOD) % MOD;
}

int mul(int a, int b) {
  return int(a * 1LL * b % MOD);
}

int binPow(int a, int k) {
  int ans = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) {
      ans = mul(ans, a);
    }
    a = mul(a, a);
  }
  return ans;
}

// If I need to find (x / a) % MOD, I need to use this function:
//    (x / a) % MOD = (x * inv(a)) % MOD
int inv(int a) {
  int b = binPow(a, MOD - 2);
  assert(mul(a, b) == 1);
  return b;
}
//

// Init variables here
const int N = 1e6 + 7;

void init() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);

}

void solve() {
  int n;
  cin >> n;
  int a[n], b[n], c[n];
  FOR(i, 0, n) cin >> a[i];
  FOR(i, 0, n) cin >> b[i];
  FOR(i, 0, n - 1) cin >> c[i];
  ll res = 0;
  int prev = -INF32, id;
  FOR(i, 0, n) {
    id = a[i] - 1;
    res += b[id];
    if (id == prev + 1) {
      res += c[prev];
    }
    prev = id;
  }
  cout << res << "\n";
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie();
  //auto beginProgram = chrono::steady_clock::now();
  //int t; scanf("%d", &t); while (t--) 
  {
    init();
    solve();
  }
  //auto endProgram = chrono::steady_clock::now();

  return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

def main():
    N=ii()
    H=list(mi())

    ans = 0
    for i in range(N):
        h = H[i]
        for j in range(i):
            if H[j] > h:
                break
        else:
            ans += 1
            continue
            
        
       
    print(ans)


                





if __name__ == "__main__":
    main()

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

int main(void)
{
    string W;
    cin >>W;
    transform(W.begin(), W.end(), W.begin(), ::tolower);
    int count=0;

    for(string str; cin>>str ,str != "END_OF_TEXT";){
        transform(str.begin(),str.end(),str.begin(),::tolower);
        if(str == W) count++;
    }
    cout <<count<<endl;
}


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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using ll = long long;
const ll inf = 1e9+5; 

const double PI =  3.14159265;

int main(){
	IO;
	int n, m, cnt = 0;
	cin>>n>>m;
	int a[n];
	for(int i = 0; i<n ; i++){
		cin>>a[i];
		cnt+= a[i];
	}

	double min = 1.0/(4*m);
	int ans = 0;
	for(int i=0; i<n ; i++){
		if(1.0*a[i]/cnt >= min) ans++;
	}

	(ans >= m)?printf("Yes\n"):printf("No\n");
	return 0;
}


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

namespace ABC118B
{
    public partial class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(long.Parse);
            var M = ss.Next(long.Parse);

            var cnts = new long[M + 1];

            for (var i = 0L; i < N; i++)
            {
                var K = ss.Next(long.Parse);
                for (var j = 0L; j < K; j++)
                {
                    var A = ss.Next(long.Parse);
                    cnts[A]++;
                }
            }

            sw.WriteLine(cnts.Count(x => x == N));
            //---------------------------------
        }
    }

    public class StreamScanner
    {
        static readonly char[] Separator = { ' ' };
        readonly StreamReader streamReader;

        string[] line = new string[0];
        int index = 0;

        public bool EndOfStream { get { return streamReader.EndOfStream && index >= line.Length; } }

        public StreamScanner(Stream stream)
        {
            this.streamReader = new StreamReader(stream);
        }

        public string Next()
        {
            return Next(s => s);
        }

        public string[] Next(int x)
        {
            return Next(s => s, x);
        }

        public string[][] Next(int x, int y)
        {
            return Next(s => s, x, y);
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (EndOfStream) throw new EndOfStreamException();
            if (index < line.Length) return parser(line[index++]);
            index = 0;
            line = streamReader.ReadLine()?.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }

    public partial class Program
    {
        static void Main()
        {
            Excute(Console.OpenStandardInput(), Console.OpenStandardOutput());
        }

        public static void Excute(Stream input, Stream output)
        {
            var ss = new StreamScanner(input);
            var sw = new StreamWriter(output);
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }
}

Measured memory_bytes: 13268
S=input()
N=len(S)
def isPalindrome(s):
  n = len(s)
  flag=True
  slist=list(s)
  for i, c in enumerate(slist):
    if c!=slist[n-1-i]:
      flag=False
    if i > n-i:
      break
  return flag

Slist=list(S)

if isPalindrome(S) and \
   isPalindrome(Slist[0:int((N-1)/2)]) and \
   isPalindrome(Slist[int((N+3)/2)-1:N]):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9056