akhauriyash/Code-Regression huggingface dataset:
using System.Linq;

namespace ABC
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.Design;
    using System.Threading;
#if USE_STUB
    using static Stub.Console;
#else
    using static System.Console;
#endif
    using static System.Math;
    public class Program
    {
        static void Main(string[] args)
        {
            var result = Solve();
            foreach (var line in result)
            {
                WriteLine(line);
            }
        }

        static IEnumerable<object> Solve()
        {
            var n = int.Parse(ReadLine());
            var sx = ReadLines(n, x => x);
            return sx.GroupBy(x => x)
                .Select(x => (count: x.Count(), value: x.Key))
                .GroupBy(x => x.count)
                .OrderByDescending(x => x.Key)
                .First().OrderBy(x => x.value).Select(x => x.value);
        }

        static IEnumerable<T> ReadLines<T>(int count, Func<string, T> selector)
        {
            for (int i = 0; i < count; i++)
            {
                yield return selector(ReadLine());
            }
        }
    }
}


Measured memory_bytes: 68448
#include<stdio.h>
#include<string.h>
#define N 2000000
#define INF -1

int parent(int);
int left(int);
int right(int);
void Insert(int);
int ExtraMax(void);
void Maxheap(int);
void Increasekey(int,int);

int H=0,S[N];

int main(){
  int key;
  char ch[20];
  while(1){
    scanf("%s",ch);
    if(ch[0]=='i'){
      scanf("%d",&key);
      Insert(key);
    }
    else if(ch[0]=='e' && ch[1]=='x'){
      printf("%d\n",ExtraMax());
    }
    else
      break;
  }
  return 0;
}
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}
void Insert(int key){
  H++;
  S[H]=INF;
  Increasekey(H,key);
}
int ExtraMax(){
  int max;
  max=S[1];
  S[1]=S[H];
  H--;
  Maxheap(1);
  return max;
}
void Maxheap(int i){
  int l,r,large,tmp;
  l=left(i);
  r=right(i);
  if(l<=H && S[l]>S[i])
    large=l;
  else large=i;
  if(r<=H && S[r]>S[large])
    large=r;

  if(large!=i){
    tmp=S[i];
    S[i]=S[large];
    S[large]=tmp;
    Maxheap(large);
  }
}
void Increasekey(int i,int key){
  int tmp;
  S[i]=key;
  while(i>1 && S[parent(i)]<S[i]){
    tmp=S[parent(i)];
    S[parent(i)]=S[i];
    S[i]=tmp;
    i=parent(i);
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0;i < N; i++) {
     cin >> A[i];
  }
  sort(A.begin(), A.end());
 
  cout << abs(A.back() - A.front()) << endl;
  
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)

int main() {

    int n;
    static int a[100004] = {};
    int in;

    scanf("%d", &n);

    Rep(i,n){
        scanf("%d", &in);
        a[in]++;
    }

    int ans = 0;
    int cnt = 0;

    Repe(i,100000,1){
        cnt = a[i-1] + a[i] + a[i+1];
        ans = max(cnt, ans);
    }

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

    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
    int x,y;
    for(;;){
        cin >> x >> y;
        if((x==0)&&(y==0))break;
        if(x>y){
            cout << y << " " << x << endl;
        } else {
            cout << x << " " << y << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3120
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] length = new int[n];
		for (int i = 0; i < length.length; i++) {
			length[i] = scan.nextInt();
		}
		
		Arrays.sort(length);
		int sum = 0;
		for (int i = 0; i < length.length - 1; i++) {
			sum += length[i];
		}
		
		if (sum > length[length.length - 1]) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		scan.close();
	}
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 1e6 + 100;
const int LOG = 20;
const int mod = 1e9 + 7;
const int MX = 2e7 + 100;
typedef long long li;
const li MOD = 1000000000949747713ll;

struct point {
    ll k, b;
    point(){
        k = b = 0;
    }

    point(ll K,ll B){
        k = K;
        b = B;
    }
};

struct vertex {
    point p;
    vertex *l, *r;

    vertex() {
        l = r = NULL;
    }
};

vertex mem[MX];
int top_mem = 0;

inline vertex* get_new(point &cur) {
    assert(top_mem < MX);
    mem[top_mem].p = cur;
    return &mem[top_mem++];
}

ll calc(point &p, ll x) {
    return p.k * x + p.b;
}

vertex *update(vertex *v, int tl, int tr, point cur) {
    if (!v)
        return get_new(cur);
    if (tl == tr) {
        if (calc(cur, tl) < calc(v->p, tl)) {
            v->p = cur;
        }
        return v;
    } else {
        int tm = (tl + tr) >> 1;
        if (calc(cur, tm) < calc(v->p, tm)) {
            swap(v->p, cur);
        }

        if (calc(cur, tl) < calc(v->p, tl)) {
            v->l = update(v->l, tl, tm, cur);
        } else {
            v->r = update(v->r, tm + 1, tr, cur);
        }
        return v;
    }
}

ll get(vertex *v, int tl, int tr, int x) {
    if (!v)
        return inf_ll;
    if (tl == tr) {
        return calc(v->p, x);
    } else {
        int tm = (tl + tr) >> 1;
        ll cur = calc(v->p, x);
        if (x <= tm) {
            return min(cur, get(v->l, tl, tm, x));
        } else {
            return min(cur, get(v->r, tm + 1, tr, x) );
        }
    }
}


ll h[MAXN];

ll dp[MAXN];

void solve() {
    int n;
    ll c;
    cin >> n >> c;
    vertex *root = NULL;
    for (int i = 1; i <= n; ++i) {
        cin >> h[i];
    }
    int mx = 2e6;
    point p = {-2 * h[1], 1ll * h[1] * h[1]};
    root = update(root, 0, mx, p);

    for (int i = 2; i <= n; ++i) {
        dp[i] = c + h[i] * h[i];
        dout << i <<" - "<<dp[i]<<endl;
        dp[i] += get(root, 0, mx, h[i]);

        point p = {-2 * h[i], dp[i] + h[i] * h[i]};
        root = update(root, 0, mx,p);

        dout << i<<" - "<<dp[i]<<endl;
    }
    cout << dp[n];


}

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;

    while (t--)
        solve();
    dout << endl << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}


