akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define hell (ll)1000000007
#define f first
#define s second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree< ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
const ll N = 2005 ;
ll a[N][N] , up[N][N] , lft[N][N] , rgt[N][N] , down[N][N] ;  
void solve()
{
    memset(a,0,sizeof(a));
    memset(lft,0,sizeof(lft));
    memset(rgt,0,sizeof(rgt));
    memset(up,0,sizeof(up));
    memset(down,0,sizeof(down));
    ll n , m ;
    cin >> n >> m ;
    ll ans = 0 ;
    rep( i , 1 , n + 1 )
    {
        rep( j , 1 , m + 1 )
        {
            char c ;
            cin >> c ;
            a[i][j] = (c=='.');
        }
    }
    rep( i , 1 , n + 1 )
    {
        rep( j , 1 , m + 1 )
        {
            if( a[i][j] == 1 )
                lft[i][j] = lft[i][j-1] + 1 ;
        }
    }
    rep( i , 1 , n + 1 )
    {
        for( ll j = m ; j >= 1 ; j-- )
        { 
            if( a[i][j] == 1)
                rgt[i][j] = rgt[i][j+1] + 1 ;
        }
    }
    rep( j , 1 , m + 1 )
    {
        rep( i , 1 , n + 1 )
        {
            if( a[i][j] == 1 )
                up[i][j] = up[i-1][j] + 1 ; 
        }
        for( ll i = n ; i >= 1 ; i-- )
        {
            if( a[i][j] == 1 )
                down[i][j] = down[i+1][j] + 1 ;
        }
    }
    rep( i , 1 , n + 1 )
    {
        rep( j , 1 , m + 1 )
        {
            if( a[i][j] == 1 )
            {
                ans = max( ans , lft[i][j] + rgt[i][j] + up[i][j] + down[i][j] - 3LL ) ;
            }
            //cout << a[i][j] << " " ;
        }
       // cout << "\n" ;
    }
    cout << ans << "\n" ;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*fact[0] = 1 ;
    rep( i , 1 , N )
        fact[i] = ( fact[i-1] * i ) % hell ;*/
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


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

ll Pow(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1) {
			res *= a;
		}
		a *= a;
		b >>= 1;
	}
	return res;
}

