akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    LL A,V,B,W;
    cin >>A>>V>>B>>W;
    LL T; cin >> T;
    LL cost = abs(A-B);
    if(V <= W){
        cout << "NO" << endl;
        return 0;
    }


    if((V-W) * T >= cost){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;

    }

}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

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

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

void solve(){
     string s;
     cin >> s;
     int cnt = 1;int maxi = 1;
     int n = s.length();
     vector<int>a(n,1);
     for(int i = 0;i<n-1;i++){
        if(s[i]==s[i+1]&&s[i]=='R') {cnt++; a[i+1] += a[i];a[i] = 0;}
     }
     for(int i = n-1;i>=1;i--){
        if(s[i]==s[i-1]&&s[i]=='L'){a[i-1]+=a[i];a[i] = 0;}
     }

     for(int i = 0;i<n-1;i++){
        if(a[i]){
            int sum = a[i]+a[i+1];
            maxi = max(a[i],a[i+1]);
            if(sum%2){
                if(a[i]>a[i+1]){a[i] = sum/2+1;a[i+1] = sum/2;}
                else {a[i+1] = sum/2+1;a[i] = sum/2;}
                if(maxi%2==0) swap(a[i],a[i+1]);
            }
            else{
                a[i] = sum/2;a[i+1] = sum/2;
            }
            i++;
        }
     }

     for(int i = 0;i<n;i++) cout << a[i] <<' ';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3820
using System;
using System.IO;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var sc = new Scanner();

            string S = sc.Next();

            for (int i = 0; i < 4 - 1; i++)
            {
                if (S[i] == S[i + 1])
                {
                    Console.WriteLine("Bad");
                    return;
                }
            }
            Console.WriteLine("Good");
        }
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}


Measured memory_bytes: 13140
#include <iostream>
#define N 300005
using namespace std;
typedef long long ll;
ll n, a, b, k, ans, M=998244353;
ll fac[N]={1,1}, inv[N]={1,1}, fiv[N]={1,1};
ll c(ll p) {return fac[n] * fiv[n-p] % M * fiv[p] % M;}

int main() {
	cin>>n>>a>>b>>k;
	ll i, t;
	for(i=2; i<=n; i++) {
		fac[i] = fac[i-1] * i % M;
		inv[i] = inv[M%i] * (M-M/i) % M;
		fiv[i] = fiv[i-1] * inv[i] % M;
	}
	for(i=0; i<=n; i++) {
		t = k - a*i;
		if(t<0) break;
		if(t%b==0 && t/b<=n) ans += c(i) * c(t/b) % M;
	}
	cout<<ans%M;
	return 0;
}

Measured memory_bytes: 7296
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int main(){
    string o, e;
    cin >> o >> e;
    for (int i = 0; i < e.size(); i++){
        cout << o[i] << e[i];
    }
    if (o.size() > e.size()){
        cout << o[o.size()-1] << endl;
    }else{
        cout << endl;
    }
    
    
}


Measured memory_bytes: 256
def Check_Num(n):

    for i in range(1,n + 1):
        x = i
        if (x % 3 == 0):
            print(' {}'.format(i),end = '')
            continue
        elif (x % 10 == 3):
            print(' {}'.format(i),end = '')
            continue
        x //= 10
        while (x > 0):
            if (x % 10 == 3):
                print(' {}'.format(i),end = '')
                break
            x //= 10
    print()
if __name__ == '__main__':
    n = int(input())
    Check_Num(n)


Measured memory_bytes: 5872
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
p = p[-X:]
q = q[-Y:]
r.extend(p)
r.extend(q)
r.sort()
print(sum(r[-(X + Y):]))

