akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <vector>
#include <bitset>
#include <stack>
#include <iomanip>
#include <set>
#include <queue>
#include <map>


typedef long long ll;
typedef unsigned long long ull;
#define mk make_pair
#define mkt make_tuple

using namespace std;
int const N = 1001;
int s[2*N], l[N];

int range(int L, int R) {
    if (R > 1000) R = 1000;
    if (L < 0) L = 0;
    if (L == 0) return l[R];
    return l[R] - l[L - 1];
}

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        l[s[i]] ++;
    }

    l[0] = 0;
    for (int i = 2; i < N; i++)
        l[i] = l[i - 1] + l[i];

    ll ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            if (i != j) {
                ans += range(abs(s[i] - s[j]) + 1, s[i] + s[j] - 1);
                if (s[i] > abs(s[i] - s[j]) && s[i] < s[i] + s[j]) ans--;
                if (s[j] > abs(s[i] - s[j]) && s[j] < s[i] + s[j]) ans--;
            }
                

    cout << ans / 6;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define PI 3.1415926535897932
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define f(i, a, n) for (int i = a; i < n; i++)
using namespace std;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n; cin>>n;
    while(n) {
        if(n%10==7) {
            cout<<"Yes";
            return 0;
        }
      n/=10;
    }
    cout<<"No";

    return 0;
}

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

// 1 2 -3 5 -3 -2
// 0 1 3 0 5 2 0

