akhauriyash/Code-Regression huggingface dataset:
N = int(input())
L = list(map(int, input().split()))

ans = 0

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[k] + L[i] > L[j] and L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                ans += 1

print(ans)

Measured memory_bytes: 9200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace AtCoder.ABC122.B
{
    class Program
    {
        public static void Main()
        {
            // Solve("A"); //1
            // Solve("X"); //0
            // Solve("ATCODER"); //3
            // Solve("HATAGAYA"); //5
            // Solve("SHINJUKU"); //0
            // Solve("ACGTACGT"); //8
            // Solve("AXAXAXAXAX"); //1
            // Solve("AAAAAAAAAA"); //10
            // Solve("TGCAXXXXXX"); //4
            // Solve("TXCAXXXCGA"); //3
            // Solve("XXXXXXXXXA"); //1
            // Solve("AXXXXXXXXX"); //1
            // Solve("AAAAAAAAAX"); // 9 
            // Solve("XAAAAAAAAA"); // 9
            // Solve("AAX"); // 2
            // Solve("XAA"); // 2
            // Solve("AX"); // 1
            // Solve("XA"); // 1
            Solve(Console.ReadLine());
        }
        static void Solve(string S)
        {
            var reg = new Regex(@"^[ACGT]+$");
            if (reg.IsMatch(S))
            {
                Console.WriteLine(S.Length);
                return;
            }
            var max = 0;
            for (int i = 1; i < S.Length; ++i)
            {
                for (int j = 0; j + i <= S.Length; ++j)
                {
                    if (i < max) { continue; }
                    var str = S.Substring(j, i);
                    max = reg.IsMatch(str) ? i : max;
                    //Console.WriteLine($"{str}({j},{i}): {reg.IsMatch(str)}, max={max}");
                }
            }
            Console.WriteLine(max);
        }
    }
}



Measured memory_bytes: 15956
from itertools import accumulate
S=list(map(len,input().split("T")))
x,y=map(int,input().split())
x=abs(x-S[0])
y=abs(y)
L=S[2::2]
R=S[1::2]
La=list(accumulate(L))
Ra=list(accumulate(R))
sumL=sum(L)
sumR=sum(R)
flag=0
if sumL>=x and sumR>=y and (sumL-x)%2==0 and (sumR-y)%2==0 and flag==0:
    setL1={0}
    setR1={0}
    gL=(sumL-x)//2
    gR=(sumR-y)//2
    if gL==0:
        flag=1
    else:
        for cnt,i in enumerate(L):
            setL=setL1
            setL1=set()
            s=setL1.add
            h=sumL-La[cnt]
            for j in setL:
                k=i+j
                #if k<gL and h+k>=gL:
                s(k)
                #if j<gL and h+j>=gL:
                s(j)
                if k==gL:
                    flag=1
                    break
            if flag==1:
                break
    if flag==1:
        if gR==0:
            flag=2
        else:
            for cnt,i in enumerate(R):
                setR=setR1
                setR1=set()
                s=setR1.add
                h=sumR-Ra[cnt]
                for j in setR:
                    k=i+j
                    #if k<gR and h+k>=gR:
                    s(k)
                    #if j<gR and h+j>=gR:
                    s(j)
                    if k==gR:
                        flag=2
                        break
                if flag==2:
                    break
if flag==2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 44252
#s = gets.chomp
#n = gets.chomp.to_i
h, n = gets.chomp.split(" ").map{|i|i = i.to_i}
a = gets.chomp.split(" ").map{|i|i = i.to_i}
sum = 0
a.each do |a_i|
  sum += a_i
end


if(sum >= h)
  puts "Yes"
else 
  puts "No"
end

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

using namespace std;

#define ll long long
#define uint unsigned int

char s[4];
char sign[4];

void go(int sum, int n) {
    if (n == 4) {
        if (sum == 7) {
            for (int i = 0; i < 4; ++i) {
                printf("%c%c", s[i], sign[i]);
            }
            puts("7");
            exit(0);
        }
        return;
    }
    sign[n - 1] = '+';
    go(sum + (s[n] - '0'), n + 1);
    sign[n - 1] = '-';
    go(sum - (s[n] - '0'), n + 1);
}

int main() {
    for (int i = 0; i < 4; ++i) {
        scanf(" %c", &s[i]);
    }

    sign[3] = '=';
    go(s[0] - '0', 1);

    throw 1;
}


Measured memory_bytes: 256
from collections import deque

