akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_DISABLE_PERFCRIT_LOCKS
#define POPCNTI(a) __builtin_popcount(a)
#define fs  first  
#define sc  second
#define ARR array
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
 
 
#include <bits/stdc++.h>
using namespace  __gnu_pbds; 
using namespace std;
 
 
// #ifndef _LOCAL_DEFINE
// inline int getchar_unlocked(){return _getchar_nolock();}
// inline void putchar_unlocked(char c) {_putchar_nolock(c);}
// #endif
 
typedef long long ll;  
inline void WRITE_CHAR(char c)  {putchar_unlocked(c);} 
template<typename T> 
inline bool READn (T &result) {
  int minus = 1;
  char ch;
  result=0;
  ch = (char) getchar_unlocked();
  while (!isdigit(ch) && ch!=EOF) minus = (ch == '-'? -1 : minus),ch= (char) getchar_unlocked();
 
  if(ch==EOF) return false;
  while (isdigit(ch))  result = result*10 + (int) (ch - '0'),ch = (char) getchar_unlocked();
  
  result *= minus;
  return ch != '\n';
}
template<typename T>
inline void WRITEn(T x) {
  if (x < 0) {putchar_unlocked('-'); x = -x; }
  char writeBuffer[20], *writePtr = writeBuffer;
  do {
    *writePtr++ = (char)('0' + x % 10);
    x /= 10;
  }
  while (x);
  do  { putchar_unlocked(*--writePtr); }
  while (writePtr > writeBuffer);
}
inline bool Read_CHAR(char &c)
{
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  c = READ_CHARACTER;
  return true;
} 
inline bool READ_CHAR_ARRAY(char *x) {
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  char *ptr = &x[0];
  while ((READ_CHARACTER != '\n' && READ_CHARACTER != '\t' && READ_CHARACTER != ' ' && READ_CHARACTER != EOF)) *ptr++ = READ_CHARACTER, READ_CHARACTER = (char)getchar_unlocked();
 
  *ptr = '\0';
  return true;
}
inline void WRITE_CHAR_ARRAY(const char *x) {
  while(*x != '\0')
    putchar_unlocked(*x++);
}
inline void WRITE_STRING(string &x) {
  for(char c: x) 
    putchar_unlocked(c);
}
const ll OOl = 1e18 ;
const int N = 1e6+1,OO = 1e9,OOm = 0x3f3f3f3f, MOD = 1e9 + 7;
map<string,int> mp;
void print(string x)
{
  WRITE_STRING(x);
  WRITE_CHAR_ARRAY(" x ");
  WRITEn(mp[x]);
  WRITE_CHAR('\n');
}
int main()
{
  mp["AC"]=0;
  mp["TLE"]=0;
  mp["WA"]=0;
  mp["RE"]=0;

  char str[N];
  int n;
  READn(n);
  
  while(n--)
  {
    READ_CHAR_ARRAY(str);
    mp[str]++;
  }
  print("AC");
  print("WA");
  print("TLE");
  print("RE");
  
  return 0;
}
 
 

Measured memory_bytes: 3640
#include <stdio.h>

void saiki(int x, int y);

int n,B[20],g=0;

int main(){
  int q,i;
  
  scanf("%d",&n);
  
  int A[20];
  
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    B[i]=A[i];
  }
  
  scanf("%d",&q);

  int M[200];
  
  for(i=0;i<q;i++){
    scanf("%d",&M[i]);
  }

  for(i=0;i<q;i++){
    saiki(0,M[i]);
    if(g==0)printf("no\n");
    g=0;
  }

  return 0;
}

void saiki(int x, int y){
  int z;
  if(y==0){
    printf("yes\n");
    g=1;
  }
  if(x<n&&g==0)saiki(x+1,y);
  if(B[x]<=y&&x<n&&g==0)saiki(x+1,y-B[x]);
}
    



Measured memory_bytes: 2104
#include<stdio.h>
int main()
{
  int a,b,i,j;
  while(1)
	   {
  scanf("%d%d",&a,&b);
  if(a==0&&b==0){break;}

  for(i=1;i<=a;i++)
    {
      for(j=1;j<=b;j++)
	{
	  if(j%2==1)
	    {
	      if(i%2==1)printf("#");
	      else printf(".");
	    }
	  else 
	    {
              if(i%2==1)printf(".");
	      else printf("#");
	    }
	}
      printf("\n");
    }
  printf("\n");
    
	   }
  return 0;
}


