akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto N = RD;
	bool[string] set;
	foreach (i; 0..N)
	{
		set[RD!string] = true;
	}

	writeln(set.keys.length);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 35808
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int i = 1;
  int a, b;
  int mi,ma;
  while(true){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    mi = min(a,b);
    ma = max(a,b);
    cout << mi << " " << ma << endl;

  }

}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    int N;
    cin >> N;
    Vi L(N);
    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }

    int mx = 0;
    int sum = 0;
    for (int i = 0; i < N; i++) {
        mx = max(mx, L[i]);
        sum += L[i];
    }

    cout << (mx * 2 < sum ? "Yes\n" : "No\n");

    return 0;
}

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

double dp [3100][3100];

int main() {
  int N;
  cin >> N;
  vector<double> v(N);
  for(int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  dp[1][1] = v.at(0);
  dp[1][0] = 1 - v.at(0);
  for(int i = 1; i < N; i++) {
    for(int j = 0; j <= i+1; j++) {
      if (j == 0) dp[i+1][j] = dp[i][j]*(1-v.at(i));
      else if(j == i+1) dp[i+1][j] = dp[i][i] * v.at(i);
      else {
        dp[i+1][j] = dp[i][j]*(1-v.at(i))+dp[i][j-1]*v.at(i);
      }
    }
  }
  double ans;
  for(int i = N/2 + 1; i <= N; i++) {
    ans += dp[N][i];
  }
  cout << fixed << setprecision(10);
  cout << ans << endl;
}

Measured memory_bytes: 72320
S=input()

if (S=='SUN'):
    print(7)
elif (S=='MON'):
    print(6)
elif (S=='TUE'):
    print(5)
elif (S=='WED'):
    print(4)
elif (S=='THU'):
    print(3)
elif (S=='FRI'):
    print(2)
else:
    print(1)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

int main(int argc, char *argv[])
{
	int len;
    char str[8];
	cin >> str;

	len = strlen(str);
	if (len == 2) {
		cout << str;
		cout << endl;
	} else {
		cout << str[2] << str[1] << str[0];
		cout << endl;
	}	
		
	return 0;
}


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

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


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef vector<vector<char> > Area;
struct state{
  Area a;
  int c;
};
int N;
Area A;
set<Area> s;

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

bool check( const Area &a ) {
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if( a[i][j] == '#' ) return false;
    }
  }
  return true;
}

bool outc(int x,int y){
  if( x < 0 || y < 0 || x >= N || y >= N ) return false;
  return true;
}

void get(const Area &a, int &x,int &y){
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if( a[i][j] == '@' ){
	x = j; y  = i;
	return;
      }
    }
  }
}

Area next( const Area &a ){
  Area b;
  b.resize(N);
  for(int i=0;i<N;i++){
    b[i].resize(N);
    for(int j=0;j<N;j++){
      int cnt = 0;
      for(int k=0;k<8;k++){
	int ni = i + dy[k], nj = j + dx[k];
	if( !outc(nj,ni) ) continue;
	if( a[ni][nj] == '#' || a[ni][nj] == '@' ) cnt++;
      }
      if( a[i][j] == '#' && (cnt == 2 || cnt == 3) ) b[i][j] = '#';
      else if( a[i][j] == '.' && cnt == 3 ) b[i][j] = '#';
      else if( a[i][j] == '@' ) b[i][j] = '@';
      else b[i][j] = '.';
    }
  }
  return b;
}

void view(const Area &a){
  cout << "view" << endl;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cout << a[i][j];
    }
    cout << endl;
  }
}

int solve(Area a){
  if( check(a) ) return 0;
  queue<state> q;
  q.push( (state){a,0} );
  while( !q.empty() ){
    state p = q.front(); q.pop();
    int x,y;
    get(p.a,x,y);
    for(int i=0;i<8;i++){
      int ny = y + dy[i], nx = x + dx[i];
      if( !outc( ny,nx ) ) continue;
      if( p.a[ny][nx] == '.' ){
	p.a[ny][nx] = '@';
	p.a[y][x] = '.';
	Area b = next(p.a);
	if( check(b) ) return p.c + 1;
	if( s.count(b) == 0 ){
	  q.push( (state){b,p.c+1} );
	  s.insert(b);
	}
	p.a[y][x] = '@';
	p.a[ny][nx] = '.';
      }
    }
  }
  return -1;
}