def main():
    H, W, K = map(int, input().split())
    x1, y1, x2, y2 = map(int, input().split())
    M = []
    Cost = [[1000000] * W for i in range(H)]
    dxdy = [(-1, 0), (0, -1), (1, 0), (0, 1)]
    Cost[x1-1][y1-1] = 0
    q = deque([(x1-1, y1-1)])
    for h in range(H):
        M.append(list(input()))

    while q:
        x, y = q.popleft()
        for ddx, ddy in dxdy:
            for i in range(1, K+1):
                dx = ddx*i
                dy = ddy*i

                if not (0 <= x+dx < H and 0 <= y+dy < W):
                    break
                if M[x+dx][y+dy] == '@' or Cost[x+dx][y+dy] <= Cost[x][y]:
                    break
                if x+dx == x2-1 and y+dy == y2-1:
                    print(Cost[x][y]+1)
                    exit(0)
                if Cost[x+dx][y+dy] > Cost[x][y] + 1:
                    Cost[x+dx][y+dy] = Cost[x][y] + 1
                    q.append((x+dx,y+dy))
    

    print(-1)

    
if __name__ == '__main__':
    main()




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

using namespace std;

int main() {
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    x = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    if 400 <= x and x <= 599:
        print(8)
    elif 600 <= x and x <= 799:
        print(7)
    elif 800 <= x and x <= 999:
        print(6)
    elif 1000 <= x and x <= 1199:
        print(5)
    elif 1200 <= x and x <= 1399:
        print(4)
    elif 1400 <= x and x <= 1599:
        print(3)
    elif 1600 <= x and x <= 1799:
        print(2)
    elif 1800 <= x and x <= 1999:
        print(1)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9204
import sys
import math
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

def main():
    n,k = list(map(int,sys.stdin.readline().split()))
    p = list(map(int,sys.stdin.readline().split()))
    p.sort()
    ans = 0
    for i in range(k):
        ans += p[i]
    print(ans)
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 9720
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int x = 0;
  int M = 0;
  rep(i,N)
  {
    if(S[i]=='I')
    {
      x++;
      M = max(M,x);
    }
    else
    {
      x--;
    }
    
  }
  cout << M << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include <bits/stdc++.h>
#define sp " "
#define endl "\n"
#define MAX 10e9
#define MAXN 100001
#define inf_int 2e9
#define inf_ll 2e18
#define e 1e-9
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpl vector<pair<ll, ll>>
#define vpc vector<pair<char, char>>
#define adj_list vector<vl>
#define umap unordered_map<ll, ll>
#define pll pair<ll, pair<ll, ll>>
#define clr(x) memset(x, 0, sizeof(x))
#define set(x, k) memset(x, k, sizeof(x))
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define fastio                        \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;
typedef long long int ll;

ll spf[MAXN];
void sieve()
{
	spf[1] = 1;
	for (auto i = 2; i < MAXN; i++)
		spf[i] = i;
	for (auto i = 4; i < MAXN; i += 2)
		spf[i] = 2;
	for (auto i = 3; i * i < MAXN; i++)
	{
		if (spf[i] == i)
		{
			for (auto j = i * i; j < MAXN; j += i)
				if (spf[j] == j)
					spf[j] = i;
		}
	}
	return;
}

vl getFactorization(ll x)
{
	vl ret;
	while (x != 1)
	{
		ret.push_back(spf[x]);
		x = x / spf[x];
	}
	return ret;
}

void check()
{
	ll x, k, d, ans = 0;
	cin >> x >> k >> d;
	if (x > 0)
	{
		ll n = x / d;
		if (k <= n)
		{
			cout << x - k * d << "\n";
		}
		else
		{
			ll x1;
			x1 = x % d;
			k = k - (x / d);

			if (k % 2 == 0)
				cout << x1 << "\n";
			else
				cout << abs(x1 - d) << "\n";
		}
	}
	else
	{
		x = abs(x);
		ll n = x / d;
		if (k <= n)
		{
			cout << abs(x - k * d) << "\n";
		}
		else
		{
			x = abs(x);
			ll x1 = x % d;
			k = k - (x / d);
			if (k % 2 == 0)
				cout << abs(-1 * x1) << "\n";
			else
				cout << abs(d - x1) << "\n";
		}
	}
	// cout << ans << endl;
	return;
}

int32_t main()
{
	fastio;
	ll t = 1;
	//cin >> t;
	while (t--)
		check();
	return 0;
}

Measured memory_bytes: 3632
n=int(input())
a=list(map(int,input().split()))
ans=1
c=0
pas=a[0]
for i in range(1,n):
  now=a[i]
  if c==0:
    if pas<now:
      c=1
    if pas>now:
      c=2
  if c==1:
    if pas>now:
      ans+=1
      c=0
  if c==2:
    if pas<now:
      ans+=1
      c=0
  pas=now
print(ans)

Measured memory_bytes: 14228
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS
vector<double> p;
double dp[3000][3000];
double func(int pos,int heads) {
	debug(pos,heads);
	if(heads<0) return 0;
	if(pos == 1 && heads == 1)return p[pos];
	else if(pos == 1 && heads==0) return 1-p[pos];
	if(heads>pos) return 0;
	double &res = dp[pos][heads];
	if(res == -1)
	res = (func(pos-1,heads)*(1-p[pos]) + func(pos-1,heads-1)*(p[pos])); 
	return res;
}
vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int n;
cin>>n;
p.resize(n+1);
FOR(i,0,3000) FOR(j,0,3000) dp[i][j]=-1;
debug(dp[0][3]);
FOR(i,1,n+1) cin>>p[i];
double ans = 0;
for(int i=n/2+1;i<=n;i++) ans+=func(n,i),debug(func(n,i));
cout<<fixed<<setprecision(10)<<ans; 
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 70784
#!/usr/bin/env python
# -*- coding: utf-8 -*-

H, W = map(int, input().split())

grid = [list(input()) for _ in range(H)]

# dp[h][w] = (0,0) から (h,w) までの経路の本数
dp = [[0] * W for _ in range(H)]
# 初期値
dp[0][0] = 1

# mod用
MOD_INT = 10 ** 9 + 7

for h in range(H):
    for w in range(W):
        # 右が範囲内の空マスなら現在マスの経路数を足す
        if w + 1 < W and grid[h][w + 1] == ".":
            # modを取って更新
            dp[h][w + 1] += dp[h][w] % MOD_INT
        # 下が範囲内の空マスなら現在マスの経路数を足す
        if h + 1 < H and grid[h + 1][w] == ".":
            # modを取って更新
            dp[h + 1][w] += dp[h][w] % MOD_INT

ans = dp[H - 1][W - 1] % MOD_INT
print(int(ans))


Measured memory_bytes: 51524
#include <bits/stdc++.h>
#define lint long long
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
using namespace std;

// cout << fixed << setprecision(12)

int main(){
  lint X;
  cin >> X;
  
  lint K = 1;
  lint deg = X;
 
  while(deg != 0){
    deg += X;
    deg %= 360;
    K++;
  }
  
  cout << K << endl;
}
    



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, k, q; cin >> n >> k >> q;
    vector<int> c(n+1, k-q);
    for (int i = 0; i < q; i++) {
        int p; cin >> p; c[p]++;
    }
    for (int i = 1; i <= n; i++) {
        if (c[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl; 
    }
    return 0;
}

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

using namespace std;

int main()
{
  int a, L;
  while(scanf("%d %d", &a, &L), a || L){
    map<int, int> dec;
    for(int i = 0; i <= 20; i++){
      if(dec.count(a) != 0){
	cout << dec[a] << " " << a << " " << i - dec[a] << endl;
	break;
      } else {
	dec[a] = i;
	char maxAstr[10], minAstr[10];
	sprintf(maxAstr, "%0*d", L, a);
	sprintf(minAstr, "%0*d", L, a);
	sort(maxAstr, maxAstr + L, greater<char>());
	sort(minAstr, minAstr + L);
	int maxAnum, minAnum;
	maxAnum = atoi(maxAstr);
	minAnum = atoi(minAstr);
	a = maxAnum - minAnum;
      }
    }
  }
  return 0;
}

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

#define int long long

using namespace std;



int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int N;

    cin >> N;

    vector<int> temp;

    for(int i = 1 ; i <= N ; i++)temp.push_back(i);

    vector<int> v1, v2;

	for(int i = 0 ; i < N ; i++)
	{
		int n;
		cin >> n;
		v1.push_back(n);
	}

	for(int i = 0 ; i < N ; i++)
	{
		int n;
		cin >> n;
		v2.push_back(n);
	}

	int a = -1, b = -1;

	int cont = 0;

	do
	{
		cont++;
		if(v1 == temp)a = cont;
		if(v2 == temp)b = cont;
	}
	while(next_permutation(temp.begin(),temp.end()));

	cout << abs(b-a) << '\n';

    return 0;
}

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

void trace(int A[], int n)
{
    for (int i = 0; i < n; i++)
    {
        if (i == n - 1)
        {
            cout << A[i] << endl;
        }
        else
        {
            cout << A[i] << ' ';
        }
    }
}

void insertSort(int A[], int n)
{
    int v, j;
    for (int i = 1; i < n; i++)
    {
        v = A[i];
        j = i - 1;
        while (j >= 0 && A[j] > v)
        {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, n);
    }
}

int main()
{
    int n, A[100];
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
    trace(A, n);
    insertSort(A, n);
    return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    int A, B;
    cin >> A >> B;

    vector<bool> vs(3);

    for (int i = 0; i < 3; ++i) {
        vs[i] = false;
    }

    vs[A - 1] = true;
    vs[B - 1] = true;

    for (int i = 0; i < 3; ++i) {
        if(!vs[i]) {
            cout << i + 1 << endl;
        }
    }


    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <cstdio>
using namespace std;
#define PI acos(-1,0)
#define eps 1e-10
#define ll long long
#define mst(ss,b) memset((ss),(b),sizeof(ss))

int main()
{
    int n;
    cin>>n;
    ll s=0;
    for(int i=1;i<=n;i++)
        s+=i;
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
# 1 "a.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.cpp"
# 1 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 1
       
# 12 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp"
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/bits/stdc++.h" 1
 #include <bits/stdc++.h>
# 13 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/ext/pb_ds/assoc_container.hpp" 1
 #include <ext/pb_ds/assoc_container.hpp>
# 14 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/ext/pb_ds/tree_policy.hpp" 1
 #include <ext/pb_ds/tree_policy.hpp>
# 15 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2







using namespace std;
using namespace __gnu_pbds;

using ii = pair<long long, long long>;
using vi = vector<long long>;
using vd = vector<long double>;
using vb = vector<bool>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vvd = vector<vd>;
using vvb = vector<vb>;
using vvii = vector<vii>;
# 50 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp"
inline long long mod(const long long n, const long long m = ((long long)1e9+7)){
    return (n%m + m)%m;
}

/**
 * Euclidean GCD.
 *
 * Time Complexity: O(log(min(a, b))).
 * Space Complexity: O(log(min(a, b))).
 */
long long gcd(const long long a, const long long b){
    if(a < 0 or b < 0)
        return gcd(abs(a), abs(b));
    if(a == 0)
        return b;
    return gcd(b%a, a);
}

/**
 * Euclidean derivated LCM.
 *
 * Time Complexity: O(log(min(a, b))).
 * Space Complexity: O(log(min(a, b))).
 */
long long lcm(const long long a, const long long b){
    // same as a*b/gcd(a, b) but avoiding overflow.
    return a/gcd(a, b)*b;
}
# 2 "a.cpp" 2

int32_t main(){
    (ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL));
    long long n;
    cin >> n;
    vi arr(n);
    for(long long &i:arr)
        cin >> i;
    vi dp(n);
    for(long long i=1; i<n; ++i){
        dp[i] = dp[i-1] + abs(arr[i] - arr[i-1]);
        if(i >= 2)
            dp[i] = min(dp[i], dp[i-2] + abs(arr[i] - arr[i-2]));
    }
    cout << dp[n-1] << "\n";
    return 0;
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            //アルファベットの配列を作成。
            char[] chAlphabet = new char[26];
            char chText = 'a';
            for(int suffix = 0; suffix < 26; suffix++){
                chAlphabet[suffix] = chText;
                chText++;
            }
            
            int[] alphabetCount = new int[26];
            
            //入力読取。
           while(true){
               string strWord = Console.ReadLine();
               if(strWord != null && strWord != ""){
                   char[] chWord = strWord.ToCharArray();
                   for(int wordNum = 0; wordNum < chWord.Length; wordNum++){
                       chWord[wordNum] = Char.ToLower(chWord[wordNum]);
                       
                         //文字をカウント。
                       for(int alphabet = 0; alphabet < 26; alphabet++){
                           if(chWord[wordNum] == chAlphabet[alphabet]){
                               alphabetCount[alphabet]++;
                           }
                       }
                       
                   }
                   

                   
               }else{
                   break;
               }
           }


            //出力
            for(int index = 0; index < 26; index++){
               Console.WriteLine("{0} : {1}", chAlphabet[index], alphabetCount[index]);  
            }
            
        }
    }

}



