akhauriyash/Code-Regression huggingface dataset:
function f()
    input = map(x -> parse(Int, x), split(chomp(readline()), " "))
    a = input[1]
    b = input[2]
    k = input[3]

    max = findmax([a, b])

    base = sort(collect(1:1:max[1]), rev = true)

    a_ = a .% base
    b_ = b .% base

    a_ = a_ .== 0
    b_ = b_ .== 0

    j = 0
    for i in 1:length(base)
        if a_[i] == true & b_[i] == true
            j += 1
            if j == k
                println(base[i])
            end
        end
    end
end
f()

Measured memory_bytes: 178708
using System;

namespace ALDS1_14_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string T = Console.ReadLine();
            string P = Console.ReadLine();
            int l = 0;
            int r = 0;
            int i;

            while (r < T.Length)
            {

                for (i = 0; i < P.Length; i++)
                {
                    if (r == T.Length)
                    {
                        break;
                    }
                    if (T[r] == P[i])
                    {
                        r++;
                    }
                    else break;
                }
                if (i == P.Length)
                {
                    Console.WriteLine(l);
                }
                l++;
                r = l;
            }
        }
    }
}

Measured memory_bytes: 9176
// https://atcoder.jp/contests/agc040/tasks/agc040_a

#include "algorithm"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(VL v);
template <typename T>
void drop(T a);

void solve() {
  string s;
  cin >> s;

  ll N = s.size() + 1;
  VL res(N, 0);

  rep(i, s.size()) {
    if (s[i] == '<') {
      chmax(res[i + 1], res[i] + 1);
    }
  }

  repr(i, s.size()) {
    if (s[i] == '>') {
      chmax(res[i], res[i + 1] + 1);
    }
  }

  ll sum = accumulate(res.begin(), res.end(), 0ll);

  cout << sum << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(VL v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
  

  int main(){
     lint n,q;
     string s;
     cin>>n;

     cout<<acos(-1)*2*n;
  }
  
     


Measured memory_bytes: 3856
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int ans=0;
  		int keit=0;
		int keix=0;
  		int keiy=0;
  
		for(int c=0;c<n;c++){
    		 int t=sc.nextInt();
          	 int x=sc.nextInt();
          	 int y=sc.nextInt();
          if(t%2==1&&(x+y)%2==0){
          ans++;
          break;
          }else if(t%2==0&&(x+y)%2==1){
          ans++;
          break;
          }else if((Math.abs(x-keix)+Math.abs(y-keiy))>t-keit){
          ans++;
           break;
          }
          keix=x;
          keiy=y;
          keit=t;
    	}
    
 	if(ans==0){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }

    }
}


Measured memory_bytes: 57200
#include <iostream>
#include <algorithm>
#include <cstdio>
          
using namespace std;
          
int main() {
int a,b;
cin >> a >> b;
int d = a/b;
int r = a%b;
double f = (double)a/b;
printf("%d %d %lf",d,r,f);
}


Measured memory_bytes: 3232
#include "bits/stdc++.h"
using namespace std;


int main()
{
	int n;
	cin >> n;
	int min = n + 1;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		int p_in;
		cin >> p_in;
		if (p_in < min) {
			cnt++;
			min = p_in;
		}
	}

	cout << cnt << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  int H, W;
  cin >> H >> W;
  rep(i,H){
    rep(j,W){
      string str;
      cin >> str;
      if(str == "snuke") cout << (char)('A'+j) << i+1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
from collections import Counter


def solve():
    c = Counter(arr)
    four_edges = [k for k, v in c.items() if v >= 4]
    two_edges = [k for k, v in c.items() if 1 < v < 4]
    four_edges.append(0)
    two_edges.append(0)
    four_edges.sort(reverse=True)
    two_edges.sort(reverse=True)

    area_f = four_edges[0] * four_edges[0]
    if len(two_edges) >= 2:
        area_t = two_edges[0] * two_edges[1]
    else:
        area_t = 0
    area_t_t = two_edges[0] * four_edges[0]
    max_area = max(area_f, max(area_t, area_t_t))
    return max_area


N = int(input())
arr = list(map(int, input().split()))
res = solve()
print(res)


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

int main()
{
    int n;
    int i, j, k;
    long long int save, key = 1, count = 0;
    
    cin >> n;
    
    long long int a[n+1];
    
    a[0] = 0;
    
    for(i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] += a[i-1];
    }
    
    sort(a, a+n+1);
    
    for(i = 0; i < n; i++) {
        while((a[i] == a[i+1]) && (i < n)) { key++; i++; }
        count += key * (key-1) / 2;
        key = 1;
    }
    
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long
#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second
 
 
 
using namespace __gnu_pbds;
using namespace std;
 const int mod=1e9+7;
 // const int mod=998244353;
const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i; 
 
 
int power(int a, int b, int mod)
{
    int prod=1;
    int mult=a%mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod*=mult;
            prod%=mod;
        }
        mult*=mult;
        mult%=mod;
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int mod)
{
    return power(q, mod-2,mod);
}


signed main()
 
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
       cout.tie(NULL);
     #ifndef ONLINE_JUDGE
        if(fopen("INPUT.txt","r"))
        {
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
        }
     #endif
    auto clk=clock(); 
        mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------     

    read(n);
    read(k);
    //how to solve
    //let me think

    int ans=0;
    //max summation - min_summaiton




    for(int l=k;l<=n+1;l++)
    {
    int min_summation=(l*(l-1))/2;
    int max_summation = (n*(n+1))/2 - ((n-l)*(n-l+1))/2 ;
    ans+=(max_summation-min_summation+1)%mod;
}   
    cout<<ans%mod;

    // -------------------------------------Code ends here------------------------------------------------------------------
 
 
    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
 }