int main()
{
	int N;
	cin >> N;
	ll res = Pow(3, N), d = 1;
	for (int i = 0, A; i < N; i++) {
		cin >> A;
		if (A % 2 == 0) {
			d *= 2;
		}
	}
	cout << res - d << endl;
	return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

#define MAX 1010
int V,E,fw[MAX][MAX];
vector<int> G[MAX];

bool dfs(int cur,int start, int goal, deque<int> &deq) {
  if( cur == goal ) return true;
  rep(i,(int)G[cur].size()) {
    int nex = G[cur][i];
    if( fw[start][nex] == INT_MAX || fw[nex][goal] == INT_MAX ) continue;
    if( fw[start][nex] + fw[nex][goal] != fw[start][goal] ) continue;
    deq.push_back(nex);
    if( dfs(nex,start,goal,deq) ) return true;
    deq.pop_back();
  }
  return false;
}

int main() {
  cin >> V >> E;
  rep(i,V) rep(j,V) fw[i][j] = INT_MAX;
  rep(i,V) fw[i][i] = 0;
  rep(i,E) {
    int s,t;
    cin >> s >> t;
    --s, --t;
    G[s].push_back(t);
    fw[s][t] = 1;
  }
  rep(k,V) rep(i,V) rep(j,V) if( fw[i][k] != INT_MAX && fw[k][j] != INT_MAX ) {
    fw[i][j] = min(fw[i][j],fw[i][k]+fw[k][j]);
  }
  int mini = INT_MAX;
  int sp=-1, ep=-1;
  rep(src,V) {
    rep(dst,V) {
      if( src == dst ) continue;
      if( fw[src][dst] == INT_MAX || fw[dst][src] == INT_MAX ) continue;
      if( mini > fw[src][dst] + fw[dst][src] ) {
	mini = fw[src][dst]+fw[dst][src];
	sp = src; ep = dst;
      }
    }
  }
  if( mini == INT_MAX ) { puts("-1"); return 0; }
  deque<int> deq;
  assert( dfs(sp, sp, ep, deq) );
  assert( dfs(ep, ep, sp, deq) );
  cout << deq.size() << endl;
  rep(i,(int)deq.size()) {
    cout << deq[i] + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 4352
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  string s;
  cin >> s;
  string r;
  r = s;
  reverse(r.begin(), r.end());
  int cnt = 0;
  rep(i,s.length()){
    if(s.substr(i,1) != r.substr(i,1)) cnt++;
  }
  cnt /= 2;
  printf("%d\n", cnt);
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  long long a[100000+10];
  for (int i=0; i<n+1; i++){
    cin >> a[i];
  }
  long long min_k=0;
  long long max_k=0;  
  long long min_s=0;
  long long max_s=0;  
  //bool flag = true;
  for (int i=n; i>=0; i--){
    min_k = (min_k+1)/2 + a[i];
    max_k = max_k + a[i];
    min_s += min_k;
    max_s += max_k;
    //cout << min_k << " " << max_k << " " << min_s << " " << max_s << endl;
  }
  
  if(min_k >= 2){
    cout << -1;
    return 0;
  }
  
  long long t = 1;
  long long s = 1;
  max_k = max_k - a[0];
  
  for (int i=1; i<=n; i++){
    s += a[i];
    max_k = max_k - a[i];
    t = min(2*t-a[i],max_k);
    s += t;
    //cout << i << " " << s << endl;
 }
  cout << s;
}

Measured memory_bytes: 4416
sx,sy,tx,ty = map(int,input().split())
dx,dy = tx-sx, ty-sy

cmd1 = 'R' * dx + 'U' * dy
cmd2 = 'L' * dx + 'D' * dy
cmd3 = 'D' + 'R' * (dx+1) + 'U' * (dy+1) + 'L'
cmd4 = 'U' + 'L' * (dx+1) + 'D' * (dy+1) + 'R'

answer = cmd1 + cmd2 + cmd3 + cmd4
print(answer)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define repl(i, a, b) for(long long i = a; i < b; i++)
#define rrepl(i, a, b) for(long long i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
using pii = pair<int,int>;
using piii = pair<pii,int>;
using pll = pair<long long, long long>;
using plll = pair<pll, long long>;
// #pragma GCC optimize("Ofast")
// #define _GLIBCXX_DEBUG
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define isSquare(x) (sqrt(x)*sqrt(x) == x)
template<class T>inline bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>inline bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void in(void){return;}
template <typename First, typename... Rest> void in(First& first, Rest&... rest){cin >> first;in(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
// const int mod = 998244353;
const int INF = 1e9;
const long long INFLL = 1e18;
void iosetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
}
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
    os << p.first << " " << p.second;
    return os;
}
template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
    is >> p.first >> p.second;
    return is;
}
template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
    for(int i = 0; i < (int) v.size(); i++) {
        os << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return os;
}
template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
    for(T &in : v) is >> in;
    return is;
}
template<class T> vector<T> make_vec(size_t a) {return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S, T>& t){return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S, T>& t){return pair<S,T>(s.first-t.first, s.second-t.second);}
template<class S, class T> pair<S,T> operator*(const pair<S,T> &s, const S& t){return pair<S,T>(s.first*t, s.second*t);}
template <typename T> void Exit(T first){cout << first << endl;exit(0); };
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const pii dxy[4] = {pii(1,0), pii(0, 1), pii(-1, 0), pii(0, -1)};

//----------------------- edit from here ---------------------------------