Measured memory_bytes: 17812
#include<stdio.h>
#include<string.h>

int main(void) {
	int j = 0;
	char s[200001], t[200001];
	scanf("%s%s",&s, &t);

	for (int i = 0; i <= strlen(s); i++)
		if (s[i] != t[i])
			j++;
	printf("%d", j);
	return 0;
}


Measured memory_bytes: 2072
import java.time.Duration
import java.time.LocalTime
import kotlin.math.max

fun main() {
  val (h1, m1, h2, m2, k) = readLine()!!.split(' ').map { it.toInt() }
  val start = LocalTime.of(h1, m1)
  val end = LocalTime.of(h2, m2)
  val study = end - Duration.ofMinutes(k.toLong())
  println(max(0L, Duration.between(start, study).toMinutes()))
}

Measured memory_bytes: 36844
#include<bits/stdc++.h>
typedef long long ll;

const int N = 1e5+2;
std::vector<int> g[N];
int dp[N];

void dfs(int v)
{
    if(dp[v]!=-1) return;
    dp[v] = 0;
    for(int u: g[v])
    {
        dfs(u);
        dp[v] = std::max(dp[v], 1 + dp[u]);
    }
}

int main()
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0); std::cout.tie(0);
    //freopen("input.txt", "r", stdin);
    int n,m;
    std::cin >> n >> m;
    for(int i=0; i<m; i++)
    {
        int x,y;
        std::cin >> x >> y;
        g[x].push_back(y);
    }
    for(int i=1; i<=n; i++) dp[i] = -1;
    for(int i=1; i<=n; i++) dfs(i);
    int ans = -1;
    for(int i=1; i<=n; i++) ans = std::max(ans, dp[i]);
    std::cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 8192
