akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <climits>
#include <iomanip>
#include <string.h>
#include <algorithm>

using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define clr(a,b) memset((a),b,sizeof(a))
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define sz(a) int((a).size())
#define pb push_back

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N = (int)2e5+77;
const ll mod = (ll)1e9+7;

ll n, m, k, x, y;
ll b[N];
ll a[N],d[N];

int main() {
    fast;
    cin >> n >> m;
    forn(i, n) cin >> b[i];
    forn(i, n - 1) {
        ll s = b[i];
        ll t = b[i + 1];
        if (s < t) {
            ll aa = t - s;
            a[1] += aa;
            a[s + 1] += 1;
            d[s + 1] -= 1;
            d[t + 1] += 1;
            a[t + 1] -= 1;
            a[t + 1] += aa;
        } else {
            ll aa = m - s + t;
            a[1] += t;
            a[1] += 1;
            a[t + 1] -= 1;
            a[t + 1] += aa;
            a[s + 1] += 1;
            d[s + 1] -= 1;
            d[1] -= 1;
            d[t + 1] += 1;
        }
    }
    for1(i, m) d[i] = d[i] + d[i - 1];
    for1(i, m) a[i] = a[i] + d[i];
    for1(i, m) a[i] = a[i] + a[i - 1];
    k = LLONG_MAX;
    for1(i, m) {
        if (a[i] < k) k = a[i], x = i;
    }
    cout << k << endl;
    return 0;
}

Measured memory_bytes: 3584
import java.util.*;

class Main {
    

  public static void main(String[]args){
    Scanner sc= new Scanner(System.in);
    int N=sc.nextInt();
    String l=sc.next();
    int K=sc.nextInt();
    char t=l.charAt(K-1);
      
      for(int i=0; i<l.length();i++){
          if(l.charAt(i)!=t&&l.charAt(i)!='*'){
              l=l.replace(l.charAt(i), '*');
          }
          
      }
          System.out.println(l);
          
  }
}


