akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
const double EPS = 1e-9;

void init() {
    
}

set<int> dp[55];
vector<int> freeday[35];
void solve(int n) {
    for (int i = 0; i < 35; i++) {
        freeday[i].clear();
    }
    for (int j = 0; j < 55; j++) {
        dp[j].clear();
    }
    for (int i = 0; i < n; i++) {
        int m;
        cin >> m;
        dp[i].insert(i);
        for (int j = 0; j < m; j++) {
            int b; cin >> b;
            freeday[b].emplace_back(i);
        }
    }
    for (int i = 0; i < 31; i++) {
        for (int j = 0; j < (int)freeday[i].size(); j++) {
            for (int k = 0; k < (int)freeday[i].size(); k++) {
                if (freeday[i][j] != freeday[i][k]) {
                    dp[freeday[i][j]].insert(begin(dp[freeday[i][k]]), end(dp[freeday[i][k]]));
                }
            }
        }
        for (int j = 0; j < n; j++) {
            if (dp[j].size() == n) {
                cout << i << endl;
                return;
            }
        }
    }
    puts("-1");
}

signed main(void) {
    LL n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    init();
    while (cin >> n, n) {
        solve(n);
    }
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
#define reg(i,a,b) for(int i=a;i<=b;i++)
#define reh(i,a,b) for(int i=a;i>b;i--)
#define in(x) scanf("%d",&x)
#define fro freopen("D:\\testdata.in", "r", stdin)
#define il inline
#define lson(q) q<<1
#define rson(q) q<<1|1
using namespace std;
typedef long long ll;
const int mx=1e5+10;
int a[mx];
int b[mx]; 
int main(){
	int n;
	scanf("%d",&n);
	reg(i,1,n){
		scanf("%d",a+i);
		b[i]=a[i];
	}
	sort(a+1,a+1+n);
	int num=0;
	reg(i,1,n){
		if(a[i]!=b[i]){
			num++;
		}
	}
	if(num>2){
		printf("NO");
	}else{
		printf("YES");
	}
	return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int number[5];
	int i , min=9;
	int total=0 , count=0;
	for(i = 0 ; i != 5 ; i++){
		scanf("%d" , &number[i]);
		if((number[i]%10 <= min%10) && (number[i]%10 != 0)) min=number[i];
	}
	
	for(i = 0 ; i != 5 ; i++){
		if(number[i] == min && count == 0){
			count=1;
		} else if(number[i]%10 != 0){
			number[i] = number[i]/10;
			number[i] = (number[i]+1)*10;
		}
		total += number[i];
	}
	printf("%d\n" , total);
	return 0;
}

Measured memory_bytes: 128
//PLUS ULTRA

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define mp make_pair
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first

typedef long long ll;
typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){

	float pie = (6.28318)/2.0;

	int r; cin >> r;

	printf("%0.4f\n", (float)2*pie*r);



}

int main(){
    //SPEED;

    solve();

    return 0;
}
      
       


Measured memory_bytes: 3800
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= a; i++) {
			for (int j = 0; j <= b; j++) {
				for (int k = 0; k <= c; k++) {
					if (x == 500 * i + 100 * j + 50 * k) {
						count++;
					}
				}
			}
		}
		System.out.println(count);
	}
}


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


using namespace std;

#define int long long
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define ff first 
#define ss second 
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<string> vs;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpii;
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}


signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vi h(n),dp(n,1e9);
    cin >> h;
    dp[0]= 0;
    for(int i = 0; i < n; ++i){
        if(i + 1 < n){
            dp[i+1] = min(dp[i+1],dp[i] + abs(h[i] - h[i+1]));
        }
        if(i + 2 < n){
            dp[i+2] = min(dp[i+2],dp[i] + abs(h[i] - h[i+2]));
        }
    }

    cout << dp[n-1];
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int h,m,s;
	int h2,m2,s2;
	int jikan[3][3];

	for (int i = 0; i < 3; i++) {
		cin >> h >> m >> s >> h2 >> m2 >> s2;
		jikan[i][2] = s2 - s;
		if (jikan[i][2] < 0) {
			m2 -= 1;
			jikan[i][2] += 60;
		}
		jikan[i][1] = m2 - m;
		if (jikan[i][1] < 0) {
			h2 -= 1;
			jikan[i][1] += 60;
		}
		jikan[i][0] = h2 - h;
	}

	for (int i = 0; i < 3; i++) {
		cout << jikan[i][0] << " " << jikan[i][1] << " " << jikan[i][2] << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;


int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n, x;
	cin >> n >> x;
	int res = n;
	int min_el = int(1e9);
	for (int i = 0; i < n; i++)
	{
		int curm;
		cin >> curm;
		x -= curm;
		min_el = min(min_el, curm);
	}
	res += x / min_el;
	cout << res;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

const int days = 30;

int main() {
    for(;;){
        int n;
        int f;
        int tmp;
        cin >> n;
        if(n==0)break;
        vector< vector<bool> > vect(days+1, vector<bool>(n,false));
        vector< vector< vector<bool> > > have(days + 1, vector< vector<bool> >(n,vector<bool>(n,false)));

        for(int i=0; i<n ;i++){
            cin >> f;
            for(int j=0; j<f ; j++){
                cin >> tmp;
                vect[tmp][i] = true;
            }
        }
        for(int i=0; i<n ; i++){
            have[0][i][i] = true;
        }
        bool isOK=false; 
        for(int day=1; day<days+1 ;day++){
            for(int i=0; i<n; i++){
                for(int j=0; j<n ; j++){
                    bool haveij=false;
                    for(int k=0; k<n; k++){
                         haveij =  (vect[day][k] ? (have[day-1][k][j] || haveij) : haveij);
                    }
                    have[day][i][j] = have[day-1][i][j] || (vect[day][i] ? haveij : false);
                }
                bool hoge=true;
                for(int j=0 ; j<n ; j++){
                    hoge = hoge && have[day][i][j];
                }
                if(hoge) {
                    cout << day << endl;
                    isOK = true;
                    break;
                }
            }
            if(isOK) break;
        }
        if(!isOK) cout << -1 << endl;
    }
    return 0;
}



Measured memory_bytes: 3196
N, M, Q = gets.split.map(&:to_i)
sum = Array.new(N+2){Array.new(N+2, 0)}
M.times do
    l, r = gets.split.map(&:to_i)
    sum[l][r] += 1
end

N.downto(1) do |l|
    (l..N).each do |r|
        sum[l][r] += sum[l][r-1]
    end
end
N.downto(1) do |l|
    (l..N).each do |r|
        sum[l][r] += sum[l+1][r]
    end
end

Q.times do
    p, q = gets.split.map(&:to_i)
    puts sum[p][q]
end

Measured memory_bytes: 6652
#include <bits/stdc++.h>
using namespace std;
string s;
vector <vector<int>> dp;
int main(){
    cin >> s;
    dp = vector<vector<int>>(s.length(),vector<int>(3,0));
    dp[0][1] = 1;
    dp[0][2] = 0;
    if(s.length() >= 2){
        if(s[0]==s[1]){
            dp[1][1] = max(dp[0][1],dp[0][2]);
        }else{
            dp[1][1] = max(dp[0][1],dp[0][2])+1;
        }
        dp[1][2] = 1;
    }
    if(s.length() >= 3){
        if(s[1]==s[2]){
            dp[2][1] = max(dp[1][1],dp[1][2]);
        }else{
            dp[2][1] = max(dp[1][1],dp[1][2])+1;
        }
        dp[2][2] = max(dp[0][1],dp[0][2])+1;
        //cout << dp[2][2] << endl;
    }
    if(s.length() >= 4){
        for(int i = 3; i < s.length(); i++){
            if(s[i-1]==s[i]){
                //cout << "pathA" << endl;
                dp[i][1]=dp[i-1][2]+1;
            }else{
                //cout << "pathB" << endl;
                dp[i][1]=(max(dp[i-1][1],dp[i-1][2])+1);
            }
            if((s[i]==s[i-2])&&(s[i-1]==s[i-3])){
                dp[i][2]=dp[i-2][1]+1;
            }else{
                dp[i][2]=max(dp[i-2][1]+1,dp[i-2][1]+1);
            }
        }
    }
    #if 0
    for(int j = 0; j < s.length(); j++){
        cout << s[j] << " ";
    }
    cout << endl;
    for(int i = 1; i <= 2; i++){
        for(int j = 0; j < s.length(); j++){
            cout << dp[j][i] << " ";
        }
        cout << endl;
    }
    #endif
    cout << max(dp.back()[1],dp.back()[2]) << endl;
    return 0;
}

Measured memory_bytes: 14420
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
int main()
{
 
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
     //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    cin >>n;
    string s,s1;
    cin >> s;
    for (int i = 0; i < s.size(); ++i)
    {
      int val = s[i]-'@';
      val += n;
      if(val %26 == 0)
        s1 += 'Z';
      else
        s1 += '@'+val%26;
    }
    cout << s1; 
    return 0;
} 

Measured memory_bytes: 256
import math

n=int(input())
L=list(input().split())
M=list(input().split())

A=0
B=0
D=0
N=[]

for i in range(n):
    a=float(L[i])
    b=float(M[i])
    
    if a>b:
        A+=a-b
        D+=(a-b)**3
        N.append(a-b)
    else:
        A+=b-a
        D+=(b-a)**3
        N.append(b-a)
        
    B+=(a-b)**2
    C=math.sqrt(B)
    
    E=D**(1/3)

print(A)
print(C)
print(E)
print(max(N))


Measured memory_bytes: 5720
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
const int INF=INT_MAX;
const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll k;string s;cin>>k>>s;
  if(s.size()<=k){cout<<s<<endl;}
  else{
    string t=s.substr(0,k);
    cout<<t<<"..."<<endl;
  }
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int p[n];
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    int ans=0;
    for(int i=1;i<n-1;i++){
        if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i+1]<p[i]&&p[i]<p[i-1]))ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int N, M;
	cin >> N >> M;

	int ans = (1900*M + 100*(N-M)) * (1 << M);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 2005
