akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
  int n,i,j,d[6]={0};
  double h;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf",&h);
    if     (h<165.0)d[0]++;
    else if(h<170.0)d[1]++;
    else if(h<175.0)d[2]++;
    else if(h<180.0)d[3]++;
    else if(h<185.0)d[4]++;
    else            d[5]++;
  }
  for(i=0;i<6;i++){
    printf("%d:",i+1);
    for(j=0;j<d[i];j++){
      printf("*");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int N,X;
	cin>>N>>X;
	int x=0,res=1;
	rep(i,0,N) {
		int l;
		cin>>l;
		x+=l;
		if (x<=X) res++;
	}
	cout<<res<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <limits>

using namespace std;

using i64 = long long int;
using P = pair<i64, i64>;

struct edge {
    i64 from, to, cost;
    edge(i64 from, i64 to) : from(from), to(to), cost(1) {}
    edge(i64 from, i64 to, i64 cost) : from(from), to(to), cost(cost) {}
};
using Graph = vector<vector<edge>>;

constexpr i64 SINF = std::numeric_limits<i64>::max() / 10;
const i64 MOD = 1000000007;
const i64 dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
//const i64 dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//const i64 dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//const i64 dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main() {
    int n, x;
    cin >> n >> x;
    i64 pos = 0;
    i64 ans = 1;
    for (int i = 0; i < n; ++i) {
        i64 l;
        cin >> l;
        pos += l;
        if(pos <= x) ++ans;
    }
    cout << ans << endl;
 }

Measured memory_bytes: 256
def InsertionSort(A, n, g):
    global count
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            count += 1
        A[j+g] = v

def ShellSort(A, n):
    G =[1]
    while True:
        g = 3*G[0] + 1
        if g > n:
            break
        G.insert(0, g)
    m = len(G)
    for i in range(m):
        InsertionSort(A, n, G[i])
    return [m, G]

N = int(input())

A = [int(input()) for i in range(N)]
count = 0
m, G = ShellSort(A, N)
print(m)
print(*G)
print(count)
for i in A:
    print(i)


Measured memory_bytes: 45520
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define input(array) repi(array##_itr, array) { cin >> *(array##_itr); }
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Three" : "Four"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int ans=0;
	cin >>n;
	vector<char> s(n);
	input(s);
	set<char> dis;
	repi(itr, s) { dis.insert(*itr); }
	
	cout<<solve(dis.size()==3)<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main(){
	int n;
	cin>>n;
	ll prev=0;
	ll a;
	ll ans=0;
	for(int i=0;i<n;++i){
		cin>>a;
		if(a<prev){
			ans+=(prev-a);
			a=prev;
		}
		prev=a;
	}
	cout<<ans;
}


Measured memory_bytes: 3628
while true
	n = gets.chomp.to_i
	break if n == 0
	a = Array.new(n, 0)
	n.times do
		b = gets.chomp.split("\s").map {|v| v.to_i}
		x = 0
		b.each_with_index do |v, i|
			printf("%5d", v)
			x = x + v
			a[i] = a[i] + v
		end
		printf("%5d\n", x)
	end
	x = 0
	a.each do |v|
		printf("%5d", v)
		x = x + v
	end
	printf("%5d\n", x)
end

Measured memory_bytes: 8808
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int A[] = new int[n];
    for(int i = 0; i < n; i++){
      A[i] = Integer.parseInt(sc.next());
    }
    int q = Integer.parseInt(sc.next());
    int m[] = new int[q];
    int max = 0;
    for(int i = 0; i < q; i++){
      m[i] = Integer.parseInt(sc.next());
      if(m[i] > max){
        max = m[i];
      }
    }
    int dp[][] = new int[n + 1][max + 1];
    for(int j = 0; j < n + 1; j++){
      for(int k = 0; k < max + 1; k++){
        dp[j][k] = 0;
       }
    }
    dp[0][0] = 1;
    for(int j = 0; j < n; j++){
      for(int k = 0; k < max + 1; k++){
        if(k >= A[j] && dp[j][k - A[j]] == 1){
          dp[j + 1][k] = 1;
        }
        else if(dp[j][k] == 1){
          dp[j + 1][k] = 1;
        }
      }
    }
    for(int i = 0; i < q; i++){
      if(dp[n][m[i]] == 1){
        System.out.println("yes");
      }
      else{
        System.out.println("no");
      }
    }
  }
}