Measured memory_bytes: 22868
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	
	flg := true
	
	for i, v := range s {
		if (i+1) % 2 == 0 && v == 'R'{
			flg = false
			break
		} else if (i+1) % 2 != 0 && v == 'L' {
			flg = false
			break
		} 
	}
	
	if flg {
		fmt.Println("Yes")
	} else{
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

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


int main() {
	
	int n;
	cin >> n;

	if (n == 7 || n == 5 || n == 3) {
		ANS("YES");
	}
	else {
		ANS("NO");
	}

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    H,W=map(int,input().split())
    N=int(input())
    a=list(map(int,input().split()))
    c=[[0]*W for _ in range(H)]
    nv=[[()]*W for _ in range(H)]
    for i in range(H):
        if i%2==0:
            for j in range(W):
                if j<W-1:
                    nv[i][j]=(i,j+1)
                else:
                    nv[i][j]=(i+1,j)
        else:
            for j in range(W-1,-1,-1):
                if j>0:
                    nv[i][j]=(i,j-1)
                else:
                    nv[i][j]=(i+1,j)
    v=(0,0)
    for i,x in enumerate(a,1):
        for _ in range(x):
            c[v[0]][v[1]]=i
            v=nv[v[0]][v[1]]
    for a in c:
        print(*a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 42608
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1010101010;
using Graph = vector<vector<int>>;

int main() {
  string s2;
  cin >> s2;
  int mi = INF;
  bool ok = true;
  for (int i = 0; i < s2.length(); i++) {
    if (s2[i] != s2[0]) {
      ok = false;
    }
  }
  if (ok) {
    cout << 0 << endl;
    return 0;
  }

  for (int i = 0; i < 26; i++) {
    string s = s2;
    char c = (char)(i + 'a');
    int cnt = 0;
    while (true) {
      bool ok = true;
      string t = "";
      for (int j = 0; j < s.length() - 1; j++) {
        if (s[j + 1] == c || s[j] == c) {
          t.push_back(c);
        } else {
          t.push_back(s[j]);
          ok = false;
        }
      }
      s = t;
      cnt++;
      if (ok) break;
      if (s.length() - 1 == 0) break;
    }
    mi = min(cnt, mi);
  }

  cout << mi << endl;
}

Measured memory_bytes: 256
from functools import lru_cache


def DEBUG(*args): pass # print('@', *args)


@lru_cache(maxsize=None)
def pat(s, n):
    return ' '.join([s] * n)


DEBUG(pat('1', 3))


def removeAll(xs, s):
    while s in xs:
        xs.remove(s)
        xs.append('#')
    return xs


def lmap(f, s): return list(map(f, s))


digits = lmap(str, range(1, 10))

def main(n):
    data = '\n'.join(map(lambda x: input(), range(n)))
    score = 0
    DEBUG(data)
    while True:
        removed = False
        sum1 = sum(map(lambda x: 0 if x == '#' else int(x), data.split()))
        for d in digits:
            if pat(d, 3) in data:
                data = data.replace(pat(d, 5), pat('0', 5))
                data = data.replace(pat(d, 4), pat('0', 4))
                data = data.replace(pat(d, 3), pat('0', 3))
                removed = True
        if removed == False:
            break
        DEBUG(data)
        score += (sum1 - sum(map(lambda x: 0 if x == '#' else int(x), data.split())))
        data = zip(*map(lambda x: x.split(), data.split('\n')))
        data = map(lambda x: list(x[::-1]), data)
        data = map(lambda x: removeAll(x, '0'), data)
        data = lmap(lambda s: ' '.join(s), zip(*data))
        data = '\n'.join(data[::-1])
        DEBUG(data)
    DEBUG(data)
    print(score)

while True:
    n = int(input())
    if n == 0: break
    main(n)


Measured memory_bytes: 6336
use proconio::{input, fastout};
use proconio::marker::Bytes;

#[fastout]
fn main() {
    input! {
        n: Bytes,
    }
    println!("{}", if n.into_iter().fold(0u64, |r, c| r + c as u64 - '0' as u64) % 9 == 0 { "Yes" } else { "No" });
}


Measured memory_bytes: 2364
n = int(input())
counter = [0 for _ in range(4)]
for _ in range(n):
    s = input()
    if s == "AC":
        counter[0] += 1
    elif s == "WA":
        counter[1] += 1
    elif s == "TLE":
        counter[2] += 1
    elif s == "RE":
        counter[3] += 1
print("AC x " + str(counter[0]))
print("WA x " + str(counter[1]))
print("TLE x " + str(counter[2]))
print("RE x " + str(counter[3]))     

Measured memory_bytes: 9212
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int [n];
    for(int i = 0;i < n;i++){
      a[i] = sc.nextInt();
    }
    Arrays.sort(a);
    int sum = 0;
    int min = Integer.MAX_VALUE;
    for(int j = a[0];j <= a[n - 1];j++){
      sum = 0;
      for(int i = 0;i < n;i++){
        sum += (j - a[i]) * (j - a[i]);
      }
      if(min > sum){
        min = sum;
      }
    }
    System.out.println(min);
  }
}

Measured memory_bytes: 22996
import scala.io.StdIn.{readInt, readLine}

object Main extends App {
  val mansions = Array.fill(4, 3, 10)(0)

  val n = readInt()

  for (_ <- 1 to n) {
    val Array(b, f, r, v) = readLine.split(" ").map(_.toInt)
    if (v > 0) mansions(b - 1)(f - 1)(r - 1) += v else mansions(b - 1)(f - 1)(r - 1) += v
  }

  for (e <- mansions) {
    for (v <- e) {
      println(" " + v.mkString(" "))
    }
    if (!(e sameElements mansions.last)) println("#" * 20)
  }

}


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

using namespace std;

int l, u[100], v[100], w[100];

int main() {
	cin >> l;
	int eid = 0, t = 0;
	while((1<<t+1) <= l) t++;
	for(int i = 1; i <= t; i++) {
		u[++eid] = i, v [eid] = i+1, w[eid] = 0;
		u[++eid] = i, v [eid] = i+1, w[eid] = (1<<i-1);
	}
	int r = l-(1<<t), p = (1<<t)-1;
	//cout << "r=" << r << " p=" << p << endl;
	for(int i = 20; i >= 0; i--) { //边数 
		if(r-(1<<i) >= 0) {
			r -= (1<<i);
			int x = p+1;
			p += (1<<i);
			u[++eid] = i+1, v [eid] = t+1, w[eid] = x;
		}
	}
	cout << t+1 << " " << eid << endl;
	for(int i = 1; i <= eid; i++) {
		cout << u[i] << " " << v[i] << " " << w[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let a = v[0];
	let b = v[1];
	if a+b >= 10 {
		println!("error");
	}else{
		println!("{}", a+b);
	}
}

Measured memory_bytes: 4352
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    print(abs(N-2)*abs(M-2))
    return


# 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)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
n = int(input())
for i in range(3, n+1):
    x = i
    if x % 3 == 0:
        print(' {0}'.format(i), end='')
        continue

    while x != 0:
        if x % 10 == 3:
            print(' {0}'.format(i), end='')
            break
        x //= 10

print()

Measured memory_bytes: 6740
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);

	int N = sc.nextInt();
	int a[] = new int[N];

	for (int i = 0; i < N; i++)
	    a[i] = sc.nextInt();

	int count = 1;
	int sum = 0;
	for (int i = 0; i < N; i++) {
	    if (a[i] == count) {
		count++;
	    } else {
		sum++;
	    }
	}

	if (count == 1)
	    System.out.println(-1);
	else
	    System.out.println(sum);

    }
}