int main(){
  while( cin >> N && N ){
    s.clear();
   A.resize(N);
    for(int i=0;i<N;i++){
      A[i].resize(N);
      for(int j=0;j<N;j++){
	cin >> A[i][j]; 
      }
    }
    cout <<  solve(A) << endl;
  }
}

Measured memory_bytes: 5692
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    alls = int(input())
    allm, s = divmod(alls, 60)
    h, m = divmod(allm, 60)
    print("{}:{}:{}".format(h, m, s))

main()



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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans = min(a,b) + min(c,d);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

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

}

int main() {
	ll a, b;

	cin >> a >> b;
 	cout << a * b / gcd(a,b) << endl;

	return 0;
}

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

int main() {
    int n;
    cin >> n;
    set<string> st;
    rep(i,n) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 19116
N,M=map(int,input().split())
A=[]
for i in range(N):
 A.append(input())
B=[]
for i in range(M):
 B.append(input())
t = 0
t = 0
for i in range(N-M+1):
	for j in range(N-M+1):
		t = 0
		for k in range(M):
			if t:
				break
			for l in range(M):
				if A[i+k][j+l] != B[k][l]:
					t = 1
					break
		else:
			if A[i+k][j+l] == B[k][l]:
				print("Yes")
				exit()
print("No")

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

int N, Q;
vector<int> edges[200000];
int64_t num[200000];

void dfs(int i, int p) {
  for (int j : edges[i])
    if (j != p) {
      num[j] += num[i];
      dfs(j, i);
    }
}

int main() {
  cin >> N >> Q;
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    edges[a - 1].push_back(b - 1);
    edges[b - 1].push_back(a - 1);
  }
  for (int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    num[p - 1] += x;
  }
  dfs(0, -1);
  for (int i = 0; i < N; i++) {
    if (i) cout << " ";
    cout << num[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 28556
#include<iostream>
#include<string>
using namespace std;
int n;string S,T;
int solve(string T){
	for(int i=0;i<T.size();i++){
		for(int j=1;j<T.size();j++){
			string U="";int c=i;
			while(c<T.size()){
				U+=T[c];c+=j;
				if(U==S)return 1;
			}
			if(U==S)return 1;
		}
	}
	return 0;
}
int main(){
	cin>>n>>S;int cnt=0;
	for(int i=0;i<n;i++){
		cin>>T;cnt+=solve(T);
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3196
# coding: utf-8
import sys


def main(argv=sys.argv):
  a = input()
  b = input()
  select = ['1', '2', '3']
  
  select.remove(a)
  select.remove(b)
  
  print(''.join(select))

  return 0


if __name__ == '__main__':
  sys.exit(main())

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using plglg = pair<ll, ll>;
using tlglglg = tuple<ll, ll, ll>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    string s; cin >> s;
    if (s[s.length()-1] == 's') {
        s += "es";
    } else {
        s += "s";
    }

    print(s);

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3652
using System;
using System.Linq;
using System.Collections.Generic;
    
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        int a = N % 10;
        if(a==3){
            Console.WriteLine("bon");
        }else if(a==0 || a==1 || a==6 || a==8){
            Console.WriteLine("pon");
        }else{
            Console.WriteLine("hon");
        }
    }
}

Measured memory_bytes: 27328
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    int A,B,C;
    cin >> A >> B >> C;
    vector<int>v(n);
    for(auto& e : v) cin >> e;
    sort(all(v));
    int ans = INF;
    do{
        for(int l = 3; l <= v.size();l++){
            int a = 0, b = 0, c = 0;
            int ac = 0, bc = 0, cc = 0;
            for(int i = 0; i < l - 2; i++){
                a +=  v[i];
                ac += (i?10:0);
                b = bc = 0;
                for(int j = i + 1; j < l - 1; j++){
                    b += v[j];
                    bc = (j-i-1)*10;
                    c = cc = 0;
                    for(int k = j + 1; k < l; k++){
                        c += v[k];
                        cc = (k - j - 1)*10 ;
                    }
                    cmin(ans, abs(A-a) + ac + abs(B-b) + bc + abs(C-c) + cc);
                }
            }
        }
    }while(next_permutation(all(v)));
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep1(i,b) for(ll i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define vi vector<ll>
#define all(v) v.begin(), v.end()

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

	ll a = 0, b = 0, x = 0, y = 0;
	cin >> a >> b;
	if(a > b)
	{	
		x = a;	
		y = b;
	}
	else
	{
		x = b;
		y = a;
	}
	ll ans = 0;
	ll mid = (abs(x - y) / 2);
	if(y + mid == abs(x - mid))
		cout << y + mid;
	else
		cout << "IMPOSSIBLE" << endl;	
	#ifdef LOCAL_DEFINE
		cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	#endif
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt();
		if(A >= 13)System.out.println(B);
		else if (A <= 5)System.out.println(0);
		else System.out.println(B/2);
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
#define inf 0x7fffffff
/*-------------,-----------------------------------------------*/
char c[maxn];
int u[maxn];
int main(){
	scanf("%s",c+1);
	int l=strlen(c+1);
	int sum=0;
	FOR(i,1,l){
		u[c[i]]=true;
		sum++;
	}
	if(sum<26){
		printf("%s",c+1);
		FOR(i,'a','z')
			if(!u[i]){
				printf("%c",(char)i);
				break;
			}
	}
	 else {
	 	FORD(i,l,1){
	 		u[c[i]]=0;
	 		FOR(j,c[i]+1,'z')
	 			if(!u[j]){
	 				FOR(k,1,i-1)printf("%c",c[k]);
	 				printf("%c",(char)j);
	 				return 0;
	 			}
	 	}
	 	out(-1);
	 }	
}

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

using namespace std;
using ll = long long;
using ld = long double;

ll a, b, v, w, t;

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

  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  bool ok;
  cin >> a >> v >> b >> w >> t;
  if(a < b) {
    ll x = a + t * v;
    ll y = b + t * w;
    ok = (x >= y);
  } else if(a > b) {
    ll x = a - t * v;
    ll y = b - t * w;
    ok = (x <= y);
  }
  cout << (ok ? "YES" : "NO");
  cout << '\n';

  return 0;
}


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

int main(){
    int N;
    cin >> N; 
    int s[N];
    int mins=1000;
    bool all=true;
    rep(i,N) cin >> s[i];
    int sum10=0, sumel=0;
    for(int i=0; i<N; i++){
        if(s[i]%10==0){
            sum10 += s[i];
        }else{
            all=false;
            sumel += s[i];
            if(s[i]<mins){
                mins=s[i];
            }
        }
    }
    if(all){
        cout << "0" <<endl;
    }else{
        if(sumel%10==0){
            cout << sumel + sum10 - mins << endl;
        }else{
            cout << sumel + sum10 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
N,A,B,C=map(int,input().split())
mod=10**9+7

#factorial,facotiralの逆数を事前計算.
#N=10**5あたりまで有効

FACT=[1,1]
FACT_INV=[1,1]
for i in range(2,2*10**5+1):
    FACT.append(FACT[-1]*i%mod)
    FACT_INV.append(FACT_INV[-1]*pow(i,mod-2,mod)%mod)
    
def Combi(N,K):
    return FACT[N]*FACT_INV[N-K]*FACT_INV[K]%mod


#Aが勝つ場合

ANS=0
SUM=A+B

for i in range(N):
    ANS=(ANS+(pow(A,N,mod)*pow(pow(SUM,mod-2,mod),N,mod)*Combi(N-1+i,i)*pow(B,i,mod)*pow(pow(SUM,mod-2,mod),i,mod))*(N+i))%mod

#Bが勝つ場合

for i in range(N):
    ANS=(ANS+(pow(B,N,mod)*pow(pow(SUM,mod-2,mod),N,mod)*Combi(N-1+i,i)*pow(A,i,mod)*pow(pow(SUM,mod-2,mod),i,mod))*(N+i))%mod

print(ANS*100*pow(100-C,mod-2,mod)%mod)

Measured memory_bytes: 68720
#include <bits/stdc++.h>
#define fup(i,a,b) for(int i=a;i<=b;++i)
#define fdw(i,a,b) for(int i=a;i>=b;--i)
#define sync ios::sync_with_stdio(false);cin.tie(0)
#define cl(a) memset(a,0,sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll ksm(ll a,ll b,ll mod){ll ans=1;a%=mod;for(;b;b>>=1){if(b&1) ans=ans*a%mod;a=a*a%mod;}return ans;}
//ll oula(ll n){ ll res=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1) res=res-res/n;return res;}
//bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;}
//void shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
const int N=3e5+10;
int main()
{
//    freopen("D:\\untitled3\\in","r",stdin);
    sync;
    int n,r;
    cin>>n>>r;
    if(n>=10)
    {
        cout<<r<<endl;
    }else cout<<r+100*(10-n)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");

		int n = Integer.parseInt(tmpArray[0]);
		int m = Integer.parseInt(tmpArray[1]);

		Job jobs[] = new Job[n];

		for(int i = 0; i < n; i++){
			tmpArray = br.readLine().split(" ");
			int a = Integer.parseInt(tmpArray[0]);
			int b = Integer.parseInt(tmpArray[1]);
			jobs[i] = new Job(a, b);
		}

		Arrays.sort(jobs);
		//debug
//		for(int i = 0; i < n; i++){
//			System.out.println(jobs[i].date + " "+ jobs[i].salary);
//		}

		int currentIndex = 0;
		long result = 0;
		PriorityQueue<Job> pq = new PriorityQueue<Job>(new Comparator<Job>() {

			@Override
			public int compare(Job o1, Job o2) {
				// TODO 自動生成されたメソッド・スタブ
				return o2.salary - o1.salary;
			}
		});
		for(int i = 1; i <= m; i++){
//			System.out.println("i =  "+i);

			for(; currentIndex < n; currentIndex++){
				if(jobs[currentIndex].date > i){
					break;
				}
				else {
					pq.add(jobs[currentIndex]);
//					System.out.println("add jobs["+currentIndex+"]");
				}
			}

			Job top = pq.poll();
			if(top != null){
				result += top.salary;
			}
		}

		System.out.println(result);
	}

}

class Job implements Comparable<Job>{
	int date;
	int salary;

	Job (int date, int salary){
		this.date = date;
		this.salary = salary;
	}

	@Override
	public int compareTo(Job j) {
		return  this.date == j.date ? (j.salary - this.salary) : this.date - j.date;
	}


}

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

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int[] a = new int[N];
    for (int i = 0; i < N; i++) {
      a[i] = scanner.nextInt();
    }
    int[] sorted = Arrays.copyOf(a, a.length);
    Arrays.sort(sorted);

    long target = N;
    target = (target * (N + 1) / 2 + 1) / 2;
    int left = -1, right = N;
    while (right - left > 1) {
      int mid = (left + right) / 2;
      long count = numSubarraysWhooseMedianBiggerThan(a, sorted[mid]);
      if (target <= count) {
        left = mid;
      } else {
        right = mid;
      }
    }
    System.out.println(sorted[left]);
  }

  private static long numSubarraysWhooseMedianBiggerThan(int[] a, int t) {
    int[] b = new int[a.length + 1];
    b[0] = 0;
    int sum = 0;
    for (int i = 0; i < a.length; i++) {
      sum += a[i] >= t ? 1 : -1;
      b[i + 1] = sum;
    }
    long n = a.length;
    return n * (n + 1) / 2 - countInversion(b, 0, b.length);
  }

  private static long countInversion(int[] a, int left, int right) {
    if (left + 1 >= right) return 0;
    int mid = (left + right) / 2;
    long count = countInversion(a, left, mid) + countInversion(a, mid, right);
    int[] b = new int[right - left];
    int i = 0;
    int li = left;
    int ri = mid;
    while (li < mid && ri < right) {
      if (a[li] <= a[ri]) {
        b[i++] = a[li++];
      } else {
        b[i++] = a[ri++];
        count += mid - li;
      }
    }
    while (li < mid) b[i++] = a[li++];
    while (ri < right) b[i++] = a[ri++];
    System.arraycopy(b, 0, a, left, b.length);
    return count;
  }
}


Measured memory_bytes: 92164
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <cctype>
#include <cstdio>
#include <cstdlib>


int main(){

    std::string str;
    while(getline(std::cin, str)){
        std::stack<double> st;
        std::stringstream ss(str);

        while(ss >> str){
            if(str.size() > 1 || isdigit(str[0])){
                st.push(atof(str.c_str()));
                continue;
            }

            double a = st.top(); st.pop();
            double b = st.top(); st.pop();
            switch(str[0]){
            case '+' : st.push(b + a); break;
            case '-' : st.push(b - a); break;
            case '*' : st.push(b * a); break;
            case '/' : st.push(b / a);
            }
        }

        printf("%lf\n", st.top());

    }

    return 0;
}

Measured memory_bytes: 3248
n=gets.to_i
a=gets.split.map(&:to_i)
if a.select{|i|i<0}.size.even?
  puts a.map{|i|i>0?i:-i}.inject(:+)
else
  b=a.map{|i|i>0?i:-i}.sort
  b[0]=-b[0]
  puts puts b.inject(:+)
end

Measured memory_bytes: 11760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int maxn=2e5;
ll p[maxn+10];
ll inv[maxn+10];
int H,W,A,B;
ll mul(ll a,ll b)
{
    ll ret=1;
    while(b)
    {
        if(b&1)
            ret=ret*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return ret;
}
void init()
{
    p[0]=1;
    for(int i=1;i<=maxn;i++)
        p[i]=p[i-1]*i%mod;
    inv[maxn]=mul(p[maxn],mod-2);
    for(int i=maxn-1;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;

}
ll C(ll n,ll m)
{
    if(n==m)
        return 1;
    if(n<m)
        return 0;
    return p[n]*inv[m]%mod*inv[n-m]%mod;
}
ll sovle()
{
    ll ret=0;
    for(int i=1;i<=(H-A);i++)
    {
        ret=(ret+C(i+B-2,i-1)*C((H-i+1)+W-B-2,H-i)%mod)%mod;
    }

    return ret;
}
int main()
{
    init();
    while(cin>>H>>W>>A>>B)
    {
        printf("%lld\n",sovle());
    }
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;



int main() {
ll N, W, H;cin >> W >> H >> N;
ll left = 0, right = W, ceil = H, floor = 0;

rep(i, 0, N){

  ll a, b, c;cin >> a >> b >> c;

  if(c == 1)left = max(left, a);

  if(c == 2)right = min(right, a);

  if(c == 3)floor = max(floor, b);

  if(c == 4)ceil = min(ceil, b);

}
  
  //cout << left << " " << right << " " << ceil << " " << floor << endl;

if(right - left < 0 || ceil - floor < 0)cout << 0;

else cout << (right - left)*(ceil - floor);

}

Measured memory_bytes: 3568
n=int(input())
a=list(map(int,input().split()))
a2=sorted(set(a))
L=len(a2)
if n==1:print(a[0]);exit()
elif n==2:print(a[1]);exit()
ng=L
ok=0
while ng-ok>1:
    check=a2[(ok+ng)//2]
    cnt=0 #check以上の要素の数
    idx=n
    cl=[0]*(2*n+1)
    cl[n]=1
    Ru=0
    for i in range(n):
        if a[i]<check:
            Ru-=cl[idx]-1
            idx-=1
        else:
            idx+=1
            Ru+=cl[idx]+1
        cnt += Ru
        cl[idx]+=1
    if cnt >= ((n+1)*n//2)//2:
        ok = (ok+ng)//2
    else:
        ng = (ok+ng)//2

print(a2[ok])

Measured memory_bytes: 20652
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline void chmin(T &a, T b){if(a>=b)a=b;}
template<class T> inline void chmax(T &a, T b){if(a<=b)a=b;}
typedef long long ll;
const int INF = 1e9;

int N,K;
int h[110000];

int main(){
    cin >> N >> K;
    REP(i,N) cin >> h[i];
    sort(h,h+N);
    int ans = INF;
    for(int i=0;K + i - 1 < N;++i){
        chmin(ans,h[K+i-1] - h[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] a = new int[100005];
		for(int i = 0; i < n; i++){
		    int k = sc.nextInt();
		    a[k]++;
		}
		
		// 計算
		int result = 0;
		for(int i = 0; i < 100001; i++){
		    int sum = a[i] + a[i+1] + a[i+2];
		    result = max(result, sum);
		}
		
		// 出力
		System.out.println(result);
	}
}




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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 5e5 + 10;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1e9+7;



int main()
{
	int x;
	cin>>x;
	int ans = 0;
	if(x%1000 != 0)
	{
		ans = 1000 - x%1000;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <cmath>
#include <set>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <cstring>

using namespace std;

constexpr long long mod = 1000000007;
constexpr double eps = 0.0000000001;

typedef long long ll;
typedef long long unsigned ull;

pair<ll, ll> extgcd(ll a, ll b) {
    if (b == 0) return make_pair(a, 0);
    else {
        auto t = extgcd(b, a % b);
        return make_pair(t.second, t.first - t.second * (a / b));
    }
}

ll inv_fac_m[200010];
ll fac_m[200010];

ll inv_fac(ll n) {
    if (n == 0) return 1;
    if (!inv_fac_m[n]) inv_fac_m[n] = (inv_fac(n - 1) * (extgcd(n, -mod).first + mod)) % mod;
    return inv_fac_m[n];
}

ll fac(ll n) {
    if (n == 0) return 1;
    if (!fac_m[n]) fac_m[n] = (fac(n - 1) * n) % mod;
    return fac_m[n];
}

ll cmb(ll n, ll k) {
    return (((fac(n) * inv_fac(k)) % mod) * inv_fac(n - k)) % mod;
}

int main() {
    ll h, w, a, b;
    cin >> h >> w >> a >> b;
    ll r = 0;
    for (ll x = b + 1; x <= w; x++) {
        r = (r + (cmb(h - a - 1 + x - 1, x - 1) * cmb(a - 1 + w - x, a - 1))) % mod;
    }
    cout << r << endl;
}

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

int main()
{
    std::string s;
    int n;
    std::cin >> s;
    n = s.size();
    std::pair<int,int> nums = {0,0}; //first : S / second : T

    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'S')nums.first++;
        if(s[i] == 'T' && nums.first != 0){
            cnt+=2;
            nums.first--;
        }
    }
    std::cout << n - cnt << std::endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        int c = a*b;
        int d = 2*(a+b);
        System.out.println( c + " " + d );
    }
}

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

struct UnionFind {
    vector<int> par;
    map<int,int> num; 
    UnionFind(int N) : par(N) { 
        for(int i = 0; i < N; i++) par[i] = i;
    }
    int root(int x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) { 
        int rx = root(x); 
        int ry = root(y); 
        if (rx == ry) return; 
        par[rx] = ry; 
    }
    void reset(int n){ 
        for(int i=0;i<n;i++)par[i] = root(par[i]);
    }
    bool con(int x,int y){
        return par[x]==par[y];
    }
    void solve(int n){
        for(int j=0;j<n;j++)num[par[j]]++;
    }
    int ans(int i){
        return (num[par[i]]-1);
    }
};
int main(){
    int n,m,k;
    cin >> n >> m >> k;
    UnionFind tree(n);
    int a,b;
    vector<int> v[n];
    for(int i=0;i<m;i++){
        cin >> a >> b;
        a--; b--;
        tree.unite(a,b);
        v[a].push_back(b);
        v[b].push_back(a);
    }
    tree.reset(n);
    tree.solve(n);
    for(int i=0;i<k;i++){
        int c,d;
        cin >> c >> d;
        c--; d--;
        if(tree.con(c,d)){
            v[c].push_back(d);
            v[d].push_back(c);
        }
    }
    for(int i=0;i<n;i++)cout << tree.ans(i)-(int)v[i].size() << " ";
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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 ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  string s; cin>>s;
  ll n=s.size();
  ll ans=0;
  for(ll bit=0; bit<(1<<(n-1)); bit++){
    ll tmp=0;
    ll pos=0;
    rep(i,n){
      if(bit&(1<<i) || i==n-1){
        tmp+=stol(s.substr(pos,i+1-pos));
        pos=i+1;
      }
    }
    ans+=tmp;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}
ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;}

int N,A,x;
ll dp[51][2510];

ll comb(int n,int r)
{
  if(n<r) return 0;
  if(n==r||r==0) return 1;
  else
  {
    r=min(r,n-r);
    return comb(n,r-1)*(n-r+1)/r;
  }
}


int main()
{
  cin >> N >> A;
  vector<int> x(N,0);
  REP(i,N) cin>>x[i];
  dp[0][0]=1;
  REP(i,N)
  {
    for(int j=i+1;j>0;j--) for(int k=0;k<=2500;k++)
    dp[j][k+x[i]]+=dp[j-1][k];
  }
  ll ans=0;
  FOR(i,1,50) ans+=dp[i][i*A];
  cout << ans << endl;
  return 0;
}


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

int main(){
  int i, N;
  bool flag = false;
  cin >> N;
  string s[N];
  for(i = 0; i < N; i++){
    cin >> s[i];
    if(s[i] == "Y"){
      flag = true;
      continue;
    }
  }
  if(flag){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }

  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int cnt = 0;
  for(int i = 1;i<10;i++){
    if((N%i)==0){
        if(double(N/i)<=9){
          cnt = 1;
        }
  }
       }
       if(cnt == 0){
         cout << "No" << endl;
       }else{
	cout << "Yes" << endl;
       }
}


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

typedef long long ll;
const int N = 5054;

int n, L, R;
int p[N];
ll f[N][N];

inline void down(ll &x, const ll y) {x > y ? x = y : 0;}

int main() {
	int i, j;
	scanf("%d%d%d", &n, &R, &L);
	for (i = 1; i <= n; ++i) scanf("%d", p + i);
	for (i = 1; i <= n + 1; ++i) {
		for (j = 0; j < i; ++j) f[i][j] = f[i - 1][j] + (p[i] < p[j] ? L : R);
		f[i][i] = LLONG_MAX;
		for (j = 0; j < i; ++j) if (p[i] > p[j]) down(f[i][i], f[i - 1][j]);
	}
	printf("%lld\n", *std::min_element(f[n], f[n] + (n + 1)));;
	return 0;
}

Measured memory_bytes: 197120
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int a, b, c; cin >> a >> b >> c;
    if (b-a == c-b) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>

using namespace std;

int me[20][10];

void fu(int dp, int di, int k){
	cout<<di;
	if(dp==1)return;
	for(int l = di-1;l<=di+1;l++)if(l>=0&&l<10){
		if(me[dp-1][l]<k)k-=me[dp-1][l];
		else{
			fu(dp-1,l,k);
			return;
		}
	}
}
int main(){
	
	cin.tie(0); ios_base::sync_with_stdio(0);
	int k;
	cin>>k;
	if(k<10){
		cout<<k<<endl;
		return 0;
	}
	k-=9;
	for(int i=0;i<10;i++)me[1][i] = 1;
	for(int i=2;i<20;i++){
		me[i][0] = me[i-1][0]+me[i-1][1];
		for(int j=1;j<=9;j++){
			me[i][j]  =0;
			for(int l = j-1;l<=j+1;l++){
				if(l<10){
					me[i][j]+=me[i-1][l];
					if(me[i-1][l]<k)k-=me[i-1][l];
					else{
						cout<<j;
						fu(i-1,l,k);
						return 0;
					}
				}
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

using namespace std;

void otsuri(int seikyu, int *ten, int *fif, int *hund, int *f_hund);

int main(void)
{
	int seikyu;
	int sum;
	int ten;
	int fif;
	int hund;
	int f_hund;

	int t;
	int f;
	int h;
	int fh;

	int check;

	check = -1;	
    while(1){

    	
		
		cin >> seikyu;
		if(seikyu==0) break;

		if(check!=-1) cout << endl;
		check = 1;

		cin >> ten >> fif >> hund >> f_hund;


		sum = ten*10 + fif*50 + hund*100 + f_hund*500;
		otsuri(sum-seikyu,&t,&f,&h,&fh);

		ten -= t;
		fif -= f;
		hund -= h;
		f_hund -= fh;
		


		if (ten >0) cout << "10" << " " << ten << endl;
		if (fif>0) cout << "50" << " " << fif << endl;
		if (hund>0) cout << "100" << " " << hund << endl;
		if (f_hund>0) cout << "500" << " " << f_hund << endl;

		//if(cin.peek()!=0) cout << endl; 


	}
	return 0;
}



void otsuri(int seikyu,int *ten, int *fif, int *hund, int *f_hund)
{

	seikyu = abs(seikyu);
	

	*f_hund = seikyu/500;
	seikyu -= (*f_hund)*500;
	*hund = seikyu/100;
	seikyu -= (*hund)*100;
	*fif = seikyu/50;
	seikyu -= (*fif)*50;
	*ten = seikyu/10;
	seikyu -= (*ten)*10;
	
}

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

int main() {
  char A;
  cin >> A;
  if (A == 'a')  {
    cout << "vowel" << endl;
  }
  else if (A == 'e')  {
    cout << "vowel" << endl;
  }
  else if (A == 'i')  {
    cout << "vowel" << endl;
  }
  else if (A == 'o')  {
    cout << "vowel" << endl;
  }
  else if (A == 'u')  {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
  
  
}

Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
res = 0

for i in range(n):
    a = list(map(int,input().split()))
    tmp = c
    for i,j in zip(a,b):
        tmp += i * j
    if tmp > 0:
        res += 1

print(res)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
          
#define pb push_back
#define ll long long
#define F first
#define S second
#define ld long double
#define fa fflush(stdout); 
#define mp make_pair
using namespace std;
void data() {
    #ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);;                                                      
} 
int dx[5] = {-1, 0, 0, 1};
int dy[5] = {0, -1, 1, 0};
  
const int N = 5e3 + 100;
const ll mod = 1e9 + 7; //998244353;
const ll big = 1e9;
 
int main() 
{
	data();
	//freopen("mountains.in", "r", stdin);
   	//freopen("mountains.out", "w", stdout);
	int x;
	cin >> x;
	if (x == 1)
	{
		cout << 0;
	}	  	
	else {
		cout << 1;
	}
}                    

Measured memory_bytes: 3684
var
	N,i,j,ans:int64;
begin
	read(N);
	i:=1;
	while i<=N do begin
		j:=N div(N div i)+1;
		inc(ans,(j-i)*(i+j-1)*(N div i)*(N div i+1)div 4);
		i:=j;
	end;
	writeln(ans);
end.

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

public class Main {
  private static int solve(int n, int m) {
    return (1900 * m + 100 * (n - m)) << m;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    int m = reader.nextInt();
    out.println(solve(n, m));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 23252
import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int x,y;
        while(true){
            x = sc.nextInt();
            y = sc.nextInt();
            if(x == 0 && y == 0) break;
            System.out.printf("%d %d\n", Math.min(x, y), Math.max(x, y));
        }
    }
}


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

int main()
{
    double A,B,H,M,Wh,Ws,W,ans,PI=3.14159265358979323846;
    cin>>A>>B>>H>>M;
    Wh=(PI/360)*(H*60+M);
    Ws=(PI/30)*M;
    W=abs(Wh-Ws);
    if(W>PI){
        W=2*PI-W;
    }
    
    ans=sqrt(pow(A,2)+pow(B,2)-2*A*B*cos(W));
    cout<<setprecision(18)<<ans<<endl;
}

Measured memory_bytes: 4216
import Data.Set

canGoBackHome :: String -> String
canGoBackHome s
  | (fromList s) == (fromList "NS") = "Yes"
  | (fromList s) == fromList "EW" = "Yes"
  | (fromList s) == fromList "NEWS" = "Yes"
  | otherwise = "No"

main = do
  s <- getLine
  putStrLn $ canGoBackHome s


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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        double d = 0;
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            d += 1d / a;
        }
        System.out.println(1 / d);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21204