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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
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(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  char c; cin >> c;
  cout << char(c + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
typedef long long lint;
const int N=3e5+5;
int n,val[N];
lint predp[N],sufdp[N],req[N],pres[N],sufs[N];//suf反向编号
struct vec{
	lint x,y;
	friend vec operator - (const vec &a,const vec &b){
		return (vec){a.x-b.x,a.y-b.y};
	}
};

namespace utils{
	template <class T> inline void apx(T &x,const T y){
		x<y?x=y:0;
	}
	template <class T> inline void apn(T &x,const T y){
		x>y?x=y:0;
	}
	inline int nxi(FILE *fd=stdin){
		int x=0;
		char c;
		while(((c=fgetc(fd))>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=fgetc(fd));
		while(x=x*10-48+c,(c=fgetc(fd))>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

inline lint crs(const vec &a,const vec &b){
	return a.x*b.y-a.y*b.x;
}

inline lint qans(lint *dp,lint *sum,int fr,int tgt){
	return dp[fr]+((lint)(tgt-fr)*(tgt-fr+1)>>1)-(sum[tgt]-sum[fr]);
}

int get_dp(lint *dp){
	static vec stk[N];
	static lint sum[N];
	int top=0;
	for(int i=1; i<=n; ++i){
		sum[i]=sum[i-1]+val[i];
	}
	dp[0]=0;
	stk[++top]=(vec){0,0};
	for(int i=1; i<=n; ++i){
		while(top>1&&qans(dp,sum,stk[top].x,i)<=qans(dp,sum,stk[top-1].x,i)){
			--top;
		}
		dp[i]=std::max(dp[i-1],qans(dp,sum,stk[top].x,i));
		vec cur=(vec){i,dp[i]+(((lint)i*i-i)>>1)+sum[i]};
		while(top>1&&crs(stk[top]-stk[top-1],cur-stk[top-1])>=0){
			--top;
		}
		stk[++top]=cur;
	}
	return dp[n];
}

void get_req(lint *dp,lint *sum,lint *res,int l,int mid,int r){
	static vec stk[N];
	int top=0;
	for(int i=l-1; i<mid; ++i){
		vec cur=(vec){i,dp[i]+(((lint)i*i-i)>>1)+sum[i]};
		while(top>1&&crs(stk[top]-stk[top-1],cur-stk[top-1])>=0){
			--top;
		}
		stk[++top]=cur;
	}
	for(int i=mid+1; i<=r; ++i){
		while(top>1&&qans(dp,sum,stk[top].x,i)<=qans(dp,sum,stk[top-1].x,i)){
			--top;
		}
		res[i-mid]=qans(dp,sum,stk[top].x,i);
	}
}

void div_req(const int l,const int r){
	static lint res[N];
	const int mid=(l+r)>>1;
	if(l==r){
		apx(req[l],predp[l-1]+sufdp[n-l]+1-val[l]);
		return;
	}
	get_req(predp,pres,res,l,mid,r);
	lint suf=-1e15;
	for(int i=r; i>mid; --i){
		apx(suf,res[i-mid]+sufdp[n-i]);
		apx(req[i],suf);
	}
	get_req(sufdp,sufs,res,n-r+1,n-(mid+1)+1,n-l+1);
	lint pre=-1e15;
	for(int i=l; i<=mid; ++i){
		apx(pre,res[mid-i+1]+predp[i-1]);
		apx(req[i],pre);
	}
	div_req(l,mid);
	div_req(mid+1,r);
}

int main(){
	memset(req,-10,sizeof(req));
	n=nxi();
	for(int i=1; i<=n; ++i){
		val[i]=nxi();
	}
	for(int i=1; i<=n; ++i){
		pres[i]=pres[i-1]+val[i];
	}
	for(int i=n; i>=1; --i){
		sufs[i]=sufs[i+1]+val[i];
	}
	std::reverse(sufs+1,sufs+n+1);
	get_dp(predp);
	std::reverse(val+1,val+n+1);
	get_dp(sufdp);
	std::reverse(val+1,val+n+1);
	div_req(1,n);
	for(int q=nxi(); q; --q){
		int pos=nxi(),v=nxi();
		lint res=std::max(req[pos]+val[pos]-v,predp[pos-1]+sufdp[n-pos]);
		printf("%lld\n",res);
	}
	return 0;
}


Measured memory_bytes: 23424
N = int(input())
#all_numは0~9の数字から成るNの数列の全部の個数
all_num = 10**N
#not_9は9が数列のどこにもいない数列の個数
#よって、(-not_9)は9が数列のどこかにいる数列の個数
not_9 = 9**N
#not_0は0が数列のどこにもいない数列の個数
#よって、(-not_0)は9が数列のどこかにいる数列の個数
not_0 = 9**N
#(-not_9) ∩ (-not_0)　=  0と9が両方ともどこかにいる数列
#よって、積集合をひかないといけない
#not_0_9は 0と9が両方ともどこにもいない数列
not_0_9 = 8**N
print((all_num-(not_9+not_0)+not_0_9) % (10**9+7))

Measured memory_bytes: 11608
N, W = map(int, input().split())
w_list = []
v_list = []
for i in range(N):
    w, v = map(int, input().split())
    w_list.append(w)
    v_list.append(v)
dp = [[0 for i in range(W+1)] for i in range(N)]
for i in range(N):
    w = w_list[i]
    v = v_list[i]
    for j in range(W+1):
        if j-w >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w]+v)
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N-1][W])

Measured memory_bytes: 171656
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){	
			final int N = sc.nextInt();
			final char[] fst = sc.next().toCharArray();
			final char[] snd = sc.next().toCharArray();
			
			for(int i = 0; i < fst.length; i++) {
				System.out.print(fst[i] + "" + snd[i]);
			}
			System.out.println();

		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21076
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()

typedef long long int ll;

//ll num[50];
//ll num2[50];
ll num[ten52];
//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<string,ll>::iterator iter;
map<ll,ll> mp;
//deque<char> deq;

ll getC(ll n)
{
    ll a=1;
    for(ll i=n;i>n-2;i--)
        a*=i;
    return a/2;
}

int main(void)
{
    double ans=0.0,d,d1,d2;
    //float f,g,h;
    long long int m,n,i,j,k=1;
    long long int a,a1,a2,a3,sum;
    string s,s1,s2;
    char c,c1;
    sum=a=a1=a2=a3=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>m;
        num[i]=m;
        mp[m]++;
    }
    for(auto &au:mp)
    {
        if(au.second>1)
            sum+=getC(au.second);
    }
    for(i=0;i<n;i++)
    {
        a1=sum;
        if(mp.find(num[i])!=mp.end())
        {
            a1-=getC(mp[num[i]]);
            a1+=getC(mp[num[i]]-1);
        }
        cout<<a1<<endl;
    }
    return 0;
}





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

int main() {
  long N;
  cin >> N;
  long K=0;
  K+=N%10;
  K+=(N%100)/10;
  K+=(N%1000)/100;
  K+=(N%10000)/1000;
  K+=(N%100000)/10000;
  K+=(N%1000000)/100000;
  K+=(N%10000000)/1000000;
  K+=(N%100000000)/10000000;
  K+=(N%1000000000)/100000000;
  K+=(N%10000000000)/1000000000;
  if(N%K==0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

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

#define mod 1000000007

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int N;
	
	cin >> N;
	
	if(100 <= N && N <= 111)
		cout << 111;
	else if(N <= 222)
		cout << 222;
	else if(N <= 333)
		cout << 333;
	else if(N <= 444)
		cout << 444;
	else if(N <= 555)
		cout << 555;
	else if(N <= 666)
		cout << 666;
	else if(N <= 777)
		cout << 777;
	else if(N <= 888)
		cout << 888;
	else
		cout << 999;
	
	return 0;
}

Measured memory_bytes: 256
H,W = [int(i) for i in input().split()]
room = ['0'] * H
ans = -1
for i in range(H):
    room[i] = list(input())
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
B = [[0] * W for _ in range(H)]
for i in range(W):
    if room[0][i] == '.':
        U[0][i] = 1
        if i == 0:
            L[0][i] = 1
        else:
            L[0][i] = L[0][i-1] +1
for i in range(H):
    if room[i][0] == '.':
        L[i][0] = 1
        if i == 0:
            U[i][0] = 1
        else:
            U[i][0] = U[i-1][0] +1
for x in range(1,H):
    for y in range(1,W):
        if room[x][y] == '.':
            U[x][y] = U[x-1][y]+1
            L[x][y] = L[x][y-1]+1
Ha = [int(i) for i in range(H)]
Wa = [int(i) for i in range(W)]
for i in Wa[::-1]:
    if room[H-1][i] == '.':
        B[H-1][i] = 1
        if i == W-1:
            R[H-1][i] = 1
        else:
            R[H-1][i] = R[H-1][i+1] +1
for i in Ha[::-1]:
    if room[i][W-1] == '.':
        R[i][W-1] = 1
        if i == H-1:
            B[i][W-1] = 1
        else:
            B[i][W-1] = B[i+1][W-1] +1
Haa = [int(i) for i in range(H-1)]
Waa = [int(i) for i in range(W-1)]
for x in Haa[::-1]:
    for y in Waa[::-1]:
        if room[x][y] == '.':
            R[x][y] = R[x][y+1]+1
            B[x][y] = B[x+1][y]+1
for x in range(H):
    for y in range(W):
        if room[x][y] == '.':
            ansa = U[x][y]+R[x][y]+B[x][y]+L[x][y]-3
            ans = max(ans,ansa)
print(ans)

Measured memory_bytes: 310792
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

// 1行読み込み
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

// 読み込みをint型へキャスト
func nextInt() int {
	sc.Scan()
	num, err := strconv.Atoi(sc.Text())
	if(err != nil) {
		panic(err)
	}
	return num
}

func main() {
	// scannerの挙動を改行区切り → 空白区切りに変更
	sc.Split(bufio.ScanWords)
	a, v := nextInt(), nextInt()
	b, w := nextInt(), nextInt()
	t := nextInt()

	dis := a - b
	spd := w - v

	if dis < 0 {
		dis = dis * -1
	} else if dis == 0 {
		fmt.Println("YES")
		return
	}
	
	if spd >= 0 {
		fmt.Println("NO")
	} else {
		spd = spd * -1
		if dis <= spd * t {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")		
		}
	}
}

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

int main() {
    long n, d, a, x, h, ans = 0, temp, dam = 0;
    cin >> n >> d >> a;
    vector<pair<long, long>> p(n);
    rep(i, n) {
        cin >> x >> h;
        p.at(i) = make_pair(x, h);
    }
    sort(p.begin(), p.end());
    queue<pair<long, long>> que;
    rep(i, n) {
        x = p.at(i).first;
        h = p.at(i).second;
        while(que.size() && que.front().first < x) {
            dam -= que.front().second;
            que.pop();
        }
        h -= dam;
        if(h > 0) {
            temp = (h + a - 1) / a;
            ans += temp;
            long num = temp * a;
            dam += num;
            que.emplace(x + 2 * d, num);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int a, b, c;

  std::cin >> a >> b >> c;

  std::cout << (b - a == c - b ? "YES" : "NO") << std::endl;

  return 0;
}


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

bool solve(int four,int seven){
    if(four+seven > n){
        return false;
    }
    if(four+seven == n){
        return true;
    }
    return solve(four+4,seven) | solve(four,seven+7);
}

int main(){
    cin >> n;
    cout << (solve(0,0)?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXN 1005
#define mod 1000000007
 
int n, m, cnt = 0;
 
char grid[MAXN][MAXN];
int dp[MAXN][MAXN];
 
int main()
{
	cin >> n >> m;
	
	for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> grid[i][j];
	
	dp[0][0] = 1;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if ((i||j) && grid[i][j] == '.') {
				if (i-1>=0) dp[i][j] = (dp[i][j]+dp[i-1][j])%mod;
				if (j-1>=0) dp[i][j] = (dp[i][j]+dp[i][j-1])%mod;
			}
		}
	}
	
	/*for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cout << dp[i][j] << ' ';			 
		}
		cout << "\n";
	}*/
	
	cout << dp[n-1][m-1] << "\n";
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define MAXN 1000002
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod=1e9+7;

double min(double a,double b)
{
  if(a<b)
  return a;
  return b;
}

double calcAngle(int h,int m)
{
    if (h == 12) h = 0;
    if (m == 60) m = 0;
    double hour_angle = 0.5 * (h * 60 + m);
    double minute_angle = 6 * m;
    double angle = abs(hour_angle - minute_angle);
    angle = min(360 - angle, angle);
    return angle;
}
void solve()
{
  int a,b,h,m;
  cin>>a>>b>>h>>m;
  double angle=calcAngle(h,m);
  //cout<<angle<<" ";
  angle=(angle*3.1415926535)/180;
  //cout<<cos(angle)<<" ";
  double ans=(a*a)+(b*b)-2*a*b*cos(angle);
  double final_ans=sqrt(ans);
  cout<<fixed<<setprecision(9)<<final_ans<<endl;
}

int main()
{
  fastio
  solve();
}


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

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

    map<pair<string,int>,int> R;

    string cityname;
    int score;
    for(int citynumber=0;citynumber<n;citynumber++){
        cin >> cityname >> score;
        R.insert({{cityname,-score},citynumber+1});
    }

    for(auto i=R.begin();i != R.end() ;i++){
        cout << (*i).second << endl;
    }

    return 0;
}

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

int main(){
    
string s1 ;
string s2 ;
cin>>s1>>s2;
int count =0;
for(int i = 0 ; i < 3 ; i++){
    if(s1[i] == s2[i])
    count++;
}
cout<<count<<endl;
return 0;

}



Measured memory_bytes: 256
#include<cstdio>
#define MAX 10000
#define NIL -1
struct Node {int parent, left, right; };
Node T[MAX];
int n,D[MAX],H[MAX];
void setDepth(int u, int d)
{
    if(u == NIL) return;
    D[u] = d;
    setDepth( T[u].left, d+1 );
    setDepth( T[u].right, d+1 );
}
int setHeight(int u)
{
    int h1=0,h2=0;
    if( T[u].left != NIL )
        h1=setHeight(T[u].left)+1;
    if( T[u].right != NIL )
        h2=setHeight(T[u].right)+1;
    return H[u]=( h1 > h2 ? h1 : h2 );
}
int getSibling(int u)
{
  if(T[u].parent==NIL) return NIL;
  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
    return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)
    return T[T[u].parent].right;
  return NIL;
}
void print(int u)
{
    printf("node %d: ", u);
    printf("parent = %d, ", T[u].parent);
    printf("sibling = %d, ", getSibling(u));
    int deg=0;
    if(T[u].left != NIL) deg++;
    if(T[u].right != NIL) deg++;
    printf("degree = %d, ", deg);
    printf("depth = %d, ", D[u]);
    printf("height = %d, ", H[u]);
    if(T[u].parent == NIL)
    {
        printf("root\n");
    }else if( T[u].left == NIL && T[u].right == NIL )
    {
        printf("leaf\n");
    }else{
        printf("internal node\n");
    }

}
int main()
{
    int v,l,r,root=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++) T[i].parent=NIL;
    for(int i=0;i<n;i++)
    {
        scanf("%d %d %d",&v,&l,&r);
        T[v].left=l;
        T[v].right=r;
        if(l!=NIL) T[l].parent=v;
        if(r!=NIL) T[r].parent=v;
    }
    for(int i=0;i<n;i++)
    if(T[i].parent == NIL) root = i;
    setDepth(root,0);
    setHeight(root);
    for(int i=0;i<n;i++)
        print(i);
    return 0;
}

Measured memory_bytes: 2684
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    long a = Long.parseLong(sc.next());
    long b = Long.parseLong(sc.next());
    long k = Long.parseLong(sc.next());
    long ansA = Math.max(a - k, 0);
    long remainK = Math.max(k - a, 0);
    long ansB = Math.max(b - remainK, 0);
    pw.println(ansA + " " + ansB);
  }
}