Measured memory_bytes: 79772
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A,B=ST().split()
    if A<B:
        print(A*int(B))
    else:
        print(B*int(A))
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <iostream>
#include <queue>
#include <iomanip>
#include <map>
#include <bitset>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define INF 1200000000
#define LLINF 1100000000000000000
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
  int N; cin >> N;

  int tA = -1, tB;
  REP(i, N) {
    int A, B;
    cin >> A >> B;
    if (tA < A) {
      tA = A;
      tB = B;
    }
  }
  cout << tA + tB << endl;

  return 0;
}

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

int main() {
    long long int N, K;
    cin >> N >> K;
    
    long long int a, b;
    a = N % K;
    b = abs(a - K);

    if (a >= b){
        cout << b << endl;
    }
    else{
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 998244353LL;

// ModInt begin

using ll = long long;
template<ll mod>
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}
    
    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

template<ll mod>
ModInt<mod> pow(ModInt<mod> n, ll k) {
    return ModInt<mod>(n.mod_pow(n.v, k));
}

template<ll mod>
ostream& operator<< (ostream& out, ModInt<mod> a) {return out << a.v;}
template<ll mod>
istream& operator>> (istream& in, ModInt<mod>& a) {
    in >> a.v;
    return in;
}

// ModInt end

using mint = ModInt<MOD>;

const int MAXV = 3005;
mint dp[3010][3010];

int main() {
    int N, S; cin >> N >> S;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];

    mint res(0);
    dp[0][0] = mint(1);
    for(int i=0; i<N; i++) {
        for(int j=0; j<=S; j++) {
            dp[i+1][j] += mint(2) * dp[i][j];
            if(j >= A[i]) dp[i+1][j] += dp[i][j - A[i]];
        }
    }
    cout << dp[N][S] << endl;
    return 0;
}


Measured memory_bytes: 74424
#include<iostream>
using namespace std;
int main() {
	int h, w;
	cin >> h >> w;
	int buf[10][10] = {};
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> buf[i][j];
		}
	}
	int a[205][205] = {};
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (buf[i][j] > buf[i][k] + buf[k][j]) {
					buf[i][j] = buf[i][k] + buf[k][j];
				}
			}
		}
	}
	int count = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] != -1) {
				count = count+ buf[a[i][j]][1]; 
			}
		}
	}
	cout << count << endl;
	return 0;
}

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


