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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int H, W, N; cin >> H >> W >> N;
	int sr, sc; cin >> sr >> sc;
	string S, T; cin >> S >> T;
	string pat = "DRUL";

	for (int d = 0; d < 4; d++) {
		int s = sc;
		int size = W;
		if (d%2 == 0) s = sr, size = H;
		
		auto in = [&](int pos) {
			return (1 <= pos && pos <= size);
		};

		for (int i = 0; i < N; i++) {
			if (pat[d] == S[i]) s += (dx[d]+dy[d]);
			if (!in(s)) { cout << "NO" << el; return; }
			if (pat[(d+2)%4] == T[i] && in(s-(dx[d]+dy[d])) ) s -= (dx[d]+dy[d]);
		}
	}
	cout << "YES" << el;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 4000
#include<iostream>

using namespace std;

int N,M;
int main () {
    cin >> N >> M;
    int ans = 0;
    for(int i=1; i*i<=M; i++) {
        if(M%i==0) {
            int a = M/i;

            if( (long long int)i * N <= M ) ans = max(ans,i);
            if( (long long int)a * N <= M ) ans = max(ans,a);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
    std::ios::sync_with_stdio(false);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(0,min(b,d)-max(a,c));


    return 0;      

}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	ll n;
	cin >> n;
	vector<ll> factor;
	ll tmp = n;
	for (ll i = 2; i*i <= tmp; i++) {
		int k = 0;
		while (tmp%i == 0) {
			tmp /= i;
			k++;
		}
		if (k > 0) factor.push_back(i);
	}
	if (tmp > 1) factor.push_back(tmp);
	ll ans = 0;
	for (int bit = 0; bit < (1 << factor.size()); bit++) {
		ll mul = 1;
		int cnt = 0;
		for (int i = 0; i < factor.size(); i++) {
			if (bit&(1 << i)) {
				mul *= factor[i];
				cnt++;
			}
		}
		if (cnt % 2 == 0) ans += n / mul;
		else ans -= n / mul;
	}
	cout << ans << endl;
 }


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
#define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p;y = y>>1;x = (x*x) % p;} return res; } 
 
// Debug //
 
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
// Constants //
 
 
/*** Template Ends ***/
ll cache[3005][3005];
string s,t;
ll lcs(ll n,ll m)
{
  if(n<1 || m<1)
    return 0;
  if(cache[n][m]!=-1)
    return cache[n][m];
  if(s[n-1]==t[m-1])
    cache[n][m] = 1+lcs(n-1,m-1);
  else
    cache[n][m] = max(lcs(n,m-1),lcs(n-1,m));
  return cache[n][m];
}
void solve()
{
  cin>>s>>t;
  ll i,j;
  ll n = s.length(),m=t.length();
  for(i=1;i<=n;i++)
    for(j=1;j<=m;j++)
      cache[i][j]=-1;
  string ans="";
  i=n,j=m;
  ll k = lcs(n,m);
  // for(i=1;i<=n;i++)
  // {
  //   for(j=1;j<=m;j++)
  //     cout<<cache[i][j]<<" ";
  //   cout<<endl;
  // }
  while(k)
  {
    if(s[i-1]==t[j-1])
    {
      // trace(s[i-1]);
      ans.push_back(s[i-1]);
      k--;
      i--;j--;
    }
    else if(cache[i-1][j]>cache[i][j-1])
    {
      // ans.push_back(t[j]);
      i--;
    }
    else
    {
      // ans.push_back(s[i]);
      j--;
    }
    // trace3(i,j,k);
  }
  reverse(all(ans));
  cout<<ans; 
}
 
int main(){ 
  ios;
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t;
  // cin >> t;
  t=1;
  while(t--)
    solve();
 
  return 0;
}

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

static const int Nmax = 1e5;
int dp[Nmax][3];

int main() {
    int N; cin >> N;
    vector<int> a(N), b(N), c(N);
    for (int i = 0; i < N; ++i) { cin >> a[i] >> b[i] >> c[i]; }

    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for (int i = 1; i < N; ++i)
    {
        dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
    }

    cout << max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2])) << endl;

    return 0;
}