using namespace std;
inline int in(){
    int x=0;bool f=0;char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
int sum[2][2][MN][MN],f[MN<<1][MN];
int num[2][MN],x[MN<<1],n;
bool c[MN<<1];
char ch;
int main()
{
	n=in();
	for (int i=1;i<=(n<<1);++i){
		ch=getchar();while (ch!='B'&&ch!='W') ch=getchar();
		c[i]=(ch=='W')?0:1;x[i]=in();
		for (int k=0;k<2;++k)
		for (int j=n;j>=0;--j) sum[c[i]][k][x[i]][j]=sum[c[i]][k][x[i]][j+1]+num[k][j];
		++num[c[i]][x[i]];
	}
	memset(f,0x3f,sizeof(f));f[0][0]=0;
	for (int i=1;i<=(n<<1);++i)
	for (int j=0;j<=i&&j<=n;++j){
		if (j) f[i][j]=min(f[i][j],f[i-1][j-1]+sum[1][1][j][j]+sum[1][0][j][i-j+1]);
		if (j!=i) f[i][j]=min(f[i][j],f[i-1][j]+sum[0][1][i-j][j+1]+sum[0][0][i-j][i-j]);
	}
	printf("%d",f[n<<1][n]);return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if(a <= b) {
        for(int i = 0; i < b; i++) {
            cout << a;
        }
    } else {
        for(int i = 0; i < a; i++) {
            cout << b;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  string s;
  cin >> s;
  int n = s.length();
  int ans = INF;
  rep(i,n-2) {
    string sub = s.substr(i, 3);
    ans = min(ans, abs(753 - stoi(sub)));
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll dp[n];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(ll i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1]<<endl;

    return 0;
}

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

#define endl '\n'
#define sz(x) ((int)(x.size()))

string s[55];
long long C[55];

long long dist[55][22][55][22];

bool pal(string s) {
	for(int i=0; i<sz(s); i++) if(s[i] != s[sz(s)-1-i]) return 0;
	return 1;
}

bool pal(string x, string y) {
	for(int i=0; i<min(sz(x), sz(y)); i++) {
		if(x[i] != y[sz(y)-1-i]) return 0;
	}
	return 1;
}

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

	int n;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++) cin >> a[i];
	sort(a, a+n);
	int ans = 0;
	for(int i=0; i<n; i++) {
		for(int j=i+1; j<n; j++) {
			for(int k=j+1; k<n; k++) {
				if(a[i] == a[j] || a[j] == a[k]) continue;
				if(a[i]+a[j] > a[k]) ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main(){

  int N;
  cin>>N;
  

  int A[N];
  rep(i,N)cin>>A[i];
  
  sort(A, A + sizeof(A)/sizeof(A[0]), greater<int>() ); 
  
  int Alice=0;
  int Bob=0;
  
  rep(i,N){

    if(i%2==0)Alice+=A[i];

    else Bob+=A[i];
  }

  
  cout<<Alice-Bob<<endl;
}

Measured memory_bytes: 256
//想定解法は2分探索でO(qlogn)だろうが、Tを昇順にソートしてやると、O(qlogq+q)でできる。(利点は…特になし.趣味.)
#include<iostream>
#include<algorithm>
#define rep(i,n) for(i = 0;i < n;i++)
using namespace std;

int S[100000],T[50000];
int main(){
	int i,s,t;
	cin >> s;
	rep(i,s)
		cin >> S[i];
	cin >> t;
	rep(i,t)
		cin >> T[i];
	sort(T,T+t);
	int scor = 0,cnt = 0;
	for(i = 0;i < t;){
		if(scor >= s)
			break;
		if(S[scor] == T[i]){
			scor++;
			i++;
			cnt++;
		}
		else if(S[scor] < T[i]){
			scor++;
		}
		else{
			i++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

int main()
{
    int n;

    cin >> n;

    long long int cnt=0,i,p,k;



    for(i=0;i<n;i++)
    {
        cin >> k;

        if(i==0)
        {
            p=k;
        }
        else
        {
            if(p>k)
            {
                cnt=cnt+(p-k);

                p=p;
            }
            else
            {
                p=k;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll factorial(ll n) {
  ll answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}

ll combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

ll permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  string ans = "";
  REP(i, n) {
    ans += s[i];
    ans += t[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int len;
int main()
{
    cin>>s;
    len=s.size();
    cout<<s[0];
    cout<<len-2;
    cout<<s[len-1];/*输出最后一个*/ 
    return 0;/*结束*/
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	string s, t;  cin >> s >> t;

	int ins_point = -1;
    int n=s.size(),m=t.size();
	for(int i = 0 ; i <= n - m ; i++){
			
			bool flag = true;
			for(int j = 0 ; j < t.size() ; j++){
					if(i+j>=s.size()||
                       (s[i + j] != '?' && s[i + j] != t[j])){
							flag = false;
							break;
					}
			}

			if(flag)  ins_point = i;
	}

	if(ins_point == -1)  cout << "UNRESTORABLE" << endl;
	else{
			for(int i = 0 ; i < s.size() ; i++){
					if(i == ins_point){
							for(int j = 0 ; j < t.size() ; j++)	cout << t[j];
							i += t.size() - 1;
							continue;
					}
					if(s[i] != '?')   cout << s[i];
					else              cout << 'a';
			}
			cout << endl;
	}

	return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

int N;
vector<vint> G(100005);

int dfs(int v) {
        if (G[v].size() == 0) return (0);
        int ret = 0;
        vint data;
        for (auto &u : G[v]) {
                data.push_back(dfs(u));
        }
        sort(begin(data), end(data));
        for (int i = 0; i < data.size(); i++) {
                ret = max(ret, data[(int)data.size() - i - 1] + i + 1);
        }
        return (ret);
}

int main() {
        cin >> N;
        for (int i = 1; i < N; i++) {
                int a;
                cin >> a; --a;
                G[a].push_back(i);
        }
        cout << dfs(0) << endl;
        return (0);
}

Measured memory_bytes: 13568
#include <iostream>

using namespace std;

int main()
{
	int n;

	cin>>n;

	int k1=0,k2=0,k4=0;

	for(int i=0;i<n;i++)
	{
		int num;

		cin>>num;

		if(num%4==0) k4++;

		else if(num%2==0) k2++;

		else k1++;
	}

	if(k1<=(k4+1)) 
	{
		int pos=(k4+1-k1);

		if(pos>0) cout<<"Yes"<<endl;
		
		else 
		{
			if(k2%2==0) cout<<"Yes"<<endl;

			else cout<<"No"<<endl;
		}
	}

	else cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<cstring>

using namespace std;

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

	int n, k;

	scanf("%d %d", &n, &k);

	vector<int> arr;

	for(int i=0;i<n;i++)
	{
		int input;

		scanf("%d", &input);

		arr.push_back(input);
	}

	sort(arr.begin(), arr.end());

	int sol = 0;

	for (int i = 0; i < k; i++)
	{
		sol += arr[i];
	}

	printf("%d\n", sol);

	return 0;
}

Measured memory_bytes: 3228
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <string>
#include <cstdio>
using namespace std;
typedef long long int ll;
static int const N = 100;
int main() {
	int n, P[N + 1], M[N + 1][N + 1];
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> P[i - 1] >> P[i];
	}
	for (int i = 1; i <= n; i++) M[i][i] = 0;
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j <= n - i + 1; j++) {
			int k = j + i - 1;
			M[j][k] = (1 << 21);
			for (int l = j; l <= k - 1; l++) {
				M[j][k] = min(M[j][k], M[j][l] + M[l+1][k] + P[j - 1] * P[l] * P[k]);
			}
		}
	}
	cout << M[1][n] << endl;
}



Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 1e5+7;
const int maxV = 90010;
//const int INF = 1e9+9;
const ll INF = (1ll)<<60;
const int MOD = 998244353;

ll n,k; 

int main()
{
	scanf("%lld",&n);
	
	ll m = sqrt(n);
	ll ans = 0;
	for(ll i=1;i<=m;i++)
	{
		if(n%i == 0)
		{
			ll x = n/i;
			ll y = i-1;
			if(y>0 && (n/y == n%y))
				ans += y;
			y = x-1;
			if(y>0 && (n/y == n%y))
				ans += y;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#pragma warning(disable:4996)

void initi(int* a, int b) {
	
	for (int i = 0; i < b; i++) {
		a[i] = 0;
	}
}
void add(int* a, int b) {
	for (int i = b - 1; i >= 0; i--) {
		if (a[i] == 0) {
			a[i] = 1;
			break;
		}
		else if (a[i] == 1) {
			a[i] = 0;
			continue;
		}
	}
}

int fcnt(int* wa, int w, int* ha, int h, char map[][7], int k) {
	int cnt = 0;
	int result = 0;
	for (int i = 0; i < h; i++) {
		if (ha[i] == 1)
			continue;
		for (int j = 0; j < w; j++) {
			if (wa[j] == 1)
				continue;
			if (map[i][j] == '#')
				cnt++;
		}
	}
	if (cnt == k)
		result++;

	return result;
}

int main() {
	int h, w, k;
	int wa[6] = { -1, -1, -1, -1, -1, -1};
	int ha[6] = { -1, -1, -1, -1, -1, -1 };
	char map[7][7];
	w = 3;
	h = 3;
	int cnt = 0;
	scanf("%d %d %d", &h, &w, &k);
	scanf("%d", &h);

	for (int i = 0; i < h; i++) {
		scanf("%s", &map[i]);
		getchar();
	}
	
	initi(ha, h);
	for (int i = 0; i < pow(2, h); i++) {
		initi(wa, w);
		add(ha, h);
		for (int j = 0; j < pow(2,w); j++) {
			add(wa, w);
			cnt += fcnt(wa, w, ha, h, map, k);
		}
	}
	printf("%d", cnt);
	

	return 0;
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
long m,n,x[100],y[100],p[20],i,t,j,f;
cin>>m>>n;
for(i=0;i<m;i++)p[i]=i;
for(i=0;i<n;i++)cin>>x[i]>>y[i];
for(;;){
f=0;
for(i=0;i<n;i++){
if(p[x[i]-1]>p[y[i]-1]){t=p[x[i]-1];p[x[i]-1]=p[y[i]-1];p[y[i]-1]=t;f=1;}
}
if(f==0)break;
}
for(j=0;j<m;j++){
for(i=0;i<m;i++){
if(p[i]==j){cout<<i+1<<endl;break;}
}
}
return 0;
}

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

#define P pair<int,int>
#define INF 1e9

using Graph = vector<vector<int>>;
int ans[100100];

void bfs(int a,const Graph &G){
  queue<int> que;
  int res = 0;
  que.push(a);
  fill(ans,ans+100100,1e9);
  while(!que.empty()){
    int now = que.front();que.pop();
    for(auto next:G[now]){
      if(ans[next]<1e9) continue;
      ans[next] = now;
      que.push(next);
    }
  }
}

int main(){
  ll N,M;cin>>N>>M;
  Graph G(N);
  ans[0]=0;
  rep(i,M){
    int a,b;cin>>a>>b;a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  bfs(0,G);
  bool flag=true;
  for(int i=1;i<N;++i){
    if(ans[i]>=1e9) flag=false;
  }
  if(flag){
    cout<<"Yes"<<endl;
    for(int i=1;i<N;++i){
      cout<<ans[i]+1<<endl;
    }
  }
  else cout<<"No"<<endl;
}

Measured memory_bytes: 10212
# x^n % mod
def pow_k(x, n, mod):
  if n == 0:
    return 1

  K = 1
  while n > 1:
    if n % 2 != 0:
      K = (x * K) % mod
        
    x = (x * x) % mod

    n //= 2

  return (x * K) % mod


MOD = 2019
array = [0] * (MOD+1)

array[0] = 1

s = input()
s = s[::-1]

n = 0
for i in range(len(s)):
  n += int(s[i]) * pow(10,i,MOD)
  n %= MOD
  array[n] += 1
  
ans = 0
for i in range(len(array)):
  if array[i] == 1 or array[i] == 0:
    continue
  
  tmp = array[i] * (array[i]-1) // 2
  ans += tmp
  
print(ans)

Measured memory_bytes: 68540
#define rep(i, m, n) for(int i = m; i < n; i++)
#define repM(i, m, n) for(int i = n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll; using namespace std;
//typedef pair<int,int> pii;
// d = distance(lower_bound(all(x)), upper_bound(all(x)));
int INF = 1e9;
int m = 1e9+7;
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>

int main(){
  int N; cin >> N; int a[N]; rep(i, 0, N) cin >> a[i];
  sort(a, a+N);
  //rep(i, 0, N) a[i] = (i==0) ? a[i] : a[i] - a[i-1];
  //sort(a, a+N);
  vector<int> r[2];
  rep(i, 0, 2) {
    for(int j=1; j*j <= a[i]; j++) {
      if (a[i] % j == 0) {r[i].push_back(j); r[i].push_back(a[i]/j);}
    }
    //cout << r[i].size() << endl;
  }
  int an=1;
  rep(i, 0, 2) {
    for (int k:r[i]){
      int dm=0; //cout << k << " ";
      rep(j, 0, N) {
        if (a[j] % k) dm++;
        if (dm==2) break;
      }
      if (dm<=1) an = max(an, k);
    }
  }
  cout << an << endl;
}

Measured memory_bytes: 640
import java.util.ArrayDeque
import java.util.Queue

fun main(args: Array<String>) {

    val (h, w) = readLine()!!.split(" ").map(String::toInt)
    val map = Array(h) {
        readLine()!!.toCharArray()
    }

    val queue: Queue<Pair<Int, Int>> = ArrayDeque()
    val route = Array(h) { IntArray(w) { -1 } }
    queue.add(0 to 0)
    route[0][0] = 0

    val list: List<Pair<Int, Int>> = listOf(1 to 0, -1 to 0, 0 to 1, 0 to -1)

    while (queue.isNotEmpty()) {
        val (y, x) = queue.poll()

        for ((dy, dx) in list) {
            val ny = y + dy
            val nx = x + dx
            if (ny in 0 until h && nx in 0 until w && map[ny][nx] == '.' && route[ny][nx] == -1) {
                queue.add(ny to nx)
                route[ny][nx] = route[y][x] + 1
            }
        }
    }
    val result = route[h-1][w-1]
    if (result == -1) {
        println(-1)
    } else {
        val whites = map.sumBy { it.count { c -> c == '.' } } - 1
        println(whites - result)
    }
}



Measured memory_bytes: 37920
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def main():
    a, b, c = LI()
    if a+b+c >= 22:
        print("bust")
    else:
        print("win")

main()



Measured memory_bytes: 7116
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
struct Mint {
	int val;
	Mint() { val = 0; }
	Mint(const ll& x) {
		val = (-MOD <= x && x < MOD) ? x : x % MOD;
		if (val < 0) val += MOD;
	}
	template <typename U>
	explicit operator U() const { return (U)val; }
	friend bool operator==(const Mint& a, const Mint& b) { return a.val == b.val; }
	friend bool operator!=(const Mint& a, const Mint& b) { return !(a == b); }
	friend bool operator<(const Mint& a, const Mint& b) { return a.val < b.val; }
	Mint& operator+=(const Mint& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
	Mint& operator-=(const Mint& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
	Mint& operator*=(const Mint& m) { val = (ll)val * m.val % MOD; return *this; }
	friend Mint modex(Mint a, ll p) {
		assert(p >= 0);
		Mint ans = 1;
		for (; p; p >>= 1, a *= a) if (p & 1) ans *= a;
		return ans;
	}
	Mint& operator/=(const Mint& m) { return *this *= modex(m, MOD - 2); }
	Mint& operator++() { return *this += 1; }
	Mint& operator--() { return *this -= 1; }
	Mint operator++(int) { Mint result(*this); *this += 1; return result; }
	Mint operator--(int) { Mint result(*this); *this -= 1; return result; }
	Mint operator-() const { return Mint(-val); }
	friend Mint operator+(Mint a, const Mint& b) { return a += b; }
	friend Mint operator-(Mint a, const Mint& b) { return a -= b; }
	friend Mint operator*(Mint a, const Mint& b) { return a *= b; }
	friend Mint operator/(Mint a, const Mint& b) { return a /= b; }
	friend ostream& operator<<(ostream& os, const Mint& x) { return os << x.val; }
};
const int MAXN = 2005;
Mint fac[MAXN], invfac[MAXN];
Mint binom(ll a, ll b) {
	if (b < 0) return 0;
	if (b > a) return 0;
	return fac[a] * invfac[b] * invfac[a - b];
}
int main() {
	fac[0] = 1;
	for (int i = 1; i < MAXN; ++i)
		fac[i] = fac[i - 1] * i;
	invfac[MAXN - 1] = 1 / fac[MAXN - 1];
	for (int i = MAXN - 2; i >= 0; --i)
		invfac[i] = invfac[i + 1] * (i + 1);
	int s;
	scanf("%d", &s);
	Mint ans = 0;
	for (int l = 1; l <= s; ++l) {
		if (3 * l > s) continue;
		ans += binom(s - 3 * l + l - 1, l - 1);
	}
	printf("%d\n", ans.val);
}


Measured memory_bytes: 3700
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

side = ((2-1, 3-1, 5-1, 4-1), (6-1, 3-1, 1-1, 4-1), (1-1, 2-1, 6-1, 5-1),
        (1-1, 5-1, 6-1, 2-1), (1-1, 3-1, 6-1, 4-1), (5-1, 3-1, 2-1, 4-1))

def check_rotate(face1, face2, f2_index):
    f1_bot = face1[5]
    if face2[5-f2_index] != f1_bot:
        return False
    f2_side_index = side[f2_index] * 2
    f2_side = [face2[f2_side_index[i]] for i in range(len(f2_side_index))]
    f1_side = [face1[i] for i in (2-1, 3-1, 5-1, 4-1)]
    # print(f1_side, f2_side)

    for i in range(4):
        if f1_side == f2_side[i:i+4]:
            return True

    return False

def check_ident(face1, face2):
    # print('Comparing:', face1, face2, file=sys.stderr)
    f1_top = face1[0]
    for index in range(len(face2)):
        if face2[index] == f1_top:
            if check_rotate(face1, face2, index):
                return True

    return False


def check_faces(faces, n):
    for x in range(n-1):
        for y in range(x+1, n):
            if check_ident(faces[x], faces[y]):
                print('No')
                return
    print('Yes')
    return

n = int(sys.stdin.readline())
faces = list()
for i in range(n):
    faces.append(sys.stdin.readline().split())

check_faces(faces, n)



Measured memory_bytes: 5620
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	string s, t;
	cin >> n >> s >> t;
	for(int i = n; i >= 0; i--){
		string tmps = s.substr(n - i, i);
		string tmpt = t.substr(0, i);
		if(tmps == tmpt){
			cout << s.length() + n - i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
a,b=gets.split.map(&:to_i)
x=gets.chomp
if x.size==a+b+1 && x.chars.all?{|y| [*?0..?9,?-].include? y} && x[a]== ?- && x.count(?-)==1
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
n, k = map(int, input().split())
alst = list(map(int, input().split()))
alst.sort()
bef = -1
cnt_lst = []
cnt = 0
for a in alst:
  if a == bef:
    cnt += 1
  else:
    cnt_lst.append(cnt)
    cnt = 1
    bef = a
cnt_lst.append(cnt)
ans = 0
l = len(cnt_lst)
cnt_lst.sort()
for i in range(l - k):
  ans += cnt_lst[i]
print(ans)


Measured memory_bytes: 102808
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
typedef long long ll;
using namespace std;

int main(void){
  int r,d,x;
  cin>>r>>d>>x;
  for(int i=0;i<10;i++){
    
    x=x*r-d;
    cout<<x<<endl;
  }

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, j, n) for (int i = j; i < (int)(n); i++)
#define brep(i, n) for (int i = n; i > 0; i--)
#define BREP(i, j, n) for(int i = n; i > j; i--)
#define TEST cout << "PASS" << endl
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 1e6 + 1e3 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;

int main(){
    int n;
    cin >> n;
    ll S[100000];
    ll a[100000];
    rep(i, n) cin >> a[i];
    S[0] = a[0];
    //+-+-の順
    ll ans = 0;
    if(S[0] <= 0) {
        ans -= S[0] - 1;
        S[0] = 1;
    }
    for(int i = 1; i < n; i++){
        S[i] = S[i-1] + a[i];
        if(i % 2 == 1&& S[i] >= 0){//偶数：-にする
            ans += S[i] + 1;
            S[i] = -1;
        }
        if(i % 2 == 0 && S[i] <= 0){//奇数：+にする
            ans -= S[i] - 1;
            S[i] = 1;
        }
    }
    ll tmp = ans;
    S[0] = a[0];
    //-+-+の順
    ans = 0;
    if(S[0] >= 0){
        ans += S[0] + 1;
        S[0] = -1;
    }
    for(int i = 1; i < n; i++){
        S[i] = S[i-1] + a[i];
        if(i % 2 == 1&& S[i] <= 0){//偶数：+にする
            ans -= S[i] - 1;
            S[i] = 1;
        }
        if(i % 2 == 0 && S[i] >= 0){//奇数：-にする
            ans += S[i] + 1;
            S[i] = -1;
        }
    }
    cout << min(ans, tmp) << endl;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=998244353;
const int MAX=1e5+10;
const ll INF=1e18;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    string s,t;
    cin >> s >> t;
    int ns=s.size(),nt=t.size();
    int ans=MAX;
    rep(i,ns-nt+1) {
        int tans=0;
        rep(j,nt) {
            if (s[i+j]!=t[j]) ++tans;
        }
        ans=min(ans,tans);
    }
    cout << ans << endl;


    return 0;   
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
#define rn(i,n) for(int i=1;i<=n;i++)

int main(){
  char A,B,C,D;
  cin>>A>>B>>C>>D;
  int a=A-'0';
  int b=B-'0';
  int c=C-'0';
  int d=D-'0';

  if(a+b+c+d==7)cout<<a<<'+'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
  else if(a+b+c-d==7)cout<<a<<'+'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
  else if(a+b-c+d==7)cout<<a<<'+'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
  else if(a+b-c-d==7)cout<<a<<'+'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;
  else if(a-b+c+d==7)cout<<a<<'-'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
  else if(a-b+c-d==7)cout<<a<<'-'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
  else if(a-b-c+d==7)cout<<a<<'-'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
  else if(a-b-c-d==7)cout<<a<<'-'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;

return 0;
}


Measured memory_bytes: 256
N,X = (map(int, input().split()))
m = [0] * N
for i in range(N):
    m[i] = int(input())

for i in range(N):
    X = X - m[i]

min_value = min(m)
ind = m.index(min_value)
count = N

while X - m[ind] >= 0:
    X = X - m[ind]
    count += 1

print(count)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;
 
int main(){
  int N,K;
  cin>>N>>K;
  double p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  
  double ans=0;
  for(int i=0;i<K;i++){
    ans=ans+p[i];
  }
  double d=ans;
  for(int i=0;i<N-K;i++){
    d=d-p[i]+p[K+i];
    ans=max(ans,d);
  }
  ans=(ans+K)/2;
  cout<<fixed<<setprecision(10);
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int l, r,d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; i++) {
        if (i % d == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
def f(l,r,u,d):
    global e,no
    res = 0
    hori = 10
    for i in range(u,d+1):
        if i==u or i==d:
            hori = min(hori,min(e[i][l:r+1]))
        else:
            hori = min(hori,e[i][l],e[i][r])
    if hori==no:
        return 0
    for i in range(u+1,d):
        for j in range(l+1,r):
            if hori<=e[i][j]:
                return 0
            res += abs(hori-e[i][j])
    return res
while True:
    D,W = map(int,input().split())
    if D+W==0:
        break
    e = [list(map(int,input().split())) for _ in range(D)]
    for i in range(D):
        no = min(e[0]) if i==0 else min(no,min(e[i]))
    #l,r,u,d
    ans = 0
    for l in range(W-2):
        for r in range(l+2,W):
            for u in range(D-2):
                for d in range(u+2,D):
                    ans = max(ans,f(l,r,u,d))
    print(ans)


Measured memory_bytes: 5624
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  ll n;
  std::cin>>n;

  std::vector<ll> dp(n+1,0);
  dp[0]=1;
  std::vector<ll> col(200010,0);
  ll prv=-1;

  rep(i,1,n+1){
    ll c;
    std::cin>>c;
    if(prv!=c)col[c]+=dp[i-1];
    col[c]%=MOD;
    dp[i]=col[c];
    prv=c;
  }

  std::cout<<dp[n]<<"\n";

  return 0;
}


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

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

ll pw[22];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n; cin>>n;
	pw[0]=1;
	for(int i=1;i<=13;i++)
	{
		pw[i]=pw[i-1]*26;
	}
	int len=1;
	while(n>pw[len])
	{
		n-=pw[len]; len++;
	}
	n--;
	vector<char> vec;
	for(int i=0;i<len;i++)
	{
		vec.pb('a'+n%26);
		n/=26;
	}
	reverse(vec.begin(),vec.end());
	for(char c:vec)
	{
		cout<<c;
	}
	cout<<'\n';
}


Measured memory_bytes: 3652
int main(void)
{
	int w,h;
	
	while(1){
		scanf("%d %d",&h,&w);
		if(w == 0&&h == 0)break;
		int i,j;
		
		for(i = 0;i < h;i++){
			for(j = 0;j < w;j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
int main(){
  #define int long long
  int N,sum=0;
  cin>>N;
  int MOD=1000000007;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    sum+=A.at(i);
    sum%=MOD;
  }
  int ans=0;
  for(int i=0;i<N-1;i++){
    sum-=A.at(i)-MOD;
    sum%=MOD;
    ans+=sum*A.at(i);
    ans%=MOD;
  }
  cout<<ans<<endl;
}

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

int main()
{
  int n;
  scanf("%d",&n);
  static int a[300000];
  for(int i=0;i<3*n;i++){
    scanf("%d",a+i);
  }
  sort(a,a+3*n);
  long long S=0;
  for(int i=0;i<n;i++){
    S+=a[3*n-2*(i+1)];
  }
  printf("%lld\n",S);
  return 0;
}


Measured memory_bytes: 1536
from bisect import bisect_left, bisect_right

n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))

res = 0
for i in b:
    res += bisect_left(a, i) * (n - bisect_right(c, i))

print(res)


Measured memory_bytes: 23240
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n : i64,
        x : i64
    }

    let mut ans = None;
    'wh: for i in 0..=n {
        for j in 0..=n-i {
            let k = n - i - j;
            if i * 10000 + j * 5000 + k * 1000 == x {
                ans = Some((i, j, k));
                break 'wh;
            }
        }
    }
    let (x, y, z) = ans.unwrap_or((-1, -1, -1));
    println!("{} {} {}", x, y, z);
}

Measured memory_bytes: 2168
import java.io.*;
import java.util.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}
 
class Solver {
    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {        
        String s = in.next();
        out.println(s.contains("AC") ? "Yes" : "No");
    }
}
 
 
class InputReader {
    BufferedReader br;
    StringTokenizer st;
 
    public InputReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }
 
    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
 
    int nextInt()
    {
        return Integer.parseInt(next());
    }
 
    long nextLong()
    {
        return Long.parseLong(next());
    }
 
    double nextDouble()
    {
        return Double.parseDouble(next());
    }
 
    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
} 

Measured memory_bytes: 23508