akhauriyash/Code-Regression huggingface dataset:
package main

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

const Mod = int(1e9) + 7

func main() {
	N := ReadInt()
	s := ReadString()

	dp := make([][]int, N)
	dpSum := make([][]int, N)
	for i := 0; i < N; i++ {
		dp[i] = make([]int, N)
		dpSum[i] = make([]int, N+1)
	}
	dp[0][0] = 1
	dpSum[0][1] = 1
	// dp[i][j]: 左からi番目まで埋めて、i番目の値が「埋めた値の中で小さい方からj番目(0-indexed)」である場合の数

	for i := 1; i < N; i++ {
		for j := 0; j <= i; j++ {
			if s[i-1] == '<' {
				dp[i][j] = dpSum[i-1][j]
				// // 遷移元からもらう
				// for k := 0; k < j; k++ {
				// 	dp[i][j] += dp[i-1][k]
				// 	dp[i][j] %= Mod
				// }
			} else {
				dp[i][j] = dpSum[i-1][i] - dpSum[i-1][j]
				dp[i][j] += Mod
				dp[i][j] %= Mod
				// for k := j; k <= i-1; k++ {
				// 	dp[i][j] += dp[i-1][k]
				// 	dp[i][j] %= Mod
				// }
			}
		}
		for j := 0; j < N; j++ {
			dpSum[i][j+1] = dp[i][j] + dpSum[i][j]
			dpSum[i][j+1] %= Mod
		}
	}
	ans := 0
	for i := 0; i < N; i++ {
		ans += dp[N-1][i]
		ans %= Mod
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define all(x) x.begin(),x.end()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

int main(){

    IOS;

    ll t,n,m,k;
    t=1;
    while(t--)
    {
        cin >> n >> k;
        vector<ll> v(n);
        for(ll i=0;i<n;i++)
            cin >> v[i];

        vector<bool> dp(k+1,false);

        for(ll i=1;i<=k;i++)
        {
            for(ll j=0;j<n;j++)
            {
                if((i-v[j])>=0 && !dp[i-v[j]])
                {
                    dp[i] = true;
                    break;
                }
            }
        }

        if(dp[k])
            cout << "First" ;
        else
            cout << "Second";

    }
    return 0;
}


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

class Dice{
 public:
 int f[6];
 Dice(){}

 void roll(int i, int j, int k, int l){
   int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
 }
 void roll_x(){ roll(0, 1, 5, 4 );}
 void roll_y(){ roll(0, 2, 5, 3 );}
 void roll_z(){ roll(1, 2, 4, 3 );}
};

bool eq( Dice p1, Dice p2){
  for( int i = 0; i < 6; i++){if( p1.f[i] != p2.f[i]) return false;}
  return true;
}

bool eqa(Dice p1, Dice p2){
	   for( int i = 0; i < 6; i++){
		    for( int j = 0; j < 4; j++){
			     if( eq(p1, p2) ) return true;
			     p1.roll_z();
	    }
		     if( i % 2 == 0) p1.roll_y();
		     else p1.roll_x();
            }
          return false;
}

int main(){
  Dice p1, p2;

  for( int i = 0; i < 6; i++){ cin >> p1.f[i];}
  for( int i = 0; i < 6; i++){ cin >> p2.f[i];}

  if( eqa( p1, p2 )) cout << "Yes" << endl;
  else cout << "No" << endl;
		  
  return 0;
}
	  

Measured memory_bytes: 3112
N, M = map(int, input().split())
A = [list(input()) for i in range(N)]
B = [list(input()) for i in range(M)]
ans = False
for i in range(N-M+1):
    for j in range(N-M+1):
        flag = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] == B[k][l]:
                    continue
                flag = False
                break
            if not flag:
                break
        if flag:
            ans = True
            break
    if ans:
        break
if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#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<int,int>;

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int ans = r/d - l/d;
    if (l%d == 0) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
// 23/01/20 // 11:34 AM //

#include <bits/stdc++.h>

using namespace std;

const int MAXN = (int)(3e3)+2;

int n;
double p, memo[MAXN][MAXN];

int main(){


    cin >> n;

    for(int i=0; i<=n; i++){
        if(i>0)
            cin >> p;
        for(int j=0; j<=n; j++){
            if(i==0){
                if(2*(n-j)<n) memo[0][j] = 0;
                else memo[0][j] = 1;
            }
            else
                memo[i][j] = p*memo[i-1][j-1] + (1-p)*memo[i-1][j];
        }
    }


    cout.precision(10);
    cout.setf(ios::fixed);
    cout << memo[n][n]<< endl;

    return 0;
}



Measured memory_bytes: 70656
/*
Aizu 2305
*/


#include<cstdio>
#include<algorithm>
#include<cmath>
#define INF 1.0
using namespace std;

int n,i,j,k,original[21];
double dp[21][200050],result = INF;

int main()
{
        scanf("%d",&n);
        for (i=1;i<=n;i++)
                scanf("%d",&original[i]);
        for (i=1;i<2*original[1];i++)
                dp[1][i] = fabs(i-original[1])/original[1];
        for (i=2;i<=n;i++)
                for (j=1;j<2*original[i];j++)
                        dp[i][j] = INF;
        for (i=2;i<=n;i++)
        {
                for (j=1;j<2*original[i-1];j++)
                {
                        for (k=j;k<2*original[i];k+=j)
                                dp[i][k] = min(dp[i][k],max(dp[i-1][j],fabs(k-original[i])/original[i]));
                }
        }
        for (i=1;i<2*original[n];i++) result = min(result,dp[n][i]);
        printf("%.10f",result);
        return 0;
}

Measured memory_bytes: 31816
//by (111110101)2
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
int n,a,b,dt1[101010],dt2[101010],ans=-1;
vector<int>v[101010];
void dfs1(int x,int lt)
{
	dt1[x]=dt1[lt]+1;
	for(int i=0;i<v[x].size();i++)
	{
		int y=v[x][i];
		if(y!=lt)
		{
			dfs1(y,x);
		}
	}
}
void dfs2(int x,int lt)
{
	dt2[x]=dt2[lt]+1;
	for(int i=0;i<v[x].size();i++)
	{
		int y=v[x][i];
		if(y!=lt)
		{
			dfs2(y,x);
		}
	}
}
int main()
{
	cin>>n>>a>>b;
	for(int i=0;i<n-1;i++)
	{
		int aa,bb;
		cin>>aa>>bb;
		v[aa].push_back(bb);
		v[bb].push_back(aa);
	}
	dfs1(a,0);
	dfs2(b,0);
	for(int i=1;i<=n;i++)
	{
		if(dt1[i]<=dt2[i])
		{
			ans=max(dt2[i],ans);
		}
	}
	cout<<ans-2<<endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s.at(i);

    vector<map<char, int>> each_c(n);
    map<char, int> all_c;

    rep(i, n)
    {
        rep(j, int(s.at(i).size()))
        {
            each_c.at(i)[s.at(i).at(j)]++;
            all_c[s.at(i).at(j)]++;
        }
    }

    string answer = "";
    // for (const auto &[k, v] : all_c)
    for (map<char, int>::iterator itr = all_c.begin(); itr != all_c.end(); ++itr)
    {
        int min_cnt = INT_MAX;
        rep(i, n)
        {
            min_cnt = min(min_cnt, int(each_c.at(i)[itr->first]));
        }
        rep(i, min_cnt)
        {
            answer = answer + itr->first;
        }
        // cout << k << " " << min_cnt << endl;
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize ("O3")
#endif
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define mor > muu & operator << (
#define R22(r) sim > typename \
  enable_if<1 r sizeof dud<c>(0), muu&>::type operator<<(c g) {
sim > struct rge { c b, e; };
sim > rge<c> range(c h, c n) { return {h, n}; }
sim > auto dud(c* r) -> decltype(cerr << *r);
sim > char dud(...);
struct muu {
#ifdef LOCAL
stringstream a;
~muu() { cerr << a.str() << endl; }
R22(<) a << boolalpha << g; ris; }
R22(==) ris << range(begin(g), end(g)); }
sim, class b mor pair < b, c > r) { ris << "(" << r.first << ", " << r.second << ")"; }
sim mor rge<c> u) {
  a << "[";
  for (c i = u.b; i != u.e; ++i)
    *this << ", " + 2 * (i == u.b) << *i;
  ris << "]";
}
#else
sim mor const c&) { ris; }
#endif
muu & operator()() { ris; }
};
#define imie(r...) "[" #r ": " << (r) << "] "
#define imask(r...) "[" #r ": " << bitset<8 * sizeof(r)>(r) << "] "
#define arr(a, i) "[" #a imie(i) ": " << a[i] << "] "
#define arr2(a, i, j) "[" #a imie(i) imie(j) ": " << a[i][j] << "] "
#define debug (muu() << __FUNCTION__ << "#" << __LINE__ << ": ")