Measured memory_bytes: 26584
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
int n,k;
vector<int> G[100005];
int val[100005];
bool vis[100005];
pair<int,int> dp[100005];
void check(int x,int flag){
	vis[x]=true;
	if (val[x]!=-1){
		if (flag==-1){
			flag=1-(val[x]%2);
		}
		else if (val[x]%2!=flag){
			cout<<"No\n";
			exit(0);
		}
		else{
			flag=1-(val[x]%2);
		}
	}
	else{
		if (flag!=-1){
			flag=1-flag;
		}
	}
	for (int i=0;i<G[x].size();i++){
		if (vis[G[x][i]]){
			continue;
		}
		check(G[x][i],flag);
	}
}
pair<int,int> get(pair<int,int> a,pair<int,int> b){
	if (a.first==-1e9 || b.first==-1e9){
		return make_pair(-1e9,-1e9);
	}
	if (a.first>b.first){
		swap(a,b);
	}
	if (a.second<b.first){
		return make_pair(-1e9,-1e9);
	}
	else{
		return make_pair(b.first,min(a.second,b.second));
	}
}
void dfs(int x){
	vis[x]=true;
	int left=-1e8;
	int right=1e8;
	vector<int> V;
	if (val[x]!=-1){
		left=val[x];
		right=val[x];
	}
	for (int i=0;i<G[x].size();i++){
		if (vis[G[x][i]]){
			continue;
		}
		dfs(G[x][i]);
		pair<int,int> tmp=get(make_pair(left,right),make_pair(dp[G[x][i]].first-1,dp[G[x][i]].second+1));
		left=tmp.first;
		right=tmp.second;
	}
	if (left==-1e9){
		cout<<"No\n";
		exit(0);
	}
	dp[x]=make_pair(left,right);
}
void Dfs(int x,int left,int right){
	dp[x]=get(dp[x],make_pair(left,right));
	val[x]=dp[x].first;
	vis[x]=true;
	for (int i=0;i<G[x].size();i++){
		if (vis[G[x][i]]){
			continue;
		}
		Dfs(G[x][i],val[x]-1,val[x]+1);
	}
}
int main(){
	scanf("%d",&n);
    for (int i=1;i<=n-1;i++){
    	int a,b;
    	cin>>a>>b;
    	G[a].push_back(b);
    	G[b].push_back(a);
    }
    memset(val,-1,sizeof(val));
    scanf("%d",&k);
    for (int i=1;i<=k;i++){
    	int node,v;
    	scanf("%d%d",&node,&v);
    	val[node]=v;
    }
    memset(vis,0,sizeof(vis));
    check(1,-1);
    memset(vis,0,sizeof(vis));
    dfs(1);
    cout<<"Yes\n";
    memset(vis,0,sizeof(vis));
    Dfs(1,-1e8,1e8);
    for (int i=1;i<=n;i++){
    	cout<<val[i]<<endl;
    }
    return 0;
}

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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int main()
{
    #ifdef FILEs
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    int n;
    int m;
    cin >> n >> m;
    cout << (n * (n - 1)) / 2 + (m * (m - 1)) / 2 << "\n";
}



Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = Array.fill(5)(sc.nextInt())
    val K = sc.nextInt()
    val r = N.combinations(2).exists { case Array(a, b) => Math.abs(a - b) > K }
    if (r) println(":(") else println("Yay!")
  }

}


Measured memory_bytes: 25540
d, g = [int(x) for x in raw_input().split()]
p, c = zip(*[[int(x) for x in raw_input().split()] for i in range(d)])

from itertools import product

ans = 100000000000000000000

for ss in product([False, True], repeat=d):
    m = 0
    s = 0
    for i in range(d):
        if ss[i]:
            s += (i + 1) * 100 * p[i] + c[i]
            m += p[i]

    for i in reversed(range(d)):
        if s >= g:
            break
        if ss[i] is False:
            t = min(p[i] - 1, -(-(g - s) // ((i + 1) * 100)))
            s += (i + 1) * 100 * t
            m += t

    if s < g:
        continue

    ans = min(ans, m)

print ans


Measured memory_bytes: 2696
from collections import defaultdict

dict=defaultdict(int)

N=int(input())
for i in range(N):
  s=input()
  dict[s]+=1

M=int(input())
for i in range(M):
  s=input()
  dict[s]-=1

ans=0
for a,b in dict.items():
  ans=max(ans,b)
print(ans)

Measured memory_bytes: 3316
import java.io.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(in.readLine());
		BigInteger a,b;
		for (int i = 0; i < N; i++) {
			a = new BigInteger(in.readLine());
			b = new BigInteger(in.readLine());
			if(a.toString().length()>80||b.toString().length()>80){
				System.out.println("overflow");
				continue;
			}
			a=a.add(b);
			if(a.toString().length()>80)
				System.out.println("overflow");
			else {
				System.out.println(a.toString());
			}
		}
	}
}