int main(){
    iosetup();
    int k; cin >> k;
    rep(i, 0, k){
        cout << "ACL";
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 3604
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        h: usize, w: usize,
        a: [chars; h]
    }
    let mut xmap = std::collections::HashMap::new();
    let mut cx = 0;
    for x in 0..w {
        let mut is_none = true;
        for y in 0..h {
            if a[y][x] != '.' {
                is_none = false;
            }
        }
        if !is_none {
            xmap.insert(cx, x);
            cx += 1;
        }
    }
    let mut ymap = std::collections::HashMap::new();
    let mut cy = 0;
    for y in 0..h {
        let mut is_none = true;
        for x in 0..w {
            if a[y][x] != '.' {
                is_none = false;
            }
        }
        if !is_none {
            ymap.insert(cy, y);
            cy += 1;
        }
    }

    for y in 0..cy {
        for x in 0..cx {
            let rx = xmap[&x];
            let ry = ymap[&y];
            print!("{}", a[ry][rx]);
        }
        println!("");
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){

  int i,j,k=0,l=0;
  int n;
  int len1,len2;
  int carry;
  int data1_int[1000],data2_int[1000];
  int sum[1000];
  int over;
  char data1[1000];
  char data2[1000];

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

    k=0;
    carry=0;
    over=0;
    memset(sum,0,sizeof(sum));

    scanf("%s",data1);
    scanf("%s",data2);

    len1=strlen(data1);
    len2=strlen(data2);
    if(len1>80||len2>80){
      over=1;
    }

    for(j=0;j<len1;j++){
      data1_int[j]=data1[j]-0x30;
    }
    for(j=0;j<len2;j++){
      data2_int[j]=data2[j]-0x30;
    }

    while(len1>0&&len2>0){
      sum[k]=(data1_int[len1-1]+data2_int[len2-1]+carry)%10;
      carry=(data1_int[len1-1]+data2_int[len2-1]+carry)/10;
      len1--;
      len2--;
      k++;
    }
    while(len1>0){
      sum[k]=(data1_int[len1-1]+carry)%10;
      carry=(data1_int[len1-1]+carry)/10;
      len1--;
      k++;
    }
    while(len2>0){
      sum[k]=(data2_int[len2-1]+carry)%10;
      carry=(data2_int[len2-1]+carry)/10;
      len2--;
      k++;
    }
    if(carry==1){
      sum[k]=carry;
      k++;
    }
    if(k>80){
      over=1;
    }
    if(over==0){  
      for(j=k-1;j>=0;j--){
	printf("%d",sum[j]);
      }
      printf("\n");

    }else{
      printf("overflow\n");
    }
    
  }
  return(0);
}
  

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    int N;
    cin >> N;
    vector<int> v(N);
    int x = 0;
    REP(i,N) {
        cin >> v[i];
        x ^= v[i];
    }
    for(const auto &it: v) cout << (it ^ x) << " ";
    cout << endl;

}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 4036
def f(n):
    if n%2==0:
        return n//2
    else:
        return 3*n+1

s = int(input())

cnt=1
l = []
j=False
while j==False:
    if s in l:
        print(cnt)
        j=True
    l.append(s)
    s = f(s)
    cnt+=1

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
    int N;
    long long T[102];
    cin >> N;
    rep(i, N) cin >> T[i];
    auto ans = T[0];
    rep(i, N) if (i) { ans = T[i] / __gcd(ans, T[i]) * ans; }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d[10]={0};
	cin>>a>>b>>c;
	d[a]++;
	d[b]++;
	d[c]++;
	if(d[5]==2)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        var X = Console.ReadLine().Split().Select(int.Parse).Last();
        Console.WriteLine(Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).TakeWhile(x => 0 <= (X -= x)).Count() - (0 < X ? 1 : 0));
    }
}