Measured memory_bytes: 3812
#include <iostream>
#include <string>

int main(){
  int n;
  std::string s;
  std::cin >> n >> s;
  int cnt = 0;
  for(int i = 0; i != n-2; ++i)
    if(s.substr(i,3) == "ABC")
      ++cnt;
  std::cout << cnt << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if (a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if (b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
    else if (b <= a && a <= c)
        cout << b << " " << a << " " << c << endl;
    else if (c <= b && b <= a)
        cout << c << " " << b << " " << a << endl;
    else if (c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
}


Measured memory_bytes: 3100
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var B = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var diff = new long[N];

            var sum = 0L;
            var count = 0;
            for (var i = 0; i < N; i++)
            {
                diff[i] = A[i] - B[i];
                if (A[i] < B[i])
                {
                    sum += B[i] - A[i];
                    count++;
                }
            }

            if (sum == 0)
            {
                Console.WriteLine(0);
                return;
            }

            Array.Sort(diff);
            Array.Reverse(diff);
            var d = 0L;

            for (var i = 0; i < N; i++)
            {
                d += diff[i];
                if (d >= sum)
                {
                    Console.WriteLine(count + i + 1);
                    return;
                }
            }

            Console.WriteLine(-1);
        }
    }
}

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



int main(){
    long long  A[100][100], B[100][100],C[100][100];
    int n, m, l;
    
    cin >> n >> m >> l;
    for ( int i = 0; i < n ; i++)
        for (int j = 0; j < m; j++) cin >> A[i][j];
    for ( int i = 0; i < m ; i++)
        for (int j = 0; j < l; j++) cin >> B[i][j];
    
    for ( int i = 0; i < n ; i++){
        for (int j = 0; j < l; j++){
            C[i][j] = 0;
            for (int k = 0; k < m; k++){
                C[i][j] += A[i][k]*B[k][j];
            }
        }
    }
    
    for ( int i = 0; i < n ; i++){
        for ( int j = 0; j < l; j++){
            if ( j ) cout << " ";
            cout << C[i][j];
        }
        cout << endl;
    }
    
    return 0;
}

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

int main(){
  int N;
  vector<int> A (110,0), B(110);

  cin >> N;
  for (int i=0; i<N-1; i++) cin >> B[i];

  A[0] = B[0];
  A[N-1] = B[N-2];

  for (int i=1; i<N-1; i++){
    A[i] = min(B[i], B[i-1]);
  }

  int sum = 0;
  for(int i=0; i<N; i++){
    sum += A[i];
  }

  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <math.h>
#include <deque>
#include <queue>
#include <map>
#include <iterator>
#include <set>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
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; }

const int mxN = 103;
const int mxM = 1009;
const int INF = 1e9;
int a[mxM], b[mxM], c[mxM];
int dist[mxN][mxN];

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

	int n, m;
	cin >> n >> m;

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

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i == j) dist[i][j] = 0;
			else dist[i][j] = INF;
		}
	}

	for (int i = 0; i < m; i++) {
		dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
		dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
	}

	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}

	int ans = m;
	for (int i = 0; i < m; i++) {
		bool ok = false;
		for (int j = 0; j < n; j++) {
			if (dist[j][a[i]] + c[i] == dist[j][b[i]]) ok = true;
		}
		if (ok) ans--;
	}

	cout << ans << endl;
}

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