Measured memory_bytes: 23456
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

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

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
struct comb {
	vector<mint> fact, ifact;
	comb(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
};
int main() {
	init();

	int x, y; cin >> x >> y;
	if ((x + y) % 3 != 0) {
		cout << 0 << "\n";
		return 0;
	}
	int n = (x + y) / 3;
	x -= n; y -= n;
	if (x < 0 || y < 0) {
		cout << 0 << "\n";
		return 0;
	}
	comb c(x + y);
	mint ans = c(x + y, x);
	cout << ans.x << "\n";

	return 0;
}


Measured memory_bytes: 10624
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }
 
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 1000000007;

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

  string S;
  cin >> S;

  auto func = [&](string s) {
    int n = s.size();
    auto dp = make_v<ll>(n+1, 2, 2, 2, 2);
    dp[0][0][0][0][0] = 1;
    REP(i, n) REP(j, 2) REP(k, 2) REP(l, 2) REP(m, 2) {
      if(dp[i][j][k][l][m] == 0) continue;
      int lim = j?9:s[i]-'0';
      REP(d, lim+1) {
        if(d != 3 && d != 5 && d != 7) continue;
        (dp[i+1][j || d<lim][k || d==3][l || d==5][m || d==7] 
          += dp[i][j][k][l][m]);
      }
    }

    ll ret = 0;
    REP(i, 2) ret += dp[n][i][1][1][1];
    return ret;
  };

  ll ans = func(S);
  FOR(i, 3, S.size()) {
    ans += func(string(i, '9'));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int t,i,j,c,p;(t=s.nextInt())>0;System.out.println(c)){int[][]a=new int[t+1][t+1];for(i=c=0;i<t;a[i++][t]=p)for(p=9999,j=0;j<t;++j)p=Math.min(a[i][j]=s.nextInt(),p);for(i=0;i<t;++i){for(j=p=0;j<t;++j)p=Math.max(a[j][i],p);for(j=0;j<t;++j)if(p==a[j][t])c=p;}}}}

Measured memory_bytes: 12000
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        //いつもの
        readonly static long mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            long[] s = ReadLine().Split(' ').Select(long.Parse).ToArray();
            int cnt4 = 0; int cnt2 = 0; int cnt = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] % 4 == 0)
                {
                    cnt4++;
                }
                else if (s[i] % 2 == 0)
                {
                    cnt2++;
                }
                else
                {
                    cnt++;
                }
            }
            if (cnt4 == 0)
            {
                WriteLine(
                    cnt2 == n ? "Yes" : "No"
                    );
            }
            else
            {
                if (cnt2 == 0)
                {
                    WriteLine(
                        (cnt4+1) >= cnt ? "Yes" : "No"
                        );
                }
                else
                {
                    WriteLine(
                       cnt4>= cnt ? "Yes" : "No"
                       );
                }
            }
        }
    }
}

Measured memory_bytes: 20832
n=int(input())
a=list(map(int,input().split())) 
b=list(map(int,input().split())) 
c=list(map(int,input().split())) 
ans=0

for i in a:
    if i - a[a.index(i)-1] == 1 and a.index(i)-1 >= 0:
        ans=ans+b[i-1]+c[i-2]
    else:
        ans+=b[i-1]
    
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
using pp=pair<int,pair<int,int>>;
#define MOD 1000000007
#define INF 1000000000