Measured memory_bytes: 2052
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	public static void main(String[] args) {

		int x =sc.nextInt();
		int a=x/2+x%2;
		p(a);
		
	}
}

Measured memory_bytes: 20948
import java.util.Scanner;


// 145_a
public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        String s = scan.next();
        String t = scan.next();
        int count = 0;

        for (int i = 0; i < 3; i++) {
            if (s.charAt(i) == t.charAt(i)) {
                count++;
            }
        }

        System.out.println(count);

    }

}


Measured memory_bytes: 23764
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
#include <queue>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;



int main() {
	long long n;
	cin >> n;
	string s;
	int a, b, c, d;
	a = 0;
	b = 0;
	c = 0;
	d = 0;
	rep(i, n) {
		cin >> s;
		if (s == "AC")a++;
		if (s == "WA")b++;
		if (s == "TLE")c++;
		if (s == "RE")d++;
	}
		
	cout << "AC x " << a << endl;
	cout << "WA x " << b << endl;
	cout << "TLE x " << c << endl;
	cout << "RE x " << d << endl;
}

Measured memory_bytes: 3632
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  auto p = minmax_element(all(a));
  cout << *p.second - *p.first << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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 (a>b) { a=b; return 1; } return 0; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    reverse(bit.begin(), bit.end());
    return bit;
}

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    ll X = 0;
    for(int i=2;i<N;i++) X ^= A[i];

    ll S = A[0] + A[1];

    if(S<X or (S-X)%2 != 0){
        cout << -1 << endl;
        return 0;
    }

    if((X^A[0]^A[1])==0){
        cout << 0 << endl;
        return 0;
    }

    ll tar = 0;
    ll Z = (S-X)/2;
    ll y = A[0];

    if(Z&X){
        cout << -1 << endl;
        return 0;
    }

    if(Z>y){
        cout << -1 << endl;
        return 0;
    }

    // dump(y)
    // dump(X)
    // dump(Z)

    // cout << num2bit(X, 50) <<  endl;
    // cout << num2bit(S, 50) <<  endl;
    // cout << num2bit(Z, 50) <<  endl;
    // cout << num2bit(A[0], 50) <<  endl;
    // cout << num2bit(A[1], 50) <<  endl;
    // cout << num2bit(A[2], 50) <<  endl;

    for(int i=49;i>=0;i--){
        if(X>>i & 1){
            ll tmp = tar + (1ll<<i);
            if((tmp^Z)<=y){
                tar += (1ll<<i);
            }
        }
    }
    // dump(tar)
    tar ^= Z;

    if(tar==0){
        cout << -1 << endl;
        return 0;
    }else{
        cout << A[0] - tar << endl;
    }

    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

vector <ll> v;

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	//freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

	ll n,i,m,j,k,x,y,a,b,t;
	string s;
	
	cin >> a >> b >> t;
	cout << t*((a+b-1)/b);

	return 0;
}


Measured memory_bytes: 3636
import sys

N = int(sys.stdin.readline())
TXY = [
    tuple(map(int, sys.stdin.readline().split())) for _ in range(N)
]

def check(st, sx, sy, et, ex, ey):
    timespan = et - st
    diff = abs(sx - ex) + abs(sy - ey)
    if diff > timespan:
        return False
    if (timespan - diff) % 2 == 0:
        return True
    return False


def main():
    TXY.insert(0, (0, 0, 0))
    for i in range(len(TXY) - 1):
        args = TXY[i] + TXY[i + 1]
        if not check(*args):
            print('No')
            return
    print('Yes')

main()

Measured memory_bytes: 17312
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    N,M = i_map()
    s = abs(N-M)
    z = 10**9 + 7

    if s >= 2:
        print(0)
        exit()

    if s == 0:
        a = math.factorial(N)
        print(a**2*2%z)
    else:
        a = math.factorial(N)
        b = math.factorial(M)
        print(a*b%z)

