akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
  int a,b;
  char op;
  int ans;
  while(1){
    cin >> a >> op >> b;
    if(op == '+'){
      ans = a + b;
    }else if(op == '-'){
      ans = a - b;
    }else if(op == '*'){
      ans = a * b;
    }else if(op == '/'){
      ans = a / b;
    }else if(op == '?'){
      break;
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3060
//                _                                      
//  ___ _ __ ___ (_) __ ___      ___   _ _ __ ___  _ __  
// / __| '_ ` _ \| |/ _` \ \ /\ / / | | | '_ ` _ \| '_ \ 
// \__ \ | | | | | | (_| |\ V  V /| |_| | | | | | | |_) |
// |___/_| |_| |_|_|\__, | \_/\_/  \__,_|_| |_| |_| .__/ 
//                  |___/                         |_|  
//code by smigwump
//https://codeforces.com/blog/entry/62393
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define REP(i,a,b) for(int i = a; i <= b; i++)
#define PER(i,a,b) for(int i = a; i >= b; i--)
typedef long long ll;

using namespace std;

int main() {
	// #ifndef ONLINE_JUDGE
	//     freopen("input.txt", "r", stdin);
	//     freopen("output.txt", "w", stdout);
	// #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a,b;
    cin>>a;
    cin>>b;
    ll len = a.length();
    ll ans = 0;
    REP(i,0,len-1) {
    	if(a[i]!=b[i]) {
    		ans++;
    	}
    }
    cout<<ans<<"\n";
	return 0;
}

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

int main(){
    int N, M, k[10], p[10], s[10][10];
    cin >> N >> M;
    
    for(int i = 0; i < M; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            cin >> s[i][j];
        }    
    }

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

    int count = 0;
    int x = 1;

    for(int i = 0; i < N; i++){
        x *= 2;
    }

    for(int i = 0; i < x; i++){
        int I = i;
        int c[11];
        for(int j = 1; j <= N; j++){
            c[j] = I % 2;
            I /= 2;
        }
        int check = 1;
        for(int a = 0; a < M; a++){
            int sum = 0;
            for(int b = 0; b < k[a]; b++){
                sum += c[s[a][b]];
            }
            if(sum %2 != p[a]){
                check *= 0;
            }
        }
        if(check == 1){
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
l = [[int(i) for i in input().split()] for _ in range(3)]

total1 = 0
total2 = 0


for i in range(3):
    total1 += sum(l[i])
    total2 += l[i][i]
    
if total1 == total2 * 3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<iostream> 
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    while (A > 0 || C > 0) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            return 0;
        } 
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            return 0;
        } 
    }
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#include <cmath>
#include <set>
#include <unordered_set>
#include <iterator>
#include <deque>
#include <assert.h>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}


int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n, m;
    cin>>n>>m;

    int d = (n-1)/2, i = 1;
    while ((m>0) && (d>0)){
        cout<<i<<" "<<i+d<<"\n";
        d-=2;
        i++;
        m--;
    }
    d = ((n-1)/2)-1;
    i = ((n+1)/2)+1;
    while ((m>0) && (d>0)){
        cout<<i<<" "<<i+d<<"\n";
        d-=2;
        i++;
        m--;
    }

    return 0;
}







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

#define INF (INT32_MAX)
#define MOD (1000000000+7)
#define MAX 100000

int N;
int A[MAX];

int gcd(int x, int y)
{
	if( x < y ) {
		swap( x, y );
	}
    int temp;
    while (y != 0) {
        temp = y;
        y = x % y;
        x = temp;
    }
    return (x);
}

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

	int ans = A[0];
	for( int i = 1; i < N; i++ ) {
		ans = gcd( ans, A[i] );
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#define mkp make_pair
#define getbit(a) (1<<(a-1))
#define lowbit(a) ((a)&(-(a)))
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define readbit(a,b) ((a>>(b-1))&1)
#define filein(a) freopen(a,"r",stdin)
#define fileout(a) freopen(a,"w",stdout)
#define plp(a,b,c) for(register int a=b;a<=c;a++)
#define rlp(a,b,c) for(register int a=b;a<=c;a++)
//get
inline void get(int &x) {
	static char c = getchar();x = 0;static int fh = 1;
	while(c < '0' || c > '9')fh=(c=='-')?-1:1,c = getchar();
	while(c <= '9' && c >= '0') x = x*10+c-48, c = getchar();
	x=x*fh;
}
inline void get(long long &x) {
	static char c = getchar();x = 0;static int fh = 1;
	while(c < '0' || c > '9')fh=(c=='-')?-1:1,c = getchar();
	while(c <= '9' && c >= '0') x = x*10+c-48, c = getchar();
	x=x*fh;
}
//get
//putll
inline void putll(long long x) {
	if(x==0) {putchar(48);return;}
	if(x<0){putchar('-');x=-x;}
	static int num = 0;static char c[25];
	while(x) c[++num] = (x%10)+48, x /= 10;
	while(num) putchar(c[num--]);
}
//putll
/*
//Gragh
const int maxv=20005;const int maxe=20005;
static int vet[maxe],vis[maxv],head[maxv],next[maxe],edgenum;
static int val[maxe];
//Gragh
//add
inline void add(int u,int v) {
    vet[++edgenum]=v;
    next[edgenum]=head[u];
    head[u]=edgenum;
}
inline void add(int u,int v,int value){
    vet[++edgenum]=v;
    val[edgenum]=value;
    next[edgenum]=head[u];
    head[u]=edgenum;
}
//add
*/
//正文从这里开始，以上都是MTL
char st[100005];
char map[256];
#include<cstring>
int len;
int main(){
	scanf("%s",st);
	len=strlen(st);
	if(len&1){
		puts("No");
		return 0;
	}
	map['d']='b';map['b']='d';map['p']='q';map['q']='p';
	for(register int i=0;i<(len>>1);i++)
		if(map[st[i]]!=st[len-i-1]){
			puts("No");
			return 0;
		}
	puts("Yes");
} 

Measured memory_bytes: 256
#[test]
fn test_solve() {
    assert_eq!(solve("a\n"), "b\n");
    assert_eq!(solve("y\n"), "z\n");
}

fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let s = sc.chars();

    format!("{}\n", (s[0] as u8 + 1) as char)
}