#include<iostream>
#include<vector>
#include<algorithm>
#include<deque>
#include<climits>
#include<cassert>
#include<cmath>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 110

using namespace std;

int V,E,ans;
vector<int> G[MAX];
int COST[MAX][MAX];
bool used[MAX];

void dfs(int node,deque<int>& deq,int sp){
  if(node >= 15)return;

  if(node >= 2){
    int tmp = [&]()mutable->int{
      int ret = 0;
      //int mincost[node];
      //for(int& i : mincost)i = IINF;
      vector<int> mincost(node,IINF);
      for(int i=0;i<node;i++){
	for(int j=i+1;j<node;j++){
	  int cost = COST[deq[i]][deq[j]];
	  if(cost==0)return -1;
	  mincost[i] = min(mincost[i],cost);
	  mincost[j] = min(mincost[j],cost);
	}
      }
      //for(int& i : mincost) ret += i;
      for(int& i : mincost) ret += i;
      return ret;
    }();

    if(tmp != -1)ans = max(ans,tmp);
  }

  REP(i,sp,V){
    if(used[i])continue;
    if(G[i].size() < node)continue;
    used[i] = true;
    deq.push_back(i);
    dfs(node+1,deq,i+1);
    deq.pop_back();
    used[i] = false;
  }
}