Measured memory_bytes: 18480
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
  int n, W;
  cin>>n>>W;
  int* w = new int[n];
  int* v = new int[n];
  for(int i=0; i<n; i++)
    cin>>w[i]>>v[i];
  int** dp = new int*[n+1];
  for(int i=0; i<=n; i++)
    	dp[i] = new int[W+1];
  for(int i=0; i<=n; i++){
    for(int j=0; j<=W; j++){
      if(i == 0 || j == 0)
        	dp[i][j] = 0;
      else if( w[i-1] <= j)
        dp[i][j] = max(dp[i-1][j-w[i-1]] + v[i-1], dp[i-1][j]);
      else
        	dp[i][j] = dp[i-1][j];
    }
  }
  cout<<dp[n][W];
  return 0;
}

Measured memory_bytes: 79488
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, K;
    string S;
    cin >> N >> K >> S;
    vector<int> nums;
    int now = 1;
    int cnt = 0;
    rep(i, 0, N)
    {
        if (S[i] == '0' + now)
        {
            ++cnt;
        }
        else
        {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0)
    {
        nums.push_back(cnt);
    }

    if (nums.size() % 2 == 0)
    {
        nums.push_back(0);
    }

    const int add = 2 * K + 1;

    int ans = 0;

    int left = 0;
    int right = 0; // [left, right) の sum
    int tmp = 0;

    for (int i = 0; i < nums.size(); i += 2)
    {
        int nextLeft = i;
        int nextRight = min(i + add, (int)nums.size());

        while (nextLeft > left)
        {
            tmp -= nums[left];
            ++left;
        }

        while (nextRight > right)
        {
            tmp += nums[right];
            ++right;
        }

        ans = max(tmp, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1020
#include<cstdio>
#include<algorithm>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')w=0,ch=getchar();
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
const int N=405;
int n,m,x[N*N],y[N*N],f[N][N],g[N],ans;
int work(int *dp){
	for(int i=m;i;--i){
		if(dp[x[i]]&&dp[y[i]])return 1;
		if(dp[x[i]]||dp[y[i]])dp[x[i]]=dp[y[i]]=1;
	}
	return 0;
}
int main(){
	n=gi();m=gi();
	for(int i=1;i<=m;++i)x[i]=gi(),y[i]=gi();
	for(int i=1;i<=n;++i)f[i][i]=1,g[i]=work(f[i]);
	for(int i=1;i<=n;++i)
		if(!g[i])
			for(int j=i+1;j<=n;++j)
				if(!g[j]){
					int fg=1;
					for(int k=1;k<=n;++k)fg&=!(f[i][k]&f[j][k]);
					ans+=fg;
				}
	printf("%d\n",ans);return 0;
}


Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
class Program
{
    static void Main()
    {
        int[] inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int dx = inputs[2] - inputs[0];
        int dy = inputs[3] - inputs[1];
        for (int i = 0; i < dx; i++)
            Console.Write('R');
        for (int i = 0; i < dy; i++)
            Console.Write('U');
        for (int i = 0; i < dx; i++)
            Console.Write('L');
        for (int i = 0; i <= dy; i++)
            Console.Write('D');
        for (int i = 0; i <= dx; i++)
            Console.Write('R');
        for (int i = 0; i <= dy; i++)
            Console.Write('U');
        Console.Write("LU");
        for (int i = 0; i <= dx; i++)
            Console.Write('L');
        for (int i = 0; i <= dy; i++)
            Console.Write('D');
        Console.WriteLine('R');
    }
}

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

#define X(a) (a=='X'?i:a-'0')

int resX(char *p[3]){
	int c[10]={0},i,x[10]={0};
	while(*p[2]){
		for(i=0;i<10;i++)
			if(X(*p[0]) + X(*p[1]) + c[i] == X(*p[2])) c[i] = 0;
			else if(X(*p[0]) + X(*p[1]) - 10 + c[i] == X(*p[2])) c[i] = 1;
			else x[i] = 1;
			p[0]++;p[1]++;p[2]++;
	}
	for(i=0;i<10;i++) if(!x[i]) return i;
	return -1;
}

void sstrrev(char *p){
	char c,*t = p + strlen(p)-1;
	while(p<t){
		c=*t;*t=*p;*p=c;
		p++;t--;
	}
}

int main(){
	long i,j,n;
	char buf[150], p;
	while(fgets(buf, 130, stdin)){
		char *p, *num[3], sp[3][150]={{0},{0},{0}},f=0;
		sstrrev(buf);
		num[2] = buf+1;
		*(p=strchr(buf, '='))=0;
		num[1]=++p;
		*(p=strchr(p, '+'))=0;
		num[0]=++p;
		if((num[0][strlen(num[0])-1]=='X' && strlen(num[0]) != 1) ||
		   (num[1][strlen(num[1])-1]=='X' && strlen(num[0]) != 1) ||
		   (num[2][strlen(num[2])-1]=='X' && strlen(num[0]) != 1)) f=1;
//		cout << num[0] << "," << num[1] << "," << num[2] << endl;
		strcpy(sp[0], num[0]);
		for(i=strlen(sp[0]);i<126;i++) sp[0][i] = '0';
		strcpy(sp[1], num[1]);
		for(i=strlen(sp[1]);i<126;i++) sp[1][i] = '0';
		strcpy(sp[2], num[2]);
		num[0]=sp[0];num[1]=sp[1];num[2]=sp[2];
//		cout << num[0] << "," << num[1] << "," << num[2] << endl;
		int ret = resX(num);
		if((f && ret == 0) || ret < 0) cout << "NA" <<endl;
		else cout << ret <<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] ABC = str.split(" ");
        int ans = Integer.parseInt(ABC[1])/Integer.parseInt(ABC[0]);
        if (ans > Integer.parseInt(ABC[2])){
            ans = Integer.parseInt(ABC[2]);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const long long MOD = 1000000007;
template<typename T>
T modpow(T a,unsigned long long b){
  T base=a,ans=T(1LL);
  while(b){
    if(b&1){
      ans=ans*base%MOD;
    }
    base=base*base%MOD;
    b>>=1;
  }
  return ans;
}
ll sign(ll x){
  return (x%2==0?1:-1);
}
ll SumPrime(ll x){
  ll ret=0;
  ll cpy=x;
  vector<ll> tmp;
  for (ll i = 2; i*i <= x; i+=2)
  {
    if(x%i==0){
      tmp.push_back(i);
      while(x%i==0){
        x/=i;
      }
    }
    if(i==2)--i;
  }
  if(x>1)tmp.push_back(x);
  REP(1LL<<tmp.size()){
    ll prod=1;
    for (ll ii = i,j=0; ii > 0;++j, ii>>=1)
    {
      if(ii&1)prod*=tmp[j];
    }
    ret+=sign(__builtin_popcountll(i))*(cpy/prod);
    ret%=MOD;
  }
  return ret;
}
void solve(long long N, long long K){
  ll ans=0;
  FOR(i,1,K+1){
    ll num=K/i,sum=SumPrime(i);
    ans=ans+sum*modpow(num,N)%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
//#define int ll
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back

void solve()
{
    int n, m; cin>>n>>m;
    int c = 0;
    int lf = 0, rg = n-1;
    int f = 0;
    while(c<m)
    {
        int delta = rg - lf;
        if (delta<=n/2 &&n%2==0 &&f==0)
        {
            f=1;
            --rg;
            continue;
        }
        cout << lf + 1 << ' ' << rg  + 1 << '\n';
        ++c;
        ++lf, --rg;
    }

}

signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    //cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll H,W;
    cin >> H >> W;
    if(H%3==0 || W%3==0){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1e18;
    cmin(ans, W);
    cmin(ans, H);
    REP(h,1,H){
        ll c = (H-h)*W;
        ll a = h*(W/2);
        ll b = h*(W/2 + W%2);
        ll M = max(a,max(b,c));
        ll m = min(a,min(b,c));
        cmin(ans,M-m);
    }
    swap(H,W);
    REP(h,1,H){
        ll c = (H-h)*W;
        ll a = h*(W/2);
        ll b = h*(W/2 + W%2);
        ll M = max(a,max(b,c));
        ll m = min(a,min(b,c));
        cmin(ans,M-m);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int main(){
	int l,r;
	scanf("%d%d",&l,&r);
	/*while(t--){
		
		
		
	}*/
	if(l>10) printf("%d",r);
	else printf("%d",r+100*(10-l));




	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

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

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

vector<ll> A;

int main(void) {
    ll K, N;
    cin >> K >> N;

    A.resize(N + 1);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    A[N] = K + A[0];

    ll ans = K;
    for (int i = 1; i <= N; i++) {
        chmin(ans, K - (A[i] - A[i - 1]));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ull unsigned long long
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;
long long GCD(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main() {
	int N, i, count = 0;
	ll absmin = 1000000001,ans=0;
	vector<int> A(100000);
	cin >> N;
	REP(i, N) {
		cin >> A[i];
		if (A[i] < 0)
			count++;
		if (absmin > abs(A[i]))
			absmin = abs(A[i]);
	}
	REP(i, N) {
		ans += abs(A[i]);
	}
	if ((count % 2) == 1)
		ans -= 2 * absmin;
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int ans = (1<<m) * (1900 * m + 100 * (n - m));
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <cstdint>

using namespace std;

int main() {
  int h, w;
  cin >> h >> w;
  
  uint8_t *field = new uint8_t[h * w];
  uint16_t *hbeam = new uint16_t[h * w];
  uint16_t *vbeam = new uint16_t[h * w];
  
  vector<string> fields;
  
  for (int r = 0; r < h; ++r) {
    string rs;
    cin >> rs;
    fields.push_back(rs);
  }
  
  // horizontal
  for (int i = 0; i < h; ++i) {
    int bc = 0, bs = 0;
    for (int j = 0; j < w; ++j) {
      if (fields[i][j] == '#') {
        for (int k = bs; k < j; ++k) hbeam[w * i + k] = bc;
        bs = j + 1;
        bc = 0;
      } else {
        ++bc;
      }
    }
    for (int k = bs; k < w; ++k) hbeam[w * i + k] = bc;
  }
  
  // horizontal
  for (int i = 0; i < w; ++i) {
    int bc = 0, bs = 0;
    for (int j = 0; j < h; ++j) {
      if (fields[j][i] == '#') {
        for (int k = bs; k < j; ++k) vbeam[w * k + i] = bc;
        bs = j + 1;
        bc = 0;
      } else {
        ++bc;
      }
    } 
    for (int k = bs; k < h; ++k) vbeam[w * k + i] = bc;
  }
  
  int maxb = 0;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      maxb = max(maxb, hbeam[w * i + j] + vbeam[w * i + j] - 1);
    }
  }
  
  cout << maxb << endl;
  
  return 0;
}

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

int main(){
	//std::vector<int> vegetables;
	int num,cap,price,i;

	while(std::cin >> num >> cap){

		if(num == 0 && cap == 0){
			break;
		}

		std::vector<int> vegetables;
		int sum = 0;

		for(i=0; i<num; ++i){
			std::cin >> price;
			vegetables.push_back(price);
		}

		sort(vegetables.begin(), vegetables.end(), std::greater<int>());

		i = 0;

		while(i < num){

			if((i+1) % cap != 0){
				sum += vegetables.at(i);
			}

			++i;
		}

		std::cout << sum << std::endl;

		//vegetables.clear();
	}

}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll at_amari = 1000000007; //10^9 + 7 

ll kaizyo(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    sum = sum % at_amari;
  }

  return sum;
}

int main(){
  int n,m; cin >> n >> m;
  ll n_zyun = kaizyo(n),m_zyun = kaizyo(m),ans = 0;
  //cout << n_zyun << ' ' << m_zyun << endl;
  
  if(abs(n - m) > 1) {
    ans = 0;
    //cout << 1 << endl;
  }
  else if(n < m || n > m) {
    ans = n_zyun * m_zyun;
    //cout << 12 << endl;
  }
  else if(n == m) {
    ans = n_zyun * m_zyun * 2;
    //cout << 1123 << endl;
  }

  ans = ans % at_amari;
  

  cout << ans << endl;
  
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long ll;

int main() {
	int h[4][3][10] = {0};
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		int a, b, c, v; cin >> a >> b >> c >> v;
		--a, --b, --c;
		h[a][b][c] += v;
	}

	for (int a = 0; a < 4; ++a) {
		if (a) cout << "####################" << endl;
		for (int b = 0; b < 3; ++b) {
			for (int c = 0; c < 10; ++c) {
				cout << " ";
				cout << h[a][b][c];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1164
<?php

$input = explode(' ', trim(fgets(STDIN)));
$input = array_map('intval', $input);

$x = $input[2] - $input[0];
$y = $input[3] - $input[1];
$result = '';

for($i = 0; $i < 2; $i++){

    $x += $i;
    $y += $i;

    $result .= str_repeat('L', $i);
    $result .= str_repeat('U', $y);
    $result .= str_repeat('R', $x);
    $result .= str_repeat('D', $i);
    $result .= str_repeat('R', $i);
    $result .= str_repeat('D', $y);
    $result .= str_repeat('L', $x);
    $result .= str_repeat('U', $i);

}

print $result;

Measured memory_bytes: 4728
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
int main() {
    ll n,a,b;
    cin >> n>>a>>b;
    // AB.
    // A.B
    // .AB
    if( (b-a)%2==0){
        cout << "Alice" << endl;
        return 0;
    }else{
        cout<<"Borys"<<endl;
        return 0;
    }
    // A..B
    // .A.B
    // .AB.
    // A.....
    // .A..B
    // A...B
    // A...B.
    // .A..B.
    // .A.B..
    // .AB..
    // A.B..
    // AB...

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
const int N=2e5+5;
using namespace std;
ll a[N];
ll sum[N];
ll ksm(ll a,ll b)
{
    ll ans=1;
    for(;b;b>>=1,a=a*a%mod) if(b&1) ans=ans*a%mod;
    return ans;
}
int main()
{
    ll n;
    cin>>n;
    sum[0]=0;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
        sum[i]=(a[i]+sum[i-1])%mod;
    }
    ll ans=0;
    for(int i=1;i<=n-1;i++)
    {
        ans=(ans+a[i]*(sum[n]-sum[i]+mod))%mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6748
#include <stdio.h>

#define MAX 3

int main(void){
    char x,y;
    int ball=0;
    int i,j;
    
    while(scanf("%c,%c\n",&x,&y)==2){
        i=x-'A';
        j=y-'A';
        if(ball==i)ball=j;
        else if(ball==j)ball=i;
    }
    
    for(i=0;i<MAX;i++){
        if(ball==i){
            printf("%c\n",'A'+i);
            break;
        }
    }
    
    return 0;
}



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

int main() {
    int N;
    cin >> N;
    int n = N % 10;
    if ((n == 2) or (n == 4) or (n == 5) or (n == 7) or (n == 9)) cout << "hon" <<endl;
    else if ((n == 0) or (n == 1) or (n == 6) or (n == 8)) cout << "pon" << endl;
    else if (n == 3) cout << "bon" << endl;

}

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

int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int w = 0;//線より左の白
  int r = 0;//線より右の垢
  int ans = 200001;//高々20万
  
  for(int i = 0; i < N; i++){
    if(s.at(i) == 'R') r++;
    
    ans = r;
  }
  
  for(int i = 0; i < N; i++){
    if(s.at(i) == 'W') w++;
    else r--;
    if(ans > max(r,w)) ans = max(r,w);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3708
def main():
    N, M = map(int, input().split())
    S = input()[::-1]
    cur = 0
    i = 1
    ans = []
    while cur < N:
        cand = 0
        while i <= M and cur + i <= N:
            if S[cur + i] == "0":
                cand = i
            i += 1
        if cand == 0:
            print(-1)
            return
        ans.append(cand)
        i -= cand + 1
        cur += cand
    print(*ans[::-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 50288
#include<bits/stdc++.h>
#include<string.h>
#define pb push_back
#define all(v) v.begin(),v.end()
#define see(x) cout<<#x<<" : "<<x<<endl;
#define ya cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
typedef long long ll;
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    //freopen("test.txt","r",stdin);

        ll n,i,j,ans=1,ck=0,an=0;
        cin>>i>>j;
        printf("%lld",i*j);


    return 0;
}


Measured memory_bytes: 3784
rect (h:w:_) = [if even y then tail xs else init xs | y <- [0..h-1]]
    where xs = [if even x then '.' else '#'| x <- [0..w]]

main=do
    line <- fmap (map (map read . words) . lines) getContents
    mapM_ putStrLn . map (unlines . rect) $ takeWhile (\(x:xs)->x/=0) line


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

int main() {
    int x, ans = 1;
    cin >> x;
    if (400 <= x && x <= 599) ans = 8;
    else if (600 <= x && x <= 799) ans = 7;
    else if (800 <= x && x <= 999) ans = 6;
    else if (1000 <= x && x <= 1199) ans = 5;
    else if (1200 <= x && x <= 1399) ans = 4;
    else if (1400 <= x && x <= 1599) ans = 3;
    else if (1600 <= x && x <= 1799) ans = 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mn=60;
const ll mod=1000000007;
int n; ll ans=1;
char s[mn],s1[mn];
int main() {
	scanf("%d %s %s",&n,s,s1);
	int i=0;
	bool T=0;
	while (i<n) {
		if (s[i]==s[i+1]) {
			if (i==0)
				ans*=6;
			else {
				if (s[i-1]==s1[i-1])
					ans*=2;
				else ans*=3;
			}
			i+=2;
		}
		else {
			if (i==0)
				ans*=3;
			else {
				if (s[i-1]!=s1[i-1])
					ans*=1;
				else ans*=2;
			}
			i++;
		}
		ans%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <cstring>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rep(i,n) for(int i=0;i<(int)n;i++)

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};

const double EPS = 1e-9;

int main(){
    cout << fixed << setprecision(10);
    int N;
    cin >> N;
    vector<point> ps(N);
    for(int i=0;i<N;i++){
        cin >> ps[i].real() >> ps[i].imag();
    }
    if(N % 2 == 0){
        point p = ps[0] + ps[N/2];
        bool ok = true;
        for(int i=0;i<N/2;i++){
            point np = ps[i] + ps[i+N/2];
            if(abs(p-np) > EPS){
                ok = false;
            }
        }
        if(ok){
            cout << (p/2.0).real() << " " << (p/2.0).imag() << endl;
        }else{
            cout << "NA" << endl;
        }
    }else{
        cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 1308
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    string S; cin >> S;
    set<char> s;
    map<char, int> mp;
    int cnt = 0;
    rep(i, 4) {
        if(s.find(S[i]) == s.end()) {
            cnt ++;
            s.insert(S[i]);
        }
      mp[S[i]] ++;
    }
    if(cnt == 2 && mp[S[0]] == 2 && mp[S[1]] == 2 && mp[S[2]] == 2) {
        Yes();
    }
    No();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#define INF 100000000
#define _INF -100000000
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> P;
 
char advance(char c, int x) {
	c = c - 26 + x;
	if (c < 'a') c += 26;
	return c;
}

int main() {
	string s; cin >> s;
	int k; cin >> k;
	Loop(i, s.length()) {
		if (i == s.length() - 1) {
			s[i] = advance(s[i], k % 26);
		}
		else {
			if (s[i] == 'a') continue;
			int x = 'z' + 1 - s[i];
			if (k >= x) {
				s[i] = advance(s[i], x);
				k -= x;
			}
		}
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
    char befour, after, now = 'A';
    while(scanf("%c,%c",&befour,&after) != EOF) {
        getchar();
        if(befour == now) {
            now = after;
        } else if(after == now) {
            now = befour;
        }
    }
    printf("%c\n",now);
    return 0;
}

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

int main() {
    int n, ans = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int i = 0; i < n-1; ++i) {
        if(a[i] == i+1) {
            swap(a[i], a[i+1]);
            ans++;
        }
    }
    if(a[n-1] == n) ans++;
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 640
N = int(input())
W = []
for _ in range(N):
    W.append(input())

if len(set(W)) != len(W):
    print("No")
    exit(0)

for i in range(N-1):
    if W[i][-1] != W[i+1][0]:
        print("No")
        exit(0)

print("Yes")

Measured memory_bytes: 62388
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define co cout
#define ci cin
#define sf1(n) scanf("%lld",&n);
#define sf2(n,m) scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define en cout<<endl;
#define pb push_back
#define coy cout<< "YES"<<endl;
#define con cout<< "NO"<<endl;
#define For(a,b) for(ll a=0;a<b;a++)
#define br break;
#define i64 long long
i64 M=10000000;
//ll b[805],ans[805];
map< ll,pair<ll,ll> >mp;

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;
    ci>>n;
    string a,b,c;
    ci>>a;
    if(n%2) co<< "No";
    else
    {
        for(ll i=0;i<n;i++)
        {
            if(i<(n/2)) b+=a[i];
            else c+=a[i];
        }
        if(b==c) co<< "Yes";
        else co<< "No";
    }

}



Measured memory_bytes: 256
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

signed main(void)
{
  string s,t;
  cin >> s >> t;
  bool ret = false;
  int idx = -1;
  REP(i, s.size()-t.size()+1) {
    bool flag = true;
    REP(j, t.size()) {
      if(s[i+j] == '?' || s[i+j] == t[j]) continue;
      flag = false;
      break;
    }
    if(flag) ret = true, idx = i;
  }
  if(!ret) {
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  REP(i, t.size()) {
    if(s[i+idx] == '?') s[i+idx] = t[i];
  }
  REP(i, s.size()) {
    if(s[i] == '?') s[i] = 'a';
  }
  cout << s << endl;

  return 0;
}


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

int main() {
  using ll = long long;

  set< ll > st;
  vector< ll > rs(100001, 0);
  for (ll i = 0; i < rs.size(); ++i) {
    st.insert(i * (i + 1));
    rs[i] = i * (i + 1);
  }

  ll s;
  cin >> s;

  vector< ll > div;
  for (ll i  = 1; i * i <= s; ++i) {
    if (i * i == s) {
      div.push_back(i);
      continue;
    }

    if (s % i == 0) {
      div.push_back(i);
      div.push_back(s / i);
    }
  }

  ll ans = 0;
  for (auto d: div) {
    ll rc = 0, lc = 0;
    for (ll r = 1; r <= s; ++r) {
      if (st.count(r * (r + 1) - 2 * d)) {
	rc++;
      }
    }

    int nd = s / d;
    for (ll r = 1; r <= s; ++r) {
      if (st.count(r * (r + 1) - 2 * nd)) {
	lc++;
      }
    }
    
    ans += lc * rc;
  }

  cout << ans << endl;
}



Measured memory_bytes: 8204
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});
process.stdin.on('end', () => {
  const r = parseFloat(content);
  const area = r * r * Math.PI;
  const c = r * 2 * Math.PI;
  console.log(area.toFixed(6), c.toFixed(6));
});


Measured memory_bytes: 19344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
#define pll pair<ll, ll>
#define vpl vector<pll>
#define vb vector<bool>
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=s; i>=e; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<ll>())
#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define mz(a)   memset(a,0,sizeof(a))
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main() {
    zoom;
    ll k;
    in1(k);
    string s="ACL";
    forn(i,k-1) s+="ACL";
    out1(s);
    return 0;
}

Measured memory_bytes: 3676
MOD = 10**9+7
MAX = 10**3

N = gets.to_i

sieve = [false, false]+[true]*(MAX-1)
$minFactor = [-1]*(MAX+1)

2.step(MAX) do |i|
    if sieve[i]
        $minFactor[i] = i
        (i*2).step(MAX, i) do |j|
            sieve[j] = false
            $minFactor[j] = i if $minFactor[j] < 0
        end
    end
end

def prime_factor n, a
    m = n
    while $minFactor[m] > 0 do
        a << $minFactor[m]
        m /= $minFactor[m]
    end
    return n-1 > 1 ? prime_factor(n-1, a) : a
end

if N == 1
    p 1
else
    p prime_factor(N, []).group_by(&:itself).map{|_,v| v.count + 1}.inject{|pr, c| (pr * c) % MOD}
end


Measured memory_bytes: 2044
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1 << 30;
const int maxn=2e5+5;

int n,ques;
int a[maxn],tim[maxn],vis[maxn];

int main(){
	scanf("%d%d",&n,&ques);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),++tim[a[i]];
	for(int i=1;i<=n;i++)
		for(int j=max(i-tim[i]+1,1);j<=i;j++)++vis[j];
	
	int ans=0;
	for(int i=1;i<=n;i++)if(!vis[i])++ans;
	while(ques--){
		int x,to;scanf("%d%d",&x,&to);
		
		int tmp=a[x];
		if(tmp-tim[tmp]+1>=1&&vis[tmp-tim[tmp]+1]==1)++ans;
		if(tmp-tim[tmp]+1>=1)--vis[tmp-tim[tmp]+1];
		--tim[tmp];
//		printf("----%d\n",ans);
		
		a[x]=to;
		if((to-tim[to]+1)-1>=1&&!vis[to-tim[to]+1-1])--ans;
		if((to-tim[to]+1)-1>=1)++vis[to-tim[to]+1-1];
		++tim[to];
		
		printf("%d\n",ans);
	}

	return 0;
}


Measured memory_bytes: 3712
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;
using Graph = vector<vector<int>>;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll a, b; cin >> a >> b;
  for(ll i = 0;i < 10000000;i++)
  {
    if ((ll)(i * 0.08) == a && (ll)(i * 0.10) == b) fin(i);
  }
  fin(-1);
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 10000000000000000;
const ll mod = 1000000007;
ll modpow(ll x, ll y, ll m = mod) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= m; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll iti[12345678], cnt[12345678], cost[4321][4321];
signed main() {
	ll n, m, cnt1 = 0, cnt2 = 0, ans = 0; cin >> n >> m;
	if ((n + m) % 3 != 0) { cout << 0 << endl; return 0; }
	if (n >= m) { swap(n, m); }
	if (2 * n < m) { cout << 0 << endl; return 0; }
	cnt2 = (n + m) / 3;
	while (true) {
		if (2 * n == m) { break; }
		cnt1++; cnt2--; n -= 2; m--;
	}
	ll N = cnt1 + cnt2, A = min(cnt1, cnt2), X = 1, Y = 1;
	for (int h = 1; h <= A; h++) { Y *= h; Y %= mod; }
	for (int h = N - A + 1; h <= N; h++) { X *= h; X %= mod; }
	//cout << X << ' ' << Y << endl;
	cout << X * modpow(Y, mod - 2) % mod << endl;
	cin >> n; return 0;
}

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

int main()
{
  int N, ai;
  cin >> N;
  map <int,int> A;
  for(int i=0;i<N;i++){
    cin >> ai;
    if(A.count(ai) > 0){ cout << "NO" << endl; return 0;}
    else A[ai] = 1;
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 12884