akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <ctype.h>

int main(void)
{
  int i,N,K;
  scanf("%d %d",&N,&K);
  char a[N],b[N];
  scanf("%s",a);

  for(i = 0;i < N;i++) {
    b[i] = ' ';
    if(i + 1 == K) b[i] = tolower(a[i]);
    else b[i] = a[i];
    printf("%c",b[i]);
  }  

  printf("\n");
  return 0;
}

Measured memory_bytes: 128
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func gcd(x, y int) (int, int) {
	nSteps := 0
	for {
		if x < y {
			tmp := x
			x = y
			y = tmp
		}
		nSteps++
		if x%y == 0 {
			return nSteps, y
		}
		x = x % y
	}
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		a, _ := nextInt()
		b, _ := nextInt()

		if a == 0 && b == 0 {
			break
		}

		nSteps, p := gcd(a, b)
		fmt.Println(p, nSteps)
	}
}



Measured memory_bytes: 1108
package main

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

var sc = bufio.NewScanner((os.Stdin))

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

func nextInt() int {
	l := nextLine()
	i, e := strconv.Atoi(l)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N, A := nextInt(), []int{}
	for i := 0; i < N; i++ {
		A = append(A, nextInt())
	}

	fmt.Printf("%d\n", ABC098D(A))
}

// ABC098D ...
func ABC098D(A []int) int {
	//res := len(A)
	res := 0
	r, sum := 0, 0
	for l := 0; l < len(A); l++ {
		for r < len(A) && sum^A[r] == sum+A[r] {
			sum += A[r]
			r++
		}

		res += r - l
		if r == l {
			r++
		} else {
			sum -= A[l]
		}
	}

	return res
}


Measured memory_bytes: 8632
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
    n = II()
    a = LI()
    nn = n*(n+1)//2
    s = sum(a)
    if s%nn != 0:
        return "NO"
    k = s//nn
    km = k%n
    c = 0
    for i in range(n):
        t = a[i]-a[i-1]
        if t % n != km:
            return "NO"
        if t > k:
            return "NO"
        kt = k-t
        if kt%n != 0:
            return "NO"
        c += kt//n
    if c == k:
        return "YES"
    return 'NO'


print(main())


Measured memory_bytes: 18800
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A, V, B, W, T;
	cin >> A >> V >> B >> W >> T;

	int X = abs(A - B);

	if (V <= W) {
		cout << "NO" << endl;
		return 0;
	}

	int d = V - W;
	X -= d * T;
	if (X <= 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}




	return 0;
}



Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String str=scanner.next();
        StringBuilder stringBuilder1=new StringBuilder();
        StringBuilder stringBuilder2=new StringBuilder();
        for(int j=0;j<(str.length()-1)/2;j++){
            stringBuilder1.append(str.charAt(j));
        }
        StringBuilder stringBuilder=new StringBuilder();
        for(int j=((str.length()-1)/2)+1;j<str.length();j++){
            stringBuilder2.append(str.charAt(j));
            stringBuilder.append(str.charAt(j));
        }
//        StringBuilder stringBuilder=stringBuilder2;
        StringBuilder ss=stringBuilder2.reverse();
        //stringBuilder2=stringBuilder2.reverse();
//        System.out.println(ss.toString());
//        System.out.println(stringBuilder.toString());
        if(stringBuilder1.toString().equals(ss.toString())){
            int ff=0;
            for(int j=0;j<stringBuilder1.length();j++){
                if(stringBuilder1.charAt(j)!=stringBuilder1.charAt(stringBuilder1.length()-1-j)){
                    ff=1;
                    break;
                }
            }
            for(int j=0;j<stringBuilder.length();j++){
                if(stringBuilder.charAt(j)!=stringBuilder.charAt(stringBuilder.length()-1-j)){
                    ff=1;
                    break;
                }
            }
            if(ff==1){
                System.out.println("No");
            }
            else{
                System.out.println("Yes");
            }


        }
        else{
//            System.out.println(stringBuilder1.toString());
//            System.out.println(stringBuilder2.toString());
            System.out.println("No");
        }


    }

}


Measured memory_bytes: 23252
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <iterator>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