if __name__=="__main__":
    main()


Measured memory_bytes: 86568
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REP(i,a,b) for(ll i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
    string S;
    ll sum=0;
    cin >> S;
    ll t=0;
    for (ll bit = 0; bit < (1<<(S.size()-1)); ++bit) {  // 0~2^N-1 までのbit 全探索
        vector<ll> V;
        V.pb(-1);
        for (ll i = 0; i < (S.size()); ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                V.push_back(i);
            }
        }
        V.pb(S.size());
        rep(j,V.size()-1){
            sum+=stoll(S.substr(V[j]+1,V[j+1]-V[j]));
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var c = 0;
		for (var n = 1; n <= 9; n++) foreach (var x in Calc(n)) if (x <= N) c++;
		WriteLine(c);
	}
	int[] hoge = { 3, 5, 7 };
	IEnumerable<long> Calc(int n)
	{
		var t = new int[n];
		while (true)
		{
			var x = 0;
			var s = new HashSet<int>();
			foreach (var c in t) { x = 10 * x + hoge[c]; s.Add(c); }
			if (s.Count == 3) yield return x;
			var i = 0;
			while (i < n && t[i] == 2) i++;
			if (i == n) yield break;
			for (var j = 0; j < i; j++) t[j] = 0;
			t[i]++;
		}
	}
}


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

const int N = 200005;

int n;
int h[N], a[N];
long long f[N];
long long ans = 0;

void upd(int p,long long v) {
	for (; p <= n; p += p & -p) {
		f[p] = max(f[p], v);
	}
}

long long get(int p) {
	long long res = 0;
	for (; p > 0; p -= p & -p) {
		res = max(res, f[p]);
	}
	return res;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", h + i);
	}
	for (int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
	}
	for (int i = 1; i <= n; ++i) {
		long long now = a[i] + get(h[i]);
		ans = max(ans, now);
		upd(h[i], now);
	}	
	printf("%lld\n", ans);
}

Measured memory_bytes: 3328
use io::*;
use std::cmp::min;

struct BIT {
    v: Vec<i64>,
}

impl BIT {
    fn new(n: usize) -> BIT {
        BIT { v: vec![0; n + 1] }
    }

    fn sum(&self, i: usize) -> i64 {
        if i == 0 {
            0
        } else {
            let ii = i as i64;
            self.v[i] + self.sum(i - (ii & (-ii)) as usize)
        }
    }

    fn add(&mut self, i: usize, x: i64) {
        if i < self.v.len() {
            self.v[i] += x;
            let ii = i as i64;
            self.add(i + (ii & (-ii)) as usize, x);
        }
    }
}

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let n: usize = sc.next();
    let s: String = sc.next();
    let s: Vec<char> = s.chars().collect();

    let mut ws = BIT::new(n);
    let mut es = BIT::new(n);

    for i in 1..n + 1 {
        ws.add(i, if s[i - 1] == 'W' { 1 } else { 0 });
        es.add(i, if s[i - 1] == 'E' { 1 } else { 0 });
    }

    let mut ans = (n + 1) as i64;
    for i in 1..n + 1 {
        let l = if i == 1 { 0 } else { ws.sum(i - 1) };
        let r = if i == n { 0 } else { es.sum(n) - es.sum(i) };

        let cur = l + r;
        ans = min(ans, cur);
    }

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

//-----

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: 14588
n=int(input())
s,t=map(str,input().split())
j=0
k=0
r=[0 for i in range(2*n)]
for i in range(0,2*n,2):
  r[i]=s[j]
  j+=1
  
for i in range(1,2*n+1,2):
  r[i]=t[k]
  k+=1
  
print("".join(r))

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int n,i,j,sum=0;
    cin>>n;
    int b[n-1];
    for(i=0; i<n-1;i++)
    {
        cin>>b[i];
    }
    int a[n];
    a[0]= b[0];
    for(i=1; i<n; i++){
        a[i]=min(b[i],b[i-1]);
    }
    a[n-1]= b[n-2];
      for(j=0; j<n; j++){
        sum =sum+ a[j];
    }
    cout<<sum;
    return 0;
}


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