int main() {
    int N; cin >> N;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    map<ll, ll> C;
    vector<ll> S(N + 1, 0);
    C[0]++;
    REP(i, 0, N) {
        S[i + 1] = A[i] + S[i];
        C[S[i + 1]]++;
    }

    ll ans = 0;
    for (auto c : C) {
        ans += c.second * (c.second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

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

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)
#define rev(s) (string((s).rbegin(),(s).rend()))

int ans;
string s[10],rs[10];
char p[10][10];
bool flg[10];

void solve(int rem){
	if(rem == 10){
		ans++;
		return;
	}

	int pos = rem / 2;

	if(rem % 2 == 0){
		int len = rem / 2;
		string tmp = "";
		rep(i,len) tmp += p[pos][i];
		rep(i,10){
			if(!flg[i]){
				flg[i] = true;

				if(s[i].substr(0,len) == tmp){
					rep(j,5) p[pos][j] = s[i][j];
					solve(rem+1);
				}
				if(s[i]!=rs[i] && rs[i].substr(0,len) == tmp){
					rep(j,5) p[pos][j] = rs[i][j];
					solve(rem+1);
				}

				flg[i] = false;
			}
		}
	}
	else{
		int len = rem / 2 + 1;
		string tmp = "";
		rep(i,len) tmp += p[i][pos]=='0' ? '1' : '0';
		rep(i,10){
			if(!flg[i]){
				flg[i] = true;

				if(s[i].substr(0,len) == tmp){
					rep(j,5) p[j][pos] = s[i][j]=='0' ? '1' : '0';
					solve(rem+1);
				}
				if(s[i]!=rs[i] && rs[i].substr(0,len) == tmp){
					rep(j,5) p[j][pos] = rs[i][j]=='0' ? '1' : '0';
					solve(rem+1);
				}

				flg[i] = false;
			}
		}
	}
}

int main(void){
	while(1){
		rep(i,10){
			if(cin>>s[i] && s[i]=="END") return 0;
			rs[i] = rev(s[i]);
		}
		fill(flg,flg+10,false);
		ans = 0;
		solve(0);
		cout<<ans/8<<endl;
	}

	return 0;
}

Measured memory_bytes: 916
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int N, D, X;
    cin >> N >> D >> X;
    int ans = 0;
    for (int i=0; i<N; i++){
        int a;
        cin >> a;
        ans += (D-1) / a + 1;
    }
    cout << ans + X << endl;
    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  for (int i = 0; i < B + 2; i++) {
    cout << "#";
  }
  cout << endl;
  for (int i = 0; i < A; i++) {
    cout << "#";
    for (int j = 0; j < B; j++) {
      char x;
      cin >> x;
      cout << x;
    }
    cout << "#" << endl;
  }
  for (int i = 0; i < B + 2; i++) {
    cout << "#";
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string c,s="MONTUEWEDTHUFRISATSUN";
    cin>>c;
    int x=s.find(c),y=s.find("SUN");
    if (c=="SUN")
        cout<<7;
    else
        cout<<(y-x)/3;

    return 0;
}


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


int main(){
    ll A, B;
    cin >> A >> B;
    ll Plug = 1;
    ll count = 0;
    while(Plug < B){
        Plug -= 1;
        Plug += A;
        count ++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
import numpy as np
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
np_A=np.array(A)

def ch(np_A,ans):
    tmp=(np_A-1)//ans
    if np.sum(tmp)<=k:
        return True
    else:
        return False


low=1
high=max(A)
while low<high :
    mid=(high+low)//2
    if ch(np_A,mid):
        high=mid
    else:
        low=mid+1
print(high)

Measured memory_bytes: 49472
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const double EPS = 1e-10;

int main() {
	int n;

	while(cin >> n, n) {
		vi score(n);
		int min=1000000, max=0, sum=0;

		REP(i, n) {
			cin >> score[i];
			if(score[i] < min) {
				min = score[i];
			}
			if(score[i] > max) {
				max = score[i];
			}
			sum += score[i];
		}

		cout << (sum-max-min)/(n-2) << endl;
	}
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AtCoder
{
    class Pair
    {
        public int num;
        public int count;
    }

    class Program
    {
        static void Main()
        {
            //ここから

            string S = ReadLineToString();
            string T = ReadLineToString();

            int [] charS = new int[26];
            int [] charT = new int[26];

            for(int i = 0; i < 26; i++)
            {
                charS[i] = 0;
                charT[i] = 0;
            }

            for (int i = 0; i < S.Length; i++)
            {
                charS[char.Parse(S.Substring(i, 1)) - 97]++;
                charT[char.Parse(T.Substring(i, 1)) - 97]++;
            }

            charS = charS.OrderByDescending(c => c).ToArray();
            charT = charT.OrderByDescending(c => c).ToArray();

            string ans = "Yes";

            for(int i = 0; i < 26; i++)
            {
                if (charS[i] != charT[i])
                {
                    ans = "No";
                    break;
                }
            }
                
            //ここまで
            Console.WriteLine(ans);
            Console.ReadKey();
        }

        long mod = 1000000007;
        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }
        static public int Conbin(int n,int m) { return Factorial(n) / (Factorial(n - m) * Factorial(m)); }


        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
    
}


Measured memory_bytes: 18904
#include<bits/stdc++.h>
using namespace std;
#define TST 105
#define TSP 105
#define TSX 105
#define TSS 105
int main()
{ 
	int n,m;
	int ans=0;
	cin>>n;
	int t[TST],x[TSX],p[TSP],sum[TSS];
	for(int i=1;i<=n;i++)
	{
		cin>>t[i];
		ans+=t[i];
	}
	cin>>m;
	for(int j=1;j<=m;j++)
	{
		cin>>p[j]>>x[j];
		sum[j]=ans-t[p[j]]+x[j];
	}
	for(int j=1;j<=m;j++)
	cout<<sum[j]<<endl;
	return 0;
}

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

int cal(string&s,string&s1){
	int num=0,m='A'-'a';
	for(int i=1;i<s.size();++i){
		if(s.at(i-1)==s.at(i)){
			s.at(i)+=m;
			++num;
		}
	}
	if(s1.front()!=s.back())s1.front()=s.back();
	return num;
}

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s,s2,s3;
	int k;
	cin>>s>>k;
	s2=s.back()+s,s3=s.back()+s;
	int64_t left=cal(s,s2),oth1=cal(s2,s3),oth2=cal(s3,s3);
	cout<<left+(k-1+(k-1)%2)/2*oth1+(k-1)/2*oth2<<"\n"s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
int main()
{
    ll h, a;
    cin >> h >> a;
    cout << (h + a - 1) / a << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

void DFS(int V,vector<vector<int> >&GRAPH,vector<int>&dist,int depth)
{
  dist[V] = depth;
  for (int i = 0; i < GRAPH[V].size(); i++)
  {
    if(dist[GRAPH[V][i]] == -1)
    {
      DFS(GRAPH[V][i],GRAPH,dist,depth+1);
    }
  }
  return;
}
void solve(void)
{
  int N;
  cin>>N;
  int X;
  cin>>X;
  vector<int> data(N);
  for (int i = 0; i < N; i++)
  {
    cin>>data[i];
  }
  int ANS = 0;
  if(data[0] > X)
  {
    ANS += data[0] - X;
    data[0] = X;
  }
  for (int i = 0; i < N - 1; i++)
  {
    int P = data[i+1] + data[i];
    if(P > X)
    {
      ANS += P - X;
      data[i+1] -= P - X;
    }
  }
  // DEBUG(data);
  cout<<ANS<<endl;
  
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O2")
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wsign-compare"

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

#define trav(a, A) for (auto & a : A)
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+5+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	ll tc = 1; //cin >> tc;
	while (tc--)
	{
		ll i, j, n;
		int x, y;
        cin >> x >> y;
        int ans = 0;
        for (i = 0; i <= 100; ++i){
            for (j = 0; j <= 100; ++j){
                if (i + j == x){
                    if (2*i + 4*j == y){
                        ans = 1;
                        break;
                    }
                }
            }
        }
        cout << (ans ? "Yes" : "No") << '\n';
	}

	return 0;
}




Measured memory_bytes: 3596
#include <iostream>

int main() {
  int X;
  std::cin >> X;
  int theta = 0;
  for (int i = 1; ; ++i) {
    theta += X;
    theta %= 360;
    if (theta == 0) {
      std::cout << i << std::endl;
      return 0;
    }
  }
  return 0;
}


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

int main(){

  int N,sum=0,ans=100000;
  cin >> N;
  int T[N],S[N];
  for(int i=0; i<N; i++){
    cin >> T[i];
    sum += T[i];
  }

  for(int i=0; i<N; i++){
    sum -= 2*T[i];
    S[i] = sum;
    ans = min(abs(S[i]), ans);
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
	int n;
	cin >> n;
	
	string s;
	cin >> s;

	int k = 0;
	for (int i = 0; i < n - 2; ++i) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
			++k;
		}
	}

	cout << k;
	
	return 0;
}
	

Measured memory_bytes: 256
import  heapq

n,m,s,t=map(int,raw_input().split())

nl=[ [ ] for j in range(n+1) ] 

for i in range(m):
	u,v,a,b=map(int,raw_input().split())
	nl[u].append( (v,a,b) )
	nl[v].append( (u,a,b) )


#Dijkstra yen
d_y=[ float("inf") ]*(n+1)
d_y[s]=0

Q=[]
heapq.heappush(Q, (0,s) )

while Q:
	cost, u=heapq.heappop(Q)
	for v,yen,snuuk in nl[u]:
		if d_y[v] > cost+yen:
			d_y[v]=cost+yen
			heapq.heappush(Q, (d_y[v], v)  )

#Dijkstra snuuk
d_s=[ float("inf")]*(n+1)
d_s[t]=0

Q=[]
heapq.heappush(Q,(0,t) )

while Q:
	cost, u=heapq.heappop(Q)
	for v,yen,snuuk in nl[u]:
		if d_s[v] > cost+snuuk:
			d_s[v]=cost+snuuk
			heapq.heappush(Q, (d_s[v], v)  )


val=float("inf")
A=[]
for i in range(n,0,-1):
	tmp=d_y[i]+d_s[i]
	val=min(val, tmp)
	A.append(val)

for i in reversed(A):
	print 10**15-i

Measured memory_bytes: 88348
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
using ll=long long;
const int mod=1e9+7;
const int N = 2e5+5;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderset; 

vector<ll> sieve(ll n) {     
    bool prim[n+1]; 
    memset(prim, true, sizeof(prim)); 
  
    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) { 
            for (ll i=p*p; i<=n; i += p) 
                prim[i] = false; 
        } 
    }
    vector<ll>vec;
    for(int i=2;i<=n;i++){
        if(prim[i]){
            vec.push_back((ll)i);
        }
        
    }
    return vec;
}

int check(int a,int b,int c,int d,int e,int f){
    if(a==b&&c==d&&e==f) return 1;
    return 0;
}

void solve(){
  int n;
  cin>>n;
  vector<pair<int,int>>vec(n);
  for (int i = 0; i < n; i++) {
      cin>>vec[i].first>>vec[i].second;
  }
  for (int i = 0; i <n-2 ; i++) {
      if(check(vec[i].first,vec[i].second,vec[i+1].first,vec[i+1].second,vec[i+2].first,vec[i+2].second)){
          cout<<"Yes\n";
          return;
      }
  }
  cout<<"No\n";
   
  
    
}

int main(){
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout); 
    #endif*/
        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
        int T=1;
        //cin>>T;
        while(T--){
          solve();
        }
        return 0;
        
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
#define int long long
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int N;
int ga, sa, ba, gb, sb, bb;

int solve(int n) {
    int dp[n+1];
    rep(i, n+1) dp[i] = i;
    rep(i, n+1) {
        if (i-ga>=0) dp[i] = max(dp[i], dp[i-ga]+gb);
        if (i-sa>=0) dp[i] = max(dp[i], dp[i-sa]+sb);
        if (i-ba>=0) dp[i] = max(dp[i], dp[i-ba]+bb);
    }
    return dp[n];
}

signed main() {
    cin >> N >> ga >> sa >> ba >> gb >> sb >> bb;
    int M = solve(N);
    swap(ga, gb);
    swap(sa, sb);
    swap(ba, bb);
    cout << solve(M);
}

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

using namespace std;

int main(void){
int N,R;
//int tmp = 3;
//int flag = 0;
//int N;
cin >> N;
cin >> R;
/*
vector<int> sosuu;
sosuu.push_back(2);
int result = 0;

for(int i = 0; i < N; i++){
  cin >> P.data[i];
}
for(int i = 0; i < N; i++){
  cin >> Q.data[i];
}*/

if(N >= 10) cout << R << endl;
if(N < 10) cout << R + 100*(10 - N) << endl;
return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var t=sc.S;
		int n=t.Length;
		bool b=true;StringBuilder sb=new StringBuilder();
		int g=1;
		for(int i = 0;i<n-1;i++) {
			if(i<n/2){
				if(t[i]!=t[n-i-2]){
					b=false;
					break;
				}
			}
			sb.Append(g);sb.Append(" ");sb.Append(i+2);sb.Append("\n");
			if(i<n/2&&t[i]=='1'){g=i+2;}

		}
		if(t[n-1]=='1'||t[0]=='0'){b=false;}
		if(!b){Console.WriteLine("{0}",-1);}
		else{Console.Write(sb);}
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


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

int main() {
  
  int N;
  
  cin >> N;
  
  vector < int >  vec ( N );
  
  for ( int i = 0; i < N; i++ ){
  	cin >> vec.at(i);
  }
  
  sort ( vec.begin(), vec.end() );
  
  reverse ( vec.begin(), vec.end() );
  
  int A,B = 0;
  
  for ( int i = 0; i < N; i++) {
  	if  ( i%2 == 0){
  		A += vec.at ( i );
  	}
  	else{
  		B += vec.at ( i );
  	}
  }

  
  cout << A - B << endl;
  
  
  }



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] a = new char[h][w];
        int[] alpha = new int[26];
        for (int i = 0; i < h; i++) {
            a[i] = sc.next().toCharArray();
            for (int j = 0; j < w; j++) {
                alpha[a[i][j] - 'a']++;
            }
        }
        int g2 = (h / 2) * (w % 2) + (h % 2) * (w / 2);
        int g4 = (h / 2) * (w / 2);
        for (int i = 0; i < alpha.length; i++) {
            g4 -= alpha[i] / 4;
            alpha[i] %= 4;
            g2 -= alpha[i] / 2;
            alpha[i] %= 2;
        }
        if (g4 > 0 || (g2 + 2 * g4) > 0) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }

}


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

int main(){
    string s,t;
    cin >> s >> t;
    int ans = 0;
    rep(i,s.size())if(s.at(i) == t.at(i)) ans++;
    cout << ans << endl;
}

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

#define INF 99999999999
using namespace std;
 
typedef long long ll;

int main(){
    int n, k;
    cin >> n >> k;
	ll x[n];
	for(int i = 0; i < n; i++)cin >> x[i];
	ll ans=INF;
	for(int i = 0; i <= n-k; i++){
		if(x[i] <= 0 && x[i+k-1] >= 0)ans = min(ans, -x[i]+x[i+k-1]+min(-x[i],x[i+k-1]));
		else if(x[i] <= 0 && x[i+k-1] <= 0)ans = min(ans, -x[i]);
		else ans = min(ans, x[i+k-1]);
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pi 3.14159265358979
using namespace std;

void C() {
	double A, B, H, M; cin >> A >> B >> H >> M;

	double vhour_hand, vmin_hand;
	vhour_hand = 2 * pi / 12 / 60;
	vmin_hand = 2 * pi / 60;
	double time = 60 * H + M;

	double temp = vmin_hand * time - vhour_hand * time;
	temp = max(temp, -temp);
	temp = fmod(temp, 2 * pi);
	double diff = min(temp, 2 * pi - temp);

	double ans = sqrt(pow(A, 2) + pow(B, 2) - 2 * A * B * cos(diff));

	
	printf("%.10f\n", ans);
}

void B() {
	int K; cin >> K;
	string s; cin >> s;

	if (s.size() > K) {
		string temp = s.substr(0, K);
		temp += "...";
		cout << temp << endl;
	}
	else {
		cout << s << endl;
	}
}

void A() {
	int N; cin >> N;
	int dig = N % 10;
	if (dig == 3) {
		cout << "bon" << endl;
	}
	else if (dig == 0 or dig == 1 or dig == 6 or dig == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}
}
int main() {
	B();
}

Measured memory_bytes: 3728
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>

using namespace std;

typedef long long LL;
typedef double db;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
int main()
{
	int n , m;
	char mp[MaxN][MaxN];
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i++)
		for(int j = 1 ; j <= m ; j++)
			cin >> mp[i][j];
	for(int i = 0 ; i <= n + 1; i++)
		for(int j = 0 ; j <= m + 1; j++)
			{
				if(i == 0 || j == 0 || j == m + 1 || i == n + 1)
					cout << "#";
				else cout << mp[i][j];
				if(j == m + 1)cout << endl;
			}
	return 0;
	}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define PI 3.1415926535897932384626433832795028
#define INF (1<<29)
#define LINF (1LL<<60)
using namespace std;
using INT = long long;
using P = pair<int,int> ;

int main(){
    int ans=0;
    string s;
    cin >> s;
    
    size_t len = s.size();
    for(int i=0; i<len/2; i++){
        if(s[i]!=s[len-i-1])ans++;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    # A = list(map(int, input().split()))
    A = input().split()

    # b = []
    # for ai in A:
    #     b.append(ai)
    #     b = b[::-1]
    #     # print(b)
    # print(" ".join(b))

    b = []
    for i in range(N - 1, -1, -2):
        b.append(A[i])
    
    if N % 2 == 0:
        for i in range(0, N, 2):
            b.append(A[i])

    else:
        for i in range(1, N, 2):
            b.append(A[i])

    print(" ".join(b))


if __name__ == "__main__":
    main()

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

int main() {
  int N, M;
  cin >> N >> M;
  int64_t A[N+3];
  if(M > 0) {
    int B[M];
    for(int i = 0; i < M; i++) cin >> B[i];
    A[0] = 0;
    A[1] = 0;
    A[2] = 1;
    A[3] = 1;
    for(int i = 4; i <= N; i++) {
      A[i] = (A[i-1] + A[i-2]) % 1000000007;
    }
    int ans = A[B[0] + 1] * A[N - B[M-1] + 1] % 1000000007;
    for(int i = 1; i < M; i++) {
      ans = ans * A[B[i] - B[i-1]] % 1000000007;
    }
    cout << ans << endl;
  }
  else {
    A[0] = 0;
    A[1] = 0;
    A[2] = 1;
    A[3] = 1;
    for(int i = 4; i <= N + 2; i++) {
      A[i] = (A[i-1] + A[i-2]) % 1000000007;
    }
    cout << A[N+2] << endl;
  }
}

Measured memory_bytes: 1408
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<stack>
#include<queue>

using namespace std;

typedef pair<string, int> P;

int main()
{
	int n, q;
	cin >> n >> q;
	
	queue<P> process;

	for (int i = 0; i < n; i++) {
		string str;
		int t;
		cin >> str >> t;
		process.push(P(str, t));
	}

	vector<P> time;
	int total = 0;
	while (!process.empty()) {
		P cur = process.front(); process.pop();
		int k = cur.second - q;
		if (k > 0) {
			process.push(P(cur.first, k));
			total += q;
		}
		else {
			total += cur.second;
			time.push_back(P(cur.first, total));
		}
	}
	for (int i = 0; i < time.size(); i++) {
		cout << time[i].first << " " << time[i].second << endl;
	}

	return 0;
}

Measured memory_bytes: 7084
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int M = Integer.parseInt(sc.next());
    int X = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    
    int x = -1000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      x = x < n ? n : x;
    }
    
    int y = 1000;
    for(int i = 0; i < M; i++){
      int n = Integer.parseInt(sc.next());
      y = y > n ? n : y;
    }
    
    String ans = "War";
    for(int i = x; i <= y; i++){
      if(X < i && x < i && i <= Y && i <= y){
        ans = "No War";
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 22996
def root(v):
    if v == par[v]:
        return v
    par[v] = root(par[v])
    return par[v]

def unite(u, v):
    u = root(u)
    v = root(v)
    if u == v:
        return
    if rank[u] < rank[v]:
        u, v = v, u
    par[v] = u
    if rank[u] == rank[v]:
        rank[u] += 1

def same(u, v):
    return root(u) == root(v)

def kruskal(edges):
    heapq.heapify(edges)
    res = 0
    while edges:
        w, u, v = heapq.heappop(edges)
        if same(u, v):
            continue
        unite(u, v)
        res += w
    return res

import heapq
N = int(input())
X = [() for _ in range(N)]
Y = [() for _ in range(N)]
for i in range(N):
    x, y = map(int, input().split())
    X[i] = (x, i)
    Y[i] = (y, i)
X = sorted(X)
Y = sorted(Y)
E = []
heapq.heapify(E)
for i in range(N-1):
    x, v = X[i]
    nx, nv = X[i+1]
    heapq.heappush(E, (nx-x, v, nv))
    y, u = Y[i]
    ny, nu = Y[i+1]
    heapq.heappush(E, (ny-y, u, nu))

par = list(range(N))
rank = [0] * N
print(kruskal(E))

Measured memory_bytes: 54628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Lining up the cards
 */
public class Main {

	static int n;
	static int k;
	static int[] cards;
	static List<int[]> perms;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			n = parseInt(line);
			if (n == 0) break;

			k = parseInt(br.readLine());
			cards = new int[n];

			for (int i = 0; i < n; i++) {
				cards[i] = parseInt(br.readLine());
			}

			perms = new ArrayList<>();
			perm(0, 0, new int[k]);

			Set<Integer> ns = new HashSet<>();

			for (int[] p : perms) {

				int num = 0;
				for (int i = 0; i < k; i++) {
					if (p[i] < 10) {
						num *= 10;
					} else {
						num *= 100;
					}
					num += p[i];
				}
				ns.add(num);
			}

			System.out.println(ns.size());

		}
	}

	//?????????????????????
	static void perm(int i, int c, int[] p) {
		if (c == k) {
			perm2(0, new int[k], p);
			return;
		}
		if (i < n) {
			int[] _p;
			//
			_p = Arrays.copyOf(p, p.length);
			_p[c] = cards[i];
			perm(i + 1, c + 1, _p);
			//
			_p = Arrays.copyOf(p, p.length);
			perm(i + 1, c, _p);
		}
	}

	//????????\?????????
	static void perm2(int i, int[] q, int[] p) {
		if (i == k) {
			perms.add(q);
			return;
		}
		q[i] = p[i];
		for (int j = i; j >= 0; j--) {
			int[] _q = Arrays.copyOf(q, q.length);
			int tmp = _q[j];
			_q[j] = _q[i];
			_q[i] = tmp;
			perm2(i + 1, _q, p);
		}
	}
}

Measured memory_bytes: 29172
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
  string s;
  cin >> s;
  vector<bool> lc(26, false);
  for(int i = 0; i < s.size(); i++){
    lc[s[i] - 'a'] = true;   
  }
  bool ans = true;
  for(int i = 0; i < 26; i++) {
  	if(lc[i] == false) {
    	ans = false;
        cout << (char)(i + 'a') << endl;
      break;
    }
  }
  if(ans) cout << "None" << endl;
}

Measured memory_bytes: 764
/*
	tips:
		inline
		for(register int i = 0 ; i < n ; i ++){} ????????????????
		 
*/ 



#include<bits/stdc++.h>
// #include<string.h>
/*
	#include<iostream>
	#include<cstring>
	#include<cmath>
	#include<cstdlib>
*/ 
//#pragma comment(linker, "/STACK:1024000000,1024000000")
//	int __size__ = 256<<20;
//	char *__p__ = (char *)malloc(__size__)+__size__;
//	__asm__("movl?%0,%%esp\n"::"r"(__p__));
#define mian main
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b
#define rep(i,n) for(int (i)=0;(i)<n;(i)++)
#define read(n) scanf("%d",&n);
#define readll(n) scanf("%lld",&n);
#define readdb(n) scanf("%lf",&n);
#define readch(n) scanf("%c",&n);
#define readstr(n) scanf("%s",n);
#define test printf("test\n");
#define pb push_back
#define in insert
#define init(n) memset(n,0,sizeof(n));

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef vector<int> VI;
typedef set<int> SI; 
typedef vector<ll> VLL;


int IT_MAX = 1 << 19;
ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
//bool operator < (const p1 & a,const p1 & b)
//{
//	    if(a.x == b.x){
//			return a.y<b.y;
//		}else{
//			return a.x<b.x;
//		}
//}
void lcs(){
	/*
		for(int i = 0 ; i < n ; i ++){
			for(int j = i ; j < n ; j ++){
				if(c[i] == b[j]){
					dp[i+1][j+1] = dp[i][j] + 1;
				}else{
					dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
				}
			}
		}
	*/
}


//inline ll read()
//{
//    ll x=0,f=1;char ch=getchar();
//    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
//    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
//    return x*f;
//}
ll gcd(ll m, ll n)
{
    while(m>0)
    {
        ll c = n % m;
        n = m;
        m = c;
    }
    return n;
} 
//   ll gcd(ll a , ll b){
//    return b?gcd(b,a%b):a;  
//}
double qpow(double a, ll b) {
      double res = 1;
      while(b) {
          if (b & 1) res = res * a;
          a = a * a;
         b >>= 1;
     }
     return res;
}
ll C(ll n,ll x){
	ll ans = 1;
	for(ll i = n , j = 1 ; i >= n-x+1 ; i -- , j ++){
		ans *= i ;
		ans /= j ;
	}
	return ans;
}		

//#define LOCAL_DEFINE
//-O2??? 
//#pragma GCC optimize(2)

//bool cmp(int a,int b){
//    return a > b;
//}
int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	cout.precision(10);
	
	int n;
	cin >> n;
	VI c(n),v(n);
	for(int i = 0; i < n ; i ++){
		cin >> c[i];
	}
	for(int i = 0 ; i < n ; i ++){
		cin >> v[i];
	}
	for(int i = 0 ; i < n ; i ++){
		c[i] -= v[i];
	}
	int ans = 0;
	for(int i = 0 ; i < n ; i ++){
		if(c[i] > 0) ans += c[i];
	}
	cout << ans;
	
	 
	
	
	
	
	
	
	
	
	
	




	 
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	
	
	








	return 0; 
} 

Measured memory_bytes: 256
#include<stdio.h>
int main()
{

    int a,b,k,i,j,z=0,c,count1=0,count2=0;
    scanf("%d%d%d",&a,&b,&c);
    int ara[b],ara2[a+1];

    for(i=0;i<b;i++)
    {
        scanf("%d",&ara[i]);

    }
    for(j=0;j<=a;j++)
    {
        ara2[j]=j;
        
    }

    for(j=1;j<c;j++)
    {
        for(i=0;i<b;i++)
        {
        if(ara2[j]==ara[i])
        {
            count1++;
        }
    }
}
      for(k=c+1;k<a;k++)
      {
          for(i=0;i<b;i++)
        {
        if(ara2[k]==ara[i])
        {
            count2++;
        }
    }
      }


     if(count1>=count2)
     {
         printf("%d\n",count2);
     }
     else
    {
        printf("%d\n",count1);
        }
}




Measured memory_bytes: 1704
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
ll n;int now=0;
vector<int> ans;
void dfs(ll n){
	if(n==1) return;
	if(n&1){
		dfs(n^1);
		ans.insert(ans.begin(),++now);
		return;
	}
	dfs(n>>1);
	ans.push_back(++now);
}
int main(){
	scanf("%lld",&n);
	dfs(n+1);
	printf("%d\n",ans.size()*2);
	for(int i=0;i<ans.size();i++) printf("%d ",ans[i]);
	for(int i=1;i<=now;i++) printf((i==now)?"%d":"%d ",i);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <climits>
#include <set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator
int n,k, x=1;

void solve() {
    cin>>n>>k;
    for(int i=0;i<n;i++) {
        if(x <= k) x *= 2;
        else x += k;
    }
    cout<<x<<endl;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

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

    int counter=1;
    for(int i=0;i<n;i++){
        if(counter==a[i]) counter++;
    }

    if(counter==1){
        cout << -1 << endl;
    }else{
        cout << n-counter+1 << endl;
    }
}

Measured memory_bytes: 4392
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)


N,Q = map(int,input().split())
trees = [[] for _ in range(N+1)]
values = [0 for _ in range(N+1)]

for _ in range(N-1):
  parent,child = map(int,input().split())
  trees[parent].append(child)
  trees[child].append(parent)

for _ in range(Q):
  node_num,value = map(int,input().split())
  values[node_num] += value

def recursive_func(i,parent):
  for child in trees[i]:
    if child == parent:
      continue
    values[child] += values[i]
    recursive_func(child,i)

recursive_func(1,-1)
print(*values[1:])



Measured memory_bytes: 231060
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 100000000;
using namespace std;

int main(){
    int n;
    cin >> n;
    rep(i,n){
        list<char> li;
        list<char>::iterator it;
        string order, s, temp;
        cin >> temp >> s;
        rep(j,s.size()) li.emplace_back(s[j]);
        for(int j = temp.size() - 1; j >= 0; j--) order += temp[j];
        rep(j,order.size()){
            if(order[j] == 'C'){
                li.emplace_back(*li.begin());
                li.pop_front();
            }else if(order[j] == 'J'){
                li.emplace_front(*(--li.end()));
                li.pop_back();
            }else if(order[j] == 'E'){
                int m = li.size();
                rep(k, m / 2){
                    li.emplace_back(*li.begin());
                    li.pop_front();
                }
                if(m % 2){
                    it = li.begin();
                    rep(k, m / 2 + 1) *it++;
                    li.insert(it, *li.begin());
                    li.pop_front();
                }
            }else if(order[j] == 'A'){
                li.reverse();
            }else if(order[j] == 'M'){
                for(it = li.begin(); it != li.end(); it++){
                    if(*it >= '0' && *it <= '8') *it = *it + 1;
                    else if(*it == '9') *it = '0';
                }
            }else if(order[j] == 'P'){
                for(it = li.begin(); it != li.end(); it++){
                    if(*it >= '1' && *it <= '9') *it = *it - 1;
                    else if(*it == '0') *it = '9';
                }
            }
        }
        for(auto t: li){
            cout << t;
        }
        cout << endl;
    }
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n, m, ans;
  scanf("%d%d", &n, &m);
  for(int i = 1; i*i <= m; i++){
    if(m % i == 0){
      if(i < n){
        if(m/i >= n) ans = i;
      }else{
        ans = m/i;
        break;
      }
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 256
/*input
8
7 5 1 1 7 3 5 3
*/

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main()
{

	int N;
	cin >> N;

	vector<int> A(N);
	map<int, int> B;
	for(int i=0;i<N;i++){
		cin >> A[i];
		B[A[i]]++;
	}

	long long ans = 1;

	if(N & 1){
		if(B.count(0) != 1){
			cout << 0 << endl;
			return 0;
		}
		for(auto m:B){
			if(m.first == 0) continue;
			if((m.first % 2 != 0) || (m.second != 2)){
				cout << 0 << endl;
				return 0;
			}
			ans *= m.second;
			ans %= 1000000007;
		}
	}else{
		for(auto m:B){
			if((m.first % 2 == 0) || (m.second != 2)){
				cout << 0 << endl;
				return 0;
			}
			ans *= m.second;
			ans %= 1000000007;
		}
	}

	cout << ans << endl;

	return 0;
}


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

int digit(int x) {
  int res = 0;
  for (; x; x /= 10) res += x % 10;
  return res;
}

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

  int N; cin >> N;
  int count = 0;
  for (int x = 11; x <= 55555; x += 5) {
    bool flag = false;
    for (int i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        flag = true;
        break;
      }
    }
    if (!flag) {
      if (count == 0) cout << x;
      else if (count < N) cout << " " << x;
      if (++count == N) break;
    }
  }
  cout << "\n";
}

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

typedef long long ll;
typedef long double ld;

const int MAXN = 2007;

char a[MAXN][MAXN];

int go[MAXN][MAXN], goRight[MAXN][MAXN], goDown[MAXN][MAXN];

void make(int a[MAXN][MAXN], int n, int m) {
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + a[i][j];
		}
	}
}