Measured memory_bytes: 2560
import java.util.*;
import static java.lang.System.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        long[] a=new long[3*n];
        for (int i = 0; i < n*3; i++) {
            a[i]=sc.nextLong();
        }
        Arrays.sort(a);
        long ans=0;
        for (int i = n*3-2; i >= n; i-=2) {
            ans+=a[i];
        }
        out.println(ans);
    }
}

Measured memory_bytes: 97180
while(1):
    H, W = map(int, input().split())
    if H==0 and W==0:
        break
    for h in range(H):
        line = ""
        for w in range(W):
            if (h + w) % 2 == 0:
                line += "#"
            else:
                line += "."
        print(line)
    print("")

Measured memory_bytes: 7672
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];
    int ans=-n;
    for(int i=0;i<n;i++){
        cin >> a[i];
        ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int listNum = sc.nextInt();
			int qLen = sc.nextInt();
			MyList[] lists = new MyList[listNum];

			for(int i=0;i<listNum;i++) {
				lists[i] = new MyList();
			}

			for(int i=0;i<qLen;i++) {
				int query = sc.nextInt();
				int t = sc.nextInt();
				switch(query) {
				case 0:
					lists[t].insert(sc.nextInt());;
					break;
				case 1:
					lists[t].dump();
					break;
				case 2:
					lists[sc.nextInt()].splice(lists[t]);
					break;
				}
			}
		}
	}
	/**
	 * リストの各要素です
	 */
	static class MyNode{
		int value;
		MyNode next;

		public MyNode(int value) {
			this.value = value;
			this.next = null;
		}
		/**
		 * 次要素をセットします
		 * @param node 次要素
		 */
		public void setNext(MyNode node) {
			this.next = node;
		}
	}
	/**
	 * 自作(単方向)リスト
	 */
	static class MyList{
		MyNode head;
		MyNode last;
		public MyList() {
			this.head = null;
			this.last = null;
		}
		/**
		 * リストに要素を追加します
		 * @param x
		 */
		public void insert(int x) {
			MyNode node = new MyNode(x);
			if(this.head == null) {
				this.head = node;
				this.last = node;
			}
			else {
				this.last.setNext(node);
				this.last = node;
			}
		}
		/**
		 * これに引数のリストを連結し、引数リストは亡き者になります
		 * @param list
		 */
		public void splice(MyList list) {
			if(this.head == null) {
				this.head = list.head;
				this.last = list.last;
			}
			else {
				this.last.setNext(list.head);
				this.last = list.last;
			}
			list.head = null;
			list.last = null;
		}
		/**
		 * リストの全要素を表示します
		 */
		public void dump() {
			MyNode node = this.head;
			if(node != null) {
				System.out.print(node.value);
				for(node = node.next;node != null;node = node.next) {
					System.out.print(" " + node.value);
				}
			}
			System.out.println();
		}
	}
}


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

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

    int N, M;
    cin >> N >> M;
    vector<int> V;
    vector<int> G(N + 1, 0);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        if (a == 1) V.push_back(b);
        if (b == N) G.at(a) = 1;
    }

    for (auto &x : V) {
        if (G.at(x)) {
            cout << "POSSIBLE" << endl;
            exit(0);
        }
    }
    cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 1660
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);		
		String N = in.next();
        String M = in.next();
      
      	int nam = Integer.parseInt(N+M);
        double nam2 = Math.sqrt((double)nam);
      
        if(nam2%1==0){System.out.print("Yes");}
        else{System.out.print("No");}
      
      }
	}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=2e5+5;
int a[mxn],b[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	for(int i=0; i<n; i++)cin >> a[i] >> b[i];
	sort(a,a+n);
	sort(b,b+n);
	if(n%2){
		cout << b[n/2]-a[n/2]+1 << endl;
	}else{
		int mn = a[n/2-1]+a[n/2];
		int mx = b[n/2-1]+b[n/2];
		cout << mx-mn+1 << endl;
	}
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 5176
s = input().strip()
list_s = list(s)


def judge(s):
    if s[0] != 'A':
        return False
    list_s[0] = 'a'
    count = 0
    for idx, c in enumerate(s):
        if 2 <= idx and idx <= len(s) - 2 and c == 'C':
            count += 1
            list_s[idx] = 'c'

    if count != 1:
        return False

    return ''.join(list_s) == s.lower()


if judge(s):
    print('AC')
else:
    print('WA')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define mod 1000000007
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define adb2(a) for(auto i:a) cout << i.first << " " << i.second << endl;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define N 100010
using namespace std;

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

    fastIO;
    long long a, b;
    cin >> a >> b;

    for(int i=0; i<10000; i++)
    {
        if((i*8)/100 == a && (i*10)/100 == b)
        {
            cout << i << endl;
            return 0;
        } 
    }

    cout << "-1" << endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;

    vector<int> h(n);

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

    vector<int> dp(n);

    dp[0] = 0;

    for(int i = 1; i < n; i++)
    {
        if(i == 1)
        {
            dp[i] += abs(h[i] - h[0]);
        }
        else
        {
            dp[i] += min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
        }
    }

    cout << dp[n - 1];

    return 0;
}

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