int main() {
    int n; scanf("%d", &n);
    vector<int> p(n), fc(n + 1, 1), iv(n + 1, 1), used(n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &p[i]);
        if (--p[i] >= 0) used[p[i]] = 1;
    }

    constexpr int kMod = 1'000'000'000 + 7;
    auto fpow = [&](int a, int n) {
        int res = 1;
        while (n > 0) {
            if (n & 1) res = 1LL * res * a % kMod;
            a = 1LL * a * a % kMod;
            n >>= 1;
        }
        return res;
    };

    for (int i = 1; i <= n; ++i) {
        fc[i] = 1LL * fc[i - 1] * i % kMod;
        iv[i] = fpow(fc[i], kMod - 2);
    }

    auto Choose = [&](int n, int k) {
        if (k < 0 || n < k) return 0LL;
        return 1LL * fc[n] * iv[k] % kMod * iv[n - k] % kMod;
    };

    int ans = fc[count(p.begin(), p.end(), -1)];
    vector<int> unused;
    for (int i = 0; i < n; ++i) {
        if (!used[i]) unused.push_back(i);
    }
    
    vector<int> fw(n + 1);

    auto Modify = [&](int p, int v) {
        for (int i = p + 1; i <= n; i += i & -i) fw[i] += v;
    };

    auto Query = [&](int p) {
        int res = 0;
        for (int i = p + 1; i > 0; i -= i & -i) res += fw[i];
        return res;
    };

    const int m = unused.size();
    for (int i = 0; i < n; ++i) if (~p[i]) Modify(p[i], 1);

    int sp = 0, ts = 0;
    for (int u : unused) (ts += Query(u)) %= kMod;
    for (int i = 0; i < n; ++i) {
        if (p[i] != -1) {
            Modify(p[i], -1);
            int s = lower_bound(unused.begin(), unused.end(), p[i]) - unused.begin(), t = Query(p[i] - 1);
            (ans += 1LL * (m - sp) * fc[m - 1] % kMod * fc[n - 1 - i] % kMod * s % kMod) %= kMod;
            (ans += 1LL * fc[m] * t % kMod * fc[n - i - 1] % kMod) %= kMod;
            (ts += kMod - (m - s)) %= kMod;
        } else {
            if (m >= 2) {
                int tk = 1LL * m * (m - 1) / 2 % kMod;
                (ans += 1LL * (m - sp - 1) * fc[m - 2] % kMod * fc[n - 1 - i] % kMod * tk % kMod) %= kMod;
            }
            (ans += 1LL * fc[m - 1] * ts % kMod * fc[n - i - 1] % kMod) %= kMod;
            sp++;
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 12272
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int factors[100];
int divs[100];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 2; i <= n; ++i)
    {
        int m = i;
        for (int j = 2; j <= m; ++j)
            while (m % j == 0)
                factors[j]++, m /= j;
    }
    vi a, b, c, d;
    int sol = 0;
    for (int i = 2; i <= n; ++i)
    {
        if (factors[i] >= 74)
            sol++;
        if (factors[i] >= 24)
            d.push_back(i);
        if (factors[i] >= 14)
            c.push_back(i);
        if (factors[i] >= 4)
            b.push_back(i);
        if (factors[i] >= 2)
            a.push_back(i);
    }
    for (int x : b)
        for (int y : c)
            if (x != y)
                sol++;

    for (int x : a)
        for (int y : d)
            if (x != y)
                sol++;

    int sol2 = 0;
    for (int x : a)
        for (int y : b)
            for (int z : b)
                if (x != y && y != z && z != x)
                    sol2++;

    cout << sol + sol2 / 2;
}


Measured memory_bytes: 256
#include<stdio.h>
//#include<windows.h>

int n,m,ans,lake[100][100];
int x[4] = {0,1,0,-1},y[4] = {-1,0,1,0};
/*
void print(){
	system("cls");
	for(int i = 0 ; i < n ;i++){
		for(int j = 0; j < m;j++){
			if(lake[i][j]){
				printf("¡");
			}else {
				printf(" ");
			}
		}puts("");
	}
	Sleep(200);
}
*/