int main(){
    long long n;
    string s;
    cin >> n;
    cin >> s;
    int count = 1;
    for (int i = 0; i < n - 1; i++){
        if (s.at(i + 1) != s.at(i)){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main
{
  public static void main(String[] args)
  {
    try (Scanner sc = new Scanner(System.in))
    {
      while (sc.hasNext())
      {
        final int H = sc.nextInt();
        final int A = sc.nextInt();
        final int B = sc.nextInt();

        System.out.println(solver(H, A, B));
      }
    }
  }

  private static int solver(int h, int a, int b)
  {
    int ans = 0;
    for (int i = a; i <= b; i++)
    {
      if (h % i == 0)
      {
        ans++;
      }
    }
    return ans;
  }
}



Measured memory_bytes: 26372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
class mint{
    public:
        long long x;
 
    constexpr mint(long long _x = 0) : x((_x%mod+mod)%mod) {}
    constexpr mint operator-() const{
        return mint(-x);
    }
    constexpr mint& operator+=(const mint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator-=(const mint& a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator*=(const mint& a){
        (x *= a.x) %= mod;
        return *this;
    }
    constexpr mint operator+(const mint& a) const{
        mint res(*this);
        return res+=a;
    }
    constexpr mint operator-(const mint& a) const{
        mint res(*this);
        return res-=a;
    }
    constexpr mint operator*(const mint& a) const{
        mint res(*this);
        return res*=a;
    }
    constexpr mint pow(long long x) const{
        if(!x) return 1;
        mint a = pow(x>>1);
        a *= a;
        if(x&1) a *= *this;
        return a; 
    }
    constexpr mint inv() const{
        return pow(mod-2);
    }
    constexpr mint& operator/=(const mint& a){
        return (*this) *= a.inv();
    }
    constexpr mint operator/(const mint& a) const{
        mint res(*this);
        return res/=a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x; return os;
    }
};
const int nmax=1000;
ll fac[nmax],finv[nmax],inv[nmax];
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<nmax;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
// modintを使うときはllをmintに
mint com(int n,int k){
  if(n<k||n<0||k<0){
    return 0;
  }
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}

// 繰り返し二乗法 n*nが64bitにおさまる必要
mint pow_mod(ll n,ll k,ll m){
  ll res=1;
  for(;k>0;k>>=1){
    if(k&1){
      res=(res*n)%m;
    }
    n=(n*n)%m;  
  }
  return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,c;cin >> n >> c;
    vector<int> a(n),b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    vector<vector<mint>> dp(n+1,vector<mint>(c+1));
    vector<vector<mint>> pw(c+1,vector<mint>(401));
    for(int i=0;i<=c;i++){
      pw[i][0]=1;
      for(int j=1;j<=400;j++){
        pw[i][j]=pw[i][j-1]+pow_mod(j,i,mod);
      }
    }
    dp[0][0]=1;
    mint m=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<=c;j++){
        for(int k=0;k+j<=c;k++){
          if(a[i]==0){
            dp[i+1][j+k]+=dp[i][j]*pw[k][b[i]];
          }
          else{
            dp[i+1][j+k]+=dp[i][j]*(pw[k][b[i]]-pw[k][a[i]-1]);
          }
        }
      }
    }
    cout << dp[n][c] << endl;
}

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

typedef long long dnt;

struct Node
{
	dnt lik, pr;
	double pri;
	Node(){	}
	Node( dnt lik, double pri, dnt pr ) : lik(lik), pri(pri), pr(pr) {	}
	bool operator < ( const Node &a ) const
	{
		return pri < a.pri;
	}
} liq[5];

dnt q, h, s, d, n;

int main()
{
	cin >> q >> h >> s >> d >> n;
	liq[1] = Node(1, q / 0.25, q), liq[2] = Node(2, h / 0.5, h);
	liq[3] = Node(4, s, s), liq[4] = Node(8, d / 2.0, d);
	sort(liq + 1, liq + 5);
	dnt fee = 0, cnt = 0;
	int tp = 1; 
	n *= 4;
	while(n)
	{
		cnt = 0;
		fee += (n - n % liq[tp].lik) / liq[tp].lik * liq[tp].pr;
		n %= liq[tp].lik;
		tp++;
	}
	cout << fee << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define ld long double
#define endl "\n"
using namespace std;

int32_t main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans = 0;
  int i = 0,j = n-1;
  while(i < n && j >= 0 && i < j) {
    while(i < n && s[i] == 'R') i++;
    while(j >= 0 && s[j] == 'W') j--;
    if(i < n && j >= 0 && i < j) { 
      swap(s[i],s[j]);
      ans++;
    }
  }
  cout<<ans;
  cout<<endl;
  return 0;
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mp make_pair
#define mm(a) memset(a,-1,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define sz(a) ll((a).size())
#define pii 3.1415926535897
#define endl "\n"
#define ld long double
#define mod 1000000007
#define BRAHAMASTRA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    BRAHAMASTRA
    ll t; t=1;
    // cin >>t;
    while(t--)
    {
        string s,s1; cin >>s>>s1;
        ll cnt=0;
        rep(i,0,sz(s))if(s[i]!=s1[i])cnt++;
        cout<<cnt<<endl;
    }
}

Measured memory_bytes: 3896
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
        
    A[i+1], A[r] = A[r], A[i+1]
    
    return i+1

n = int(input())
lst = list(map(int, input().split()))

s = partition(lst, 0, n-1)
lst[s] = [lst[s]]
print(*lst)


Measured memory_bytes: 16384
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int) (n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;
int main(){
map<int,ll> dic;
int n;
cin >> n;
int temp;
vector<int> v;
rep(i,n){
  cin >> temp;
  v.push_back(temp);
  dic[temp]++;
}
ll ans=0;
for(auto it=dic.begin();it!=dic.end();it++){
  ll t=it->second;
  ans+=t*(t-1)/2;
}
for(int i=0;i<v.size();i++){
  cout << ans-(dic[v[i]]-1) << endl;
}
return 0;
}


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

int main(void)
{
    string s;
    cin >> s;
    int sum = 0;
    for (auto x : s) {
        if (x == '1') {
            sum++;
        }
    }
    cout << sum << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	int a, b;
	cin >> a >> b;
	V<bool> ans(3, true);
	ans[a - 1] = false;
	ans[b - 1] = false;

	REP(i, 3) {
		if (ans[i]) {
			col(i + 1);
		}
	}

	return 0;
}


Measured memory_bytes: 3652
using System;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            char[] chars = input.ToCharArray();
            int total = 0;
            if(chars[1] == 'R')
            {
                total = 1;
                if (chars[0] == 'R')
                    total++;
                if (chars[2] == 'R')
                    total++;
            }
            else if(chars[1] != 'R')
            {
                if (chars[0] == 'R')
                    total++;
                else if (chars[2] == 'R')
                    total++;
            }
            Console.WriteLine(total);
        }
    }
}


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

