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

using namespace std;

int main(){
	while(1){
		
		int n;
		cin >> n;
		
		if(n==0)
			return 0;
		
		vector<pair<int,int> > co(n);
		
		for(int i=0;i<n;i++)
			cin >> co[i].first >> co[i].second;
		
		int cc;
		
		cin >> cc;
		
		vector<pair<string,int> > cm(cc);
		
		for(int i=0;i<cc;i++){
			cin >> cm[i].first >> cm[i].second;
		}
		
		int ma[21][21]={};
		
		int nx=10,ny=10;
		int xy,xx;
		for(int i=0;i<cc;i++){
			if(cm[i].first == "N"){
				xx=0;xy=1;
			}else if(cm[i].first == "E"){
				xx=1;xy=0;
			}else if(cm[i].first == "S"){
				xx=0;xy=-1;
			}else{
				xx=-1;xy=0;
			}
			
			for(int j=0;j<cm[i].second;j++){
				nx+=xx;ny+=xy;
				ma[nx][ny] = 1;
			}
		}
		
		for(int i=0;i<n;i++){
			if(ma[co[i].first][co[i].second] != 1){
				cout << "No" << endl;
				break;
			}else if(i==n-1){
				cout << "Yes" << endl;
			}
		}
	}
}


Measured memory_bytes: 3140
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);
		long k = long.Parse(input[1]);
      
        long x = n % k;
        Console.WriteLine(x > k-x ? k-x : x);

	}
}

Measured memory_bytes: 13140
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int k = std.nextInt();
        Integer[] hs = new Integer[n];
        for (int i = 0; i < n; i++) {
            hs[i] = std.nextInt();
        }

        Arrays.sort(hs, Comparator.reverseOrder());
        long count = 0;
        for (int i = k; i < hs.length; i++) {
            count += hs[i];
        }

        System.out.println(count);
    }
}


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

using namespace std;