Measured memory_bytes: 632320
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<sstream>

using namespace std;
#define ll 		long long
#define int     long long
#define ld 		long double
#define vll 	vector<ll>
#define pll 	pair<ll,ll>
#define map1 	map<ll,ll>
#define pqb 	priority_queue<ll>
#define pqs 	priority_queue<ll, vll,greater<ll> >
#define push_back emplace_back
#define N 		100009
#define mod 	1e9+9
#define MAX 	1e9
#define test(tt123) ll Tt123,tt123; cin>>Tt123; for(tt123=1 ; t<=Tt123 ; t++)    
#define one(x)	__builtin_popcountll(x)
#define zero(x) __builtin_ctzll(x)
#define precision(x) cout<<fixed<<setprecision(x);
#define debug(x)   cout<<"HELLO "<<x<<endl
const double pi = 3.14159265358979323846;
//vector<pll> p;
void fast(){
	//p.push_back({1,0}); p.push_back({0,1}); p.push_back({-1,0});p.push_back({0,-1});
	//p.push_back({-1,-1}); p.push_back({-1,1}); p.push_back({1,-1});p.push_back({1,1});
	ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	//#endif
}

int32_t main(){
	fast();
	string n; cin>>n;
	
	int num=0 ;
	for(int i=0 ; i<n.length() ;i++)
	  num += (n[i]-'0');
	if(num%9==0) 
	 	cout<<"Yes\n";
	else
		cout<<"No\n";	  
}


Measured memory_bytes: 3780
#include<iostream>
#include<string> // for using std::string data type
 
using namespace std;
 
int main(){
  string s;
  getline(cin, s);
  
  if(s[2] == s[3] && s[4] == s[5])
    cout << "Yes";
  else
    cout << "No";
  
 return 0; 
}


Measured memory_bytes: 256
from collections import deque
# N = int(input())
# S = input()
N, M = map(int, input().split())
# A = list(map(int, input().split()))

edge = [[] for _ in range(N + 1)]

for _ in range(M):
    A, B = map(int, input().split())
    edge[A].append(B)
    edge[B].append(A)

q = deque([1])
done = [True for _ in range(N + 1)]
done[1] = False

ans = [0 for _ in range(N + 1)]

while q:
    num = q.popleft()
    for e in edge[num]:
        if done[e]:
            ans[e] = num
            done[e] = False
            q.append(e)

print("Yes")
for i in range(2, N + 1):
    print(ans[i])

Measured memory_bytes: 35052
class Tree():
    def __init__(self):
        self.root = None
    def insert(self, key):
        z = Node(key)
        y = None
        x = self.root
        while x:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
        z.parent = y
        if y == None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z

    def print(self):
        print('', ' '.join(map(str, self.root.inwalk())))
        print('', ' '.join(map(str, self.root.prewalk())))

    def find(self, x, k):
        while x != None and k != x.key:
            if k < x.key:
                x = x.left
            else:
                x = x.right
        return x

    def delete(self, k):
        z = self.find(tree.root, k)
        y = self.minimum(z.right) if z.left and z.right else z
        x = y.left if y.left else y.right

        if x:
            x.parent = y.parent
        if y.parent == None:
            self.root = x
        elif y == y.parent.left:
            y.parent.left = x
        else:
            y.parent.right = x
        if y != z:
            z.key = y.key

    def minimum(self, x):
        while x.left:
            x = x.left
        return x

class Node():
    def __init__(self, key):
        self.key = key
        self.parent = self.left = self.right = None

    def prewalk(self):
        ret = [self.key]
        if self.left:
            ret += self.left.prewalk()
        if self.right:
            ret += self.right.prewalk()
        return ret

    def inwalk(self):
        ret = []
        if self.left:
            ret += self.left.inwalk()
        ret += [self.key]
        if self.right:
            ret += self.right.inwalk()
        return ret

tree = Tree()
n = int(input())
for i in range(n):
    com = input().split()
    if com[0] == "insert":
        tree.insert(int(com[1]))
    elif com[0] == "find":
        ans = tree.find(tree.root, int(com[1]))
        if ans != None:
            print("yes")
        else:
            print("no")
    elif com[0] == "delete":
        tree.delete(int(com[1]))
    else:
        tree.print()



Measured memory_bytes: 117884
n=int(input())
s=input()
s_list=[]
for i in range(len(s)):
    s_list.append(s[i])

ans_list=[]
for j in range(len(s_list)):
    ans=len(set(s_list[:j])&set(s_list[j:]))
    ans_list.append(ans)

