akhauriyash/Code-Regression huggingface dataset:
using System.Linq;
using System;

public class Team
{
    public int tid { get; set; }
    public int ac { get; set; }
    public int[] wa { get; set; }
    public int score { get; set; }
}

public class Hello
{
    public const int INF = 999999999;
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var M = int.Parse(line[0]);
            var T = int.Parse(line[1]);
            var P = int.Parse(line[2]);
            var R = int.Parse(line[3]);
            if (M == 0 && T == 0 && P == 0 && R == 0) break;
            var teams = new Team[T];
            for (int i = 0; i < T; i++)
                teams[i] = new Team { tid = i + 1, ac = 0, wa = new int[10], score = INF };
            for (int i = 0; i < R; i++)
            {
                line = Console.ReadLine().Trim().Split(' ');
                var m = int.Parse(line[0]);
                var t = int.Parse(line[1]) - 1;
                var p = int.Parse(line[2]) - 1;
                var j = int.Parse(line[3]);
                if (j == 0)
                {
                    teams[t].ac++;
                    teams[t].score += m + teams[t].wa[p] * 20;
                }
                else teams[t].wa[p]++;
            }
            print(teams);
        }
    }
    public static void print(Team[] t)
    {
        var a = t.OrderByDescending(x => x.ac).ThenBy(x => x.score).ThenByDescending(x => x.tid).ToArray();
        var pre1 = a[0].ac;
        var pre2 = a[0].score;
        Console.Write(a[0].tid);
        for (int i = 1; i < t.Length; i++)
        {
            Console.Write(a[i].ac == pre1 && a[i].score == pre2 ? '=' : ',');
            Console.Write(a[i].tid);
            pre1 = a[i].ac; pre2 = a[i].score;
        }
        Console.WriteLine();
    }
}


Measured memory_bytes: 10272
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll N;
    cin >> N;
    ll d = (N / 11);
    ll r = N % 11;

    cout << d * 2 + (r > 0) + (r > 6) << '\n';

}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
    int n, c[222222],a, i, max = 0, ans;
    scanf("%d", &n);
    for (i = 0; i <= n; i++)
        c[i] = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &a);
        c[a] = c[a - 1] + 1;
    }
    for (i = 1; i <= n; i++) {
        if (c[i] > max)
            max = c[i];
    }
    ans = n - max;
    printf("%d\n", ans);
    return 0;
}

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

ans = 0
cnt = 0
for i in range(1, N):
  if H[i] <= H[i - 1]:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 15020
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes";
            return 0;
        }
        a -= d;
        if (a <= 0) {
            cout << "No";
            return 0;
        }
    }
    return 0;
}

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