void func(int i,int j,int c){
	lake[i][j] = 0;
//	print();
	if(c > ans)ans=c;
	
	for(int k = 0;k < 4; k++){
		if(lake[i+x[k]][j+y[k]] && i+x[k] >= 0 && i+x[k] < n && j+y[k] >= 0  && j+y[k] < m){
			func(i+x[k],j+y[k],c+1);
			lake[i+x[k]][j+y[k]] = 1;
		}
	}
	lake[i][j] = 1;
}
		

int main(void){
	while(scanf("%d%d", &m, &n) && n && m){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				scanf("%d", &lake[i][j]);
			}
		}
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				if(lake[i][j])func(i,j,1);
			}
		}
		
		printf("%d\n",ans);
		ans = 0;
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				lake[i][j] = 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
def args():
    N, M = map(int, input().split())

    ST = []
    for _ in range(N):
        ST.append(tuple(map(int, input().split())))

    CP = []
    for _ in range(M):
        CP.append(tuple(map(int, input().split())))

    # print(N, M)
    # print(ST)
    # print(CP)

    return N, M, ST, CP


def solve(N, M, ST, CP):
    def get_dist(xy1, xy2):
        x1, y1 = xy1
        x2, y2 = xy2

        return abs(x1 - x2) + abs(y1 - y2)

    res = []
    for st in ST:
        min_cp, min_dist = 0, float("inf")
        for i, cp in enumerate(CP):
            dist = get_dist(st, cp)
            if dist < min_dist:
                min_dist = dist
                min_cp = i
        res.append(min_cp + 1)

    return res


if __name__ == '__main__':
    ans = solve(*args())
    for a in ans:
        print(a)


Measured memory_bytes: 39536
moji = input()
L = len(moji)

lst = []
for i in range(L):
    lst.append(ord(moji[i]))

lst2 = list(range(97,123))
ans = list(set(lst2) - set(lst))

if len(ans) == 0:
    print("None")
else:
    print(chr(min(ans)))
    

Measured memory_bytes: 9640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace __gnu_pbds;
using namespace std;
/*
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
*/
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST int testcase;cin>>testcase;while(testcase--)
#define all(x) (x).begin(),(x).end()
#define mset0(x) memset((x), 0, sizeof((x)));
#define mset1(x) memset((x), -1, sizeof((x)));
#define endl "\n"
#define plll pair<ll,pll>
#define no {cout<<"NO"<<endl;return;}
#define yes {cout<<"YES"<<endl;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;




void solve(){

    int n,cnt=0;
    cin>>n;
    map<int,int> mp;
    int a;
    for(int i=0;i<n;i++) {cin>>a;mp[a]++;}
    vector<int> v;
    for(auto i:mp) v.push_back(i.first);
    for(int i=0;i<v.size();i++)
    for(int j=i+1;j<v.size();j++)
    for(int k=j+1;k<v.size();k++)
    if(v[i]+v[j]>v[k]){
        cnt+=mp[v[i]]*mp[v[j]]*mp[v[k]];
    }

    cout<<cnt;
}

int main(){
    IO

    //TEST
    solve();

    return(0);
}
/*
1
4
0000
*/