public class Main {
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static void main(String[] args) {
		FastReader in = new FastReader();
		int a = in.nextInt();
		int i = 0;
		while(i*(i+1) < a*2) i++;
		System.out.println(i);
	}
	

}


Measured memory_bytes: 22612
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const int MOD = 1000000007;
struct mint { int n; mint(int n_ = 0) : n(n_) {} };
mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
istream &operator>>(istream &i, mint &a) { return i >> a.n; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }

vector<mint> F_{1, 1}, R_{1, 1}, I_{0, 1};
void check_fact(int n) {
  for (int i = I_.size(); i <= n; i++) {
    I_.push_back(I_[MOD % i] * (MOD - MOD / i));
    F_.push_back(F_[i - 1] * i);
    R_.push_back(R_[i - 1] * I_[i]);
  }
}

mint I(int n) { check_fact(abs(n)); return n >= 0 ? I_[n] : -I_[n]; }
mint F(int n) { check_fact(n); return n < 0 ? 0 : F_[n]; }
mint R(int n) { check_fact(n); return n < 0 ? 0 : R_[n]; }
mint C(int n, int r) { return F(n) * R(n - r) * R(r); }
mint P(int n, int r) { return F(n) * R(n - r); }
mint H(int n, int r) { return n == 0 ? (r == 0) : C(n + r - 1, r); }

