akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
 
struct node {
  struct node *right;
  int key;
  struct node *left;
};
typedef struct node * NodePointer;
 
void init(void);
NodePointer makenode(int);
void insert(int,NodePointer);
void preorder(NodePointer);
void inorder(NodePointer);
int find(int,NodePointer);
 
NodePointer head, tail;
 
int main(){
  char str[7];
  int n,k;
 
  init();
  scanf("%d" ,&n);
  while(n--){
    scanf("%s" ,str);
 
    if(str[0] == 'i'){
      scanf("%d" ,&k);
      insert(k, head);
    }else if(str[0] == 'p'){
      inorder(head->right);
      printf("\n");
      preorder(head->right);
      printf("\n");
    }else{
      scanf("%d" ,&k);
      if(find(k,head->right)){
    printf("yes\n");
      }else{
    printf("no\n");
      }
    }
  }
 
  return 0;
}
 
void init(void){
  head=makenode(-1);
  tail=makenode(-1);
  head->right=tail;
  head->left=tail;
}
 
NodePointer makenode(int k){
  NodePointer x;
 
  x=malloc(sizeof(struct node));
  x->key = k;
  x->left = x->right = tail;
 
  return x;
}
 
void insert(int k, NodePointer p){
  if(k < p->key){
    if(p->left == tail){
      p->left = makenode(k);
    }else{
      insert(k , p->left);
    }
  }else{
    if(p->right == tail){
      p->right = makenode(k);
    }else{
      insert(k , p->right);
    }
  }
}
 
void preorder(NodePointer node){
  if(node != tail){
    printf(" %d", node->key);
    preorder(node->left);
    preorder(node->right);
  }
}
 
void inorder(NodePointer node){
  if(node != tail){
    inorder(node->left);
    printf(" %d", node->key);
    inorder(node->right);
  }
}
 
int find(int k,NodePointer node){
  if(node == tail){
    return 0;
  }
 
  if(node->key == k){
    return 1;
  }else if(node->key < k){
    return find(k , node->right);
  }else{
    return find(k , node->left);
  }
}


Measured memory_bytes: 14216
let prime_p n =
  if n == 2 then true
  else if n < 2 || (n mod 2 = 0) then false
  else begin
    let x = int_of_float (sqrt (float_of_int n)) in
    let rec doit i =
      if i > x then true
      else if n mod i = 0 then false
      else doit (i + 2)
    in
    doit 3
  end

let () =
  let n = read_int () in
  let rec read i cnt =
    if i >= n then cnt
    else read (i + 1) (cnt + (if prime_p (read_int ()) then 1 else 0))
  in
  Printf.printf "%d\n" (read 0 0)