int main() {
	int y, m, d;
	char c1, c2;
	cin >> y >> c1 >> m >> c2 >> d;

	if(m <= 4) cout << "Heisei" << endl;
	else cout << "TBD" << endl;

	return 0;
}

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    s64 N;
    cin >> N;

    s64 x = 0, y = 0, z = 0;
    bool found = false;
    for (y = CEIL(N, 4); y <= 3500; ++y)
    {
        for (x = y; x <= 3500; ++x)
        {
            if ((N - 4 * y) * x + N * y == 0) continue;
            z = - N * x * y / ((N - 4 * y) * x + N * y);
            if (z > 3500) continue;
            if (z > 0 && 4 * x * y * z == (x * y + y * z + z * x) * N)
            {
                found = true;
            }
            if (found) break;
        }
        if (found) break;
    }

    cout << x << " " << y << " " << z << "\n";
    return 0;
}



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

//https://qiita.com/tubo28/items/e6076e9040da57368845
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")
}

//https://onlinejudge.u-aizu.ac.jp/solutions/problem/ALDS1_5_B/review/2709881/arsenic28/Rust
trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn main(){
    let mut s:Vec<char> = read::<String>().chars().collect();
    for i in 0..s.len(){
        if s[i] == '?'{
            s[i] = 'D';
        }
    }
    println!("{}",s.iter().join(""));

}


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

using namespace std;

//#define int long long
//#define double long double

int n;
int a[200010];
int b[200010];

int mysolution(){
    int result = 0;
    for(int i = 0; i < 30; i++){
        vector<int> aa, bb;
        for(int j = 0; j < n; j++){
            aa.push_back(((1 << (i + 1)) - 1) & a[j]);
            bb.push_back(((1 << (i + 1)) - 1) & b[j]);
        }
        sort(aa.begin(), aa.end(), greater<int>());
        sort(bb.begin(), bb.end());
        int lo = 0, hi = 0;
        int lo2 = 0, hi2 = 0;
        int lo3 = 0, hi3 = 0;
        for(int j = 0; j < n; j++){
            if(!(aa[j] & (1 << i))){
                int low = (1 << i) - aa[j];
                int high = (1 << (i + 1)) - aa[j] - 1;
                while(lo < n && bb[lo] < low) lo++;
                hi = max(lo, hi);
                while(hi < n && bb[hi] <= high) hi++;
                if((hi - lo) & 1) result ^= (1 << i);
            }
            else{
                int low = 0, high = (1 << (i + 1)) - aa[j] - 1;
                while(lo2 < n && bb[lo2] < low) lo2++;
                hi2 = max(hi2, lo2);
                while(hi2 < n && bb[hi2] <= high) hi2++;
                if((hi2 - lo2) & 1) result ^= (1 << i);

                low = (1 << (i + 1)) - aa[j] + (1 << i);
                high = (1 << (i + 1)) - 1;
                while(lo3 < n && bb[lo3] < low) lo3++;
                hi3 = max(hi3, lo3);
                while(hi3 < n && bb[hi3] <= high) hi3++;
                if((hi3 - lo3) & 1) result ^= (1 << i);
            }
        }
        //cout << result << endl;
    }
    return result;
}

int bad(){
    int result = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            result ^= (a[i] + b[j]);
        }
    }
    return result;
}

mt19937 mt(123);
void gen(int my){
    if(my){
        cin >> n;
        for(int i = 0; i < n; i++) cin >> a[i];
        for(int i = 0; i < n; i++) cin >> b[i];
    }
    else{
        n = 10;
        for(int i = 0; i < n; i++) a[i] = mt() % (1 << 28);
        for(int i = 0; i < n; i++) b[i] = mt() % (1 << 28);
    }
}

main()
{
    ios_base::sync_with_stdio(0);
    if(0){
        for(int cnt = 1; ; cnt++){
            gen(0);
            int a1 = bad();
            int a2 = mysolution();
            if(a1 != a2){
                cout << n << endl;
                for(int i = 0; i < n; i++) cout << a[i] << ' '; cout << endl;
                for(int i = 0; i < n; i++) cout << b[i] << ' '; cout << endl;
                cout << "EXPECTED: " << a1 << endl;
                cout << "FOUND: " << a2 << endl;
                exit(0);
            }
            if(cnt % 1024 == 0) cout << cnt << " OK" << endl;
        }
    }
    else{
        gen(1);
        cout << mysolution() << endl;
    }
}