ll N, M, K;
int main(void){
    cin >> N >> M >> K;
    ll comb = C(int(N*M-2), int(K-2)).n;
    ll n1 = 0;
    for(ll i=0;i<N;i++){
        n1 += (i*(N-i)) % MOD;
        n1 %= MOD;
    }
    n1 *= (M*M)%MOD;
    n1 %= MOD;

    ll n2 = 0;
    for(ll i=0;i<M;i++){
        n2 += (i*(M-i)) % MOD;
        n2 %= MOD;
    }
    n2 *= (N*N)%MOD;
    n2 %= MOD;


    cout << (comb*(n1+n2))%MOD << endl;
    return 0;
}



Measured memory_bytes: 2912
n=int(input())
s =[0]*n
for i in range(n):
    s[i]=int(input())

sums=sum(s)
if sums%10!=0:
    print(sums)
else:
    tens=[ss for ss in s if ss%10!=0]
    if tens!=[]:
        to_remove = min(tens)
        print(sums-to_remove)
    else:
        print(0)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

template <class T>
T inf = numeric_limits<T>::max();


// 素因数分解
/*
 * [2]-> 5, [3] -> 5のとき N = 2^5 * 3^5
 */
template<typename T>
map<T, long long> factorize(T x) {
  map<T, long long> res;
  for (long long i = 2; i * i <= x; ++i) {
    while (x % i == 0) {
      x /= i;
      res[i] += 1;
    }
  }
  if (x != 1) res[x]++;
  return res;
}

const int MAX = 510000;
const int MOD = 1000000007;

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

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

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

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

  ll N,M;
  cin >> N >> M;

  auto f = factorize(M);
  ll ans = 1;
  COMinit();
  for (auto itr : f) {
    ll cnt = itr.second;
    ans *= COM(cnt+N-1, cnt);
    ans %= mod;
  }

  cout << ans << endl;
}


Measured memory_bytes: 15600
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


VV G;
V cl;
V cnt(2);

bool dfs(int u, int x=0) {
  if (cl[u] == x) return true;
  if (cl[u] == (x^1)) return false;
  cl[u] = x;
  ++cnt[x];
  for (auto v : G[u]) {
    if (!dfs(v, x^1)) return false;
  }
  return true;
}


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

  VVbo A(n, Vbo(n, true));
  rep(i, m) {
    int u, v; cin >> u >> v;
    --u; --v;
    A[u][v] = false;
    A[v][u] = false;
  }
  rep(i, n) A[i][i] = false;

  G.assign(n, V());
  cl.assign(n, -1);
  rep(i, n) rep(j, n) if (A[i][j]) G[i].push_back(j);


  vector<P> ab;

  rep(i, n) {
    if (cl[i] != -1) continue;
    cnt.assign(2, 0);
    if (!dfs(i)) {
      cout << -1 << "\n";
      return 0;
    }
    ab.emplace_back(cnt[0], cnt[1]);
  }

  int k = ab.size();
  bitset<701> dp;
  dp[0] = 1;
  for (auto &e : ab) dp = (dp<<e.first) | (dp<<e.second);

  int ans = INF;
  rep(i, n) if (dp[i]) chmin(ans, i*(i-1)/2 + (n-i)*(n-i-1)/2);
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3200
import java.util.Scanner;

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

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, n, m;
  in(n);
  m = 0 - n;
  rep(i, n){
    in(a);
    m = m + a;
  }
  out(m);
  memi;
}

Measured memory_bytes: 256
import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.ascii, std.regex, std.conv, std.stdio, std.typecons;

void main()
{
  auto hi = new int[](26);

  for (;;) {
    auto s = readln;
    if (!s) break;

    foreach (c; s.chomp)
      if (c.isLower) ++hi[c - 'a'];
      else if (c.isUpper) ++hi[c - 'A'];
  }

  foreach (dchar i; 0..26)
    writefln("%c : %d", dchar(i + 'a'), hi[i]);
}

Measured memory_bytes: 2464
#include<bits/stdc++.h>
#define For(i,k,n) for(ll i=k;i<n;i++)
#define endl "\n"
#define ll long long int
using namespace std;
#define test int t; cin>>t; while(t--)
#define vi vector<int>
#define vl vector<ll>
#define umapii unordered_map<int,int>
#define umapll unordered_map<ll,ll>