const int N = 2e5 + 7;
vector <int> punkty[N];
vector <int> kand[N];

const int inf = 1e6 + 7;
set <pair <int, int>> S;

void wstaw(int a, int b) {
    S.insert({a, b});
    auto it = S.find({a, b});
    if (next(it) != S.end() && next(it) -> first == b + 1) {
        b = next(it) -> second;
        S.erase(next(it));
        S.erase(it);
        S.insert({a, b});
        it = S.find({a, b});
    }
    if (it != S.begin() && prev(it) -> second == a - 1) {
        a = prev(it) -> first;
        S.erase(prev(it));
        S.erase(it);
    }
}

void ucinaj() {
    set <pair <int, int>> nS;
    for (auto it = S.begin(); it != S.end(); ++it) {
        int a = it -> first;
        int b = it -> second;
        if (a + 1 <= b) nS.insert({a + 1, b});
    }
    S.swap(nS);
}

bool czyJest(int x) {
    auto it = S.lower_bound({x, inf + 1});
    if (it == S.begin()) return true;
    return prev(it) -> second < x;
}

int main() {
    int h, w, n;
    scanf("%d %d %d", &h, &w, &n);
    int wynik = h;
    S.insert({2, inf});
    
    for (int i = 1; i <= n; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        punkty[x].push_back(y);
        kand[x - 1].push_back(y);
    }
    
    for (int x = 1; x < h; ++x) {
        for (int y : punkty[x]) {
            if (czyJest(y)) wstaw(y, y);
        }
        
        for (int y : kand[x]) {
            debug << imie(x) imie(y) imie(czyJest(y));
            if (czyJest(y)) {
                wynik = min(wynik, x);
                goto koniec;
            }
        }
        
        if (S.size() == 1 && S.begin() -> first == 1) break;
        ucinaj();
    }
    
    koniec:
    
    printf("%d\n", wynik);
    return 0;
}