int main(){
  int N,K;
  cin>>N>>K;
  if(K==1){
    cout<<0<<endl;
  }else if(N==K){
    cout<<0<<endl;
  }else{
    cout<<N-K<<endl;
  }
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int dp[1000000];
int main(){
	int n,i;
	string s;
	cin >> n;
	cin >> s;
	dp[0] = 0,dp[1] = 0;
	s = "0"+s+"0";
	for(i=1;i<n+1;i++){
		dp[i+1] = max(dp[i+1],dp[i]);
		if(s[i-1]=='1' && s[i]=='0' && s[i+1]=='1'){
			int prev = i-1,next = i+1;
			while(s[prev]=='1'){
				dp[i+1] = max(dp[i+1],dp[prev-1]+i-prev);
				prev--;
			}
			while(s[next]=='1'){
				dp[next] = max(dp[next],dp[i-2]+next-i);
				next++;
			}
		}
	}
	cout << dp[n+1] << endl;
}

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

int round(double num);

int main(){
	int n=100;
	int w;
	cin >> w;

	for(int i=0; i<w; i++){
		n = round(n*1.05);
	}

	cout << n*1000 << endl;

	return 0;
}

int round(double n){
	int m=n;

	if(n>m) return m+1;
	if(n==m) return m;
}

Measured memory_bytes: 2980
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
int main()
{
    fastio();
    ll n, k;
    cin >> n >> k;
    ll a[n];
    cn(a, n);
    // ll prev = 1;
    // for (int i = 0; i < k; i++)
    // {
    //     prev *= a[i];
    // }
    for (int i = k; i < n; i++)
    {
        if (a[i] > a[i - k])
        {
            cout << "Yes\n";
        }
        else
        {
            cout << "No\n";
        }
        // prev = temp;
    }
}

Measured memory_bytes: 5152
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();
    Block[] blocks = new Block[N];
    for (int i = 0; i < N; i++) {
      blocks[i] = new Block(scanner.nextInt(), scanner.nextInt(), scanner.nextInt());
    }

    Arrays.sort(blocks, (b1, b2) -> Math.min(b2.s, b1.s - b2.w) - Math.min(b1.s, b2.s - b1.w));

    final int MAX_W = 20_000;
    long[][] dp = new long[N + 1][MAX_W + 1];
    for (int i = 1; i <= N; i++) {
      Block b = blocks[i - 1];
      for (int j = 0; j <= MAX_W; j++) {
        if (j >= b.w && j - b.w <= b.s) {
          dp[i][j] = Math.max(dp[i - 1][j - b.w] + b.v, dp[i - 1][j]);
        } else {
          dp[i][j] = dp[i - 1][j];
        }
      }
    }

    long max = 0;
    for (int i = 0; i <= MAX_W; i++) {
      max = Math.max(max, dp[N][i]);
    }
    System.out.println(max);
  }

  private static class Block {
    public final int w;
    public final int s;
    public final int v;

    private Block(int w, int s, int v) {
      this.w = w;
      this.s = s;
      this.v = v;
    }
  }
}


Measured memory_bytes: 251852
def solve(x, y):
    for i in range(x + 1):
        if 2 * x + 2 * i == y:
            return "Yes"
    return "No"


def main():
    x, y = map(int, input().split())
    res = solve(x, y)
    print(res)


def test():
    assert solve(3, 8) == "Yes"
    assert solve(2, 100) == "No"
    assert solve(1, 2) == "Yes"


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 9192
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>

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

using namespace std;

int bubbleSort(int *A, int N)
{
    int c = 0;
    bool flag = true;
    while (flag)
    {
        flag = false;
        FOR(i, 1, N)
        {
            if(A[i] < A[i-1])
            {
                swap(A[i], A[i - 1]);
                c++;
                flag = true;
            }
        }
    }
    return c;
}

int main()
{
    int a[100], N;
    cin >> N;
    REP(i, N)
    {
        cin >> a[i];
    }

    int c = bubbleSort(a, N);

    REP(i, N)
    {
        cout << a[i];
        if (i != N-1)
            cout << ' ';
    }

    cout << endl << c << endl;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15);

  string s, t;
  cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3808
import copy
a = list(input())
N=len(a)
bit_list =[]
for i in range(2**(N-1)):
  b = format(i,"09b")
  b = b[::-1]
  bit_list.append(b)
count = 0
for i in range(2**(N-1)):
  a_list = []
  a_list=copy.copy(a)
  num = 0
  num_li =[a[0]]
  for k,j in enumerate(bit_list[i]):
    if j == '1':
      a_list.insert(k+1+num,"+")
      num+=1
  for j,i in enumerate(a_list):
    if j>0:
      num_li[0] +=i
  count+= eval(num_li[0])
print(count)

Measured memory_bytes: 9200
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 int compare(int a,int b)
 {
   return a>b;    
 }

 int main()
 {
   int first,second,third;
   first=second=third=0;
   int arr[10];
   for(int i=0;i<10;i++) cin>>arr[i];
   sort(arr,arr+10,compare);
   first=arr[0];
   second=arr[1];
   third=arr[2];
   cout<<first<<endl;
   cout<<second<<endl;
   cout<<third<<endl;
   //while(1);      
   return 0;    
 }
 

Measured memory_bytes: 3152
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int ver,edge,ans=0; 
vi g[55]; 
int deg[55]; 