void dummy(){
    for(int i=0;i<23;i++);
}
void scanArr(ll a[],ll n){
    For(i,0,n)cin>>a[i];
}
void scanArr(int a[],int n){
    For(i,0,n)cin>>a[i];
}
void printl(){
  cout<<endl;
}
void dummy2(){
  For(i,0,10)cout<<"";
}
ll mexp(ll a,ll b){
  if(a==0) return 0;
  if (b==0) return 1;
  ll ans=1;
  while(b>0){
    if(b&1){
      ans*=a;b--;
    }
    else{
      a*=a;b=b>>1;
    }
  }
  return ans;
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  //        ------Code Here------
  long double a,b;
  cin>>a>>b;
  cout<<(ll)(a*b);
  
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  vector<int> t(3);

  sort(l.begin(), l.end(), greater<int>());

  int ans = 0;
  for (int i = 0; i < n - 2; ++i) {
    for (int j = i + 1; j < n - 1; ++j) {
      for (int k = j + 1; k < n; ++k) {
        if (l[i] < l[j] + l[k]) ans++;
      }
    }
  }

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


Measured memory_bytes: 384
// @title AtCoder Libraryのサンプル
// @see https://atcoder.jp/contests/practice2/tasks/practice2_b

#include <iostream>
#include <atcoder/fenwicktree>

using namespace std;
using namespace atcoder;
using ll = long long;

int main() {
    int n, q; cin >> n >> q;
    fenwick_tree<ll> fw(n);
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        fw.add(i, a);
    }
    for (int i = 0; i < q; ++i) {
        int t; cin >> t;
        if (t == 0) { 
            ll p, x; cin >> p >> x;
            fw.add(p, x);
        }
        else {
            int l, r; cin >> l >> r;
            cout << fw.sum(l, r) << endl;
        }
    }
}

Measured memory_bytes: 8204
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c,cn=0;
    cin>>n;
    int a[n],i,flag=0;
    for(i=0; i<n; i++)
        cin>>a[i];
    while(flag!=1)
    {
        c=0;
        for(i=0; i<n; i++)
        {
            if(a[i]%2==0)
               {
               c++;
                a[i]=a[i]/2;
               }
        }
        if(c==n)
            cn++;
        else
        flag=1;

    }
    cout<<cn<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % 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 argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  // ll n, m;
  // cin >> n >> m;
  ll n, m, k;
  cin >> n >> m >> k;
  //      n-i
  //    ..###
  //    ..### m - j
  //  j ##...
  //    ##...
  //    i
  if(k == 0) {
    cout << "Yes\n";
    return 0;
  }
  fi(0, n)
    fj(0, m) {
      if(i * j + (n - i) * (m - j) == k) {
        cout << "Yes\n";
        return 0;
      }
    }
  cout << "No\n";
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include<cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include<bitset>

#define REP(i, b, n) for(int i=b;i<(int)n;i++)
#define rep(i, n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it, o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;

//ハマったらチェックリスト見ろ!!

ll dp[20][20];

ll solve(string &R, string &sub1, string &sub2){
    rep(i, 19)rep(j, 19)dp[i][j] = 0;
    dp[0][0] = 1;

        rep(i, sub1.length()+1){
            rep(j, sub2.length()+1){
                ll now = dp[i][j];
                if(i<sub1.length() && R[i+j] == sub1[i]){
                    dp[i+1][j] += now;
                }
                if(j<sub2.length() && R[i+j] == sub2[j]){
                    dp[i][j+1] += now;
                }
            }
        }
    return dp[sub1.length()][sub2.length()];
}

int main() {
    ll N;
    cin >> N;
    string S;
    cin >> S;

    string R = S;
    reverse(ALL(R));
    ll ans = 0;

    rep(bit, (1<<N)){
        string s;
        bitset<20> B(bit);
        string sub[2];
        rep(i, N){
            sub[B[i]] += S[i];
        }
        ans += solve(R, sub[0], sub[1]);
    }
    cout << ans <<endl;

    return 0;
}

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