Measured memory_bytes: 22144
// in the name of Allah

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

#define endl '\n'
#define pb push_back
#define ll long long
#define double long double
#define sz(x) ((int) (x.size()))
#define all(x) (x).begin(), (x).end()

#define fr first
#define se second

const ll mod = 1000000007;

inline ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

inline ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

inline ll power(ll a, ll b) {
	ll p = 1;
	while(b) {
		if(b&1) p = mul(p, a);
		a = mul(a, a);
		b /= 2;
	}
	return p;
}

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

	ll a;
	string s;
	cin >> a >> s;
	if(a >= 3200) cout << s << endl;
	else cout << "red" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

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

  int ans=0;
  REP(i,n-2){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
  }

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


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
int gcd(int a, int b);

int main() {
    // source
    int a,b;
    cin >> a>>b;
    string ans="Draw";

    if(a>b){
        ans="Alice";
    }else if(b>a){
        ans="Bob";
    }

    if(a==1 && b!=1){
        ans="Alice";
    }else if(a!=1 && b==1){
        ans="Bob";
    }

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

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;




int a[100001];
int main(){
    int n;cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        int k;cin>>k;
        if(k<=100000)a[k]++;
        else ans++;
    }
    for(int i=1;i<=100000;i++){
        if(a[i]<i)ans+=a[i];
        if(a[i]>i)ans+=a[i]-i;
    }
    printf("%d",ans);
    
    
    return 0;
}


Measured memory_bytes: 256
a,b,c,d = list(input())
sign = '+-'
for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+sign[i]+b+sign[j]+c+sign[k]+d) == 7:
                print(str(a+sign[i]+b+sign[j]+c+sign[k]+d) + '=7')
                exit()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(998244353)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
const int N = 100005;


int32_t main() {

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

	int a,e,k;
	cin >> a >> e >> e >> e >> e >> k;
	if(e-a <= k) {
		cout << "Yay!\n";
	}
	else
		cout << ":(\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if(a == b && b == c){
        cout << "No" << endl;
    }else if(a == b || b == c || a == c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

class Main{

	static int N;
	static int M;
	static 		ArrayList<ArrayList<Integer>> map;
	static boolean[] used;
	static int f = 0;
	static int s = 0;

	static int mindis = 1000000000;
	static ArrayList<Integer> saitan;




	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int[] a = new int[n+1];
		for(int i= 1;i <= n;i++){
			a[i] = sc.nextInt();
		}
		boolean[] used = new boolean[n+1];
		int c =0;
		int p= 1;
		for(int i= 1;i <= n;i++){

			if(used[p]){
				System.out.println(-1);
				return;
			}
			if(p == 2){
				System.out.println(c);
				return;
			}
			c++;

			used[p] = true;
			p = a[p];
			
		}
		
		
		
	}

}