Measured memory_bytes: 13396
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let N = get!(i64);

    let ans = format!("ABC{}", N);

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  cin>>n;
  vector<int> g[n];
  int a,b;
  REP(i,n-1){
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> c(n);
  REP(i,n){
    cin>>c[i];
  }
  sort(c.begin(),c.end(),greater<int>());
  int deg[n];
  REP(i,n){
    deg[i]=g[i].size();
  }
  vector<pair<int,int>> cand;
  REP(i,n){
    cand.push_back(make_pair(-deg[i],i));
  }
  sort(cand.begin(),cand.end());
  int ans=0;
  int index=0;
  int root=cand[0].second;
  bool used[n]={};
  int d[n];
  used[root]=true;
  d[root]=c[0];
  index++;
  queue<int> q;
  q.push(root);
  while(!q.empty()){
    int cur=q.front();
    q.pop();
    REP(i,deg[cur]){
      if(used[g[cur][i]]){
        continue;
      }else{
        d[g[cur][i]]=c[index];
        ans += c[index];
        index++;
        used[g[cur][i]]=true;
        q.push(g[cur][i]);
      }
    }
  }
  cout<<ans<<endl;
  REP(i,n){
    cout<<d[i]<<' ';
  }
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 1280
#!/mnt/c/Users/moiki/bash/env/bin/python

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

# N splited by number of M 
import math
plist = [2]
for i in range(3, int(1e5+1)):
    ok = True
    for j in plist:
        if j > math.sqrt(i):
            break   
        elif i % j == 0:
            ok = False
            break
    if ok:
        plist.append(i)

# print(plist)

## 

prime_pair = {}

def cnt_power(n, p):
    if p < 2:
        raise "p is smaller than 2."
    if n >= p and n % p == 0:
        return 1 + cnt_power(int(n/p), p)
    else:
        return 0
        
def fac(N):
    global prime_pair
    for p in plist:
        if N % p == 0:  
            # print(N,p)
            # prime_pair[p = ] = (p, cnt_power(N, p))
            prime_pair[p] = cnt_power(N, p)

# print(fac(M))
fac(M)

import copy
divisor = []
init_nowpair = {}
for k in prime_pair:
    # print("prime pair: ", k, prime_pair[k])
    init_nowpair[k] = 0


def makedivisor(prime_pair, now_pair):
    # print(now_pair)
    multi = 1
    for np in now_pair:
        multi *= int(pow(np, now_pair[np]))
    #     print("\tmulti:", multi)
    # print("multi:", multi)
    if multi > M:
        return 
    else:
        if not multi in divisor:
            divisor.append(multi)
        else:
            return 
    

    for np in now_pair:
        if prime_pair[np] > now_pair[np]:
            now_pair2 = copy.deepcopy(now_pair)
            now_pair2[np] += 1
            makedivisor(prime_pair, now_pair2)
makedivisor(prime_pair, init_nowpair)            
divisor.sort()
# print(divisor)

maxx = 0
for d in divisor:
    if M % d == 0 and int(M/d) >= N:
        maxx = max(maxx, d)

print(maxx)
        
    
# for k in prime_pair:
#     print(k,prime_pair[k])





# maxx = 0
# maxlen = 0
# for i in range(3, int(1e9)):
#     if i % int(1e3) == 0:
#         print(i)
#         print(maxx, maxlen)

#     prime_pair = {}
#     fac(i)
#     maxlen = max(maxlen, len(prime_pair))
#     for k in prime_pair:
#         maxx = max(maxx, prime_pair[k])
    

Measured memory_bytes: 4040
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#ifdef  _DEBUG
#define debug(x) cout << "debug" << ": " << x << endl;
#else
    #define debug(x)
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    queue<pair<int,int>> que;
    vector<vector<int>> c(h,vector<int>(w,INF));
    if(s[0][0]!='.'){
        c[0][0] = 1;
    }
    else{
        c[0][0] = 0;
    }
    que.push(make_pair(0,0));
    while(!que.empty()){
        auto a = que.front();
        que.pop();
        int y = a.first;
        int x = a.second;
        if(y+1 < h && c[y+1][x]>c[y][x]){
            if(s[y][x]!=s[y+1][x] && s[y+1][x]=='#'){
                chmin(c[y+1][x],c[y][x]+1);

            }
            else{
                chmin(c[y+1][x],c[y][x]);
            }
            que.push(make_pair(y+1,x));
        }
        if(x+1<w && c[y][x+1]>c[y][x]){
            if(s[y][x]!=s[y][x+1] && s[y][x+1]=='#'){
                chmin(c[y][x+1],c[y][x]+1);
            }
            else{
                chmin(c[y][x+1],c[y][x]);
            }
            que.push(make_pair(y,x+1));
        }
    }
    cout << c[h-1][w-1] << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		List list = new ArrayList<Character>();
      	for(int i=0; i<s.length(); i++){
          if(s.charAt(i)!='B') list.add(s.charAt(i));
          else{
          	if(list.size()!=0) list.remove(list.size()-1);
          }
        }
     	for(int i=0;i<list.size();i++) System.out.print(list.get(i));
	}
}

Measured memory_bytes: 35468
N = int(input())
H = list(map(int, input().split()))

cnt = 1

for i in range (1, N):
  mieru = True
  
  for j in range(i):
    if H[i] < H[j]:
      mieru = False
      break
      
  if mieru == True:
    cnt += 1
    
print(cnt)

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

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

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

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

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

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

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

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

fn main() {
    input!{
        n: usize,
        v: [i64; n]
    }
    let mut tab: Vec<usize> = vec![0; n + 1];
    tab[1] = (v[0] - v[1]).abs() as usize;
    for i in 2..n {
        tab[i] = std::cmp::min(tab[i - 1] + (v[i] - v[i - 1]).abs() as usize, tab[i - 2] + (v[i] - v[i - 2]).abs() as usize)
    }
    println!("{}", tab[n - 1]);
}


