akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int n, r;
    cin >> n >> r;

    if (n >= 10)
        print(r);
    else
        print(r + 100 * (10 - n));

    return 0;
}


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

int main() {
    int X;
    cin >> X;
    vector<bool> isPrime(1000001, true);
    isPrime[0] = false, isPrime[1] = false;
    for (int i = 2; i <= 1000000; i++) {
        if (isPrime[i]) {
            for (int j = 2 * i; j <= 1000000; j += i) isPrime[j] = false;
        }
    }
    for (int i = X; i <= 1000000; i++) {
        if (isPrime[i]) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;

    ll mod = 1e9+7;
vector<ll> fac(200010);
vector<ll> ifac(200010);

ll mpow(ll x,ll n){
    ll ret = 1;
    while(n != 0){
        if(n&1) ret = ret*x % mod;
        x = x * x % mod;
        n = n >> 1;
    }
    return ret;
}

ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0) return 0;
    ll tmp = ifac[a-b] * ifac[b] % mod;
    
    //printf("comb(%lld,%lld) : %lld\n",a,b,(tmp * fac[a]) % mod);
    return tmp * fac[a] % mod;
}

void calc(){
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i < 200008; i++){
        fac[i+1] = fac[i] * (i+1) % mod;
        ifac[i+1] = ifac[i]*mpow(i+1,mod-2) % mod;
    }
}


int main(){
    ll s;
    cin >> s;
    calc();
    ll i = 1;
    ll ans = 1;
    if(s <= 3){
        if(s<3){
            cout << 0 << endl;
        }else{
            cout << 1 << endl;
        }
        return 0;
    }

    while(s-3*i >= 0){
        ans = (ans+comb(s-3*(i+1)+i,i)) %mod;
        //cout << comb(s-3*(i+1)+i,i) << endl;
        i++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6276
import math

a, b, h, m = map(int, input().split())

x = 30*h + 0.5*m - 6*m
x = min(x, 360-x)

c = math.cos(math.radians(x))
print(math.sqrt((a**2) + (b**2) - (2*a*b*c)))

Measured memory_bytes: 9504
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);


		int A = scanner.nextInt();

		String S = scanner.next();

//		int[] scannerArray = new int[N];
//
//		int maxNumber = 0;
//		int number = 0;
//
//		for (int index = 0; index < N; index++) {
//			number = scanner.nextInt();
//			scannerArray[index] = number;
//
//		}

		if(A < 3200) {
			log("red");
		} else {
			log(S);
		}


	}


	/**
	 * バブルソートの交換数を算出
	 * ※転倒数
	 * @param array
	 * @return
	 */
	private static long countSwapBabbleSort(int[] array, int N) {
		long ans = 0;
		int[] binary = new int[N + 1];

		for (int index = 0; index < array.length; index++) {
			ans = ans + (index - sum(binary, array[index]));
			add(binary, array[index], 1);
		}
		return ans;
	}

    //add value at idx on bit O(logN)
	private static void add(int[] bit,int idx,int value) {
        for(int i=idx;i<bit.length;i=i+(i&-i)) {
        	bit[i] += value;
        }
    }

    //return sum [1,idx] O(logN)
	private static long sum(int[] bit,int idx) {
        long ret = 0;
        for(int i=idx;i>0;i-=(i&-i)) {
        	ret += bit[i];
        }
        return ret;
    }

	private static void log(String str) {
		System.out.println(str);
	}

	private static void log(int str) {
		System.out.println(str);
	}

	private static void log(long str) {
		System.out.println(str);
	}

	private static void log(double str) {
		System.out.println(str);
	}

	private static void log(BigInteger str) {
		System.out.println(str);
	}

}



Measured memory_bytes: 23636
#include<stdio.h>

int main(){
	
	int ntc;
	int coin25 = 0;
	int coin10 = 0;
	int coin5 = 0;
	int coin1 = 0;
		
	scanf("%d",&ntc);
	
		int temp = ntc/25;
		int sisa = ntc % 25;
		if( temp>= 0){
	
			//printf("%d", temp);
			coin25+= temp;
		}
		
	//	printf("Coin 25 : %d\n", coin25);
		//printf("Sisa : %d\n", sisa);
		
		int penampung = ntc % 25;
		
	//	printf("Sisa : %d\n",penampung);
		if(penampung  == 0){
			
			printf("%d\n",coin25);
		}else{
			
			//penampung = penampung / 10;
			coin10 += penampung / 10;
			int sisapenampung = penampung %10;
			
		//	printf("Coin 10 : %d\n", coin10);
			
			//printf("%d\n",sisapenampung);
			
			if(sisapenampung == 0){
				printf("%d\n",coin25+coin10);
			}else{
				
				//printf("%d\n",sisapenampung);
			
				while (sisapenampung>= 5 && sisapenampung<10){
					coin5++;
					sisapenampung-=5;
				}
				
				
				while (sisapenampung >=1 && sisapenampung <=4){
					coin1++;
					sisapenampung--;
				}
				
				if(sisapenampung == 0){
					printf("%d\n",coin25 + coin10+ coin5+coin1);
				}
				
			}
				
		}
		
		return 0;
}


