akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned int
#define test int t;cin>>t; while(t--)
#define en '\n'
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) (int)x.size()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
// You should only debug a pair of simple data types. For example,
// the debug won't work if one of pair's elements is collection type
// (std::vector, std::map, std::set...).
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


// bool check_prime(int n)  return whether a number is prime or not O(sqrt(N));
// int BE(int x,int n,int m)  return x^n%m; O(logN);
// void sieve()  from number 1-1000001 saare prime store kar lega  in bool is_prime[1000001] array
// vector<int> z_array(string s)  return vector which is Z-array of string s;
// vector<int> lps(string s)      return vector which is lps array of string s;
// int power(int x,int n) return x^n; O(logN);
// using_ordered_set (template for using ordered set , replace first 2 lines of this page with this code..);
const int gf = 1e6 + 9;

// int get(int n,int k,int i)
// {
// 	int ans=0;
// 	var=n%i;
// 	n-=var;
// 	ans+=(n/i)*(k-i);

// }

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n, k;
	cin >> n >> k;
	int ans = 0;
	if (k == 0)
	{
		cout << n*n << en;
		return 0;
	}

	rep(i, k, n)
	{
		// b=i here ...
		// a%i >=k;
		int var = n - n % i;
		int var2 = n % i;
		ans += (var / i) * (max(0ll, i - k));
		ans += max(0ll, var2 - k + 1);
	}
	cout << ans << en;


	return 0;
}




Measured memory_bytes: 3652
#include<stdio.h>

int A[100];

void swap(int *a, int *b){
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

int selection(int *A, int N){
    int i, j, minj;
    int ans = 0;
    
    for(i = 0; i < N; i++){
        minj = i;
        for(j=i+1; j < N; j++){
            minj = A[j] < A[minj]?j:minj;
        }
        if(i != minj){
            swap(&A[i], &A[minj]);
            ans++;
        }
    }
    return ans;
}

int main(void){
    int i, ans, n;
    
    scanf("%d", &n);
    
    for(i=0; i<n;i++){
        scanf("%d", &A[i]);
    }
    
    ans = selection(A, n);
    
    for(i=0; i<n;i++){
        if(i == n-1) printf("%d\n", A[i]);
        else printf("%d ", A[i]);
    }
    printf("%d\n", ans);

    return 0;    
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main () {
    long long n,a,b;
    scanf ("%lld %lld %lld",&n,&a,&b);
    long long go = n/(a+b);
    long long res = n%(a+b);
    printf ("%lld\n",go*a+min(a,res));
}



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

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    cin >> n >> m;
    int a[n];
    for (int i = 0; i < n; i++) a[i] = -1;
    int x, y, flag = 1;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        x--;
        if (a[x] == -1 || a[x] == y) a[x] = y;
        else flag = 0;
    }
    if (a[0] == 0 && n != 1) flag = 0;
    if (flag) {
        for (int i = 0; i < n; i++) {
            if (a[i] == -1) {
                if (i == 0 && n != 1) cout << "1";
                else cout << "0";
            } else cout << a[i];
        }
        cout << "\n";
    } else cout << "-1\n";
    return 0;
}


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