ans_list.sort()
print(ans_list[-1])


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n, y;
	cin >> n >> y;
	for(int i = 0; i <= n; i++){
		for(int j = 0; i + j <= n; j++){
			int k = n - (i + j);
			if(10000 * i + 5000 * j + 1000 * k == y){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

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

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pint;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;

int main() {
    int n; cin >> n;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    vector<ll> acum(n+1, 0);
    rep(i, n) {
        acum[i+1] = acum[i] + a[i];
    }

    int l = 1;
    int r = 3;
    ll ans = LINF;
    for (int i = 2; i < n-1; i++) {
        if (r <= i) r = i+1;
        while (l+1 < i && abs(acum[l+1] - (acum[i] - acum[l+1])) <= abs(acum[l] - (acum[i] - acum[l]))) {
            l++;
        }
        while (r+1 < n && abs(acum[r+1] - acum[i] - (acum[n] - acum[r+1])) <= abs(acum[r] - acum[i] - (acum[n] - acum[r]))) {
            r++;
        }
        ll mn = min({acum[l], (acum[i] - acum[l]), acum[r] - acum[i], acum[n] - acum[r]});
        ll mx = max({acum[l], (acum[i] - acum[l]), acum[r] - acum[i], acum[n] - acum[r]});
        ans = min(ans, mx-mn);
    }

    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 3328
import sys

n = int(input())
# a = map(int, sys.stdin.read().split("\n"))
a = map(int, [int(input()) for i in range(n)])

d = dict()
for a_i in a:
	if a_i not in d:
		d[a_i] = 0
	d[a_i] = (d[a_i]+1) % 2

print(sum(d.values()))

Measured memory_bytes: 16268
S = input().rstrip()
w = 0
b = 0
for i in range(len(S)):
    if i%2==0 and int(S[i])==0:
        w += 1
    elif  i%2==1 and int(S[i])==1:
        w += 1
    elif  i%2==0 and int(S[i])==1:
        b += 1
    elif  i%2==1 and int(S[i])==0:
        b += 1
print(min(w,b))

Measured memory_bytes: 9300
#include <bits/stdc++.h>
int main()
{
	for(std::size_t n,k,m;;){
		std::cin >> n>> k >> m;
		if(n == 0 and k == 0 and m == 0){break;}
		auto rec = [&](auto&& self, const int N)->std::size_t{return N == 1?0:(self(self,N-1)+k)%N;};
		std::cout <<((rec(rec,n-1)+m)%n)+1<<std::endl;
	}
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define REP(n)    for(int i = 0; i < (n); ++i)
#define RREP(n)   for(int i = (n); i >= 0; --i)
#define FOR(m, n) for(int i = (m); i < (n); ++i)
#define SZ(x)       ( (int)(x).size() )
#define BIT(n)      ( 1LL << (n) )
#define EXIST(x)    ( (x).find()		!= (x).end() )
#define DEBUG(n)    cerr << #n << " : " << n << '\n';
#define PB  push_back
#define UB  upper_bound			//k <
#define LB  lower_bound			//k	<= 
#define F   first
#define S   second
#define INF 1.0e9


using namespace std;

typedef long long			ll;
typedef pair<int, int>		pii;
typedef pair<long			long, long long>   pll;
typedef vector<int>			vi;
typedef vector<double>		vd;
typedef vector<long long>   vll
;

template<class T> void chmax(T &	a, const T & b){ if( a < b ) a = b; }
template<class T> void chmin(T &	a, const T & b){ if( a > b ) a = b; }

int r_up(const int a, const int b){ return (a + b - 1) / b; }

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

struct UFT{
  vi	p;
  UFT(){}
  UFT(int N)       { p.resize( N, -1 ); }
  int	par(int a)   { if( p[a] >= 0 ){ p[a]  = par( p[a] ); return p[a]; } return a;  }
  int size(int a)  { return -p[par(a)]; }
  bool	same(int a, int b) { return par(a)	 == par(b); }
  void unite(int	a, int b){
	a													  = par(a);  b = par(b);
	if( a == b ) return;
	if( size(a) < size(b) ) swap(a,b);
	p[a]												 -= size(b);
	p[b]												  = a;
  }
};
int n;
vi v(100),c(100);
int rec(int i,int j,int k){
  if(i>=n)return j-k;
  return max(rec(i+1,j+v[i],k+c[i]),rec(i+1,j,k));
}

int main(){
  cin>>n;
  REP(n)cin>>v[i];
  REP(n)cin>>c[i];
  cout<<rec(0,0,0)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#define N (200010)
#define P ()
#define M ()
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
namespace fastIO1{
	inline char read(){
		static const int IN_LEN=1000000;
		static char buf[IN_LEN],*s,*t;
		return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
	}
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=read();!isdigit(c);c=read()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=read())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
	inline char readc(char &c){
		for(c=read();!isalpha(c)&&!isdigit(c);c=read())
		if(c==-1)return 0;
	}
	const int OUT_LEN = 10000000;
	char obuf[OUT_LEN],*ooh=obuf;
	inline void print(char c){
		if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
		*ooh++=c;
	}
	template<class T>
	inline void print(T x){
		static int buf[30],cnt;
		if(x==0)print('0');
		else{
			if(x<0)print('-'),x=-x;
			for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
			while(cnt)print((char)buf[cnt--]);
		}
	}
	inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
}
namespace fastIO2{
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=getchar();!isdigit(c);c=getchar()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=getchar())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
}
using namespace fastIO1;
int n,m,ans,a[N];
bool check(int x){
//	for(int i=1;i<=x;i++)if(a[i]+a[x*2-i+1]>=m)return 0;
	for(int i=2*x+1,j=2*n;i<j;i++,j--)if(a[i]+a[j]<m)return 0;return 1;
}
int main(){
	read(n),read(m);int L=0,R=n;
	for(int i=1;i<=2*n;i++)read(a[i]); sort(a+1,a+2*n+1);
	while(L<R){
		int mid=L+R>>1;
		if(check(mid))R=mid;
		else L=mid+1;
	}
//	cout<<L<<endl;
	for(int i=1,j=2*L;i<j;i++,j--)ans=max(ans,a[i]+a[j]);
	for(int i=2*L+1,j=2*n;i<j;i++,j--)ans=max(ans,a[i]-m+a[j]);
	printf("%d\n",ans);
}

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define ten(n) ((int)1e##n)
#define fst first
#define snd second
using ll=long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pil=pair<int,ll>;using pli=pair<ll,int>;
using vs=vector<string>;using vvs=vector<vs>;using vvvs=vector<vvs>;
using vb=vector<bool>;using vvb=vector<vb>;using vvvb=vector<vvb>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<class T> bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
ll ri(){ll l;cin>>l;return l;} string rs(){string s;cin>>s;return s;}
template<class T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<'('<<p.fst<<", "<<p.snd<<')';}
ostream&operator<<(ostream&o,const vb&t){forr(e,t)o<<"#."[e];return o;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&t){o<<"{";forr(e,t)o<<e<<",";o<<"}"<<endl;return o;}
#ifdef LOCAL
vs s_p_l_i_t(const string&s,char c){vs v;stringstream ss(s);string x;while(getline(ss,x,c))v.emplace_back(x);return move(v);}
void e_r_r(vs::iterator it){cerr<<endl;}
template<class T,class... Args>void e_r_r(vs::iterator it,T a,Args... args){cerr<<it->substr((*it)[0]==' ',it->length())<<" = "<<a<<", ";e_r_r(++it,args...);}
#define out(args...){vs a_r_g_s=s_p_l_i_t(#args,',');e_r_r(a_r_g_s.begin(),args);}
#else
#define out(args...)
#endif

void Main() {
  int n = ri();
  int m = ri();
  vi ans(n);
  rep(i, m) {
    int u = ri() - 1;
    int v = ri() - 1;
    ans[u]++;
    ans[v]++;
  }
  rep(i, n) {
    cout << ans[i] << endl;
  }
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 256
#include <iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int i = 0;
    for(i=0;;i++){
        int a=0,b=0;
        string c;
        cin >> a >> c >> b;
        if (c=="+"){
            cout << a+b << endl;
        }
        if (c=="-"){
            cout << a-b << endl;
        }
        if (c=="*"){
            cout << a*b << endl;
        }
        if (c=="/"){
            cout << a/b << endl;
        }
        if (c =="?")break;
    }
}

Measured memory_bytes: 1208
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = nk[0], K = nk[1];
            var rsp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int R = rsp[0], S = rsp[1], P = rsp[2];
            var T = Console.ReadLine();


            var ans = 0L;
            for (var i = 0; i < K; i++)
            {
                var c = '?';
                for (var j = i; j < N; j += K)
                {
                    if (c == T[j])
                    {
                        c = '?';
                        continue;
                    }

                    switch (T[j])
                    {
                        case 'r':
                            ans += P;
                            break;
                        case 'p':
                            ans += S;
                            break;
                        case 's':
                            ans += R;
                            break;
                        default:
                            break;
                    }

                    c = T[j];
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13408
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    int N, K, C; cin>>N>>K>>C;
    string S; cin>>S;
    if(C==0){
        int count=0;
        rep(i,N){
            if(S[i]=='o') count++;
        }
        if(count==K){
            rep(i,N){
                if(S[i]=='o') cout<<i+1<<endl;
            }
        }
        return 0;
    }
    vec R(200010), L(200010), imos(200010,0);
    L[0]=0; R[0]=0;
    rep(i,N){
        if(S[i]=='o'){
            L[i+1]=1;
            if(i>=C) L[i+1]+=L[i-C];
        }
        else{
            L[i+1]=L[i];
        }
    }
    rep(i,N){
        if(S[N-1-i]=='o'){
            R[i+1]=1;
            if(i>=C) R[i+1]+=R[i-C];
        }
        else{
            R[i+1]=R[i];
        }
    }
    int l;
    rep(r,N+1){
        l=max(-1,r-C-1);
        int res=L[l+1]+R[N-r];
        if(res>=K){
            imos[l+1]++;
            imos[r]--;
        }
    }
    while(l<N){
        if(L[l+1]>=K){
            imos[l+1]++;
            imos[N]--;
        }
        l++;
    }
    FOR(i,1,N){
        imos[i]+=imos[i-1];
    }
    rep(i,N){
        if(imos[i]==0 && S[i]=='o') cout<<i+1<<endl;
    }
}

Measured memory_bytes: 5252
program ATCoder
implicit none
character*10::s
integer::i,l,count=0,ans=0
read*,s
s=trim(adjustl(s))
l=len_trim(s)
!print*,l
do i=1,l
   if(s(i:i)=='A'.or.s(i:i)=='T'.or.s(i:i)=='C'.or.s(i:i)=='G')then
      count=count+1
      ans=max(count,ans)
   else
      count=0
   end if
end do

print*,ans
!print*,s

end program ATCoder

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int main() {
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	if (std::abs(a - c) <= d || (std::abs(a - b) <= d && std::abs(b - c) <= d))printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
A=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
b=[int(input()) for _ in range(N)]
for i in range(3):
    if set(A[i]) <= set(b):
        print("Yes")
        exit()
    if set([A[0][i], A[1][i], A[2][i]]) <= set(b):
        print("Yes")
        exit()
if set([A[0][0], A[1][1], A[2][2]]) <= set(b) or set([A[0][2], A[1][1], A[2][0]]) <= set(b):
    print("Yes")
    exit()
print("No")


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

#define int long long

using namespace std;

int mod = 998244353;
const int maxn = 200005;

int fac[maxn];
int binpow(int a, int b) {
    if (b == 0) return 1;
    if (b % 2 == 1) return (a*binpow(a, b-1))%mod;
    int v = binpow(a, b/2);
    return (v*v)%mod;
}
int inverse(int x) {
    return binpow(x, mod-2);
}
long long C(int n, int k) {
    return fac[n] * inverse(fac[k]) % mod * inverse(fac[n - k]) % mod;
}

/*int C(int n, int k) {
    double res = 1;
    for (int i = 1; i <= k; ++i)
        res = res * (n - k + i) / i;
    return (int)(res + 0.01);
}*/

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    fac[0] = 1;
    for (int i = 1; i < maxn; i++) fac[i] = (fac[i-1]*i)%mod;
    int n, m, k;
    cin >> n >> m >> k;
    int res = 0;
    int breaks = n-k;
    for (int i = breaks-1; i < n; i++) {
        res += (((C(n-1, i)*binpow(m-1, i))%mod)*m)%mod;
        res %= mod;
    }
    cout << res << '\n';
}

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A==B && B==C) cout << "No" << endl;
  else if(A==B || B==C || C==A) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define M 1000000007
typedef long long int ll;
int main()
{
  int x=0,y=0,z=0;
  int i,j;
  int n;
  cin>>n;
  string s;
  int p=0;
  while(n--)
  {
      cin>>s;
      for(i=0;i<s.length()-1;i++)
      {
          if(s[i]=='A'&&s[i+1]=='B')
          {
              p++;
          }
      }
      if(s[0]=='B'&&s[s.length()-1]=='A')
      {
          z++;
      }
      else if(s[0]=='B')
      {
          y++;
      }
      else if(s[s.length()-1]=='A')
      {
          x++;
      }


  }

  int ans=0;
  ans+=p;
  ans+=min(x,y);
  if(z>=1)
  {
      ans+=z-1;
  }

  x-=min(x,y);
  y-=min(x,y);
  if((x>=1||y>=1)&&(z>=1))
    {ans++;}

  cout<<ans;


}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[]h = new int[n + 1];
        List[]lists = new List[n + 1];
        for (int i = 1; i <= n; i++) {
            h[i] = sc.nextInt();
            lists[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            lists[a].add(b);
        }
        int[]ans = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            List<Integer>l = lists[i];
            for(int is : l){
                if(h[i] < h[is]){
                    ans[i] = -1;
                }else if(h[i] > h[is]){
                    ans[is] = -1;
                }else{
                    ans[i] = -1;
                    ans[is] = -1;
                }
            }
        }
        int item = 0;
        for (int i = 1; i < ans.length; i++) {
            if(ans[i] != -1)
                item++;
        }
        System.out.println(item);
    }
}


Measured memory_bytes: 68092
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    cout << fixed << setprecision(10);
    
    int N, M; cin >> N >> M;
    if (N==M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

class Node{
public:
	vector<int> to;
	vector<int> ecost;
	int cost;
	bool done;
	bool avail;
	Node(){ done=0; cost=-1; avail=0; }
};

void find(Node *node, int nodes, int start);

int main(){
	int v, e, r;
	cin >> v >> e >> r;

	int s[e], t[e], d[e];
	int i;
	for(i=0 ; i<e; i++){
		cin >> s[i] >> t[i] >> d[i];
	}
	
	Node node[v];
	for(i=0; i<e; i++){
		node[s[i]].to.push_back(t[i]);
		node[s[i]].ecost.push_back(d[i]);
	}

	find(node, v, r);
	//cout << "finded" << endl;
	for(i=0; i<v; i++){
		if(node[i].cost==-1){ cout << "INF" << endl;}
		else{ cout << node[i].cost << endl; }
	}

	return 0;
}

void find(Node *node, int nodes, int start){
	int i, j;
	if(node[start].done) return;
	queue<int> list;
	node[start].cost=0;
	node[start].done=1;

	for(i=0; i<node[start].to.size(); i++){
		node[node[start].to[i]].cost = node[start].ecost[i];
		list.push(node[start].to[i]);
	}
	
	bool dflag;
	 
	while(!list.empty()){
		//cout << list.front() << endl;
		dflag=1;
		for(j=0; j<node[list.front()].to.size(); j++){
			if(node[node[list.front()].to[j]].cost == -1){
				node[node[list.front()].to[j]].cost = node[list.front()].cost + node[list.front()].ecost[j];
				list.push(node[list.front()].to[j]);
				dflag=0;
				continue;
			}
			if(node[node[list.front()].to[j]].cost > node[list.front()].cost + node[list.front()].ecost[j]){
				node[node[list.front()].to[j]].cost = node[list.front()].cost + node[list.front()].ecost[j];
				node[node[list.front()].to[j]].done=0;
				list.push(node[list.front()].to[j]);
				dflag=0;
				continue;
			}
		}
		if(dflag) node[list.front()].done=1;
		list.pop();
	}
}

Measured memory_bytes: 22292
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
using namespace std;
#define MAXN 100005
typedef long long LL;
#define int LL
const int mo=1e9+7;
typedef pair<int,int> pii;
#define gc() getchar()
template<typename _T>
void read(_T &x){
	_T f=1;x=0;char s=gc();
	while(s>'9'||s<'0'){if(s=='-')f=-1;s=gc();}
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+(s^48);s=gc();}
	x*=f;
}
template<typename _T>
_T Fabs(_T x){return x<0?-x:x;}
int n,s[MAXN];
deque<int> q;
void print(){
	puts("Yes");int idx=1;
	while(!q.empty()){
		if(s[idx]==1)puts(q.front()==1?"A":"B");
		if(s[idx]==2)puts(q.front()==1?"A":"C");
		if(s[idx]==3)puts(q.front()==1?"B":"C");
		q.pop_front();idx++;
	}
	return ;
}
void dfs(int x,int a,int b,int c){
	if(x>n){print();exit(0);}
	if(s[x]==1){
		if(!a&&!b)return ;
		if(b)q.push_back(1),dfs(x+1,a+1,b-1,c),q.pop_back();
		if(a)q.push_back(2),dfs(x+1,a-1,b+1,c),q.pop_back();
	}
	if(s[x]==2){
		if(!a&&!c)return ;
		if(c)q.push_back(1),dfs(x+1,a+1,b,c-1),q.pop_back();
		if(a)q.push_back(2),dfs(x+1,a-1,b,c+1),q.pop_back();
	}
	if(s[x]==3){
		if(!b&&!c)return ;
		if(c)q.push_back(1),dfs(x+1,a,b+1,c-1),q.pop_back();
		if(b)q.push_back(2),dfs(x+1,a,b-1,c+1),q.pop_back();
	}
}
signed main(){
	int a,b,c;
	read(n);read(a);read(b);read(c);
	for(int i=1;i<=n;i++){
		char A,B;scanf("\n%c%c",&A,&B);
		if(A=='A'&&B=='B')s[i]=1;
		if(A=='A'&&B=='C')s[i]=2;
		if(A=='B'&&B=='C')s[i]=3;
	}
	dfs(1,a,b,c);puts("No");
	return 0;
}
/*
 A B C
AB i1 i2
AC j1 j2
BC k1 k2
a+i1+j1>=i2+j2
b+i2+k1>=i1+k2
c+j2+k2>=j1+k1

a+b+(sum2-j2)+(sum3-k2)>=j2+k2
2*j2+2*k2<=a+b+sum2+sum3

a+c+(sum1-i2)+(sum3-k1)>=i2+k1
2*i2+2*k1<=a+c+sum1+sum3

2*i1+2*j1<=b+c+sum1+sum2 

2*k1+2*j1<=a+b+2c+sum2+sum3=2c+2j2+2k2
a+b+sum2+sum3=2j2+2k2
(S-x)+(about x)=2chose x
((S-x)-about x)=2chose x
*/


Measured memory_bytes: 14656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public void maain(){

	}

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????

		//1???????????\????????¢
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);


        while(true){
        	String[] input = br.readLine().split(" ");
            int m = Integer.parseInt(input[0]);
            int f = Integer.parseInt(input[1]);
            int r = Integer.parseInt(input[2]);

            //?????????????????????
            if(m == -1 && f == -1 && r == -1){
            	return;
            }

            //???????????¨???
            if(m + f < 30 || (m == -1 || f == -1)){
            	System.out.println("F");
            }else if(m + f >= 80){
            	System.out.println("A");
            }else if(m + f >= 65 && m + f <= 80){
            	System.out.println("B");
            }else if(m + f >= 50 && m + f <= 65){
            	System.out.println("C");
            }else if(m + f >= 30 && m + f <= 50){
            	if(r >= 50){
            		System.out.println("C");
            	}else{
                	System.out.println("D");
            	}
            }
        }
	}
}

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