Measured memory_bytes: 3188
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

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

    int ans = 0;
    for (int i = 0; i < 100; i++) {
        int water = false;
        for (int j = 0; j < n; j++) {
            if (h[j] > 0) {
                water = true;
                h[j]--;
            } else {
                if (water) {
                    ans++;
                    water = false;
                }
            }
        }
        if (water) ans++;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 892
//
// Created by Harshit on 21-08-2020.
//

#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5+5;
int indegree[maxx];
bool dis[maxx];
void dfs(vector <vector <int >> &,vector <int> &,int );
int main(){
    int n,m;
    int u,v;
    cin>>n>>m;
    vector <int> visited(n+1,0);
    vector <vector <int>>  adjlist(n+1,vector <int> () );
    indegree[0]=0;
    visited[0]=0;
    for(int i=0;i<m;i++){
        cin>>u>>v;
        adjlist[u].push_back(v);
        indegree[v]++;
    }
    for(int i=1;i<n+1;i++){
        if(!dis[i] && indegree[i]==0)
            dfs(adjlist,visited,i);
    }
        int ans=0;
    for(int x:visited)
        ans=max(ans,x);
    cout<<ans<<endl;
}
void dfs(vector <vector <int >> &adjlist,vector <int> &visited,int sou){
    dis[sou]=true;
    for(auto it=adjlist[sou].begin();it!=adjlist[sou].end();it++){
        if(visited[*it]<visited[sou]+1){
            visited[*it]=visited[sou]+1;
        }
        indegree[*it]--;
        if(indegree[*it]==0 && !dis[*it])
            dfs(adjlist,visited,*it);
    }
}

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

namespace ConsoleApp1 {
    public class Class1 {
        static void Main(string[] args) {
            var X = int.Parse(Console.ReadLine());
            
            for(var i = -1000; i < 1000; i++) {
                for(var j = -1000; j < 1000; j++) {
                    var A = Math.Pow(i, 5);
                    var B = Math.Pow(j, 5);
                    if (A - B == X) {
                        Console.Write("{0} {1}", i, j);
                        return;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 27756
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>


using namespace std;
string yn(bool a)
{
  if (a){return "Yes";}
  else{return "No";}
}

int main()
{
  ios::sync_with_stdio(false);
  string s;
  int x,y;
  cin>>s>>x>>y;
  vector<int> a,b;
  bool f=1;
  int tmp=0;
  for(auto itr=s.begin();itr !=s.end();itr++)
  {
    if(*itr=='F'){tmp++;}
    else {
      if(f){a.push_back(tmp);}
      else{b.push_back(tmp);}
      f=!f;
    tmp=0;
  }

  }
  if(f){a.push_back(tmp);}
  else{b.push_back(tmp);}
  x-=a[0];
  x=abs(x);
  y=abs(y);
  a.erase(a.begin());
  int suma=0,sumb=0;
  for(auto itr=a.begin();itr !=a.end();itr++)
  {
    suma+=*itr;
  }
  for(auto itr=b.begin();itr !=b.end();itr++)
  {
    sumb+=*itr;
  }
  int flag=0;
  if((suma-x)%2 or (sumb-y)%2){flag=0;}
  else
  {
    if(suma<x or sumb<y){flag=-2;}
    x=(suma-x)/2;
    y=(sumb-y)/2;
    vector<int> dpx(8001),dpy(8001);
    //for(int i=0;i<8001;i++){dpx[i]=0;dpy[i]=0;}
    dpx[0]=1;dpx[suma]=1;
    dpy[0]=1;dpy[sumb]=1;
    for(auto itr1=a.begin();itr1 !=a.end();itr1++)
    {
      for(int i=suma-x;i>-1;i--)
      {
        if(dpx[i]==1){dpx[i+*itr1]=1;}
      }
      if(dpx[x]!=0 or dpx[suma-x]!=0){flag+=1;break;}

    }
    if(a.size()==0 and x==0){flag+=1;}
    for(auto itr2=b.begin();itr2 !=b.end();itr2++)
    {
      for(int i=sumb-y;i>-1;i--)
      {
        if(dpy[i]==1){dpy[i+*itr2]=1;}
      }
      if(dpy[y]!=0 or dpy[sumb-y]!=0){flag+=1;break;}
    }
    if(b.size()==0 and x==0){flag+=1;}
  }
  cout<<yn(flag>=2)<<endl;
  return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python3

def main():
    x = int(input())
    primes = furui(300000)
    for p in primes:
        if x <= p:
            print(p)
            return
    raise ValueError

# https://mathtrain.jp/eratosthenes
def furui(nmax):
    assert nmax > 2
    p = 2
    primes = list(range(2, nmax + 1))
    while True:
        if p ** 2 > nmax:
            break
        primes_next = []
        for x in primes:
            if x <= p or x % p != 0:
                primes_next.append(x)
        primes = primes_next
        p = primes[primes.index(p) + 1]
    return primes

if __name__ == "__main__":
    main()


Measured memory_bytes: 79216
class Dice:
    def __init__(self,dim=list(range(1,7))):
        self.dim = dim

    def roll(self,direction):
        if direction == "N":
            buff = self.dim[0]
            self.dim[0] = self.dim[1]
            self.dim[1] = self.dim[5]
            self.dim[5] = self.dim[4]
            self.dim[4] = buff

        if direction == "E":
            buff = self.dim[3]
            self.dim[3] = self.dim[5]
            self.dim[5] = self.dim[2]
            self.dim[2] = self.dim[0]
            self.dim[0] = buff

        if direction == "W":
            buff = self.dim[0]
            self.dim[0] = self.dim[2]
            self.dim[2] = self.dim[5]
            self.dim[5] = self.dim[3]
            self.dim[3] = buff

        if direction == "S":
            buff = self.dim[0]
            self.dim[0] = self.dim[4]
            self.dim[4] = self.dim[5]
            self.dim[5] = self.dim[1]
            self.dim[1] = buff

lst = list(map(int,input().split()))
D = Dice(lst)
D2_lst = list(map(int,input().split()))

count = 0
for op in 'EEENEEENEEESEEESEEENEEEN':
    if D.dim == D2_lst:
        print("Yes")
        break
    D.roll(op)
    count += 1
if count == 24:
    print("No")



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N,M,X;
	cin>>N>>M>>X;
	
	vector<int> A(M);
	for(int i=0;i<M;i++)cin>>A[i];
	
	int ans = 0;
	
	for(int i=0;i<X;i++){
		if(binary_search(A.begin(),A.end(),i))ans++;
	}
	
	int a = 0;
	
	for(int i=X;i<N;i++){
		if(binary_search(A.begin(),A.end(),i))a++;
	}
	
	cout<<min(a,ans)<<endl;
		
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <map>
#include <algorithm>
#include <iomanip>
using namespace std;

#define MAXV 1000000000
using ll = long long;

bool operator<(const pair<int, int>& a, const pair<int, int>& b) {
	if (a.first == b.first) {
		return a.second < b.second;
	}
	return a.first < b.first;
}

ll min_cost(ll n, ll a1, ll m1) {
	if (n == 1) return 1;
	return 1 + min_cost(n*a1%m1,a1, m1);
}

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

int main() {
	
	
	ll a1, m1, a2, m2, a3, m3;
	while (cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3) {
		if (a1 == 0 && m1 == 0 && a2 == 0 && m2 == 0 && a3 == 0 && m3 == 0) break;

		ll l1 = min_cost(a1%m1, a1, m1);
		ll l2 = min_cost(a2%m2, a2, m2);
		ll l3 = min_cost(a3%m3, a3, m3);

		ll L1 = l1/gcd(l1, l2)*l2;

		cout << L1 * l3 / gcd(L1, l3) << endl;
	}
	int a; cin >> a;
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
const int uchiha=1e3+5;
int main()
{
string s;
cin>>s;
int w=s.size();
for(int i=0;i<w;i++){
    if((i+1)%2!=0)
        cout<<s[i];
    else
        continue;
}
}


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

int cnt[10][10];

int main()
{
  fastio;
  int n; cin >> n;
  long res = 0;
  for (int i = 1; i <= n; i++){
    int first = i % 10;
    int last = i;
    while (last >= 10) last /= 10;
    cnt[first][last]++; 
  }
  for (int i = 1; i < 10; i++){
    for (int j = i; j < 10; j++){
      if (i != j) res += 2ll * cnt[i][j] * cnt[j][i]; 
      else res += 1ll * cnt[i][j] * cnt[i][j];
    }
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int count;
   for (int i = 0; i < 3; i++) {
    if (S.at(i) == 'A') {
      count++;
    }
  }
  if (count == 0 || count == 3 ) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
static MOD: usize = 1_000_000_000 + 7;
fn main() {
    input! {
        n: usize,
        k: usize,
        a: [i64; n],
    }
    let mut v = a.clone();
    let mut dd = 0;
    for i in 0..v.len() - 1 {
        for j in i+1..v.len() {
            if v[i] > v[j] {
                dd+=1;
                dd %= MOD;
            }
        }
    }
    if k == 1 {
        println!("{}", dd%MOD);
        return;
    }
    let mut cnt = 0;
    for i in 0..a.len() {
        for j in 0..a.len() {
            if i != j && a[i] > a[j] {
                cnt+=1;
                cnt %= MOD;
            }
        }
    }
    let e = extended_euclidean(MOD as i64, 2) as usize;
    println!("{}", ((cnt * (k-1) % MOD * k % MOD * e %MOD) % MOD+ dd * k % MOD)% MOD);
}
fn extended_euclidean(u: i64, v: i64) -> i64 {
    let mut r0 = u;
    let mut r1 = v;
    let mut s0 = 1;
    let mut s1 = 0;
    let mut t0 = 0;
    let mut t1 = 1;
    while r1 != 0 {
        let q = r0 / r1;
        let r = r0 - q * r1;
        let s = s0 - q * s1;
        let t = t0 - q * t1;
        r0 = r1;
        s0 = s1;
        t0 = t1;
        r1 = r;
        s1 = s;
        t1 = t;
    }
    if t0 < 0 {
        t0 + u
    } else {
        t0
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string ss;
	cin>>ss;
	int l=ss.size(),sum=0;
	for(int i=0;i<l;i++)
	{
		sum+=ss[i]-'0';
	}
	if(sum%9==0)
	cout<<"Yes";
	else cout<<"No";
}

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

int main(){
int w,h,x,y,r;
cin >>w>>h>>x>>y>>r;

if(w>=x+r && h>=y+r && x>0 && y>0){
cout << "Yes" << endl;
}
else{
cout << "No" << endl;
}
return 0;
}

Measured memory_bytes: 3108
#include <iostream>
#include <fstream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 2147483647;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

//RMQ_Segment_Tree
int N, dat[1000000];
void init(int n_){
	N = 1;
	while(N<=n_)N *= 2;
	for(int i = 1; i<=2*N; ++i)dat[i] = inf;
}

void update(int k, int a){
	k += N;
	dat[k] = a;
	while(k>0){
		k /= 2;
		dat[k] = min(dat[k*2], dat[k*2+1]);
	}
}

int query(int a, int b, int k, int l, int r){
	if(r <= a || b <= l)return inf;
	if(a <= l && r <= b)return dat[k];
	else{
		int vl = query(a, b, k*2, l, (l+r)/2);
		int vr = query(a, b, k*2+1, (l+r)/2, r);
		return min(vl, vr);
	}
}

int main(){
	int n,q; cin>>n>>q;
	init(n);
	// cout<<N<<endl;
	rep(i,q){
		int Q,a,b;
		cin>>Q>>a>>b;
		if(Q == 0){
			update(a+1, b);
		}else{
			cout<<query(a+1, b+2, 1, 1, N)<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 4132
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int main() {
    int i, x;
    REP(i, 10000) {
        x = iin();
        if (x == 0) break;
        printf("Case %d: %d\n", i + 1, x);
    }
    return 0;
}



Measured memory_bytes: 2040
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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





int main(){
    int N; std::cin >> N;
    std::vector<__int128_t> A(N);
    long long a;
    for(int i(0); i < N; ++i){
        std::cin >> a;
        A[i] = a;
        if(!a){
            std::cout << 0 << std::endl;
            return 0;
        }
    }
    __int128_t prd(1);
    for(int i(0); i < N; ++i){
        if(prd * A[i] > LINF){
            std::cout << -1 << std::endl;
            return 0;
        }
        prd *= A[i];
    }
    std::cout << (long long)prd << std::endl;
    return 0;
}


Measured memory_bytes: 4844
#include <cstdio>
#include <string.h>
using namespace std;
int main()
{
	char s1[17] = "CODEFESTIVAL2016",s2[17];
	int num = 0 ,i;
	scanf("%s",s2);
	for (i = 0 ;i < 16 ;i++) {
		if (s1[i] != s2[i]) {
			num++;
		}
	}
	printf("%d\n",num);
	return 0;
 } 

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
struct card{
    char ma;
    int nu;
};
int main(){
    int n,i,j,minj,st;
    st = 1;
    string s;
    cin >> n;
    vector<card> A(n),B(n);
    for(i=0;i<n;i++){
        cin >> s;
        A.at(i).ma = s.at(0);
        A.at(i).nu = s.at(1)-'0';
        B.at(i) = A.at(i);
    }
    //bubblesort A
    for(i=0;i<n;i++){
        for(j=n-1;j>i;j--){
            if(A.at(j).nu<A.at(j-1).nu){
                swap(A.at(j),A.at(j-1));
            }
        }
    }
    //out bubblesorted A
    for(i=0;i<n;i++){
        if(i) cout << " ";
        cout << A.at(i).ma<<A.at(i).nu;
    }
    cout << endl << "Stable"<<endl;
    //Selection Sort B
    for(i=0;i<n;i++){
        minj=i;
        for(j=i;j<n;j++){
            if(B.at(j).nu<B.at(minj).nu) minj = j;
        }
        swap(B.at(i),B.at(minj));
    }
    //out SelectionSorted B
    for(i=0;i<n;i++){
        if(i) cout << " ";
        if(A.at(i).ma != B.at(i).ma) st =0;
        cout << B.at(i).ma << B.at(i).nu;
    }
    cout << endl;
    if(st) cout << "Stable"<<endl;
    else cout << "Not stable" << endl;
    return 0;

}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
#define fast  ios_base::sync_with_stdio(false),cin.tie(NULL)
#define loop(var,init,condition) for(int var=init;var<condition;var++)
#define rloop(var,init,condition) for(int var=init;var>condition;var--)
#define mod 1000000007
#define qmod 998244353
#define M 1000001
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define popi pop_back
#define SZ(v) ((int)(v).size()) 
 
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef unordered_map<string, int> usi;
typedef unordered_map<int, int> umii;
typedef map<int, int> omii;
typedef set<int > seti;

ll pow(ll a,ll b,ll m){ll x=1,y=a;while(b > 0){if(b%2 == 1){x=(x*y);if(x>m) x%=m;}y = (y*y);if(y>m) y%=m;b /= 2;}return x%m;}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

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

	
	fast;

	int x,y,z;
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	cout<<x<<" "<<y<<" "<<z<<" "<<endl;

   
	return 0;
}




//MAKING HARD THINGS SIMPLE AND SIMPLE THINGS HARD 

//        ,~~.
//       (  6 )-_,
//  (\___ )=='-'
//   \ .   ) )
//    \ `-' /    battak
// ~'`~'`~'`~'`~

Measured memory_bytes: 256
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

// End of template.


int main(){
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s, t;
    cin >> s >> t;

    int ans = 0;
    rep(i, 3) if (s[i] == t[i]) ans += 1;
    
    print(ans);

    return 0;
}



Measured memory_bytes: 768
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    string s;

    cin >> s;

    int n = s.size();

    map <char, bool> mp;

    for (int i = 0; i < n; i++) {

    	mp[s[i]] = 1;
    }

    for (int i = n; i >= 0; i--) {

    	for (int j = 0; j < 26; j++) {

    		if (i < n) mp[s[i]] = 0;

    		if (mp['a'+j] == 0 && char('a'+j) > s[i]) {

    			cout << s.substr(0, i) << char('a'+j);
    			return 0;
    		}
    	}
    }

    cout << "-1";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
#define w1 first
#define ls (x<<1)
#define w2 second
#define rs (x<<1|1)
#define mp make_pair
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) (int((x).size()))
#define All(x) (x).begin(),(x).end()
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
const int maxn=4e6+5;
int n,h,t;
int deg[maxn],fa[maxn];
map<int,int>adj[maxn];
typedef map<int,int>::iterator It;
pa q[maxn];
int find(int x){
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
int main(){
	read(n);
	rep(i,1,n)fa[i]=i;
	rep(i,1,n-1){
		int x,y;read(x);read(y);
		adj[x][y]++;deg[x]++;
		adj[y][x]++;deg[y]++;
	}
	rep(i,1,n-1){
		int x,y;read(x);read(y);
		adj[x][y]++;deg[x]++;
		adj[y][x]++;deg[y]++;
		if(adj[x][y]>=2)q[t++]=mp(x,y);
	}
	int cnt=0;
	while(h!=t){
		int x=q[h].w1,y=q[h].w2;
		h++;
		x=find(x);y=find(y);
		if(x==y)continue;
		cnt++;
		if(adj[x][y]<2)assert(0);
		if(deg[x]>deg[y])swap(x,y);
		adj[y][x]--;deg[y]--;
		fa[x]=y;
		for(It it=adj[x].begin();it!=adj[x].end();it++){
			deg[y]++;
			if(it->w2)adj[y][it->w1]+=it->w2;
			adj[it->w1][x]-=it->w2;
			adj[it->w1][y]+=it->w2;
			if(adj[it->w1][y]>=2)q[t++]=mp(it->w1,y);
		}
	}
	puts(cnt==n-1?"YES":"NO");
	return 0;
}

Measured memory_bytes: 244864
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

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

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

int main()
{
    ll N, W;
    cin >> N >> W;

    ll *dp_old = new ll[W + 1];
    ll *dp = new ll[W + 1];
    REP(i, W + 1)
    {
        dp_old[i] = dp[i] = 0;
    }

    FOR(n, 1, N)
    {
        ll w, v;
        cin >> w >> v;

        FOR(i, 1, W)
        {
            if (i - w < 0)
                continue;

            chmax(dp[i], dp_old[i - w] + v);
        }

        REP(i, W + 1)
        {
            dp_old[i] = dp[i];
        }
    }

    cout << dp[W] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
  FAST/**/
   
   ll n;
   cin>>n;
   
   ll arr[n+1];
   rep(n)
        cin>>arr[i+1];
        
   ll stock = 0;
   ll mon = 1000;
   for(ll i=1;i<n;i++)
   {
       if(arr[i]>arr[i+1])
       {
           mon+=(stock*arr[i]);
           stock = 0;
       }
       
       else
       {
           stock+=(mon/arr[i]);
           mon%=arr[i];
       }
   }
   
   mon+=(stock*arr[n]);
   cout<<mon;
   
   
   return 0;        
}  
  
          
   

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

int main(){
  int MOD = 1e9 + 7;
  int N, M;
  cin >> N >> M;
  
  vector<int> dp(N+1);
  for(int i = 0;i < M;i++){
    int a;
    cin >> a;
    
    dp.at(a) = -1;
  }
  
  dp.at(0) = 1;
  for(int i = 1;i <= N;i++){
    if(dp.at(i) == -1){
      dp.at(i) = 0;
      continue;
    }
    if(i == 1){
      dp.at(i) = 1;
      continue;
    }
    dp.at(i) = (dp.at(i-1) + dp.at(i-2)) % MOD;
  }
  
  cout << dp.at(N) << endl;
  
  return 0;
}

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

#define FASTIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  ll long long
#define sc second
#define fr first
const int nax = 2e5+5;
const int mod = 1e4+7;
using namespace std;
typedef pair<double,double> pi;
typedef tuple<int,int,int> tu;
int arr[nax];
int n;

bool isPossible(int ans, int k)
{
	for(int i=0;i<n;i++)
	{
		if(arr[i] <= ans)	continue;
		k -= (arr[i]/ans);
	}

	return k>=0;
}

signed main()
{
	FASTIO;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt" , "w" , stderr);
    #endif
	int k;
	cin >>  n >> k;
	for(int i=0;i<n;i++)
		cin >> arr[i];
	

	int mini =1 , maxi = (int)1e9+5;
	
	while(mini<maxi)
	{
		int mid = (mini+maxi)/2;
		if(isPossible(mid,k))
		{
			maxi = mid;
		}
		else
		{
			mini =mid+1;
		}
	}
	cout << mini << "\n";
	return 0;
}



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

using namespace std;

string s;

int main(void)
{
	cin >> s;
	bool flag = false;
	if(s[0] != 'A') goto ng;
	s.erase(s.begin());

	for(int i = 1; i <= s.size()-2; i++){
		if(s[i] == 'C'){
			flag = true;
			s.erase(s.begin() + i);
			break;
		}
	}
	if(!flag) goto ng;
	for(int i = 0; i < s.size(); i++){
		if(s[i] < 'a' || s[i] > 'z') goto ng;
	}
	cout << "AC" << endl;
	return 0;
	ng:;
	cout << "WA" << endl;
}

Measured memory_bytes: 256
import copy

N, M = input().split()
N = int(N)
M = int(M)

abList = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    b = int(b)
    abList.append((a,b))


def dfs(graph, now, done):
    result = 0
    doneCache = copy.deepcopy(done)
    doneCache.append(now)
    if len(doneCache) == N:
        return 1
    for a,b in graph:
        if a == now:
            if b not in doneCache:
                result += dfs(graph, b, doneCache)
        if b == now:
            if a not in doneCache:
                result += dfs(graph, a, doneCache)

    return result

print(dfs(abList, 1, []))

Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////






int main() {
	ll A, B;
	cin >> A >> B;

	if (A + B < 10) { cout << A+B; }
	else { cout << "error"; }
	system("PAUSE");
}


Measured memory_bytes: 504
"use strict"
function main(arg) {
    let N = arg.trim().split("\n")[0]
    for (let i = 1;; i++) {
        if (N <= i * 1000 ) {
            // console.log(i)
            console.log(i*1000 - N)
            break
        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29684
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k;
  
  cin >> k;
  cout << (k - (k / 2)) * (k / 2) << endl;
  return 0;
}



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

using namespace std;

typedef pair<int,int> ii;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

ll mod = 1000000007;

int main(){
	int n, a, b;
	int sum = 0;
	scanf("%d %d %d",&n, &a, &b);
	for(int i = 1; i <= n; i++){
		int aux = i;
		int sum1 = 0;
		while(aux){
			sum1 += aux % 10;
			aux /= 10;
		}
		if(sum1 >= a && sum1 <= b){
			sum += i;
		}
	}
	printf("%d\n",sum );
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

typedef long long LL;
const int Mod = 1000000007;
const int MN = 55;

int N, A[MN * 2];

int f[MN][MN * 2][MN * 2];
int DP(int i, int a, int b) {
	if (i == 1) return 1;
	if (~f[i][a][b]) return f[i][a][b];
	int na = a + (A[i - 1] != A[i]);
	int nb = b + (A[2 * N - i + 1] != A[2 * N - i]);
	LL v = DP(i - 1, na, nb);
	for (int j = 1; j <= na; ++j) v = (v + DP(i - 1, na - j, nb + 1)) % Mod;
	for (int j = 1; j <= nb; ++j) v = (v + DP(i - 1, na + 1, nb - j)) % Mod;
	return f[i][a][b] = v % Mod;
}

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= 2 * N - 1; ++i) scanf("%d", &A[i]);
	std::sort(A + 1, A + 2 * N);
	memset(f, -1, sizeof(f));
	printf("%d\n", DP(N, 0, 0));
	return 0;
}

Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
  string s;
  cin >> s;
  cout << s.substr(0,3) << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#define N 1001000
typedef long long ll; 
template<typename T> inline void read(T &x) {
  x = 0; char c = getchar(); bool flag = false;
  while (!isdigit(c)) { if (c == '-') flag = true; c = getchar(); }
  while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
  if (flag) x = -x; 
}
using namespace std;
const int P = 998244353;
inline ll quickpow(ll x, int k) {
  ll res = 1;
  while (k) {
    if (k & 1)  res = res * x % P;
    x = x * x % P;
    k >>= 1;
  }
  return res;
}
int n, m;
ll jie[N], jieni[N];
inline void init() {
  int up = n + m;
  jie[0] = jieni[0] = 1;
  for (int i = 1; i <= up; ++i) jie[i] = jie[i - 1] * i % P;
  jieni[up] = quickpow(jie[up], P - 2); 
  for (int i = up - 1; i; --i)  jieni[i] = jieni[i + 1] * (i + 1) % P;
}
inline ll get_c(int n, int m) {
  ll res = jie[n] * jieni[m] % P * jieni[n - m] % P;
  return res;
}
inline void work() {
  ll res = 0;
  if (n < m)  swap(n, m); 
  for (int i = 1; i <= m; ++i) {
    res = (res + get_c(i + i - 1, i) * get_c(n - i + m - i, n - i)) % P;
  }
  res = (res + n * get_c(n + m, n)) % P;
  res = res * quickpow(get_c(n + m, n), P - 2) % P;
  printf("%lld\n", (res % P + P) % P); 
}
int main() {
  read(n), read(m); init();
  work();
  return 0;
}


Measured memory_bytes: 18824
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
 
using namespace std;
 
signed main()
{
    fast;
    int r;
    cin>>r;

    cout<<pow(r,2)<<endl;
    return 0;
}

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

bool isPrime(ll x) {
    for (ll i = 2; i * i < x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

int main() {
    ll x;
    cin >> x;
    ll p = x;
    while (!isPrime(p)) p++;
    cout << p << endl;

    return 0;
}

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

int main() {
	int n;
	cin>>n;
	long p[n],k=0;
	for(int i=0;i<n;i++)cin>>p[i];
	sort(p, p+n);
	for(int i=0;i<n;i++)k+=p[i];
	k-=p[n-1]/2;
	cout<<k<<endl;
	return 0;
}

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

void printarray(int a[], int n){
	for (int i=0; i<n; i++){
		if (i==n-1){
			cout << a[i] << endl;
		}
		else{
			cout << a[i] << ' ';
		}
	}

}

void insertionsort(int a[], int n){
	for (int i=0; i<n; i++){
		int v = a[i];
		int j = i-1;
		while (j >= 0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		printarray(a,n);
	}
}

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


int main(){
	int a, b;
	cin >> a >> b;
	cout << gcd(a,b) << endl;


	return 0;
}


Measured memory_bytes: 3124
from math import gcd

MOD = 10**9+7
N = int(input())
d = {}
zero = 0
for i in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero += 1
        continue

    # cosで単位円を考える
    # 第一象限に来るまでの90度回転回数
    flip = 0
    while not (a >= 0 and b > 0):
        a, b = -b, a
        flip ^= 1

    g = gcd(a, b)
    a //= g
    b //= g
    if not (a, b) in d:
        d[(a, b)] = [0, 0]
    d[(a, b)][flip] += 1

ans = 1
for (v1, v2) in d.values():
    ans *= pow(2, v1, MOD) + pow(2, v2, MOD)-1
    ans %= MOD
ans -= 1
ans += zero
ans %= MOD
print(ans)


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N =  sc.nextInt();
		long A[] = new long[N];
		for(int i=0;i<N;i++) {
			A[i] = sc.nextLong();
		}
		Arrays.parallelSort(A);
		for(int i=1;i<N;i++) {
			if (A[i]==A[i-1]) {
				System.out.print("NO");
				return ;
			}
		}
		System.out.print("YES");
		return ;
	}
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int n;
    cin >> n;

    vll a(n);
    rep(i, 0, n) { cin >> a[i]; }

    if (n % 2 == 0) {
        ll left = 0, right = 0;

        rep(i, 0, n / 2) {
            right = max(left, right) + a[2 * i + 1];
            left = left + a[2 * i];
        }
        cout << max(right, left) << endl;
        return 0;
    }

    ll left = 0, mid = 0, right = 0;
    rep(i, 0, n / 2) {
        right = max(left, max(mid, right)) + a[2 * i + 2];
        mid = max(left, mid) + a[2 * i + 1];
        left = left + a[2 * i];
    }
    cout << max(left, max(mid, right)) << endl;

    return 0;
}

Measured memory_bytes: 4748
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 2005;
const int mod = 1e9 + 7;

int n, k;
LL f[N][N], fac[N * N], inv[N * N], fav[N * N];

inline void Add(LL &x, LL y) {
	x += y;
	if (x >= mod) x -= mod;
}

inline LL C(LL x, LL y) {
	if (x < 0 || x < y) return 0;
	return (fac[x] * fav[y] % mod * fav[x - y] % mod);
}

int main() {
	cin >> n >> k;
	if (k == 1) return 0 * puts("1");
	fac[0] = fav[0] = 1;
	fac[1] = fav[1] = inv[1] = 1;
	for (int i = 2; i < N * N; ++i) {
		inv[i] = (-mod / i * inv[mod % i] % mod) + mod;
		fac[i] = fac[i - 1] * i % mod;
		fav[i] = fav[i - 1] * inv[i] % mod;
	}
	f[0][0] = 1;
	for (int i = 0; i <= n; ++i) {
		for (int j = i; j <= n; ++j) {
			if (j < n) {
				Add(f[i][j + 1], f[i][j]);
			}
			if (i < j) {
				if ((n - i) * k - j + i - 1 >= 0)
					Add(f[i + 1][j], f[i][j] * C((n - i) * k - j + i - 1, k - 2) % mod);
			}
		}
	}
	for (int i = 1; i <= n; ++i) {
		f[n][n] = f[n][n] * i % mod;
	}
	cout << f[n][n] << endl;
	return 0;
}



Measured memory_bytes: 125312
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
#define MAX_V 100005
struct edge { int to; int cost; };
using P = pair<int, int>;
int V, d[MAX_V], n[MAX_V];
vector<edge> G[MAX_V];
void dijkstra(int s) {
	fill(d, d + V, INF);
	d[s] = 0;  // 始点sへの最短距離は0

	priority_queue<P, vector<P>, greater<P>> que;  // 距離が小さい順に取り出せるようgreater<P>を指定
	que.push(P(0, s));
	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;  // 更新した頂点の中で距離が最小の頂点v
		if (d[v] < p.first) {
			continue;
		}
		for (auto e : G[v]) {  // 頂点vから出る辺eを走査
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				n[e.to] = v;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}
int main(void) {
	int E;
	cin >> V >> E;
	int x, y, cost;
	rep(i, 0, E) {
		cin >> x >> y;
		x--, y--;
		G[x].push_back({ y, 1 });
		G[y].push_back({ x, 1 });
	}
	dijkstra(0);
	rep(i, 0, V) {
		if (d[i] == INF) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	rep(i, 1, V) {
		printf("%d\n", n[i] + 1);
	}
	return 0;
}

Measured memory_bytes: 13536
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;

  int ans = 1;

  while (ans < 1251) {
    if (floor(ans * 0.08) == a && floor(ans * 0.1) == b) {
      cout << ans << endl;
      return 0;
    }
    ans++;
  }
  cout << "-1" << endl;
}

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

//Minimum Macros
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
#define rep(_i,_n) for(ll _i = 0; _i < _n; ++_i)
#define rep2(_i,_s,_n) for(ll _i = _s; _i < _n; ++_i)
#define elif else if
//Vector Macros
#define vec vector
#define append(_x) push_back(_x)
#define fullSort(_a) sort(_a.begin(), _a.end())
#define inputVecI(_name, _n) vec<int> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecL(_name, _n) vec<long> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecLL(_name, _n) vec<ll> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecUL(_name, _n) vec<ul> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecULL(_name, _n) vec<ull> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecS(_name, _n) vec<string> _name(_n);rep(_i, _n)cin >> _name[_i];
#define maxIdx(_name) distance(_name.begin(), max_element(_name.begin(), _name.end()))
#define printVec(_vec) cout << "{";rep(i, _vec.size()-1)cout << _vec[i] << ",";cout << _vec[_vec.size()-1];cout << "}\n";
//Graph Macros
using Graph = vec<vec<long>>;
inline vec<long> BFS(Graph _g, long start){
  vec<long> _ans(_g.size(), -1); _ans[start] = 0; queue<long> _que; _que.push(start);
  while(!_que.empty()){
    long _target = _que.front(); _que.pop();
    for(long _towhere : _g[_target]){
      if(_ans[_towhere] == -1){
        _ans[_towhere] = _ans[_target] + 1; _que.push(_towhere);
      }
    }
  }
  return _ans;
}

int main()
{
    ll A, B, C, K, ans;
    cin >> A >> B >> C >> K;
    if(K <= A){
      cout << K << endl;
    }
    elif(K <= A+B){
      cout << A << endl;
    }
    else{
      cout << A - (K - (A + B)) << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleTest
{
    static partial class Program
    {
        static void Main(string[] args)
        {
            var v = Ints();
            int n = v[0];
            int m = v[1];
            var a = Ints();
            var sum = a.Sum();
            int thr = sum;

            int num = 0;
            for(int i = 0; i < a.Length; ++i)
            {
                if (4*m*a[i] >= thr) ++num;
            }
            if (num >= m) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
    static partial class Program
    {
        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }
        public static int[] Ints()
        {
            return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        }
        public static int[][] MultiInts(int num)
        {
            var result = new int[num][];
            for(int i = 0; i < num; ++i)
            {
                result[i] = Ints();
            }
            return result;
        }
        public static T[] MultiItems<T>(int num, Func<string,T> parser)
        {
            var result = new T[num];
            for(int i =0; i < num; ++i)
            {
                result[i] = parser(Console.ReadLine());
            }
            return result;
        }
    }
}


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

using namespace std;

vector<int> a[111111];
int f(int s, int *p, int &u) {
	int m = -1;
	u = s;
	for (auto i : a[s]) {
		if (i == p[s]) continue;
		p[i] = s;
		int v;
		int j = f(i, p, v);
		if (m < j) m = j, u = v;
	}
	return m + 1;
}
int b[111111];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int v, w;
		scanf("%d%d", &v, &w);
		a[v].push_back(w);
		a[w].push_back(v);
	}
	int u, v;
	f(1, b, u);
	b[u] = 0;
	f(u, b, v);
	vector<int> p, q;
	int r = 0;
	n = 1;
	for (int i = v; i != u; i = b[i]) {
		int m = n + 1;
		for (auto j : a[i]) {
			if (j == b[i] || j == r)
				continue;
			if (a[j].size() > 1) {
				cout << -1 << endl;
				return 0;
			}
			p.push_back(m++);
		}
		r = i;
		p.push_back(n);
		n = m;
	}
	p.push_back(n);
	b[v] = 0;
	f(v, b, u);
	r = 0, n = 1;
	for (int i = u; i != v; i = b[i]) {
		int m = n + 1;
		for (auto j : a[i]) {
			if (j == b[i] || j == r)
				continue;
			q.push_back(m++);
		}
		r = i;
		q.push_back(n);
		n = m;
	}
	q.push_back(n);
	p = min(p, q);
	for (auto i : p)
		cout << i << ' ';
	cout << endl;
	return 0;
}


Measured memory_bytes: 17272
#include <iostream>
#include <cstring>
#include<cstdio>
#include<algorithm>
using namespace std;

#define INF 1000967200
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define DEBUG 



int main(void){
	int n,t,a[200000],m=INF,ans=0,sc=0,lc=0,c=0;
	cin>> n >> t;
	REP(i,n)scanf("%d",&a[i]);
	
	REP(i,n){
		m=min(m,a[i]);
		if(c<(a[i]-m)){
			c=a[i]-m;
			lc=1;
		}else if(c==(a[i]-m)){
			lc++;
		}
	}

	cout<<lc<<endl;

	return 0;
}

Measured memory_bytes: 640
import math
n = int(input())
h = list(map(int, input().split()))
#print(n)
#print(h)
counter = 0
countMax = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    counter +=1
    countMax = max(counter,countMax)
  else:
    counter = 0
print(countMax)


Measured memory_bytes: 15020