Measured memory_bytes: 3664
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b := nextInt(), nextInt()
	ans := (a + b) / 2
	if (a+b)%2 != 0 {
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<stdio.h>
 
int main() {
  int n=0,i;
  char s[3];
  scanf("%s",s);
  
  for(i=0; i<3; i++){
    if(s[i]=='7') n++;
  }
  
  if(n==0) printf("No");
  else printf("Yes");
  return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cstring>
#include <cctype>
#include <numeric>
#include <cstdio>
#include <math.h>
#include <functional>
using namespace std;
struct initon {
    initon() {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define rep(i, n) for (i64 i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define na(a, n) rep(i, n) cin >> a[i];
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;
}
vb d(10);
int ans(int x)
{
    while (x)
    {
        if (d[x % 10])
            return 0;
        x /= 10;
    }
    return 1;
}
int main()
{
    int n, k, a, an;
    cin >> n >> k;
    rep(i, k)
    {
        cin >> a;
        d[a] = 1;
    }
    while (!ans(n))
        n++;
    cout << n;
  return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

void minu(P &f) {
	f.first--;
	f.second--;
}

//head

int di[] = {0, 0, 1, -1};
int dj[] = {1, -1, 0, 0};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w, k;
	cin >> h >> w >> k;
	P S, G;
	cin >> S >> G;
	minu(S);
	minu(G);
	vs c(h);
	rep(i, h) cin >> c[i];
	auto num = [&](int i, int l) {
		return i*w + l;
	};

	const int X = h*w;

	PQG<pair<P, ll> > pq;
	pq.emplace(make_pair(P(0, 0), num(S.first, S.second)));
	pq.emplace(make_pair(P(0, 0), X+num(S.first, S.second)));
	pq.emplace(make_pair(P(0, 0), X*2+num(S.first, S.second)));
	pq.emplace(make_pair(P(0, 0), X*3+num(S.first, S.second)));
	vector<P> dist(X<<2, P(INF, INF));
	dist[num(S.first, S.second)] = P(0, 0);
	dist[X+num(S.first, S.second)] = P(0, 0);
	dist[X*2+num(S.first, S.second)] = P(0, 0);
	dist[X*3+num(S.first, S.second)] = P(0, 0);
	while(!pq.empty()) {
		P now;
		int nn;
		tie(now, nn) = pq.top();
		pq.pop();
		if(dist[nn] != now) continue;
		int hg = nn/X;
		nn %= X;
		int i = nn/w;
		int j = nn%w;
		rep(l, 4) {
			int ni = i+di[l];
			int nj = j+dj[l];
			if(ni < 0 or nj < 0 or ni >= h or nj >= w or c[ni][nj] == '@') continue;
			int nh = num(ni, nj);
			P no = P(now.first+1, 1);
			if(l == hg and now.second < k) {
				no = P(now.first, now.second+1);
				if(dist[nh + X*l] > no) {
					dist[nh+X*l] = no;
					pq.emplace(no, nh+X*l);
				}
			} else {
				if(dist[nh + X*l] > no) {
					dist[nh+X*l] = no;
					pq.emplace(no, nh+X*l);
				}
			}
		}
	}

	if(dist[num(G.first, G.second)] == P(INF, INF) and dist[X+num(G.first, G.second)] == P(INF, INF) and
		dist[X*2+num(G.first, G.second)] == P(INF, INF) and dist[X*3+num(G.first, G.second)] == P(INF, INF)) {
			cout << -1 << endl;
	} else {
		int ans = INF;
		rep(i, 4) {
			chmin(ans, dist[X*i+num(G.first, G.second)].first+1);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 39836
def resolve():
    N,M,Q=map(int,input().split())
    mp=[[0 for i in range(N+2)] for i in range(N+1)]
    for _ in range(M):
        L,R=map(int,input().split())

        mp[L][R]+=1
    for i in range(1,N+1):
        for j in range(1,N+1):
            mp[i][j]+=mp[i][j-1]
        #print(i,mp[i])
    for _ in range(Q):
        p,q=map(int,input().split())
        sm=0
        for i in range(p,q+1):
            sm+=mp[i][q]
        print(sm)



if __name__ == "__main__":
    resolve()
    #unittest.main()


Measured memory_bytes: 54744
#!/usr/bin/env python3
s = int(input())
l = []
for i in range(2, 1000000):
    l.append(s)
    if s % 2 == 0:
        s = int(s / 2)
    else:
        s = int(3 * s + 1)
    if s in l:
        print(i)
        exit()
    

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <tuple>

using lli=long long int;
const lli large=10000000000;

int main(){
  int N,M,L;
  std::cin >> N >> M >> L;
  std::vector<std::vector<lli>> dist(N, std::vector<lli>(N, large)), dist2(N, std::vector<lli>(N, large));
  for(int i = 0; i < M; i++){
    int a,b,c;
    std::cin >> a >> b >> c;
    a--; b--;
    dist[a][b] = c;
    dist[b][a] = c;
  }

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

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(dist[i][j] <= L) dist2[i][j] = 1;
    }
  }

  for(int k = 0; k < N; k++){
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        dist2[i][j] = std::min(dist2[i][j], dist2[i][k]+dist2[k][j]);
        dist2[j][i] = dist2[i][j];
      }
    }
  }

  int Q;
  std::cin >> Q;
  for(int q = 0; q < Q; q++){
    int s,t;
    std::cin >> s >> t;
    s--; t--;
    lli d = dist2[s][t];
    if(d == large) std::cout << -1 << std::endl;
    else std::cout << d-1 << std::endl;
  }

  return 0;
}



Measured memory_bytes: 1920
from itertools import accumulate
N = int( input())
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
B = list( accumulate(A))
while r - l > 1:
    m = (l+r)//2
    # now = sum(A[:m+1])
    check = 1
    for i in range(m+1,N):
        if A[i] <= B[i-1]*2:
            pass
        else:
            check = 0
            break
    if check == 1:
        r = m
    else:
        l = m
print(N-r)

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    li n;

    cin>>n;

    if(n>=30)
    {
    	cout<<"Yes";
    }
    else
    	cout<<"No";
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t=1;

    // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
#include<math.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))
#define SORT(a,num,cmp) qsort((a),(num),sizeof(*(a)),cmp)

void run (void) {
  i64 s;
  scanf ("%" SCNi64, &s);
  i64 l = 0;
  i64 r = 1000000000;
  while (r - l > 1) {
    i64 m = (l + r) / 2;
    if (m * m >= s) {
      r = m;
    } else {
      l = m;
    }
  }
  i64 a = r;
  i64 d = r;
  i64 b = 0, c = 0;
  i64 e = 0, f = 0;
  if (a * d > s) {
    b = 1;
    c = a * d - s;
  }
  if (c > 1000000000) {
    a = r - 1;
    d = r - 1;
    b = 0;
    c = s - a * d;
    e = f = 1;
  }
  printf ("%" PRIi64 " %" PRIi64 " %" PRIi64 " %" PRIi64 " %" PRIi64 " %" PRIi64 "\n", e, f, a, b, c, d);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int k;
  cin >> k;
  cout << ((k+1)/2)*(k/2) << endl;
}


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

namespace AtCoder
{
    public class Prog
    {
        const int MOD = 1000000007;
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Prog().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var s = cin.ReadLine;

            var mc = ' ';

            foreach (var c in s)
            {
                if (mc == c)
                {
                    Console.WriteLine("Bad");
                    return;
                }
                mc = c;
            }

            Console.WriteLine("Good");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; } }
    }
}


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

int main()
{
	int n;
	cin >> n;
	set<string> st;
	string s;
	cin >> s;
	st.insert(s);
	for (int i = 1; i < n; i++)
	{
		string t;
		cin >> t;
		if (t[0] == *s.rbegin() && st.find(t) == st.end())
		{
			st.insert(t);
			s = t;
		}
		else
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    int k;
    cin >> s >> k;
    for(int i=0;i<s.size();i++){
        if(i!=s.size()-1){
            if(s[i]=='a') cout << 'a';
            else{
                if(26-(s[i]-'a')<=k){
                    cout << 'a';
                    k -= 26-(s[i]-'a');
                }
                else cout << s[i];
            }
        }
        else cout << char((k%26+(s[i]-'a'))%26+'a');
    }
    cout << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
	int i;
	string N,S;
	cin >> N;
	for (i = 0; i < 3; i++) {;
		if (N.at(i) == '7') {
			S="Yes";
			break;
		}
		else {
			continue;
		}
	}
	if (S != "Yes") {
		S = "No";
	}
	cout<< S << endl;

}
 



Measured memory_bytes: 3632
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
#define ff first
#define ss second
#define Clear(x) memset(x,0,sizeof(x))
#define all(x) (x).begin(),(x).end()

void checkpoint1()
{
	/******think more code less******/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
}

bool comp(pair< ll,ll > &a,pair< ll,ll > &b)
{
	if(a.ff!=b.ff)
		return a.ff<b.ff;
	else
	{
		if(a.ss>b.ss)
			return b.ss<a.ss;
		else if(a.ss<b.ss)
			return a.ss<b.ss;
	}
	return a.ff>b.ff;
}

ll powe(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b&1)
		{
			res*=a;
			res%=mod;
		}
		a*=a;
		a%=mod;
		b>>=1;
	}
	return res;
}
int main()
{
	checkpoint1();
	ll n;
	cin>>n;
	ld dp[n+1][n+1];
	ld p[n+1];
	for(ll i=1;i<=n;i++)
		cin>>p[i];
	dp[0][0]=1.000;
	dp[1][0]=1-p[1];
	for(ll i=2;i<=n;i++)
		dp[i][0]=dp[i-1][0]*(1-p[i]);
	for(ll i=1;i<=n;i++)
		dp[i][i]=p[i]*dp[i-1][i-1];
	for(ll i=2;i<=n;i++)
	{
		for(ll j=1;j<i;j++)
			dp[i][j]=dp[i-1][j]*(1-p[i])+p[i]*dp[i-1][j-1];
	}
	ld ans=0.000000;
	for(ll i=n/2+1;i<=n;i++)
		ans+=dp[n][i];
	cout<<fixed<<setprecision(10)<<ans;
	return 0;
}