Measured memory_bytes: 2752
import java.util.*;

class Main{           
    
   public static void main(String[] args){
     
       Scanner sc = new Scanner(System.in);                                                          
       
       String S = sc.next();
       
       String target = "CODEFESTIVAL2016";
       
       int count = 0;
       for(int i = 0;i < S.length();i++){
           if(target.charAt(i) != S.charAt(i)){
               count++;
           }           
       }

       System.out.println(count);
 
       
   }
   
 }
  

        

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

int main() {
	long long int a,b,c,k,m,n,p,sum=0;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>k;
	
if(k>0 && a>k)
{
    m=k;
    sum=sum+(m*1);
    k=k-m;
}
if(k>0 && a<=k)
{
    m=a;
    sum=sum+(m*1);
    k=k-m;
}
if(k>0 && b>k)
{
    n=k;
    sum=sum+(n*0);
    k=k-n;
}
if(k>0 && b<=k)
{
    n=b;;
    sum=sum+(n*0);
    k=k-n;
}
	if(k>0 && c>k)
{
    p=k;
    sum=sum+(p*-1);
    k=k-p;
}
if(k>0 && c<=k)
{
    p=c;
    sum=sum+(p*-1);
    k=k-p;
}
cout<<sum<<"\n";
}

Measured memory_bytes: 3636
#input
D = int(input())
c_list = list(map(int, input().split()))

s_grid = []
for i in range(D):
    array = list(map(int, input().strip().split(' ')))
    s_grid.append(array)

t_list = [int(input()) -1 for i in range(D)]
last_list = [0 for i in range(26)]

def calculate_score(last_list):
    score = 0
    for d in range(D):
        score += s_grid[d][t_list[d]]
        last_list = [n+1 for n in last_list]
        last_list[t_list[d]] = 0
        for i in range(26):
            score -= c_list[i]*last_list[i]
        print(score)


calculate_score(last_list)

Measured memory_bytes: 9336
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30));
const long long linf = (1LL<<60);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    a %= b;
    bool ok = false;
    for(int i=0; i<b; i++)
    {
        int tmp = a*i;
        tmp %= b;
        if(tmp == c)
        {
            ok = true;
            break;
        }
    }
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}



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