class Program
{
    public static void Main()
    {
        while(true)
        {
            int[] data = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if(data[0] == 0 && data[1] == 0)break;
            
            for(int i = 0; i < data[0];i++)
            {
                for(int j = 0; j < data[1];j++)
                {
                    Console.Write("#");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}


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

int main() {
	long long int n;
	cin >> n;
	long long int asum = (n*(n+1))/2;
	long long int a = n/3;
	long long int b = n/5;
	long long int c = n/15;
	long long int tsum = 3*a*(a+1)/2;
	long long int fsum = 5*b*(b+1)/2;
	long long int tfsum = 15*c*(c+1)/2;
	cout << asum - tsum - fsum + tfsum << endl;
	return 0;
}

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

int main() {

  int N;
  cin >> N;
    if(N<=111){
      cout << 111 << endl;
    }else if(N<=222){
      cout << 222 << endl;
    }else if(N<=333){
      cout << 333 << endl;
    }else if(N<=444){
      cout << 444 << endl;
    }else if(N<=555){
      cout << 555 << endl;
    }else if(N<=666){
      cout << 666 << endl;
    }else if(N<=777){
      cout << 777 << endl;
    }else if(N<=888){
      cout << 888 << endl;
    }else{
      cout << 999 << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int x[100005], l[100005];
int asc(const void* a, const void* b)
{
	if (x[*(int*)a] > x[*(int*)b])return 1;
	if (x[*(int*)a] < x[*(int*)b])return -1;
	return 0;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	for (i = 0; i < n; i++)
		scanf("%d %d", &x[i], &l[i]);
	int c[100005];
	for (i = 0; i < n; i++)
		c[i] = i;
	qsort(c, n, sizeof(int), asc);
	int ans = 1;
	int p = 0;
	for (i = 1; i < n; i++)
	{
		if (x[c[i]] - l[c[i]] < x[c[p]] + l[c[p]])
		{
			if (x[c[i]] + l[c[i]] < x[c[p]] + l[c[p]])
				p = i;
		}
		else
		{
			ans++;
			p = i;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1788
Program ABC159A
   implicit none
   integer::n,m,x

      read(*,*) n,m
      if (n>=2.AND.m>=2) then
         x=n*(n-1)/2+m*(m-1)/2
      else
         if (n==1.AND.m==1) then
            x=0
         else if (n==1.AND.m==2) then
            x=1
         else if (n==2.AND.m==1) then
            x=1
         else if (n==0.OR.m==0) then
            x=n*(n-1)/2+m*(m-1)/2
         end if
      end if
      print *,x
      stop

   End Program ABC159A

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr <<__LINE__<< ": " << #x << " -> " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#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 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

ll beki(ll x, ll n, const ll &p) {
    ll ret = 1;
    while (n > 0) {
        if (n & 1) (ret *= x) %= p;
        (x *= x) %= p;
        n >>= 1;
    }
    return ret;
}

void solve() {
    string s;
    cin >> s;
    int cnt[2020] = {0};
    cnt[0]++;
    reverse(all(s));
    int now = 0;
    rep(i, (int)s.size()) {
        now = (now + (s[i] - '0') * beki(10, i, 2019)) % 2019;
        cnt[now]++;
    }
    ll ans = 0;
    rep(i, 2019) {
        ans += cnt[i] * (cnt[i] - 1) / 2;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 3768
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int K = sc.nextInt();
        
        int distanceSum = 0;
        
        for(int i = 0; i < N; i++){
            int x = sc.nextInt();
            distanceSum += Math.min(x * 2, (K-x)*2);
        }
        
        System.out.println(distanceSum);
    }
    
}


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

int main() {
  string s;int ans1=0, ans2=0;
  cin >> s;
  for(int i = 0;i<s.size();i++){
    if(i%2==int(s[i]-'0'))ans1++;
  }
  for(int i = 0;i<s.size();i++){
    if((i+1)%2==int(s[i]-'0'))ans2++;
  }
  cout << min(ans1, ans2) << endl;
}


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

int main(){
    int x; cin >> x;
    if(x >= 400 and x < 600) cout << 8 << endl;
    else if(x >= 600 and x < 800) cout << 7 <<endl;
    else if(x >= 800 and x < 1000) cout << 6 <<endl;
    else if(x >= 1000 and x < 1200) cout << 5 <<endl;
    else if(x >= 1200 and x < 1400) cout << 4 <<endl;
    else if(x >= 1400 and x < 1600) cout << 3 <<endl;
    else if(x >= 1600 and x < 1800) cout << 2 <<endl;
    else if(x >= 1800 and x < 2000) cout << 1 <<endl;
    return 0;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split("/");
        int y = Integer.parseInt(a[0]);
        int m = Integer.parseInt(a[1]);
        int d = Integer.parseInt(a[2]);
        
        if (y <= 2019 && m <= 4 && d <= 30) {
            System.out.println("Heisei");
        } else {
            System.out.println("TBD");
        }
    }
}


Measured memory_bytes: 21204
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    string s;
    while(cin >> s, s != "0"){
        int n = s.size();
        int t = 0;
        int ans = 0;
        vi cnt(11);
        cnt[0]++;
        rep(i,n){
            int a = s[i]-'0';
            if(i%2)a = 11 - a;
            t = t + a;
            t %= 11;
            ans += cnt[t] - (s[i]=='0');
            if(s[i] > '0')cnt[t]++;
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3196
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

N,K = map(int, input().split())
H = []
for i in range(N):
    h = int(input())
    H.append(h)
H.sort()

ans = 10**9
for i in range(N-K+1):
    ans = min(ans,H[i+K-1]-H[i])

print(ans)

Measured memory_bytes: 20956
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
using namespace std;

ll fw[200001];
ll bw[200001];

int main() {
    
    ll n,k,c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    ll tmp = -mop;
    ll now = 0;
    for(ll i=0;i<s.length();i++){
        if(tmp+c < i and s[i] == 'o'){
            tmp = i;
            now++;

        }
        fw[i] = now;
    }
    now = 0;
    tmp = mop;
//    cout << "mofu" << endl;
//    cout << s.length() << endl;;
    for(ll i=s.length()-1;i>=0;i--){
//        cout << i << endl;
        if(tmp-c > i and s[i] == 'o'){
            tmp = i;
            now++;

        }
        bw[i] = now;
    }
    if(n == 1){
        cout << 1 << endl;
    }else {
        if (bw[1] < k) {
            cout << 1 << endl;
        }
//    cout << "Mofu" << endl;
        for (ll i = 1; i < s.length() - 1; i++) {
            if (fw[i - 1] + bw[i + 1] < k) {
                cout << i + 1 << endl;
            }
        }
        if (fw[s.length() - 2] < k) {
            cout << s.length() << endl;
        }
    }

}

Measured memory_bytes: 4996
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;

static constexpr ull MOD = 1000000007;
static constexpr double pi = 3.14159265359;



int main() {
    ull A, B;
    ull Q;
    cin >> A >> B >> Q;
    vector<ull> s;
    for (ull i = 0; i < A; ++i) {
        ull tmp;
        cin >> tmp;
        s.push_back(tmp);
    }
    sort(s.begin(), s.end());
    vector<ull> t;
    for (ull i = 0; i < B; ++i) {
        ull tmp;
        cin >> tmp;
        t.push_back(tmp);
    }
    sort(t.begin(), t.end());


    for (ull i = 0; i < Q; ++i) {
        ull x;
        cin >> x;
        auto es = lower_bound(s.begin(), s.end(), x);
        auto et = lower_bound(t.begin(), t.end(), x);
        auto ws = es - 1;
        auto wt = et - 1;

        ull d1 = 999999999999;
        if (es != s.end() && et != t.end()) {
            d1 = max(*es, *et) - x;
        }
        ull d2 = 999999999999;
        if (es != s.begin() && et != t.begin()) {
            d2 = x - min(*ws, *wt);
        }
        ull d3 = 999999999999;
        if (es != s.begin() && et != t.end()) {
            d3 = 2 * min((x - *ws), (*et - x)) + max((x - *ws), (*et - x));
        }
        ull d4 = 999999999999;
        if (et != t.begin() && es != s.end()) {
            d4 = 2 * min((x - *wt), (*es - x)) + max((x - *wt), (*es - x));
        }
        ull ans = min(d1, min(d2, min(d3, d4)));
        cout << ans << endl;
    }
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
void f(int a, int b) {for (int i{a}; i <= b; ++i) cout << i << "\n";}
int main()
  {int A, B, K, x, y; cin >> A >> B >> K, x = min(B, A + --K), y = max(A, B - K);
  y <= x ? f(A, B) : (f(A, x), f(y, B));}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	vector<int>v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	sort(v.begin(),v.end());
	cout<<v[n-1]-v[0]<<endl;
	return 0;
}


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

string S;

int main(){
    cin>>S;
    int n=S.length();
    int ans=0;
    for(int i=0;i<n/2;i++){
        if(S[i]!=S[n-1-i]){ans++;}
    }
    cout<<ans<<endl;
}

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

int main(){
  string s;
  cin >> s;
  int ex = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'o'){
      ex++;
    }
  }
  cout << 700 + 100 * ex << endl;
  return 0;
}

Measured memory_bytes: 256
import numpy as np
n = int(input())
b = list(map(int, input().strip().split()))
s = sum(b)
x = np.zeros((n))

x[0] = s
k = 1
for i in range(int((n-1)/2)):
    x[0] -= 2*b[k%n]
    k += 2

for i in range(1,n):
    x[i] = 2 * b[i-1] - x[i-1]

x = (x.astype(int)).tolist()

s = str(x)
s = s.replace(',','')
s = s.replace('[','')
s = s.replace(']','')
s = s.replace('  ',' ')

print(s)

Measured memory_bytes: 24712
import java.util.Arrays;
import java.util.Scanner;

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

        int n = sc.nextInt();

        int[] a = new int[1000];
        a[0] = 1;
        for (int i = 2; i < n; i++) {
            int max = i * i;
            if (max <= n) {
                do {
                    max *= i;
                } while (max <= n);
                max /= i;
                a[i-1] = max;
            }
        }

        Arrays.sort(a);
        System.out.print(a[999]);
    }
}


Measured memory_bytes: 23764
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var N, A, B, ans int

	fmt.Scan(&N, &A, &B)
	for i := 1; i <= N; i++ {
		var x = strconv.Itoa(i)
		var num int
		for j := 0; j < len(x); j++ {
			str := string(x[j])
			var t, _ = strconv.Atoi(str)
			num += t
		}
		if A <= num && num <= B {
			ans += i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e12;

LL gcd(LL a,LL b){
	if(b==0)return a;
	return gcd(b,a%b);
}

int main(){
	int n;
	
	while(cin>>n){
		LL mony=100000;
		REP(i,n){
			mony*=1.05;
			if(mony%1000!=0)mony=(LL)(mony/1000)*1000+1000;
			else mony=(LL)(mony/1000)*1000;
		}
		cout<<mony<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
import sys
import collections

input = sys.stdin.readline

H, W = map(int, input().split())
q = collections.deque()
grid = []
for i in range(H):
    grid.append(list(input().strip()))
    for j in range(W):
        if grid[i][j] == "#":
            q.append((i, j, 0))

maxc = 0
while q:
    i, j, c = q.popleft()
    if maxc < c:
        maxc = c
    if i > 0 and grid[i - 1][j] == ".":
        q.append((i - 1, j, c + 1))
        grid[i - 1][j] = "#"
    if i < H - 1 and grid[i + 1][j] == ".":
        q.append((i + 1, j, c + 1))
        grid[i + 1][j] = "#"
    if j > 0 and grid[i][j - 1] == ".":
        q.append((i, j - 1, c + 1))
        grid[i][j - 1] = "#"
    if j < W - 1 and grid[i][j + 1] == ".":
        q.append((i, j + 1, c + 1))
        grid[i][j + 1] = "#"

print(maxc)


Measured memory_bytes: 188508
a,b,c,d,e,f=map(int,input().split())

max_s=0
max_w=a
max_conc=0

water_s=set()
sugar_s=set()
for i in range(f//a//100+1):
  aa=a*i
  for j in range(f//b//100+1):
    bb=b*j
    if aa+bb <= f//100:
      water_s.add(aa+bb)
      
for i in range(f//c+1):
  cc=c*i
  for j in range(f//d+1):
    dd=d*j
    if cc+dd <= f:
      sugar_s.add(cc+dd)

for w in water_s:
  for sg in sugar_s:
    if w*100+sg <= f and w*e >= sg and w+sg > 0:
      conc=(100*sg)/(100*w+sg)
      if max_conc < conc:
        max_conc=conc
        max_w=w
        max_s=sg
print(max_w*100+max_s,max_s)

Measured memory_bytes: 9092
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        c: i32,
        b: [i32; m],
    };

    let mut count = 0;
    for _ in 0..n {
        input! {
            a: [i32; m],
        };

        let a: Vec<i32> = a;

        let mut sum: i32 = 0;
        for (ai, bi) in a.iter().zip(b.iter()) {
            sum += ai * bi;
        }
        sum += c;

        if sum > 0 {
            count += 1;
        }
    }

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


Measured memory_bytes: 2172
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;



class UnionFindTree {
	using int32 = std::int_fast32_t;
	using uint32 = std::uint_fast32_t;
	std::vector<int32> tree;

public:
	UnionFindTree(uint32 size) : tree(size, -1) {}
	uint32 find(const uint32 x) {
		if (tree[x] < 0)
			return x;
		return tree[x] = (int32)find((uint32)tree[x]);
	}
	bool unite(uint32 x, uint32 y) {
		x = find(x);
		y = find(y);
		if (x == y)
			return false;
		if (tree[x] > tree[y])
			std::swap(x, y);
		tree[x] += tree[y];
		tree[y] = (int32)x;
		return true;
	}
	uint32 size(const uint32 x) { return (uint32)(-tree[find(x)]); }
	bool same(const uint32 x, const uint32 y) { return find(x) == find(y); }
};

int main(void) {
	std::ios::sync_with_stdio(false);
	uint32 n, m;
	std::cin >> n >> m;
#define SIZ 100001
	std::priority_queue<uint32, std::vector<uint32>, std::greater<uint32>> Q[SIZ], P;
	std::vector<uint32> r(n, 0), c(n);
	UnionFindTree U(n);
	for (uint32 i = 0;i < n;++i) {
		std::cin >> c[i];
	}
	uint32 x, y;
	for (uint32 i = 0;i < m;++i) {
		std::cin >> x >> y;
		U.unite(x, y);
	}
	for (uint32 i = 0;i < n;++i) {
		Q[U.find(i)].push(c[i]);
	}
	uint64 cost = 0, node = 0;
	for (uint32 i = 0;i < n;++i) {
		if (r[U.find(i)]) continue;
		r[U.find(i)] = 1;
		++node;
		cost += Q[U.find(i)].top();
		Q[U.find(i)].pop();
		while (!Q[U.find(i)].empty()) {
			P.push(Q[U.find(i)].top());
			Q[U.find(i)].pop();
		}
	}
	if (node == 1) {
		std::cout << "0\n";
		return 0;
	}
	if (P.size() + 2 < node) {
		std::cout << "Impossible\n";
		return 0;
	}
	for (uint32 i = 2;i < node;++i) {
		cost += P.top();
		P.pop();
	}
	std::cout << cost << "\n";
	return 0;
}

Measured memory_bytes: 8832
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, k = map(int,input().split())
    have = [False] * n
    for _ in range(k):
        input()
        for a in map(int,input().split()):
            have[a - 1] = True
    print(n - sum(have))
resolve()

Measured memory_bytes: 65612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e6 + 5;
const ll MOD = 1e9 + 7;
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pis pair<ll,string>
#define F first
#define S second
#define LCM(a,b) ((a*b)/__gcd(a,b))
#define inf 1e15
#define test ll cse;cin>>cse;for(ll _i=1;_i<=cse;_i++)
#define PI 3.14159265
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const double EPS = 1E-9;
typedef vector< vector<double> > matrix;
typedef vector<int> vi;



int main() {
    fast;

    ll ar[5];
    for(int i = 0; i < 5; i++) cin >> ar[i];

    for(int i = 0; i < 5; i++) {
        if(ar[i] == 0){
            cout << (i+1) << "\n";
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int A, B;  cin >> A >> B;
	cout << 6 - A - B << endl;

	return 0;
}

Measured memory_bytes: 892
n,m = map(int,input().split())
time = [0 for _ in range(n)]
def nex(time):
  for i in range(n):
    if time[i] == 0:
      time[i] += 1
      break
    else:
      time[i] = 0
  else:
    time = 'over'
  return time
s = []
for _ in range(m):
  raw = list(map(int,input().split()))
  add = [0 for _ in range(n)]
  for j in range(1,raw[0]+1):
    add[raw[j]-1] = 1
  s.append(add)
p = list(map(int,input().split()))
ans = 0
while time != 'over':
  for k in range(m):
    tmp = p[k]
    for i in range(n):
      tmp ^= time[i] * s[k][i]
    if tmp == 1:
      break
  else:
    ans += 1
  time = nex(time)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll X,Y,A,B,C;
    cin >> X >> Y >> A >> B >>C;
    ll p[A],q[B],r[C];
    ll i,j;
    for(i=0;i<A;i++){
        cin >> p[i];
    }
    for(i=0;i<B;i++){
        cin >> q[i];
    }
    for(i=0;i<C;i++){
        cin >> r[i];
    }
    sort(p,p+A);
    sort(q,q+B);
    sort(r,r+C);
    ll D[X+Y];
    for(i=0;i<X;i++){
        D[i]=p[A-1-i];
    }
    for(i=0;i<Y;i++){
        D[X+i]=q[B-1-i];
    }
    sort(D,D+X+Y);
    j=C-1;
    for(i=0;i<X+Y;i++){
        if(j>=0&&D[i]<r[j]){
            D[i]=r[j];
            j--;
        }
    }
    ll ans=0;
    for(i=0;i<X+Y;i++){
        ans+=D[i];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 10;
const double EPS = 1e-9;

struct ptInt{
	int x , y;
};
struct pt{
	double x , y;
	bool operator <(pt p)
	{
		if(fabs(x - p.x) < EPS)
			return y < p.y;
		return x < p.x;
	}
	pt zsuv()
	{
		pt p;
		p.x = x , p.y = y;
		p.x -= EPS;
		p.y -= EPS;
		return p;
	}
	void print()
	{
		printf("%.6lf %.6lf\n" , x , y);
	}
	bool operator==(pt v)
	{
		return ((x - v.x) < EPS) && ((y - v.y) < EPS);
	}
};
struct vctr
{
	double x , y;
	pt beg , en;
	vctr(pt p1 , pt p2)
	{
		beg = p1;
		en = p2;
		x = p2.x - p1.x;
		y = p2.y - p1.y;
	}
	double operator *(vctr v2)
	{
		return x * v2.y - y * v2.x;
	}
	void print()
	{
		printf("%.6lf %.6lf\n" , x , y);
	}

};
struct line
{
	line(ptInt p1 , ptInt p2)
	{
		a = p2.y - p1.y;
		b = p1.x - p2.x;
		c = -(ll)p2.x * a - (ll)p2.y * b;
	}
	line()
	{

	}
	pt genByX(ll x)
	{
		pt p;
		p.x = x;
		if(b)
			p.y = (- c  - a * x) / b;
		else
		{
			p.y = x;
			p.x = -c / a;
		}
		return p;
	}
	bool isOnLine(ptInt p)
	{
		return a * p.x + b * p.y + c < EPS;
	}
	int a , b;
	ll c;
};

struct intersec{
	pt tochka;
	int idx1 , idx2;
	intersec(pt p1 , int _idx1 , int _idx2):tochka(p1) , idx1(_idx1) , idx2(_idx2)
	{

	}
	intersec()
	{

	}
};
struct segm
{
	pt leftBorder , rightBorder;
	line onLine;

};

double det(double a , double b , double c , double d)
{
	//cout << a << " " << b << " " << c << " " << d << endl;
	return a * d - b * c;
}
bool parallel(line l1 , line l2)
{
	double x =  det(l1.a , l1.b , l2.a , l2.b);
	//cout << x << endl;
	return abs(x) < EPS;
}
bool intersect(line l1 , line l2 , pt &tochka)
{
	//cout << "We are here" << endl;
	if(parallel(l1 , l2))
	{
		//cout << "Parallel" << endl;
		return false;
	}
	//cout << det(l1.a , l1.b , l2.a , l2.b) << endl;
	tochka.x = -det(l1.c , l1.b , l2.c , l2.b) / det(l1.a , l1.b , l2.a , l2.b);
	tochka.y = -det(l1.a , l1.c , l2.a , l2.c) / det(l1.a , l1.b , l2.a , l2.b);
	return true;
}
bool cmp(pt p1 , pt p2)
{
	if(fabs(p1.x - p2.x) > EPS)
		return p1.x < p2.x;
	return p1.y < p2.y;
}
bool inRange(double x , double a , double b)
{
	return x >= min(a , b) && x <= max(a , b);
}
int topRight(int i)
{
	return 2 * i;
}
int leftBottom(int i)
{
	return 2 * i + 1;
}

int n;
int t[100001] , x[100001] , y[100001];
int main()
{
	scanf("%d" , &n);
	for(int i = 1 ; i <= n; i++)
	{
		scanf("%d %d %d" , &t[i] , &x[i]  , &y[i]);
	}
	bool good = true;
	for(int i = 1; i <= n; i++)
	{
		int dx = abs(x[i] - x[i - 1]);
		int dy = abs(y[i] - y[i - 1]);
		int T = t[i] - t[i - 1];
		if(dx + dy - T > 0 || (dx + dy - T) % 2)
			good = false;
	}
	if(good)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 1408
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.nextInt();
		pw.print(Math.round(Math.pow(N, 3)));
		pw.close();
	}
}

Measured memory_bytes: 21844
/*
    じょえチャンネルです！
    https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
    チャンネル登録と高評価お願いします！
    最新の動画：
    【競プロ】チーム対抗！目隠しABC早解き対決 https://youtu.be/gPFr7q7eLL8
*/

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

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

    int n, k;
    cin >> n >> k;
    int ans = 0;
    while (n) {
        ans++;
        n /= k;
    }

    cout << ans;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main ()
{
	int n,i,j,x,k,m;
	int a[10000];
	while (cin >> n)
	{
	
		for(m=0,k=0;k<n;k++)
		{
			cin >> i>>j;
			a[k]=j-i+1;
			
		}
		for(k=0;k<n;k++)
		{	m+=a[k];
		}
		
		 	cout<<m<< endl;
		 
		
	}
	
	
	return 0;
}
 

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var firstLine = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
			var n = firstLine[0];
			var m = firstLine[1];

			var loads = new List<int[]>();

			for(var i = 0; i < m; i++)
			{
				loads.Add(Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray());
			}

			var dictionary = new Dictionary<int, int>();

			for(var i = 1; i <= n; i++)
			{
				dictionary.Add(i, 0);
			}

			foreach(var load in loads)
			{
				dictionary[load[0]]++;
				dictionary[load[1]]++;
			}

			foreach(var value in dictionary.Values)
			{
				Console.WriteLine(value);
			}
		}
	}
}


Measured memory_bytes: 13408
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    string s, t;
    cin >> s >> t;
    vector<int> sa(s.length() + 1, 0), sb(s.length() + 1, 0);
    vector<int> ta(t.length() + 1, 0), tb(t.length() + 1, 0);
    
    repeat_from_to (i, 1, (int)s.length()) {
        if (s[i-1] == 'A') sa[i] = sa[i-1] + 1, sb[i] = sb[i-1];
        else               sa[i] = sa[i-1],     sb[i] = sb[i-1] + 1;
    }
    repeat_from_to (i, 1, (int)t.length()) {
        if (t[i-1] == 'A') ta[i] = ta[i-1] + 1, tb[i] = tb[i-1];
        else               ta[i] = ta[i-1],     tb[i] = tb[i-1] + 1;
    }
    
    int q;
    cin >> q;
    rep(q) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        
        int cnt_sa = sa[b] - sa[a-1];
        int cnt_sb = sb[b] - sb[a-1];
        int cnt_ta = ta[d] - ta[c-1];
        int cnt_tb = tb[d] - tb[c-1];
        
        if ( (cnt_sa + cnt_sb*2) % 3 == (cnt_ta + cnt_tb*2) % 3 )
            cout << "YES" << endl;
        else 
            cout << "NO" << endl;
    }
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    int arr[n+1][3];
    for(int i=0;i<n;i++){
        for (int j=0;j<3;j++)
            cin>>arr[i][j];
    }
    int dp[n+1][3];
    memset(dp,0,sizeof dp);
    for(int i=0;i<3;i++)
         dp[0][i]=arr[0][i];
    for(int i=1;i<n;i++){
            for(int j=0;j<3;j++){
                if(j==0)dp[i][j]=arr[i][j]+max(dp[i-1][1],dp[i-1][2]);
                if(j==1)dp[i][j]=arr[i][j]+max(dp[i-1][0],dp[i-1][2]);
                if(j==2)dp[i][j]=arr[i][j]+max(dp[i-1][1],dp[i-1][0]);
                }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

    return 0;
}


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

using namespace std;

int main() {
    long long H, W;
    cin >> H >> W;
    if (H == 1 || W == 1)
        cout << 1 << endl;
    else if ((H * W) & 1)
        cout << (H * W) / 2 + 1 << endl;
    else
        cout << (H * W) / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;


int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);

long long int a,v,b,w,t,dist;
cin>>a>>v;
cin>>b>>w;
cin>>t;

dist = abs(b-a);

if((v-w)>0)dist<=((v-w)*t)?cout<<"YES":cout<<"NO";
else{cout<<"NO";}

return 0;

}


Measured memory_bytes: 3652
#include<stdio.h>
int s(int n){
  int ans;
  for(ans=0;n;n/=10)ans+=n%10;
  return ans;
}
int main(void){
  int n,a,b,i,ans=0;
  scanf("%d%d%d",&n,&a,&b);
  for(i=1;i<=n;i++)if(a<=s(i)&&s(i)<=b)ans+=i;
  printf("%d",ans);
  return 0;
}

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

void fnInput(vector<int>& rvnOrder)
{
  int nOrderSiz;
  cin >> nOrderSiz;

  rvnOrder.resize(nOrderSiz + 1);
  for (int n = 1; n < rvnOrder.size(); n++)
  {
    int nOrder;
    cin >> nOrder;
    rvnOrder[nOrder] = n;
  }
}

int fnOrderCheck(const vector<int>& cnrvnOrder)
{
  for (int n = 1; n < cnrvnOrder.size(); n++)
    cout << cnrvnOrder[n] << " ";

  cout << endl;
}

int main()
{
  vector<int> vnOrder;

  fnInput(vnOrder);
  fnOrderCheck(vnOrder);

  return 0;
}

Measured memory_bytes: 1152
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }

void main() {
  auto I = readln.split.to!(long[]);
  auto W = I[0];
  auto H = I[1];

  long solve() {
    if (W == 1 || H == 1) return 1;
    
    long ans;
    ans += (1 + (W - 1)/2) * (1 + (H - 1)/2);
    ans += (W / 2) * (H / 2);
    return ans;
  }

  solve().writeln();
}


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

using namespace std;

int main() {

	int N;
	cin >> N;

	int a = 0 , b = 0, c = 0;
	int r = 0;
	for (a = 1; a <= N; a++) {
		if (a % 2 == 1) {
			c = 0;
			for (b = 1; b <= N; b++) {

				if (a % b == 0)c++;
			}
			if (c == 8)r++;
		}
	}

	cout << r << endl;

	return 0;
}

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

#define ll long long
#define L 100005
#define MX 1000000007
#define T int t; cin>>t; while(t--)

int main()
{
    double n;
    cin>>n;
    n/=3;
    n=n*n*n;
    printf("%.8f", n);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse4")
using namespace std;

# define mp make_pair
# define pb push_back
# define PI acos(-1)
# define ff first 
# define ss second 
# define endl '\n'
# define vt vector
# define all(c) (c).begin(), (c).end()
# define rep(i,a,b) for(ll i = a ; i < b ; ++i)

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

template<class T> bool umin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int MOD = 998244353  ;
const ll inf = 1e18 ;  
const ll mod = 1e9+7 ;  
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T lcm(T a, T b) { return (a*b)/gcd(a,b) ; }
template<typename T> T power(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
ll nCr(ll n,ll r){ll t=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){t*=(n-i);t/=(i+1);}return t;}

void read(vt<int> &a) {
    rep(i,0,a.size()) 
        cin >> a[i] ; 
}
void read(vt<ld> &a) {
    rep(i,0,a.size()) 
    cin >> a[i] ; 
}

bool prime(ll t) {
    for(ll i  =2 ; i*i <= t ; ++i) {
        if(t%i==0) 
            return 0 ; 
    }
    return 1 ; 
}
bool cmp(pii &a , pii &b) {
    if(a.ss == b.ss) 
        return a.ff > b.ff ; 
    return a.ss < b.ss ; 
}

// ==========Start Here==============



int main() 
{ 
    string s ,t ;
    cin >> s >> t ; 
    int n = s.size() ; 
    int m = t.size() ; 
    int ans = m  ; 
    for(int i = 0 ; i + m  <= n ; ++i) {
    
        int moves = 0 ; 
        for(int j = 0 ; j < m ; ++j) {
            if(s[i+j] != t [j] ) 
                moves++; 
        }
        umin(ans ,moves) ; 
    }
    cout << ans ; 
    return 0; 
} 

Measured memory_bytes: 3632
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("NO");exit(0);}
	
	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int M=5e6+10;
	ll fac[M],facinv[M],Inv[M];ll C(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,M-1) fac[i]=fac[i-1]*i%MOD;
		facinv[M-1]=invm(fac[M-1]);fd(i,M-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,M-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=1e6+10;
	//------------------FIXED------------------
	int a[N],b[N];
	void main()
	{
		int n=qread();fo(i,1,n) a[i]=a[i-1]+qread();fo(i,1,n) b[i]=b[i-1]+qread();
		int mx=0;fo(i,1,n) chmax(mx,a[i]+b[n]-b[i-1]);write(mx);
	}
};//����������
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();//����Ԥ����ģ����
	mine::main();
	debug("\n---------------------Zory---------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

Measured memory_bytes: 121216
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if ((a*b)%2 == 0) {
      System.out.println("Even");
    } else {
      System.out.println("Odd");
    }
  }
}

Measured memory_bytes: 23124
#include<iostream> 
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <vector>

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



int main() {
	int k, n,i=0,ans=0,kaka=1000000;
	cin >> k >> n;
	vector<int>a(n),m(n,0);
	rep(i, n) {
		cin >> a.at(i);
	}
	rep(i, n-1) {
		m.at(i) = a.at(i + 1) - a.at(i);
	}
	m.at(n - 1) = k - a.at(n-1) + a.at(0);

	sort(m.begin(), m.end());
	reverse(m.begin(), m.end());
	rep(i, n) {
		ans += m.at(i);
	}
	cout << ans - m.at(0)  << endl;
	return 0;
}


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    bool flag = false;
    if (a == b && a != c) {
        flag = true;
    } else if (a == c && a != b) {
        flag = true;
    } else if (b == c && c != a) {
        flag = true;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define inp(arr,n) for(int i=0;i<n;i++) cin>>arr[i]
#define soa(arr,n) sort(arr,arr+n)
#define sov(arr) sort(arr.begin(),arr.end())
#define fr(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

int n,n1;
int m[1000001]={0};
class Q{
public:
    int l,r,num;
    Q(int a,int b,int c){ l=a; r=b; num=c; }
    bool operator<(const Q& a){
        if(this->l/n1==a.l/n1)
            return this->r<a.r;
        else return this->l/n1<a.l/n1;
    }
};
ll* solve(int num,int t,int* arr,vector<Q> &vec){
    n=num;
    n1=(int) sqrt(n);
    ll* ans=new ll[t];
    sort(vec.begin(),vec.end());
    int li=0,ri=-1;
    ll value=0;
    for(int i=0;i<t;i++){
        while(ri<vec[i].r){
            int v=arr[++ri];
            ll f=++m[v];
            if(f==1) value++;
        }
        while(li>vec[i].l){
            int v=arr[--li];
            ll f=++m[v];
            if(f==1) value++;
        }
        while(li<vec[i].l){
            int v=arr[li++];
            ll f=--m[v];
            if(f==0) value--;
        }
        while(ri>vec[i].r){
            int v=arr[ri--];
            ll f=--m[v];
            if(f==0) value--;
        }
        ans[vec[i].num]=value;
    }
    return ans;
}

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t=1;
    while(t--){
        int n,q;
        cin>>n>>q;
        int arr[n]; inp(arr,n);
        vector<Q> vec;
        fr(i,1,q){
            int l,r;
            cin>>l>>r;
            vec.push_back(Q(l-1,r-1,i-1));
        }
        ll* ans=solve(n,q,arr,vec);
        fr(i,0,q-1) cout<<ans[i]<<"\n";
    }
    return 0;
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> masu(H);
  for (int i=0;i<H;i++){
    cin>>masu.at(i);
  }

  vector<int> H_kuro(H,0);
  vector<int> W_kuro(W,0);

  for (int i = 0;i<H;i++){
    for (int j = 0;j<W;j++){
      if(masu.at(i).at(j)=='#'){
        H_kuro.at(i)=1;
        W_kuro.at(j)=1;
        continue;
      }
    }
  }

  for (int i = 0;i<H;i++){
    for (int j = 0;j<W;j++){
      if(H_kuro.at(i)==1 && W_kuro.at(j)==1){
        cout<<masu.at(i).at(j);
      }
      if(H_kuro.at(i)==1 && j==W-1){
        cout<<endl;
      }
    }
  }
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        S: chars,
        T: chars,
        n: i32,
        m: i32,
        U: chars
    }
    if S == U {
        println!("{} {}", n-1, m);
    } else {
        println!("{} {}", n, m-1);
    }
}


Measured memory_bytes: 4352