int main()
{
  cin >> V >> E;
  rep(i,V)G[i].clear();
  rep(i,E){
    int u,v,f;
    cin >> u >> v >> f;
    u--,v--;
    G[u].push_back(v);
    G[v].push_back(u);
    COST[u][v] = COST[v][u] = f;
  }

  deque<int> deq;
  dfs(0,deq,0);
  cout << ans << endl;

  return 0;
}

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

typedef long long LL;
const int MAX_N = 2*1e5+100;
int n;

int main(){
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    LL x;
    multiset<LL> s;
    for(int i = 0; i < n; ++i){
        cin >> x;
        s.insert(x);
    }
    int ans = 0;
    while(!s.empty()){
        LL x = *s.rbegin();
        s.erase(s.find(x));
        LL now = 1LL;
        while(now <= x) now <<= 1;
        auto it = s.find(now - x);
        if(it == s.end()) continue;
        s.erase(it);
        ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
//#include <E:\codeblocksfile\c++\learning.h>
using namespace std;
#define sci1(a) scanf("%d",&a)
#define sci2(a,b) scanf("%d %d",&a,&b)
#define sci3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define scs(s) scanf("%s",s)
#define ll long long
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)
#define infi 0x7fffffff
#define infl 0x7fffffffffffffff
#ifndef GET_MACRO
#define GET_MACRO(__1,__2,__3,NAME,...) NAME
#endif // GET_MACRO
#define sci(...) GET_MACRO(__VA_ARGS__,sci3,sci2,sci1)(__VA_ARGS__)


int fill_p_q(ll n,ll* pfactor,ll* power){
    if(n<2)return 0;
    double sq=sqrt((double)n);
    ll l=(ll)sq,i;
    int j=0;
    for(i=2;i<=l;i++){
    if((n%i)==0){
        pfactor[j]=i;
        power[j]=0;
        while((n%i)==0){
            n/=i;
            power[j]++;
        }
        j++;
    }
    }
    if(n!=1){
        power[j]=1;
        pfactor[j]=n;
        j++;
    }
    return j;
}
ll pow_(ll n,ll p){
    ll ans=1;
    while(p>0){
        ans*=n;
        p--;
    }
    return ans;
}
int main(){
    //freopen("input.txt","r",stdin);
    ll n,p;
    cin>>n>>p;
    ll pfactor[100],power[100];
    int j=fill_p_q(p,pfactor,power);
    int i;
    ll ans=1;
    for(i=0;i<j;i++){
        ans*=pow_(pfactor[i],power[i]/n);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;

int main(void) {
    int m,f,r;
    char g;
    for (;;) {
        cin >> m >> f >> r;
        if (m==-1 && f==-1 && r==-1) break;
        if (m==-1 || f==-1) {
            g = 'F';
        } else if (m+f >= 80) {
            g = 'A';
        } else if (m+f >= 65) {
            g = 'B';
        } else if (m+f >= 50) {
            g = 'C';
        } else if (m+f >= 30) {
            if (r >= 50) {
                g = 'C';
            } else {
                g = 'D';
            }
        } else {
            g = 'F';
        }
        cout << g << endl;
    }
    return 0;
}

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


int main() {
  int n;  cin >> n;
  rep(i, 100) {
    if (i * 1000 >= n) {
      cout << i * 1000 - n << endl;
      break;
    }
  }
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<iostream>
char c[101][101]={0};
int main(void){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
        	std::cin>>c[i][j];
    for(int i=0;i<n;i++,putchar('\n'))
        for(int j=0;j<m;j++){
            int sum=0;
            if(c[i][j]=='#')
				printf("#");
            else{
                if(c[i-1][j+1]=='#') sum++;
                if(c[i][j+1]=='#') sum++;
                if(c[i+1][j+1]=='#') sum++;
                if(c[i-1][j]=='#') sum++;
                if(c[i+1][j]=='#') sum++;
                if(c[i-1][j-1]=='#') sum++;
                if(c[i][j-1]=='#') sum++;
                if(c[i+1][j-1]=='#') sum++;
                printf("%d",sum);
                }
            }
    return 0;
}

Measured memory_bytes: 256
//package Hello.World;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String []args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String str = br.readLine();
        StringTokenizer st = new StringTokenizer(str);
        int x  = Integer.parseInt(st.nextToken());
        int a  = Integer.parseInt(st.nextToken());
        if(x<a)
            out.println(0);
        else
            out.println(10);

        out.flush();
    }

}


Measured memory_bytes: 23124
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <vector>
using namespace std;

int main()
{
    int n, q, target, ans;
    ans = 0;
    cin >> n;
    vector<int> s(n);
    // input data
    for(int i=0; i<n; ++i){
        cin >> s[i];
    }
    cin >> q;
    for(int i=0; i<q; ++i){
        cin >> target;
        for(int j=0; j<n; ++j){
            if(s[j] == target){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

// clang-format off
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
#define forn(i, x, y) for(int i = x; i < y; i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
// clang-format on

const long long INF = 1LL << 60;

int main()
{
  IOS;

  ll N, W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  forn(i, 0, N) cin >> w[i] >> v[i];

  const ll sum_v = accumulate(v.begin(), v.end(), 0LL);

  vector<ll> dp(sum_v + 1, INF);
  dp[0] = 0;

  for (int i = 0; i < N; i++)
    for (int j = sum_v; j >= v[i]; j--)
      chmin(dp[j], w[i] + dp[j - v[i]]);

  for (int i = sum_v; i >= 0; i--)
    if (dp[i] <= W)
    {
      cout << i << endl;
      break;
    }

  return 0;
}


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

using namespace std;

#define prr pair<int,int>
#define ll long long
#define pb push_back
#define int long long
#define ld long double
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 //   cout<<"here";
    long double a,b,c;
    cin>>a>>b>>c;
    long double a1=sqrt(a);
    long double b1=sqrt(b);
    long double c1=sqrt(c);
    ld a4=a+b+2*(a1*b1);
    
    if(a4<c){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
const int mod = 1000000007;

ll gcd(ll a, ll b){return b ? gcd(b,a%b) : a;};//最大公約数
ll lcm(ll a, ll b){return a*b/gcd(a,b);};//最小公倍数
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
//ll a[100000];
//ll dom[100001];

int main(){
  int a,b;
  cin>>a>>b;
  if((a==1&&b==2)||(a==2&&b==1)) cout<<3;
  else if((a==2&&b==3)||(a==3&&b==2)) cout<<1;
  else if((a==1&&b==3)||(a==3&&b==1)) cout<<2;

   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 2147483647;
int prime = 998244353;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;

signed main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    cin >> n;
    vec(a,n);
    input(a,n);
    Sort(a);
    Reverse(a);
    int ans = 0;
    int i = 0;
    while(true){
        if(i){
            if(i*2-1>=n-1){
                break;
            }
            ans += a[i];
            if(i*2-1 == n-2){
                break;
            }
            else{
                ans += a[i];
            }
        }
        else{
            ans += a[i];
        }
        i++;
    }
    print(ans);


    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 4776
import java.util.Scanner;

public class Main {

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

        final String S = sc.next();
        final String T = sc.next();
        int A = sc.nextInt();
        int B = sc.nextInt();
        final String U = sc.next();

        if (U.equals(S)) A--;
        if (U.equals(T)) B--;
        System.out.println(A + " " + B);
    }
}


Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] A = new int[N];
		for(int i = 0;i < N;i++) {
			A[i] = scn.nextInt();
		}

		boolean flag = true;
		int swap = 0;
		while(flag) {
			flag = false;
			for(int i = N-1;i >0;i--) {
				if(A[i-1] > A[i]) {
					int buf = A[i];
					A[i] = A[i-1];
					A[i-1] = buf;
					flag = true;
					swap++;
				}
			}
		}
		printArray(A);
		System.out.println(swap);

	}
	public static void printArray(int[] A) {
		for(int i = 0;i < A.length;i++) {
			System.out.print(((i==0)?"":" ") + A[i] + ((i==A.length-1)?"\n":""));
		}
	}

}



Measured memory_bytes: 26412
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    bool flag = 0;
    int n = s.length();
    rep(i,n){
        int c = i,b = 1;
        rep(j,n){
            if (s[j] != t[(j+c)%n]) b = 0;
        }
        if (b){
            flag = 1;
            break;
        }
    }
    if (flag) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
def f(N, X):
  if N == 0:
    if X >= 1:
      return 1
    return 0
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  else:
    return p[N-1] + 1 + f(N-1, X-a[N-1] - 2)

N, X = map(int, input().split(" "))
a = [1]
p = [1]
for i in range(N):
  a.append(a[i]*2+3)
  p.append(p[i]*2+1)

print(f(N,X))

Measured memory_bytes: 3064
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let line: Vec<u64> = read_as_vec();
    let (n, m, d) = (line[0], line[1], line[2]);

    let each_exp: f64;
    if d == 0 {
        each_exp = n as f64 / n as f64 / n as f64;
    } else {
        each_exp = ((n - d) as f64 * 2.0) / n as f64 / n as f64;
    }
    //let expcted_beauty = each_exp * m as f64;
    println!("{}", each_exp * (m - 1) as f64);
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string> vec(n);
  int i;
  for(i=0;i<n;i++){
    cin >> vec.at(i);
  }
  int count=n;
  sort(vec.begin(),vec.end());
  for(i=0;i<n-1;i++){
    if(vec.at(i)==vec.at(i+1)){
      count--;
    }
  }
  cout << count;
}

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

int min(int x,int y){
    if (x < y) {
        return x;
    }
    else {
        return y;
    }
}

int main(){
    int N,X,Y;
    cin >> N >> X >> Y;

    int dist = 0;
    int dist1 = 0;
    int dist2 = 0;
    int ans[N-1];
    for(int i = 0;i<N-1;i++){
        ans[i] = 0;
    }

    for(int i = 1;i<=N;i++){
        for(int j = i + 1;j<=N;j++){
            if(i <= X && j >= Y){
                dist = X - i + j - Y + 1;
            }else if(i > X && j >= Y){
                dist1 = i - X + j -Y + 1;
                dist2 = j - i;
                dist = min(dist1,dist2);
            }else if(i <= X && j < Y){
                dist1 = j - i;
                dist2 = Y - j + X - i + 1;
                dist = min(dist1,dist2);
            }else if(i > X && j < Y){
                dist1 = j - i;
                dist2 = i - X + Y - j + 1;
                dist = min(dist1,dist2); 
            }else{
                dist = j - i;
            }

            ans[dist-1] = ans[dist-1] + 1;
        }
    }
    for(int i = 0;i<N-1;i++){
        cout << ans[i] << endl;
    }
}

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


Measured memory_bytes: 3804
#!/usr/bin/perl

use strict;
use warnings;

my ($n, $k);
{
    my $in = <STDIN>;
    ($n, $k) = split(" ", $in);
}
my @p;
{
    my $in = <STDIN>;
    @p = split(" ", $in);
}
my @sum;
$sum[0] = 0;
for (my $i=0; $i<$n; $i++)
{
    $sum[$i+1] = $sum[$i] + $p[$i];
}
my $max = 0;
for (my $i=$k; $i<$n+1; $i++)
{
    $max = $sum[$i] - $sum[$i-$k] if $max < $sum[$i] - $sum[$i-$k];    
}
$max = ($max + $k)/2;

print "$max\n";

Measured memory_bytes: 34852
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define int long long
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
  int N;
  cin>>N;
  cout<<(N%1000==0? 0:1000-(N%1000))<<endl;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int a,b,c,i,N;
	
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%d %d %d",&a,&b,&c);
		
		if((a*a == b*b + c*c) || (b*b == a*a + c*c) 
			|| (c*c == a*a + b*b)){
			printf("YES\n");
		}else
		{
			printf("NO\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 580
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	char key[5],query[5];
	int hit,blow;
	
	scanf("%s %s",key,query);
	while(key[0] != '0' || key[1] != '\0'){
		hit = 0;
		blow = 0;

		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(key[j] == query[i]){
					if(i == j)
						hit++;
					else
						blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);

		scanf("%s %s",key,query);
	}

	return 0;
}

Measured memory_bytes: 1136
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<bits/stdc++.h>
#include<chrono>
#include<unordered_map>
#include<random>
#include<complex> 
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned ll 
#define endl '\n'
#define mk make_pair
void fast_in_out() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);
}
int dx[] = { 0,0,-1,1,-1,1,-1,1,0 };
int dy[] = { -1,1,0,0,-1,-1,1,1,0 };
int lx[] = { 2, 2, -1, 1, -2, -2, -1, 1 };
int ly[] = { -1, 1, 2, 2, 1, -1, -2, -2 };
const ld eps = 1e-9;
const int N = 1e5 + 50, M = 1e5 + 10, mod = 1e9 + 7;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll t = gcd(a, b); return t ? (a / t * b) : 0; }
int main() {
	fast_in_out();
//	cout << fixed << setprecision(6);
	int n, k, s;
	cin >> n >> k >> s;
	vector<int>ans(n);
	for (int i = 0; i < k; i++)
		ans[i] = s;
	for (int i = k; i < n; i++) {
		if (s == 1000000000)
			ans[i] = s - 1;
		else ans[i] = s + 1;
	}
	for (int i = 0; i < n; i++)
		cout << ans[i] << " \n"[i == n - 1];

	return 0;
}

Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
	var a, b, c, k int
	fmt.Scan(&a, &b, &c, &k)

	if abs(a-b) > 1000000000000000000 {
		fmt.Println("Unfair")
	} else if k%2 == 1 {
		fmt.Println(b - a)
	} else {
		fmt.Println(a - b)
	}
}

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