int main(void){
    // Your code here!
   int D,G;
   bool p = 0;
   cin >> D >> G;
   vector<pair<int, ll>> pc(D);
   for(int i = 0; i < D; i++){
       cin >> pc.at(i).first >> pc.at(i).second; 
   }
   
   vector<pair<int, ll>> total(D);
   for(int i = 0; i < D; i++){
       total.at(i).first = pc.at(i).first;
       total.at(i).second = pc.at(i).first * (i+1) * 100 + pc.at(i).second;
       //cout << total.at(i).second << endl;
   }
   int ans = 100000;
   if(0){
       //cout //全部必須
   }
   else{
       for(int i = 0; i < pow(2, D); i++){
           p = 0;
           ll g = 0;
           int num = 0;
           vector<bool> A(D);
           int I = i;
           for(int j = 0; j < D; j++){
               A.at(j) = I % 2;
               I /= 2;
           }
           for(int k = 0; k < D; k++){
                if(A.at(k)){
                    g += total.at(k).second;
                    num += total.at(k).first;
               }
            }
            
            
            if(g >= G){
                ans = min(num, ans);
            }
            else{
                if(p) break;
                for(int j = D-1; j >= 0; j--){
                    if(p) break;
                    if(A.at(j) == 0){
                        if(p) break;
                        for(int k = 0; k < pc.at(j).first; k++){
                            if(p) break;
                            g += (j + 1) * 100;
                            num++;
                            if(g >= G){
                               ans = min(num, ans);
                               p = 1;
                            }
                        }
                    }
                }
            }
            
        }
    }   
   cout << ans << endl;
   
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

constexpr int64 P = 1000000007;

struct FiniteField {
 private:
  int64 x;
  static inline int64 Normalize(int64 x) {
    if (0 <= x && x < P) return x; x %= P; if (x < 0) x += P; return x;
  }
 public:
  FiniteField(int64 x) : x(Normalize(x)) {}
  FiniteField() : x(0) {}
  int64 Value() const { return x; }
  inline FiniteField operator+(FiniteField o) const {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) const {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) const {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) const {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

ostream& operator<<(ostream& s, const FiniteField& v) { s << v.Value(); return s; }

template<typename T>
vector<vector<T>> Make2DVector(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

tuple<vector<FiniteField>, vector<FiniteField>> MakeFactorialTables(int n) {
  vector<FiniteField> factorials(n + 1);
  vector<FiniteField> inverse_factorials(n + 1);
  factorials[0] = 1;
  for (int i = 1; i <= n; i++) {
    factorials[i] = factorials[i - 1] * i;
  }
  inverse_factorials[n] = FiniteField(1) / factorials[n];
  for (int i = n; i >= 1; i--) {
    inverse_factorials[i - 1] = inverse_factorials[i] * i;
  }
  return make_tuple(factorials, inverse_factorials);
}

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

  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;

  vector<FiniteField> fs, i_fs;
  tie(fs, i_fs) = MakeFactorialTables(n);
  auto c_fn = [&](int x, int y) -> FiniteField {
    if (x < y) return 0;
    return fs[x] * i_fs[y] * i_fs[x - y];
  };

  auto dp = Make2DVector(b + 1, n + 1, FiniteField(0));
  dp[a - 1][0] = 1;
  for (int i = a; i <= b; i++) {
    for (int j = 0; j <= n; j++) {
      if (dp[i - 1][j].Value() == 0) continue;

      dp[i][j] += dp[i - 1][j];

      FiniteField x = 1;
      for (int k = 1; k <= d; k++) {
        if (j + i * k > n) break;
        x *= c_fn(k * i - 1, i - 1);
        // cout << "k: " << k << " x: " << x << endl;
        if (c <= k) {
          dp[i][j + i * k] += dp[i - 1][j] * c_fn(n - j, i * k) * x;
        }
      }
    }
  }
  // cout << dp[2][6] << endl;

  cout << dp[b][n] << endl;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(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) long long(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>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

// 転倒数: https://scrapbox.io/pocala-kyopro/%E8%BB%A2%E5%80%92%E6%95%B0
// バブルソートの交換回数は、狭義単調減少の転倒数と一致する

template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  vll s(n+1);
  rep(i,n){
    ll a; cin>>a;
    a-=k;
    s[i+1]=s[i]+a;
  }
  
  auto ss=s;
  vsort(ss);
  // uniqueはユニークな要素を配列の先頭に集める関数(重複要素を実際に削除することはしない)
  // 戻り値としてユニークな要素の末尾のindexが返されるので、これと配列のendまでの要素を指定してeraseすることで重複を除いた配列が得られる
  // 対象の配列は事前にソートしておく必要あり
  ss.erase(unique(all(ss)),ss.end());
  
  BIT<ll> bit(n+10);
  ll ans=0;
  rep(i,n+1){
    ll id=lower_bound(all(ss),s[i])-ss.begin();
    ans+=bit.sum(id+1);
    bit.add(id+1,1);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;

int main()
{
	int N,K;cin >> N >>K;
    vector<bool> child(N,false);
    int d,a;
    for (int i=0;i<K;i++)
    {
        cin >>d;
        for (int j=0;j<d;j++)
        {
            cin >>a;
            child[a-1]=true;
        }
    }
    int ans=0;
    for (int i=0;i<N;i++)
    {
        if (!child[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,s[100000],po,ne,W,a,A=100000,B=100000;
vector<ll>v1,v2;
int main(void){
    cin>>n;
    if(n==2){
        cin>>A>>B;
        cout<<abs(A-B)<<endl;
        if(A>B)cout<<A<<" "<<B<<endl;
        else cout<<B<<" "<<A<<endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        cin>>a;
        if(a>=0){
            po+=a;
            if(A==100000)A=a;
            else v1.push_back(a);
        }
        else{
            ne-=a;
            if(B==100000)B=a;
            else v2.push_back(a);
        }
    }
    if(A!=100000&&B!=100000){
        cout<<po+ne<<endl;
    if(v1.size()==0){
        cout<<A<<" "<<B<<endl;
    }
    else cout<<B<<" "<<A<<endl;
    W=B-A;
    for(int i=0;i<v1.size();i++){
        if(i==v1.size()-1){cout<<v1[i]<<" "<<W<<endl;}
        else cout<<W<<" "<<v1[i]<<endl;
        W-=v1[i];
    }
    W*=-1;
    for(int i=0;i<v2.size();i++){
        cout<<W<<" "<<v2[i]<<endl;
        W-=v2[i];
    }
    }
    if(B==100000){
        v1.push_back(A);
        sort(v1.begin(),v1.end());
        cout<<po-v1[0]*2<<endl;
        cout<<v1[0]<<" "<<v1[1]<<endl;
        W=v1[0]-v1[1];
        for(int i=2;i<v1.size();i++){
            if(i==v1.size()-1){
                cout<<v1[i]<<" "<<W<<endl;
                return 0;
            }
            cout<<W<<" "<<v1[i]<<endl;
            W-=v1[i];
        }
    }
    
    if(A==100000){
        v2.push_back(B);
        sort(v2.begin(),v2.end());
        reverse(v2.begin(),v2.end());
        cout<<ne+v2[0]*2<<endl;
        cout<<v2[0]<<" "<<v2[1]<<endl;
        W=v2[0]-v2[1];
        for(int i=2;i<v2.size();i++){
            cout<<W<<" "<<v2[i]<<endl;
            W-=v2[i];
        }
    }
}


Measured memory_bytes: 2804
#include<bits/stdc++.h>
	using namespace std;
	#define int long long int
	#define pb push_back
	const int mod=1e9+7;
	#define all(x) x.begin(),x.end()
	#define endl '\n'
	#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
	
	int32_t main(){
		IOS;
		int n;
		cin>>n;
		vector<pair<int,int>>v;
		for(int i=0;i<n;i++){
			int a,b;
			cin>>a>>b;
			v.pb({a,b});
		}
		for(int i=0;i<n-2;i++){
			if(v[i].first==v[i].second and v[i+1].first==v[i+1].second and v[i+2].first==v[i+2].second){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		cout<<"No"<<endl;
		return 0;
	}


Measured memory_bytes: 3656
// g++ -std=gnu++14 -I ~/Documents/AtCoder -o test ~/Documents/AtCoder/test.cpp && ./test && rm test
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    (v).begin(), (v).end()
#define in        ([]{int n; cin>>n; return n;}())
using namespace std;
using lint = int64_t;


int main() { cin.tie(0); ios::sync_with_stdio(false);
    int N=in;
    vector<int> X(N), Y(N);
    rep( i, N ) { X[i]=in; Y[i]=in; }

    if( N==1 ) { cout << 1 << endl; return 0; }

    int max_value = INT_MIN;
    rep( i, N ) {
        rep( j, N ) {
            int p = X[i] - X[j];
            int q = Y[i] - Y[j];

            if( i==j ) { continue; }

            int count = 0;
            rep( k, N ) {
                rep( l, N ) {
                    if( k==l ) { continue; }
                    if( X[k] - p == X[l] && Y[k] - q == Y[l] ) {
                        count ++;
                    }
                }
            }
            max_value = max( max_value, count );
        }
    }

    cout << (N-max_value) << endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = 50;
    let k = read::<usize>();
    let base = k / n + n - 1;
    let mut ans = vec![base; n];
    let rest = k % n;
    for i in 0..rest {
        ans[i] += n;
        for j in 0..n {
            if i == j {
                continue;
            }
            ans[j] -= 1;
        }
    }
    println!("{}", n);
    for i in 0..n {
        if i != 0 {
            print!(" ");
        }
        print!("{}", ans[i]);
    }
    println!("");
}


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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int main(void){
    int n; cin >> n;
    vector<int> p(n);
    REP( i, n ) cin >> p[i];
    

    
    if( n == 1 ){
        cout << p[0] << endl;
        return 0;
    } 
    
    if( n == 2 ){
        cout << max( p[0], p[1] ) * 2 << endl;
        return 0;
    }
    
    int cnt[4] = {0};
    
//　単独３
    vector<int> tmp = p;
    cnt[0] += 3;
    FOR( i, 1, n - 1 ){
        while( tmp[i] > 0 ){
            tmp[i]--;
            tmp[i + 1]--;
            cnt[0] += 2;
        }
    }
    while( tmp[n - 1] > 0 ){
        tmp[n - 1]--;
        cnt[0]++;
    }

// 単独2   
    tmp = p;
    tmp[0] -= 2;
    cnt[1] += 2;
    REP( i, n - 1 ){
        while( tmp[i] > 0 ){
            tmp[i]--;
            tmp[i + 1]--;
            cnt[1] += 2;
        }
    }
    while( tmp[n - 1] > 0 ){
        tmp[n - 1]--;
        cnt[1]++;
    }
    
//  単独１
    tmp = p;
    tmp[0]--;
    cnt[2]++;
    REP( i, n - 1 ){
        while( tmp[i] > 0 ){
            tmp[i]--;
            tmp[i + 1]--;
            cnt[2] += 2;
        }
    }
    while( tmp[n - 1] > 0 ){
        tmp[n - 1]--;
        cnt[2]++;
    }

// 単独０
    tmp = p;
    REP( i, n - 1 ){
        while( tmp[i] > 0 ){
            tmp[i]--;
            tmp[i + 1]--;
            cnt[3] += 2;
        }
    }
    while( tmp[n - 1] > 0 ){
        tmp[n - 1]--;
        cnt[3]++;
    }
    
    cout << min( min( cnt[0], cnt[1] ), min( cnt[2], cnt[3] ) ) << endl;
    
}


Measured memory_bytes: 3200
from collections import Counter

n, k, q = map(int, input().split())
A = [int(input()) for _ in range(q)]
C = Counter(A)

ans = [k]*n
for i in range(n):
  ans[i] += C[i+1]
for a in ans:
  if a > q:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 19340
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}



int main()
{
	IOS;
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	cout<<a[k-1];
}



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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;
const double EPS=1e-12;

ll gcd(ll x,ll y){
  return y? gcd(y,x%y):x;
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll A,B,C,D;cin>>A>>B>>C>>D;A--;
  ll L=C*D/gcd(C,D);
  //debug(L);
  ll ans = (B-B/C-B/D+B/L)-(A-A/C-A/D+A/L);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
"use strict";

function solve(inputs) {
    let a = inputs.nextInt();
    let b = inputs.nextInt();

    let c = a * b;

    if ((c % 2) == 0) {
        console.log("Even");
    } else {
        console.log("Odd");
    }
}

function main(inputs) {
    let Input = class {
        constructor() {
            this.stdinputs = require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\s+/);
            this.stdinputIndex = 0;
        }

        next() {
            return this.stdinputs[this.stdinputIndex++];
        }

        nextInt() {
            return parseInt(this.next());
        }

        nextFloat() {
            return parseFloat(this.next());
        }
    }

    solve(new Input());
}

main();


Measured memory_bytes: 7372
import itertools
N, M ,Q = map(int, input().split())
l = []
for i in range(Q):
  a, b, c, d = map(int, input().split())
  l.append([a, b, c, d])
  
nums = list(itertools.combinations_with_replacement(range(1, M+1), N))
scores = []
for row in nums:
  score = 0
  i = 0
  while i < Q:
    if row[l[i][1]-1]-row[l[i][0]-1] == l[i][2]:
      score += l[i][3]
    i += 1
  scores.append(score)
  
print(max(scores))

Measured memory_bytes: 25156
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if(N==1){
            System.out.println(1);
            return;
        }
        long p1 = 2;
        long p2 = 1;
        for (int i = 1; i < N; i++) {
            long np = p1+p2;
            p1 = p2;
            p2 = np;
        }

        System.out.println(p2);
    }

    public static void main(String[] args) {
        new Main();
    }
}


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

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n,b;
    cin >> n;
    
    vector<ll> a(n);
    vector<ll> c(n);
    
    rep(i,n){
        cin >> a[i];
        c[i] = i - a[i];
    }
    
    sort(c.begin(), c.end());
    if(n % 2 == 0) b = (c[n/2-1] + c[n/2]) / 2;
    else b = c[n/2];
    
    ll ans = 0;
    for(ll i = 0 ; i < n ; i++){
        ans += abs(c[i]-b);
    }
    cout << ans << endl;
}


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

int main(){
    int64_t a,b,c,d;
    cin>>a>>b>>c>>d;
    int64_t x;
    x=a*c;
    int64_t y;
    y=a*d;
    int64_t z;
    z=b*c;
    int64_t v;
    v=b*d;
    vector<int64_t> w{x,y,z,v};
    sort(w.begin(), w.end());
    reverse(w.begin(), w.end());
    cout<<w.at(0)<<endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
vector<int> prime;

void make_prime(){
	for(int i(1);i<=N;++i){
		int cnt(0);
		for(int j(1);j<=i;++j){
			if(i%j==0) cnt++;
		}
		if(cnt==2) prime.push_back(i);
	}
}

vector<int> factoring(int n){
	vector<int> factors(prime.size());
	for(int i(0);i<prime.size();++i){
		while(n % prime[i] == 0){
			factors[i]++;
			n /= prime[i];
		}
	}
	return factors;
}

int counter(vector<int> factor, int num){
	int cnt(0);
	for(int i(0);i<factor.size();++i){
		if(factor[i]>=num-1) cnt++;
	}
	return cnt;
}

int main(){
	cin >> N;
	make_prime();
	vector<int> factors(prime.size());
	for(int i(1);i<=N;++i){
		vector<int> t = factoring(i);
		for(int j(0);j<prime.size();++j){
			factors[j] += t[j];
		}
	}
	int ans = counter(factors,75) + counter(factors,25) * (counter(factors,3) - 1)
	+ counter(factors,15) * (counter(factors,5) - 1) + counter(factors,5) * (counter(factors,5) - 1) * (counter(factors,3) - 2) /2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
X = list(map(int, input().split()))
X = sorted(X)


def main():
    if N > M:
        print(0)
        return

    #print(X)
    diff = [X[i+1] - X[i] for i in range(M-1)]
    #print(diff)
    diff = sorted(diff, reverse=True)
    #print(diff)

    print(sum(diff[N-1:]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 13968
a, b, k = map(int, input().split())

ans = set()
for i in range(a, min(b, a + k - 1) + 1):
    ans.add(i)
for i in range(max(a, b - k + 1), b + 1):
    ans.add(i)
ans = list(ans)
ans.sort()

for i in ans:
    print(i)


Measured memory_bytes: 3060
def A_Rotation(C1, C2):
    C = [C1, C2]
    C_rotate = [C2[::-1], C1[::-1]]
    if C == C_rotate:
        return 'YES'
    else:
        return 'NO'

C1 = input().strip()
C2 = input().strip()
print(A_Rotation(C1, C2))

Measured memory_bytes: 3060
from sys import stdin,setrecursionlimit

n,w = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

kijyun = li[0][0]

omosa = [[] for _ in range(4)]

for i in li:
    omosa[i[0]-kijyun].append(i[1])

for i in range(len(omosa)):
    omosa[i].sort(reverse = True)

ma = 0

for i in range(len(omosa[0])+1):
    for j in range(len(omosa[1])+1):
        for k in range(len(omosa[2])+1):
            for l in range(len(omosa[3])+1):
                to_ka = omosa[0][:i]+omosa[1][:j]+omosa[2][:k]+omosa[3][:l]
                if i*kijyun+j*(kijyun+1)+k*(kijyun+2)+l*(kijyun+3) > w:
                    continue
                ma = max(ma,sum(to_ka))

print(ma)

Measured memory_bytes: 3188
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
win=[]
lose=[]
if sum(a)<sum(b):
  print(-1)
else:
  for i in range(n):
    if a[i]<b[i]:
      lose.append(b[i]-a[i])
    else:
      win.append(a[i]-b[i])
  if len(lose)==0:
    print(0)
  else:
    win.sort()
    win.reverse()
    x=sum(lose)
    ct=0
    for j in range(len(win)):
      ct+=win[j]
      if ct>=x:
        break
    print(j+len(lose)+1)

Measured memory_bytes: 19188
import math


class Combination:
    def __init__(self, n_max, mod=998244353):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * \
                modinv[self.mod % i] % self.mod
        return modinv


def power_func(a, n, p=998244353):
    bi = str(format(n, "b"))
    res = 1
    for i in range(len(bi)):
        res = (res*res) % p
        if bi[i] == "1":
            res = (res*a) % p
    return res


n, m, k = map(int, input().split())
mod = 998244353
comb = Combination(n)

ans = 0
if n-1 == k:
    ans += m

for i in range(1, n):
    if n-i-1 <= k:
        ans += comb(n-1, i)*m*power_func(m-1, i)
        ans %= mod
print(ans % mod)


Measured memory_bytes: 32668
while(True):
    n,x=map(int,input().split())
    if n==x==0:
        exit()
    ans=0
    for i in range(1,n+1):
        for j in range(1, n+1):
            if i!=j and i!=x-i-j and j!=x-i-j and 0<x-i-j<=n:
                ans+=1
    print(ans//6)


Measured memory_bytes: 5596
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdio>
#include <list>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}

int main(){
    string s=stin();
    rep(i,5)cout<<s.at(i);
    cout<<" ";
    rep(i,7)cout<<s.at(i+6);
    cout<<" ";
    rep(i,5)cout<<s.at(i+14);
    cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_lim=(n); i<i##_lim; ++i)
#define FOR(i, a, b) for (int i=(a), i##_lim=(b); i<i##_lim; ++i)
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main()
{
    int R, D, X2000;
    cin >> R >> D >> X2000;

    ll ret = X2000;
    REP(i, 10)
    {
        ret = R*ret-D;
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int mod = 1e9 + 9;
const int MAXN = 100005;

int n;
lint a, b, c, d;

int main(){
	cin >> n >> a >> b >> c >> d;
	for(int i=0; i<n; i++){
		lint incr_min = c * i - d * (n - 1 - i);
		lint incr_max = d * i - c * (n - 1 - i);
		if(incr_min <= b - a && incr_max >= b - a){
			puts("YES");
			return 0;
		}
	}
	puts("NO");
}


Measured memory_bytes: 256
use std::cmp::min;
use std::collections::{BinaryHeap, HashSet};

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let k: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut heap = BinaryHeap::new();
    let mut set = HashSet::new();

    for i in 0..s.len() {
        for j in i + 1..min(s.len() + 1, i + k + 1) {
            let t = &s[i..j];
            if set.contains(t) {
                continue;
            }
            set.insert(t);
            heap.push(t);
            if heap.len() > k {
                if t >= heap.pop().unwrap() {
                    break;
                }
            }
        }
    }

    let ans = heap.iter().max().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 4352
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    s = S()
    t = "Sunny, Cloudy, Rainy".split(", ")
    for i in range(3):
        if s == t[i]:
            return t[(i+1)%3]

    return -1


print(main())





Measured memory_bytes: 6740
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する
int H, W;

bool choku_f(int h, int w) {
    if (h == 0) return true;
    return h != H - 1 && w % 2 == 0;
}

bool aoki_f(int h,int w){
    if(h == H - 1) return true;
    return h != 0 && w % 2 == 1;
}

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

    cin >> H >> W;
    vector<vector<char> > choku(H, vector<char>(W)), aoki(H, vector<char>(W));

    rep(i,0,H){
        rep(j,0,W){
            if(choku_f(i,j)){
                choku[i][j] = '#';
            }else{
                choku[i][j] = '.';
            }
            if(aoki_f(i,j)){
                aoki[i][j] = '#';
            }else{
                aoki[i][j] = '.';
            }
        }
    }
    rep(i,0,H){
        rep(j,0,W){
            char tmp;
            cin >> tmp;
            if(tmp == '#'){
                choku[i][j] = '#';
                aoki[i][j] = '#';
            }
        }
    }

    rep(i,0,H){
        rep(j,0,W){
            cout << choku[i][j];
        }
        cout << endl;
    }
    cout << endl;
    rep(i,0,H){
        rep(j,0,W){
            cout << aoki[i][j];
        }
        cout << endl;
    }
//    rep(i,0,H){
//        rep(j,0,W){
//            if(aoki[i][j] == '#' && choku[i][j] == '#') cout << '#';
//            else cout << '.';
//        }
//        cout << endl;
//    }
    return 0;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin>>n;
  int time=0;
  vector<int> t(n);
  rep(i,n){
    cin>>t.at(i);
    time+=t.at(i);
  }
  int m; cin>>m;
  vector<vector<int>> X(m,vector<int>(2)); 
  rep(i,m){
    cin>>X.at(i).at(0)>>X.at(i).at(1);
    cout<<time-t.at(X.at(i).at(0)-1)+X.at(i).at(1)<<endl;  
  }
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    s = s.substring(len-1,len);
    if(s.equals("2") ||s.equals("4") ||s.equals("5") ||s.equals("7") ||s.equals("9")){
      System.out.println("hon");
    }else if(s.equals("3")){
      System.out.println("bon");
    }else{
      System.out.println("pon");
    }
  }
}


Measured memory_bytes: 35824
#include <bits/stdc++.h>
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define sort(a) sort((a).begin(),(a).end())
#define rev(a) reverse((a).begin(),(a).end())
using db = double;
using namespace std;
typedef long long ll;



int main() {
  int n;
  cin >> n;
  vector<tuple<string, int, int>> a;
  for (int i = 1; i <= n; i++) {
    string s;
    int p;
    cin >> s >> p;
    p = -p;
    a.push_back(tie(s,p,i));
  }
  sort(a);
  rep(i,n) cout << get<2>(a[i]) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

string binary(long num) {
	long tmp = 0;
	for (int i = 0; 0 < num; i++) {
		tmp = tmp + (num % 2) * pow(10,i);
		num /= 2;
	}
	string ret = to_string(tmp);

	return to_string(tmp);
}

int main(int argc, char *argv[]) {
	
	int N,M,X; cin >> N >> M >> X;

	vector<int> cost(N,0);
	vector<vector<int>> A(N,vector<int>(M,0));
	vector<int> check(M,0);
	for (int i = 0; i < N; i++) {
		cin >> cost[i];
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
			check[j] += A[i][j];
		}
	}

	for (int i = 0; i < M; i++) {
		if (check[i] < X) {
			cout << -1 << endl;	
			return 0;
		}
	}

	int ans = INF;
	for (int i = 0; i < (1<<N); i++) {
		string bin = binary(i);
		while(bin.size() < N) {
			bin = '0' + bin;
		}
		vector<int> Asum(M,0);
		int mini = INF;
		int sum = 0;
		for (int j = 0; j < N; j++) {
			//cout << "j = " << j << endl;
			if (bin[j] == '1') {
				sum += cost[j];				
				for (int k = 0; k < M; k++) {
					Asum[k] += A[j][k];
				}
			}
		}
		for (int k = 0; k < M; k++) {
			if (Asum[k] < X) {
				sum = INF;
			}
		}
		ans = min(ans, sum);
	}
	cout << ans	<< endl;


	return 0;
}


Measured memory_bytes: 4180
#include<stdio.h>
#include<string.h>

int main()
{
    char st[6];

    scanf("%s", st);

    if(st[2] == st[3] && st[4] == st[5]){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }


    return 0;
}


Measured memory_bytes: 128
n=int(input())
a=input()
b=input()
m=10**9+7
if n==1:exit(print(3))
c=3*(2-(a[0]==b[0]))
for i in range(1,n):
 if a[i-1]==a[i]:continue
 if a[i-1]==b[i-1]:c*=2;c%=m
 elif a[i]!=b[i]:c*=3;c%=m
print(c)

Measured memory_bytes: 9124
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    int N, K;
    cin >> N >> K;
    vector<int> P(N);
    rep(i, N) { cin >> P[i]; }

    sort(all(P));
    ll sum = 0;
    rep(i, K) { sum += P[i]; }

    cout << sum << endl;
}

Measured memory_bytes: 3664
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>
#include<cmath>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	int n,m;
	cin >> n >> m;

	pair<int,int> first[51];
	pair<int,int> second[51];

	for(int i=0 ; i<n ; i++)
		cin >> first[i].first >> first[i].second;

	for(int j=0 ; j<m ; j++)
		cin >> second[j].first >> second[j].second;
	
	for(int i=0 ; i<n ; i++)
	{
		int minDis = INT_MAX;
		int minIndex = -1;
		for(int j=0 ; j<m ; j++)
		{
			int temp = abs(first[i].first-second[j].first)+abs(first[i].second-second[j].second);
			if(temp < minDis)
			{
				minDis = temp;
				minIndex = j+1;
			}
		}

		cout << minIndex << "\n";
	}


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,x,c=0;
    cin>>n>>x;
    int l[n];
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    for(int i=1;i<n;i++){
        l[i]=l[i-1]+l[i];
    }
    for(int i=0;i<n;i++){
        if(l[i]<=x){
            c++;
        }
    }
    cout<<c+1<<endl;
}


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

int main(){
  int A,B;
  cin >> A >> B;
  int ans=0;
  if(B==1){
    cout << 0 << endl;
    return 0;
  }
  for(int i=1;;i++){
    if(A*i-(i-1)>=B){
      ans=i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second



int main(){
    ll sh,sw,gh,gw;
    ll h,w;

    cin >> h >> w;
    cin >> sh >> sw >> gh >> gw;
    char c[h][w];
    ll memo[h][w];
    rep(i,0,h) rep(j,0,w) cin >> c[i][j];       
    rep(i,0,h) rep(j,0,w) memo[i][j] = LINF;
    memo[sh-1][sw-1] = 0;

    priority_queue<pair<ll,P>,vector<pair<ll,P>>, greater<pair<ll,P>>> pq;
    pair<ll,P> ptemp; ptemp.fs = 0; ptemp.sc.fs = sh-1; ptemp.sc.sc = sw-1;
    pq.push(ptemp);

    while(!pq.empty()){
        pair<ll,P> v = pq.top();
        pq.pop();
        ll y = v.sc.fs, x = v.sc.sc;

        rep(k,-2,3){
            rep(l,-2,3){
                if(y+k < 0 || y+k >= h || x+l < 0 || x+l >= w) continue;
                if(c[y+k][x+l] == '#') continue;

                if(abs(k) + abs(l) == 1){
                    if(memo[y+k][x+l] > memo[y][x]){
                        memo[y+k][x+l] = memo[y][x];
                        ptemp.fs = memo[y+k][x+l]; ptemp.sc.fs = y+k; ptemp.sc.sc = x+l;
                        pq.push(ptemp);
                    }
                }
                else{
                    if(memo[y+k][x+l] > memo[y][x] + 1){
                        memo[y+k][x+l] = memo[y][x] + 1;  
                        ptemp.fs = memo[y+k][x+l]; ptemp.sc.fs = y+k; ptemp.sc.sc = x+l;
                        pq.push(ptemp);
                    }
                }
            }
        }
    }
    


    if(memo[gh-1][gw-1] != LINF) cout << memo[gh-1][gw-1] << endl;
    else cout << -1 << endl;
}



Measured memory_bytes: 12564
#include <stdio.h>
#include <math.h>
int main(void){
	int y,z,e,m,k;
	for(;scanf("%d",&e),e;){
		m=1000000;
		for(z=0;(k=z*z*z)<=e;z++){
			y=sqrt(e-k);
			k=y+z+e-y*y-k;
			if(m>k)m=k;
		}
		printf("%d\n",m);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

int main() {
	int inputan1 {}, inputan2 {};
	std::cin >> inputan1 >> inputan2;
	inputan1 = inputan1 * inputan2;
	if (inputan1%2 == 0) {
		std::cout << "No";
	}
	else {
		std::cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long

signed main(){
	int N, M;
	scanf("%lld%lld", &N, &M);
	if(N == 1 && M == 1){
		printf("%lld\n", 1);
	}
	else if(N == 1 && M > 1){
		printf("%lld\n", M - 2);
	}
	else if(N > 1 && M == 1){
		printf("%lld\n", N - 2);
	}
	else{
		printf("%lld\n", (N - 2) * (M - 2));
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {

	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int X = sc.nextInt();
    int count = N;
    int sum=0;
    int []hairetu = new int[N];
    for(int i=0;i<N;i++) {
    	hairetu[i]=sc.nextInt();
    	sum+=hairetu[i];
    }
    int min = hairetu[0];
    for(int i=0;i<N;i++) {
    	if(min>hairetu[i]) {
    		min = hairetu[i];
    	}
    }
    int ans = (X-sum)/min;
    System.out.println(ans+count);
	}
}


Measured memory_bytes: 21844
use proconio::*;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
        q: usize,
        bc: [i64; 2*q]
    }

    const MAX_VAL: usize = 100001;
    let mut counter: [i64; MAX_VAL] = [0; MAX_VAL];
    let mut sum: i64 = 0;
    for i in 0..n {
        counter[a[i] as usize] += 1;
        sum += a[i];
    }

    for i in 0..q {
        let b = bc[2 * i];
        let c = bc[2 * i + 1];

        sum += (c - b) * counter[b as usize];
        println!("{}", sum);

        counter[c as usize] += counter[b as usize];
        counter[b as usize] = 0;
    }
}


Measured memory_bytes: 6900
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A; double B;
    cin >> A >> B;
    ll b = B * 100 + 0.5;
    cout << A * b / 100 << endl;

    return 0;
}


Measured memory_bytes: 3756
K,A,B=input().split()
K=int(K)
A=int(A)
B=int(B)

def solve(A,B,K):
    if A>=B-1 or A-1>=K:
        return K+1
    K-=(A-1)
    if K%2==0:
        return int(A+(B-A)*int(K/2))
    else:
        return A+(B-A)*int((K-1)/2)+1

print(solve(A,B,K))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
char s[233333];
int s1, s2;
int main() {
	scanf("%s", s);
	for (int i = 0; i < strlen(s); i++)
		if (s[i] == 'C') s1++;
		else if (s[i] == 'F') s2 += s1;
	if (s2 > 0) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

int main()
{
	ll N;
	cin >> N;
	vec A(N);

	REP(i, N) {
		cin >> A[i];
		// A[i]/=2;
	}

	vec ans(N, 0);

	bool isloop=true;

		ans[0] = 0;
	while(isloop) {
		FOR(j, 1, N) {
			ans[j] = A[j - 1] - ans[j - 1];
		}
		// vdebug(ans);
		// debug(A[N - 1]);
		if (ans[N - 1] + ans[0] == A[N - 1]) break;
		else {
			ans[0]+=(A[N-1]-ans[0]-ans[N-1])/2;
			// isloop=false;
		}
	}

	REP(i, N - 1) {
		cout << 2 * ans[i] << " ";
	}
	cout << 2 * ans[N - 1] << endl;

	return 0;
}

Measured memory_bytes: 2944
#include <iostream>

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

  if(13 <= a) std::cout << b << std::endl;
  else if (6 <= a && a <= 12) std::cout << b/2 << std::endl;
  else  std::cout << '0' << std::endl;

  return 0;
}


Measured memory_bytes: 256