Measured memory_bytes: 85732
#include <stdio.h>

int main(void)
{
        int S=0;
        int hour=0,minute=0,second=0;

        scanf("%d",&S);

        hour = S / (60*60);
        minute = (S % (60*60)) / 60;
        second = S % 60;

        printf("%d:%d:%d\n",hour,minute,second);

        return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <sstream>

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の二つ目の要素
#define C(x) cout << x << endl //テスト出力

//関数
//nCkの計算の関数(呼び出しは[cbn])
ll cbn(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}
// a^n mod を計算する
ll powmod(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
//２つの最大公約数
int gcb(int a, int b){
    if(a < b){
        int x = a;
        a = b;
        b = x;
    }
    int amari = a % b;
    if(amari == 0) return b;

    return gcb(b, amari);
}
//３つの最大公約数
int gcb_3(int a, int b, int c){
    return gcb(gcb(a, b), c);
}

/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;
vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))*/

/*-----------------------------ここから-----------------------------*/

int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll a,b; cin>>a>>b;
ll c=max(a,b);
ll d=max(min(a,b),c-1);
cout<<c+d;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    ll t,i,j,n,m,l=100ll,r;
    cin>>n;
    for(i=1; ;i++)
    {
        l+=(l/100ll);
        if(l>=n)
        {
            cout<<i<<"\n";
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3652
#pragma GCC optimize("O3") //コンパイラ最適化用

#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <algorithm>   //sort,二分探索,など
#include <bitset>      //固定長bit集合
#include <chrono>      //実行時間計測
#include <cmath>       //pow,logなど
#include <complex>     //複素数
#include <deque>       //両端アクセスのキュー
#include <functional>  //sortのgreater
#include <iomanip>     //setprecision(浮動小数点の出力の誤差)
#include <iostream>    //入出力
#include <iterator>    //集合演算(積集合,和集合,差集合など)
#include <map>         //map(辞書)
#include <numeric>     //iota(整数列の生成),gcdとlcm,accumulate
#include <queue>       //キュー
#include <set>         //集合（順序保持）
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility> //pair
#include <vector>  //可変長配列
using namespace std;
typedef long long ll;
typedef long double ld;

#define REP(i, n) for (int i = 0; i < ll(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < ll(b); i++)
#define FORD(i, a, b) for (int i = a; i > ll(b); i--)
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size()) // sizeをsize_tからllに直しておく
const long long INF = 1e12;
const int MOD = 1e9 + 7;
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define Umap unordered_map
#define Uset unordered_set
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000

// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed#c%E3%81%A7%E3%81%AE%E5%AE%9F%E8%A3%85
void print() { cout << endl; }

template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T> void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}

template <class T> void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}

void add(long long &a, long long b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}
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() {

    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int cnt = 0;
    REP(ri, 3001) {
        REP(gi, 3001) {
            int rem = (n - (ri * r + gi * g));
            if (rem < 0) {
                continue;
            }
            if (rem % b == 0) {
                cnt++;
            }
        }
    }
    print(cnt);
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n][m];
  int b[m];
  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++) {
    cin >> b[i];
  }

  for (int i = 0; i < n; i++) {
    int c = 0; 
    for (int j = 0; j < m; j++) {
      c += (a[i][j] * b[j]);
    }
    cout << c << endl;
  }
}


Measured memory_bytes: 3136