Measured memory_bytes: 1832
import sys

n, k = map(int, input().split())
a = [int(x) for x in input().split()]

values = dict()
valuelist = [0]*(n+1)
values[0] = 1
s = 0
ans = 0
if k == 1:
  print(0)
  sys.exit()

for i in range(n):
  s += a[i]-1
  s %= k
  if s in values:
    ans += values[s]
    values[s] += 1
  else:
    values[s] = 1
  
  valuelist[i+1] = s
  if i >= k-2:
    values[valuelist[i-k+2]] -= 1

print(ans)

Measured memory_bytes: 41972
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_HW = 305;
int A[MAX_HW][MAX_HW];
P locA[MAX_HW*MAX_HW];
int MP[MAX_HW*MAX_HW];

int main()
{
	int H,W,D;
	cin >> H >> W >> D;
	rep(i,H)
	{
		rep(j,W)
		{
			cin >> A[i][j];
			locA[A[i][j]] = P(i,j);
		}
	}

	for(int i = 1; i <= D; ++i)
	{
		int now = i;
		MP[now] = 0;
		now += D;
		while(now <= H*W)
		{
			MP[now] = MP[now-D] + abs(locA[now].first-locA[now-D].first) + abs(locA[now].second-locA[now-D].second);
			now += D;
		}
	}

	int Q;
	cin >> Q;
	rep(i,Q)
	{
		int L,R;
		cin >> L >> R;
		cout << MP[R] - MP[L] << endl;
	}
	return 0;
}

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