Measured memory_bytes: 52488
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
	ll a[6];
    REP(i, 6) cin >> a[i];
    if(a[4] - a[0] > a[5]){
        cout << ":(" << endl;
        return 0;
    }
    cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<vector<int>>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

#define PI 3.14159265358979323846264338327950L
const int mod = 1e9+7;









void solve(){

    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max(1LL*a*d,max(1LL*b*c,max(1LL*b*d,1LL*a*c)));
       

}




int main() {
    int T;
    //if (0==0) cin >> T;  
    //else T = 1;
    T = 1;
    while (T--) {
        solve();
        cout << endl;
    }
}




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

using namespace std;

int get_divnum(int n) {
  int res = 0;
  for (int i = 1; i <= n; i += 2)
    if (n % i == 0) res++;
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++)
    if (get_divnum(i) == 8) ans++;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
    int vis[10];
    scanf("%d%d",&a,&b);
        for(int i=1;i<=10;i++)
        vis[i]=0;
        vis[a]=1;
        vis[b]=1;
        int i;
        for(i=1;i<=3;i++)
        {
            if(!vis[i])
            break;
        }
        printf("%d\n",i);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double eps = 1e-10;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 +7;
const ll MAXN = 1e5 + 5;

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

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

ll a[MAXN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll n,m;
	cin>>n>>m;
	bool ok=1;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]/=2;
	}
	sort(a+1,a+1+n);
	ll qaq=1;
	for(int i=1;i<=n;i++){
		if(i==1) qaq=a[i];
	    qaq=lcm(qaq,a[i]);
	    if(qaq>m) ok=0;
	}
	for(int i=1;i<=n;++i){
        if(qaq/a[i]%2==0){ok=0;break;}
    }
	if(!ok){
		cout<<0;
		return 0;
	}
	ll ans=0,tot=m/qaq;
	ans=tot/2;
	if(tot&1) ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1024
while True:
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:break
    elif m == -1 or f == -1:print("F")
    elif (m + f) >= 80:print("A")
    elif (m + f) >= 65:print("B")
    elif (m + f) >= 50:print("C")
    elif (m + f) >= 30:
        if r >= 50:print("C")
        else:print("D")
    else:print("F")


Measured memory_bytes: 5596
n = input()
ans = [0 for _ in n]
count = 0

for i in range(len(n)):
    if n[i] == "L":
        if i % 2 == p:
            ans[loop_pos] += 1
        else:
            ans[loop_pos-1] += 1
    elif n[i+1] != "L":
        ans[i+1] = ans[i] + 1
        ans[i] = 0
    else:
        loop_pos = i+1
        ans[i] += 1 
        ans[i+1] = ans[i] // 2
        ans[i] =  ans[i] //2 + ans[i] %2
        p = loop_pos %2
       
print(" ".join(map(str, ans)))



Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

const int mod=1000000007;
const int INF=1001001001;

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

int main() {
  int N;
  cin>>N;
  int cnt=0;
  for(int i=1;i<=N;i++){
    if(i%2!=0&&f(i)==8){cnt++;}
  }
  cout<<cnt<<endl;
  return 0;  
}

Measured memory_bytes: 3588
from sys import stdin
readline = stdin.readline

N = int(readline())
A = list(map(int, readline().split()))
Q = int(readline())

t = [0] * (10 ** 5 + 1)
s = sum(A)
for a in A:
    t[a] += 1

for _ in range(Q):
    B, C = map(int, readline().split())
    s -= B * t[B]
    s += C * t[B]
    t[C] += t[B]
    t[B] = 0
    print(s)


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

const int MAX_N = 100005;

int N, M, A[MAX_N], B[MAX_N], odd;