ll N,K;
ll R,S,P;

char winX(char c){
    if(c == 'r') return 'p';
    if(c == 's') return 'r';
    if(c == 'p') return 's';
    return 0;
}

ll point(char c){
    if(c == 'r') return R;
    if(c == 's') return S;
    if(c == 'p') return P;
    return 0;
}

int main(){
    cin >> N >> K;
    cin >> R >> S >> P;
    string T; cin >> T;
    vector<vector<char> > A(K+1,vector<char>(N/K+10,'x'));
    rep(i,N){
        A[i%K][i/K] = T[i];
    }

    ll res = 0;
    rep(i,K){
        vector<char> B(N/K+10);
        B[0] = winX(A[i][0]);
        res += point(B[0]);
        rep(j,N/K+1){
            if(j>0){
                if(B[j-1] == winX(A[i][j])){
                    B[j] = 'x';
                }else{
                    B[j] = winX(A[i][j]);
                    res += point(B[j]);
                }
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 5120
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

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

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	string s;
	cin>>s;
	bool a=s[0]=='A',b=0,d=1;
	int c=-1;
	REP(i,2,(int)s.length()-2) {
		if(s[i]=='C'&&c==-1)c=i,b=1;
		else if(s[i]=='C')b=0;
	}
	REP(i,1,(int)s.length()-1) {
		if(i==c)continue;
		if(s[i]>='A'&&s[i]<='Z')d=0;
	}
	if(a&&b&&c&&d)cout<<"AC";
	else cout<<"WA";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3612
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int a=1;
        int count=0;
        while(a<m){
            a+=n-1;
            count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23764
import java.io.*;
import java.util.*;

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

        String s = cin.nextLine();
        if(s.equals("Sunny")) cout.println("Cloudy");
        else if(s.equals("Cloudy")) cout.println("Rainy");
        else cout.println("Sunny");

        cout.close();
    }
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
#define newline printf ("\n")
#define space printf (" ")
#define cinfalse ios::sync_with_stdio(false)
#define fread(a) freopen (a".in", "r", stdin), freopen(a".out", "w", stdout)
#define rint register int
#define For(i, a, b) for (rint i = a; i <= b; i ++)
#define Low(i, a, b) for (rint i = a; i >= b; i --)
#define FFr(i, a, b, c) for (rint i = a; i <= b; i += c)
#define FLw(i, a, b, c) for (rint i = a; i >= b; i -= c)
#define min(a, b) (a)>(b)?(b):(a)
#define max(a, b) (a)>(b)?(a):(b)
using namespace std;
char a[100010];
int la;
int main()
{
    gets(a);
    la = strlen(a);
    For (i, 0, la/2)
    {
        rint l = i, r = la - i - 1;
        if(a[l]=='b' && a[r]=='d' || a[l]=='d' && a[r]=='b' || a[l]=='p' && a[r]=='q' || a[l]=='q' && a[r]=='p');
        else return puts("No"), 0;
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
  long long a,b,c,d;
  cin >> a >> b >> c >> d;
  long long array[3] = {a*d, b*c, b*d};
  long long out = a*c;
  for(long long ar : array){
    if(ar > out){
    	out = ar;
    }
  }
  
  cout << out;
}

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

int main(){
  ll n,k;
  cin >> n >> k;
  n = min(n%k,n);
  while( true ){
    ll pre = n;
    n = min(abs(n-k),n);
    if( n == pre ) break;
  }
  cout << n << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll cnt[100002];

int main(void)
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
        cnt[a[i]]++;
    }

    ll max = cnt[0] + cnt[1];
    ll max_idx = 0;

    FOR(i,1,100001){
        ll tmp = cnt[i - 1] + cnt[i] + cnt[i + 1];
        if(max <= tmp){
            max = tmp;
            max_idx = i;
        }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 1792
MAX = 2000000

def max_heapify(a, i, h)
  left = i * 2
  right = left + 1
  largest = (left <= h && a[left] > a[i]) ? left : i
  largest = right if right <= h && a[right] > a[largest]
  if largest != i
    a[i], a[largest] = a[largest], a[i]
    max_heapify(a, largest, h)
  end
end

class Que
  def initialize
    @a = Array.new(MAX)
    @size = 0
  end

  def insert(k)
    @size += 1
    @a[@size] = k
    up(@size)
  end

  def up(i)
    while i > 1 && @a[i / 2] < @a[i]
      @a[i / 2], @a[i] = @a[i], @a[i / 2]
      i /= 2
    end
  end

  def extract()
    v = @a[1]
    @a[1] = @a[@size]
    @size -= 1
    max_heapify(@a, 1, @size)
    return v
  end
end

que = Que.new
while true
  command, k = gets.split
  if command == 'insert'
    que.insert k.to_i
  elsif command == 'extract'
    puts que.extract
  else
    break
  end
end



Measured memory_bytes: 22496
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    map<int, int> ma;
    REP(i, 3) {
        cin >> tmp;
        ma[tmp]++;
    }
    cout << ma.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int r;
    cin >> r;
    cout << r * 2 * 3.1415 << endl;
}


Measured memory_bytes: 3796
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var N, C int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d %d", &N, &C)

	xs := make([]int, N+2)
	vs := make([]int, N+2)
	sumv := make([]int, N+2)
	for i := 1; i < N+1; i++ {
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%d %d", &xs[i], &vs[i])
		sumv[i] = sumv[i-1] + vs[i]
	}
	xs[N+1] = C
	vs[N+1] = 0
	sumv[N+1] = sumv[N]

	leftMax := make([]int, N+2)
	left2Max := make([]int, N+2)
	for left := 1; left < N+1; left++ {
		v := sumv[left]
		d := xs[left]
		leftMax[left] = max(leftMax[left-1], v-d)
		left2Max[left] = max(left2Max[left-1], v-2*d)
	}

	rightMax := make([]int, N+2)
	right2Max := make([]int, N+2)
	for right := N; right > 0; right-- {
		v := sumv[N] - sumv[right-1]
		d := C - xs[right]
		rightMax[right] = max(rightMax[right+1], v-d)
		right2Max[right] = max(right2Max[right+1], v-2*d)
	}

	ans := 0
	for i := 0; i <= N; i++ {
		c1 := left2Max[i] + rightMax[i+1]
		c2 := leftMax[i] + right2Max[i+1]
		ans = max(ans, c1, c2)
	}
	fmt.Println(ans)
}

func max(ns ...int) int {
	ret := math.MinInt64
	for _, n := range ns {
		if n > ret {
			ret = n
		}
	}
	return ret
}


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

int main() {

    int a, b;
    scanf("%d %d", &a, &b);

    if (b == 1) {
        printf("0");
    } else if (a >= b) {
        printf("1");
    } else {
        //b = b - (a-1);
        b -= a;
        //printf("%d\n", b);
        if (b % (a - 1) == 0) {
            printf("%d", 1 + (b / (a - 1)));
        } else {
            printf("%d", 2 + (b / (a - 1)));
        }
    }

    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	int N;
	std::string s;
	in >> N >> s;

	int cnt = 0;
	rep(i, N)
	{
		if (s[i] == 'R') ++cnt;
	}
	int blue = N - cnt;
	out << (cnt > blue ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256
from bisect import bisect_left
N = int(input())
L = sorted(list(map(int,input().split())),reverse = False)
cnt = 0
for a in range(0,N-2):
    A = L[a]
    for b in range(a+1,N-1):
        B = L[b]
        cnt += bisect_left(L,A+B)-b-1
print(cnt)           


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto &e : a)
    cin >> e;

  ll cnt = 0;
  bool up = false, down = false;
  for (int i = 0; i < n - 1; ++i)
  {
    if (a[i] < a[i + 1])
      up = true;
    if (a[i] > a[i + 1])
      down = true;
    if (down && up)
    {
      cnt++;
      down = up = false;
    }
  }
  cnt++;
  cout << cnt << endl;

  return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;
int a[100000];int n,m;
bool good(int k){
  int L=1;
  int res=1;
  while(true){
    if(L+k>a[n-1])break;
    int r=lower_bound(a,a+n,L)-a;
    int ne=10000000;
    if(a[r]<L+k){
      ne=a[r]-L;
    }
    if(r>0){
      ne=min(ne,L-a[r-1]);
    }
    L+=max(1,k-ne);
    res++;
  }
  if(res>=m)return true;
  else return false;
}
int main(){
  while(cin>>n>>m,n){
    for(int i=0;i<n;i++){
      cin>>a[i];
    }
    if(!good(1)){
      cout<<-1<<endl;continue;
    }
    int le=0;int ri=10000000;
    while(ri-le>1){
      int mid=(le+ri)/2;
      if(1+mid<=a[0]){
        le=mid;continue;
      }
      if(good(mid))le=mid;
      else ri=mid;
    }
    if(1+le>a[0]){
      cout<<le<<endl;
    }
    else{
      cout<<-1<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3392
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

typedef long long ll;

#define vi std::vector<int>
#define vl std::vector<ll>
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;

int f(int x, int y, int z)
{
    return x*x+y*y+z*z+x*y+y*z+x*z;
}

int main()
{
    int N, max, res, sz;
    std::cin >> N;
    max = sqrt(N);
    vl A(N, 0);

    if(N >= 6)
    {
        for(int x = 1; x <= max; ++x)
        {
            for(int y = x; y <= max; ++y)
            {
                for(int z = y; z <= max; ++z)
                {
                    res = f(x, y, z);
                    if(res > N)
                        break;

                    std::set<int> s{x, y, z};
                    sz = s.size();
                    A[res-1] += sz==3 ? 6 : sz==2 ? 3 : 1;
                }
            }
        }
    }


    floop(N)
        print(A[i]);

    return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };
LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)

// ---- ----

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	cout << (a + b + c >= 22 ? "bust" : "win") << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 2e5 + 5;
bool vis[N];
int nxt[N][26];
int par[N];
char pch[N];
void solve(){
	string s;
	cin >> s;
	int n = sz(s);
	s = '0' + s;
	for(int i = n - 1; i >= 0; i--){
		fr(j, 0, 25){
			nxt[i][j] = nxt[i + 1][j];
		}
		nxt[i][s[i + 1] - 'a'] = i + 1;
	}
	queue<int> q;
	q.push(0);
	vis[0] = 1;
	while(!q.empty()){
		int u = q.front();
		q.pop();
		fr(j, 0, 25){
			if(!nxt[u][j]){
				string s = "";
				s += (char)('a' + j);
				while(u > 0){
					s += pch[u];
					u = par[u];
				}
				reverse(all(s));
				cout << s;
				return;
			}
			else{
				if(!vis[nxt[u][j]]){
					vis[nxt[u][j]] = 1;
					pch[nxt[u][j]] = 'a' + j;
					q.push(nxt[u][j]);
					par[nxt[u][j]] = u;
				}
			}
		}
	}
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 43216
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n;
	cin >> n;

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		string s = to_string(i);
		if (s.size() % 2 == 1) {
			ans++;
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n,m,l = map(int,input().split())
town = [list(map(int,input().split())) for _ in range(m)]
q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

inf = (l+1)*n
d = [[inf]*n for _ in range(n)]
for i in range(n):
    d[i][i] = 0
for a,b,c in town:
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c
    
def warshall_floyd(d,n):
    for k in range(n):
        for j in range(n):
            for i in range(n):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])

warshall_floyd(d,n)

d2 = [None]*n
for i,row in enumerate(d):
    d2[i] = [1 if val<=l else inf for val in row]
    d2[i][i] = 0

warshall_floyd(d2,n)
 
for s,t in query:
    s -= 1
    t -= 1
    count = (d2[s][t]%inf)-1
    print(count)


Measured memory_bytes: 70492
using System;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			var h = int.Parse(Console.ReadLine());
			var w = int.Parse(Console.ReadLine());
			var n = int.Parse(Console.ReadLine());

			int max = Math.Max(h, w);
			int count = n % max == 0 ? n / max : n / max + 1;

			Console.WriteLine(count);
		}
	}
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

int N;

void func(string s, int &ans) {
    if (s.length() != 0) {
        ll num = stoll(s);
        if (num > N) {
            return;
        } else if (s.length() >= 3) {
            bool seven = false;
            bool five = false;
            bool three = false;
            for (int i = 0; i < s.length(); ++i) {
                if (s[i] == '3') three = true;
                if (s[i] == '5') five = true;
                if (s[i] == '7') seven = true;
            }
            int total = three + five + seven;
            if (total == 3) {
                ans++;
            }
        }
    }

    string news; 
    news = '3' + s;
    func(news, ans);
    news = '5' + s;
    func(news, ans);
    news = '7' + s;
    func(news, ans);

    return;
}

void solve() {
    cin >> N;

    int ans = 0;
    func("", ans);

    print(ans);
}

signed main() {
    solve();
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

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

  int64_t i,o,t,j,l,s,z;
  cin>>i>>o>>t>>j>>l>>s>>z;

  int64_t result=0;
  if(i>0&&j>0&&l>0){
     int64_t ti=i-1,tj=j-1,tl=l-1;
     int64_t tmp=3;
     tmp+=(ti/2)*2+(tj/2)*2+(tl/2)*2;
     tmp+=o;
     result=tmp;
  }
  result=std::max(result,o+(i/2)*2+(j/2)*2+(l/2)*2);
  cout<<result<<endl;




  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

int main() {

    int M;
    cin >> M;
    vector<ll> d(M), c(M);
    rep(i,M) cin >> d[i] >> c[i];

    ll N = 0;
    ll digitsum = 0;
    rep(i,M) {
        N += c[i];
        digitsum += d[i] * c[i];
    }

    ll ans = N - 1 + (digitsum - 1) / 9;
    cout << ans << endl;
    
    return 0;
}

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

int main()
{
  int N;
  int ans = 0;
  cin >> N;
  vector<vector<pair<int, int>>> a(N);
  rep(i, N)
  {
    int A;
    cin >> A;
    rep(j, A)
    {
      int x, y;
      cin >> x >> y;
      a[i].emplace_back(make_pair(x - 1, y));
    }
  }

  rep(i, pow(2, N))
  {
    bitset<15> bs(i);
    vector<int> B(N, -1);
    int count = 0;
    bool is_ok = true;
    rep(j, N)
    {
      if (B[j] == -1)
        B[j] = bs[j];
      else if (B[j] != bs[j])
        is_ok = false;

      if (bs[j] == 1)
      {
        count++;
        rep(k, a[j].size())
        {
          int x = a[j][k].first;
          int y = a[j][k].second;
          if (B[x] == -1)
            B[x] = y;
          else if (B[x] != y)
            is_ok = false;
        }
      }
    }
    if (is_ok)
      ans = max(ans, count);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int max,fluet;
    int alt;
    int sum = 0;
    int price[999];

    if(scanf("%d%d",&max,&fluet) != 2){
        return -1;
    }

    if(max < fluet)return -1;
    if(max > 1000)return -1;

    for(int i = 0;i < max;i++){
        if(scanf("%d",&price[i]) != 1){
            return -1;
        }
        if(price[i] <1 || 1000 < price[i])return -1;
    }



    for(int i = 0;i < max - 1;i++){
        for(int j = i + 1;j < max;j++){
            if(price[i] > price[j]){
                alt = price[i];
                price[i] = price[j];
                price[j] = alt;
            }
        }
    }

    for(int k = 0;k < fluet;k++){
        sum += price[k];
    }

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

     return 0;
}


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

int main() {
  int N;
  cin >> N;
  priority_queue<int> a;
  int ain;
  for (int i=0; i<N; i++) {
    cin >> ain;
    a.push(ain);
  }
  int aliceSum=0;
  int bobSum=0;
  for (int i=0; i<N; i++) {
    if (i%2 == 0) {
      aliceSum+=a.top();
      a.pop();
      continue;
    }
    bobSum+=a.top();
    a.pop();
  }
  cout << aliceSum-bobSum << endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;
const int mod = 1000000007;


int main(){
    long long a, b, c;
    cin >> a >> b >> c;
    if(c - a - b <= 0){
        cout << "No" <<endl;
        return 0;
    }
    if(4 * a * b < (c - a - b) * (c - a - b)){
        cout << "Yes" << endl;
        return 0;
    }else{
        cout << "No" <<endl;
        return 0;
    }
}


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

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

  if (A + B == C + D) {
    cout << "Balanced" << endl;
  }  
  if (A + B > C + D) {
    cout << "Left" << endl; 
  }
  if (A + B < C + D) {
    cout << "Right" << endl;
  }
}  



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

constexpr int mod = 1000000007;
struct mint {
  long long x;
  constexpr mint(long long x = 0) : x((x % mod + mod) % mod) {}
  constexpr mint operator-() const { return mint(-x); }
  constexpr mint &operator+=(const mint &a) {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  constexpr mint &operator-=(const mint &a) {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  constexpr mint &operator*=(const mint &a) {
    (x *= a.x) %= mod;
    return *this;
  }
  constexpr mint operator+(const mint &a) const {
    mint res(*this);
    return res += a;
  }
  constexpr mint operator-(const mint &a) const {
    mint res(*this);
    return res -= a;
  }
  constexpr mint operator*(const mint &a) const {
    mint res(*this);
    return res *= a;
  }
  constexpr mint pow(long long t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  constexpr mint inv() const { return pow(mod - 2); }
  constexpr mint &operator/=(const mint &a) { return (*this) *= a.inv(); }
  constexpr mint operator/(const mint &a) const {
    mint res(*this);
    return res /= a;
  }
};
ostream &operator<<(ostream &os, const mint &m) {
  os << m.x;
  return os;
}

mint comb(ll n, ll r) {
  mint res = 1;
  for (int i = 1; i <= r; i++) {
    res *= n;
    res /= i;
    n--;
  }
  return res;
}

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

  int n, k;
  cin >> n >> k;
  int a = n - k + 1;
  rep(i, 1, k + 1) {
    mint v = comb((k - i) + (i - 1), i - 1);
    cout << (v * comb(a, i)).x << endl;
  }
}


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

int main(){
  int x;
  char c,*cons[] = {"w","","k","s","t","n","h","m","y","r","w"};
  map<char,char> vowl;
  vowl['T'] = 'a';vowl['L'] = 'i';vowl['U'] = 'u';vowl['R'] = 'e';vowl['D'] = 'o';

  while (cin >> x >> c){
    if (x == 0 && c == 'U'){
      cout << "nn";
    }else{
      cout << cons[x] << vowl[c];
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1192
defmodule Main do
  def main do
    [a, b, c] =
      IO.read(:line)
      |> String.trim
      |> String.split(" ")
    a = String.to_integer(a)
    b = String.to_integer(b)
    c = String.to_integer(c)
    if a + b >= c do
    	IO.puts("Yes")
    else
    	IO.puts("No")
    end
  end
end


Measured memory_bytes: 30704
n, q = map(int, input().split())
A = [2**31-1 for _ in range(n)]

class SegTree:
    def __init__(self, raw_data):
        n = len(raw_data)
        self.size = 1 << (n.bit_length()) # 葉の要素数
        self.data = [0] * (2*self.size)
        self.build(raw_data)

    def build(self, raw_data):
        for i, x in enumerate(raw_data):
            self.data[self.size+i] = x
        for i in range(self.size-1, 0, -1):
            x = self.data[2*i]
            y = self.data[2*i+1]
            self.data[i] = x if x < y else y # ここを変更
    
    def update(self, i, x):
        i += self.size
        self.data[i] = x
        i >>= 1
        while i:
            x = self.data[2*i]
            y = self.data[2*i+1]
            self.data[i] = x if x < y else y # ここを変更
            i >>= 1
    
    def get_data(self, i):
        return self.data[i+self.size]
    
    # これを変更
    def get_max(self, L, R):
        L += self.size
        R += self.size + 1
        res = float("inf") # ここを変更
        while L < R:
            if L & 1:
                x = self.data[L]
                if res > x: res = x # ここを変更
                L += 1
            if R & 1:
                R -= 1
                x = self.data[R]
                if res > x: res = x # ここを変更
            L >>= 1
            R >>= 1
        return res

seg = SegTree(A)
for _ in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        seg.update(x, y)
    else:
        print(seg.get_max(x, y))


Measured memory_bytes: 9808
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

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

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

const int INF = 1001001001;

int main()
{
    string s;
    int k;
    cin >> s >> k;
    
    rep(i, s.size()){
        int d = 26 - (s[i] - 'a');
        if(d == 26) continue;
        
        if(d <= k){
            s[i] = 'a';
            k -= d;
        }
    }
    
    s[s.size() - 1] = (s[s.size() - 1] - 'a' + k) % 26 + 'a';
    cout << s << endl;
}


Measured memory_bytes: 640
package main

import (
	"fmt"
)

type (
	//   1
	// 4 2 3 5
	//   6
	Dice struct {
		face [6]int
	}
)

func (d *Dice) Rotate(direction rune) int {
	switch direction {
	case 'W':
		d.face[0], d.face[2], d.face[5], d.face[3] =
			d.face[2], d.face[5], d.face[3], d.face[0]
	case 'E':
		d.face[0], d.face[2], d.face[5], d.face[3] =
			d.face[3], d.face[0], d.face[2], d.face[5]
	case 'N':
		d.face[0], d.face[1], d.face[5], d.face[4] =
			d.face[1], d.face[5], d.face[4], d.face[0]
	case 'S':
		d.face[0], d.face[1], d.face[5], d.face[4] =
			d.face[4], d.face[0], d.face[1], d.face[5]
	default:
		panic(fmt.Sprintf("Undefind direction: %c", direction))
	}
	return d.Get()
}

func (d *Dice) Get() int {
	return d.face[0]
}

func (d Dice) String() string {
	return fmt.Sprintf(
		`  %d
%d %d %d %d 
  %d
`, d.face[0], d.face[3], d.face[1], d.face[2], d.face[4], d.face[5])
}

func main() {
	dice := Dice{}
	for i := 0; i < len(dice.face); i++ {
		fmt.Scan(&dice.face[i])
	}

	var directions string
	fmt.Scan(&directions)
	for _, d := range directions {
		dice.Rotate(rune(d))
	}
	fmt.Println(dice.Get())
}



Measured memory_bytes: 1152
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(s...)  fprintf(stderr, s)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }


int H, W;
char F[111][111];

int A[101][101];
short dp[101][101][101][101];
short box(int l, int u, int r, int d) {
    return A[d][r] - A[d][l] - A[u][r] + A[u][l];
}

int main() {
    scanf("%d%d", &H, &W);
    REP (i, H) scanf("%s", F[i]);

    int si, sj;

    REP (i, H) REP (j, W) {
	if (F[i][j] == 'E') {
	    si = i;
	    sj = j;
	}
	A[i+1][j+1] = A[i][j+1] + A[i+1][j] - A[i][j];
	if (F[i][j] == 'o') A[i+1][j+1] ++;
    }


    int ans = 0;
    REP (l, sj+1) REP (r, W-sj) REP (u, si+1) REP (d, H-si) {
	short cur = dp[l][r][u][d];
	amax(ans, (int)cur);

	int R, L, D, U;

	U = max(si-u, d); D = min(si+d+1, H-u);
	if (sj-1-l >= r && U < D) amax<short>(dp[l+1][r][u][d], cur + box(sj-1-l, U, sj-l, D));
	if (sj+1+r < W-l && U < D) amax<short>(dp[l][r+1][u][d], cur + box(sj+1+r, U, sj+2+r, D));

	L = max(sj-l, r); R = min(sj+r+1, W-l);
	if (si-1-u >= d && L < R) amax<short>(dp[l][r][u+1][d], cur + box(L, si-1-u, R, si-u));
	if (si+1+d < H-u && L < R) amax<short>(dp[l][r][u][d+1], cur + box(L, si+1+d, R, si+2+d));
    }

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



    return 0;
}



Measured memory_bytes: 48128
fun main(args: Array<String>) {
    val list = readLine()!!.split(" ").map(String::toInt)
    var H     = list[0]
    val A     = list[1]
    var Count = 0
    do {
        H = H - A
        Count = Count + 1
    } while (H > 0)
    println(Count)
}

Measured memory_bytes: 37624