const ll infll=9223372036854775806;
const int inf=2147483646;
int i,k,n,f,t,w,ans[100001];
vector<vector<pair<int,int>>> v(100001);
bool vis[100001];

void dfs(int a){
	vis[a]=true;
	int j;
	for (j=0;j<v[a].size();j++){
		if (vis[v[a][j].first]==false){
			if (v[a][j].second==0){
				ans[v[a][j].first]=ans[a];
			}
			else {
				ans[v[a][j].first]=1^ans[a];
			}
			dfs(v[a][j].first);
		}
	}
}

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>n;
	fill(vis,vis+n,false);
	for (i=0;i<n-1;i++){
		cin>>f>>t>>w;
		w%=2;
		f--;t--;
		v[f].push_back(make_pair(t,w));
		v[t].push_back(make_pair(f,w));
	}
	ans[0]=0;
	dfs(0);
	for (i=0;i<n;i++){
		cout<<ans[i]<<"\n";
	}
	return 0;
}

Measured memory_bytes: 7680
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 Q =sc.nextInt();
      
      int n[] =new int[N];
      int a[] =new int[Q];
      
      for(int j=0; j<Q; j++){
      a[j] =sc.nextInt();
      }
      
      int kq = K-Q;
      Arrays.fill(n,kq);
      
      for(int j=0; j<Q; j++){
		n[a[j]-1]++;//
      }
      for(int j=0; j<N; j++){
        if(n[j]<=0){
        System.out.println("No");
        }
        else{
        System.out.println("Yes");
        }
        }
    }
}
     

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  
  int as = a.size();
  int bs = b.size();
    
  if ( a.at(as-1) == b.at(0) && b.at(bs-1) == c.at(0)) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <tuple>
#include <set>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define all(v) (v).begin(),(v).end()
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    int h,r;
    cin>>h>>r;
    if(h==-1*r)cout<<0<<endl;
    else if(h+r<0)cout<<-1<<endl;
    else cout<<1<<endl;
    
    
    
    return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll N, K; cin >> N >> K;
  multiset<ll> M;
  rep(i, N){
    ll p; cin >> p;
    M.insert(p);
  }
  ll ans = 0;
  auto itr = M.begin();
  rep(i, K){    
    ans += *itr;
    itr++;
  }
  cout <<ans << endl;
}


Measured memory_bytes: 3648