int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= M; ++i) {
    scanf("%d", &A[i]);
    if (A[i] & 1) odd++;
  }

  if (M == 1) {
    if (N == 1) printf("1\n1\n1\n");
    else printf("%d\n2\n%d %d\n", N, N - 1, 1);
  } else if (odd <= 2) {
    for (int i = 1, num = 0; i <= M; ++i)
      if ((A[i] & 1) && num == 0) swap(A[1], A[i]), num++;
      else if ((A[i] & 1) && num == 1) swap(A[i], A[M]), num++;

    int tot = 0, sum = 0;
    for (int i = 1; i <= M; ++i) {
      sum += A[i];
      if (i != M && sum != 1) {
	B[++tot] = sum - 1;
      } else if (i == M) {
	B[++tot] = N;
      }
    }

    for (int i = 1; i <= M; ++i)
      printf("%d ", A[i]);
    puts("");

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

    for (int i = 1; i <= tot; ++i)
      printf("%d ", B[i] - B[i - 1]);
    puts("");

  } else {
    puts("Impossible");
  }
  
  return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    abc144c()
}

fun abc144c() {
    val n = readLine()!!.toLong()

    (Math.pow(n.toDouble(), 1 / 2.toDouble()).toLong() downTo 1).map { i ->
        if (n % i == 0L) return println(i + (n / i) - 2)
    }

    println("WTH?")
}


Measured memory_bytes: 40724
while True:
    h, w = map(int,input().split())
    if h == 0 and w ==0:
        break
    else:
        x1="#"
        x2="."
        for i in range(0, w-1):
            if x1[-1] == "#":
                x1+="."
            else:
                x1+="#"
        for i in range(0, w-1):
            if x2[-1] == ".":
                x2+="#"
            else:
                x2+="."
        for i in range(0, h):
            if i % 2 == 0:
                print(x1)
            else:
                print(x2)
    print('')

Measured memory_bytes: 7676
#include <stdio.h>

int main(void)
{
    int n=0;
    long int sum=0;
    scanf("%d",&n);

    for(int i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0){
            sum+=i;
        }
    }

    printf("%ld",sum);

    return 0;
}


Measured memory_bytes: 1732
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BBreakNumber solver = new BBreakNumber();
        solver.solve(1, in, out);
        out.close();
    }

    static class BBreakNumber {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            out.println((int) Math.pow(2, Math.floor(Math.log(in.nextInt()) / Math.log(2))));
        }

    }
}



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