int main()
{
    long n;
    cin >> n;
    
    vector<int> a(n);
    for(long  i=0;i<n;i++)
        cin >> a[i];
    
    long dp[n];
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    
    for(int i=2;i<n;i++)
    {
        dp[i] = min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
    }
    cout << dp[n-1] <<"\n";
    
}

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

int main() {
    int A;
    int B;
    cin >> A;
    cin >> B;
    
    int tap = A;
    int ans = 1;
    if ( B == 1 ){
        ans = 0;
    } else if ( A < B ){
        for ( int i = 1; i <= 30; ++i ){
            tap += A - 1;
            ans += 1;
            if ( tap >= B ){
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    N = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zer
    ans = [0]*N
    for x in range(1,int(N**0.5)+1):
        for y in range(1,int(N**0.5)+1):
            for z in range(1,int(N**0.5)+1):
                a = x**2 + y**2 + z**2 +x*y + y*z + z*x
                if a > N:
                    break
                ans[a-1] += 1

    for i in range(N):
        print(ans[i])



if __name__ == '__main__':
    solve()


Measured memory_bytes: 9468
#include <map>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();int f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
int mod = 1000000007;
inline int sq(int x){return 1ll*x*x%mod;}
inline int sub(int a,int b){return a<b?a-b+mod:a-b;}
inline int add(int a,int b){return a+b>=mod?a+b-mod:a+b;}
inline int mul(int a,int b){return 1ll*a*b%mod;}
inline int pow(int a,int b){if(b == 0)return 1;return b&1?mul(sq(pow(a,b/2)),a):sq(pow(a,b/2));}
inline int inv(int a){return pow(a,mod-2);}
int n,q,l[20],r[20],conn[20][20],bcj[20],isp,oriv[33000],pool[10][33000] = {0};
vector<pii> poi;
int fnd(int x){
	return bcj[x] == x?x:bcj[x] = fnd(bcj[x]);
}
int main() {
	read(n);
	read(q);
	int tp = -1;
	for(int i=0;i<q;i++){
		read(l[i]);read(r[i]);
		poi.push_back(MP(l[i]-1,i));
		poi.push_back(MP(r[i],i));
		//cout<<l[i]-1<<' '<<r[i]<<endl;
	}
	for(int i=0;i<q;i++)bcj[i] = i;
	for(int i=0;i<q;i++)for(int j=0;j<q;j++)conn[i][j] = 1;
	sort(poi.begin(),poi.end());
	int cq = 0;
	for(int i=0;i<poi.size()-1;i++){
		while(i<poi.size()-1 && poi[i].FF == poi[i+1].FF){
			if(fnd(poi[i].SS)!=fnd(poi[i+1].SS))bcj[fnd(poi[i].SS)] = fnd(poi[i+1].SS);
			poi.erase(poi.begin()+i);
		}
	}
	
	int ccnt[20] = {0};
	for(int i=0;i<=q;i++)ccnt[fnd(i)]=1;
	for(int i=1;i<=q;i++)ccnt[i]+=ccnt[i-1];
	for(int i=0;i<poi.size();i++)poi[i].SS = ccnt[fnd(poi[i].SS)]-1;
	int m = ccnt[q],cans = 1,inv9 = inv(9);
	if(poi[0].FF!=0)cans = mul(sub(pow(10,poi[0].FF),1),inv9);
	int cf = mul(sub(pow(10,poi[0].FF),1),inv9);
	for(int i=0;i<poi.size();i++){
		//cout<<poi[i].FF<<' '<<poi[i].SS<<endl;
		if(poi[i].FF == 0)isp|=1<<poi[i].SS;
		for(int j=i+1;j<poi.size();j++){
			if(poi[j].FF!=poi[i].FF){
				if(isp&(1<<poi[i].SS) && poi[j].FF==poi[i].FF)isp|=1<<poi[j].SS;
				int cd = mul(sub(pow(10,poi[j].FF-poi[i].FF),1),inv9),cc = mul(add(cd,1),inv(cd));
				cans = mul(cans,cd);
				if(poi[i].SS!=poi[j].SS){
					conn[poi[i].SS][poi[j].SS] = mul(conn[poi[i].SS][poi[j].SS],cc);
					conn[poi[j].SS][poi[i].SS] = mul(conn[poi[j].SS][poi[i].SS],cc);
				}else{
					cans = mul(cans,cc);
				}
				break;
			}
		}
	}
	cans = mul(pow(10,n-poi[poi.size()-1].FF),cans);
	//cout<<cans<<' '<<cf<<endl;
	oriv[0] = 1;
	for(int i=0;i<1<<m;i++){
		if(i){
			int lo = __builtin_ctz(i);
			oriv[i] = oriv[i-(1<<lo)];
			for(int j = lo;1<<j<=i;j++) if((1<<j)&i)oriv[i] = mul(oriv[i],conn[lo][j]);
		}
		if((i&isp) == isp){
			pool[0][i] = mul(cans,oriv[i]);
			if(i>>poi[0].SS&1 && poi[0].FF)pool[0][i] = mul(pool[0][i],mul(cf+1,inv(cf)));
			//cout<<i<<' '<<pool[0][i]<<endl;
		}
	}
	for(int i=1;i<9;i++){
		for(int j=0;j<1<<m;j++){
			int cc = 0;
			for(int k=j;;k = (k-1)&j){
				cc = add(cc,mul(pool[i-1][k],oriv[k^j]));
				if(k == 0)break;
			}
			pool[i][j] = cc;
		}
	}
	cout<<pool[8][(1<<m)-1]<<endl;
	return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<string.h>
#include<queue>
#include<map>
#include<vector>
#include <cstdlib>
#include<algorithm>
#include <cstdio>
#include <cctype>
using namespace std;
const long long INF=10000000000000LL;
typedef long long ll;
typedef pair<ll,ll> P;
ll N,M,K=1,C;
ll A,B,W;
ll T,a,b;
double v[55],D[55],Q,l,r;
ll ans=0;
//bool D[100005];
ll S[50][50]={};
string str1[55],str2="abcdefghijklmnopqrstuvwxyz";
map<string,int> m;

int main(){
	cin>>N;
	for(int i=1;i<=N;++i){
		K=(K*i)%1000000007;
	}
	cout<<K<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 20, maxn = 1<<20|3, mod = 1e9+7;
int n,m,cnt[maxn],b[maxn],s[maxn],c[maxn];
pa e[N*N];

struct _{
	int fa[N];
	inline void init(int n){
		FOR(i,0,n) fa[i]=i;
	}
	inline int Find(int x){
		return fa[x]==x?x:fa[x]=Find(fa[x]);
	}
	inline void Merge(int x,int y){
		fa[Find(x)]=Find(y);
	}
}f;

const int M = 200;
int fac[M+10],ifac[M+10];
inline int power(int a,int b){
	int ret=1;
	for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) ret=1ll*ret*a%mod;
	return ret;
}
inline void init(int n){
	fac[0]=1;
	For(i,1,n) fac[i]=1ll*fac[i-1]*i%mod;
	ifac[n]=power(fac[n],mod-2);
	Dow(i,n-1,0) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
}
inline int calc(int l,int r){
	return 1ll*fac[r]*ifac[l-1]%mod;
}

int main(){
	n=read(),m=read();
	FOR(i,0,m) e[i].fi=read()-1,e[i].se=read()-1;
	FOR(i,0,1<<(n-1)){
		f.init(n);
		FOR(j,0,n-1) if (i&(1<<j)) f.Merge(e[j].fi,e[j].se);
		b[i]=n-1-__builtin_popcount(i);
		cnt[i]=m-__builtin_popcount(i);
		FOR(j,n-1,m) if (f.Find(e[j].fi)==f.Find(e[j].se)) --cnt[i];
	}
	init(M);
	c[(1<<(n-1))-1]=1;
	Dow(i,(1<<(n-1))-2,0){
		FOR(j,0,n-1) if (!(i&(1<<j))){
			int k=i^(1<<j);
			c[i]=(c[i]+1ll*c[k]*calc(cnt[k]+1,cnt[i]-1))%mod;
			s[i]=(s[i]+1ll*s[k]*calc(cnt[k]+2,cnt[i]))%mod;
		}
		s[i]=(s[i]+1ll*c[i]*b[i])%mod;
	}
	printf("%d\n",s[0]);
}

Measured memory_bytes: 11928
package main

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

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

func main() {
	sc.Split(bufio.ScanWords)

	n := scanInt()
	
	g := make([][][]match, n)
	count := make([][]int, n)

	for i := 0; i < n; i++ {
		g[i] = make([][]match, n)
		count[i] = make([]int, n)
	}
	
	for i := 0; i < n; i++ {
		m := scanInt()-1
		for j := 0; j < n-2; j++ {
			next := scanInt()-1
			g[min(i,m)][max(i,m)] = append(g[min(i,m)][max(i,m)], match{min(i,next),max(i,next)})
			count[min(i,next)][max(i,next)]++
			m = next
		}
	}

	q := make([]match, 0)

	for i := 0; i < n; i++ {
		for j := i+1; j < n; j++ {
			if count[i][j] == 0 {
				q = append(q, match{i,j})
			}
		}
	}

	ans := 0
	
	for len(q) > 0 {
		// fmt.Println(q)
		// fmt.Println(count)
		ans++
		nextq := make([]match, 0)
		for _, e := range q {
			for _, f := range g[e.a][e.b] {
				count[f.a][f.b]--
				if count[f.a][f.b] == 0 {
					nextq = append(nextq, f)
				}
			}
		}
		q = nextq
	}
	
	for i := 0; i < n; i++ {
		for j := i+1; j < n; j++ {
			if count[i][j] != 0 {
				fmt.Println(-1)
				return
			}
		}
	}

	fmt.Println(ans)
}


func min(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res > a[i] {
			res = a[i]
		}
	}
	return res
}

func max(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res < a[i] {
			res = a[i]
		}
	}
	return res
}


type match struct {
	a int
	b int
}


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


int main(){
    string S, T; cin >> S >> T;
    int A, B; cin >> A >> B;
    string U; cin >> U;
    map<string, int> mp;
    mp[S] = A;
    mp[T] = B;
    
    if(U == S) mp[S]--;
    if(U == T) mp[T]--;
    cout << mp[S] << " " << mp[T] << endl;

    return 0;
}



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

typedef long long ll;

int main() {        
	int n;
	cin >> n;
	vector<int> dp(n + 1);
	for (int i = 1; i <= n; ++i) {
		dp[i] = i;
	}
	for (int i = 0; i <= n; ++i) {
		for (int j = 6; i + j <= n; j = j * 6) {
			dp[i + j] = min(dp[i] + 1,dp[i + j]);
		}
		for (int j = 9; i + j <= n; j = j * 9) {
			dp[i + j] = min(dp[i] + 1,dp[i + j]);
		}
	}
	cout << dp[n];
}








Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int,int>
#define endl "\n"
#define MAXN 100005
#define mod 1000000007
using namespace std;

void solve()
{
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    solve();
    ll d,t,s;
    cin>>d>>t>>s;
    float time = (float)d/s;
    if(time <= t)
    {
        cout<<"Yes"<<'\n';
    }
    else
    {
        cout<<"No"<<'\n';
    }
    
}

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

string s,t;
int INF = 100000;

int how_not_much(string target, string s){
    int counter = 0;
    int len = target.length();
    for (int i=0;i<len;i++){
        if(target[i]==s[i])counter++;
    }
    return len - counter;
}

void solve(){
    cin >> t;
    cin >> s;
    int result = INF;
    string target;
    int s_length = s.length();
    for(int i=0;i<(t.length()-s_length+1);i++){
        target = t.substr(i,s_length);
        result = min(how_not_much(target,s), result);
    }
    cout << result << endl;
}

int main(){
    solve();
}

Measured memory_bytes: 3612
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		int[] a = new int[n], b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		for (int i = 0; i < m; i++) {
			int c = sc.nextInt();
			for (int j = 0; j < n; j++) if (a[j] <= c) {
				b[j]++; break;
			}
		}

		int ans = -1;
		for (int i = 0; i < n; i++) {
			if (ans < 0 || b[ans] < b[i]) {
				ans = i;
			}
		}
//		debug(b);
		System.out.println(ans + 1);
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

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

Measured memory_bytes: 24920
N = int(input())
A = list(map(int, input().split()))
S = sum(A)

d = {}
for i in A:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1

Q = int(input())
for i in range(Q):
  B, C = map(int, input().split())
  #
  if B in d:
    S += (C - B) * d[B]
    if C in d:
      d[C] += d[B]
    else:
      d[C] = d[B]
    d[B] = 0
  print(S)
  #

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

#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
//#define pdd pair<double,double>
#define pll pair<LL,LL>
#define pb(x) push_back(x)
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define mii map<int,int>
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi 3.14159265359
#define INF 0x7fffffff
#define next Next
#define N 200005
using namespace std;
typedef long long LL;
int main(){
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	//printf("%d\n",b-a);
	if(abs(b-a)&1){
		printf("Borys\n");
	}
	else{
		printf("Alice\n");
	}
}

Measured memory_bytes: 256