akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

int main() {

    int n;

    std::cin >> n;

    int p = 0, q = 0;

    for ( int i = 0; i < n; i++ ) {

        std::string s1, s2;

        std::cin >> s1 >> s2;

        if ( s1 == s2 ) p += 1, q += 1;
        if ( s1 > s2 )  p += 3;
        if ( s1 < s2 )  q += 3;
    }

    std::cout << p << " " << q << std::endl;

    return 0;
}



Measured memory_bytes: 3152
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

int f(ll n){
  int res = 1;
  while(n>=10){
    ++res;
    n /= 10;
  }
  return res;
}
int main() {
  ll n;
  cin >> n;
  int ans = f(n);
  for(ll i=2; i*i<=n; ++i){
    if(n%i==0) ans = min(ans,f(n/i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    char a,b;
    cin >> a >> b;
    if(a == b)cout << "H\n";
    else cout << "D\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ll n,m;
cin >>n>>m;
ll l[m],r[m];
for(ll i=0;i<m;i++) cin >>l[i]>>r[i];
ll table[n];
for (ll i = 0; i < n; i++) table[i] = 0;
for (ll i = 0; i <m; i++) {
  table[l[i]-1]++;
  table[r[i]]--;
}
// シミュレート
for (ll i = 0; i < n; i++) {
  if (0 < i) table[i] += table[i - 1];
}

ll ans=0;
for (ll i = 0; i < n; i++) {
  if (table[i]==m) ans++;
}
cout <<ans<<endl;
}


Measured memory_bytes: 2560
import math
import fractions
a, b = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors


def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


ans = 1
divs = make_divisors(fractions.gcd(a, b))
for num in divs:
    if is_prime(num):
        ans += 1
print(ans)

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

using namespace std;

const unsigned long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

long long dp[55];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string a, b;
    int n; cin >> n >> a >> b;

    for(int i = 0; i < n; ++i){
        if(i == 0){
            if(a[i] == b[i])
                dp[i] = 3;
            else
                dp[i] = 6;
        } else {
            if(a[i] == a[i - 1]){
                dp[i] = dp[i - 1];
                continue;
            }
            if(a[i] == b[i]){
                if(a[i - 1] == b[i - 1])
                    dp[i] = dp[i - 1] * 2 % MOD;
                else
                    dp[i] = dp[i - 1];
            } else {
                if(a[i - 1] == b[i - 1])
                    dp[i] = dp[i - 1] * 2 % MOD;
                else
                    dp[i] = dp[i - 1] * 3 % MOD;
            }
        }
    }

    cout << dp[n - 1] << "\n";


    return 0;
}


Measured memory_bytes: 256
#import math
#from decimal import *
#getcontext().prec = 28
a,b=input().split()
#a_ = Decimal(a)
#b_ = Decimal(b)
a = int(a)
b = int(float(b)*1000)
#print(round(Decimal(Decimal(a)*Decimal(b))))
ans = a*b
print(ans//1000)
#print(math.floor(Decimal(a)*Decimal(b)/Decimal(100.0)))

Measured memory_bytes: 9164
N = int(input())
V = list(map(int,input().split()))

V.sort()

if N==2:
    ans = (V[0]+V[1])/2
    print(ans)

else:
    seed = (V[0]+V[1])/2
    for i in range(2,N):
        seed += V[i] 
        ans = seed/2
        seed = ans
    print(ans)

Measured memory_bytes: 38600
#include<stdio.h>
int main(void)
{
int s,x,y;
	scanf("%d",&s);
	x=s/3600;
	s=s-3600*x;
	y=s/60;
	s=s-60*y;
	printf("%d:%d:%d\n",x,y,s);
	return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int n;
    cin >> n;
    vector<unsigned long long> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    unsigned long long res = 1;
    for (int i = 0; i < n; ++i) {
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
        if (1000000000000000000 / res < a[i]) {
            cout << -1 << endl;
            return 0;
        }
        res = res * a[i];
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4048
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include <iomanip>

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;


int main()
{
	int n,mn=1e9+5,mx=0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int x;
		cin >> x;
		mn=min(mn,x);
		mx=max(mx,x);
	}
	cout << mx-mn << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,m,k,l;
double A1[200005],A[200005],n,C[200005],maxx;
int main()
{
                      while(true) {
                      break;
                      a++;
                      b++;
                      c=0;
           }
	cin>>n>>k;
	for(long long i=1; i<=n; i++)
           cin>>A[i];
	for(long long i=1;i<=n;i++)
           A1[i]=((A[i]*(A[i]+1))/2)/A[i];
	C[1]=A1[1];                                                                                                                                                                                                                                                                                                                                                                                                 ////////////////////////////dfgsdfbsfgnsgn
	for(long long i=2;i<=n;i++)
	C[i]=C[i-1]+A1[i];
           while(true) {
                      break;
                      a++;
                      b++;
                      c=0;
           }
           while(true) {
                      break;
                      a++;
                      b++;
                      c=0;
           }
	for(long long i=1;i<=n-k+1;i++)
	maxx=max(maxx,C[i+k-1]-C[i-1]);
	std::cout<<std::setprecision(10)<<maxx<<endl;                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ////////////////////////////asdgasdgadfgadfgdfga
           while(true) {
                      break;
                      a++;
                      b++;
                      c=0;
           }	
           while(true) {
                      break;
                      a++;
                      b++;
                      c=0;
           }
}

Measured memory_bytes: 4992
#ABC-122-B
S = input()
ans = 0
tmp_ans = 0

for char in S:
    if char == "A" or char == "C" or char == "G" or char == "T":
        tmp_ans += 1
        ans = max(ans, tmp_ans)
    else:
        tmp_ans = 0
        
print(ans)

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

string s;
int cnt[100] = {0};

int main() {
  int x = 0;
  cin >> s;
  for(int i = 0; i < 4; ++i) ++cnt[s[i] - 'A'];
  for(int i = 0; i < 26; ++i)
    if(cnt[i] == 2) ++x;
  if(x == 2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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


#define li          long long int
#define uli         unsigned long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



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



    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;

void Main(){
    ll X, N;
    sll(X);
    sll(N);
    set<ll> ps;
    rep(i, N){
        ll a;
        sll(a);
        ps.insert(a);
    }

    bool not_found = true;
    ll diff = 0;
    ll ans;
    while(not_found){
        ans = X - diff;
        if(ps.find(ans)==ps.end()){
            break;
        }
        ans = X + diff;
        if(ps.find(ans)==ps.end()){
            break;
        }
        diff += 1;
    }

    cout << ans <<endl;

}

int main(){
    Main();
}

Measured memory_bytes: 3268
using System;
using System.Linq;

class Program
{
    public static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(p => long.Parse(p)).ToArray();
        long N = line[0];
        long M = line[1];
        long r = 0;
        long r_ = 1;
        long r__ = 0;
        bool k = true;
        bool[] broken = new bool[N + 1];

        for (long i = 0; i < M; i++)
        {
            broken[long.Parse(Console.ReadLine())] = true;
        }

        for (long i = 1; i <= N; i++)
        {
            if (broken[i])
            {
                r = 0;
            }
            else
            {
                r = r_ + r__;
                r = r % 1000000007;
            }
            r__ = r_;
            r_ = r;
        }

        Console.WriteLine(r);
        
    }

}

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

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define V vector<int>

using namespace std;
using ll = long long;

int main() {
    string S;
    IN(S);
    map<char, int> memo;
    REP(i, S.size()) {
        memo[S[i]]++;
        if(memo[S[i]] == 2) {
            OUT("no");
            return 0;
        }
    }
    OUT("yes");
}

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

#define LEFT 'L'
#define RIGHT 'R'

int main(void)
{
    string S;
    cin >> S;

    const int size = (int)S.size();
    vector<int> pairIndex(size, -1);
    int index = -1;
    // left
    for (int i = 0; i < size; i++) {
        if (S[i] == RIGHT)
            index = i;
        else
            pairIndex[i] = index;
    }
    // right
    for (int i = size - 1; i >= 0; i--) {
        if (S[i] == LEFT)
            index = i;
        else
            pairIndex[i] = index;
    }

    vector<int> ans(size, 0);
    for (int i = 0; i < size; i++) {
        if (S[i] == RIGHT) {
            int d = pairIndex[i] - i;
            if (d % 2 == 0)
                ans[pairIndex[i]]++;
            else
                ans[pairIndex[i] - 1]++;
        }
        else {
            int d = i - pairIndex[i];
            if (d % 2 == 0)
                ans[pairIndex[i]]++;
            else
                ans[pairIndex[i] + 1]++;
        }
    }
    //for (int i = 0; i < size; i++)
    //    cout << S[i] << (i == size - 1 ? '\n' : ' ');

    //for (int i = 0; i < size; i++)
    //    cout << pairIndex[i] - i << (i == size - 1 ? '\n' : ' ');

    for (int i = 0; i < size; i++)
        cout << ans[i] << (i == size - 1 ? '\n' : ' ');

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
  string s; cin >> s;
  if (s == "AKIHABARA" || s == "KIHABARA" || s == "AKIHBARA" || s == "AKIHABRA"
      || s == "AKIHABAR" || s == "KIHBARA" || s == "KIHABRA" || s == "KIHABAR"
      || s == "AKIHBRA" || s == "AKIHBAR" || s == "AKIHABR" || s == "KIHBRA"
      || s == "KIHBAR" || s == "KIHABR" || s == "AKIHBR" || s == "KIHBR") cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n; 
    cin >> n;

    int temp = n / 500 ;
    int rem = n % 500;
    int x = rem / 5;
    int ans = 0 ;

    ans += temp * 1000 + x * 5 ;

    cout << ans;


    return 0;

}


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


int main(void){
  char s[3];
  rep(i,3) cin >> s[i];
  bool a = 1;
  if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

def solve(A, B, C):
    # Uncomment the following if you want to check the input.
    i = [A,B,C]
    print(max(i)-min(i))

def readQuestion():
    ws = sys.stdin.readline().strip().split()
    A = int(ws[0])
    B = int(ws[1])
    C = int(ws[2])
    return (A, B, C,)

def main():
    solve(*readQuestion())

# Uncomment before submission
main()

Measured memory_bytes: 3060
use std::io::*;
use std::str::FromStr;
use std::collections::LinkedList;

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")
}

#[derive(Clone, Debug)]
struct Query {
    a: usize,
    b: usize,
}

fn main() {
    let n: u8 = read();
    let s: String = read::<String>().chars().map(|c| (((c as u8) - 65 + n) % 26 + 65) as char).collect();
    println!("{}", s);
}


Measured memory_bytes: 4352
#include "iostream"
#include "algorithm"
#include "vector"

int main(int argc, char const *argv[]) {
  /* input
  2 3
  0 1 1
  1 0 1
  1 4 0
  1 2
  3 3
   */

  int N, C;
  int res = 1<<30;
  std::cin >> N >> C;

  int D[C][C];
  int ct[3][C];

  for (size_t i = 0; i < C; i++) {
    /* code */
    for (size_t i2 = 0; i2 < C; i2++) {
      /* code */
      std::cin >> D[i][i2];
    }
  }

  for (size_t i = 0; i < 3; i++) {
    /* code */
    for (size_t j = 0; j < C; j++) {
      /* code */
      ct[i][j] = 0;
    }
  }

  for (size_t i = 0; i < N; i++) {
    /* code */
    for (size_t i2 = 0; i2 < N; i2++) {
      /* code */
      int col;
      std::cin >> col;
      ct[(i+i2)%3][col-1] += 1;
    }
  }

  for (size_t c1 = 0; c1 < C; c1++) {
    /* code */
    for (size_t c2 = 0; c2 < C; c2++) {
      /* code */
      if(c1 != c2){
        for (size_t c3 = 0; c3 < C; c3++) {
          /* code */
          if(c3 != c2 && c3 != c1){
            int tt = 0;

            for (size_t i = 0; i < C; i++) {
              /* code */
              tt += D[i][c1] * ct[0][i];
            }
            for (size_t i = 0; i < C; i++) {
              /* code */
              tt += D[i][c2] * ct[1][i];
            }
            for (size_t i = 0; i < C; i++) {
              /* code */
              tt += D[i][c3] * ct[2][i];
            }

            if (tt < res) {
              /* code */
              res = tt;
            }

          }
        }
      }
    }
  }

  std::cout << res << '\n';
  return 0;
}


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

int main(){
    int N;  cin >> N;
    vector<int> L(N);
    for(int i=0; i<N; i++)
        cin >> L[i];
    L.push_back(1e9);
    sort(L.begin(), L.end());

    int ans = 0;
    for(int i=0; i<N-2; i++) for(int j=i+1; j<N-1; j++){
        int a = L[i], b = L[j];
        
        int lower = lower_bound(L.begin() + j + 1, L.end(), b) - L.begin();
        int upper = lower_bound(L.begin() + j + 1, L.end(), a+b) - L.begin() - 1;
        if(lower <= upper)
            ans += upper - lower + 1;
    }
    cout << ans << endl;
}

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

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

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt(); // > 0, odd, up to 3000

            double[] dp = new double[(N / 2) + 1];
            // dp[i] = probability of having i tails
            dp[0] = 1;
            for (int coin = 0; coin < N; coin++)
            { // coins
                double p_tails = 1 - in.nextDouble();
                for (int i = (N / 2); i >= 0; i--)
                {
                    if (i - 1 >= 0)
                    {
                        dp[i] = dp[i - 1] * p_tails + dp[i] * (1 - p_tails);
                    } else
                    {
                        dp[i] = +dp[i] * (1 - p_tails);
                    }
                }
            }
            double sum = 0;
            for (int tails = 0; tails <= N / 2; tails++)
            {
                sum += dp[tails];
            }
            out.print(sum);
        }

    }
}



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

int main(){

	int m, f, r;

	while(1){
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1){
			break;
		}else if(m == -1 || f == -1){
			cout << 'F' << endl;
		}else if((m + f) >= 80){
			cout << 'A' << endl;
		}else if((m + f) >= 65){
			cout << 'B' << endl;
		}else if((m + f) >= 50){
			cout << 'C' << endl;
		}else if((m + f) >= 30){
			if(r >= 50){
				cout << 'C' << endl;
			}else{
				cout << 'D' << endl;
			}
		}else{
			cout << 'F' << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1152
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize, m: usize,
        a: [chars; n],
        b: [chars; m],
    }

    for i in 0..n - m + 1 {
        for j in 0..n - m + 1 {
            let mut ok = true;
            for k in 0..m {
                for l in 0..m {
                    ok &= a[i + k][j + l] == b[k][l];
                }
            }
            if ok {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
    
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


int main(void){
    ll n;
    cin >> n;
    string res;
    rep(i,32) {
        ll sign = (i%2==0 ? +1 : -1);
        if (n%(1LL<<(i+1))==0){
            res += "0";
        } else {
            res += "1";
            n -= sign * bit(i);
        }
        if (n == 0) break;
    }
    reverse(all(res));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
A,B=map(int, input().split())
k=0
if A<B:
  k=A+(B-A)/2
  if (B-A)//2==(B-A)/2:
    print(int(k))
  else:
    print("IMPOSSIBLE")
else:
  k=A-(A-B)/2
  if (A-B)//2==(A-B)/2:
    print(int(k))
  else:
    print("IMPOSSIBLE")

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

int N;

int a[110];

int main(void)
{
    cin >> N;

    double ave=0.0;

    double min=110.0;

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

        ave+=a[i];
    }

    ave=ave/N;

    // cout << ave << endl;

    int ans=0;

    for(int i=0;i<N;i++)
    {
        if(min>abs(ave-a[i]))
        {
            // cout << ans << endl;

            min=abs(ave-a[i]);

            ans=i;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define strep(it,v) for(it=v.begin();it!=v.end();++it)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
#define rs resize
ll modexp(ll a,ll b){ ll res = 1;  while(b>0){  if(b&1)  res = (res*a)%mod;  a = (a*a)%mod;  b/=2;  }  return res; }
int main()
{
   std::ios::sync_with_stdio(false);
   ll n,i,a,A = 0,B = 0,ch = 0;
   cin>>n;
   set<ll> s;
   map<ll,ll> mp;
   rep(i,0,n) cin>>a,mp[a]++,s.insert(a);
   bool flag = false;
   for(set<ll>::reverse_iterator it = s.rbegin();it != s.rend();it++)
   {
      if(mp[*it] > 3 and !flag){
         A = B = *it;
         break;
      }
      if(mp[*it] > 1)
      {
        flag = true;
        if(ch == 0)
         A = *it;
        else
         B = *it;
        ch++;
        if(ch == 2)
         break;
      }
   }
   cout<<A*B;
   return 0;
}


Measured memory_bytes: 11264
// acdart
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <string>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
/*********default*********/

long long a[100010], b[100010];

int main()
{
	int n;
	
	while (~scanf("%d", &n)){
		for (int i = 0; i < n; i++){
			scanf("%lld%lld", &a[i], &b[i]);
		}	
		long long x = 0;
		for (int i = n - 1; i >= 0; --i){
			a[i] += x;
			if (a[i] % b[i] != 0){
				x += (b[i] - a[i] % b[i]);
			}
		}
		printf("%lld\n", x);
	}
	return 0;
} 

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
#define INF 100000000
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> p;
typedef vector<int> vi;
set <int> st;
int n,m,r;
int dif[205][205];
int main(int argc,char const* argv[])
{
  cin >> n >> m >> r;
  vector<int> R(r);
  for(int i=0;i<n;i++)
    {
      for(int j=0;j<n;j++)
	{
	  if(i==j) dif[i][j]=0;
	  else dif[i][j]=200000009;
	}
    }
  for(int i=0;i<r;i++)
    {
      int tmp;
      cin >> tmp;
      tmp--;
      R[i]=tmp;
    }
  for(int i=0;i<m;i++)
    {
      int a,b,c;
      cin >> a >> b >> c;
      a--,b--;
      dif[a][b]=c;
      dif[b][a]=c;
    }

  for(int k=0;k<n;k++)
    {
      for(int i=0;i<n;i++)
	{
	  for(int j=0;j<n;j++)
	    {
	      dif[i][j]=min(dif[i][j],dif[i][k]+dif[k][j]);
	    }
	}
    }
  ll ans=10000000000000;
  ll tmp=0;
  sort(R.begin(),R.end());
  do
    {
      tmp=0;
      for(int i=0;i<R.size()-1;i++)
	{
	  tmp+=dif[R[i]][R[i+1]];
	}

      if(tmp<=ans) ans=tmp;
    }
  while(next_permutation(R.begin(),R.end()));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
int main()
{
  string s; cin >> s;
  stack<char > v;
  int n = s.size();
  int ans = n;
  REP(i,n){
    if(s[i] == 'S'){
      v.push(s[i]);
    }else{
      if(!v.empty()&&v.top() == 'S'){
	v.pop();
	ans -= 2;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int n; cin >> n;
  Graph G(n, vi(2));
  rep(i,n) rep(j,2) cin >> G[i][j];

  sort(all(G));

  int a = 0, b = -1;
  int a_end = n - 1;
  bool zero = false;

  rep(i,n) {
    if (b == -1) {
      if (G[a][1] < G[i][0]) {
        b = i;
        a_end = i - 1;
      }
      else if (G[i][1] <= G[a][1]) {
        a = i;
      }
    }

    else {
      if (G[i][0] > G[b][1]) {
        zero = true;
        break;
      }
      else if (G[i][1] <= G[b][1]) {
        b = i;
      }
    }
  }

  int ans = 0;
  rep(i,n) ans = max(ans, G[i][1] - G[i][0] + 1);

  if (zero) {
    cout << ans << endl;
    return 0;
  }

  if (b == -1) {
    ans += G[a][1] - G[n-1][0] + 1;
    b = n - 1;
  }

  int b_right = G[b][1];

  for (int i=a_end; i>=a; --i) {
    if (G[i][1] < b_right) {
      ans = max(ans, (G[a][1] - G[i][0] + 1) + (b_right - G[n-1][0] + 1));
      b_right = G[i][1];
    }
    if (G[i][1] < G[n-1][0]) break;
  }

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


Measured memory_bytes: 5760
#include <iostream>

using namespace std;

int main()
{
    int n;

    while (cin >> n, n) {
        int cnt = 0;

        while (n > 1) {
            if (n % 2) 
                n = 3 * n + 1;
            else
                n /= 2;
            cnt++;
        }
        cout << cnt << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)

#A
def A():
    return

#B
def B():
    return

#C
def C():
    s = S()
    t = S()
    n = len(s)
    d = defaultdict(list)
    for i in range(n):
        d[s[i]].append(t[i])
    d2 = defaultdict(list)
    for i in range(n):
        d2[t[i]].append(s[i])
    for i in d.keys():
        k = d[i]
        k = list(set(d[i]))
        if len(k) > 1:
            print("No")
            quit()
    for i in d2.keys():
        k = d2[i]
        k = list(set(d2[i]))
        if len(k) > 1:
            print("No")
            quit()
    print("Yes")
#D
def D():
    n,m = LI()
    if m == 1:
        print(1)
        quit()
    d = defaultdict(int)
    i = 2
    a = m
    while i**2 <= m:
        if not a%i:
            while not a%i:
                a//=i
                d[i] += 1
        i += 1
    if a != 1:
        d[a] += 1
    fact = [1 for i in range(n+31)]
    for i in range(n+30):
        fact[i+1] = fact[i]*(i+1)%mod
    inv_fact = [None for i in range(n+31)]
    inv_fact[n+30] = pow(fact[n+30],mod-2,mod)
    for i in range(n+30)[::-1]:
        inv_fact[i] = inv_fact[i+1]*(i+1)%mod
    ans = 1
    for i in d.values():
        ans *= fact[i+n-1]*inv_fact[i]*inv_fact[n-1]%mod
        ans %= mod
    print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 46644
s = int(input())
a_list = [s]
i = 0
ans = -1
while (ans==-1):
    if a_list[i]%2==0:
        a_list.append(a_list[i]//2)
    else:
        a_list.append(3*a_list[i]+1)
    i += 1
    for j in range(len(a_list)-1):
        if a_list[i]==a_list[j]:
            ans = i
            break
print(ans+1)

Measured memory_bytes: 3064
#include <iostream>

int solv(int A, int B, int K) {
  int k=0;

  for (int i=std::max(A, B); i>0; i--) {
    if (A%i == 0 && B%i ==0) k++;
    if (k == K) return i;
  }

  return 100;
}

int main() {
  int A, B, K;

  std::cin >> A >> B >> K;

  std::cout << solv(A, B, K) << std::endl;

  return 0;
}


Measured memory_bytes: 256
import bisect
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A.sort()
    C.sort()

    ans = 0
    for b in B:
        cnt_a = bisect.bisect_left(A, b)
        cnt_c = N - bisect.bisect_right(C, b)
        ans += cnt_a * cnt_c
        # print(str(cnt_a) + "*" + str(cnt_c))
    
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 92644
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int dfs (const int depth, const int sum, int currs, int currd, int j)
{
	int count = 0;
	int i;

	if (currd == depth){
		if (sum == currs){
			return 1;
		}else{
			return 0;
		} // end if
	} // end if
	++currd;
	
	for (i = j; i <= min(9,sum); ++i){
		currs += i;
		count += dfs (depth, sum, currs, currd, i+1);
		currs -= i;
	} // end for

	return count;
}
 

int main()
{
//	cut here before submit 
//	freopen("testcase.si", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){
		int n, sum;
		int res = 0;
		stringstream ss(str);
		ss >> n >> sum;

		if (n == 0 && sum == 0){
			break;
		} // end if
		
		res = dfs (n, sum, 0, 0, 0 );

		cout << res << endl;
	} // end while
	
	return 0;
}

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

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {

  ll N,ans=0;
  cin>>N;
  
  for(auto p : prime_factor(N)) {
      
      ll k=p.second;
      ll j=1;
      for(ll i=1;i<=k;i+=j){
          ans++;
          j++;
      }
      
      //cout << " " << p.first<<" "<<p.second<<endl;
  }
      
     
      //cout << " " << p.first<<" "<<p.second;
     // a.at()
   // while(p.second--) cout << " " << p.first<<" "<<p.second;
    
   cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
int pop();
void push(int x);
int top=0;
int S[100];
int main(void){
    char a[101];
    int x,y;

    while(scanf("%s",a)!=EOF){
        if(a[0]=='+'){
            x=pop();
            y=pop();
            push(y+x);
        }else if(a[0]=='-'){
            x=pop();
            y=pop();
            push(y-x);
        }else if(a[0]=='*'){
            x=pop();
            y=pop();
            push(y*x);
        }else{
            push(atoi(a));
        }
    }
    printf("%d\n",pop());
    return 0;
}

int pop(){
    top--;
    return S[top+1];
}

void push(int x){
    top++;
    S[top]=x;
}


Measured memory_bytes: 2128
fun main(args: Array<String>) {
    // Your code here!
    var n = readLine()!!
    var n1 = n[n.length-1] 
    var msg = ""

    if(n1=='2' || n1=='4' || n1=='5' || n1=='7' || n1=='9'){
        msg = "hon"
    }else if(n1=='0' || n1=='1' || n1=='6' || n1=='8'){
        msg = "pon"
    }else{
        msg = "bon"
    }
    
    println(msg)
}


Measured memory_bytes: 34456
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define vv(Type,Name, n,m,d)vector<vector<Type>> Name(n, vector<Type>(m, d))
#define P pair
using namespace std;
using ll = long long;


int main(void) {

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

	int n;
	cin >> n;
	vector<int> r(n),w(n); //0:red,1:white;
	string str;
	cin >> str;

	if (str[0] == 'W') w[0] = 1;
	else r[0] = 1;



	for(int i = 1;i < n;i++){
		r[i] = r[i - 1];
		w[i] = w[i - 1];
		if (str[i] == 'W') w[i] += 1;
		else r[i] += 1;
	}

	int allred = w[n-1];
	int allwhi = r[n-1];

	int move = r[n-1] ? w[r[n - 1] - 1] : 0;

	int ans = min(allred, allwhi);
	ans = min(ans, move);

	cout << ans << endl;
	



	return 0;
}


Measured memory_bytes: 5180
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<functional>
#include<queue>
using namespace std;
#define INF 1000000007
typedef pair<int, int> P;

struct edge { int to, cost; };
int d[5005];
P cst[5005];
bool used[5005];

vector<edge>graf[5005];
vector<edge>G[5005];

int main() {
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		cst[i] = P(a, b);
	}
	for (int i = 0; i < k; i++) {
		int a, b;
		cin >> a >> b;
		graf[a - 1].push_back({ b - 1,1 });
		graf[b - 1].push_back({ a - 1,1 });
	}

	for (int ia = 0; ia < n; ia++) {//bfs
		queue<P>q;
		fill(d, d + n, INF);
		d[ia] = 0;
		q.push(P(0, ia));

		while (q.size()) {
			P p = q.front();
			q.pop();
			int v = p.second;
			if (d[v] < p.first)continue;
			for (int i = 0; i < graf[v].size(); i++) {
				edge e = graf[v][i];
				if (d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					q.push(P(d[e.to], e.to));
				}
			}
		}
		for (int i = 0; i<n; i++) {
			if (i == ia) {
				G[ia].push_back({ i,0 });
				continue;
			}
			if (d[i]>cst[ia].second)continue;
			G[ia].push_back({ i,cst[ia].first });
		}
	}

	//dijkstra ElogV=36989
	priority_queue<P, vector<P>, greater<P> >Q;
	fill(d, d + n, INF);
	d[0] = 0;
	Q.push(P(0, 0));

	while (Q.size()) {
		P p = Q.top();
		Q.pop();
		int v = p.second;
		if (d[v]<p.first)continue;
		for (int i = 0; i<G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to]>d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				Q.push(P(d[e.to], e.to));
			}
		}
	}

	cout << d[n - 1] << endl;

	return 0;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
double A; cin >> A;
ll cnt = 0;
FOR(i,1,A) if(i%2!=0) cnt++;
cout << cnt/A;
}

Measured memory_bytes: 3800
use io::*;
use std::*;

fn solve(N: i64, W: i64, w: Vec<i64>, v: Vec<i64>) {
    let max = 100001i64;
    let mut dp = vec![1e18 as i64 + 5; max as usize];
    dp[0] = 0;
    for (weight, value) in w.iter().zip(v.iter()) {
        for i in (0i64..max).rev() {
            if i  - (*value) < 0 {
                break;
            }
            dp[i as usize] = cmp::min(dp[i as usize], dp[(i - *value) as usize] + *weight);
        }
    }
    for i in (0i64..max).rev() {
        if (dp[i as usize] <= W) {
            println!("{}", i);
            break;
        }
    }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
    let con = read_string();
    let mut scanner = Scanner::new(&con);
    let mut N: i64;
    N = scanner.next();
    let mut W: i64;
    W = scanner.next();
    let mut w: Vec<i64> = vec![0i64; (N) as usize];
    let mut v: Vec<i64> = vec![0i64; (N) as usize];
    for i in 0..(N) as usize {
        w[i] = scanner.next();
        v[i] = scanner.next();
    }
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(move || solve(N, W, w, v)).unwrap().join().unwrap();
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            int N = int.Parse(line);
            line = Console.ReadLine();
            string[] strs = line.Split(' ');

            var hash = new HashSet<string>();
            for(int i = 0; i < N; i++)
            {
                if (hash.Contains(strs[i]))
                {
                    Console.WriteLine("NO");
                    return;
                }
                hash.Add(strs[i]);
            }


            Console.WriteLine("YES");
        }
    }
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t n; cin>>n;
	int ans=1e10;
	for(int64_t i=1;i*i<=n;++i){
		if(n%i==0){
			int64_t t=max(n/i,i);
			int tans=0;
			while(t){
				t/=10;
				++tans;
			}
			ans=min(ans,tans);
		}
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3620
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,m,ans;
int main()
{
    scanf("%lld%lld",&n,&m);
    if(n==m){
        puts("1");
        return 0;
    }
    ll p=60;
    while(p>=0&&(n>>p)%2==(m>>p)%2)
        p--;
    n&=(1ll<<(p+1))-1;
    m&=(1ll<<p)-1;
    ans+=(1ll<<p)-n;
    int s=0;
    while(m){
        s++;
        m>>=1;
    }
    ans+=1ll<<s;
    n=max(n,1ll<<s);
    ans+=(1ll<<p)-n;
    printf("%lld\n",ans);
}


Measured memory_bytes: 128
import math


k = int(input())

sum_gcd = 0

for a in range(1, k + 1):
    for b in range(1, k + 1):
        gcd_ab = math.gcd(a, b)

        for c in range(1, k + 1):
            sum_gcd += math.gcd(gcd_ab, c)

print(sum_gcd)


Measured memory_bytes: 9076