Measured memory_bytes: 4828
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <utility>
#include <numeric>
#include <map>
#include <iomanip>
using namespace std;

int main() {
    int N; cin >> N;
	vector<vector<int>> xyh(N, vector<int>(3));
	for(int i = 0; i < N; i++) cin >> xyh[i][0] >> xyh[i][1] >> xyh[i][2];

	int cx, cy, ch;

	for(int i = 0; i <= 100; i++){
		for(int j = 0; j <= 100; j++){
			for(int h = max(1, xyh[0][2] - 210); h < xyh[0][2] + 210; h++){
				bool ok = true;
				for(int k = 0; k < N; k++){
					if(xyh[k][2] != max(0, h - abs(i-xyh[k][0]) - abs(j-xyh[k][1]))){
						ok = false;
						break;
					}
				}
				if(ok){
					cx = i;
					cy = j;
					ch = h;
				}
			}
		}
	}

	cout << cx << " " << cy << " " << ch << endl;

}

Measured memory_bytes: 256
import math

N,K = map(int,input().split())
sum = 0
max2 = math.ceil(math.log2(K)) 
for i in range(1,N+1):

    #K ~ Nの時は、100％となる
    if i == K:
        sum += (2 ** max2) * (N-K+1)
        break

    R = math.ceil(math.log2(K / i))
    r = max2 - R

    sum += 2 ** r

mother = N * 2 ** max2
answer = sum/mother

print(answer)

Measured memory_bytes: 3064
using System;

class P
{
public static void Main()
{
            //????????????????????????
            var x = (Console.ReadLine()).Split(' ');

            //?????????????????°?????????
            int a = Int32.Parse(x[0]);
            int b = Int32.Parse(x[1]);
            int c = Int32.Parse(x[2]);

            int countNo = 0;

            for (int i = a; i <= b; i++)
            {
                if (c % i == 0)
                {
                    countNo++;
                }
            }

            string D = countNo.ToString();
            //??????
            Console.WriteLine(D);
}
}

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


using namespace std;

int a[3];