Measured memory_bytes: 6396
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    for(auto&& i : l){
        cin >> i;
    }
    long long ans = 0;
    sort(begin(l), end(l));
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            ans += lower_bound(begin(l), end(l), l[i] + l[j]) - begin(l) - j - 1;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
import math
def combinations_count(n, r):
 return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
A=0
N,M=map(int,input().split())
if N<2:
 A+=0
else:
 A+=combinations_count(N, 2)
if M<2:
 A+=0
else:
 A+=combinations_count(M, 2)
print(A)


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

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

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


Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<string>
#include<list>
#include<algorithm>

using namespace std;

int main() {
	long a, b;
	long N, M,K;
	vector<long>  money;
	long sum = 0;
	long ans = 0;

	cin >> N >> K;

	for (int i = 0; i < N; i++)
	{
		cin >> a;

		if (a >= K) {
			ans++;
		}
	}
	

	cout << ans;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int H,W,h,w;
	cin>>H>>W>>h>>w;
	
	cout<<(H-h)*(W-w)<<endl;
	
	return 0;
}

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

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

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

// order statistics tree
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
             tree_order_statistics_node_update> indexed_set;

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define rrep(i, b, a) for(int i = b; i >= a; --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

bool possible;
int sum, n;
vector<pii> jobs;
int main() {
  cin.tie(0); cin.exceptions(cin.failbit);
  possible = true;
  scanf("%d", &n);
  rep(i, 0, n){
    int a,b;
    scanf("%d%d", &a,&b);
    jobs.PB({b,a});
  }
  sort(jobs.begin(), jobs.end());

  trav(j, jobs){
    int et = j.F, t = j.S;
    sum += t;
    if(sum > et) {
      possible = false;
      break;
    }
  }
  printf("%s\n", (possible ? "Yes" : "No"));
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	string s,t,u;
	cin>>s>>t>>a>>b>>u;
	if(u==s) cout<<a-1<<" "<<b;
	else cout<<a<<" "<<b-1; 
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int mo=1e9+7;

int n;
struct ninja{int x,v;}p[200001];
bool operator<(ninja a,ninja b){return a.x<b.x;}

int q[200001],c;
struct segment{int l,r;}s[200001];
bool operator<(segment a,segment b){return a.r!=b.r?a.r<b.r:a.l>b.l;}

int f[200001],g[200001],ans;

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
	scanf("%d%d",&p[i].x,&p[i].v);
    std::sort(p+1,p+n+1);

    for(int i=1,l,r,m;i<=n;++i)
    {
	if(p[i].v>p[q[c]].v)q[++c]=i;
	
	l=0,r=c;
	while(l+1<r)
	{
	    m=(l+r)>>1;
	    if(p[q[m]].v<p[i].v)l=m;
	    else r=m;
	}

	s[i].l=q[r];
    }

    p[c=0].v=2e9;
    for(int i=n,l,r,m;i;--i)
    {
	if(p[i].v<p[q[c]].v)q[++c]=i;
	
	l=0,r=c;
	while(l+1<r)
	{
	    m=(l+r)>>1;
	    if(p[q[m]].v>p[i].v)l=m;
	    else r=m;
	}

	s[i].r=q[r];
    }
    std::sort(s+1,s+n+1);

    c=0;
    for(int i=1;i<=n;++i)
	if(s[i].l>s[c].l)s[++c]=s[i];

    g[0]=1;
    for(int i=1,l=0;i<=n;++i)
    {
	while(l<=c&&s[l].r<i)++l;

	(f[i]=g[i-1]-g[s[l-1].l-1])<0&&(f[i]+=mo);
	(g[i]=g[i-1]+f[i])>=mo&&(g[i]-=mo);
    }

    (ans=g[n]-g[s[c].l-1])<0&&(ans+=mo);
    printf("%d\n",ans);
    
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
// vector<vector<int>> A(3, vector<int>(4));
int main() {
    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    if(K%2==1){
        cout<<B-A<<endl;
    }
    else{
        cout<<A-B<<endl;
    }
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef tuple<ll,ll,ll> T;
int main(){
  ll n,x=0,y=0;
  cin>>n;
  ll a[n],b[n];
  vector<T> p(n);
  for(ll i=0;i<n;i++){
    cin>>a[i]>>b[i];
    p.push_back(T(a[i]+b[i],a[i],i));
  }
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  for(int i=0;i<n;i++){
    if(i%2==0){
      x+=a[get<2>(p[i])];
    }else{
      y+=b[get<2>(p[i])];
    }
  }
  cout<<x-y;
}

Measured memory_bytes: 6616
#include<stdio.h>




int main(){
    int N;
    

    
    scanf("%d",&N);
    
    
    if (N%2==0) {
        
        printf("%d\n",N);
   

    } else if (N%2!=0) {
    
              printf("%d\n",N*2);
        
    }
    
    return 0;
    
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>

using namespace std;

int fish[1000001] = { 0 };
typedef pair<int, int> Pii;

void AOJ0099() {
	int n, q;
	int a, v;
	cin >> n >> q;

	priority_queue<Pii> pq;

	for (int i = 0; i < q; i++) {
		cin >> a >> v;
		fish[a] += v;
		pq.push(Pii(fish[a], -a));

		Pii p;
		while (!pq.empty()) {
			p = pq.top();
			if (p.first == fish[-p.second]) {
				break;
			}
			pq.pop();
		}
		printf("%d %d\n", -p.second, p.first);
	}
	return;
}

int main()
{
	AOJ0099();
	return 0;
}

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

int main(){
  long N;
  
  cin >> N;
  //二つの積の形a*bに表す。
  long a=N,b=N;
  
  for(long n=1; n*n <= N; n++){
    if(N%n == 0){
      if(n + N/n < a+b){
        a = n;
        b = N/n;
      }
    }
  }
  cout << (a + b -2);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int n,x[200000],maxv,minv;

void max(){
    maxv=x[1]-x[0], minv=x[0];

    for(int i=1 ; i<n ; i++){
        maxv=(maxv > x[i]-minv) ? maxv:(x[i]-minv);
        minv=(x[i] < minv) ? x[i]:minv;
    }
    printf("%d\n", maxv);
}

int main(void){
    scanf("%d", &n);
    for(int i=0 ; i<n ; i++)
        scanf("%d",&x[i]);
    max();
    return 0;
}



Measured memory_bytes: 2564
/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-5-26 20:27:08
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
string S;
int sum[2][300010];
int cost[300010];

int main()
{
  cin >> N;
  cin >> S;
  for (auto i = 0; i < N; i++)
  {
    int x = (S[i] == 'E');
    sum[x][i] = 1;
    sum[1 - x][i] = 0;
  }
  for (auto i = 1; i < N; i++)
  {
    sum[0][i] += sum[0][i - 1];
  }
  for (auto i = N - 2; i >= 0; i--)
  {
    sum[1][i] += sum[1][i + 1];
  }
  cost[0] = sum[1][1];
  for (auto i = 1; i < N - 1; i++)
  {
    // cerr << "cost[" << i << "] = " << sum[0][i - 1] << " + " << sum[1][i + 1] << endl;
    cost[i] = sum[0][i - 1] + sum[1][i + 1];
  }
  cost[N - 1] = sum[0][N - 2];
  int mini = N;
  for (auto i = 0; i < N; i++)
  {
    mini = min(mini, cost[i]);
  }
  cout << mini << endl;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=998244353;
const int N=2e5+5;



int main(){
    int N, K; cin >> N >> K;
    ll R, S, P; cin >> R >> S >> P;
    string T; cin >> T;
    vi cnt(3, 0);
    vector<vi> db_cnt(K, vi(3, 0));
    vi prev_val(K, -1);
    vi f(K, 0);
    for(int i=0; i<N; i++){
        int val;
        switch (T[i]){
            case 'r' : 
                val=0;
                break;
            case 's' :
                val=1;
                break;
            case 'p' :
                val=2;
                break;
        }
        cnt[val]++;
        if(i < K) continue;
        if(T[i] == T[i-K]){
            prev_val[i%K]=val;
            if(f[i%K] == 0){
                f[i%K]++;
                db_cnt[i%K][val]+=2;
            }
            else db_cnt[i%K][val]++;
        }
        else{
            if(f[i%K]){
                cnt[prev_val[i%K]]-=db_cnt[i%K][prev_val[i%K]]/2;
                db_cnt[i%K][prev_val[i%K]]=0;
                f[i%K]=0;
            }
        }
    }
    for(int i=0; i<K; i++){
        if(f[i%K]) cnt[prev_val[i%K]]-=db_cnt[i%K][prev_val[i%K]]/2;
    }
    ll res;
    res=cnt[0]*P+cnt[1]*R+cnt[2]*S;
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 6656
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k; cin >> n >> k;
    ll ans = k;
    rep(i, n-1) ans *= (k-1);
    cout << ans;
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long

int n, m;
pair <int, int> a[105];
bool correct;

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> m;
	for(int i = 0; i < m; ++i) {
		cin >> a[i].first >> a[i].second;
	}
	if (n == 1) {
		for(int i = 0; i < 10; ++i) {
			correct = true;
			string s = to_string(i);
			for(int j = 0; j < m; ++j) {
				if ((int)(s[a[j].first-1])-48 != a[j].second) {
					correct = false;
				}
			}
			if (correct == true) {
				cout << s;
				return 0;
			}
		}
	}
	else if (n == 2) {
		for(int i = 10; i < 100; ++i) {
			correct = true;
			string s = to_string(i);
			for(int j = 0; j < m; ++j) {
				if ((int)(s[a[j].first-1])-48 != a[j].second) {
					correct = false;
				}
			}
			if (correct == true) {
				cout << s;
				return 0;
			}
		}
	}
	else if (n == 3) {
		for(int i = 100; i < 1000; ++i) {
			correct = true;
			string s = to_string(i);
			for(int j = 0; j < m; ++j) {
				if ((int)(s[a[j].first-1])-48 != a[j].second) {
					correct = false;
				}
			}
			if (correct == true) {
				cout << s;
				return 0;
			}
		}
	}
	cout << -1;
}

Measured memory_bytes: 3696
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();

		System.out.println(solve(n, s));
	}

	private static int solve(int n, String s) {
		int min = n;
		int cnt = 0;

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

			if (i == 0) {
				for (int j = 1; j < n; j++)
					if (s.charAt(j) == 'E')
						cnt++;
			}

			else {
				if (s.charAt(i-1) == 'W')
					cnt++;
				if (s.charAt(i) == 'E')
					cnt--;
			}

			if (min > cnt) min = cnt;
		}
		return min;
	}
}

Measured memory_bytes: 29148
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifdef LOCAL
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define debug(x) ;
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 3010

vector<ll> factmemo, factmemoInv;
ll factmemoMod = -1;

ll factorial(int n, int M){
  if(factmemoMod == M) return factmemo[n];
  if(n <= 1) return 1;

  ll res = 1;
  for(int i=1; i<=n; i++) res = res * i % M;
  return res;
}

ll power(int k, int n, int M){
  if(n == 0) return 1;
  if(n == 1) return (ll)k;

  ll res = power(k, n/2, M);

  res = res * res % M;
  return n%2 == 1 ? res * k % M : res;
}

void initFactorial(int n, int M){
  factmemo.assign(n+1, 0);
  factmemoInv.assign(n+1, 0);
  factmemoMod = M;
  factmemo[0] = 1;
  for(int i=1;i<=n;i++) factmemo[i] = factmemo[i-1] * i % M;
  factmemoInv[n] = power(factmemo[n], M-2, M);
  for(int i=n;i>0;i--) factmemoInv[i-1] = factmemoInv[i] * i % M;

}

//nCm nPm nHm (mod M)

/*Combination*/
ll C(int n, int m, int M){
  if(n < m) return 0;
  if(m == 0 || n == m) return 1;

  if(factmemoMod == M)
    return factmemo[n] * factmemoInv[m] % M * factmemoInv[n-m] % M;

  ll numer = factorial(n, M);
  ll denom = factorial(m, M) * factorial(n-m, M) % M;

  denom = power((int)denom, M-2, M);

  return numer * denom % M;
}
/*Permutation*/
ll P(int n, int m, int M){
  if(n < m) return 0;
  if(m == 0) return 1;

  if(factmemoMod == M)
    return factmemo[n] * factmemoInv[n-m] % M;

  ll numer = factorial(n, M);
  ll denom = factorial(n-m, M);

  denom = power((int)denom, M-2, M);

  return numer * denom % M;
}
/*Combination with Repetitions*/
ll H(int n, int m, int M){
  if(n == 0 && m == 0) return 1;
  return C(n+m-1, m, M);
}



ll dp[SIZE][2];

int main(){
  int h, w, n;
  pair<int,int> walls[SIZE];

  scanf("%d%d%d", &h, &w, &n);

  initFactorial(h+w, mod);

  for(int i=0;i<n;i++){
    int y, x;
    scanf("%d%d", &y, &x);
    y--; x--;
    walls[i] = {y, x};
  }

  sort(walls, walls+n);

  for(int i=0;i<n;i++){
    int y = walls[i].first;
    int x = walls[i].second;

    dp[i][1] = (dp[i][1] + C(x+y, x, mod)) % mod;

    for(int j=0;j<i;j++){
      ll dy = y - walls[j].first;
      ll dx = x - walls[j].second;
      if (dy < 0 || dx < 0) continue;

      ll c = C(dy+dx, dy, mod);
      dp[i][0] = (dp[i][0] + dp[j][1] * c % mod) % mod;
      dp[i][1] = (dp[i][1] + dp[j][0] * c % mod) % mod;
    }
  }

  ll ans = C(h+w-2, h-1, mod);

  for(int i=0;i<n;i++){
    ll dy = h-1 - walls[i].first;
    ll dx = w-1 - walls[i].second;
    ll c = C(dx+dy, dy, mod);
    ans = (ans + dp[i][0] * c % mod - dp[i][1] * c % mod + mod) % mod;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
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 gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}

   


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

    int n,l;
    cin>>n>>l;

    
    vector<string>s(n);
    string ans;

    rep(i,n)cin>>s.at(i);

    sort(ALL(s));
    
    rep(i,n){
        ans += s[i];
       
    }
    cout<<ans<<endl;

    
}



Measured memory_bytes: 3640
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;

int main() {
	// your code goes here
	char str1[11], str2[11], str3[11];
	
	cin>>str1>>str2>>str3;

	char i=toupper(str1[0]);
	char j=toupper(str2[0]);
	char k=toupper(str3[0]);
	cout<<i<<j<<k;
	return 0;
}


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

using namespace std;

const double EPS = 1e-7;
const int N = 1e5+5, M = 1e5+5, OO = 0x3f3f3f3f;
typedef long long ll;

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

//ll fixMod(ll a, ll b){
//    return (a%b + b)%b;
//}
//
//void pushBack(ll& h, ll base, ll mod, char c){
//    h = ((h*base)%mod + c)%mod;
//}
//
//void pushFront(ll& h, ll p, ll mod, char c){
//    h = (h + (c*p)%mod)%mod;
//}
//
//void popFront(ll& h, ll p, ll mod, char c){
//    h = fixMod((h - (p*c)%mod), mod);
//}
//
//void popBack(ll& h, ll inv, ll mod, char c){
//    h = (fixMod(h-c, mod)*inv)%mod;
//}
//
//ll power(ll a, ll b, ll m){
//    if(!b)  return 1;
//    ll t = power(a, b>>1, m);
//    return ((t*t)%m * (b&1 ? a : 1))%m;
//}

ll getDivisors(ll n){       //O(n)
    ll mx=0;
    for(ll i = 1 ; i <= n ; ++i)
        if(n%i == 0)   mx=max(mx, i);
    return mx;
}


vector<pair<ll, ll>> factorize(ll n){
    vector<pair<ll, ll> > ret;
    for(ll p = 2 ; p <= n/p ; ++p){
        int e = 0;
        while(n%p == 0){
            n /= p;
            ++e;
        }
        if(e)   ret.push_back({p, e});
    }
    if(n > 1)   ret.push_back({n, 1});
    return ret;
}


ll a,b;
vector<pair<ll, ll>> ans;

int main(){
//    freopen("araf_bara.txt", "wt", stdout);
    cin>>a>>b;

    if(a==1 || b==1)cout<<1<<endl;
    else{
    ans = factorize(__gcd(a,b));
    cout<<ans.size()+1<<endl;}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main(){
    ll h;
    cin >> h;
    ll ans =0;
    ll cnt =0;

    while(h!=0){
        ans += pow(2,cnt);
        cnt++;
        h /= 2;
    }

    dunk(ans);
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L.at(i);
  }
  sort(L.begin(), L.end());
  reverse(L.begin(), L.end());
  int length = 0;
  for (int i = 0; i < K; i++) {
    length += L.at(i);
  }
  cout << length << endl;
}

Measured memory_bytes: 256
for i in range(0,10000):
  a, op, b = input().split()
  a = int(a)
  b = int(b)
  if op == "?":
    break
  elif op == "+":
    print(a+b)
  elif op == "-":
    print(a-b)
  elif op == "*":
    print(a*b)
  elif op == "/":
    print(a//b)


Measured memory_bytes: 5592