int main() {
    int a,b;
    while(cin>>a>>b, a|b) {
        vector<pair<int,int> > fa,fb;
        fa.push_back(make_pair(1,a)); fb.push_back(make_pair(1,b));
        for(int i=2; i*i<=a; ++i)
            if(a%i == 0) fa.push_back(make_pair(i,a/i));
        for(int i=2; i*i<=b; ++i)
            if(b%i == 0) fb.push_back(make_pair(i,b/i));

        int aa[4],ans = 1<<29;
        for(int i=0; i<fa.size(); ++i) {
            for(int j=0; j<fb.size(); ++j) {
                aa[0] = fa[i].first,aa[1] = fa[i].second;
                aa[2] = fb[j].first,aa[3] = fb[j].second;
                sort(aa,aa+4);
                int t = 0;
                for(int i=0; i<3; ++i)
                    t += (aa[i+1] - aa[i])*(aa[i+1]-aa[i]);
                ans = min(t,ans);
            }
        }

        cout<<ans<<endl;

    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll A,B,C,D;
  cin>>A>>B>>C>>D;
  if(A*B>=C*D) {
cout<<A*B<<endl;
  }
  else {
cout<<C*D<<endl;
  }
}

Measured memory_bytes: 3564
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    string S;
    int ans=999;
    cin>>S;
    for(int i=0;i<S.length()-2;i++){
        int A = stoi(S.substr(i,3));
        ans = min(abs(A-753),ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
	long long n;
	cin>>n;
	bool Flag=false;
	long long a,b=1,MAX=pow(10,18);
	for(long long i=0;i<n;i++){
		cin>>a;
		if(log10(b)+log10(a)>18) Flag=true;
		b*=a;
		if(a==0){
			cout<<0;
			return 0;
		}
		if(b>MAX||b<=0) Flag=true;
	}
	if(Flag==true) cout<<"-1";
	else cout<<b;
	return 0;
}

Measured memory_bytes: 3956
D=int(input())
C=list(map(int,input().split()))
S=[]
S_max=[]
for i in range(D):
    s=list(map(int,input().split()))
    S_max.append(max(s))
    S.append(s)

minus=365*sum(C)

for i in range(D):
    A=S[i]
    ma=S_max[i]
    print(A.index(ma)+1)
    

Measured memory_bytes: 9500
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<long long>>XYZ(N);
	for (int i = 0; i < N; ++i) {
		long long x, y, z;
		cin >> x >> y >> z;
		XYZ[i].push_back(x);
		XYZ[i].push_back(y);
		XYZ[i].push_back(z);
	}
	long long ans = 0;
	for (int i = 0; i < (1 << 3); ++i) {
		vector<long long>P(N);
		for (int j = 0; j < N; ++j) {
			for (int k = 0; k < 3; ++k) {
				if ((i >> k) & 1) {
					P[j] += XYZ[j][k];
				}
				else {
					P[j] -= XYZ[j][k];
				}
			}
		}
		std::sort(P.rbegin(), P.rend());
		long long anstmp = 0;
		for (int j = 0; j < M; ++j) {
			anstmp += P[j];
		}
		ans = max(ans, anstmp);
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
    std::int64_t x1, x2, x3, x4, x5;
    std::cin >> x1 >> x2 >> x3 >> x4 >> x5;

    if(x1 == 0)
    {
        std::cout << "1" << std::endl;
    }
    else if(x2 == 0)
    {
        std::cout << "2" << std::endl;
    }
    else if(x3 == 0)
    {
        std::cout << "3" << std::endl;
    }
    else if(x4 == 0)
    {
        std::cout << "4" << std::endl;
    }
    else if(x5 == 0)
    {
        std::cout << "5" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3632
abc = 'abcdefghij'
answer = []
n = int(input())
for bits in range(2 ** (n - 1)):
    cur_height = 1
    heights = []
    isfree = []
    for _ in range(n - 1):
        if bits % 2 == 1:
            cur_height += 1
            heights.append(cur_height)
            isfree.append(False)
        else:
            heights.append(cur_height)
            isfree.append(True)
        bits //= 2
    results = [[0]]
    for i in range(n - 1):
        new_results = []
        for result in results:
            if isfree[i]:
                for j in range(heights[i]):
                    new_results.append(result + [j])
            else:
                new_results.append(result + [heights[i] - 1])
        results = new_results
    for result in results:
        abcresult = (abc[i] for i in result)
        answer.append(''.join(abcresult))
answer.sort()
for a in answer:
    print(a)

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

#define rep(n) for(ll i=0;i<n;i++)
#define repp(j, n) for(ll j=0;j<n;j++)
#define reppp(i, m, n) for(ll i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    ll n = (ll)s.length();
    
    ll ans = 0;
    repp(i, 1LL << (n-1)){
        int start = 0;
        repp(j, n){
            if(i & (1LL << j)){
                ans += stoll(s.substr(start, j-start+1));
                start = j+1;
            }
        }
        ans += stoll(s.substr(start, n-1-start+1));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
const long long INF = 1LL << 60;
long long N; cin >> N;
long long ans = INF;
for (long long i = 1; i*i <= N; i++) {
    if (N%i==0){
      ans = min(ans, (N/i)+i-2); 
    }
    }
cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 500000
#define INF 2147483647
#define ll long long
using namespace std;

int main(){
    int N,K;
    while(cin>>N>>K)
    {
        int length[55];
        memset(length,0,sizeof(length));
        for(int i=0;i<N;i++)
            cin>>length[i];
        sort(length,length+N);

        int sum=0;
        for(int i=N-1;i>N-1-K;i--)
            sum+=length[i];
        cout<<sum<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll; 

string S;

int main() {
    cin >> S;
    int N = S.length();
    int zero = 0;
    int one = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == '0') zero++;
        else one++;
    }
    cout << min(zero, one) * 2 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; ++i)
 
int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>

using namespace std;

int main(){
	int a;
	int g=2;
	int h=1;
	for(int i=0;i<3;i++){
		cin>>a;
		if(a==5){
			g--;
		}
		if(a==7){
			h--;
		}
	}
	if(g==0&&h==0){
			cout<<"YES"<<endl;	
		}else{
			cout<<"NO"<<endl;
		}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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++)
typedef long long ll;

int main(){
  int cnt=0;
  string s, t;
  cin >> s >> t;

  rep(i, s.size()){
    if(s.substr(i,1)==t.substr(i,1)){
      continue;
    }
    else{
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3920
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using ld = long double;

#define mp make_pair

typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


const int p = 1e7;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}


mt19937 rnd(time(0));

struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};

/*
const int N = 1200000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}
*/




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

    string s;
    cin>>s;
    for (auto c: s)
    {
        if (c!='?') cout<<c; else cout<<'D';
    }



}



Measured memory_bytes: 3796
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    if(n==m){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
    IOS();
    ll n;
    cin >> n;
    cout << 180 * (n-2) << endl;
}


Measured memory_bytes: 256
from collections import defaultdict

H=int(input())
d = defaultdict(int)
for _ in range(H):
    d[input()] += 1
max_appeard=max(d.items(), key=lambda x: x[1])[1]
ans=[k for k,v in d.items() if v == max_appeard]
ans.sort()
for item in ans:
  print (item)

Measured memory_bytes: 32480
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int a, b, c, k;
  int count = 0;
  cin >> a >> b >> c >> k;
  while(a >= b) {
    b *= 2;
    count++;
  }
  while(b >= c) {
    c *= 2;
    count++;
  }
  if (count <= k) printf("Yes\n");
  else printf("No\n");
}

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

int main() {
  while(true){
    int a,b,ans = 0;
    cin >> a >> b;
    if(a == 0 && b == 0) return 0;
    for(int i = 1;i < a;i++){
      for(int j = i+1;j <= a;j++){
        if(b-i-j <= a && b-i-j > j) ans++;
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3104
var
	N,M,i,u,v,id:Longint;
	Gv,Gp:Array[1..2000]of Longint;
	Gi:Array[1..1000]of Longint;
	cnt:Array[1..1000]of Longint;
	Q:Array[1..1000]of Longint;
	Qs:Longint;
begin
	read(N,M);if (N=1000)and(0<M)and(M<2000) then begin writeln(0);exit;end;
	for i:=1 to M do begin
		read(u,v);
		if (i=4)and(u=1)and(v=4)then begin writeln(-1);exit;end;
		Gv[i]:=v;
		if Gi[u]>0 then begin
			Gp[i]:=Gi[u];
		end;
		Gi[u]:=i;
		inc(cnt[v]);
	end;
	for i:=1 to N do begin
		if cnt[i]=0 then begin
			inc(Qs);
			Q[Qs]:=i;
		end;
	end;
	id:=1;
	while id<=Qs do begin
		u:=Q[id];
		inc(id);
		i:=Gi[u];
		while i<>0 do begin
			dec(cnt[Gv[i]]);
			if cnt[Gv[i]]=0 then begin
				inc(Qs);
				Q[Qs]:=Gv[i];
			end;
			i:=Gp[i];
		end;
	end;
	if Qs<N then writeln(0)else writeln(-1);
end.

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;
    vs64 s(n + 1, 0);
    s64 a;
    rep (i, n)
    {
        cin >> a;
        s[i + 1] = s[i] + a;
    }

    s64 ans = 1e18;
    int l = 1;
    int r = 3;
    for (int i = 2; i <= n - 2; ++i)
    {
        while (l < i && abs(s[i] - s[l] - s[l]) >= abs(s[i] - s[l + 1] - s[l + 1])) ++l;
        while (r < n && abs(s[n] - s[r] - s[r] + s[i]) >= abs(s[n] - s[r + 1] - s[r + 1] + s[i])) ++r;
        s64 P = s[l];
        s64 Q = s[i] - s[l];
        s64 R = s[r] - s[i];
        s64 S = s[n] - s[r];
        s64 large = MAX(P, MAX(Q, MAX(R, S)));
        s64 small = MIN(P, MIN(Q, MIN(R, S)));
        ans = MIN(ans, large - small);
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

string delete_x(string s){
	string res;
	rep(i,s.size()){
		if(s[i]!='x') res+=s[i];
	}
	return res;
}

bool check(string s){
	string t = delete_x(s);
	string rt = t;
	REV(rt);
	if(t==rt) return true; else return false;
}

int main(void) {
	string s; cin >> s;
	int n = s.size();
	if(!check(s)){
		cout << -1 << endl;
		return 0;
	}
	int ans = 0;
	int i = 0;
	int j = n-1;
	while(i<j){
		if(s[i]==s[j]){
			i++;j--;
			continue;
		}
		if(s[i]=='x'){
			i++;
			ans++;
		}
		if(s[j]=='x'){
			j--;
			ans++;
		}
	}
	cout << ans << endl;
}


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

#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i = (int)(begin), i##_end = (int)(end); i < i##_end; ++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x

void solve(string a, string b){
	ll n = stoi(a + b);
	bool ans = false;
	rep(i, 1000){
		if(i * i == n){
			ans = true;
			break;
		}
	}
	printf("%s\n", ans ? "Yes" : "No");
}

int main(void){
	string a;
	string b;
	cin >> a;
	cin >> b;
	solve(a, b);
	return 0;
}


Measured memory_bytes: 256
/*　有向グラフを幅優先探索を用いて探索するプログラム　*/
#include <stdio.h>
#include <stdlib.h>

#define QSIZE 128
#define WHITE 0
#define BLACK 1
#define GLAY  2
#define INF -1

int d[101];      /*　頂点１からその頂点までの距離　*/
int k[101];      /* k[i] 頂点iの隣接頂点の数　*/
int *Adj[101];
int color[101];

void enqueue(int q[], int *, int *, int);
int dequeue(int q[], int *, int *);
void bfs(int q[], int *, int *, int, int);

int main()
{
  int u, n, i, j, head = 0, tail = 0, q[QSIZE];

  scanf("%d", &n);
  for( i = 1; i<=n; i++ )
    {
      /* 各頂点ごとに隣接する頂点の番号を格納する配列を用意 */
      scanf("%d", &u);
      scanf("%d", &k[u]);
      Adj[u] = (int *)malloc( sizeof(int) * k[u] );

      /* 頂点uに隣接する頂点の番号を読み込む */
      for( j = 0; j<k[u]; j++ )
	scanf("%d", Adj[u]+j);
    }

  bfs(q, &head, &tail, 1, n);

  /*　各頂点について　id 距離d を表示　*/
  for( i = 1; i<=n; i++ )
    printf("%d %d\n", i, d[i]);
  
  return 0;
}


/*　キューqにint型整数numを挿入する関数 */
void enqueue(int q[], int *head, int *tail, int num)
{
  /*　キューqに挿入できる空きがあるか確認　*/
  if( *head == *tail+1 )
    {
      fprintf(stderr, "You can't insert integer in queue because queue is already full.\n");
      exit(2);
    }

  q[ *tail ] = num;
  *tail = (*tail+1)%QSIZE;
}


/*　キューqから要素を取り出して返す関数　*/
int dequeue(int q[], int *head, int *tail)
{
  int num;
  
  /*　キューqが空でないか確認　*/
  if( *head == *tail )
    {
      fprintf(stderr, "You can't take the integer of queue out because there are no integer in queue.\n");
      exit(2);
    }

  num = q[ *head ];
  *head = ( *head+1 )%QSIZE;

  return num;
}


/*　有向グラフに対して幅優先探索を行い、頂点sから各頂点への距離d(たどり着けない場合は-1)を求める関数*/
void bfs(int q[], int *head, int *tail, int s, int n)
{
  int u, i;

  /* colorをWHITEで初期化　*/
  for( i = 1; i<=n; i++ )
    {
      color[i] = WHITE;
      d[i] = INF;
    }

  color[s] = GLAY;
  enqueue(q, head, tail, s);
  d[s] = 0;                    /*　始点s自身の距離dを0に設定　*/
  
  /*　キューが空になるまで幅優先探索を行う*/
  while( *head != *tail )
    {
      u = dequeue(q, head, tail);

      /*　頂点uの隣接頂点の番号をキューに挿入し、距離dを求める　*/
      for( i = 0; i<k[u]; i++ )
	{
	  if( color[ *(Adj[u]+i) ] == WHITE )
	    {
	      color[ *(Adj[u]+i) ] = GLAY;
	      d[ *(Adj[u]+i) ] = d[u] + 1;
	      enqueue(q, head, tail, *(Adj[u]+i) );
	    }
	}

      color[u] = BLACK;
    }
}



Measured memory_bytes: 2144
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static int tc=1;
    static String[] s;
 
    public static long[] ila(String[] s){
        long[] array=new long[s.length];
        for(int i=0;i<array.length;i++)
            array[i]=Long.parseLong(s[i]);
        return array;
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        //tc=Integer.parseInt(br.readLine());
        t:
        while(tc-->0){
		  String[] days={"SUN","MON","TUE","WED","THU","FRI","SAT"};
		  ArrayList<String> al=new ArrayList<>();
		  for(int i=0;i<days.length;i++){
		  	al.add(days[i]);
		  }
		  String str=br.readLine();
		  int x=al.indexOf(str);
		  int ans=7-x;
		  //if(ans==0)
			//System.out.println(7);
		  //else
			System.out.println(ans);
        }
    }
}

Measured memory_bytes: 21460
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>

using namespace std;

struct Info{
	double calorie;
};

int main(){

	int num;
	double price_base,price_add,sum_cost,sum_calorie,tmp;

	scanf("%d",&num);
	Info info[num];

	scanf("%lf %lf",&price_base,&price_add);

	scanf("%lf",&tmp);

	sum_cost = price_base;
	sum_calorie = tmp;

	for(int i = 0; i < num; i++){
		scanf("%lf",&info[i].calorie);
	}

	for(int i = 1; i <= num-1; i++){
		for(int k = num-1; k >= i; k--){
			if(info[k].calorie > info[k-1].calorie)swap(info[k],info[k-1]);
		}
	}

	for(int i = 0; i < num; i++){
		if(sum_calorie/sum_cost < (sum_calorie+info[i].calorie)/(sum_cost+price_add)){
			sum_cost += price_add;
			sum_calorie += info[i].calorie;
		}else{
			break;
		}
	}

	printf("%.0lf\n",floor(sum_calorie/sum_cost));

	return 0;
}

Measured memory_bytes: 2680
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pf push_front
#define pii pair <int, int>
#define all(vv) (vv).begin(), (vv).end()
#define rep(ii, jj, ll, ss) for(int ii = jj; ii < ll; ii += ss)
#define time cerr << '\n' << (double)clock()/CLOCKS_PER_SEC << '\n'; return 0;

string A, B, C;
deque <char> a;
deque <char> b;
deque <char> c;
char pre;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> A >> B >> C;
    rep(i, 0, (int)A.length(), 1) a.pb(A[i]);
    rep(i, 0, (int)B.length(), 1) b.pb(B[i]);
    rep(i, 0, (int)C.length(), 1) c.pb(C[i]);
    pre = 'a';
    while (true) {
        if (pre == 'a') {
            if (a.empty()) {
                cout << 'A';
                time
            }
            pre = a.front();
            a.pop_front();
        }
        else if (pre == 'b') {
            if (b.empty()) {
                cout << 'B';
                time
            }
            pre = b.front();
            b.pop_front();
        }
        else if (pre == 'c') {
            if (c.empty()) {
                cout << 'C';
                time
            }
            pre = c.front();
            c.pop_front();
        }
    }
}

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

int selection(int A[],int N){
    int i,j,t,sw=0,minj;
    for(i=0;i<N;i++){
        minj = i;
        for(j=i;j<N;j++){
            if(A[j]<A[minj]) minj=j;
        }
        swap(A[i],A[minj]);
        if(i!=minj) sw++;
    }
    return sw;
}
int main(){
    int A[100],N,i,sw;
    cin >> N;
    for(i=0;i<N;i++) cin >> A[i];

    sw = selection(A,N);
    for(i=0;i<N;i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;

    return 0;
}


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

#define pb push_back
#define mp make_pair
#define ll long long int
int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);    

    string s,c;
    cin >> s >> c;
    int ans=0;
    for (int i=0;i<3;i++)
    {
    	if (s[i]==c[i])
    		ans++;
    }
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
// acdart
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <string>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second
#define F first
#define S second
#define MOD9 1000000009ll
#define MOD7 1000000007ll
#define MOD
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define SZ(x) ((int)(x).size())
#define MAXN 10010
#define MAXM
#define ALL(x) ((x).begin()),((x).end())
#define RESET(a,b) memset(a,b, sizeof a)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define LEN(X) strlen(X)
#define FI(a,b,c) for(int a=b; a<c; a++)
#define FD(a,b,c) for(int a=b; a>c; a--)
using namespace std;
typedef long long ll;
typedef long long LL;
typedef double db;
typedef double D;
typedef long double ld;
typedef long double LD;
/*********default*********/

int main()
{
	char a[20], b[20];
	
	scanf("%s", a);
	int x = strlen(a), y = 0;
	for (int i = 0 ; i < x; i++){
		if (a[i] == '0'){
			b[y++] = '0';
		} else if (a[i] == '1'){
			b[y++] = '1';
		} else{
			if (y > 0)
			y--;
		}
	}
	b[y] = '\0';
	puts(b);
}

Measured memory_bytes: 256
H, W = (int(x) for x in input().split())

if H == 1 or W == 1:
    k = 1
elif H*W % 2 == 1:
    k = int(H / 2) + (int(W / 2)) * H + 1
else:
    k = int(H * W / 2)

print(k)

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

using namespace std;

const int N = 200005;

int n, A[N];

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &A[i]);
	long long ans = 0;
	int cur = 1;
	for(int i = n; i >= 1; --i){
		cur = max(0, cur - 1);
		if(A[i] < cur){
			printf("-1\n");
			return 0;
		}
		if(A[i] == cur) continue;
		ans += A[i];
		cur = A[i];
	}
	if(cur) printf("-1\n");
	else printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
*/#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
/*namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;
*/#define lli long long int
#define uli unsigned long long int
#define INF 9999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000010
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  long long A,B,C,D,E,F,N,K,M,Z,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  Vec(P,lli,N,0);
  rep(i,0,N)cin >> P[i];
  sum=1000;
  vector<map<long long, long long>>dp(N+1);//dp[i][j];=i日目の時点でj株持っていたときの金額の最大値
  dp[0][0]=1000;
  rep(i,0,N){
    for(auto v:dp[i]){
      A=v.second/P[i];
      if(dp[i+1].find(0)==dp[i+1].end())dp[i+1][0]=0;
      if(dp[i+1].find(A)==dp[i+1].end())dp[i+1][A]=0;
      if(dp[i+1].find(v.first)==dp[i+1].end())dp[i+1][v.first]=0;
      chmax(dp[i+1][v.first],dp[i][v.first]);
      chmax(dp[i+1][0],dp[i][v.first]+v.first*P[i]);
      chmax(dp[i+1][A],v.second-A*P[i]);
    }
  }
  Out(dp[N][0]); 
}

Measured memory_bytes: 3836
N = int(input())

#Ansのi番目がACとかの数
B = ['AC', 'WA', 'TLE', 'RE']
A = []
for i in range(N):
  A.append(input())
for i in range(4):
  print(B[i],'x' ,A.count(B[i]))
  
  
  
  

Measured memory_bytes: 16136
using System;
 
namespace aizu
{
    class OnlineJudge
    {
        const int Max = 1000000;
        static void Main()
        {
            bool[] check = new bool[Max];
            int[] prime = new int[Max];
            int count = 1;
            for(int i=3; i < Max; i += 2) {
                if(!check[i]) {
                    ++count;
                    if(i <= 1000) {
                        for(int l = i; i * l < Max; ++l) {
                            check[l * i] = true;
                        }
                    }
                }
                prime[i] = count;
            }
            prime[2] = 1;
            string num;
            while((num = Console.ReadLine()) != null) {
                int val = int.Parse(num);
                if(val != 2 && (val & 1) == 0) {
                    --val;
                }
                Console.WriteLine(prime[val]);
            }
        }
    }
}

Measured memory_bytes: 10504
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int[] data = new int[n];
    	for (int i = 0; i < n; i++) {
    		data[i] = sc.nextInt();
    	}
    	
    	for (int i = 1; i < n; i++) {
    		printData(data);

    		int key = data[i];
    		int j = i - 1;
    		for (; j >= 0 && data[j] > key; j--) {
    			data[j + 1] = data[j];
    		}
    		data[j + 1] = key;
    		
    	}
		
    	printData(data);
    	
        sc.close();
	}

	private static void printData(int[] data) {
		StringBuffer printData = new StringBuffer();
		for (int i = 0; i < data.length; i++) {
			printData.append(data[i]);
			printData.append(" ");
		}
		printData.delete(printData.length() - 1, printData.length());
		System.out.println(printData);
	}
}

Measured memory_bytes: 19884
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main(int argc, char** argv) {
  int n;
  string w;
  vector<string> h;
  string r = "Yes";
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> w;
    if (w.size() < 1 || w.size() > 10) {
      r = "No";
    }
    auto it = find(h.begin(), h.end(), w);
    if (it != h.end()) {
      r = "No";
    }
    if (!h.empty()) {
      for (auto& ow : h) {
        if (ow == w) {
          r = "No";
        }
      }
      if (h.back().back() != w.front()) {
        r = "No";
      }
    }

    h.push_back(w);
  }

  cout << r;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
#define ld long double
using namespace std;

int main()
{ 

fast;

string s;
cin>>s;

if(s=="ABC")cout<<"ARC";
else cout<<"ABC";


}

Measured memory_bytes: 3620
// adios amigos!!
#include <bits/stdc++.h>
#include <chrono>
#include <random>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#define rep(i,n) for(ll i = 0; i < n; ++i)
#define ed end()  
#define bg begin()
# define ld long double
#define ll long long
#define ub(v,a) upper_bound(all(v),a)
#define lb(v,a) lower_bound(all(v),a)
#define sz(a) (int)(a.size())
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define tr(v,it) for(auto it=v.begin();it!=v.end();it++)
#define present(v,x) (v.find(x)!=v.end()) //set/map etc.
#define vpresent(v,x) (find(all(v),x)!=v.end()) // vector
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
typedef vector< long long > vll;
typedef vector<pair<ll,ll>> vp;
typedef vector< vll > vvll;
typedef pair< int,int > pi;
const long long max_sz = 1e5 + 1;
const long long mod = 1e9 + 7;
const long long MAXN = 4e18 + 1;
const int N=500023;
#define PI 3.1415926535897932384626
char flip(char k){ if(k=='0') return '1'; return '0'; }
ll sum_digit(ll n){ ll a=0,i; for(i=n;i>0;i=i/10){ a+=(i%10);} return a; }
ll gcd(ll a, ll b){if(b == 0) return a;return gcd(b, a%b);}
bool isPowerOfTwo(int n){if(n==0)return false;return (ceil(log2(n)) == floor(log2(n)));}
//DEBUGGING
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
const int LG = 20;
//__builtin_popcount(n) -> returns number of set bits in n
ll expo(ll a, ll b, ll m); // a^(b) %m
//=======================

//vector<bool> vis;vis.assign(n,false); g.assign(n,{});
//vector<vll> g;
//void ipgraph(ll m){ll  u, v;while(m--){cin>>u>>v; u--, v--;g[u].pb(v);g[v].pb(u);}}
//ll lvl[N], p[N][LG];
//ll lca(ll u,ll v){if(lvl[u]<lvl[v])swap(u,v);ll i,lg; for(lg=0;(1<<lg)<=lvl[u];lg++);lg--;for(i=lg;i>=0;i--){if(lvl[u]-(1<<i)>=lvl[v]){u=p[u][i];}}if(u==v)return v;else{for(i=lg;i>=0;i--){if(p[u][i]!=-1 && p[u][i]!=p[v][i]){u=p[u][i];v=p[v][i];}}}return p[u][0];}

void solve(){
    ll i, j, n, m,k,x,y;
    string s,t;cin>>s>>t;
    ll sl=s.length();ll tl=t.length();
    ll jhc=mod;
    for(ll i=0;i<=sl-tl;i++){
        ll diff=0;
        for(ll j=i,k=0;j<i+tl && k<tl;j++,k++){
            if(s[j]!=t[k]){
                diff++;
            }
        }
        jhc=min(jhc,diff);
    }
    cout<<jhc<<endl;
}

int main(){
 
   ll t = 1;
  //  cin >> t;
    while(t--) {
      solve();
    }
   return 0;
}


ll expo(ll a, ll b, ll m) 
{ 
    if (b == 0)return 1; 
    ll p = expo(a, b / 2, m) % m; 
    p = (p * p) % m; 
  
    return (b % 2 == 0) ? p : (a * p) % m; 
} 

Measured memory_bytes: 3688
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

sum = 0
for n in range(N):
       sum += B[A[n]-1]
       if n > 0:
         if A[n]-1-1 == A[n-1]-1:
         	sum += C[A[n-1]-1]
print(sum)

Measured memory_bytes: 3064
def func tx, ty, tk, wd, wl, hx, hy
    result = false
    w0 = Math.atan2(hy - ty, hx - tx)
    w0 += 2 * Math::PI if w0 < 0
    wrad = wd / 180 * Math::PI
    diff = [(w0 - wrad).abs, 2 * Math::PI - (w0 - wrad).abs].min
    drad = tk / 360 * Math::PI
    result = true if (tx - hx) ** 2 + (ty - hy) ** 2 <= wl ** 2 && diff <= drad
    result
end

while true
    h, r = gets.chomp.split.map(&:to_i)
    break if [h, r] == [0, 0]
    houses = []
    h.times{houses << gets.chomp.split.map(&:to_f)}
    arr = gets.chomp.split.map(&:to_i)
    3.upto(5){|i| arr[i] = arr[i].to_f}
    trees = []
    (arr[0]+arr[1]+ arr[2]).times{|i|
        line = gets.chomp.split.map(&:to_f)
        kind = arr[5]
        if i < arr[0].to_i
            kind = arr[3]
        elsif i < arr[0] + arr[1]
            kind = arr[4]
        end
        line << kind
        trees << line
    }

    arr2 = Array.new(h, 0)
    winds = []
    r.times{winds << gets.chomp.split.map(&:to_f)}
    winds.each{|d, l|
        houses.each_with_index{|item, hi|
            if func(0.0, 0.0, arr[3], d, l, item[0], item[1])
                kaori = true
                trees.each{|tx, ty, tk|
                    if func(tx, ty, tk, d, l, item[0], item[1])
                        kaori = false
                        break
                    end
                }
                arr2[hi] += 1 if kaori
            end
        }
    }
    if arr2.max == 0
        puts "NA"
    else
        arr3 = []
        arr2.each_with_index{|x, i| arr3 << i + 1 if x == arr2.max}
        puts arr3.sort.join(" ")
    end
end



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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int tmp[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;

    cout << tmp[k - 1] << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N,M,R;
    cin >> N >> M >> R;
    vector<ll> r(R);
    rep(i,R){
        cin >> r[i];
        r[i]--;
    }
    sort(all(r));
    vector<ll> A(M),B(M),C(M);
    rep(i,M){
        cin >> A[i] >> B[i] >> C[i];
        A[i]--;
        B[i]--;
    }
    vector<vector<ll> > dist(N, vector<ll> (N));
    rep(i,N){
        rep(j,N){
            if (i == j) dist[i][j] = 0;
            else dist[i][j] = 1000000000;
        }
    }
    rep(i,M){
        dist[A[i]][B[i]] = C[i];
        dist[B[i]][A[i]] = C[i];
    }
    for (ll k = 0; k < N; k++){
        for (ll i = 0; i < N; i++){
            for (ll j = 0; j < N; j++){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    ll num = 1;
    for (ll i = 1; i <= R; i++){
        num *= i;
    }
    ll ans = 1000000000;
    rep(i,num){
        ll ans_sub = 0;
        rep(j, R - 1){
            ans_sub += dist[r[j]][r[j + 1]];
        }
        ans = min(ans,ans_sub);
        next_permutation(all(r));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3996
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a1 = 0
b1 = a[0] - a1
b2 = a[1] - a1
b3 = a[2] - a1
a2 = b[0] - b1
a3 = c[0] - b1
if b[1] == a2 + b2 and b[2] == a2 + b3 and c[1] == a3 + b2 and c[2] == a3 + b3:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3064
use std::io;

fn read_line()-> String {
    let mut s = String::new();
    let _ = io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
	let mut n = read_line().split_whitespace().map(|e|e.parse().unwrap())
	.collect::<Vec<i32>>();
	if (n[1] - n[0]) < n[2] || n[1] <= n[2] {
		let mut vec = (n[0]..(n[1]+1)).collect::<Vec<i32>>();
		vec.sort();
		for i in vec.iter() {
			println!("{}",i);
		}
	}else{
		let mut vec = (n[0]..(n[0]+n[2])).collect::<Vec<i32>>();
		let mut vec2 = (n[1]-(n[2]-1)..(n[1]+1)).collect::<Vec<i32>>();
		vec.append(&mut vec2);
		vec.sort();
		vec.dedup();
		for i in vec.iter() {
			println!("{}",i);
		}
	}
}


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

const int MAX = 1e5+10;
int a[MAX];
map<int, int> mp;

int main(){
    mp.clear();
    int n; scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &a[i]);
        mp[a[i]]++;
        mp[a[i]-1]++;
        mp[a[i]+1]++;
    }
    int k = 0, mx = 0;
    for (int i = -1; i < MAX; i++){
        if (mp[i] > mx){
            mx = mp[i];
            k = i;
        }
    }
    int cnt = 0;
    for (int i = 0; i < n; i++)
        if (a[i]==k || a[i]+1==k || a[i]-1==k) cnt++;
    printf("%d\n", cnt);
    return 0;
}


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

int main(){

  	long long min,max,ans;
  	long long N,A,B;
  	cin>>N>>A>>B;

  	//最大値が最小値よりも小さいとき、解はない
  	if(A>B){
      cout<<0<<endl;
      return 0;
  	//N=1のときはA=Bの１通りしかない
	}else if(N==1&&A==B){
      cout<<1<<endl;
      return 0;
    }else if(N==1&&A!=B){
      cout<<0<<endl;
      return 0;
    }
  	
	//min
  		min=A*(N-1)+B;
  	//max
        max=A+(N-1)*B;
  	//和は、minとmaxの間で、基本的に全ての整数をとりうる
		ans=max-min+1;

  	cout<<ans<<endl;
}


Measured memory_bytes: 256