int main() {
    int N;
    cin >> N;
    vector<string> vec(N);
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
    }

    bool siritori = true;
    bool nikai = true;
    for(int i=0; i<N-1; i++){
        if(vec.at(i).at(vec.at(i).size()-1) != vec.at(i+1).at(0)){
            siritori = false;
        }
    }

    sort(vec.begin(),vec.end());
    for(int i=0; i<N-1; i++){
        if(vec.at(i)==vec.at(i+1)){
            nikai = false;
        }
    }

    if(siritori && nikai){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
using pll=pair<ll,ll>;	

int n;
int ara[305];
ld dp[305][305][305];

ld f(int o,int tw,int th)
{
	if(o<0 || tw<0 || th<0) return 0.0;
	
	int z=n-(o+tw+th);
	
	if(z==n) return 0.0;
	
	ld &ans=dp[o][tw][th];
	
	if(ans>-0.3) return ans;
	
	
	ld a=(ld)o/(ld)n*(1.0+f(o-1,tw,th));
	ld b=ld(tw)/(ld)n*(1.0+f(o+1,tw-1,th));
	ld c=ld(th)/(ld)n*(1.0+f(o,tw+1,th-1));
	ld d=(ld)z/(ld)n;
	
	ld mul=(ld)n/(ld)(n-z);
	
	return ans=(a+b+c+d)*mul;
}

void solve()
{
	cin>>n;
	
	int one=0,two=0,three=0;
	
	for(int i=0;i<n;i++)
	{
		cin>>ara[i];
		
		if(ara[i]==1) one++;
		else if(ara[i]==2) two++;
		else three++;
	}
	
	memset(dp,-1,sizeof dp);
	
	cout<<fixed<<setprecision(10);
	cout<<"\n"<<f(one,two,three);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	
	return 0;
}


Measured memory_bytes: 443648
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B = get_ints

puts A * B - (A + B - 1)


Measured memory_bytes: 14388
n, m = gets.split.map(&:to_i)
a = Array.new(m){gets.to_i}
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1
a.each do |x|
  dp[x] = -1
end
2.upto(n) do |i|
  next if dp[i] == -1
  dp[i] += [dp[i - 1], 0].max + [dp[i - 2], 0].max
  dp[i] %= 1_000_000_007
end
puts dp[n]

Measured memory_bytes: 15792
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun



int main() {
	
	int s;
	cin >> s;
	if (s >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll n,a[101010];
ll i, j, k;
int main(){
    
    scanf("%lld", &n);
    while(n){
        ll ans = 0;
        ll ave = 0;
        fornum(i,0,n){
            scanf("%lld", &a[i]);
            ave += a[i];
        }
        ave = ave / n;
        fornum(i,0,n){
            if(a[i]<=ave){
                ans++;
            }
        }
        printf("%lld\n",ans);
        scanf("%lld", &n);
        k++;
    }
    return 0;
}


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

int main(){
    int n,i,c=0;
    cin>>n;
    vector<int> v(n);
    for(i=0;i<n;i++) cin>>v[i];
    for(i=1;i<n-1;i++){
        if(max({v[i-1],v[i],v[i+1]})!=v[i] && min({v[i-1],v[i],v[i+1]})!=v[i]) c++;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
<?php
$l1 = explode(' ', trim(fgets(STDIN)));
$l2 = explode(' ', trim(fgets(STDIN)));
$n = $l1[0];
$k = $l1[1];

arsort($l2, SORT_NUMERIC);
$res = 0;
for ($i = 0; $i < $k; $i++) {
  $res += array_shift($l2);
}

echo $res;

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<double, double> PDD;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

PDD operator-(const PDD &a, const PDD &b) {
  return PDD(a.fi - b.fi, a.se - b.se);
}

double len(PDD p) {
  return sqrt(p.fi * p.fi + p.se * p.se);
}

double dot(PDD a, PDD b) {
  return a.fi * b.fi + a.se * b.se;
}

double cross(PDD a, PDD b) {
  return a.fi * b.se - a.se * b.fi;
}

double distance(PDD p1, PDD p2, PDD q1, PDD q2) {
  if (cross(p2 - p1, q1 - p1) * cross(p2 - p1, q2 - p1) < 0 && cross(q2 - q1, p1 - q1) * cross(q2 - q1, p2 - q1) < 0) {
    return 0;
  } else {
    double mini = INF;
    if (dot(p2 - p1, q1 - p1) < 1e-7) minch(mini, len(q1 - p1));
    else if (dot(p1 - p2, q1 - p2) < 1e-7) minch(mini, len(q1 - p2));
    else minch(mini, abs(cross(p2 - p1, q1 - p1)) / len(p2 - p1));

    if (dot(p2 - p1, q2 - p1) < 1e-7) minch(mini, len(q2 - p1));
    else if (dot(p1 - p2, q2 - p2) < 1e-7) minch(mini, len(q2 - p2));
    else minch(mini, abs(cross(p2 - p1, q2 - p1)) / len(p2 - p1));

    if (dot(q2 - q1, p1 - q1) < 1e-7) minch(mini, len(p1 - q1));
    else if (dot(q1 - q2, p1 - q2) < 1e-7) minch(mini, len(p1 - q2));
    else minch(mini, abs(cross(q2 - q1, p1 - q1)) / len(q2 - q1));

    if (dot(q2 - q1, p2 - q1) < 1e-7) minch(mini, len(p2 - q1));
    else if (dot(q1 - q2, p2 - q2) < 1e-7) minch(mini, len(p2 - q2));
    else minch(mini, abs(cross(q2 - q1, p2 - q1)) / len(q2 - q1));

    return mini;
  }
}

int main(){
  int n;
  while(cin >> n, n) {
    PDD s, e;
    cin >> s.fi >> s.se >> e.fi >> e.se;

    double ans = INF;
    bool ok = true;
    rep(i, n) {
      PDD mi, ma;
      double h;
      cin >> mi.fi >> mi.se >> ma.fi >> ma.se >> h;
      double mini = INF;
      minch(mini, distance(s, e, mi, PDD(ma.fi, mi.se)));
      minch(mini, distance(s, e, mi, PDD(mi.fi, ma.se)));
      minch(mini, distance(s, e, ma, PDD(ma.fi, mi.se)));
      minch(mini, distance(s, e, ma, PDD(mi.fi, ma.se)));
      minch(mini, distance(s, e, mi, ma));

      if (mini < h) {
        minch(ans, mini);
      } else {
        double high = 1000, low = mini, mid;
        rep(j, 100) {
          mid = (high + low) / 2;
          if ((mid - h) * (mid - h) + mini * mini >= mid * mid) low = mid;
          else high = mid;
        }
        minch(ans, low);
      }
    }

    printf("%.10f\n", ans);
  }

  return 0;
}

Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;

int main(){
    ll N,K;
    cin>>N>>K;
    vll H(N);
    for(int i=0;i<N;i++) cin>>H[i];
    
    sort(H.begin(),H.end(),greater<ll>());
    ll sum=0;
    for(int i=K;i<N;i++){
        sum+=H[i];
    }
    
    cout<<sum<<endl;
    
    return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int N, A, B;
  cin >> N >> A >> B;
  cout << min(N*A, B) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, a[1010]; cin >> n; for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if ((a[j] - a[i]) % (n - 1) == 0) {
				cout << a[i] << ' ' << a[j] << endl;
				return 0;
			}
		}
	}
	return 0;
}


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

int main() {
    long a, b, k;
    cin>>a >>b >>k;
    if(a>=k) cout<<a-k<<" "<<b<<endl;
    else if(a+b>=k) cout<<0<<" "<<a+b-k<<endl;
    else cout<<"0 0"<<endl;
}

Measured memory_bytes: 3608
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  n <- readInt
  s <- getLine
  putStrLn $ solve n s
  return ()

solve :: Int -> String -> String
solve n s = let ans = filter (check n s) [genAns s (a,b) | [a,b] <- replicateM 2 "SW"]
            in if null ans then "-1" else head ans

trans :: Char -> Char
trans 'S' = 'W'
trans 'W' = 'S'
trans _ = error "rev"

genNext :: Char -> Char -> Char -> Char
genNext e0 'S' 'o' = e0
genNext e0 'S' 'x' = trans e0
genNext e0 'W' 'o' = trans e0
genNext e0 'W' 'x' = e0

genAns :: String -> (Char, Char) -> String
genAns (xo:xos) (e0, e1) = e0:e1:foo xos e0 e1
  where foo (xo:[]) _ _ = []
        foo (xo:xos) e0 e1 = let e2 = genNext e0 e1 xo
                             in e2 : foo xos e1 e2
        foo _ _ _ = error "po"

check :: Int -> String -> String -> Bool
check len (xo0:xos) es = genNext ea eb xon == e0 && genNext eb e0 xo0 == e1
  where xon = last xos
        [e0, e1] = take 2 es
        [ea,eb] = drop (len-2) es

        
------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"


Measured memory_bytes: 26108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int K, T;
  cin >> K >> T;
  vector<int> cake, a(T);
  rep(i, T)
  {
    cin >> a[i];
  }
  RSORT(a);
  rep(i, T)
  {
    rep(j, a[i])
    {
      cake.push_back(i);
    }
  }
  vector<int> sort_cake(K);
  rep(i, K)
  {
    if(i * 2 < K)
      sort_cake[i * 2] = cake[i];
    else
    {
      int j = (i * 2) % K;
      //cout <<  j << "->" << j * 2 + 1 << endl;
      //j = j * 2 + 1;
      sort_cake[j] = cake[i];
    }
  }
  int ans = 0;
  rep(i, K - 1)
  {
    if(sort_cake[i] == sort_cake[i + 1])
      ans++;
  }
  cout << ans << endl;
  return 0;
}

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


int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b > c+d) cout << "Left" << endl;
  if(a+b < c+d) cout << "Right" << endl;
  if(a+b == c+d) cout << "Balanced" << endl;
  
}