fn main() {
    let mut buf = String::new();
    use std::io;
    use std::io::{Read, Write};
    io::stdin().read_to_string(&mut buf).unwrap();
    io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}

struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.get().chars().collect()
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};

// FHCまでにスタックオーバーフローの罠を解決する


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

    int n;
    cin>>n;
    vector<pair<int,string>> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i].second;
        a[i].first = a[i].second.size();
    }
    sort(a.begin(),a.end());

    const ll mod1 = 1000000103, mod2 = 1000000483;
    ll mul1=10009;
    ll mul2=10007;

    map<ll,ll> mp1[26],mp2[26];
    ll ans = 0;
    int ma = 0;
    ll one[26]={};
    for(int i=0;i<n;i++){
        string s = a[i].second;
        if(s.size() == 1){
            one[s[0]-'a']++;
            continue;
        }
        ll h1=0;
        ll h2=0;
        int m = s.size(), c=26;
        int cnt[c][m+1]={};
        for(int j=0;j<m;j++){
            cnt[s[j]-'a'][j+1]++;
            for(int k=0;k<26;k++) cnt[k][j+1] += cnt[k][j];
        }
        // one
        for(int j=0;j<26;j++){
            if(cnt[j][m] == 0)continue;
            ans += one[j];
        }
        int now = 0;
        for(int j=m-1;j>=1;j--){
            now++;
            h1 = (h1*mul1 + s[j]) % mod1;
            h2 = (h2*mul2 + s[j]) % mod2;
            if(now > ma)continue;
            for(int k=0;k<26;k++){
                if(cnt[k][j] && mp1[k].count((int)h1) && mp2[k].count((int)h2)){
                    ans += min(mp1[k][h1],mp2[k][h2]);
                }
            }
        }
        chmax(ma,s.size());
        mp1[(int)(s[0]-'a')][h1]++;
        mp2[(int)(s[0]-'a')][h2]++;
    }
    cout << ans << endl;
    
}


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

int main() {
	int s;
	cin >> s;
	int a, b;
	a = s / 100;
	b = s % 100;
	if (0 < a && a <= 12 && 0 < b && b <= 12)cout << "AMBIGUOUS" << endl;
	else if (0 < a && a <= 12)cout << "MMYY" << endl;
	else if (0 < b && b <= 12)cout << "YYMM" << endl;
	else cout << "NA" << endl;
}

Measured memory_bytes: 256
#include <iostream>


int main()
{
	while(1)
	{
		int num,ans,kazu=0;
		std::cin >> num >> ans;
			if(num == 0 && ans == 0)
			{
				return 0;
			}
		for(int i=1; i<=num-2; i++)
		{
			for(int j=i+1; j<=num-1; j++)
			{
				for(int k=j+1; k<=num; k++)
				{
					if(i+j+k == ans)
					{
						kazu++;
					}
				}
			}
		}
	std::cout << kazu << std::endl;
	}
}

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