int ask(int a[MAXN][MAXN], int x1, int y1, int x2, int y2) {
	return a[x2][y2] - a[x1 - 1][y2] - a[x2][y1 - 1] + a[x1 - 1][y1 - 1];
}
int main()
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n, m, q;
	scanf("%d %d %d", &n, &m, &q);
	for (int i = 1; i <= n; i++)
	{
		scanf("%s", a[i]);
		for (int j = m; j >= 1; j--) {
			a[i][j] = a[i][j - 1];
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (a[i][j] == '1') {
				go[i][j] = 1;
			}
			if (a[i][j] == '1' && a[i][j + 1] == '1') {
				goRight[i][j] = 1;
			}
			if (a[i][j] == '1' && a[i + 1][j] == '1') {
				goDown[i][j] = 1;
			}
		}
	}
	make(go, n, m);
	make(goDown, n, m);
	make(goRight, n, m);
	for (int i = 1; i <= q; i++) {
		int x1, y1, x2, y2;
		scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
		int res = ask(go, x1, y1, x2, y2) - ask(goRight, x1, y1, x2, y2 - 1) - ask(goDown, x1, y1, x2 - 1, y2);
		printf("%d\n", res);
	}
}



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

#define ll long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int MAX = 1e5 + 5;

int main()
{
	IOS
	int t = 1;
	//cin >> t;
	while(t--)
	{
		string s, t;
		cin >> s >> t;
		int ct = 0;
		for(int i = 0; i < s.length(); ++i)
		{
			if(s[i] != t[i]) ct += 1;
		}
		cout << ct << endl;
	}
	return 0;
}