long a[100];
long b[100];
long c[100];
long d[100];

int main(int argc, char* argv[])
{
    long count=0;
    long a, b;
    scanf("%ld %ld", &a, &b);
    long i;
    for(i=a; i<=b; i++) {
        char str[6]={0};
        sprintf(str, "%ld", i);
        if(str[0]==str[4] && str[1]==str[3]) {
            count++;
        }
    }
    printf("%ld\n", count);
    return 0;
}


Measured memory_bytes: 128
N = int(input())
C = list(input())
ans = 0
r = 0
l = N - 1
while r < l:
    if C[r] == 'W':
        while True:
            if C[l] == 'R':
                ans += 1
                l -= 1
                break
            else:
                l -= 1
                if r == l:
                    break
    r += 1
print(ans)

Measured memory_bytes: 10756
# include <stdio.h>

int main(){
    int x, y;
    scanf("%d %d", &x, &y);
    
    char mat[x][y];
    char str[y];
    
    for(int i =0; i < x; ++i){
        scanf("%s", str);
        for(int h = 0; h < y; ++h){
            mat[i][h] = str[h];
        }
    }

    char triz[x+2][y+2];
    int a = -1, b = 0;
    
    for (int i = 0; i < x+2; ++i){
        a += 1, b = 0;
        for (int j = 0; j < y+2; ++j)
            if ((i != 0 && j != 0) && (i != x+1 && j != y+1))
                triz[i][j] = mat[i-1][j-1];
            else
                triz[i][j] = '#';
            b += 1;
    }
    
    
    for (int i = 0; i < x+2; ++i){
        if (i > 0)
            printf("\n");
        for (int j = 0; j < y+2; ++j){
            printf("%c", triz[i][j]);
        }
    }
    
    
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

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;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const i64 dy[4] = {0, 1, 0, -1};
const i64 dx[4] = {1, 0, -1, 0};

int main() {
    i64 H, W; cin >> H >> W;
    i64 N; cin >> N;
    vector<i64> A(N);
    REP(i, N) cin >> A[i];

    vector<vector<i64>> color(H, vector<i64>(W));
    i64 y = 0, x = 0;
    i64 ly = 0, uy = H - 1, lx = 0, ux = W - 1;
    i64 di = 0;
    i64 ci = 0;
    while (1) {
        if (A[ci] == 0) ci++;
        if (ci >= N) break;

        color[y][x] = ci + 1;
        A[ci]--;
        i64 ny = y + dy[di];
        i64 nx = x + dx[di];
        if (ny < ly || uy < ny || nx < lx || ux < nx) {
            if (di == 0) ly++;
            else if (di == 1) ux--;
            else if (di == 2) uy--;
            else if (di == 3) lx++;
            di = (di + 1) % 4;
            ny = y + dy[di];
            nx = x + dx[di];
        }
        y = ny;
        x = nx;
    }

    REP(y, H) {
        REP(x, W) cout << color[y][x] << " ";
        cout << endl;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 512
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
content = 0
content+=b[a[0]-1]
for i in range(1,n):
  content += b[a[i]-1]
  if a[i]-a[i-1]==1:
    content+=c[a[i-1]-1]
print(content)

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

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s;
        int sum=0;
        while((s = br.readLine())!=null){
            String[] str = s.split(" ");
            int m = Integer.parseInt(str[0]);
            int f = Integer.parseInt(str[1]);
            int r = Integer.parseInt(str[2]);
            if(m==-1 && f==-1 && r==-1){
                break;
            }else{
               sum = m + f;
                if(m<0 || f<0){
                    System.out.println("F");
                }else{
                    if(sum >= 80){
                        System.out.println("A");
                    }else if(sum>=65 && sum<80){
                        System.out.println("B");
                    }else if(sum>=50 && sum<65){
                        System.out.println("C");
                    }else if(sum>=30 && sum<50){
                        if(r>=50){
                            System.out.println("C");
                        }else{
                            System.out.println("D");
                        }
                    }else{
                        System.out.println("F");
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 16936
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

void get() {

}

typedef long long ll;
ll a[123456];
map<ll, int>mp;
// Returns value of Binomial Coefficient C(n, k) O(n)时间, O(1)空间
typedef long long ll;
// Returns value of Binomial Coefficient C(n, k) O(n*k)时间,O(n)空间
ll binomialCoeff(int n, int k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;  // nC0 is 1

    for (int i = 1; i <= n; i++)
    {
        // Compute next row of pascal triangle using
        // the previous row
        for (int j = min(i, k); j > 0; j--)
            C[j] = C[j] + C[j-1];
    }
    return C[k];
}

class DCandyDistribution {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, m;
		in >> n >> m;
		mp.clear();
		memset(a, 0, sizeof(a));
		ll sum = 0;
		for (int i = 1; i <= n; ++i) {
			in >> a[i];
			if(i != 0)a[i] += a[i-1];
//			if(a[i] % m == 0)a[i] = m;
			a[i] %= m;
//			if(a[i] % m == 0 && a[i])sum ++;
			mp[a[i]]++;
//			cerr << a[i] << " ";
		}
//		cerr << endl;
//		mp[0]++;
//		if(a[n] % m == 0 && a[n])sum ++;
		for (auto it = mp.begin(); it != mp.end(); ++it) {
			if(it->second >= 2 && it->first != 0)sum += binomialCoeff(it->second, 2), cerr << sum << " " ;
			else if(it->first == 0)sum += binomialCoeff(it->second, 2) + it->second, cerr << sum << " ";
		}
//		cerr << endl;
		out << sum << endl;
	}
};


int main() {
	DCandyDistribution solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 5120
import sys
import math
from collections import deque
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

input = sys.stdin.readline

A,B,C,D = MI()
while True:
    C -= B
    if C<=0:
        print('Yes')
        break
    A -= D
    if A<=0:
        print('No')
        break


Measured memory_bytes: 77272
import java.util.*;
public class Main {
    
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        boolean res = true;
        for (int i = 0; i < S.length(); i++) {
            if(S.charAt(i) != T.charAt(i)) res = false;
        }
        if(res){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35604
# やっていることは単純だが、何故これで正しい答えが出るのかよくわからない

N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

la = 0
lb = 0
for i in range(N):
    if a[i] > b[i]:
        la += a[i] - b[i]
    elif b[i] > a[i]:
        lb += (b[i] - a[i]) // 2

if lb >= la:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 73876
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
const int MOD = 998244353;
// const int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

	int n;
	cin >> n;
	vll a(n);
	rep(i,n)cin >> a[i];
	int cnt = 0;
	rep(i,n){
		if(a[i]%2==1 && (i+1)%2==1)cnt++;
	}
	cout << cnt << endl;



	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://atcoder.jp/contests/aising2020/tasks/aising2020_a


Measured memory_bytes: 3592
n = int(input())
h = [0] + [int(x) for x in input().split()]
dp = [float('inf')] * (n + 1)
dp[1] = 0
for i in range(2, n + 1):
    if i == 2:
        dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
    if i >= 3:
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[n])

Measured memory_bytes: 13980
#define NDEBUG
NDEBUG


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>


using namespace std;

template<class T>
using vec = std::vector<T>;


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


// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END


// Section with adoption of array and vector algorithms.


//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {
        
    };

    
    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  map<string, int> cnts;
  FOR(i, n) {
    auto s = next<string>(in);
    cnts[s]++;
  }
  vec<string> strs{"AC", "WA", "TLE", "RE"};
  for (auto s : strs) {
    out << s << " x " << cnts[s] << "\n";
  }

}

//#include <fstream>


int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[4];
int main(){
    for(int i=0;i<4;i++) cin>>a[i];
    for(int i=1;i<4;i++) a[i] = min(a[i],a[i-1]*2);
    int n; cin>>n;
    if(n%2==0) cout<<1ll*a[3]*(n/2)<<endl;
    else cout<<1ll*a[3]*(n/2)+a[2]<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan =  new Scanner(System.in);
		
		int n = scan.nextInt();
		if(n>=30) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		

	}

}

Measured memory_bytes: 35636
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
int main(){
   double a,b,h,m;
   cin>>a>>b>>h>>m;
   double ans=a*a+b*b-2*a*b*cos(2*pi*((h+m/60)/12-m/60));
   printf("%.12lf\n",sqrt(ans));
   return 0;
}

Measured memory_bytes: 4128
console.log((args=>{
  const [[N,X],x] = args.trim().split('\n').map( r=>r.split(' ').map(v=>v|0) );
  const gcd = (a,b) => {while(a)[a,b]=[b%a,a]; return b;};
  let d = Math.abs(x[0]-X);
  for ( let i = 1; i < N; i++ ) {
    d = gcd( d, Math.abs(x[i]-X) );
  }
  return `${d}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repe(i, n) for (ll i = 0; i <= (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);
template <typename T>
void MACRO_VAR_Scan(T &t)
{
    std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &... rest)
{
    std::cin >> first;
    MACRO_VAR_Scan(rest...);
}

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

double ans = 0;
bool check = 0;
bool boo = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n, k, m = 1000000;
int x = 0, y = 0;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;
    cin >> n;
    if (n % 111 == 0)
        pr(n);
    else
    {
        a = n /111 + 1;
        
        pr(a * 100 + a * 10 + a);
    }

    return 0;
}


Measured memory_bytes: 3660
# abc130_c.py
# https://atcoder.jp/contests/abc130/tasks/abc130_c

# C - Rectangle Cutting /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# 平面上に長方形があり、4つの頂点の座標は (0,0),(W,0),(W,H),(0,H) です。
# この長方形の内部または周上の点 (x,y) が与えられます。
# (x,y) を通る直線で長方形を 2つの部分に分割するとき、 面積の大きくない方の面積の最大値を求めてください。
# また、その最大値を達成する分割の方法が複数あるかも判定してください。

# 制約

#     1≤W,H≤109
#     0≤x≤W
#     0≤y≤H
#     入力はすべて整数である

# 入力
# 入力は以下の形式で標準入力から与えられる。
# W H x y

# 出力
# はじめに、面積の大きくない方の面積の最大値を出力せよ。
# つづいて、その最大値を達成する分割の方法が複数あるなら 1 を、そうでないなら 0 を出力せよ。 
# 出力された面積は、絶対誤差あるいは相対誤差が 10−9以下の時正答と判定される。

# 入力例 1
# 2 3 1 2

# 出力例 1
# 3.000000 0

# 直線 x=1で分割するのが最適です。また、最適な分割方法はこれ以外には存在しません。

# 入力例 2
# 2 2 1 1

# 出力例 2
# 2.000000 1


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    W, H, x, y = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(6):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(M):
    #     valueses.append(list(map(int, lines[i+1].split())))

    # (x,y)が中心点だったら
    if W == x*2 and H == y*2:
        flag = 1
    else:
        flag = 0

    area = W*H*0.5

    return [area, flag]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2 3 1 2']
        lines_export = ['3.000000 0']
    if pattern == 2:
        lines_input = ['2 2 1 1']
        lines_export = ['2.000000 1']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9228
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-3223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

#define MOD 100000
int M,N;
int A[20][20],B[20][20];
int one = 0b11111111111111111111;

int dp[2][20][1<<19];

int main() {
	iostream::sync_with_stdio(false);

	cin >> M >> N;
	for(int i=0; i<M; i++){
		string S;
		cin >> S;
		for(int j=0; j<N; j++){
			/*for(int k=0; k<(1<<19); k++){
				dp[i][j][k] = -1;
			}*/
			if(S[j] == '?') A[i][j] = -1;
			if(S[j] == 'J') A[i][j] = 0;
			if(S[j] == 'O') A[i][j] = 1;
			if(S[j] == 'I') A[i][j] = 2;
			
		}
	}
	for(int i=M-1; i>=0; i--){
		if(i != M-1) B[i][N-1] = B[i+1][0];
		else B[i][N-1] = 1;
		if(A[i][N-1] == -1) B[i][N-1] = (3*B[i][N-1])%MOD;
		//cout << B[i][N-1] << " ";
		for(int j=N-2; j>=0; j--){
			B[i][j] = B[i][j+1];
			if(A[i][j] == -1) B[i][j] = (3*B[i][j])%MOD;
			//cout << B[i][j] << " ";
		}
		//cout << endl;
	}

	for(int i=0; i<N; i++){
		for(int j=0; j<(1<<19); j++){
			dp[M%2][i][j] = 0;
		}
	}
	for(int y=M-1; y>=0; y--){
		for(int x=N-1; x>=0; x--){
			for(int state=0; state<(1<<19); state++){
				int re;
				if(x == N-1){
					if(A[y][x] == 0) re = dp[(y+1)%2][0][state & (one-(1<<(x-1)))];
					if(A[y][x] == 1) re = dp[(y+1)%2][0][state];
					if(A[y][x] == 2) re = dp[(y+1)%2][0][(state & (one-(1<<(x-1))))];
					if(A[y][x] == -1) re = dp[(y+1)%2][0][state & (one-(1<<(x-1)))] * 2 + dp[(y+1)%2][0][state];
				}
				else{
					if(A[y][x] == 0) re = dp[y%2][x+1][(state|(1<<x)) & (one-(1<<(x-1)))];
					if(A[y][x] == 1){
						re = dp[y%2][x+1][state&(one-(1<<x))];
					}
					if(A[y][x] == 2){
						if((state>>x) % 2 == 1) re = B[y][x+1];
						else re = dp[y%2][x+1][state&(one-(1<<x)-(1<<(x-1)))];
					}
					if(A[y][x] == -1){
						re = dp[y%2][x+1][(state|(1<<x)) & (one-(1<<(x-1)))];
						re += dp[y%2][x+1][state&(one-(1<<x))];
						if((state>>x) % 2 == 1) re += B[y][x+1];
						else re += dp[y%2][x+1][state&(one-(1<<x)-(1<<(x-1)))];
					}
				}

				//cout << y << " " << x << " " << state << endl;
				//cout << re << endl;
				dp[y%2][x][state] = re % MOD;
			}
		}
	}

	std::cout << dp[0][0][0] << endl;

	return 0;
}



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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

template <typename T>
T powmod(T n, T k, T mod) {
  if (k == 0) {
    return 1;
  } else if (k % 2 == 0) {
    return powmod(n * n % mod, k / 2, mod);
  } else {
    return n * powmod(n, k-1, mod) % mod;
  }
}

template <typename T>
T inv(T x, T mod) {
  return powmod(x, mod-2, mod);
}

template <typename T>
T comb(T n, T k, T mod) {
  assert (0 <= k && k <= n);
  T ret = 1;
  for (T i = 0; i < k; i++) {
    ret *= n - i;
    ret %= mod;
    ret *= inv(i+1);
    ret %= mod;
  }
  return ret;
}


int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  const ll mod = 1e9 + 7;

  int N; cin >> N;
  vector<ll> X(N); REP(i, N) cin >> X[i];
  vector<ll> fact(N + 1), inv_fact(N + 1), invs(N + 1);
  fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
  invs[0] = invs[1] = 1;
  FOR(i, 2, N + 1) {
    fact[i] = fact[i-1] * i % mod;
    inv_fact[i] = inv(fact[i], mod);
    invs[i] = inv<ll>(i, mod);
  }
  ll ans = 0, acc = 0;
  FOR(i, 1, N-1) {
    //acc = (acc + invs[i+1]) % mod;
    ans += (1 - invs[i+1] + mod) * X[i] % mod;
    ans %= mod;
  }

  REP(i, N-2) {
    ans += -X[i] + mod + invs[N-i-1] * X[i] % mod;
    ans %= mod;
  }
  REP(i, N-1) {
    /*
    FOR(j, i+1, N-1) {
      ans += (X[j] - X[i]) * invs[j-i+1] % mod * invs[j-i] % mod;
      ans %= mod;
    }
    */
    // N まで移動
    ans += (X[N-1] - X[i]) * invs[N-i-1] % mod;
    ans %= mod;
  }
  cout << (ans * fact[N-1] % mod) << endl;
  return 0;
}


Measured memory_bytes: 3456
/*
    Problem 3
    https://atcoder.jp/contests/abc122/tasks/abc122_b
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector<char> atcg {'A', 'T', 'C', 'G'};
/* function */
/* main */
int main(){
    string S;
    cin >> S;
    int lenATCG = 0;
    int r = 0;
    for (int l = 0; l < S.size(); l++) {
        while (r < S.size() && count(atcg.begin(), atcg.end(), S[r]))
            r++;
        lenATCG = max(lenATCG, r - l);
        l = r;
        r++;
    }
    cout << lenATCG << '\n';
}

Measured memory_bytes: 3596
#include <cstdio>
#include <vector>

#define MAX(a,b) ((a)>(b)?(a):(b))

using namespace std;


struct BINNODE {
	int parent;
	int degree;
	int sibling;
	int left;
	int right;

	BINNODE () { // default constructor
		parent=-1;
		degree=0;
		sibling=-1;
		left=-1;
		right=-1;
	}
};


void preorderwalk(vector<BINNODE>& node, int root) {
	if(root==-1) return;
	printf(" %d",root);
	preorderwalk(node,node[root].left);
	preorderwalk(node,node[root].right);
	return;
}

void inorderwalk(vector<BINNODE>&node, int root) {
	if(root==-1) return;
	inorderwalk(node,node[root].left);
	printf(" %d",root);
	inorderwalk(node,node[root].right);
	return;
}

void postorderwalk(vector<BINNODE>&node, int root) {
	if(root==-1) return;
	postorderwalk(node,node[root].left);
	postorderwalk(node,node[root].right);
	printf(" %d",root);
	return;
}

int main() {
	int n;
	int i;
	int id,left,right,root;
	vector<BINNODE> node;
	scanf("%d",&n);
	node.resize(n);
	for(i=0; i<n; ++i) {
		scanf("%d%d%d",&id,&left,&right);
		node[id].left=left;
		node[id].right=right;
		if(left==-1 && right==-1) {
			node[id].degree=0;
		} else if(left==-1) {
			node[id].degree=1;
			node[right].parent=id;
			node[right].sibling=-1;
		} else if(right==-1) {
			node[id].degree=1;
			node[left].parent=id;
			node[left].sibling=-1;
		} else {
			node[id].degree=2;
			node[left].parent=id;
			node[right].parent=id;
			node[left].sibling=right;
			node[right].sibling=left;
		}
	}
	for(i=0; i<n; ++i) {
		if(node[i].parent==-1) root=i;
	}
	printf("Preorder\n");
	preorderwalk(node,root);
	printf("\n");
	printf("Inorder\n");
	inorderwalk(node,root);
	printf("\n");
	printf("Postorder\n");
	postorderwalk(node,root);
	printf("\n");
	return 0;
}

Measured memory_bytes: 2620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
#define rep(i,s,n) for(ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(),a.end()
using namespace std;
using graph =vector<vector<ll>>;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
ll gcd(ll a, ll b) {
	ll r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}



/*最小公倍数*/

ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}


/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    string s;
    cin>>s;
    ll count=0;
    for(ll i=0;i<s.size();i++){
        if(s[i]=='h'&&s[i+1]=='i'){
            count++;
        }
    }
    if(count==(s.size()+2-1)/2){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    

}


Measured memory_bytes: 256
def actual(N, D, X, A):
    # 2 * [食べたチョコ] + 1 <= D かつ [食べたチョコ]は左の式を超えない整数 を解けばよい
    count_chocolates = lambda a_i: (D - 1) // a_i + 1

    return X + sum([count_chocolates(a_i) for a_i in A])

N = int(input())
D, X = map(int, input().split())
A = [int(input()) for _ in range(N)]

print(actual(N, D, X, A))


Measured memory_bytes: 9116
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD;
	auto P = RD;

	writeln((A * 3 + P) / 2);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    int n;
    cin >> n;
    long long a[100010];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    int zero=0;
    for(int i=0;i<n;i++){
        if(a[i] == 0){
            zero++;
        }
    }
    if(zero>0){
        cout << 0 << endl;
        return 0;
    }
    long long prod=1;
    for(int i=0;i<n;i++){
        if(a[i]<=1000000000000000000/prod){
            prod*=a[i];
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << prod << endl;
    return 0;
}

Measured memory_bytes: 4324
N, K = map(int,input().split())
A = list(map(int,input().split()))

d = {}
for a in A:
  if(a not in d):
    d[a] = 1
  else:
    d[a] += 1
if(len(d) <= K):
  print(0)
else:
  tmp = sorted(d.items(), key = lambda x: -x[1])[K:]
  print(sum(t[1] for t in tmp))

Measured memory_bytes: 38964
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    a, b, x = map(int, rl().split())
    ans = b // x - a // x
    if a % x == 0:
        ans += 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 2940
#include<stdio.h>
using namespace std;
int main()
{
    int a=0,b=0,c=0;//a奇数，b能被4整除，c被2整除
    int n;
    while(~scanf("%d",&n)){
            a=0,b=0,c=0;
    int s;
    while(n--)
    {
        scanf("%d",&s);
        if(s%2==1)
            a++;
        else
        {
            if(s%4==0)
                b++;
            else
                c++;
        }
    }
    if(a>b+1||(a==b+1&&c!=0))
        printf("No\n");
    else
         printf("Yes\n");
    }
        return 0;
}


Measured memory_bytes: 128
package main
import (
	"fmt"
	"bufio"
	"strconv"
	"os"
)

const MAX int = 10000
var N int

type Node struct {
	Parent int
	Left int
	Right int
}

var T []Node = make([]Node, MAX)
var D []int = make([]int, MAX)
var H []int = make([]int, MAX)

func setDepth(u, d int) {
	if u==-1 {
		return
	}
	D[u] = d
	setDepth(T[u].Left, d+1)
	setDepth(T[u].Right, d+1)
}

func setHeight(u int) int {
	h1 := 0
	h2 := 0
	if T[u].Left != -1 {
		h1 = setHeight(T[u].Left) + 1
	}
	if T[u].Right != -1 {
		h2 = setHeight(T[u].Right) + 1
	}
	if h1 > h2 {
		H[u] = h1
	} else {
		H[u] = h2
	}
	return H[u]
}

func getSibling(u int) int {
	if T[u].Parent == -1 {
		return -1
	}
	if T[T[u].Parent].Left != u && T[T[u].Parent].Left != -1 {
		return T[T[u].Parent].Left
	}
	if T[T[u].Parent].Right != u && T[T[u].Parent].Right != -1 {
		return T[T[u].Parent].Right
	}
	return -1
}

func print() {
	for i:=0; i<N; i++ {
		typeStr := ""
		if T[i].Parent == -1 {
			typeStr = "root"
		} else if T[i].Left == -1 && T[i].Right == -1 {
			typeStr = "leaf"
		} else {
			typeStr = "internal node"
		}
		degree := 0
		if T[i].Left != -1 {
			degree ++
		}
		if T[i].Right != -1 {
			degree ++
		}

		fmt.Printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n",
					i, T[i].Parent, getSibling(i), degree, D[i], H[i], typeStr)
	}
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	N = nextInt(scanner)
	for i:=0; i<N; i++ {
		T[i].Parent = -1
		T[i].Left = -1
		T[i].Right = -1
	}

	for i:=0; i<N; i++ {
		index := nextInt(scanner)
		T[index].Left = nextInt(scanner)
		T[index].Right = nextInt(scanner)
		if T[index].Left != -1 {
			T[T[index].Left].Parent = index
		}
		if T[index].Right != -1 {
			T[T[index].Right].Parent = index
		}

	}
	root := 0
	for i:=0; i<N; i++ {
		if T[i].Parent == -1 {
			root = i
		}
	}

	setDepth(root, 0)
	setHeight(root)

	print()
}


Measured memory_bytes: 1136
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const long long mod = 1000000007;
struct mint {
  long long x;
  mint(ll x = 0):x(x%mod) {}
  mint& operator+=(const mint a) {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    (x += mod-a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint ret(*this);
    return ret += a;
  }
  mint operator-(const mint a) const {
    mint ret(*this);
    return ret -= a;
  }
  mint operator*(const mint a) const {
    mint ret(*this);
    return ret *= a;
  }
  mint pow(ll t) const {
    if(t==0) return mint(1);
    mint a = pow(t>>1);
    a *= a;
    if(t&1) a *= *this;
    return a;
  }
  
  //for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint ret(*this);
    return ret /= a;
  }
};
ostream &operator<<(ostream& os, const mint& x) {
  os << x.x;
  return os;
}
class modutils {
  vector<mint> fact, invfact;
public:
  modutils(int n = 200005):fact(n+1),invfact(n+1) {
    fact[0] = 1;
    for(int i=1; i<=n; i++) fact[i] = fact[i-1] * i;
    invfact[n] = fact[n].inv();
    for(int i=n; i>=1; i--) invfact[i-1] = invfact[i] * i;
  }
  mint pow(mint x, ll n) {
    return x.pow(n);
  }
  mint comb(ll n, ll k) {
    if(n<0 || k<0 || n<k) return 0;
    return fact[n] * invfact[k] * invfact[n-k];
  }
  mint perm(ll n, ll k) {
    if(n<0 || k<0 || n<k) return 0;
    return fact[n] * invfact[n-k];
  }
  mint fac(ll n) {
    return fact[n];
  }
};
modutils mutil;


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

  mint X = 0, Y = 0, Z = 0;
  rep(i,N){
    X += (i * (N-i)) % mod;
  }
  X *= M;
  X *= M-1;

  {
    mint base = 0;
    rep(i,N-1){
      base += i+1;
      Y += base;
    }
  }
  Y *= M;
  {
    mint base = 0;
    rep(i,M-1){
      base += i+1;
      Z += base;
    }
  }

  mint W = mutil.comb(N*M-2, K-2);

  mint NN = N*N;
  
  mint ret = (Y + Z * NN + X) * W;
  //cout << Y << " " << Z << " " << NN << " " << X << " " << W << endl;
  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    string a;
    cin >> a;
    if (a.at(0) == a.at(1) || a.at(2) == a.at(1) || a.at(2) == a.at(3))cout << "Bad" << endl;
    else cout << "Good" << endl;
}

Measured memory_bytes: 384
#include<cstdio>
#define MOD 1000000007
#define MAXS 200000
typedef long long LL;

int h,w,a,b,ans=0;
LL jc[MAXS+5],inv[MAXS+5];

LL Powm(LL x,LL M) {
	LL cf=x,ret=1;
	while(M) {
		if(M&1)
			ret=ret*cf%MOD;
		cf=cf*cf%MOD;
		M>>=1;
	}
	return ret;
}
void Prepare() {
	jc[0]=1;
	for(LL i=1;i<=MAXS;i++)
		jc[i]=jc[i-1]*i%MOD;
	inv[0]=1;
	inv[MAXS]=Powm(jc[MAXS],MOD-2);
	for(LL i=MAXS-1;i>0;i--)
		inv[i]=(i+1)*inv[i+1]%MOD;
}
LL C(LL a,LL b) {
	if(a<0||b<0) return 1;
	return jc[a]*inv[b]%MOD*inv[a-b]%MOD;
}
int main() {
	Prepare();
	scanf("%d %d %d %d",&h,&w,&a,&b);
	for(LL i=b+1;i<=w;i++)
		ans=(ans+C(h-a+i-2,i-1)*C(a+w-i-1,w-i)%MOD)%MOD;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3328
//if acyclic graph try toposort
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
template <typename T>void umax(T &a, T b){
    a = max(a, b);
}
template <typename T>void umin(T &a, T b){
    a = min(a, b);
}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}

ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
const ll N = 3e3 + 5;
ld dp[N];
void solve(){
    ll n;
    cin >> n;
    dp[0] = 1;
    fo(i,n){
        ld p;
        cin >> p;
        for(ll j = i + 1; j>=0; j--){
            dp[j] = dp[j]*(1 - p) + (j?dp[j - 1]*p:0);
        }

    }
    //fo(i, n)cout << dp[i] << nl;
    ld ans = 0;
    fo(i, n + 1){
        ll t = n - i;
        if(t < i){
            ans += dp[i];
        }
    }
    cout << fixed << setprecision(10) << ans << nl;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    while(TC--){
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3868