Measured memory_bytes: 23252
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000
const int mod = INF+7;


int max(int a, int b){
  if(a>=b){
    return a;
  }
  else{
    return b;
  }
}

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

  vector<int> left_max(N);
  vector<int> right_max(N);
  left_max[0]=A[0];
  right_max[N-1]=A[N-1];
  srep(i,1,N){
    if(A[i]>left_max[i-1]){
      left_max[i]=A[i];
    }
    else{
      left_max[i]=left_max[i-1];
    }
    if(A[N-1-i]>right_max[N-i]){
      right_max[N-1-i]=A[N-i-1];
    }
    else{
      right_max[N-1-i]=right_max[N-i];
    }
  }

  printf("%d\n", right_max[1]);
  srep(i,1,N-1){
    printf("%d\n", max(left_max[i-1], right_max[i+1]));
  }
  printf("%d\n", left_max[N-2]);
}


Measured memory_bytes: 3968
n, k = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(k)]
mod = 998244353

dp = [0] * (n + 1)
dp[1] = 1
sm = 0
for i in range(2, n + 1):
    for l, r in lr:
        if i - r - 1 >= 1:
            sm -= dp[i-r-1]
        if i - l >= 1:
            sm += dp[i-l]

        sm %= mod

    dp[i] = sm

ans = dp[n]
print(ans)


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