int main(){
    cin >> a[0] >> a[1] >> a[2];
    int cnt = 0;
    while(a[0] != a[1]|| a[1] != a[2] || a[0] != a[2]){
        sort(a, a + 3);
        if(a[0] < a[2] && a[1] < a[2]){
            a[0] ++;
            a[1] ++;
        }else if(a[1] == a[2]){
            a[0] += 2;
        }
        cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long x = Integer.parseInt(sa[1]);

		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int[] mins = new int[n];
		System.arraycopy(a, 0, mins, 0, n);

		long ans = Long.MAX_VALUE;
		for (int k = 0; k < n; k++) {
			long sum = 0;
			for (int i = 0; i < n; i++) {
				mins[i] = Math.min(mins[i], a[minus(i, k, n)]);
				sum += mins[i];
			}
			ans = Math.min(ans, sum + k * x);
		}
		System.out.println(ans);
	}

	static int minus(int a, int b, int n) {
		int c = a - b;
		if (c < 0) {
			c += n;
		}
		return c;
	}

	static int plus(int a, int b, int n) {
		int c = a + b;
		if (c >= n) {
			c -= n;
		}
		return c;
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
int main(void) {
	// Your code here!
	string S;
	int l = 0;
	int max = 0;
	cin >> S;
	for (int i = 0; i < 3; i++) {
		if (S.at(i) == 'R') {
			l++;
		}
		else if (l != 0 && S.at(i) == 'S') {
			l = 0;
		}
		if (max <= l) {
			max = l;
		}
	}
	cout << max << endl;
}

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

struct city {
  int x;
  int y;
  int64_t p;
};

int64_t recursive_score(int K,
                        vector<vector<int64_t>> &city_line_scores,
                        int current_line,
                        int selected_num,
                        vector<stack<int>> &city_stack) {

  int N = city_line_scores.size();
  if (selected_num == K) {
    int64_t s = 0;
    for (int i = 0; i < N; i++) {
      s += city_line_scores[i][city_stack[i].top()];
    }
    return s;
  }

  int64_t min_score = 100000000000000LL;
  int add_line_num = city_line_scores[0].size() - 2;
  if (current_line >= add_line_num) {
    return min_score;
  }
  int rest = (add_line_num - current_line) / 2;
  if (selected_num + rest < K) {
    return min_score;
  }

  for (int i = 0; i < N; i++) {
    if (city_line_scores[i][city_stack[i].top()] > city_line_scores[i][current_line]) {
      city_stack[i].push(current_line);
    }
  }
  min_score = min(min_score, recursive_score(K, city_line_scores, current_line + 2, selected_num + 1, city_stack));
  for (int i = 0; i < N; i++) {
    if (city_stack[i].top() == current_line) {
      city_stack[i].pop();
    }
  }
  for (int i = 0; i < N; i++) {
    if (city_line_scores[i][city_stack[i].top()] > city_line_scores[i][current_line + 1]) {
      city_stack[i].push(current_line + 1);
    }
  }
  min_score = min(min_score, recursive_score(K, city_line_scores, current_line + 2, selected_num + 1, city_stack));
  for (int i = 0; i < N; i++) {
    if (city_stack[i].top() == current_line + 1) {
      city_stack[i].pop();
    }
  }
  min_score = min(min_score, recursive_score(K, city_line_scores, current_line + 2, selected_num, city_stack));
  return min_score;
}

int main() {
  int N;
  cin >> N;
  vector<city> cities(N);
  for (int i = 0; i < N; i++) {
    int x, y, p;
    cin >> x;
    cin >> y;
    cin >> p;
    cities[i] = city{x, y, p};
  }

  vector<bool> exist_lines(N * 2 + 2);
  for (int j = 0; j < N; j++) {
    exist_lines[j * 2] = false;
    exist_lines[j * 2 + 1] = false;
  }
  exist_lines[N * 2] = true;
  exist_lines[N * 2 + 1] = true;

  vector<vector<int64_t>> city_line_scores(N);
  for (int i = 0; i < N; i++) {
    int xi = cities[i].x;
    int yi = cities[i].y;
    int64_t pi = cities[i].p;

    vector<int64_t> line_score(N * 2 + 2);

    for (int j = 0; j < N; j++) {
      int xj = cities[j].x;
      int yj = cities[j].y;

      line_score[j * 2] = pi * abs(xi - xj);
      line_score[j * 2 + 1] = pi * abs(yi - yj);
    }
    line_score[N * 2] = pi * abs(xi);
    line_score[N * 2 + 1] = pi * abs(yi);

    city_line_scores[i] = line_score;
  }

  for (int K = 0; K < N; K++) {
    vector<stack<int>> city_stack(N);
    for (int i = 0; i < N; i++) {
      int h = N*2;
      int v = N*2+1;
      city_stack[i].push(h);
      if (city_line_scores[i][city_stack[i].top()] > city_line_scores[i][v]) {
        city_stack[i].push(v);
      }
    }
    int64_t S = recursive_score(K, city_line_scores, 0, 0, city_stack);
    cout << S << endl;
  }
  cout << 0 << endl;
}


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

int main()
{
	int n;
	vector<int> a;
	a.push_back(0);

	cin >> n;
	for (int i = 0; i < n; i++) {
		int b;
		cin >> b;
		a.push_back(b);
	}

	int count = 0;
	for (int i = 0; 2 * i + 1 <= n; i++) {
		if (a[2 * i + 1] % 2 == 1) {
			count++;
		}
	}

	cout << count;
}

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

int main() {
  int n,ans=0;
  cin >> n;
  int mi=n;
  vector<int> vec(n);
  for(int i=0; i<n; i++) cin >> vec[i];
  for(int i=0; i<n; i++) {
    if(mi >= vec[i]) ans++;
    mi = min(mi,vec[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String s = sc.next();
		//String t = sc.next();
		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();
		long l = sc.nextLong();
		//long count=0;

		/*for(int i=0;i<3;i++) {
			if(s.substring(i,i+1).equals(s.substring(i+1,i+2))) {
				count++;
			}else if(i!=2){
				count=0;
			}
		}*/
		if(n+m<k+l) {
			System.out.println("Right");
		}else if(n+m>k+l){
			System.out.println("Left");
		}else {
			System.out.println("Balanced");
		}
		//System.out.println((int)Math.ceil((n+m)/2.0));
		//System.out.println(Math.ceil(5.5));
	}
}




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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cout.precision(12);
    cout << fixed;
    cin.tie(0);

    int n, m, k;
    cin >> n >> m >> k;
    vector<string> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    int ans = 0;
    for (int m1 = 0; m1 < (1<<n); m1++) {
        for (int m2 = 0; m2 < (1<<m); m2++) {
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                if ((m1 >> i) & 1) continue;
                for (int j = 0; j < m; j++) {
                    if ((m2 >> j) & 1) continue;
                    if (v[i][j] == '#') cnt++;
                }
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3648
package main

import "fmt"

func main() {
	var h int
	fmt.Scan(&h)
	fmt.Println(dfs(h/2) + 1)
}

var memo = map[int]int{}

func dfs(h int) int {
	if h == 0 {
		return 0
	}

	if memo[h] > 0 {
		return memo[h]
	}

	a := dfs(h/2) + 1
	memo[h] = a * 2

	return a * 2
}


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

using namespace std;

int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    int d[3];
    d[0] = abs(a[0]-a[1]);
    d[1] = abs(a[1]-a[2]);
    d[2] = abs(a[2]-a[0]);
    sort(begin(d),end(d));
    
    cout << (d[0] + d[1]) << '\n';
    
    return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    int a[3];
    rep(i,3)a[i]=0;
    rep(i,n){
        int t;cin>>t;
        if(t%4==0)a[0]++;
        else if(t%2==0)a[1]++;
        else a[2]++;
    }
    if(a[1]==0)a[0]++;
    if(a[2]<=a[0])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main(){
    int n;
    pair<int, int> num[100000];
    int i;
    cin >> n;
    for(i = 0;i < n;i++){
        cin >> num[i].first;
        num[i].second = i + 1;
    }
    
    sort(num, num + n);
    for(i = 0;i < n;i++){
        cout << num[i].second << " ";
    }
    
    
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
const int N = 200000;
int n, k, l, p1[N], p2[N], idx[N], id, ans[N], cnt[N];
bool vis[N];
int find(int u, int *p) {
	if (u == p[u])
		return u;
	return p[u] = find(p[u], p);
}

vector<vector<int> > cmp1, cmp2;

void solve1(int *p, int m) {
	for (int i = 0, a, b, aa, bb; i < m; ++i) {
		scanf("%d%d", &a, &b);
		--a, --b;
		aa = find(a, p);
		bb = find(b, p);
		if (aa != bb)
			p[aa] = bb;
	}
}

void solve2(int *p, vector<vector<int> > &cmp) {
	id = 0;
	for (int i = 0; i < n; ++i) {
		if (!vis[find(i, p)]) {
			vis[find(i, p)] = true;
			idx[find(i, p)] = id++;
		}
	}
	cmp.resize(id);
	for (int i = 0; i < n; ++i)
		cmp[idx[find(i, p)]].push_back(i);
	memset(vis, 0, sizeof vis);
}

int main() {
	scanf("%d%d%d", &n, &k, &l);
	for (int i = 0; i < n; ++i)
		p1[i] = p2[i] = i;
	solve1(p1, k);
	solve1(p2, l);
	solve2(p1, cmp1);
	solve2(p2, cmp2);
	for (int i = 0; i < (int) cmp1.size(); ++i) {
		for (int j = 0; j < (int) cmp1[i].size(); ++j)
			++cnt[find(cmp1[i][j], p2)];
		
		for (int j = 0; j < (int) cmp1[i].size(); ++j)
			ans[cmp1[i][j]] = cnt[find(cmp1[i][j], p2)];
		
		for (int j = 0; j < (int) cmp1[i].size(); ++j)
			--cnt[find(cmp1[i][j], p2)];
	}
	
	for (int i = 0; i < n; ++i)
		printf("%d%c", ans[i], " \n"[i == n - 1]);
	
	return 0;
}



Measured memory_bytes: 24576
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define int long long
#define ld long double
#define ll long long

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ld n, m;
	cin >> n >> m;
	vector<ld> v(n);
	ld sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		sum += v[i];
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	bool x = 1;
	for (int i = 0; i < m; i++) {
		x &= ((v[i] / sum) >= (1.0 / (4 * m)));
	}
	if (x) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOJHelloWorld1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            if (a < b)
            {
                Console.WriteLine("a < b");
            }
            else if (a > b)
            {
                Console.WriteLine("a > b");
            }
            else
            {
                Console.WriteLine("a == b");
            }
        }
    }
}


Measured memory_bytes: 15880
R=range
l=[[[0 for i in R(10)]for j in R(3)]for s in R(4)]
n=int(input())
for a in range(n):
    b,f,r,v=map(int,input().split())
    l[b-1][f-1][r-1]+=v
for b in range(4):
    for k in l[b]:
        print('',*k)
    if b<3:
        print('#'*20)

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//桁数
ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//約数全列挙
vector<ll> enum_div(ll n)
{
  vector<ll> ret;
  for (ll i = 1; i * i <= n; ++i)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
      {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

//累乗(xのn乗%mod)
ll modpow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//階乗
ll factorial(ll n)
{
  if (n > 0)
    return n * factorial(n - 1);
  else
    return 1;
}

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

void Main()
{
  str s; cin >> s;
  ll a = 0;
  rep(i, 4)
  {
    if(s[i] == '+') a++;
    else a--;
  }
  fin(a);
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n;
string s;
int nowl,nowr;
int ans;
int main(){
    cin>>n;
    cin>>s;
    nowr=n;
    for(int i=0;i<n;i++)
        if(s[i]=='#')
            nowr--;
    ans=nowr;
    for(int i=0;i<n;i++){
        if(s[i]=='.')
            nowl++,nowr--;
        ans=min(ans,(i+1-nowl+nowr));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 100000007)
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(Scanner())
	a := make([]int, n)
	sum := make([]int, n+1)

	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		sum[i+1] = sum[i] + a[i]
	}

	ans := 0
	mod := int(1e9 + 7)
	for i := 0; i < n; i++ {
		s := (sum[n] - sum[i+1]) % mod
		ans += a[i] * s
		ans %= mod
	}
	fmt.Println(ans)
}


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

int main()
{
  int N;
  cin >> N;
  vector<vector<int>> G(N);
  vector<pair<int, int>> vp;
  for (int i = 1; i < N; i++)
  {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    vp.emplace_back(a, b);
  }

  int K = 0;
  map<pair<int, int>, int> I;
  vector<int> cs(N, 0); // color of edge between its parent

  vector<int> used(N, 0);
  queue<int> que;
  used[0] = 1;
  que.emplace(0);
  while (!que.empty())
  {
    int v = que.front();
    que.pop();
    if (K < (int)G[v].size())
      K = G[v].size();
    int cur = 1;
    for (int u : G[v])
    {
      if (used[u])
        continue;
      if (cur == cs[v])
        cur++; // 親の色と同じだったら
      cs[u] = I[make_pair(u, v)] = I[make_pair(v, u)] = cur++;
      used[u] = 1;
      que.emplace(u);
    }
  }
  cout << K << endl;
  for (auto p : vp)
  {
    cout << I[p] << endl;
  }
}


Measured memory_bytes: 20084
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if ( (a+b)==c || (b+c)==a || (c+a)==b )
			System.out.println("Yes");
		else System.out.println("No");
	}
}


Measured memory_bytes: 23636
#include<stdio.h>

int main(){
    int n= -1,x = -1;
    int i,j;
    int z;
    int c = 0;
    while(n != 0 || x != 0){
        scanf("%d %d",&n,&x);
        if(n != 0){
            for(i = 1; i < n-1; ++i){
                for(j = i + 1; j <n; ++j){
                    z = x - j - i;
                    if(z > j && z <= n){
                        c++;
                    }
                }
            }
            printf("%d\n",c);
            c = 0;
        }
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

const int MAX_N = 5e5 + 10, MAX_A = 1 << 20, MOD = 1e9 + 7;

int N, A[MAX_N], cnt[MAX_N];
ll ans, po2[MAX_N];
vector<int> app[MAX_A];

int main()
{
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> A[i], A[i] ^= A[i - 1];
    if (A[N])
    {
        int f[2] = {0, 1};
        for (int i = 1; i <= N; i++)
        {
            if (A[i] == A[N]) (f[0] += f[1]) %= MOD;
            else if (A[i] == 0) (f[1] += f[0]) %= MOD;
        }
        cout << f[1] << endl;
    }
    else
    {
        po2[0] = 1;
        for (int i = 1; i <= N; i++) po2[i] = po2[i - 1] * 2 % MOD;
        for (int i = 1; i <= N; i++) cnt[i] = cnt[i - 1] + (A[i] == 0);
        for (int i = 1; i <= N; i++) app[A[i]].push_back(i);
        ans = po2[cnt[N] - 1];
        for (int i = 1; i < MAX_A; i++)
        {
            ll sum = 0, sv = 0;
            for (vector<int>::iterator j = app[i].begin(); j != app[i].end(); j++)
            {
                ll f = (cnt[*j] * sum + MOD - sv + 1) % MOD;
                (sum += f) %= MOD;
                (sv += f * cnt[*j]) %= MOD;
            }
            (ans += sum) %= MOD;
        }
        cout << ans << endl;
    }
}

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

int main(){
  int X, A, B;
  cin >> X >> A >> B;

  if (abs(A - X) < abs(B - X)){
    cout << "A" << endl;
  }
  else
  {
    cout << "B" <<endl;
  }
  
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
void fast()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
}
int main(void)
{
	fast();
    ll int n,k;
    cin>>n>>k;
    
    vector<ll int> p(n,0);
    for(ll int i=0;i<p.size();i++)
    {
        cin>>p[i];
    }
    
     if(k>=n)
    {
           cout<<0<<endl;
    }
    
    else if(k==0)
    {
        ll int sum=0;
        for(ll int i=0;i<p.size();i++)
        {
            sum=sum+p[i];
        }
        cout<<sum<<endl;
    }
    
    else
    {
        sort(p.begin(),p.end());
        ll int sum2=0;
        ll int qw=n-k;
        for(ll int j=0;j<qw;j++)
        {
          sum2=sum2+p[j];   
        }
        cout<<sum2<<endl;
    }
}

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

ll mod = 998244353;
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll m,n,k;
    cin>>m>>n>>k;
    //n%=mod;
    m%=mod;
    ll ans = modpow(m,n);
    ll b[k]={}; // mCi中ちょうどi種類
    ll com[k]={}; com[0] = 1;
    ll in[k]={}; 
    COMinit();
    for(int i=1;i<k;i++){
        in[i] = modinv(i);
        com[i] = com[i-1] * ((m+1-i)%mod);
        com[i] %= mod;
        com[i] *= in[i];
        com[i] %= mod;
    }
    for(int i=1;i<k;i++){
        b[i] = modpow(i,n);
        for(int j=1;j<i;j++){
            b[i] += mod - (COM(i,j) * b[j])%mod;
            b[i] %= mod;
        }
    }
    ll t=0;
    for(int i=1;i<k;i++){
        t += (com[i] * b[i])%mod;
        t %= mod;
    }


    ans += mod - t;
    ans %= mod;
    cout << ans << endl;
    
}


Measured memory_bytes: 15184
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")


Measured memory_bytes: 2940
#include <stdio.h>
#include <bits/stdc++.h>
     
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
     
using namespace std;

const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int res = 0;
    rep(i, c, d+1)
        if (a <= i && i <= b) res++;

    cout << max(0, res-1) << endl;
    return 0;
}


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main() {
	string S, T;

	cin >> S;
	cin >> T;

	T.pop_back();

	if (S == T) {
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>

int main(){
  int r,c,a[101][101],i,j,sum=0;
  scanf("%d %d",&r,&c);
  for(i=0; i<101; i++){
    for(j=0; j<101; j++){
      a[i][j]=0;
    }
  }
  for(i=0; i<r; i++){
    for(j=0; j<c; j++){
      scanf("%d",&a[i][j]);
    }
  }
  for(i=0; i<r; i++){
    for(j=0; j<c; j++){
      a[r][j]+=a[i][j];
      a[i][c]+=a[i][j];
    }
  }//-----            
for(i=0; i<r; i++){
    for(j=0; j<c; j++){
      a[r][c]+=a[r][j];
      a[r][c]+=a[i][c];
    }
  }
  a[r][c]/=(r+c);
  for(i=0; i<=r; i++){
    for(j=0; j<=c; j++){
      if(j==c)printf("%d\n",a[i][j]);
      else printf("%d ",a[i][j]);
    }
  }
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll n;
    cin >> n;
    ll ans = INF;
    vi a(n);
    rep(i,n){
        cin >> a[i];
    }
    sort(all(a));
    for (ll i = a[0]; i <= a[n - 1];i++){
        ll tmp = 0;
        rep(j,n){
            tmp += (a[j] - i) * (a[j] - i);
        }
        chmin(ans, tmp);
    }
    print(ans);
}

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


int main()
{
 

    int x,y,z;
    cin>>x>>y>>z;//A:X,B:Y,C:Z

    //exchange A <->B
    int wk=x;
    x=y;
    y=wk;

    //exchange A <->C
    wk=x;
    x=z;
    z=wk;

    cout<<x<<" "<<y<<" "<<z<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define maxn 2005
#define MOD 1000000007
int n,m;
int a[maxn],b[maxn];
int dp[maxn][maxn];
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=m;i++) scanf("%d",&b[i]);
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            dp[i][j] = dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1];
            if (a[i]==b[j]) dp[i][j]+=dp[i-1][j-1]+1;
            if (dp[i][j]<0) dp[i][j]+=MOD;
            dp[i][j] %= MOD;

        }
    }
    printf("%d",(dp[n][m]+1)%MOD);
    return 0;
}

Measured memory_bytes: 15872