vector<ll> Rui(vector<ll> V)
{
    ll N = V.size();
    vector<ll> ret(N);
    ret[0] = V[0]; 
    for(ll i=1;i<N;i++)
    {
        ret[i] = ret[i-1] + V[i];
    }
    return ret;
}

int main()
{
    ll N,M,K;
    cin >> N >> M >> K;

    vector<ll> A(N+1,0),B(M+1,0);
    for(ll i=1;i<=N;i++)
    {
        cin >> A[i];
    }
    for(ll i=1;i<=M;i++)
    {
        cin >> B[i];
    }

    vector<ll> A_Rui = Rui(A), B_Rui = Rui(B);

    ll max_books = 0;
    for(ll i=0;i<=N && A_Rui[i]<=K;i++)
    {
        max_books = max(max_books,-1+i+(upper_bound(ALL(B_Rui),K-A_Rui[i])-B_Rui.begin()));
    }

    OUT0(max_books);

    return 0;
}

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

#define FIO ios_base::sync_with_stdio(0); cin.tie(0);
#define T() int tt; cin >> tt; rep1(qq,1,tt)
#define rep(i,start,lim) for(int i=start;i<lim;i++)
#define rep1(i,start,lim) for(int i=start; i<=lim; ++i)
#define repd(i,start,lim) for(int i=start;i>=lim;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define eps (1e-6)
#define what_is(x) cerr << #x << " is " << x << "\n";
#define int long long int
#define infll 9e18
#define inf 1e12

#define lnode (2 * node + 1)
#define rnode (2 * node + 2)

using namespace std;

typedef pair<int, int> pii;

const int N = 2e5 + 5;

int n;
string s;

bool isPal(string &s){
  string t = s;
  reverse(all(t));
  return (s == t);
}

int32_t main()
{

	FIO
	//cout << fixed << setprecision(10);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	cin >> s;
	n = s.length();
  string s1 = s.substr(0,n/2);
  string s2 = s.substr((n/2)+1);
  if(isPal(s) && isPal(s1) && isPal(s2)){
    cout << "Yes\n";
  } else{
    cout << "No\n";
  }
	
	
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s, t, u;
    cin >> s >> t;
    int a, b;
    cin >> a >> b >> u;
    if (s == u)
        a--;
    else
    {
        b--;
    }

    cout << a<< " " << b << endl;
}


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

int main() {
    int n;cin>>n;
    ll a=1,b=1;
    while (n--) {
        int c,d;
        cin>>c>>d;
        ll m=max((a+c-1)/c,(b+d-1)/d);
        a=c*m;
        b=d*m; 
    }
    cout<<a+b<<endl;
    return 0;
}

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

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

int main(void)
{
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n);
    vector<bool> seen(n,false);
    deque<int> path;
    for(int i=0;i<n;++i)
    {
        cin >> a[i];
        --a[i];
    }
    int x=0;
    while(true)
    {
        if(seen[x])
        {
            while(path[0]!=x)
            {
                path.pop_front();
                --k;
                if(k==0)
                {
                    cout << path[0]+1 << endl;
                    return 0;
                }
            }
            break;
        }
        seen[x]=true;
        path.push_back(x);
        x=a[x];
    }
    
    cout << path[k%path.size()]+1 << endl;
    return 0;
}


Measured memory_bytes: 4840
n = int(input())
a = list(map(int, input().split()))
c = [0] * 9
for i in range(n):
    if a[i] < 400:
        c[0] = 1
    elif a[i] < 800:
        c[1] = 1
    elif a[i] < 1200:
        c[2] = 1
    elif a[i] < 1600:
        c[3] = 1
    elif a[i] < 2000:
        c[4] = 1
    elif a[i] < 2400:
        c[5] = 1
    elif a[i] < 2800:
        c[6] = 1
    elif a[i] < 3200:
        c[7] = 1
    else:
        c[8] += 1
for i in range(7):
    c[i+1] += c[i]
print(max(c[7], 1), c[7]+c[8])


Measured memory_bytes: 3064