int main(){
  // 入力
  int N, K;
  cin >> N >> K;
  
  int min_length = 0;
  int x;
  
  for(int i = 0; i < N; i++){
    cin >> x;
    
	if(K - x < x)
      min_length += 2*(K - x);
    else
      min_length += 2*x;
  }
  cout << min_length << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#define mp make_pair
#define pb push_back
#define mem(i,a) memset(i,a,sizeof(i))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
const int DMAX=1000000+5;
const int MOD=1000000000+7;
template<class T> inline void read(T &x){
	x=0;
	T f=1;
	char ch=getchar();
	while(ch<'0' || ch>'9'){
		if(ch=='-'){
			f=-1;
		}
		ch=getchar();
	}
	while(ch<='9' && ch>='0'){
		x=x*10+(ch-'0');
		ch=getchar();
	}
	x*=f;
}
int a,b,c;
int main(){
	cin>>a>>b>>c;
	swap(a,b);
	swap(a,c);
	cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;

Node root;

void insert(int);
void inorder(Node);
void preorder(Node);
//Node Mini(Node);

int main(){

  int i = 0;
  int n = 0, key = 0;
  char com[7];
  Node u;
  
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s",com);
    
    if(com[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    
  }
  
  return 0;
}

void insert(int key){

  Node y = NIL; /* x's parent  */
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = key;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;    /* settei parent */
    if(z->key < x->key){
      x = x->left;   /* move to left child */
    }
    else{
      x = x->right;  /* move to right child */
    }
  }

  z->parent = y;

  if(y == NIL){ /* if T is empty  */
    root = z;
  }
  else if(z->key < y->key){
    y->left = z; /* y'left is z */
  }
  else {
    y->right = z; /* y'right is z */
  }
  
}

void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}

void preorder(Node u){
  if(u != NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}
/*
Node Mini(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}
*/



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

int main(){
 string num;
 cin >> num;
  if(num == "AAA"){
    cout <<"No";
  }
  else{
    if(num == "BBB"){
      cout << "No";
    }
      else{
        cout << "Yes";
      }
  }
  
  return 0;
}

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

int main()
{
    using namespace std;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

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

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
            cin >> A[i][j];
    }

    int count = 0;
    for (int i = 0; i < N; i++)
    {
        int temp = C;
        for (int j = 0; j < M; j++)
        {
            temp += A[i][j] * B[j];
        }
        if (temp > 0)
        {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

var n int

func abso(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

func roud(tp, xp, yp, tn, xn, yn int) bool {
	t := tn - tp
	x := abso(xn - xp)
	y := abso(yn - yp)

	move := x + y

	if t-move < 0 {
		return false
	}

	if (t-move)%2 == 0 {
		return true
	}
	return false
}

func main() {
	var t, x, y []int
	fmt.Scan(&n)
	t = make([]int, n+1)
	x = make([]int, n+1)
	y = make([]int, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&t[i], &x[i], &y[i])
	}

	for i := 0; i < n; i++ {
		if !roud(t[i], x[i], y[i], t[i+1], x[i+1], y[i+1]) {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 5504
#include <iostream>


int main()
{
	int a, b, d, r;
	double f;
	std::cin >> a >> b;

	d = a / b;
	r = a%b;
	f = 1.0*a / b;
	
	
	std::cout << d << " " << r << " " ;
	printf("%.5lf\n", f);

    return 0;
}

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

S = set(input())
if ('S' in S and 'N' not in S) or \
   ('N' in S and 'S' not in S) or \
   ('E' in S and 'W' not in S) or \
   ('W' in S and 'E' not in S):
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a == b && b == c ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

    int a,b,i;
    scanf("%d%d",&a,&b);
    double ret=0;

    for(i=1;i<=a;i++){
        double tmp=1.0/a;
        int now=i;
        while(now<b){
        now*=2;
        tmp/=2;
    }
    ret+=tmp;
    }
    printf("%.12f\n",ret);
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int a[] = new int[6];
        for (int i = 0; i < 6; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        Dice d = new Dice(a);
        char[] orders = sc.next().toCharArray();
        for (int i = 0; i < orders.length; i++) {
//            out.println(d.getTop());
            switch (orders[i]) {
                case 'E':
                    d.rollEast();
                    break;
                case 'W':
                    d.rollWest();
                    break;
                case 'S':
                    d.rollSouth();
                    break;
                case 'N':
                    d.rollNorth();
                    break;
                default:
                    out.println("Error!");
                    break;
            }
        }
        out.println(d.getTop());
        out.flush();
    }
}
class Dice {
    private int top, front, back, left, right, down, temp;
    Dice(int[] a) {
        this.top = a[0];
        this.front = a[4];
        this.back = a[1];
        this.left = a[3];
        this.right = a[2];
        this.down = a[5];
    }
    void rollWest() {
        this.temp = this.left;
        this.left = this.top;
        this.top = this.right;
        this.right = this.down;
        this.down = this.temp;
    }
    void rollEast() {
        this.temp = this.right;
        this.right = this.top;
        this.top = this.left;
        this.left = this.down;
        this.down = this.temp;
    }
    void rollSouth() {
        this.temp = this.back;
        this.back = this.top;
        this.top = this.front;
        this.front = this.down;
        this.down = this.temp;
    }
    void rollNorth() {
        this.temp = this.front;
        this.front = this.top;
        this.top = this.back;
        this.back = this.down;
        this.down = this.temp;
    }
    int getTop() {
        return this.top;
    }
}


Measured memory_bytes: 26276
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;

struct Card{
    string suit;
    int value;
};

int Func(){
    int x = 0;
    return x;
}

int main(){
    int N, M, C;

    float f;
    string s;
    
    //cin >> N;
    //for (int i=0;i<N;i++) cin >> A[i];
    
    cin >> N >> M >> C;
    int B[20];
    int A[20][20];
    
    for (int i=0;i<M;i++) cin >> B[i];
    for (int i=0;i<N;i++) {
        for (int j=0;j<M;j++) {
            cin >> A[i][j];
        }
    }
    
    int result = 0;
    for (int i=0;i<N;i++) {
        int temp = 0;
        for (int j=0;j<M;j++) {
            temp += A[i][j]*B[j];
        }
        if (temp+C>0) result += 1;
    }
    
    cout << result << endl;
    
    
//    Card C1[100], C2[100];
//    //for (int i=0;i<N;i++) cin >> C1[i].suit >> C1[i].value;
//    //for (int i=0;i<N;i++) C2[i] = C1[i];
//
//    vector<int> v{5,4,3,2}; // g++ -std=c++11
//    v.push_back(1);
//    for (int i=0;i<v.size();i++) cout << v[i] << " " ; cout << endl;
//    sort(v.begin(), v.end());
//    for (int i=0;i<v.size();i++) cout << v[i] << " " ; cout << endl;

    
    return 0;
}

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

int main() {
  int n; cin >> n;
  string s; cin >> s;
  
  int ans = 1;
  char buf = s.at(0);
  
  for (int i=1; i<n; i++){
    if (buf != s.at(i)){
      ans++;
      buf = s.at(i);
    }
  }
  
  cout <<ans <<endl;
}


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

int main() {
  string S;
  cin >> S;
  set<char> SSS;
  for (char c:S) {
    SSS.insert(c);
  }
  if (S.size()==SSS.size()) {
    cout << "yes" << endl;
  }
  else {
    cout << "no" << endl;
  }
}


Measured memory_bytes: 3548
s = input()

if s == 'SUN':
  print(7)
elif s == 'MON':
  print(6)
elif s == 'TUE':
  print(5)
elif s == 'WED':
  print(4)
elif s == 'THU':
  print(3)
elif s == 'FRI':
  print(2)
else:
  print(1)
  

Measured memory_bytes: 2940
# 英小文字からなる文字列 S が与えられます．
# S に現れない英小文字であって，最も辞書順（アルファベット順）で小さいものを求めてください．
# ただし，S にすべての英小文字が現れる場合は，代わりに None を出力してください．

s = gets.chomp

result = "None"

("a".."z").each do |char|
  unless s.include?(char)
    result = char
    break
  end
end

puts result


Measured memory_bytes: 1916
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main(){
  int a, b, c, d; cin >> a >> b >> c >> d;
  if(a > b){
    if(c >= d) cout << b + d << endl;
    else cout << b + c << endl;
  }
  else if(a <= b){
    if(c >= d) cout << a + d << endl;
    else cout << a + c << endl;
  }
}

Measured memory_bytes: 256
import java.lang.Integer.min
import java.util.*
import kotlin.math.max

fun readInt(): Int = readLine()!!.toInt()
fun readInts(): List<Int> = readLine()!!.split(" ").map { it.toInt() }

fun parseInt(): Int {
    var digit = System.`in`.read()
    while(digit <= 32) {
        digit = System.`in`.read()
    }

    val negative = digit == '-'.toInt()
    if (negative) {
        digit = System.`in`.read()
    }
    var res = 0
    while (digit in '0'.toInt()..'9'.toInt()) {
        res *= 10
        res += digit - '0'.toInt()
        digit = System.`in`.read()
    }
    return if (negative) -res else res
}

fun gcd(x : Int, y : Int) : Int {
    var a = x
    var b = y
    var r = 0
    while(b > 0) {
        r = a % b
        a = b
        b = r
    }
    return a
}

val MOD : Int = 1000000007

fun pw(base : Int, exp : Int) : Int {
    var b = base.toLong()
    var e = exp
    var res = 1L
    while(e > 0) {
        if ((e and 1) != 0) {
            res = (1L * res * b) % MOD
        }
        b = (1L * b * b) % MOD
        e = e shr 1
    }

    return res.toInt()
}

fun main() {
//    val t = readLine()!!.toInt()
    val t = 1

    for(testNumber in 1..t) {
        val (n, m) = readInts()
        val sz = max(m, n) + 1
        val f = IntArray(sz)
        f[0] = 1
        for(i in 1 until sz) f[i] = ((1L * f[i - 1] * i) % MOD).toInt()

        val inv = IntArray(sz)
        inv[sz - 1] = pw(f[sz - 1], MOD - 2)
        for(i in sz - 2 downTo 0) inv[i] = ((1L * inv[i + 1] * (i + 1)) % MOD).toInt()

        fun comb(n : Int, k : Int) : Int {
            return ((1L * f[n] * inv[k]) % MOD * inv[n - k] % MOD).toInt()
        }

        fun aranj(n : Int, k : Int) : Int {
            return (1L * f[n] * inv[n - k] % MOD).toInt()
        }

        var ans = 0
        for(nrEq in 0..n) {
            val term = 1L * comb(n, nrEq) * aranj(m - nrEq, n - nrEq) % MOD
            if(nrEq % 2 == 0) {
                ans += term.toInt()
                if(ans >= MOD) ans -= MOD
            } else {
                ans -= term.toInt()
                if(ans < 0) ans += MOD
            }
        }

        println(1L * ans * aranj(m, n) % MOD)
    }
}

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

int main() {
    vector<int> x(4),y(4);
    for (int i=0;i<2;i++) cin >> x[i] >> y[i];
    for (int i=2;i<4;i++) {
        x[i]=-(y[i-1]-y[i-2])+x[i-1];
        y[i]=(x[i-1]-x[i-2])+y[i-1];
    }
    for (int i=2;i<4;i++) {
        cout << x[i] << " " << y[i];
        if (i==2) cout << " ";
    }
    cout << endl;
}

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

map<string,bool> hash;

int check(string s)
{
  //  if(hash.insert(make_pair(s,true)).second==0)
  //  return s.size();

  //  cout<<s<<endl;

  bool del=false;
  char tmp=s[0];
  int cnt=1;
  int i=1;
  for(;i<s.size();i++)
    {
      if(tmp==s[i])
	cnt++;
      else
      if(tmp!=s[i])
	{
	  if(cnt>=4)
	    {
	      //sakuzyo
	      //   cout<<i-cnt<<" "<<cnt<<endl;
	      s.erase(i-cnt,cnt);	     
	      i=i-cnt-1;
	      del=true;
	      
	      //	      cout<<s<<endl;
	      break;
	      
	    }
	  cnt=1;
	  tmp=s[i];
	}
    }
  if(!del)
    {
      if(cnt>=4)
	{
	  //sakuzyo
	  //	  cout<<i-cnt<<" "<<i-1<<endl;
	  s.erase(i-cnt);
	  del=true;
	  // cout<<s<<endl;
	}
    }
  
  if(del)
    return check(s);
  else
    return s.size();
}

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      hash.clear();
      string s;
      char t;

      for(int i=0;i<n;i++)
	{
	  cin>>t;
	  s+=t;
	}
      int ans=n;
      
      for(int i=0;i<n;i++)
	{
	  if(i>0 && s[i]!=s[i-1])
	    {
	      string tmp=s;
	      tmp[i]=tmp[i-1];
	      ans=min(ans,check(tmp));
	    }
	  if(i+1<n && s[i]!=s[i+1])
	    {
	      string tmp=s;
	      tmp[i]=tmp[i+1];
	      ans=min(ans,check(tmp));
	    }
	}
      cout<<ans<<endl;
    }
}

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

map<int,int>q;

int main()
{
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            q[i*j]=1;
        }
    }
    int n;cin>>n;
    if(q[n])cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#define PI 3.14159265359
typedef long long ll;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
using namespace std;


ll llmin(ll x, ll y){
	if (x < y) return x;
	return y;
}

ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}


int main(){
	string s;
	cin >> s;
	ll sum = 0;

	for (int i = 0; i < s.length(); i++){
		sum += s[i] - '0';
	}
	if (sum % 9) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3752
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

const string YES = "Yes";
const string NO = "No";

int main()
{
  long long X;
  scanf("%lld", &X);
  cout << (X >= 30 ? YES : NO) << endl;

  return 0;
}


Measured memory_bytes: 3668
import sys,collections as cl,bisect as bs,heapq as hq
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

n,q = m()

a = l()
a.sort()
d = []
su = 0
co = 0
for i in range(q):
	b,c = m()
	if c > a[0]:
		d.append([b,c])
hq.heapify(a)
d.sort(reverse = True,key = lambda x:x[1])

for i in range(len(d)):
	kk = bs.bisect_left(a,d[i][1])
	if kk == 0:
		break
	else:
		if co + d[i][0] >= kk+1:
			su += d[i][1] * (kk-co)
			co += kk-co
			break
		else:
			su += d[i][0] * d[i][1]
			co += d[i][0]

			
su +=sum(a[co:])
print(su)


Measured memory_bytes: 85784
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;
ll mod = pow(10,9) + 7;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}
int main() {
	int h,w; cin >> h >> w;
	vector<string> s(h);
	rep(i,h){
		cin >> s[i];
	}
	rep(i,h){
		cout << s[i] << endl;
		cout << s[i] << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forN(i, n) for(int i = 0; i <n ; ++i)
#define endl "\n"
#define noob (main)
typedef long long ll;
using namespace  std;
typedef vector<int> vi;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const int N = 2e5 +5 ;
vi primes(1,2);
void sieve(){
    vi m(N+1,0);
    for(int i = 4; i<N; i+=2)m[i]=1;
    for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
    for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}
bool isPrime(ll x){
    if(x==1)return 0;
    for(auto i:primes){
        if(i*i>x)return 1;
        if(x%i==0)return 0;
    }
    return 1;
}

int noob(){
    fastIO;
    string s;
    cin>>s;
    if(s[s.size()-1]!='s'){
        cout<<s<<"s";
    }
    else{
        cout<<s<<"es";
    }
}

Measured memory_bytes: 3608
N = int(input())
p = [tuple(map(int,input().split())) for _ in range(N)]
p.sort(key=lambda x:x[2])
mx,my,mh = p[-1]

for cx in range(101):
  for cy in range(101):
    H = mh + abs(mx-cx) + abs(my-cy)
    if all(h == max(H - abs(x - cx) - abs(y - cy), 0) for x, y, h in p):
      print(cx, cy, H)
      exit()


Measured memory_bytes: 3064
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s; cin >> s;
  bool ans = true;
  for(int i = 0; i < (s.size() - 1) / 2; i++) {
    if(s[i] != s[s.size() - 1 - i] || s[i] != s[(s.size() - 1) / 2 - 1 - i]) {
      ans = false; break;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

 int main(){

   string str;

   while(1){

     getline(cin, str);
     if(str[0] == '.') break;

     vector<char> v;

     for(int i = 0; i < (int)str.size(); i++){
       if(str[i] == '[' || str[i] == '('){
	 v.push_back(str[i]);
       }else if(str[i] == ')'){
	 if(v.empty()){
	   v.push_back(str[i]);
	   break;
	 }

	   if(v.back() == '('){
	     v.pop_back();
	   }else break;

       }else if(str[i] == ']'){
	 if(v.empty()){
	   v.push_back(str[i]);
	   break;
	 }

	   if(v.back() == '['){
	     v.pop_back();
	   }else break;
       }
     }
     if(v.empty()) cout << "yes" << endl;
     else cout << "no" << endl;

   }

   return 0;
 }

Measured memory_bytes: 1192
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <utility>
#include <vector>

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<std::pair<int, int>> p(n);
  char buf[1048576];
  for (auto& pi: p) {
    scanf("%s", buf);
    std::string s = buf;
    int diff = 0;
    int depth = 0;
    for (auto c: s) {
      diff += ((c == '(')? +1: -1);
      depth = std::min(depth, diff);
    }
    pi = std::make_pair(depth, diff);
  }

  std::sort(p.begin(), p.end(), [](auto const& p1, auto const& p2) {
    auto [de1, di1] = p1;
    auto [de2, di2] = p2;
    return std::min(de1, di1+de2) > std::min(de2, di2+de1);
  });

  int diff = 0;
  for (auto const& [de, di]: p) {
    if (diff+de < 0) return puts("No"), 0;
    diff += di;
  }

  if (diff != 0) return puts("No"), 0;
  puts("Yes");
}


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

typedef long long ll;
#define EPSILON 1e-9
using namespace std;


int f(int x) {
    int c = 0;
    for (int i = 1; i <= x; i++) {
        c += (x % i == 0);
    }
    return c;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    freopen("n.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    ll n;
    cin >> n;
    vector<ll> p(n + 1, 1);
    ll sum = 1;
    for (ll i = 2; i <= n; ++i) {
        if (p[i] == 1) {
            ++p[i];
            for (ll j = 2 * i; j <= n; j += i) {
                ll x = j / i;
                ll c = 1;
                while (x > 0) {
                    if (x % i == 0) {
                        x /= i;
                        c++;
                    } else {
                        break;
                    }
                }
                p[j] *= (c + 1);
            }
        }
        sum += (i * p[i]);
    }
    
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 81332
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var zennbu = Console.ReadLine().Split();
    var N = long.Parse(zennbu[0]);
    var K = long.Parse(zennbu[1]);
    var j = 0;
    if(K > N){
      long kotae1 = K-N;
      if(kotae1 <= N){
        Console.WriteLine(kotae1);
      }
      else{
        Console.WriteLine(N);
      }
    }
    else if(N == K){
      Console.WriteLine(j);
    }
    else{
      long amari = N%K;
      long saidai = (N-amari)/K;
      long kotae1 = N-(saidai*K);
      
      long kotae2 = -1*(kotae1 - K);
      if(kotae1 <= kotae2){
        Console.WriteLine(kotae1);
      }
      else{
        Console.WriteLine(kotae2);
      }
    }

    
   
  }
}

Measured memory_bytes: 13140
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> cost(1<<n,INF);

	for(int i = 0;i < m;i++){
		int a,b;
		cin >> a >> b;
		int idx = 0;
		for(int j = 0;j < b;j++){
			int c;
			cin >> c;
			c--;
			idx += (1 << c);
		}
		cost[idx] = min(cost[idx],a);
	}

	int sz = cost.size();
	for(int i = 0;i < sz-1;i++){
		for(int j = i+1;j < sz;j++){
			cost[i|j] = min(cost[i|j],cost[i]+cost[j]);
		}
	}

	if(cost[sz-1] == INF)cout << -1 << endl;
	else cout << cost[sz-1] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

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


void solve(){
  int n;cin >> n;
  int a[n];
  for(int i = 0;i < n;i++) cin >> a[i];
  int mn = a[0];
  int ans = 1;
  for(int i = 1;i < n;i++){
    if(mn > a[i]){
      ans++;
      mn = a[i];
    }
  }
  cout << ans << endl;
}


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


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

typedef long long int ll;

#define endl '\n'

ll n;
ll arr[100005][3];
ll dp[100005][3];


ll solve(ll u,ll st)
{
    if(u==n){
        return 0;
    }

    if(dp[u][st]==-1)
    {
        ll val = -1e18;

        for(ll k=0;k<3;k++){
            if(k!=st){
                val = max(val,arr[u][k]+solve(u+1,k));
            }
        }

        dp[u][st] =  val;
    }
    return dp[u][st];

}
int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));

    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    }

    cout<<max(solve(0,0),max(solve(0,1),solve(0,2)))<<endl;
}


Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

bool cmp(pair<ll, ll> x, pair<ll, ll> y) {
  	if (y == make_pair(0ll, 0ll)) return false;
  	if (x == make_pair(0ll, 0ll)) return true;
    bool a = x < make_pair(0ll, 0ll), b = y < make_pair(0ll, 0ll);
    if (a != b) return a < b;
    return x.first * y.second < x.second * y.first;
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll z = 0;
    pair<ll, ll> a[213] = {};
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
    sort(a, a + n, cmp);
    for (int i = 0; i < n; i++) a[i + n] = a[i];
    for (int i = 0; i < n; i++) {
        ll x = 0, y = 0;
        for (int j = i; j < i + n; j++) {
            x += a[j].first;
            y += a[j].second;
            z = max(z, x * x + y * y);
        }
    }
    cout << setprecision(17) << sqrt(z) << '\n';
}



Measured memory_bytes: 3764
MOD = 10**9 + 7


def main():
    N, K = (int(i) for i in input().split())
    ans = 0
    A = [0]*(K+1)
    for i in range(1, K+1)[::-1]:
        A[i] += pow(K//i, N, MOD)
        A[i] %= MOD
        for j in range(2*i, K+1, i):
            A[i] -= A[j]
        ans += i*A[i]
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74720
x = gets.to_i

b = (-((x.to_f)**(0.2))).to_i

while true do
  a = ((x + b**5) ** (0.2)).to_i

  if a ** 5 - b ** 5 == x
    puts "#{a} #{b}"
    break
  end

  b += 1
end

Measured memory_bytes: 14672
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int X,Y,Z;
    cin >> X >> Y >> Z;
    swap(X,Y);
    swap(X,Z);
    cout << X MM Y MM Z << endl;
    return 0;
}



Measured memory_bytes: 768
import itertools, math
a = [int(input()) for i in range(5)]
x = 130*5
for i in itertools.permutations(a):
    y = 0
    for j in range(4):
        y+=math.ceil(i[j]/10)*10
    y+=i[4]
    x=min(x,y)
print(x)

Measured memory_bytes: 9032
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int N, x;
    cin >> N >> x;
    if(x-(N-2) <= N && N <= x+(N-2)){
      cout << "Yes\n";
      vector<int> ans(2*N-1);
      ans[N-1] = x;
      int sm = 1, lg = 2*N-1, turn = 0;
      FOR(i, 1, N){
        if(sm == x) sm++;
        if(lg == x) lg--;
        if(turn){
          ans[N-1-i] = sm++;
          ans[N-1+i] = lg--;
        }else{
          ans[N-1-i] = lg--;
          ans[N-1+i] = sm++;
        }
        turn = (turn+1)%2;
      }
      REP(i, 2*N-1) cout << ans[i] << (i == 2*N-2 ? "\n" : " ");
    }else{
      cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n,l;
    scanf("%d%d", &n, &l);
    int mindif=1e9;
    int all=0;
    for(int i=l;i<n+l;i++) all+=i;

    int res;
    for(int i=l;i<n+l;i++)
    {
        if(mindif>abs(i))
        {
            mindif=abs(i);
            res=all-i;
        }
    }
    printf("%d\n",res);    
}

Measured memory_bytes: 256
n = int(input())
import  numpy as np
fact = np.zeros(100)
def prime_factorize(n):
    while n % 2 == 0:
        fact[1]+=1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            fact[f-1] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        fact[n-1] += 1

for i in range(2, n + 1):
  prime_factorize(i)

def num(a):
  return sum(fact>=a-1)

print(num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1) + num(5)*(num(5)-1)*(num(3)-2)//2)

Measured memory_bytes: 12512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,ans=0;
  cin>>N;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(a%2==1 && i%2==0)ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

#define lc c[x][0]
#define rc c[x][1]

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-8;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 2e5+10;
const int MAXM = (int) 3e6+10;

///--------------------START-------------------------
int N;
vector<int> G[MAXN];
LL ans[MAXN];
int siz[MAXN];

LL power(LL x,LL y){
    LL ret=1;
    for(;y;y>>=1,x=x*x%MOD)if(y&1)
        ret=ret*x%MOD;
    return ret;
}

void DFS(int u,int fa){
    siz[u]=1;
    int sizU=G[u].size();
    for(int i=0;i<sizU;i++){
        int v=G[u][i];
        if(v==fa) continue;
        DFS(v,u);
        siz[u]+=siz[v];
    }
    ans[1]=ans[1]*power(siz[u],MOD-2)%MOD;
}

void DFS2(int u,int fa){
    int sizU=G[u].size();
    for(int i=0;i<sizU;i++){
        int v=G[u][i];
        if(v==fa) continue;
        ans[v]=ans[u]*siz[v]%MOD*power(N-siz[v],MOD-2)%MOD;
        DFS2(v,u);
    }

}

void work(){
    scanf("%d",&N);
    for(int i=1;i<N;i++){
        int u,v; scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    ans[1]=1;
    for(int i=2;i<=N;i++) ans[1]=ans[1]*i%MOD;
    DFS(1,-1);
//    printf("%lld\n",ans[1]);
    DFS2(1,-1);
    for(int i=1;i<=N;i++) printf("%lld\n",ans[i]);
}

///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}





Measured memory_bytes: 16244
import sys
input = sys.stdin.readline
N, A, B, K = map(int, input().split())
mod = 998244353
class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod

f = Factorial(N, mod)
res = 0
for r in range(N + 1):
  if K < r * A: break
  if (K - r * A) % B: continue
  b = (K - r * A) // B
  if b > N: continue
  res += f.combi(N, r) * f.combi(N, b)
  res %= mod
print(res)

Measured memory_bytes: 62048
s = input()
t = input()
alf = []
for i in range(97,123):
    alf.append(chr(i))
slist = []
tlist = []
for i in alf:
    slist.append(s.count(i))
    tlist.append(t.count(i))
slist.sort()
tlist.sort()
ans = "Yes"
for i in range(len(slist)):
    if slist[i] != tlist[i]:
        ans = "No"
print(ans)

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX / 100;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
const double PI = 3.14159265358979323846;

typedef pair<char, char> P;


int main() {
    int n;
    cin >> n;
    ll tn = 1, an = 1;
    rep(i, n) {
        ll t, a;
        cin >> t >> a;

        ll tr = (tn + t - 1) / t;
        ll ar = (an + a - 1) / a;
        ll r = max(tr, ar);

        tn = t * r;
        an = a * r;

    }
    cout << tn + an << endl;

}



Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
#define REP(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
int a[5005];
int dp[5005][5005];
void init() {
	REP(i, 5005)
		REP(j, 5005)dp[i][j] = 0;
}
signed main() {
	int n, k; cin >> n >> k;
	REP(i, n)cin >> a[i]; sort(a, a + n);

	int ok = -1, ng = n;
	while(ng-ok>1){
	int i = (ok + ng) / 2;
		init();
		dp[0][0] = 1;
		for (int j = 0; j < n; j++) {//card
			for (int l = 0; l < k; l++) {
				dp[j + 1][l] += dp[j][l];
				if (j != i&&l + a[j] <= k)dp[j + 1][l + a[j]] += dp[j][l];
			}
		}
		int flg = 0;
		for (int j = max(0ll,k - a[i]); j <= k - 1; j++) {
			if (dp[n][j])flg++;
		}
		if (flg)ng = i;
		else ok = i;
	}
	cout << ng << endl;
}


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

int main(void) {
    string s;
    cin >> s;
    int n = (int)(s.length());
    for (int i = 0; i < (n-1)/2; i++) {
        if (s[i] != s[(n-1)/2-1-i]) {
            cout << "No" << endl;
            return 0;
        }
        if (s[i] != s[n-1-i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

int main()
{
  int L, R;
  cin >> L >> R;
  if (2019 <= R-L+1) {
    cout << "0\n";
    return 0;
  }
  vector<long long> v(R-L+1);
  for (long long i = L; i <= R; i++) {
    v.at(i-L) = i;
  }
  long long result = 2019;
  for (int x = 0; x < (int)v.size(); x++) {
    for (int y = x+1; y < (int)v.size(); y++) {
      result = min(result, (v.at(x)*v.at(y)) % 2019);
    }
  }
  cout << result << '\n';
  return 0;
}


Measured memory_bytes: 384
#include <iostream>


const int SIZE = 3;

int main(void){

	int in[SIZE];
	for(int i = 0; i < SIZE; i++){
		std::cin >> in[i];
	}

	for(int i = 0; i < SIZE; i++){
		
		bool flag = true;
		for(int j = 0; j < SIZE; j++){
			if(i != j && in[i] == in[j]){
				flag = false;
			}
		}

		if(flag){
			std::cout << in[i] << std::endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
/// I won't go back on my word, that's my ninja way!
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5 ;
string str ;
int solve(char ch){
    int ret = str.size() ;
    for(int i=0;i<str.size();++i)if(str[i]==ch){
        int j = i ;
        while(j<str.size() && str[j]==ch)++j;
        --j ;


        int a = j + 1 ;
        int b = str.size() - i ;

        int a0 = a - (j-i+1) ;
        int b0 = b ;
        int ans0 = min(a,max(a0,b0));


        int a1 = a ;
        int b1 = b - (j-i+1) ;
        int ans1 = min(b,max(a1,b1));

        ret = min(ret ,max(ans0,ans1));

        i = j ;
    }
    return ret ;
}
int main(){
    cin >> str ;
    cout << max(solve('0') ,solve('1')) ;
    return 0 ;
}


Measured memory_bytes: 512