signed main()
{
    cin >> ver >> edge ; 
    for (int i=1;i<=edge;i++){
        int u,v; cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    } 
    for (int i=1;i<=ver;i++)
        deg[i] = sz(g[i]);
    while (true){
        bool ok=true;
        for (int i=1;i<=ver;i++){
            if (deg[i]==1){
                deg[i]=0; 
                ok=false; 
                for (auto &it: g[i]){
                    if (deg[it]>0) {
                        deg[it]--; 
                        break;
                    }
                }
                ans++;
            }
        }
        if (ok) break;
    }
    cout << min(edge,ans) << endl;
    return 0;
}


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

lint a[2000010],n;

int main(){
	scanf("%lld",&n);
	for(int i=0;i<n;i++) scanf("%lld",&a[i]);
	lint result=0,cur=0,r=0;
	for(int i=0;i<n;i++){
		while(r<n&&(cur&a[r])==0){
			cur^=a[r];r++;
		}
		cur^=a[i];
		result+=r-i;
	}
	printf("%lld",result);
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
data = [[int(i) for i in input().split()] for _ in range(N)]

data.sort(key=lambda x: x[1])

flag = 'Yes'
passed_time = 0
for d in data:
    A, B = d
    passed_time += A
    # print(passed_time, B)
    if passed_time > B:
        flag = 'No'
        # print('BREAK')
        break

print(flag)
    


Measured memory_bytes: 41172
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int turn=1;
    while(a>0 && c>0){
        if(turn){
            c -= b;
            turn =0;
        }else{
            a -= d;
            turn =1;
        }
    }

    if(turn){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3644
import java.util.Scanner;


public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        char[] c = sc.next().toCharArray();
        c[K-1] += 32;
        for (int i=0;i<N;i++){System.out.print(c[i]);}
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int N;
    cin >> N;
    vector<int> P(N);
    REP(i, N) cin >> P[i];

    vector<int> pos(N+1);
    REP(i, N) pos[P[i]] = i;

    long long ans = 0;
    set<int> s{-1, pos[N], N};
    for(int i = N-1; i >= 1; --i){
        auto tmp = s.lower_bound(pos[i]);
        int w, x, y, z;
        x = *next(tmp, -1);
        w = (tmp == next(s.begin(), 1))? x: *next(tmp, -2);
        y = *tmp;
        z = (next(tmp, 1) == s.end())? y: *next(tmp, 1);

        long long cases = (long long) (x-w)*(y-pos[i]) + (long long) (pos[i]-x)*(z-y);
        ans += i * cases;
        s.insert(pos[i]);
        // cout << i << " " << ans << endl;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 5760
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
ll dp[51][2];
string str[3];
int l[3],r[3];
int main(void){
	while(1){
		cin >> str[0];
		if(str[0]=="0")break;
		cin >> str[1];
		cin >> str[2];
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=0;i<str[2].size();i++){
			for(int j=0;j<3;j++){
				l[j]=r[j]=0;
				if(str[j].size()>i){
					if(str[j][str[j].size()-i-1]>='0' && str[j][str[j].size()-i-1]<='9'){
						l[j]=str[j][str[j].size()-i-1]-'0';
						r[j]=str[j][str[j].size()-i-1]-'0';
					}else{
						l[j]=0;
						r[j]=9;
						if(str[j].size()==i+1)l[j]=1;
					}
				}
			}
			for(int n=0;n<2;n++){
				for(int j=l[0];j<=r[0];j++){
					for(int k=l[1];k<=r[1];k++){
						for(int m=l[2];m<=r[2];m++){
							if((n+j+k)%10==m){
								dp[i+1][(n+j+k)/10]=(dp[i+1][(n+j+k)/10]+dp[i][n])%MOD;
							}
						}
					}
				}
			}
		}
		printf("%lld\n",dp[str[2].size()][0]); 
	}
	return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
#define EPS 0.000000000001

struct Line{
	double x[2],y[2];
};

int main(){
	int N;
	Line l[2];
	cin>>N;
	for(int tc=0;tc<N;tc++){
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				cin>>l[i].x[j]>>l[i].y[j];
			}
		}
		double a,b;
		if(l[0].x[0]==l[0].x[1] || l[1].x[0]==l[1].x[1]){
			if(l[0].x[0]==l[0].x[1] && l[1].x[0]==l[1].x[1]) a=b=0;
			else a=0,b=1;
		}
		else{
			a = (l[0].y[1]-l[0].y[0])/(l[0].x[1]-l[0].x[0]);
			b = (l[1].y[1]-l[1].y[0])/(l[1].x[1]-l[1].x[0]);
		}
		if(abs(a-b)<EPS) puts("YES");
		else puts("NO");
	}
}

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

using namespace std;

typedef long long ll;

struct block {
    ll w, s, v;

    block() : w(0), s(0), v(0) {}

    bool operator<(const block& other) const {
        return w + s > other.w + other.s;
    }
};

const int MAXS = 10000;

int N;
ll dp[MAXS + 1];
vector<block> b;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    b.resize(N);
    for (int i = 0; i < N; i++)
        cin >> b[i].w >> b[i].s >> b[i].v;
    sort(b.begin(), b.end());
    ll result = 0;
    for (int i = N - 1; i >= 0; i--) {
        result = max(result, b[i].v + dp[b[i].s]);
        for (int j = MAXS; j >= 0; j--)
            if (b[i].w <= j)
                dp[j] = max(dp[j], b[i].v + dp[min(b[i].s, j - b[i].w)]);
    }
    cout << result << endl;
}


Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