int main() {
    int N, M, now = 0;
    string S;
    cin >> N >> M >> S;
    reverse(S.begin(), S.end());
    vector<bool> step(N+1, false);
    step[0] = true; step[N] = true;
    if (N <= M) { cout << N << endl; return 0; }
    while (now < N) {
        bool NO = true;
        for (int i = min(N+1,now+M); i > now; i--) {
            if (S[i] == '0') {
                now = i; step[i] = true; NO = false;
                break;
            }
        }
        if (NO == true) { cout << -1 << endl; return 0; }
    }
    
    reverse(step.begin(), step.end());
    vector<int> ans;
    for (int i = 0; i <= N; i++) {
        if (step[i] == true) ans.emplace_back(i);
    }
    
    for (int i = 1; i < ans.size(); i++) {
        cout << ans[i] - ans[i-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <string>
#include <cmath>
#include <math.h>
using namespace std;

class Dice{
public:
	int face[6];
	Dice(){}
	void north(){
		int t=face[0];
		face[0]=face[1];
		face[1]=face[5];
		face[5]=face[4];
		face[4]=t;
	}
	void south(){
		int t=face[0];
		face[0]=face[4];
		face[4]=face[5];
		face[5]=face[1];
		face[1]=t;
	}
	void east(){
		int t=face[0];
		face[0]=face[3];
		face[3]=face[5];
		face[5]=face[2];
		face[2]=t;
	}
	void west(){
		int t=face[0];
		face[0]=face[2];
		face[2]=face[5];
		face[5]=face[3];
		face[3]=t;
	}
	void spin(){
		int t=face[1];
		face[1]=face[2];
		face[2]=face[4];
		face[4]=face[3];
		face[3]=t;
	}
};

int getRight(Dice d, int top, int front){
	for(int i=0; i<6; i++){
		for(int j=0; j<4; j++){
			if(d.face[0]==top && d.face[1]==front) return d.face[2];
			d.spin();
		}
		if(i%2==0) d.north();
		else d.east();
	}
	return -1;
}

int main(){
	int nums[6];
	Dice dice = Dice();
	for(int i=0; i<6; i++){
		cin >> dice.face[i];
	}
	int line;
	cin >> line;
	for(int i=0; i < line; i++){
		int t,f;
		cin >> t >> f;
		printf("%d\n",getRight(dice,t,f));	
	}
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937_64 mt64(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/


int n, k;
int a[222222], b[222222];
signed main() {
	cin >> n >> k;
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	sort(a, a + n);
	sort(b, b + n, greater<>());
	int ok = inf, ng = -1;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		int cnt = 0;
		rep(i, n) {
			cnt += max(0ll, a[i] - mid / b[i]);
		}
		if (cnt <= k)ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}


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



int main(void){
	int N,i;
	vector<int> H(100000);
	
	cin >> N;

	for (i = 0; i < N; i++){
		cin >> H[i];
	}

	H[0] -= 1;

	for (i = 0; i <= N - 2; i++){
		if (H[i] < H[i + 1]){
			H[i + 1] -= 1;
		}
		else if (H[i] > H[i + 1]){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;

int gcd(int a, int b)
{
	if ( b == 0)
	{
		return(a);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

signed main() {
	ios::sync_with_stdio(false);
	int i, j;
	int n;
	cin >> n;
	vector<int> a(n, 0);
	rep(i, n) {
		cin >> a[i];
	}
	vector<int> l(n+1,0);
	vector<int> r(n+1,0);
	int ans = 1;
	rep(i, n) l[i + 1] = gcd(l[i], a[i]);
	for (int i = n - 1; i >= 1; i--) r[i - 1] = gcd(r[i], a[i]);
	rep(i, n) ans = max(ans, gcd(r[i], l[i]));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    cin >> n;
    vvi G(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vi c(n);
    rep(i, n) {
        cin >> c[i];
    }
    sort(all(c));

    vi si(n);
    queue<int> que;
    rep(i, n) {
        si[i] = G[i].size();
        if(si[i] == 1) {
            que.push(i);
        }
    }

    vi anv(n, -1);
    ll ans = accumulate(all(c), 0LL) - c[n-1];
    int nnow = 0;
    while(!que.empty()) {
        int now = que.front();
        que.pop();
        anv[now] = c[nnow];
        ++nnow;
        if(nnow == n) break;
        if(G[G[now][0]].size() == 2) {
            que.push(G[now][0]);
        }
        vi::iterator itr = find(all(G[G[now][0]]), now);
        G[G[now][0]].erase(itr);
    }

    cout << ans << endl;
    rep(i, n) {
        cout << anv[i] << '\n';
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int x;
  cin >> x;
  cout << ((x >=30) ? "Yes" : "No" )<< endl;
  return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
using namespace std;
const int Mod=1e9+7;
typedef long long ll;
int x[11],y[11],ans;
ll fac[2100000],inv[2100000];
int C(int x,int y){
	if (x<y) return 0; 
	return 1ll*fac[x]*inv[y]%Mod*inv[x-y]%Mod;
}
int calc2(int x1,int y1,int x2,int y2){ return C((x2-x1)+(y2-y1),(x2-x1));}
int calc(int a,int b,int f){
	if (f==1)
		return calc2(x[2],y[2],a,b)-calc2(x[1]-1,y[2],a,b)
		      -calc2(x[2],y[1]-1,a,b)+calc2(x[1]-1,y[1]-1,a,b);
	else
		return calc2(a,b,x[5],y[5])-calc2(a,b,x[6]+1,y[5])
		      -calc2(a,b,x[5],y[6]+1)+calc2(a,b,x[6]+1,y[6]+1);
}
int main(){
	fac[0]=1; for (int i=1;i<=2000000;i++) fac[i]=fac[i-1]*i%Mod;
	inv[1]=1; for (int i=2;i<=2000000;i++) inv[i]=(Mod-Mod/i)*inv[Mod%i]%Mod;
	inv[0]=1; for (int i=1;i<=2000000;i++) inv[i]=inv[i-1]*inv[i]%Mod;
	for (int i=1;i<=6;i++) scanf("%d",&x[i]);
	for (int i=1;i<=6;i++) scanf("%d",&y[i]);
	for (int a=x[3];a<=x[4];a++) ans=(ans+1ll*calc(a,y[4],1)*calc(a,y[4]+1,3)%Mod*(a+y[4]+1)%Mod)%Mod;
	for (int a=x[3];a<=x[4];a++) ans=(ans-1ll*calc(a,y[3]-1,1)*calc(a,y[3],3)%Mod*(a+y[3])%Mod+Mod)%Mod;
	for (int b=y[3];b<=y[4];b++) ans=(ans+1ll*calc(x[4],b,1)*calc(x[4]+1,b,3)%Mod*(b+x[4]+1)%Mod)%Mod;
	for (int b=y[3];b<=y[4];b++) ans=(ans-1ll*calc(x[3]-1,b,1)*calc(x[3],b,3)%Mod*(b+x[3])%Mod+Mod)%Mod;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 32896
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int n;
int ans = 0;

bool check(ll cn) {
  map<int, int> mp;
  while(cn) {
    mp[cn%10]++;
    cn/=10;
  }
  if (mp[3] == 0 || mp[7] == 0 || mp[5] == 0) {
    return false;
  } else {
    return true;
  }
}

void dfs(ll cn) {
  if (cn > n) {
    return;
  }
  if (check(cn)) ans++;
  
  dfs(cn*10 + 3);
  dfs(cn*10 + 5);
  dfs(cn*10 + 7);
}

int main()
{
  cin >> n;
  dfs(0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  var S = inputStr[0];
  var ans = "Yes";

  //console.log(S.length);
  
  //判定
  for(var i=0 ; i<S.length ; i++){
    if((i+1)%2===0){
      //偶数位置
      var str = "LUD";
    } else {
      //奇数位置
      var str = "RUD";
    }
    //console.log(str,S.substr(i,1),str.indexOf(S.substr(i,1)));

    if( str.indexOf(S.substr(i,1)) === -1 ){
      ans = "No";
      break;
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  [n, m, k] <- getIntList

  let solve x y | y > n = False
                | x > m = solve 0 (y+1)
                | otherwise = let bk = x * (n - y) + (m - x) * y
                              in if bk == k
                                 then True
                                 else solve (x+1) y

  if solve 0 0
    then putStrLn "Yes"
    else putStrLn "No"


Measured memory_bytes: 380
#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>
#include<cassert>
using namespace std;

typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<string> svec;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)

int N, M;
vector<bool> issafe;

int main() {
	cin >> N >> M;
	issafe.assign(N + 1, true);
	rep(i,0,M) {
		int a; cin >> a;
		issafe[a] = false;
	}

	vecll dp(N + 1, 0);
	dp[0] = 1;
	if (issafe[1]) dp[1] = 1;
	for (int n = 2; n <= N; ++n) {
		if (issafe[n - 1]) dp[n] += dp[n - 1];
		if (issafe[n - 2]) dp[n] += dp[n - 2];
		dp[n] %= mod;
	}
	cout << dp[N] << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int ones(int n)
{
    n = (n & 0x5555'5555) + (0x5555'5555 & (n >> 1));
    n = (n & 0x3333'3333) + (0x3333'3333 & (n >> 2));
    n = (n & 0x0f0f'0f0f) + (0x0f0f'0f0f & (n >> 4));
    n = (n & 0x00ff'00ff) + (0x00ff'00ff & (n >> 8));
    n = (n & 0x0000'ffff) + (0x0000'ffff & (n >> 16));

    return n;
}

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

    vector<int> a(n, 0);
    rep(i, n)
    {
        rep(j, 10)
        {
            int f;
            cin >> f;
            a[i] |= (f << j);
        }
    }

    vector<vector<int>> p(n, vector<int>(11));
    rep(i, n)
    {
        irep(j, 10)
        {
            cin >> p[i][j];
        }
    }

    int result = numeric_limits<int>::min();
    rep(d, 1 << 10)
    {
        if (d != 0) {
            int score = 0;
            rep(i, n)
            {
                score += p[i][ones(d & a[i])];
            }
            result = max(result, score);
        }
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {
  val r = Array(2,3,5,7)

  def twoPow(d:Int,s:Int):(Int,Int) = {
    if(d%2 == 1) (d,s)
    else twoPow(d>>1,s+1)
  }

  def maybePrime(i:Int,d:Int,s:Int, n:Int):Boolean = {
    if(i>3) true
    else {
      val a = r(i)
      val x = BigInt(a).modPow(d,n).toLong

      if(x==1 || x==n-1) maybePrime(i+1,d,s,n)
      else repeat(s-1,BigInt(x).modPow(2,n).toLong, i, d, s, n)
    }
  }

  def repeat(j:Int, x:Long, i:Int, d:Int, s:Int, n:Int):Boolean = {
    if(j==0) false
    else if(x==1) false
    else if(x==n-1) maybePrime(i+1,d,s,n)
    else repeat(j-1,BigInt(x).modPow(2,n).toLong,i,d,s,n)
  }

  def isPrime(n:Int):Boolean = {
    if(n<5000) (2 to Math.sqrt(n).toInt).forall(n%_ != 0)
    else if(n%2==0) false
    else {
      val (d,s) = twoPow(n-1,0)
      maybePrime(0,d,s,n)
    }
  }

  def main(args:Array[String]) = {
    val n = readInt
    println((for {
      i <- 0 until n
      if isPrime(readInt)
    } yield 1).length)
  }
}

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

int main() {

  int K;
  cin >> K;
  
    if (K == 1) {
      cout << "ACL" << endl;
  
    }
    if (K == 2) {
      cout << "ACLACL" << endl;  
      }
   if (K == 3) {
      cout << "ACLACLACL" << endl;
   }

    if (K == 4) {
      cout << "ACLACLACLACL" << endl;
    }
        if (K == 5) {
      cout << "ACLACLACLACLACL" << endl;
        }
}


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

int main() {
    int a=0,n=0;
    string s;
    
    cin >> s;
    n = s.length();
    for (int i = 0; i < n / 2; i++) {
        if ( s[(s.length()-1)-i] != s[i] ) {
            s[(s.length() - 1) - i] = s[i];
            a++;
        }
    }
    cout << a;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cmath>
#include <list>
#include <algorithm>

using namespace std;

int main(void)
{
    int n;
    scanf("%d", &n);

    if (n % 10 == 3) {
        printf("bon");
    } else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) {
        printf("pon");
    } else {
        printf("hon");
    }

    return 0;
}


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

bool isUruu(int y){
  if(y%4)return false;
  if(y%100)return true;
  if(y%400)return false;
  return true;  
}

int main(){
  int a, b;
  bool first = false;
  while(std::cin >> a >> b, a){
    if(first)std::cout << std::endl;
    first = true;
    bool flag = false;
    for (int i = a; i <= b; i++) {
      if(isUruu(i)){
        std::cout << i << std::endl;
        flag = true;
      }
    }
    if(flag == false)std::cout << "NA" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

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

	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int a = 0;
	for (int i = 1; i < n; i++)
	{
		a = a ^ (arr[0] ^ arr[i]);
	}
	a = a ^ arr[0];
	int ans[n] = {0};
	ans[0] = a;
	for (int i = 1; i < n; i++)
	{
		ans[i] = ans[0] ^ (arr[0] ^ arr[i]);
	}
	for (int i = 0; i < n; i++)
		cout << ans[i] << " ";
	return 0;
}


Measured memory_bytes: 5088
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> II;

const int N = (int) 1e6 + 10;
const int P = (int) 1e9 + 7;
int n, dp[N];

int main() {
	scanf("%d", &n);
	int s = dp[1] = n; dp[0] = 1;
	for (int i = 2; i <= n; ++i) {
		dp[i] = (s + (n - 1ll) * (n - 1ll) + n - i + 2) % P;
		dp[i] = (dp[i] - dp[i - 2] + P) % P;
		s = (s + dp[i]) % P;
	}
	//for (int i = 1; i <= n; ++i) cerr << dp[i] << endl;
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

typedef string::const_iterator State;

ll num(State &begin){
    ll res=0;
    while(isdigit(*begin)){
        res*=10;
        res+=*begin-'0';
        begin++;
    }
    return res/2+1;
}
ll expr(State &begin){
    if(*begin=='['){
        vector<ll>v;
        begin++;
        while(*begin!=']'){
            ll c=expr(begin);
            v.pb(c);
        }
        begin++;
        sort(v.begin(),v.end());
        ll ns=v.size();
        ll res=0;
        rep(i,0,ns/2){
            res+=v[i];
        }
        return res;
    }else{
        return num(begin);
    }
}

bool anspro(){
    string s;cin>>s;
    State b=s.begin();
    cout<<expr(b)<<endl;
    
    return 0;
}

int main(){fastio
    ll q;cin>>q;
    while(q--){
        anspro();
    }
    return 0;
}



Measured memory_bytes: 3276
# import bisect
from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    S=list(input())
    from itertools import accumulate

    W=[0]*N
    E=[0]*N
    for i in range(N):
        if S[i]=='W':
            W[i]=1
        else:
            E[i]=1
    WW=[0]+W
    EE=[0]+E

    from itertools import accumulate

    WW = list(accumulate(WW))
    EE=list(accumulate(EE))# 累積和を格納したリスト作成


    # この問題は長さが1-Nの連続部分の和の最大値を出せというものなので以下の通り
    ans=10**10
    for i in range(1, N + 1):
        ans = min(WW[i-1]+EE[N]-EE[i],ans)
    print(ans)



resolve()

Measured memory_bytes: 38096
n=int(input())
T=list(map(int,input().split()))
S=list(map(int,input().split()))
C=list(map(int,input().split()))
SUM=sum(S)
for i in range(n-1):
    if T[i+1]==T[i]+1:
        SUM+=C[T[i]-1]
print(SUM)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

//GCD(最大公約数)
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

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

    int sum = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            for(int k = 1; k <= n; k++) {
                sum += gcd(i, gcd(j, k));
            }
        }
    }

    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 10+5;
const int dx[] = {0,0,-1,1,-1,-1,1,1};
const int dy[] = {-1,1,0,0,-1,1,-1,1};
using namespace std;
char str[N];
int bit[N],len;
bool vis[N];
LL res;
void dfs(int x){
    if(x==len){
        LL sum1=0,sum2=0;
        for(int i=1;i<=len-1;i++){
            sum1=sum1*10+bit[i];
            if(vis[i]){
                sum2+=sum1;
                sum1=0;
            }
        }
        sum1=sum1*10+bit[len];
        res+=(sum1+sum2);
        return;
    }

    vis[x]=true;
    dfs(x+1);

    vis[x]=false;
    dfs(x+1);
}
int main(){
    scanf("%s",str+1);
    len=strlen(str+1);
    for(int i=1;i<=len;i++)
        bit[i]=str[i]-'0';
    dfs(1);
    printf("%lld\n",res);
    return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 200005;

int v[N], dp[N], n;

int main(){
	fastio;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> v[i];
    dp[1] = abs(v[1] - v[0]);
    for(int i = 2; i < n; i++){
        dp[i] = min(dp[i-1] + abs(v[i]-v[i-1]),
                            dp[i-2] + abs(v[i]-v[i-2]));
    }
    cout << dp[n-1] << '\n';
	return 0;
}


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

#define ll long long
#define pb push_back

using namespace std;

const int N=1e5+100;
ll n,a[N],b[N],m=0;

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

    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        b[a[i]-1]++;
        b[a[i]]++;
        b[a[i]+1]++;
    }

    for(int i=0;i<N-50;i++)
    {
        m=max(m,b[i]);
    }

    cout<<m;
    return 0;
}


Measured memory_bytes: 1792
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll X;
bool isPrime(ll X) {
	for(int i = 2; i <= sqrt(X); i++) {
		if(X % i == 0) {
			return 0;
		} 
	}
	return 1;
}

int main() {
	scanf("%lld", &X);
	while(1) {
		if(isPrime(X)) {
			printf("%lld\n", X);
			return 0;
		}
		X++;
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
package main

import "fmt"

func abs(a, b int) int {
	if a < b {
		return b - a
	} else {
		return a - b
	}
}

type Table []int

func (t *Table) At(i int) int {
	i += t.Size()
	return (*t)[i%t.Size()]
}

func (t *Table) Size() int {
	return len(*t)
}

func (t *Table) Cost(i, j int) int {
	return abs(t.At(i), t.At(j))
}

func (t *Table) FullCost() int {
	cost := 0
	for i, _ := range *t {
		cost += t.Cost(i, i+1)
	}
	return cost
}

func (t *Table) ReductedCost(i int) int {
	return t.Cost(i-1, i) + t.Cost(i, i+1) - t.Cost(i-1, i+1)
}

func main() {
	var n int
	fmt.Scan(&n)
	var as Table = make([]int, n+1)

	as[0] = 0
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i+1])
	}

	full := as.FullCost()
	for i := 0; i < n; i++ {
		fmt.Println(full - as.ReductedCost(i+1))
	}
}


Measured memory_bytes: 6528