akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int INF = 2e6;
ll MOD = 1e9 + 7;

int main(){
    int a, b; cin >> a >> b;
    int c = b - a;
    int d = c * (c + 1) / 2;

    cout << d - b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n, k, a[MAXN];
bool work() {
	static int s[MAXN];
	memset(s, 0, sizeof(s));
	for (int i = 1; i <= n; i++) {
		int l = max(1, i - a[i]), r = min(n, i + a[i]);
		s[l]++, s[r + 1]--;
	}
	bool res = false;
	for (int i = 1; i <= n; i++) {
		s[i] += s[i - 1];
		if (s[i] != a[i]) {
			res = true;
			a[i] = s[i];
		}
	}
	return res;
}
int main() {
	read(n), read(k);
	for (int i = 1; i <= n; i++)
		read(a[i]);
	for (int i = 1; i <= k; i++)
		if (!work()) break;
	for (int i = 1; i <= n; i++)
		printf("%d ", a[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 5264
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <deque>
using namespace std;
using P = pair<int,int>;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){ 
  int n; cin >> n;
  if(n%2==0){
    double tmp = n/2;
    cout << tmp/n;
  }else{
    double tmp = (n/2)+1;
    cout << tmp/n;
  }
  return 0;
}



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

using namespace std;

#define MAX_N 25

int n;

int map[8][8];
int bombx, bomby;

queue<int> queint;
queue<char> quechar;

int vx[] = { 1, 0, -1, 0, 2, 0, -2, 0, 3, 0, -3, 0 };
int vy[] = { 0, 1, 0, -1, 0, 2, 0, -2, 0, 3, 0, -3 };

void solve(int bx,int by){
	for (int i = 0; i < 12; i++){
		if (bx + vx[i] >= 0 && bx + vx[i] < 8 &&
			by + vy[i] >= 0 && by + vy[i] < 8){
			if (map[bx + vx[i]][by + vy[i]] == 1){
				map[bx + vx[i]][by + vy[i]] = 0;
				solve(bx + vx[i], by + vy[i]);
			}
		}
	}
}

int main(){
	int m;
	char c;

	cin >> m;
	for (int j = 0; j < m; j++){
		for (int i = 0; i < 8; i++){
			for (int k = 0; k < 8; k++){
				cin >> c;
				quechar.push(c);
			}
		}
		cin >> n;
		queint.push(n);
		cin >> n;
		queint.push(n);
	}
	for (int i = 0; i < m; i++){
		for (int y = 0; y < 8; y++){
			for (int x = 0; x < 8; x++){
				map[x][y] = quechar.front() - '0';
				quechar.pop();
			}
		}
		bombx = queint.front()-1; queint.pop();
		bomby = queint.front()-1; queint.pop();

		//????????????
		map[bombx][bomby] = 0;
		solve(bombx,bomby);
		cout << "Data " << i+1 << ":" << endl;
		for (int y = 0; y < 8; y++)
		{
			for (int x = 0; x < 8; x++)
			{
				cout << map[x][y];
			}
			cout << endl;
		}

	}

	return 0;
}

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

int main(){
  int N,M;
  cin >> N;
  vector<int> T(N);
  for (int i = 0; i < N; i++){
    cin >> T[i];
  }
  cin >> M;
  vector<int> P(M);
  vector<int> X(M);
  for (int i = 0; i < M; i++){
    cin >> P[i] >> X[i];
  }
  int ans = 0;
  for (int i = 0; i < M; i++){
    for (int j = 0; j < N; j++){
      if (j == (P[i] - 1)){
        ans += X[i];
      }
      else{
        ans += T[j];
      }
    }
    cout << ans << endl;
    ans = 0;
  }
}
//最後のans=0が謎

Measured memory_bytes: 256
n = gets.chomp.to_i
pn = gets.chomp.split.map(&:to_i)
qn = gets.chomp.split.map(&:to_i)
a = b = -1
(1..n).to_a.permutation.each.with_index(1) do |p, i|
  a = i if p == pn
  b = i if p == qn
end
puts (a - b).abs


Measured memory_bytes: 2300
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{ return firstElof.second < secondElof.second; }
//**Snippetリスト**//
//rep, vin, all//
//gcdlcm, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 1; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//

int main() {
	cin >> N >> K;
	if (K > N* (N - 1) / 2 - (N - 1)) {
		cout << -1;
		exit(0);
	}
	else {
		vpll A;
		for (k = 2; k <= N; k++) {
			A.push_back(make_pair(1, k));
		}
		ll Q = N * (N - 1) / 2 - (N - 1) - K;
		for (k = 2; k <= N - 1; k++) {
			if (Q == 0) { break; }
			for (l = k + 1; l <= N; l++) {
				A.push_back(make_pair(k, l));
				Q--;
				if (Q == 0) { break; }
			}
			if (Q == 0) { break; }
		}
		M = A.size();
		cout << M << endl;
		for (i = 0; i < M; i++) {
			cout << A[i].first << " " << A[i].second << endl;
		}
	}
}


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

int main(){

  int n;
  int ans = 0;
  cin>>n;
  int p[n];
  bool b[n];
  REP(i,n){
    cin>>p[i];
    if(p[i] == i+1){
      b[i] = true;
      ans++;
      
    }else{
      b[i] = false;
    }
  }
  

	int k = 0;
  REP(i,n){
    if(b[i] == true){
      k++;
      if(i==n-1&&k>=2){
        ans -= k/2;
      }
    }else{
      if(k>=2){
        ans-=k/2;
      }
      k = 0;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstring>
#include<set>
using namespace std;
set<string> s;
string t;
int n;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>t;
		s.insert(t);
	}
	cout<<s.size()<<endl;
} 

Measured memory_bytes: 19264
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = -1;
		
		while((n=scanner.nextInt()) != 0) {
			int scoreOfA=0, scoreOfB=0;
			for(int i=0; i<n; i++) {
				int a = scanner.nextInt();
				int b = scanner.nextInt();
				
				if(a>b) scoreOfA += (a+b);
				else if(b>a) scoreOfB += (a+b);
				else {
					scoreOfA += a;
					scoreOfB += b;
				}
			}
			System.out.printf("%d %d\n", scoreOfA, scoreOfB);
		}
		
		scanner.close();

	}

}

Measured memory_bytes: 59468
package main

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

func main() {
	n := getInt()
	ss := make([]string, n)
	for i := range ss {
		ss[i] = getString()
	}

	xs := make([]int, 26)
	for i := range xs {
		xs[i] = 51
	}

	for _, s := range ss {
		tmp := make([]int, 26)
		for _, c := range s {
			tmp[c-'a']++
		}

		for i := range xs {
			xs[i] = min(xs[i], tmp[i])
		}
	}

	ans := ""
	for i, x := range xs {
		for j := 0; j < x; j++ {
			ans += string('a' + i)
		}
	}

	fmt.Println(ans)
}

func min(ns ...int) int {
	min := ns[0]
	for i := 1; i < len(ns); i++ {
		if min > ns[i] {
			min = ns[i]
		}
	}
	return min
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
import math
import sys
input = sys.stdin.readline


def main():
    sc = Scan()
    s = sc.strarr()[0]

    index = 0
    for c in s:
        if index % 2 == 0 and c == 'L':
            print('No')
            exit()
        if index % 2 == 1 and c == 'R':
            print('No')
            exit()
        index += 1
    print('Yes')


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#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 <unordered_set>
#include <unordered_map>
using namespace std;

int n, w, h;

int main(void)
{
	cin >> n >> w >> h;
	vector<int>imosx(w + 1), imosy(h + 1);
	for (int i = 0; i < n; ++i)
	{
		int x, y, b;
		cin >> x >> y >> b;
		int lef = max(x - b, 0);
		int rht = min(x + b, w);
		int upp = max(y - b, 0);
		int dwn = min(y + b, h);
		imosx[lef]++;
		imosx[rht]--;
		imosy[upp]++;
		imosy[dwn]--;
	}
	bool xx = false, yy = false;
	for (int i = 0; i < w; ++i)
	{
		imosx[i + 1] += imosx[i];
		if (!imosx[i])
		{
			xx = true;
		}
	}
	for (int i = 0; i < h; ++i)
	{
		imosy[i + 1] += imosy[i];
		if (!imosy[i])
		{
			yy = true;
		}
	}
	if (xx && yy)cout << "No\n";
	else cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int n;
    cin >> n;
    vi x(n);

    int maior = 0, menor = 101;
    fo(i, n) {
        cin >> x[i];
        maior = max(maior, x[i]);
        menor = min(menor, x[i]);
    }

    int sta = INFINITO;
    for ( int p = menor; p <= maior; p++ ) {
        int cont = 0;
        for ( auto c : x ) {
            cont += (c - p) * (c - p);
        }
        sta = min(sta, cont);
    }

    cout << sta << endl;

    return 0;
}

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

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define debug(x) cerr << (#x) << "is "<< x << "\n"

using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,s=0,s1=0;
	cin >> n;
	vector<int> a(n);
	f(i,0,n){
		cin >> a[i];
		s+=a[i];
	}
	int ans = 1e9;
	f(i,0,n){
		s-=a[i];
		s1+=a[i];
		ans = min(abs(s1-s),ans);
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

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

func calcCumulativeSum(ints []int) []int {
	n := len(ints)
	cSum := make([]int, n)
	cSum[0] = ints[0]
	for i := 1; i < n; i++ {
		cSum[i] = ints[i] + cSum[i-1]
	}
	return cSum
}

func findMinDiff(ints []int) int {
	ints = calcCumulativeSum(ints)
	n := len(ints)
	total := ints[n-1]

	beforeDiff := total
	for _, sl := range ints {
		sr := total - sl
		diff := abs(sl - sr)
		if beforeDiff < diff {
			break
		}
		beforeDiff = diff
	}
	return beforeDiff
}

func abs(i int) int {
	if i < 0 {
		i = -i
	}
	return i
}

func main() {
	n := nextInt()
	ints := nextInts(n)
	r := findMinDiff(ints)
	fmt.Println(r)
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

#define MAX 55
#define MINF -(1e8)

int N,M,a[MAX],b[MAX],c[MAX];
int memo[MAX][MAX][MAX];

int solve(int n,int l1,int m){
    if(n == N) return 0;
    int &res = memo[n][l1][m];
    if(res != MINF) return res;
    for(int i = 0 ; i <= min(8,m) ; i++){
        for(int j = 0 ; j <= i ; j++){
            for(int k = 0 ; k <= min(l1,8-j) ; k++){
                int cost = (j+k == 0 ? c[n] : a[n]*j+b[n]*k);
                res = max(res,solve(n+1,i,m-i)+cost);    
            }
        }
    }
    return res;
}

int main(){
    cin >> N >> M;
    for(int i = 0 ; i < N ; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    fill(&memo[0][0][0],&memo[MAX-1][MAX-1][MAX-1],MINF);
    cout << solve(0,0,M) << endl;
    return 0;
}

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

const long long mod =1e9+7 ;
const int N = 3e3+5;


#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define fr(i,l,m) for(int i=l;i<m;i++)
# define vii vector<int>
#define vpr vector<pair<int,int> >
#define dbg(x) cout << #x << " is " << x << endl;
#define spk(x) cout<<x<<endl;
ll pwr(ll x,ll y);

////
////
////
ll a[3005], n,dp[N][N];
ll ans=0;
ll solve(ll l,ll r)
{

    if(l>r)return 0;
    int sz=(r-l+1);
    if(dp[l][r]!=mod)return dp[l][r];
    if((n-sz)%2)
    {
        if(l==r){dp[l][r]=-1*(ll)a[l];return -1*(ll)a[l];}
    dp[l][r]= min(-1*a[l]+(dp[l+1][r]==mod?solve(l+1,r):dp[l+1][r]),-1*a[r]+(dp[l][r]==mod?solve(l,r-1):dp[l][r-1]));
        //dbg(p);
        return dp[l][r];

    }
    else
    {
        if(l==r){dp[l][r]=a[l];return (ll)a[l];}
         dp[l][r]= max(a[l]+(dp[l+1][r]==mod?solve(l+1,r):dp[l+1][r]),a[r]+(dp[l][r-1]==mod?solve(l,r-1):dp[l][r-1]));
         //dbg(p)
         return dp[l][r];
    }
}
////
////
///
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);

cin>>n;

fr(i,1,n+1)
{
    cin>>a[i];
}
fr(i,0,n+1)
{
    fr(j,0,n+1)
    {

        dp[i][j]=mod;
    }
}
cout<<solve(1LL,n)<<endl;
return 0;

 }
ll pwr(ll x,ll y)
{
    ll ans=1;
    x=x%mod;
    while(y>0){
    if(y&1)ans=(x*(ans%mod))%mod;
    x=(x*x)%mod;
    y=y/2;

    }
    return ans%mod;
}


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

int main(){
  int A;
  cin >> A;
  int B;
  cin >> B;
  
  if(A>=13){
    cout << B << endl;
  }
  
  else if(A<=5){
    cout << 0 << endl;
  }
  
  else{
    cout << B/2 << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a + b >= c)
            System.out.print("Yes");
        else
            System.out.print("No");
    }
}

Measured memory_bytes: 21588
#include <iostream>
#include <vector>

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN_LL(v) ll v;cin>>v;
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl
const ll MOD = 1e9+7;
const int INF = 1000000000;

int main() {
  IN(N); IN_LL(K);

  vi A(N);
  REP(i, N) {
    cin >> A[i];
  }
  ll tento = 0, count2 = 0;
  REP(i, N) {
    REP(j, N) {
      if (A[i] > A[j]) {
        ++count2;
        if (i < j)
          ++tento;
      }
    }
  }
  ll ans = tento * K % MOD;
  ll cal = K * (K-1) / 2 % MOD;
  ans += count2 *cal;
  ans %= MOD;
  OUT(ans);

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> btn(100100);
  for(int i=1;i<=N;i++) {
    cin >> btn.at(i);
  }
  int num=1,ai;
  while(num<=N) {
    if(num==1) ai=btn.at(1);
    else ai=btn.at(ai);

    if(ai==2){
      cout << num << endl;
      break;
    }
    else num++;
  }
  if(num == N+1) cout << -1 << endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n, d, x;
    std::cin>>n>>d>>x;
    std::vector<int> a(n);
    for(int i = 0;i <a.size();i++){
        std::cin>>a[i];
    }

    std::transform(a.begin(), a.end(), a.begin(),
            [d](int k) -> int {return (d-1) / k + 1;});

    std::cout<<x + std::accumulate(a.begin(), a.end(), 0)
        <<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	if ( n >= 1 && n <= 999) {
		cout << "ABC" << endl;
		return 0;
	}
	if ( n >= 1000 && n <= 1998) {
		cout << "ABD" << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <math.h>

#define rep(i,n) for((i)=0;i<(int)(n);i++)
using namespace std;

int main() {
	int A[21], B[20], C[20];
	int N;
	cin >> N;
	int i;
	rep(i, N) {
		cin >> A[i];
	}
	rep(i, N)cin >> B[i];
	rep(i, N - 1)cin >> C[i];

	int ans = 0;
	rep(i, N) {
		ans += B[A[i]-1];
		if (i>0 && A[i] == A[i - 1] + 1)ans += C[A[i-1]-1];
	}
  cout << ans;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define nl "\n"
#define pi acos(-1)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pcase printf("Case %d:\n",ca)
int ca=1;
using namespace std;

int main(){
    string a;
    cin>>a;
    int r = 0;
    int x = 0;
    for(int i =0;i<a.size();i++){
        if(a[i]=='R'){
            x++;
            for(int j = i+1;j<a.size();j++){
                if(a[j]=='R'){
                    x++;

                }else{
                    break;
                }

            }
            r = max(x,r);
        }
        x=0;

    }
    cout<<r<<nl;
  
} 

   





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

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Block = Tuple!(int, "i", int, "j");
int[] di = [0, 1, 0, -1];
int[] dj = [1, 0, -1, 0];

void main() {
    int h, w;
    scan(h, w);
    auto ban = iota(h).map!(i => readln.chomp).array;

    auto d = new int[][](h, w);
    fillAll(d, inf3);
    d[0][0] = 0;
    auto q = Queue!(Block)(h * w + 100);
    q.insert(Block(0, 0));

    while (!q.empty) {
        auto f = q.front; q.popFront();
        auto i = f.i, j = f.j;

        foreach (k ; 0 .. 4) {
            int ni = i + di[k];
            int nj = j + dj[k];
            if (ni < 0 || nj < 0 || ni >= h || nj >= w) continue;
            if (d[ni][nj] < inf3 || ban[ni][nj] == '#') continue;
            d[ni][nj] = d[i][j] + 1;
            q.insert(Block(ni, nj));
        }
    }

    if (d[h - 1][w - 1] == inf3) {
        writeln(-1);
        return;
    }

    int black = h * w - d[h - 1][w - 1] - 1;

    foreach (i ; 0 .. h) {
        foreach (j ; 0 .. w) {
            black -= ban[i][j] == '#';
        }
    }

    writeln(black);
}


struct Queue(T) {
    private {
        size_t cap, head, tail;
        T[] data;
    }

    this (size_t n) in {
        assert(n > 0, "The capacity of a queue must be a positive integer.");
    } body {
        cap = n + 1;
        data = new T[](cap);
    }

    void clear() {
        head = tail = 0;
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return head == (tail + 1) % cap;
    }

    size_t length() {
        return head <= tail ? tail - head : cap - head + tail;
    }

    T front() in {
        assert(!empty, "The queue is empty.");
    } body {
        return data[head];
    }

    void removeFront() in {
        assert(!empty, "The queue is empty.");
    } body {
        (++head) %= cap;
    }

    alias popFront = removeFront;

    void insertBack(T x) in {
        assert(!full, "The queue is full.");
    } body {
        data[tail++] = x;
        tail %= cap;
    }

    alias insert = insertBack;

    T[] array() {
        return head <= tail ? data[head .. tail].dup : data[head .. $] ~ data[0 .. tail];
    }

    string toString() {
        import std.format : format;

        if (head <= tail) {
            return format("[%(%s, %)]", data[head .. tail]);
        }
        else {
            return format("[%(%s, %)", data[head .. $]) ~ format(", %(%s, %)]", data[0 .. tail]);
        }
    }
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
X, K, D = map(int, input().split())

ans = 0
if X - D * K >= 0:
    ans = X - D * K
elif X + D * K <= 0:
    ans = -(X + D * K)
else:
    n = int((K - X / D) / 2)
    ans = abs(X + D * (2 * n - K))
    n += 1
    ans = min(ans, abs(X + D * (2 * n - K)))

print(ans)

Measured memory_bytes: 9224
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
    string s;
    cin >> s;
    long long count=0,ans=0;
    for(int i=0; i<s.length(); i++){
        if(s[i]=='B')count++;
        else if(s[i]=='W')ans+=count;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  string A,B; 
  cin>>A>>B;
  string C = A+B;
  int D = stoi(C);
  for(int i=1;i<=1000;i++){
    if(i*i==D){
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

const int MAXN=100000;

int dp[MAXN]={0};
int a[MAXN]={0};

int main()
{
    int n, k;

    cin >>n>>k;

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

    dp[0]=0;

    for (int i=1; i<n; ++i)
    {
        int mini=-1;

        for (int j=1; j<=k; ++j)
        {
            if (i-j>=0)
            {
                if (mini==-1 or mini>dp[i-j]+abs(a[i]-a[i-j]))
                    mini=dp[i-j]+abs(a[i]-a[i-j]);
            }
        }

        dp[i]=mini;
    }

    cout <<dp[n-1];

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;
 
 
int main() {
    int n, k, min =  (int) 1e9 + 1;
    vector<int>as(3);
    cin >> as[0] >> as[1] >> as[2];
    sort (as.begin(), as.end());
    if (as[0] % 2 == as[1] % 2){
        cout << as[2] - as[1] + (as[1] - as[0]) / 2 << endl;
    }else{
        cout << as[2] + 1 - as[1] + (as[1] + 1 - as[0]) / 2 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a, b, k;
	cin>>a>>b>>k;
	set<int> res;
	for(int i = a; i < a + k; ++i){
		if(i >= a && i <= b)res.insert(i);
	}
	for(int i = b - k + 1; i <= b; ++i){
		if(i >= a && i <= b)res.insert(i);
	}
	for(auto x : res){
		cout<<x<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

char field[100][100];
ll d[100][100];

int dx[4]{0, 1, 0, -1};
int dy[4]{1, 0, -1, 0};


int main(int argc, char **argv)
{
	ll H, W; cin >> H >> W;
	ll cb{0}, cw{0};
	for (ll h = 0; h < H; ++h) for (ll w = 0; w < W; ++w) {
			cin >> field[h][w];
			if (field[h][w] == '.') ++cw;
			else ++cb;
			d[h][w] = -1;
		}


	queue<pair<ll, ll>> que;
	que.push(pair<ll, ll>(0, 0));
	d[0][0] = 1;

	while (!que.empty())
	{
		auto now = que.front(); que.pop();
		ll h = now.first;
		ll w = now.second;
		
		for (ll i = 0; i < 4; ++i)
		{
			ll nh = dy[i] + h;
			ll nw = dx[i] + w;

			if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
			if (field[nh][nw] == '#') continue;
			if (d[nh][nw] != -1) continue;
			
			d[nh][nw] = d[h][w] + 1;
			que.push(pair<ll, ll>(nh, nw));
		}
	}

	ll tmp = d[H-1][W-1];
	// std::cout << "cb : " << cb << "\tcw : " << cw << "\ttmp : " << tmp<< std::endl;
	if (tmp == -1)
		std::cout << tmp << std::endl;
	else
		std::cout << cw - tmp << std::endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
	    //件数の入力
		int a = scanner.nextInt();
		
		
		//棟、階、部屋で３次元配列arrayを作成
		int[][][] array = new int[4][3][10];
		
		
		//件数分繰り返し
		for (int i = 0; i < a; i++) {
			
			int b = scanner.nextInt();		//棟
			int f = scanner.nextInt();		//階
			int r = scanner.nextInt();		//部屋
			int v = scanner.nextInt();		//人数
			
			//人数を配列に代入
			array[b-1][f-1][r-1] += v;
		}
		
		
		//4棟分
		for (int i = 0; i < 4; i++) {
			
			//縦３
			for (int j = 0; j < 3; j++) {
				
				//横１０
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + array[i][j][k]);		//配列arrayを出力
				}
				
				System.out.println();		//次の列へ
			}
			
			//最後以外表示
			if (i != 3)
				System.out.println("####################");
		}
	}
}


Measured memory_bytes: 29444
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define bitcnt(a) (ll) __builtin_popcount((a))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main() {
  ll a, b;
  cin >> a >> b;
  if (a * b == 15) {
    cout << "*" << endl;
  } else if (a + b == 15) {
    cout << "+" << endl;
  } else {
    cout << "x" << endl;
  }
}


Measured memory_bytes: 764
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        int employee[] = new int[N];
        
        for(int i=0;i<N-1;i++){
            employee[sc.nextInt()-1]++;    
        }
        
        for(int i=0;i<N;i++){
            System.out.println(employee[i]);
        }
        
        
    }
}


Measured memory_bytes: 61688
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define pb push_back
#define mp make_pair
#define PI 3.14159265359
//#define gc() getchar_unlocked();
using namespace std;
clock_t start_time,end_time;

inline float ellapse(){ return (clock()-start_time)*1.0/CLOCKS_PER_SEC; }
//inline int read_int() {register char c = gc();while(c<'0' || c>'9') c = gc();int ret = 0; while(c>='0' && c<='9') {ret = 10 * ret + c - 48; c = gc();}return ret;}
long long int gcd( long long int a , long long int b )
{
    return b == 0 ? a : gcd( b , a%b );
}

long long power( long long a , long long b )
{
    long long ret = 1 ;
    while( b ) {
        if( b%2 == 1 ) ret = ( ret * a ) % mod  ;
        a = (a * a) % mod ;
        b /= 2 ;
    }
    return ret ;
}


#define N 310


int main()
{
    int n , k , x , ans = 0;
    cin >> n >> k ;

    for( int i = 0; i < n ; i++ ) {
      cin >> x ;
      ans += 2 * min( x , abs( k - x ) ) ;
    }
    cout <<  ans ;
    return 0 ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define E endl
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		string s;
		cin>>s;
		int n = s.size();
		while(n--)cout<<"x";
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(int i=j;i<k;i+=in)
#define DF(i,j,k,in) for(int i=j;i>=k;i-=in)
#define feach(it,l) for (auto it = l.begin(); it != l.end(); ++it)
#define fitr(it,it1,itr2) for(auto it=itr1;it!=itr2;++it)
#define fall(a) a.begin(),a.end()
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define eq equal_range
#define fs first
#define ss second
#define ins insert
#define mkp make_pair
#define PI 3.1415926535897932384626433832795
#define endl "\n"
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vin;
typedef vector<char> vch;
typedef vector<string> vst;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll,ll>> vpll;
typedef set<ll> sll;
typedef set<int> sint;
typedef set<char> sch;
typedef set<string> sst;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef map<ll,ll> mll;
typedef pair<ll,ll> pll;
const ll MOD=1000000007;
ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;}
int main()
{
  ios_base::sync_with_stdio(false) , cin.tie(NULL) , cout.tie(NULL);
  int sx, sy , tx, ty;
  cin>>sx>>sy>>tx>>ty;
  string ans;
  F (i,0,tx-sx,1) ans+='R';
  F (i,0,ty-sy,1) ans+='U';
  F (i,0,tx-sx,1) ans+='L';
  F (i,0,ty-sy,1) ans+='D';
  ans+='L';
  F (i,0,ty-sy+1,1) ans+='U';
  F (i,0,tx-sx+1,1) ans+='R';
  ans+='D';
  ans+='R';
  F (i,0,ty-sy+1,1) ans+='D';
  F (i,0,tx-sx+1,1) ans+='L';
  ans+='U';
  cout<<ans;
return 0;
}




Measured memory_bytes: 3668
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    hit = 0
    blow = 0
    for i in range(4):
        try:
            if i == a.index(b[i]):
                hit += 1
            else:
                blow += 1
        except:
            pass
    print("{} {}".format(hit, blow))



Measured memory_bytes: 5592
N = int(input())
S = list(map(int,input().split()))
B = list(reversed(S))
B.sort()
count = 0
for i in range(len(S)):
    if S[i] != B[i]:
        count += 1
if count == 2 or count == 0:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3060
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	k := nextInt()
	sunuke := make([]bool, n)
	for i := 0; i < k; i++ {
		d := nextInt()
		for j := 0; j < d; j++ {
			a := nextInt()
			sunuke[a-1] = true
		}
	}
	ans := 0
	for i := 0; i < n; i++ {
		if sunuke[i] == false {
			ans++
		}
	}
	fmt.Println(ans)
}

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


Measured memory_bytes: 1760
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<vector>
#include<math.h>
#define ls(x) (x<<1)
#define rs(x) ((x<<1)|1)
#define ll long long
using namespace std;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    if(k&1)
    {
        printf("%lld",(long long)(n/k)*(n/k)*(n/k));
    }
    else
    {
        int a=n/k;
        k>>=1;
        int b=n/k;
        b-=a;
        printf("%lld",(long long)a*a*a+(long long)b*b*b);
    }
}


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

typedef long long LL;
typedef unsigned long long LONG;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MAXINT = 2147483647;
const int mod = 1000000007;
const long long MAXLONG = 9223372036854775807;
const LL INT32 = (LL(MAXINT) + 1) * 2;
using namespace std;
typedef pair<int, int> PII;
#define ft fisrt
#define sd second
#define eb emplace_back
#define END '\n'

template<class T>
inline bool Read(T &ret) {
    char c;
    int sgn;
    if (static_cast<void>(c = getchar()), c == EOF) return 0;
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (static_cast<void>(c = getchar()), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

template<class T>
inline void Write(T x) {
    if (x < 0) putchar('-'), Write(x);
    if (x > 9) Write(x / 10);
    putchar(x % 10 + '0');
}

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    map<int, int> ans;
    for (int i = 1; i < n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            {
                int dis = j - i;
                if (dis >= (abs(i - x) + abs(j - y)) + 1)
                    dis = abs(i - x) + abs(j - y) + 1;
                if (dis >= (abs(i - y)) + abs(j - x) + 1)
                    dis = abs(i - y) + abs(j - x) + 1;
                ans[dis]++;
            }
        }
    }
    for (int i = 1; i < n; ++i) {
        cout << ans[i] << END;
    }
    return 0;
}


Measured memory_bytes: 384
S = input()
K = int(input())


if S[0] != "1":
    print(S[0])
else:
    i = 0
    count = 0
    while i < len(S) and S[i] == "1":
        count += 1
        i += 1
    if K <= count:
        print(1)
    else:
        print(S[i])

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
int main() {
	int n,i,x;
	int f;
	scanf("%d", &n);
	for (i = 1; i <= n; ++i) {
		for (x = i, f = 0; 0 < x; x /= 10)
			if (!(i % 3) || (x % 10 == 3)) f = 1;
		if(f) printf(" %d", i);
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <iostream>
#include <set>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  set<int> ss;
  ss.insert(a);
  ss.insert(b);
  ss.insert(c);
  cout << ss.size() << endl;
  return 0;
}


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

using namespace std;

int main() {
	int n,k;
  	cin>>n>>k;
  	pair<long long int,long long int> w[n];
  	for(int i=0; i<n; i++) {
    	cin>>w[i].first>>w[i].second;
    }
  	sort(w,w+n);
  	vector<vector<long long int>> dp(n+1,vector<long long int> (k+1,0));
  	
  	for(int i=1; i<=n; i++) {
    	for(int j=1; j<=k; j++) {
        	if(w[i-1].first<=j)  {
                	dp[i][j] = max(dp[i-1][j-w[i-1].first] + w[i-1].second,dp[i-1][j]);
        	} else {
        	    dp[i][j] = dp[i-1][j];
        	}
        }
    }
    /*for(int i=0;i<=n;i++) {
		for(int j=0; j<=k; j++) {
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
  	cout<<dp[n][k];
	return 0;
}

Measured memory_bytes: 80256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const long long INF = 1LL << 60;    // 1.15x10^18
using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

Graph g;
vector<long long> a, b;
long long x = INF;
bool dfs(int u) {
    bool ret = true;
    for (auto &p: g[u]) {
        int v = p.first; long long s = p.second;
        if (a[v] == INF) {
            a[v] = -a[u];
            b[v] = s - b[u];
            ret &= dfs(v);
        } else {
            if (x == INF) {
                long long num = s - b[u] - b[v];
                long long den = a[u] + a[v];
                if (den == 0) {
                    if (num == 0) {  }
                    else return false;
                } else {
                    if (num % den != 0) return false;
                    x = num / den;
                }
            } else {
                if (a[u] * x + b[u] + a[v] * x + b[v] != s) return false;
            }
        }
    }
    return ret;
}

int main() {
    int n, m; cin >> n >> m;
    g.resize(n);
    while (m--) {
        int u, v, s; cin >> u >> v >> s; u--, v--;
        g[u].emplace_back(v, s);
        g[v].emplace_back(u, s);
    }
    a.assign(n, INF);
    b.assign(n, INF);
    a[0] = 1, b[0] = 0;
    if (!dfs(0)) return !(cout << 0 << endl);
    if (x != INF) {
        for (int i = 0; i < n; i++) {
            if (a[i] * x + b[i] <= 0) return !(cout << 0 << endl);
        }
        cout << 1 << endl;
    } else {
        long long l = -INF, r = INF;
        for (int i = 0; i < n; i++) {
            if (a[i] > 0) {
                chmax(l, (1 - b[i] + a[i] - 1) / a[i]);
            } else if (a[i] < 0) {
                chmin(r, (1 - b[i]) / a[i]);
            }
        }
        cout << max(0LL, r - l + 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 14080
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,x,ans=0;
  cin >> n;
  map<int,int> m;
  for(int i=0; i<n; i++) {
    cin >> x;
    m[x]++;
  }
  for(auto p:m) {
    if(p.second%2) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  ios::sync_with_stdio(false);
  cin.tie(0);
 
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<char>> cake(H, vector<char>(W, 0));
  vector<int> check(H, 0);
  for (int i = 0; i < H; i++) 
    for (int j = 0; j < W; j++) {
      cin >> cake[i][j];
      if (cake[i][j] == '#') ++check[i];
  }
  vector<vector<int>> ans(H, vector<int>(W, 0));
  int count = 1;
  for (int i = 0; i < H; i++) {
    if (check[i] == 0) {
        check[i] = -1;
        continue;
    }
    for (int j = 0; j < W; j++) {
      if (check[i] != 0) ans[i][j] = count;
      else ans[i][j] = count - 1;
      if (cake[i][j] == '#') {
        --check[i];
        ++count;
    }
  }
  }
  for (int i = 1; i < H; i++) 
    if (check[i] == -1)
      for (int j = 0; j < W; j++) 
        ans[i][j] = ans[i - 1][j];

  for (int i = H - 2; i >= 0; i--) 
    if (check[i] == -1) 
      for (int j = 0; j < W; j++) 
        ans[i][j] = ans[i + 1][j];

  for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
          cout << ans[i][j] << ' ';
      }
      cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 1280
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    else:
        if op == "?":
            break


Measured memory_bytes: 5596
// -*- coding:utf-8-unix -*-

use proconio::input;
use proconio::marker::{Bytes, Chars};

fn main() {
    input! {
        n: Chars,
    }
    
    let mut yes = false;
    for s in  n {
        if s == '7' {
            yes = true;
        }
    }
    if yes {
        println!("Yes" )
    }else{
        println!("No")
    }


}


Measured memory_bytes: 2176
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N;
  cin >> N;
  /*
    4 / N == 1 / h + 1 / n + 1 / w == (h*n + h*w + n*w) / h*n*w;
    4*h*n*w == N*(h*n + h*w + n*w);
    w*(4*h*n - N*n -N*h) == N*h*n
  */
  for (long h = 1; h <= 3500; h++) for (long n = 1; n <= 3500; n++) {
    long foo = N * h * n;
    long bar = 4*h*n - N*n - N*h;
    if (bar <= 0) continue;
    if (foo % bar) continue;
    long w = foo / bar;
    cout << h << " " << n << " " << w << endl;
    return;
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] ts = new int[n];
    for (int i = 0; i < n; ++i) {
      ts[i] = sc.nextInt();
    }
    int m = sc.nextInt();
    int[] ps = new int[m];
    int[] xs = new int[m];
    for (int i = 0; i < m; ++i) {
      ps[i] = sc.nextInt();
      xs[i] = sc.nextInt();
    }
    int sumT = 0;
    for (int i = 0; i < n; ++i) {
      sumT += ts[i];
    }

    for (int i = 0; i < m; ++i) {
      System.out.println(sumT - (ts[ps[i] - 1] - xs[i]));
    }
  }
}


Measured memory_bytes: 22996
x = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

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

    # divisors.sort()
    return divisors

li = make_divisors(x)
for i in range(-1000,1000):
    for j in range(i+1,1000):
        if j-i in li:
            if j**5-i**5 == x:
                if x >= 0:
                    print(j,i)
                    exit()
                else:
                    print(i,j)
                    exit()

Measured memory_bytes: 9508
#include <cstdio>
using namespace std;

int main(){
	int N;
	scanf("%d", &N);
	
	while(N--){
		int a = 0, b = 0, t;
		bool flag = true;
		for(int i = 0; i < 10; i++){
			scanf("%d", &t);
			if(a < t){
				if(b < t){
					(a > b ? a : b) = t;
				}
				else{
					a = t;
				}
			}
			else{
				if(b < t){
					b = t;
				}
				else{
					flag = false;
				}
			}
		}
		printf(flag ? "YES\n" : "NO\n");
	}
	return 0;
}

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

int main () {
  int N, a, b, c;
  cin >> N;
  a = N/100;
  b = (N-a*100)/10;
  c = N-a*100-b*10;
  if (a == c) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
} 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
const int maxn=1e5+9;
int ord[maxn];
int main()
{
    int n ;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int h;
        scanf("%d",&h);
        ord[h]=i;
    }
    for(int i=1;i<=n;i++)
        printf("%d ",ord[i]);
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N = 100010;
int a[N];

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n, x;

	cin >> n >> x;
	for(int i = 0; i < n; i++) cin >> a[i];
	a[n] = x;

	sort(a, a+n+1);
	int ans = a[1] - a[0];
	for(int i = 2; i <= n; i++){
		x = a[i] - a[i-1];
		ans = __gcd(ans, x);
	}
	cout << ans ;
}	

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, a, b;
  cin >> n >> a >> b;
  cout << n / (a + b) * a + min(n % (a + b), a) << '\n';
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  char tmp;
  for(int i=0; i<n; i++){
    cin >> tmp;
    if(tmp=='Y'){cout << "Four" << endl;return 0;}
  }
  cout << "Three" << endl;
}

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

int main(int argc, char const *argv[]) {
  int x;
  bool power[1001] = {false};
  cin >> x;

  power[1] = true;
  for (int i = 2; i*i < 1000; i++) {
    int p = i*i;
    while (p <= 1000) {
      //cout << p << endl;
      power[p] = true;
      p *= i;
    }
  }

  for(int i=x; i>0; i--){
    if(power[i]) {cout << i << endl; break;}
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MOD 998244353LL

using namespace std;

int main() {
  int n, s, a[3000];
  ll dp[3001][3001] = {};
  cin >> n >> s;
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  dp[0][0] = 1;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j <= s; j++) {
      dp[i + 1][j] = (dp[i + 1][j] + (dp[i][j] << 1)) % MOD;
      if(j + a[i] <= s)
        dp[i + 1][j + a[i]] = (dp[i + 1][j + a[i]] + dp[i][j]) % MOD;
    }
  }
  printf("%lld\n", dp[n][s]);
}

Measured memory_bytes: 74164
#include<stdio.h>

#define MAX 100000

int Paritition(int *,int,int);

int main(){
  int i,j,n,index;
  int A[MAX];

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);

  index=Paritition(A,0,n-1);

  for(i=0;i<index;i++) printf("%d ",A[i]);
  printf("[%d] ",A[index]);
  for(i=index+1;i<n-1;i++) printf("%d ",A[i]);
  printf("%d\n",A[i]);
  
  return 0;
}

int Paritition(int *A,int p,int r){
  int i,j,x,tmp;

  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i+=1;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }

  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;

  return i+1;
}



Measured memory_bytes: 2144
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n;
char num[1000010];
int f[1000010];
int b[1000010];

int main()
{
	scanf("%s\n", num);
	n = strlen(num);
	
	reverse(num, num + n);
	for (int i = 0 ; i < n ; i++)
		num[i] = num[i] - '0';
	num[n] = 0;
		
	f[0] = num[0];
	b[0] = 10 - num[0];
	
	for (int i = 1 ; i <= n ; i++) {
		int numA;
		int numB;
		numA = f[i - 1] + num[i];
		numB = b[i - 1] + num[i] + 1;
		if (numA > numB)
			f[i] = numB;
		else
			f[i] = numA;
			
		numA = f[i - 1] + (10 - num[i]);
		numB = b[i - 1] + (10 - num[i] - 1);
		if (numA > numB)
			b[i] = numB;
		else
			b[i] = numA;
	}
	
	if (f[n] > b[n]) {
		printf("%d\n", b[n]);
	} else {
		printf("%d\n", f[n]);
	}
		
	return 0;
}

Measured memory_bytes: 8960
#include<iostream>
using namespace std;
int main ()
{int H,N,i;
 int A[100000];
 cin>>H>>N;
 for (i=0;i<N;i++){
    cin>>A[i];
 }
 for(i=0;i<N;i++){
    H-=A[i];
 }
 if(H<=0){cout<<"Yes"<<endl;
    }
 else{
    cout<<"No"<<endl;
  }
    return 0;
}


Measured memory_bytes: 640