Measured memory_bytes: 256
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    string s;
    cin>>s;
    int n=s.size();
    cout << s;
    if(s[n-1]=='s'){
        cout << "es\n";
    }
    else cout << "s\n";
    return 0;
}
///Alhamdulillah


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v(n), c(n);
  for_each(begin(v), end(v), [](int &e) {
    cin >> e;
  });
  for_each(begin(c), end(c), [](int &e) {
    cin >> e;
  });

  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += max(0, v[i] - c[i]);
  }
  cout << ans << endl;
}


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

using namespace std;

int main()
{
  int H, W;
  cin >> H >> W;
  vector<vector<char>> grid(H, vector<char>(W));
  vector<int> rows(H, 0);
  vector<int> cols(W, 0);
  for (int h = 0; h < H; ++h) {
    for (int w = 0; w < W; ++w) {
      cin >> grid[h][w];
      if (grid[h][w] == '#') {
        ++rows[h];
        ++cols[w];
      }
    }
  }

  for (int h = 0; h < H; ++h) {
    if (rows[h] == 0) continue;
    for (int w = 0; w < W; ++w) {
      if (cols[w] == 0) continue;
      cout << grid[h][w];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
#include <numeric>
#include <cstdint>

typedef long long int llint;
using u64 = std::uint_fast64_t;


template <std::uint_fast64_t Modulus> class modint {

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
	*this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

template <std::uint_fast64_t Modulus>
modint<Modulus> mypow(modint<Modulus> a, u64 exp){
  //std::cout << a.a << " " << exp << std::endl;
  
  if(exp==0) return modint<Modulus>(1);

  modint<Modulus> Kk = 1;
  while(exp>1){
    if(exp%2) Kk *= a;
    a*=a;
    exp/=2;
  }

  return Kk * a;
}

int main(void){

  modint<998244353> ret = 0;
  
  int N, M, K;
  std::cin >> N >> M >> K;

  modint<998244353> combi = 1;
  //std::cout << K << std::endl;
  for(int k=0; k<=K; k++){
    //std::cout << k << std::endl;
    ret += combi * M * mypow(modint<998244353>(M-1),N-1-k);

    combi *= (N-1-k);
    combi /= k+1;
  }
  
  std::cout << ret.a << std::endl;
  
  return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] x = new int[N];
        int[] y = new int[N];
        for (int i = 0; i < N; ++i) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        System.out.println(solve(x, y, K));

        sc.close();
    }

    static long solve(int[] x, int[] y, int K) {
        long result = Long.MAX_VALUE;
        for (int minX : x) {
            for (int maxX : x) {
                for (int minY : y) {
                    for (int maxY : y) {
                        int interiorCount = 0;
                        for (int i = 0; i < x.length; ++i) {
                            if (x[i] >= minX && x[i] <= maxX && y[i] >= minY && y[i] <= maxY) {
                                ++interiorCount;
                            }
                        }

                        if (interiorCount >= K) {
                            result = Math.min(result, (long) (maxX - minX) * (maxY - minY));
                        }
                    }
                }
            }
        }

        return result;
    }
}

Measured memory_bytes: 24016
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
from functools import lru_cache
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=list(map(int,input().split()))

lst=[0]*3
for i in range(n):
    lst[a[i]-1]+=1

dp=[[[0.0]*310 for i in range(310)] for j in range(310)]

for k in range(lst[2]+1):
    for j in range(lst[1]+lst[2]+1-k):
        for i in range(lst[0]+lst[1]+lst[2]+1-k-j):
            if i==j==k==0:
                continue
            tmp=1.0
            if i>0:
                tmp+=dp[i-1][j][k]*i/n
            if j>0:
                tmp+=dp[i+1][j-1][k]*j/n
            if k>0:
                tmp+=dp[i][j+1][k-1]*k/n
            
            tmp*=n/(i+j+k)

            dp[i][j][k]=tmp

print(dp[lst[0]][lst[1]][lst[2]])

Measured memory_bytes: 276616
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define INF 1145141919810364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int h, x, w;
string s[15];
int cnt[15][1010];
int ans = INF;

signed main() {
	cin >> h >> w >> x;
	for (int i = 0; i < h; i++)cin >> s[i];
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cnt[i][j] = cnt[i - 1][j] + cnt[i][j - 1] - cnt[i - 1][j - 1];
			if (s[i - 1][j - 1] == '1')cnt[i][j]++;
		}
	}
	for (int i = 0; i < (1 << (h - 1)); i++) {
		vector<int> vec;
		int cnt2 = 0;
		vec.push_back(0);
		for (int j = 0; j < h - 1; j++) {
			if (i&(1 << j)) {
				vec.push_back(j + 1);
				cnt2++;
			}
		}
		vec.push_back(h);
		int l = 0;
		for (int j = 1; j <= w; j++) {
			bool bl = true;
			for (int k = 1; k < (int)vec.size(); k++) {
				if (cnt[vec[k]][j] - cnt[vec[k]][l] - cnt[vec[k - 1]][j] + cnt[vec[k - 1]][l] > x)bl = false;
			}
			if (!bl) {
				if (j - l == 1)cnt2 = INF;
				l = j - 1;
				cnt2++;
			}
		}
		ans = min(ans, cnt2);
	}
	cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> p(n+1);
    for(int i = 1; i <= n; i++) cin >> p[i];

    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(p[i] == i){
            int j = 1;
            for(; i+j <= n; j++){
                if(p[i+j] != i+j) break;
            }
            ans += (j+1)/2;

            i += j-1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3780