int main() {
    int A, B, C, tmp;
    set<int> st;
    cin >> A >> B >> C;
    int k = 0;
    while(true) {
        k++;
        tmp = A*k-C;
        if (tmp < 0) {
            continue;
        }
        tmp %= B;
        if (st.count(tmp)) {
            cout << "NO" << endl;
            return 0;
        }
        if (tmp == 0) {
            cout << "YES" << endl;
            return 0;
        }
        st.insert(tmp);

    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
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;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
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 n, k, p[200000];
long double cnt, ma;

signed main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++)cin >> p[i];
	for (int i = 0; i < k; i++) {
		cnt += p[i];
		ma += p[i];
	}
	for (int i = k; i < n; i++) {
		cnt += p[i];
		cnt -= p[i - k];
		ma = max(cnt, ma);
	}
	printf("%.10Lf", (ma + k) / 2.0);
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  string s,t;
  cin>>s>>t;
  for(Int i=0;i<n;i++){
    Int k=m*i;
    if(k%n) continue;
    if(s[i]!=t[k/n]){
      cout<<-1<<endl;
      exit(0);
    }
  }
  Int l=n*m/__gcd(n,m);
  cout<<l<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MAX_V 100000
#define INF 1e9
using namespace std;

/*????°??????¨???(???????????£????????????????????¨) O(F|V||E|)*/

//????????¨????§???????(???????????????????????????????????????)
struct edge{
  int to, cap,rev;
  string cost;
  edge(){};
  edge(int a,int b,string c,int d){
    to=a, cap=b, cost=c, rev=d;
  };
};
int V;                         //????????°
vector<edge> G[MAX_V];         //??°???????????£??\???????????¨???
string dist[MAX_V];               //???????????¢
int prevv[MAX_V],preve[MAX_V]; //??´??????????????¨???

// from??????to??????????????????cap????????????cost???????????°????????????????????????
void add_edge(int from,int to,int cap,string cost){
  G[from].push_back((edge){to,cap,cost,G[to].size()});
  string C=cost;
  if(cost.size())C+="{";
  G[to].push_back((edge){from,0,C,G[from].size()-1});
}

//s??????t????????????f???????°??????¨???????±???????
//??????????????´???-1?????????
string min_cost_flow(int s,int t,int f){
  
  string res;
  
  while(f>0){
    //????????????????????????????????????,s-t????????????????±???????
    for(int i=0;i<V;i++) dist[i]="{";
    dist[s]=res;
    bool update = true;
    while(update){
      update = false;
      for(int v=0; v<V ;v++){
	if(dist[v]=="{") continue;
	
	for(int i=0; i<G[v].size(); i++){
	  edge &e = G[v][i];
	  
	  string str;
	  
	  if(e.cost.size()==2){
	    
	    string tmp;
	    int F=0;
	    
	    for(int j=0;j<dist[v].size();j++){
	      if(!F&&dist[v][j]==e.cost[0]){
		F=1;
		continue;
	      }
	      tmp+=dist[v][j];
	    }
	    
	    str=tmp;
	    
	  }else str=dist[v]+e.cost;
	  
	  sort(str.begin(),str.end());
	  
	  if(e.cap > 0 && dist[e.to] > str){
	    dist[e.to] = str;
	    prevv[e.to] = v;
	    preve[e.to] = i;
	    update = true;
	  }
	}
      }
    }
    
    //s???t?????????????????£??????????????????
    int d = f;
    for(int v=t; v!=s; v=prevv[v])d=min(d,G[prevv[v]][preve[v]].cap);
    f -= d;
    res=dist[t];
    
    for(int v=t; v!=s; v=prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  
  return res;
}

int main(){
  
  int n;
  cin>>n;
  
  int S=n*2,T=S+1;

  for(int i=0;i<n;i++){
    
    string s;
    cin>>s;
    
    for(int j=0;j<n;j++){
      string t;
      t+=s[j];
      add_edge(i,j+n,1,t);
    }
    
  }

  for(int i=0;i<n;i++){
    add_edge(S,i,1,"");
    add_edge(i+n,T,1,"");
  }
  
  V=n*2+2;
  
  cout<<min_cost_flow(S,T,n)<<endl;

  return 0;
}

Measured memory_bytes: 6748
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

template <typename T>//	Tはintかll
T gcd(T a, T b) {//	最大公約数
	if (a < 0) { a = -a; }
	if (b < 0) { b = -b; }
	if (a == 0) { return b; }
	if (b == 0) { return a; }
	if (a < b) {
		return gcd(a, b % a);
	}
	return gcd(b, a % b);
}
template <typename T>//	Tはintかll
T gcd(int size, T* a) {//	配列の最大公約数
	if (size <= 0 || a == NULL) { return 0; }
	T c = abs(a[0]);
	for (int i = 1; i < size; i++) {
		c = gcd(c, a[i]);
		if (c == 1) {
			break;
		}
	}
	return c;
}

template <typename T>//	Tはintかll
ll lcm(T a, T b) {//	最小公倍数
	if (a < 0) { a = -a; }
	if (b < 0) { b = -b; }
	if (a == 0) { return b; }
	if (b == 0) { return a; }
	ll x = a;
	x /= gcd(a, b);
	x *= b;
	return x;
}
template <typename T>//	Tはintかll
ll lcm(int size, T* a) {//	配列の最小公倍数
	if (size <= 0 || a == NULL) { return 0; }
	ll c = abs(a[0]);
	for (int i = 1; i < size; i++) {
		c = lcm(c, (ll)a[i]);
	}
	return c;
}

bool f[20000] = {};

int main() {
	f[0] = false;
	f[1] = false;
	f[2] = true;
	for (int i = 3; i < 20000; i++) {
		f[i] = (i % 2 == 1);
	}
	for (int i = 3; i < 20000; i++) {
		if (f[i] == false) { continue; }
		for (int j = i * 2; j < 20000; j += i) {
			f[j] = false;
		}
	}
	vector<ll> v;
	for (int i = 0; i < 20000; i++) {
		if (f[i] == true) {
			v.push_back(i);
		}
	}

	int N = 500;
	ll** ans = new ll * [N];
	for (int i = 0; i < N; i++) {
		ans[i] = new ll[N];
		for (int j = 0; j < N; j++) {
			ans[i][j] = 1;
		}
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if ((i + j) % 2 == 0) {
				ans[i][j] = v[abs(1000 - 2 * (i + j) + 1) + 1] * v[abs(1000 - 2 * (i - j + N) + 1)];
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if ((i + j) % 2 == 1) {
				ll c = 1;
				if (i > 0) { c = lcm(c, ans[i - 1][j]); }
				if (j > 0) { c = lcm(c, ans[i][j - 1]); }
				if (i < N - 1) { c = lcm(c, ans[i + 1][j]); }
				if (j < N - 1) { c = lcm(c, ans[i][j + 1]); }

				ans[i][j] += c;
			}
		}
	}

	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}

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

int main() {
	int n;
	cin>>n;
	if(n%2!=0)
	{
		cout<<0;
		return 0;
	}
	int d[n];
	for(int i=0;i<n;i++)
	{
		cin>>d[i];
	}
	sort(d,d+n);
	int mid=n/2;
	if(d[mid]!=d[mid-1])
	{
		cout<<abs(d[mid]-d[mid-1]);
	}
	else
	{
		cout<<0;
	}
	return 0;
	
}

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

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<int>());
  int n      = s.size();
  int m      = t.size();
  bool res   = true;
  string tmp = "";
  for (int i = 0; i < n; i++) {
    if (s[i] > t[i]) {
      res = false;
      break;
    } else if (s[i] == t[i]) {
      tmp += t[i];
      continue;
    } else {
      break;
    }
  }
  if (s == tmp && n >= m) { res = false; }
  if (res) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (void) {
    string O, E;

    cin >> O >> E;

    for (int i = 0; i < min(O.length(), E.length()); i++) {
        cout << O[i];
        cout << E[i];
    }
    if (O.length() > E.length()) cout << O[O.length() - 1];
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int N;
	int A[200001];
	int B[200001]={0};
	scanf("%d",&N);
	for(int i=1;i<N;i++){
		scanf("%d",&A[i]);	
		B[A[i]]++;		
	}
	for(int i=1;i<N+1;i++)printf("%d\n",B[i]);
}

Measured memory_bytes: 3292
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	string N; cin >> N;
	if(N[0] == '9' or N[1] == '9') cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;

}


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

int main()
{
    long long N,A,B,blues,r;
    cin >> N >> A >> B;

    r = N % (A+B);
    blues = (N/(A+B))*A;
    blues += min(A,r);
    cout << blues << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  vi a(n);

  rep(i, n) {
    int x; cin >> x;
    a[x-1] = i+1;
  }

  rep(i, n) {
    if (i) cout << " ";
    cout << a[i];
  }

  cout << endl;

  return (0);
}


Measured memory_bytes: 3688
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		String S = scanner.next();
		char[] sArray = S.toCharArray();
		sArray[K - 1] += 32;
		System.out.println(sArray);
		scanner.close();
	}
}

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