Measured memory_bytes: 3796
#include <iostream>

using namespace std;

int main(){

  int n, m;
  
  cin >> n;

  int x[n];  

  for(int i = 0; i < n; i++){
    cin >> x[i];
  }

  cin >> m;

  for(int i = 0; i < m; i++){
    int tmp;
    cin >> tmp;
    if(x[tmp-1] == 2019){
      continue;
    }
    if((x[tmp-1] + 1) != x[tmp]){
      x[tmp-1]++;
    }
  }



  for(int i = 0; i < n; i++){
    cout << x[i] << '\n';
  }
  
  
  return 0;
}



Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <string.h>
using namespace std;

int N,M,s,t,Q;
vector<vector<int>> v(100010),rv(100010);
vector<int> rs;
int visited[100010] = {},cmp[100010] = {};

void dfs(int n){
    visited[n] = 1;
    for(auto x:v[n]) if(!visited[x]) dfs(x);
    rs.push_back(n);
}

void rdfs(int n,int cnt){
    visited[n] = 1;
    cmp[n] = cnt;
    for(auto x:rv[n]) if(!visited[x]) rdfs(x,cnt);
}

void scc(){
    memset(visited,0,sizeof(visited));
    for(int i=1;i<=N;i++) if(!visited[i]) dfs(i);
    memset(visited,0,sizeof(visited));
    int now = 1;
    for(int i=rs.size()-1;i>=0;i--) if(!visited[rs[i]]) rdfs(rs[i],now++);
}

int main(){
    cin >> N >> M;
    for(int i=0;i<M;i++){
        cin >> s >> t;
        s++; t++;
        v[s].push_back(t);
        rv[t].push_back(s);
    }
    scc();
    cin >> Q;
    for(int i=0;i<Q;i++){
        cin >> s >> t;
        s++; t++;
        cout << (cmp[s]==cmp[t]? 1:0) << endl;
    }
}


Measured memory_bytes: 9348
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define reo(i,n) for(int (i) = 1 ; (i) <= (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(i,n) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'a')
#define itoc(c) (char)(c+'a')
#define pb push_back
#define cauto const auto&
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
const vec<int>dx{ 0,0,-1,1 }, dy{ 1,-1,0,0 };
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------------------
int n, k, s;
signed main() {
	cin >> n >> k >> s;
	rep(i, k) cout << s << ssp(i, n);
	int r = 1;
	for (int i = 2; i * i <= s; i++) {
		if (s % i) r = i;
	}
	rep(i, n-k) {
		if (r == 1) cout << s + 1 << ssp(i, n - k);
		else cout << r << ssp(i, n - k);
	}
}

Measured memory_bytes: 1280