ll N, mod = 1000000007;

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

int main() {

	cin >> N;

	ll ans = 0;

	ans = 1;
	rep(i, N) {
		ans *= 10;
		ans %= mod;
	}
	ll sub = 1;
	rep(i, N) {
		sub *= 8;
		sub %= mod;
	}

	ans = ans + mod - sub;
	ans %= mod;

	ll cnt = 1, eight = 1;

	rep(i, N) {
		ans = ans + mod - cnt * eight * 2 % mod;
		ans %= mod;
		
		cnt *= N - i;
		cnt %= mod;
		cnt *= modinv(i + 1, mod);
		cnt %= mod;
		eight *= 8;
		eight %= mod;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3616
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    int n, k;
    int r, s, p;
    cin >> n >> k;
    cin >> r >> s >> p;

    string t;
    cin >> t;
    vector<int> tt(n);
    rep(i, n)
    {
        if (t[i] == 'r')
        {
            tt[i] = 0;
        }
        else if (t[i] == 's')
        {
            tt[i] = 1;
        }
        else
        {
            tt[i] = 2;
        }
    }

    int point[3] = {p, r, s};
    int result = 0;
    rep(i, k)
    {
        int prev = -1;
        for (int j = i; j < n; j += k)
        {
            if (prev != tt[j])
            {
                result += point[tt[j]];
                prev = tt[j];
            }
            else
            {
                prev = -1;
            }
        }
    }
    cout << result << endl;

    return 0;
}

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

public class Main {
    void run() {
        int A = readInt();
        int B = readInt();
        int C = readInt();
        int ans = 0;
        for (int i = A; i <= B; ++i) {
            if (C % i == 0) ans++;
        }
        System.out.printf("%d\n",ans);
    }

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

    // flush automatically iff you call `println` or `printf` or `format`.
    PrintWriter sysout = new PrintWriter(System.out, true);

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer buffer = null;

    String readLine() {
        buffer = null;
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    String read() {
        if (buffer == null || !buffer.hasMoreTokens()) {
            buffer = new StringTokenizer(readLine());
        }
        return buffer.nextToken();
    }

    int readInt() {
        return Integer.parseInt(read());
    }

    long readLong() {
        return Long.parseLong(read());
    }

    double readDouble() {
        return Double.parseDouble(read());
    }
}



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

#define MOD 1000000007
#define SIZE_1 2000005
#define SIZE_2 1000000
#define INT_BITS 32
typedef long long int ll;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<ll> vi;

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

    ll n, m;
    cin >> n >> m;

    cout << min(n % m, m - (n % m));

    return 0;
}


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

int tot=0,h[200005];
int n,cnt=0,S,T,del,scc[200005];
int fa[200005],val[200005];
struct Edge{
	int x,next;
}e[200005];
bool vis[200005];

inline void add_edge(int x,int y){
	e[++tot].x=y;
	e[tot].next=h[x],h[x]=tot;
}

inline int get_mex(int x){
	int ans;
	for(int i=h[x];i;i=e[i].next)if(del!=i)vis[val[e[i].x]]=1;
	for(int i=0;;i++)if(!vis[i]){ans=i;break;}
	for(int i=h[x];i;i=e[i].next)if(del!=i)vis[val[e[i].x]]=0;
	return ans;
}

void dfs(int x){
	scc[x]=cnt;
	for(int i=h[x];i;i=e[i].next)
		if(scc[e[i].x]){
			if(scc[e[i].x]==cnt)S=x,T=e[i].x,del=i;
		}else dfs(e[i].x);
	val[x]=get_mex(x);
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",fa+i);
		add_edge(fa[i],i);
	}
	for(int i=1;i<=n;i++)
		if(!scc[i])cnt++,dfs(i);
	if(S==0&&T==0)return puts("POSSIBLE"),0;
	int tmp1=get_mex(S);
	vis[tmp1]=true;
	int tmp2=get_mex(S);
	vis[tmp1]=false;
	if(val[T]!=tmp1)return puts("POSSIBLE"),0;
	val[S]=tmp2;
	for(int i=fa[S];i!=T;i=fa[i])val[i]=get_mex(i);
	if(get_mex(T)==tmp1)puts("POSSIBLE");
	else puts("IMPOSSIBLE");
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

int main(){
    string s;   cin >> s;
    vector<ll> a(4);
    REP(i, 4) a[i] = s[i]-'0';
    char c[2] = {'+', '-'};

    REP(i, 2){
        ll x = a[0], y=0;      
        if(c[i]=='+') y = x+a[1];
        else y = x-a[1];
        REP(j, 2){
            ll z;
            if(c[j]=='+') z = y+a[2];
            else z = y-a[2];
            REP(k, 2){
                ll yz;
                if(c[k]=='+') yz = z+a[3];
                else yz = z-a[3];
                if(yz==7){
                    string ans = to_string(a[0])+c[i]+to_string(a[1])+c[j]+to_string(a[2])+c[k]+to_string(a[3]);
                    cout << ans << "=7" << endl;
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 256
n, a, b = map(int, input().split())
total = a + b
s = list(input())
for c in s:
	if c == 'a' :
		if total > 0 :
			print("Yes")
			total -= 1
		else :
			print("No")
	elif c == 'b' :
		if b > 0 and total > 0 :
			print("Yes")
			total -= 1
			b -= 1
		else :
			print("No")
	else :
		print("No")

Measured memory_bytes: 56440
#include <iostream>

using namespace std;

int main() {
    int r,g,b;

    cin >> r >> g >> b;
    int total = r*100 + g*10 + b;
    int mod = total % 4;
    string ans;
    if (mod == 0) {
        ans = "YES";
    } else {
        ans = "NO";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 888
n , m = map(int, input().split())
edge=[[] for _ in range(n)]
deg=[0] * n
for i in range(m):
    x, y =map(int, input().split())
    edge[x - 1 ].append(y - 1)
    deg[y - 1] +=1 

from collections import deque

que =deque()
for i in range(n):
    if deg[i] == 0:
        que.append(i)
dp = [0] *n

while que:
    v = que.popleft()
    nv = edge[v]
    for nv in nv:
        deg[nv] -=1
        if deg[nv] ==0:
            que.append(nv)
            dp[nv] = max(dp[v] + 1 ,dp[nv])
print(max(dp))


Measured memory_bytes: 23092
#include <vector>
#include <iostream>

const int kMaxJumpStep = 3;

int dp(const int N){
	std::vector<int> step(N+2);
	step[0] = 1;

	for (int i = 0; i <= N; i++){
		for (int j = i + 1; j <= i + kMaxJumpStep; j++){
			if (j > N) break;
			step[j] += step[i];
		}
	}

	return step[N];
}

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

	while (1){
		int n;
		std::cin >> n;
		if (n == 0) break;
		std::cout << dp(n)/3650 + 1 << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

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

    ll N;
    cin >> N;

    string S;
    cin >> S;

    ll count = 0;
    string prefix = "";

    for (ll i = 0; i < N; i++) {
        if (S[i] == '(') {
            count++;
        } else {
            count--;
        }

        if (count == -1) {
            count++;
            prefix += '(';
        }
    }

    string suffix = "";
    for (ll i = 0; i < count; i++) {
        suffix += ')';
    }

    cout << prefix << S << suffix << endl;

    return 0;
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

ll Pow(ll A, ll B, ll mod){
  if (B == 0) return 1;
  else{
    if (B % 2 == 0){
      return Pow(A * A % mod, B / 2, mod) % mod;
    }else{
      return A * Pow(A * A % mod, B / 2, mod) % mod;
    }
  }
}


int main(){

  int N; cin >> N;
  vector <ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];

  ll ans = 0;
  for (int i = 0; i < N; i++){
    ll now = Pow(A[i], nmax - 2, nmax);
    ans += now; ans %= nmax;
  }

  vector <ll> cnt(1e6);
  for (int i = 0; i < N; i++){
    ll num = A[i];
    for (ll j = 2; j * j <= A[i]; j++){
      ll now = 0;
      while (num % j == 0){
        num /= j; now++;
      }
      if (cnt[j] < now) cnt[j] = now;
    }
    if (num > 1){
      cnt[num] = max(cnt[num], 1ll);
    }
  }
  
  for (ll i = 1; i < 1e6; i++){
    ans *= Pow(i, cnt[i], nmax);
    ans %= nmax;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

bool fdp(vector<int> &t, int r){
  set<int> se;
  se.insert(0);
  for(int i : t){
    set<int> ne;
    for(int j : se){
      ne.insert(j+i);
      ne.insert(j-i);
    }
    se = ne;
  }
  return se.count(r) == 1;
}

int main(){
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;
  vector<pair<bool, int>> vp;
  int co = 0;
  bool m = (s.front() == 'F');
  rep(i, s.size()){
    if(i != 0 && s.at(i) != s.at(i-1)){
      if(!(vp.size() == 0 && m == true))vp.push_back({m, co});
      co = 1;
      m ^= 1;
    }else{
      if(vp.size() == 0 && m == true){
        x--;
      }
      co++;
    }
  }
  if(!(vp.size() == 0 && m == true))vp.push_back({m, co});
  int tot = 0;
  vector<int> tx, ty;
  bool mode = true;//x
  for(auto p : vp){
    if(p.first == false){
      p.second %= 2;
      if(p.second == 1) mode ^= 1;
    }else{
      tot += p.second;
      if(mode == 1) tx.push_back(p.second);
      else ty.push_back(p.second);
    }
  }

  bool r1 = fdp(tx, x), r2 = fdp(ty, y);
  if(r1 && r2 == true) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3972
from collections import deque


def main():
    from sys import stdin
    readline = stdin.readline

    from builtins import max, min, range

    INF = 10 ** 6

    H, W = map(int, readline().split())
    Ch, Cw = map(lambda x: int(x) - 1, readline().split())
    Dh, Dw = map(lambda x: int(x) - 1, readline().split())
    S = [readline()[:-1] for _ in range(H)]

    t = [[INF] * W for _ in range(H)]
    for h in range(H):
        th = t[h]
        Sh = S[h]
        for w in range(W):
            if Sh[w] == '#':
                th[w] = -1

    t[Ch][Cw] = 0
    q = deque([(Ch, Cw)])
    warp_count = 0
    warpq = []
    while q:
        while q:
            warpq.append(q[0])
            h, w = q.popleft()
            if h - 1 >= 0 and t[h - 1][w] > warp_count:
                q.append((h - 1, w))
                t[h - 1][w] = warp_count
            if h + 1 < H and t[h + 1][w] > warp_count:
                q.append((h + 1, w))
                t[h + 1][w] = warp_count
            if w - 1 >= 0 and t[h][w - 1] > warp_count:
                q.append((h, w - 1))
                t[h][w - 1] = warp_count
            if w + 1 < W and t[h][w + 1] > warp_count:
                q.append((h, w + 1))
                t[h][w + 1] = warp_count

        if t[Dh][Dw] != INF:
            break

        warp_count += 1
        for h, w in warpq:
            for i in range(max(0, h - 2), min(H, h + 3)):
                ti = t[i]
                for j in range(max(0, w - 2), min(W, w + 3)):
                    if ti[j] > warp_count:
                        ti[j] = warp_count
                        q.append((i, j))
        warpq.clear()

    if t[Dh][Dw] == INF:
        print(-1)
    else:
        print(t[Dh][Dw])


main()


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

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    ll n, k, s;
    cin >> n >> k >> s;

    for (int i = 0 ; i < k; i++) {
        cout << s << ' ';
    }

    if (s > n - k) {
        for (int i = 0; i < n - k; i++) cout << 1 << ' ';
    } else {
        for (int i = 0; i < n - k; i++) cout << s + 1 << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] l = line.split(" ");
        int a = Integer.parseInt(l[0]);
        int b = Integer.parseInt(l[1]);

        if(a < b) {
          System.out.println("a < b");
        } else if(a > b) {
          System.out.println("a > b");
        } else {
          System.out.println("a == b");                                                              
        }
    }
}

Measured memory_bytes: 26060
import sys
sys.setrecursionlimit(10**9)

def main():
    S = list(input())
    comp = []

    pre_s = S[0]
    length = 1
    for s in S[1:]:
        if s == pre_s:
            length += 1
        else:
            comp.append((pre_s,length))
            length = 1

        pre_s = s

    comp.append((pre_s,length))

    ans = []
    # print(comp)
    for i in range(len(comp)//2):
        ev = comp[i*2][1]
        od = comp[i*2+1][1]
        mid = (ev+od)//2

        if (ev+od) % 2 == 0:
            for j in range(ev-1):
                ans.append(0)

            ans.append(mid)
            ans.append(mid)

            for j in range(od-1):
                ans.append(0)
        else:
            if od % 2 == 1:
                for j in range(ev-1):
                    ans.append(0)

                ans.append(mid)
                ans.append(mid+1)

                for j in range(od-1):
                    ans.append(0)

            else:
                for j in range(ev-1):
                    ans.append(0)

                ans.append(mid+1)
                ans.append(mid)

                for j in range(od-1):
                    ans.append(0)





    print(*ans)


if __name__ == "__main__":
  main()


Measured memory_bytes: 68088
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

# 二次元配列，他の要素まで書き変わらないように静的確保，意識
# c = [[0] * 10] * 10
c = [[0 for i in range(10)] for j in range(10)]


for i in range(1, n+1):
    s_i = str(i)
    # print(s_i)
    first = int(s_i[0])
    last = int(s_i[-1])
    # print(first)
    # print(last)
    c[first][last] += 1
    # print(c)

# print(c)
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += c[i][j] * c[j][i]
print(ans)


# exit()

# dic = defaultdict(int)
# for i in range(1, n+1):
#     dic["{},{}".format(str(i)[0], str(i)[-1])] += 1

# # print(dic)

# ans = 0
# for n in dic.copy():
#     s, e = n.split(",")
#     # print(s, e)
#     # if s == e:
#     #     ans += dic[n] * dic[n]
#     # else:
#     ans += dic[n] * dic["{},{}".format(e, s)]
# print(ans)        



Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  map<ll,ll> m;
  REP(i,n){
      ll tmp;cin >> tmp;
      m[tmp]++;
  }
  ll s = m.size();
  s -= (s%2==0);
  cout << s << endl;

}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define rep(i, n) for(ll i=0; i<n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n;

signed main(){
    ll x, y;
    cin >> x >> y;
    ll t = y / x;
    ll cnt = 0;
    while(t >= 1){
        t /= 2;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int a, b;
  cin >> a >> b;
  cout << (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 ? "Possible" : "Impossible") << endl;
}



Measured memory_bytes: 256
#include <iostream>


#define DEBUG(x) do {std::cerr << #x << ": " << x << std::endl; } while (0)


int main(int argc, const char ** argv){
	int n1, n2, n3;
	std::cin >> n1 >> n2 >> n3;

	bool found = false;

	if (n1 == 7) {
		if (n2 == 5 && n3 == 5) found = true;
	}
	else if (n2 == 7) {
		if (n1 == 5 && n3 == 5) found = true;
	}
	else if (n3 == 7){
		if (n1 == 5 && n2 == 5) found = true;
	}

	if (found) std::cout << "YES" << std::endl;
	else std::cout << "NO" << std::endl;

    return 0;
}


Measured memory_bytes: 256