int main(){
    int N;
    cin >> N;
    int x;
    vector<long double> A(N);
    long double ans=0;
    for(int i=0; i<N; i++){
        cin >> x;
        ans += (long double)1.0/x;
    }
    
    ans = 1/ans;
    cout << fixed << setprecision(7) << ans << endl;
}

Measured memory_bytes: 3732
def dfs(v):
  if(0 not in already):return(1)
  allReach=0
  for i in range(n):
    if(connect[v][i]==1 and already[i]==0):
      already[i]=1
      allReach+=dfs(i)
      already[i]=0
  return(allReach)

n,m=map(int,input().split())
connect=[[0for i in range(n)]for j in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  connect[a-1][b-1]=1
  connect[b-1][a-1]=1
  
already=[0for i in range(n)]
already[0]=1
print(dfs(0))

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

void solve(long long H, long long W)
{
    if (H == 1 || W == 1)
    {
        cout << "1" << endl;
    }
    else
    {
        if (H % 2 == 0 && W % 2 == 0)
        {
            cout << H * W / 2 << endl;
        }
        if (W % 2 == 1 && H % 2 == 0)
        {
            cout << W * (H / 2) << endl;
        }
        if (W % 2 == 0 && H % 2 == 1)
        {
            cout << W * (H / 2) + W / 2 << endl;
        }
        if (W % 2 == 1 && H % 2 == 1)
        {
            cout << W * (H / 2) + W / 2 + 1 << endl;
        }
    }
}

int main()
{
    long long H;
    scanf("%lld", &H);
    long long W;
    scanf("%lld", &W);
    solve(H, W);
    return 0;
}


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

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

typedef struct{
  int x,y;
}Point;

int det(Point p,Point q){
  return p.x*q.y-p.y*q.x;
}

int main(int argc, char const *argv[]) {
  int n;
  cin >>n;
  for(int T=0; T<n; ++T){
    int i;

    Point p[3],v,a;
    rep(i,3) scanf(" %d %d", &p[i].x, &p[i].y);
    scanf(" %d %d", &a.x, &a.y);
    scanf(" %d %d", &v.x, &v.y);

    bool _a=false, _v=false;
    int tmp=0;
    rep(i,3){
      Point t1,t2;
      t1.x=p[(i+1)%3].x-p[i].x;
      t1.y=p[(i+1)%3].y-p[i].y;
      t2.x=a.x-p[i].x;
      t2.y=a.y-p[i].y;

      if(det(t1,t2)>0) ++tmp;
      else --tmp;
    }
    if(tmp==3||tmp==-3) _a=true;

    tmp=0;
    rep(i,3){
      Point t1,t2;
      t1.x=p[(i+1)%3].x-p[i].x;
      t1.y=p[(i+1)%3].y-p[i].y;
      t2.x=v.x-p[i].x;
      t2.y=v.y-p[i].y;

      if(det(t1,t2)>0) ++tmp;
      else --tmp;
    }
    if(tmp==3||tmp==-3) _v=true;

    //cout << _a << " " << _v << endl;

    string s="OK";
    if(_a==_v) s="NG";
    std::cout << s << std::endl;
  }
  return 0;
}

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

inline int readInt(){
  int ret = 0;
  char c;
  while((c=getchar()) && isdigit(c)){
    ret = ret * 10 + (c-'0');
  }
  return ret;
}

void outint(int a){
  if (a == 0)return;
  outint(a/10);
  putchar('0' + a%10);
}

main(){
  int n,s;
  while(true){
    n = readInt();
    if (n==0)break;
    s = readInt();
    int r[101]={0};
    int sum[101];
    for(int i=0;i<n;i++){
      int tmp;tmp=readInt();r[tmp]++;
    }
    sum[0] = 0;
    for(int i=1;i<101;i++){
      sum[i] = sum[i-1] + r[i];
    }
    int ans = 0;
    for(int i=1;i != 101;i++){
      if (r[i] && i+i > s)ans += r[i]*(r[i]-1)/2;
      for(int j=i+1;j<101;j++){
	//if (i+j>s)ans += r[i]*r[j];
	if (i+j > s){
	  ans += r[i] * (sum[100] - sum[j-1]);
	  break;
	}
      }
    }
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	int a,b;
	cin>>a;
	for(int i=0;i<a;i++){
		char d;
		cin>>d;
		if(d=='Y')b++;
	}
	if(b==0)cout<<"Three"<<endl;
	else cout<<"Four"<<endl;
}


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

namespace ABC135A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] AB = Console.ReadLine().Split(' ');
            long A = long.Parse(AB[0]);
            long B = long.Parse(AB[1]);
            if ((A + B) % 2 == 0)
            {
                Console.WriteLine((A + B) / 2);
            }
            else
            {
                Console.WriteLine("IMPOSSIBLE");
            }
        }
    }
}


Measured memory_bytes: 27404
#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>;
using G = vector<vector<int>>;
    
int main(){
    int n;
    cin >> n;
    int ans = 1000 - n % 1000;
    if(ans==1000) ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int mod = 1e9 + 7;

int main()
{
    long long n;
    cin >> n;
    vector<long long> origin(n);

    for (int i = 0; i < n; i++)
    {
        cin >> origin.at(n - i - 1);
    }

    for (int i = 0; i < n - 1; i++)
    {
        cout << origin.at(i) << " ";
    }
    cout << origin.at(n - 1) << endl;

    return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2165

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 256
#define NUM 15

#define EPS (1e-10)

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	while(true){
		int N;
		vector<int> I;
		double _min = INF;
		pair<pair<int,int>,int> ans;
		
		cin>>N;
		
		if(!N) break;
		
		I.resize(N);
		
		for(int i = 0; i < N; i++){
			cin>>I[i];
		}
		
		for(int i = 0; i <= NUM; i++){
			for(int j = 0; j <= NUM; j++){
				for(int k = 0; k <= NUM; k++){
					vector<int> con(MAX,0);
					int R = i;
					double sum = 0;
					
					for(int l = 0; l < N; l++){
						R = (j*R + k)%MAX;
						con[(R+I[l])%MAX]++;
					}
					for(int l = 0; l < MAX; l++){
						if(con[l]){
							sum -= ((double)con[l]/N) * log((double)con[l]/N);
						}
					}
					
					if(sum  < _min - EPS){
						_min = sum;
						ans.first.first = i;
						ans.first.second = j;
						ans.second = k;
					}
				}
			}
		}
		
		cout<<ans.first.first<<" "<<ans.first.second<<" "<<ans.second<<endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 3464
#include <stdio.h>

int main(){
    long long int n;
    int dias,m,a,soma_tarefas=0;

    scanf("%lld %d",&n,&m);

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


    soma_tarefas+=a;

    }
    dias = n - soma_tarefas;

    if(soma_tarefas>n){
        printf("-1\n");
    }else {
        printf("%d\n",dias);
    }



return 0;
}


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

int	main(void)
{
  	int		N;
  	char	S[10000];
  	int 	num;
  	int		i;
  
  	num = scanf("%d", &N);
  	if(num != 1)
      	return (0);
  
  	num = scanf("%s", S);
  	if(num != 1)
      	return (0);
  
  	for(i=0; i<10000; i++)
    {
      	if( S[i] == '\0' )
          	break ;
      	if( S[i] > 'Z' - N )
          	S[i] = S[i] + N - 26;
      	else
          	S[i] = S[i] + N;
    }
  	printf("%s", S);
  	return (0);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(int argc, char const *argv[]) {
  int N,Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  int t[N+1];
  t[0] = 0;
  for(int i=0; i<N; i++){
    t[i+1] = t[i] + ((S[i] == 'A'&&S[i+1]=='C') ? 1:0);
  }

  for (int i=0; i<Q; i++){
    int l,r;
    cin >> l >> r;
    cout << t[r-1]-t[l-1] << endl;
  }

  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> d(n);
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    vector<int> checked(200,0);
    for(int i=0;i<n;i++){
        checked[d[i]]=1;
    }
    int sum=0;
    for(int i=0;i<200;i++){
        sum+=checked[i];
    }
    cout<<sum<<endl;
    return 0;
}

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

int f(int n){
    int n2 = n /10000;
    int n3 = n % 10000;
    int a = n3 /1000;
    int amari = n % 1000;
    int b = amari / 100;
    int bmari = amari % 100;
    int c = bmari /10;
    int cmari = bmari % 10;

    return n2 + a + b + c + cmari;
}

int main(){
    int n;
    int a, b;

    long long  sum = 0;

    cin >> n >> a >> b;

    //printf("f(20) %d\n", f(20));
    
    for(int i = 1; i <= n; i++){
        if(f(i) >= a and f(i) <= b){
            sum = sum + i;
            
        }
    }

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

    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = [1]*n
for _ in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        ans[a-1] = 0
    elif h[a-1] > h[b-1]:
        ans[b-1] = 0
    else:
        ans[a-1] = 0
        ans[b-1] = 0
print(sum(ans))

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

int main(){
  string s; cin >> s;
  int N = s.size();
  int bgn, lst;
  for(int i = 0; i < N; i++){
    if(s[i] == 'A') {bgn = i; break;}
  }
  for(int i = 0; i < N; i++){
    if(s[i] == 'Z') {lst = i;}
  }
  cout << lst - bgn + 1;
}

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

int main(){
  string s; cin >> s;
  bool contained[26];
  for(char c=0; c<26; c++){
    contained[c] = false;
  }

  bool f = true;
  for(int i=0; i<s.length(); i++){
    if(contained[s[i]-'a']) f=false;
    contained[s[i]-'a'] = true;
  }

  cout << (f? "yes": "no") << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    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 T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, A);
    IN(ll, V);
    IN(ll, B);
    IN(ll, W);
    IN(ll, T);
    if (W >= V)
    {
        OUT("NO");
        return 0;
    }
    YES(abs(B - A) <= T * (V - W), "YES", "NO");
}

Measured memory_bytes: 3632
def main():
    from collections import deque
    N = int(input())

    amounts = [1]
    mul6 = 6
    while mul6 <= N:
        amounts.append(mul6)
        mul6 *= 6
    mul9 = 9
    while mul9 <= N:
        amounts.append(mul9)
        mul9 *= 9

    distances = [-1]*(N+1)
    distances[0] = 0

    targets = deque([0])
    while targets:
        t = targets.popleft()
        d = distances[t]
        for a in amounts:
            if t + a <= N and distances[t+a] == -1:
                distances[t+a] = d+1
                targets.append(t+a)
    print(distances[N])




main()

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

char s[15];
ll f2[15],f10[15];

int main(){
	scanf("%s",s);
	f2[0]=f10[0]=1;
	for(int i=1;i<=strlen(s);i++) f2[i]=f2[i-1]<<1,f10[i]=f10[i-1]*10;
	ll sum=0,n=strlen(s);
	for(int i=0;i<n;i++)
		for(int j=0;j<=n-i-1;j++)
			if(j<n-i-1) sum+=(s[j]-'0')*f2[n-i-2]*f10[i];
			else sum+=(s[j]-'0')*f2[n-i-1]*f10[i];
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	long int N,K,S[101],B,i,j,flag;
	
	while(0<=scanf("%ld%ld",&N,&K)){
		if(N==0 && K==0){
			break;
		}
		
		for(i=1;i<=K;i++){
			scanf("%ld",&S[i]);
		}
		
		for(i=1;i<=N;i++){
			for(j=1;j<=K;j++){
				scanf("%ld",&B);
				S[j]=S[j]-B;
			}
		}
		
		flag=0;
		for(i=1;i<=K;i++){
			if(S[i]<0){
				flag=1;
			}
		}
		
		if(flag==1){
			printf("No\n");
		}else{
			printf("Yes\n");
		}
	}
	return 0;
}

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

int gcd(int a, int b);
int gcd(const std::vector<int>& arr);

int main() {

        int n = 0;
        int m = 0;
        std::cin >> n >> m;

        int maxL = std::numeric_limits<int>::min();
        int minR = std::numeric_limits<int>::max();
        int L = 0;
        int R = 0;

        for (std::size_t i = 0; i < m; ++i) {
                std::cin >> L >> R;
                if (L > maxL) {
                        maxL = L;
                }
                if (minR > R) {
                        minR = R;
                }
        }

        if (minR >= maxL) {
                std::cout << minR - maxL + 1 << std::endl;
        }
        else {
                std::cout << 0 << std::endl;
        }

        return 0;
}

int gcd(int a, int b) {
        if (a > b) {
                std::swap(a, b);
        }

        for (int r = b % a; r != 0; b = a, a = r, r = b % a)
                ;

        return a;
}

int gcd(const std::vector<int>& arr) {
        const int size = arr.size();
        if (size == 0) {
                return 0;
        }
        else if (size == 1) {
                return arr[0];
        }

        int ret = gcd(arr[0], arr[1]);

        for (std::size_t i = 2; i < size && ret != 1; ++i) {
                ret = gcd(arr[i], ret);
        }

        return ret;
}


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

#define sci(a) scanf("%d", &a)
#define fto(i, a, b) for (int i = a; i <= b; ++i)
#define fdto(i, a, b) for (int i = a; i >= b; --i)
#define scii(a, b) scanf("%d %d", &a, &b)
#define ll long long
#define ff first
#define ss second
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define pii pair<int, ii>
#define maxN 100005
#define oo 1000000007
#define mp make_pair
#define pb push_back
#define bug(a) cout << #a << "= " << a << endl;
#define bug2(a, b) cout << #a << "= " << a << "; " << #b << "= " << b << endl
#define pri(a) printf("%d", a)
#define pril(a) printf("%d\n", a)

using namespace std;

int n;
ii x[maxN], y[maxN];
vector<pii> canh;
int p[maxN];

int findSet(int i) {
    if(i == p[i]) return i;
    return p[i]= findSet(p[i]);
}
void unionSet(int i, int j) {
    int x = findSet(i);
    int y = findSet(j);
    p[x] = y;
}
int issameSet(int i, int j) {
    return findSet(i) == findSet(j);
}

int main() {
//    #ifndef ONLINE_JUDGE
//    freopen("cf.inp", "r", stdin);
//    freopen("cf.out", "w", stdout);
//    #endif

    sci(n);
    fto(i, 1, n) scii(x[i].ff, y[i].ff), y[i].ss = i, x[i].ss = i;
    sort(x+1, x+1+n);
    sort(y+1, y+1+n);
    fto(i, 1, n-1) canh.pb(mp(x[i+1].ff - x[i].ff, mp(x[i].ss, x[i+1].ss)));
    fto(i, 1, n-1) canh.pb(mp(y[i+1].ff - y[i].ff, mp(y[i].ss, y[i+1].ss)));
    sort(canh.begin(), canh.end());
    int ans = 0;
    fto(i, 1, n) p[i] = i;
    fto(i, 0, (int)canh.size()-1) {
        int w = canh[i].ff;
        int u = canh[i].ss.ff;
        int v = canh[i].ss.ss;
        if(!issameSet(u, v)) {
            ans += w;
            unionSet(u, v);
        }
    }
    pril(ans);
    return 0;
}


Measured memory_bytes: 6516
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define met(a,b); memset(a,b,sizeof(a));
typedef long long ll;
using namespace std;
double pai=3.141592653589793;
 
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
 
// inline long long read() {
//     long long tmp=0, fh=1; char c=getchar();
//     while (c<'0'||c>'9') {if (c=='-') fh=-1; c=getchar();}
//     while (c>='0'&&c<='9') tmp=tmp*10+c-48, c=getchar();
//     return tmp*fh;
// }
int main(){
    int h,a,ans;
    cin>>h>>a;
    ans=h/a;
    if(h%a) ans++;
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(x) x.begin(), x.end()
#define mset(a, b) memset(a, b, sizeof a)
#define rep(i, a, b) for(int i(a), i##_END_(b); i <= i##_END_; i++) 
#define drep(i, a, b) for(int i(a), i##_END_(b); i >= i##_END_; i--)
using namespace std;
template<class T> inline bool tomax(T &a, T b) {return a < b ? a = b, 1 : 0;}
template<class T> inline bool tomin(T &a, T b) {return b < a ? a = b, 1 : 0;}
typedef long long ll;
typedef double db;

const int MOD = 1e9 + 7, N = 55;

int dp[N][N * N][N];

int main() {
    // freopen("data.in", "r", stdin);
    int n, k;
    scanf("%d%d", &n, &k);
    dp[1][0][1] = 1; dp[1][0][0] = 1;
    rep(i, 1, n - 1) rep(j, 0, k) rep(x, 0, i) {
        (dp[i + 1][j + 2 * x][x] += dp[i][j][x]) %= MOD;
        (dp[i + 1][j + 2 * x][x + 1] += dp[i][j][x]) %= MOD;
        if(x > 0) {
            (dp[i + 1][j + 2 * x][x] += (ll) 2 * x * dp[i][j][x] % MOD) %= MOD;
            (dp[i + 1][j + 2 * x][x - 1] += (ll) x * x * dp[i][j][x] % MOD) %= MOD;
        }
    }
    printf("%d\n", dp[n][k][0]);
    return 0;
}


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

#define f first
#define s second
#define pb push_back
#define mp make_pair

using namespace std;

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

const int N = (int)2e5 + 123, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;

int n, ans;
vector< pii > v;
multiset< int >  al, ar, bl, br;

int main()
{
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		int l, r;
		scanf("%d%d", &l, &r);
		v.pb({r, l});
	}
	sort(v.begin(), v.end());
	for(auto it : v){
		int l = it.s, r = it.f;
		bl.insert(l);
		br.insert(r);			
	}
    for(auto it : v){
		int l = it.s, r = it.f;
		bl.erase(bl.find(l));	
		br.erase(br.find(r));
		ans = max(ans, r - l + 1 + max(0, *br.begin() - *bl.rbegin() + 1)); 
		bl.insert(l);
		br.insert(r);			
	}

	for(auto it : v){
		int l = it.s, r = it.f;
		al.insert(l);
		ar.insert(r);			
		bl.erase(bl.find(l));	
		br.erase(br.find(r));
		if(bl.empty())
			break;
		ans = max(ans, max(0, *ar.begin() - *al.rbegin() + 1) + max(0, *br.begin() - *bl.rbegin() + 1)); 
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 10356
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define SUM(n) ((n)+1)*(n)/2
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = (1e9)+7;
#define all(v) v.begin(),v.end()
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

  int n, sum = 0;
  cin >> n;
  int l, r;
  rep(i,n){
    cin >> l >> r;
    sum += (r - l) + 1;
  }
  cout << sum << '\n';
    
  return 0;
}


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

int main() {
    ll K;
    cin >> K;
    queue<ll> q;
    for (ll i = 1; i < 10; i++){
        q.push(i);
    }
    for (ll i = 0; i < K-1; i++) {
        ll s = q.front();
        q.pop();
        for (ll j = -1; j <= 1; j++) {
            ll add = (s % 10) + j;
            if (add >= 0 && add <= 9){
                q.push(s * 10 + add);
            }
        }
    }
    cout << q.front() << endl;
}

Measured memory_bytes: 5088
import java.util.*;

public class Main{

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer K = scan.nextInt();
        Integer X = scan.nextInt();


        for(int i=X-K+1;i<=(X+K)-1;i++){
            System.out.print(i + " ");
        }
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

const double th = M_PI * 60 / 180.0;

struct Point {double x, y;};

void print(Point a) {
    printf("%.8f %.8f\n", a.x, a.y);
}

void koch(int n, Point a, Point b) {
    if (n == 0) return;
    Point s, t, u;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n - 1, a, s); print(s);
    koch(n - 1, s, u); print(u);
    koch(n - 1, u, t); print(t);
    koch(n - 1, t, b);
}

int main(void) {
    int n;
    cin >> n;
    Point a = {0, 0};
    Point b = {100, 0};
    print(a);
    koch(n, a, b);
    print(b);
    return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define endl '\n'
using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int x,a;
	cin>>x>>a;
	if(x<a)cout<<0<<endl;
	else cout<<10<<endl;
}

Measured memory_bytes: 256
/*input
2
1
2 0
1
1 0

*/

#include <bits/stdc++.h>

using namespace std;

vector< vector< pair<int,int> > > personClaim;

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    personClaim.push_back(vector< pair<int,int> >());
    for (int j = 0; j < a; ++j) {
      int x, y;
      cin >> x >> y;
      personClaim[i].emplace_back(x - 1, y);
    }
  }

  int mm = (1 << n), ans = 0;
  for (int i = 1; i < mm; ++i) {
    int contra = false;
    for (int j = 1, k = 0; !contra && (j < mm); j <<= 1, ++k) {
      if ((i & j) == 0) continue;
      auto claim = personClaim[k];
      for (auto p : claim) {
        int b = (1 << p.first);
        if ((i & b) != (p.second * b)) {
          contra = true;
          break;
        }
      }
    }
    if (!contra) {
      ans = max(ans, __builtin_popcount(i));
    }
  }
  cout << ans;

  return 0;
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

class DisjointSet {
    private:
    vector<int> label; //label[x] stores the root of x if x is not root, otherwise it stores -(size of x's set).
    public:
    DisjointSet(){}
    DisjointSet(int n) {
        label.assign(n+7,-1); //label should contains at least n+1 elements, as x is 1-indexed.
        //At first, each node is a seperate set of size 1.      
    }
    int find(int x) { //find the root of set which contains x.
        if (label[x]<0) return (x); //x is root iff label[x] is negative.
        label[x]=find(label[x]);
        return (label[x]); //find the root of x by recursion.
    }
    bool join(int a,int b) { // join the sets which contains a and b. Return false iff a and b are already in the same set.
        int x=find(a);
        int y=find(b);
        if (x==y) return (false); //A set contains both a and b.
        if (label[x]>label[y]) swap(x,y); //label[x]>label[y] means size(x)<size(y).
        //We speed up the disjoint set by joinning the smaller set to the bigger set        
        label[x]+=label[y];
        label[y]=x; //Update the label of x and y.      
        return (true);
    }
    int getSize(int x) { //return the size of set which contains x.
        return (-label[find(x)]);
    }
};



void solve() {

    int n;
    int m;
    cin >> n >> m;
    DisjointSet D(n+1);
    for(int i = 0;i < m;i++){
        int a,b;
        cin >> a >> b;
        D.join(a,b);
    }

    int ans = 0;
    for(int i = 1;i <= n;i++){
        ans = max(ans,D.getSize(i));
    }
    cout << ans << endl;

    

}

int32_t main()
{
    IOS
    // int T; cin >> T; while (T--)
    solve();
    return 0;
}


Measured memory_bytes: 3992
import java.util.Scanner;

class Main{

	static char[][] map;
	static int N;
	static int M;
	static boolean flag;
	static int ans;



	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		int A =sc.nextInt();
		int B = sc.nextInt();
		int X = sc.nextInt();


			if(X < A){
				System.out.println("NO");
			}else if(X > A+B){
				System.out.println("NO");

			}else{
				System.out.println("YES");

			}
			
		


	}


}

class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}





Measured memory_bytes: 23124
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/14/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int N;

void dfs(string s, char mx) {
  if (s.size() == N) {
    cout << s << endl;
  } else {
    for (char c = 'a'; c <= mx; c++) {
      dfs(s+c, c == mx ? char(mx+1) : mx); 
    }
  }
}

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

  cin>>N;
  dfs("", 'a');

  return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;

class Main {
	Scanner sc = new Scanner(System.in);

	
	public void run() {
		while(true){
			int m=sc.nextInt(),f=sc.nextInt(),r=sc.nextInt();
			if(m==-1 && f==-1 && r==-1){
				break;
			}
			if(m!=-1 && f!=-1){
				if(m+f>=80){
					ln("A");
				}else if(m+f >=65){
					ln("B");
				}else if(m+f >=50){
					ln("C");
				}else if(m+f >=30){
					if(r>=50){
						ln("C");
					}else{
						ln("D");
					}
				}else{
					ln("F");
				}
			}else{
				ln("F");
			}
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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; }

int main() {
	
	
	
	int n,k; cin >> n >> k;
	
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	//sort(a.begin(),a.end());
	
	
	vector<ll> cost(n,100000000000);

	
	
	cost[0]=0;
	
	

	for(int i=1;i<n;i++){
		
		for(int j=1;j<=k;j++){
			cost[i]=min(cost[i],abs(h[i]-h[i-j])+cost[i-j]);
			if((i-j)==0) break;
		}
	}



	cout << cost[n-1] << '\n';
	return 0;

}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double lod;
const int N=4e5;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
struct P{ int x,y; inline bool operator < (const P &b) const { return y<b.y; } }p[N];
int x[N],c[N];
int mn[N];
int main()
{
	int x1=gi(),y1=gi(),x2=gi(),y2=gi(),i;
	int n=gi(),t,k,sum=0,s;
	const lod pi=3.14159265358979323846;
	for (i=1;i<=n;i++)
		p[i].x=gi(),p[i].y=gi();
	if (x1>x2) { x1*=-1; x2*=-1; for (i=1;i<=n;i++) p[i].x*=-1; }
	if (y1>y2) { y1*=-1; y2*=-1; for (i=1;i<=n;i++) p[i].y*=-1; }
	for (i=1;i<=n;i++)
		if (p[i].x<x1||x2<p[i].x||p[i].y<y1||y2<p[i].y) p[i--]=p[n--];

	for (i=1;i<=n;i++) x[i]=p[i].x;
	sort(x+1,x+1+n);
	sort(p+1,p+1+n);
	for (i=1;i<=n;i++) {
		k=lower_bound(x+1,x+1+n,p[i].x)-x;
		s=0;
		for (t=k;t;t^=t&-t) s=max(s,c[t]);
		sum=max(sum,++s);
		for (t=k;t<=n;t+=t&-t) c[t]=max(c[t],s);
	}
	/*double ans=100LL*(x2-x1+y2-y1);
	ans=ans-20*sum+5*pi*sum;
 	if (sum==abs(x1-x2)+1||sum==abs(y1-y2)+1)
		ans=ans+5*pi;
		printf("%.15lf\n",ans);*/
	printf("%.15lf\n",100LL*(x2-x1+y2-y1)-20*sum+5*pi*sum+(sum==min(y2-y1,x2-x1)+1?5*pi:0));
	return 0;
}


Measured memory_bytes: 4992
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u32,
    }
    println!("{}", n.pow(3));
}


Measured memory_bytes: 4352
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    char c;
    cin>>c;
    c++;
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

/*
 update : [s,t) に xを加算
 query  : [s,t) の　最大(小)値を出力する
 */

/* [0..N-1] */
const ll INIT = 0; // 問題に合わせる
struct SegTree {
    int N;
    ll init_v;
    vector<ll> node, lazy;
    
    SegTree(int _N):init_v(INIT) {
        N = 1;
        while (N < _N) N *= 2;
        node.resize(2 * N - 1, init_v);
        lazy.resize(2 * N - 1, init_v);
    }
    
    void lazy_evaluate(int l, int r,int k){
        node[k] += lazy[k];
        if(r - l > 1){
            lazy[2 * k + 1] += lazy[k];
            lazy[2 * k + 2] += lazy[k];
        }
        lazy[k] = 0;
    }
    
    /* [a,b) 引数の範囲に注意!! s~tまでを更新→update(s,t+1,~) */
    void update(int a, int b, ll x) { update(a, b, 0, 0, N, x); }
    void update(int a, int b, int k, int l, int r, ll x) {
        lazy_evaluate(l,r,k);
        if (r <= a || b <= l) return;
        if (a <= l && r <= b) {
            lazy[k] += x;
            lazy_evaluate(l,r,k);
        }
        else {
            update(a, b, 2 * k + 1, l, (l + r) / 2, x);
            update(a, b, 2 * k + 2, (l + r) / 2, r, x);
            node[k] = max(node[2 * k + 1],node[2 * k + 2]);
        }
    }
    
    /* [a,b) 引数の範囲に注意!! */
    ll query(int a, int b) { return query(a, b, 0, 0, N); }
    ll query(int a, int b, int k, int l, int r) {
        lazy_evaluate(l, r, k);
        if (r <= a || b <= l) return LLONG_MIN; // min : LLONG_MAX , max : LLONG_MIN
        if (a <= l && r <= b) {
            return node[k];
        }
        else {
            ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return max(vl, vr);
        }
    }
};

int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll N,T; cin >> N >> T;
    SegTree st(T);
    for(int i = 0; i < N;i++){
        ll l,r; cin >> l >> r;
        st.update(l,r,1);
    }
    cout << st.query(0,T+1) << endl;
    return 0;
}



Measured memory_bytes: 7068