akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

// 文字のカウント
func main() {
	sc := bufio.NewScanner(os.Stdin)
	alpha := []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
	m := map[string]int{}
	for _, v := range alpha {
		m[v] = 0
	}
	for {
		sc.Scan()
		s := sc.Text()
		if s == "" {
			break
		}
		for _, v := range s {
			char := strings.ToLower(string(v))
			_, ok := m[char]
			if !ok {
				continue
			}
			m[char]++
		}
	}
	s := ""
	for _, v := range alpha {
		s += fmt.Sprintf("%v : %v\n", v, m[v])
	}
	fmt.Print(s)
}



Measured memory_bytes: 1096
H, N = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(N)]
dp = [float('inf')] * 10001
dp[0] = 0
for a, b in AB:
    for i in range(10001 - a):
        dp[i + a] = min(dp[i + a], dp[i] + b)
print(min(dp[H:]))


Measured memory_bytes: 49628
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>

using namespace std;

#define ll long long
#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define mp make_pair
#ifdef LOCAL
#define debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define check(...) assert(__VA_ARGS__)
#else
#define debug(fmt, ...)
#define check(...)
#endif

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


    int r;
    cin >> r;
    cout << 2* r * M_PI;
}


Measured memory_bytes: 3256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int a = scan.nextInt();
	    int b = scan.nextInt();
	    int c = scan.nextInt();

		if ((a < b) && (b < c)) {
	    	System.out.println( "Yes" );

		}
	    else {
	    	System.out.println( "No" );
		}
	}

}

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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;


int main(){
  int n,m,l; cin >> n >> m >> l;
  vector<vector<int>> a(n, vector<int>(m));
  vector<vector<int>> b(m, vector<int>(l));
  vector<vector<ll>> c(n, vector<ll>(l));
  rep(i, n){
    rep(j, m) {
      cin >> a[i][j];
    }
  }
  rep(i, m) {
    rep(j, l) {
      cin >> b[i][j];
    }
  }
  
  
  rep(i,n) {
    rep(j,l) {
      rep(k,m) {
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  rep(i,c.size()) {
    rep(j,c[i].size()) {
      cout << c[i][j];
      if (j != c[i].size()-1) {
          cout << " ";
      }
    }
    cout << endl;
  }
}



Measured memory_bytes: 3264
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
	string s;
	cin >> s;

	int x = 0;

	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'o')
			x++;
	}

	cout << 700 + x * 100 << endl;

	return 0;
}

Measured memory_bytes: 256
//Author: Rahul Purohit

#include<bits/stdc++.h>
#define vi vector<int>
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define ll  long long int
#define pi pair<ll,ll>
#define f first
#define mp make_pair
#define mod 1000000007
#define s second
#define pb push_back
#define mp make_pair
#define N 100001
using namespace std;
int gcd(int a, int b)
{
	if(b==0)
		return a;
	else
		return (b,a%b);
}
/*ll isp[N]={1};
void sieve(int n)
{
	isp[0]=isp[1]=0;
	for(int i=2;i<=n;i++)
	{
		if(isp[i]==1)
		{
			for(int j=i*i;j<=n;j+=i)
			{
				isp[j]==0;
			}
		}
	}
}*/
ll pow(int x,int  y,int m)
{
	ll ans=1;
	while(y!=0)
	{
		if(y%2==1)
		{
			ans=(ans*x)%m;
		}
		x=(x*x)%m;
		y/=2;
	}
	return ans;
}
template <class x>
void swap(x &a,x &b)
{
	x tp;
	tp=a;
	a=b;
	b=tp;
}
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

    string a;
    cin>>a;
    ll n=a.size();
    ll res=0;
    ll temp=0;
    rep(i,0,n)
    {
        if(a[i]=='A'||a[i]=='C'||a[i]=='G'||a[i]=='T')
        {
            ++temp;
        }
        else
        {
            res=max(res,temp);
            temp=0;
        }
        //cout<<temp<<endl;
    }
    res=max(res,temp);
    cout<<res;
    return 0;
}


Measured memory_bytes: 256
//
// Create by 神舟 on 2015-02-21
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <cctype>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <set>
#include <vector>
using namespace std;

#define CLR(x) memset(x,0,sizeof x)
#define ll long long
#define inf 0x3f3f3f3f
const int maxn=1e3+5;
const int MOD=5e5+5;
int n,m,t,sx,sy,ex,ey;
char word[maxn][maxn];
int path[maxn][maxn];
int ans,dir[4][2]={0,1,1,0,-1,0,0,-1};

struct pnt
{
    int x,y;
    pnt(int x=0,int y=0):x(x),y(y){};
};

void bfs()
{
    memset(path,0x3f,sizeof path);
    queue <pnt> que;
    pnt p,np;
    p.x=sx,p.y=sy;
    path[sx][sy]=0;
    que.push(p);
    while(!que.empty()){
        p=que.front();que.pop();
        if(p.x==ex&&p.y==ey) {return;}
        for(int i=0;i<4;i++){
            np.x=p.x+dir[i][0];
            np.y=p.y+dir[i][1];
            if(np.x>0 && np.x<=n && np.y>0 && np.y<=m && path[np.x][np.y]>path[p.x][p.y]+1 && word[np.x][np.y]!='X')
            {
                path[np.x][np.y]=path[p.x][p.y]+1;
                que.push(np);
            }
        }
    }
}
int main()
{
#ifdef LOCAL
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
#endif
	ios_base::sync_with_stdio(0);

	while(scanf("%d%d%d",&n,&m,&t)!=EOF){
        ans=0;
        CLR(word);
        for(int i=1;i<=n;scanf("%s",word[i++]+1));
        for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(word[i][j]=='S') word[i][j]='0';
        for(int k=0;k<t;k++){
            char tp=k+'0';
            for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){
                if(word[i][j]==tp) sx=i,sy=j;
                if(word[i][j]==tp+1) ex=i,ey=j;
            }
            bfs();
            ans+=path[ex][ey];
            //printf("%d\t",path[ex][ey]);
        }
        printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 6172
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int a[3][3];
    for(int i=0;i<3;i++){
    	for(int j=0;j<3;j++){
    		cin >> a[i][j];
    	}
    }
    int mi = 10000;
    for(int i=0;i<3;i++) mi = min(mi, a[0][i]);
    int b[3];
    for(int i=0;i<3;i++) {
    	b[i] = a[0][i] - mi;
    }
    for(int i=0;i<3;i++){
    	for(int j=0;j<3;j++){
    		a[i][j] -= b[j];
    	}
    }
    bool ok = true;
    for(int i=1;i<3;i++){
    	for(int j=0;j<2;j++){
    		if(a[i][j] != a[i][j+1]) ok = false;
    	}
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int data[5];
	REP(i,5) cin >> data[i];
	sort(data,data+5,greater<int>());
	REP(i,4) cout << data[i] << " ";
	cout << data[4] << endl;
}

Measured memory_bytes: 1180
while True:
    
    h,w = map(int, input().split())
    if h==0 and w==0:
        break
    a=h
    while h>0:
        
        if h==a or h==1:
            print("#"*w)
        else:
            print("#"+"."*(w-2)+"#")
        h-=1
    
    print("")


Measured memory_bytes: 5612
#include <algorithm>
#include <iostream>
#include <deque>
#include <string>
using namespace std;
typedef deque <string> sdeque;

int sdeque_out(sdeque &A){
    int n=A.size();
    for (int i=0; i<n; i++){
        cout << A[i];
        if (i!= n-1) cout<<" ";
        else cout<<endl;
    }
    return 0;
}

int main(void){
	int n;
	string text = "";
	sdeque que;
	sdeque::iterator pos;
	
	cin >> n;
	getline(cin, text);

	for (int i=0; i<n; i++){
		getline(cin, text);

		if (text[0]== 'i')
			que.push_front(text.substr(7));
		else if (text[6] == ' '){
			pos = find( que.begin(), que.end(), text.substr(7) );
			if (pos != que.end()) que.erase(pos);
		}else if (text[6] == 'F')
			que.pop_front();
		else if (text[6] == 'L')
			que.pop_back();
	}

	sdeque_out(que);
	return 0;
}

Measured memory_bytes: 56184
#include<bits/stdc++.h>
using namespace std;
int a[10009];
int b[200][200];
int main()
{
    int h,w;
    int n;
    cin>>h>>w>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    int k=1;
    for(int i=1; i<=h; i++)
    {
        if(i%2==1)
        {
            for(int j=1; j<=w; j++)
            {
                
                b[i][j]=k;
                a[k]-=1;
                if(a[k]==0)
                {
                    k+=1;
                }
            }
        }
        else
        {
            for(int j=w; j>=1; j--)
            {
               
                b[i][j]=k;
                a[k]-=1;
                if(a[k]==0)
                {
                    k+=1;
                }
            }

        }
    }
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            cout<<b[i][j]<<" ";
        }
        cout<<endl;
    }
}


Measured memory_bytes: 384
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int a=sc.nextInt();
    int b=sc.nextInt();
    int min=Math.min(n*a,b);
    System.out.println(min);
  }
}


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

int main()
{
  char prime[1000000];

  memset(prime, 1, sizeof(prime));
  prime[0] = prime[1] = 0;
  for (int i = 2; i < 1000; i++) {
    if (prime[i])
      for (int j = i * 2; j < 1000000; j += i)
        prime[j] = 0;
  }

  int a, d, n;
  while (cin >> a >> d >> n && (a||d||n)) {
    int ct = 0;
    while (a < 1000000) {
      if (prime[a]) 
        if (++ct == n)
          break;
      a += d;
    }
    cout << a << endl;
  }
}

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;

const int MAXN = 1010;

int v[MAXN];

int main()
{
	int n, k;
	scanf("%d %d",&n,&k);

	for(int i = 1 ; i <= n ; i++)
		scanf("%d",&v[i]);

	lli ans = 0;

	sort( v + 1 , v + n + 1 );

	for(int i = 1 ; i <= k ; i++)
		ans += v[i];

	printf("%lld\n",ans);
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int num[10][10];

void num_set(int N){
    int left = N%10;
    while(N >= 10) N /= 10;
    ++num[N][left];
    return ;
}

int main()
{
    int N;
    scanf("%d", &N);
    for(int i = 1; i <= N; ++i) num_set(i);
    ll res = 0LL;
    for(int i = 0; i < 10; ++i) {
        for(int j = 0; j < 10; ++j) {
            res += (ll)num[i][j] * (ll)num[j][i];
        }
    }
    printf("%lld\n", res);
    return 0;
}

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

//書き直し
public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;
	
	static List<String> ls;
	static int n;
	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		n = fs.nextInt();
		ls = new ArrayList<>();
		dfs("", 'a');

	}
	static void dfs(String s, char max) {
		if(s.length()==n) {
			System.out.println(s);
			return;
		}
		for(char i='a';i<max+1;i++) {
			String ns = s + i;
			if(i==max) dfs(ns, (char)(max+1));
			else dfs(ns,max);
		}
	}
	

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 46576
#include<bits/stdc++.h>
using namespace std;
long long int a[205],b[205];
int main()
{
   long long int i,x,j,pd=0;
   for(i=1;i<=150;i++)
   {
   	a[i]=i*i*i*i*i;
   }
   cin>>x;
   for(i=150;i>=0;i--)
   for(j=i-1;j>=0;j--)
   if(x==a[i]-a[j])
   {
   	cout<<i<<" "<<j;
   	pd=1;
   	break;
   }
   if(pd==0)
   {
  	for(i=0;i<=150;i++)
   	for(j=i+1;j<=150;j++)
   	if(a[i]+a[j]==x)
   	{
   		
   	  cout<<i<<" "<<-j;
	  break;	
   	}
   }
} 

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;


int main (){
    ll a,b;
    cin >> a >> b;
    cout << max(a+b,max(a-b,a*b)) << endl;
}

Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
s = Array.new(h + 2){Array.new(w + 2, 0)}
que = []
h.times do |i|
  c = gets.chomp
  w.times do |j|
    if c[j] == '.'
      s[i][j + 1] = -1
    elsif c[j] == '#'
      que.push(i)
      que.push(j + 1)
    end
  end
end
ans = 0
while que.size > 0 do
  i = que.shift
  j = que.shift
  ans = s[i][j]
  if s[i + 1][j] == -1
    s[i + 1][j] = ans + 1
    que.push(i + 1)
    que.push(j)
  end
  if s[i - 1][j] == -1
    s[i - 1][j] = ans + 1
    que.push(i - 1)
    que.push(j)
  end
  if s[i][j + 1] == -1
    s[i][j + 1] = ans + 1
    que.push(i)
    que.push(j + 1)
  end
  if s[i][j - 1] == -1
    s[i][j - 1] = ans + 1
    que.push(i)
    que.push(j - 1)
  end
end
puts ans

Measured memory_bytes: 27316
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())

    A = []
    x = []
    y = []

    for i in range(N):
        Ai = int(input())
        xi = []
        yi = []
        A.append(Ai)
        x.append(xi)
        y.append(yi)

        for j in range(Ai):
            xij, yij = map(int, input().split(' '))
            xi.append(xij)
            yi.append(yij)

    logging.info(A)
    logging.info(x)
    logging.info(y)

    ok_list = []
    for bits in range(2 ** N):
        ok_flag = True
        for i in range(N):
            if (bits >> i) & 1 == 0:
                continue

            for j in range(A[i]):
                if (bits >> (x[i][j] - 1) & 1) != y[i][j]:
                    ok_flag = False

        if ok_flag:
            ok_list.append(bin(bits).count('1'))

    print(max(ok_list))

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 4536
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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

int gcd(ll x, ll y){
  return y ? gcd(y, x%y) : x;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if(a+b>=10)cout<<"error"<<endl;
    else cout<<a+b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
 #define rep(i,N) for(int i=0;i<int(N);++i)
 using ll = long long;
 using v_i = vector<int>;
 using v_ll = vector<ll>;
 using v_s = vector<string>;
 const int INF = 2147483647;

 int main(){
    string t;
    cin >> t;
    int n = t.size();
    rep(i,n){
        if(t[i]=='?'){
            t[i] = 'D';
        }
    }
    cout << t << endl;
    return 0;
 }

     //int nin = *max_element(a.begin(),p.end());
    //int nax = *max_element(a.begin(),p.end())-p.begin();
    //int min_index = min_element(p.begin(),p.end())-p.begin();
     //sort(l.begin(),l.end(),greater<int>());
     //stringは",charは'
     //ちょっとあやしかったら立ち止まって考える
     //例外処理はreturn忘れずに
     //文字列連結 文字+="aa" でできる

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define NMAX 200005
using namespace std;
typedef long long ll;
typedef int fr[27];
ll k, x, ans, i, j;
map<string,ll> mp;
string s;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
}
int main()
{
    fast();
    int t;
    cin>>t;
    while(t--)
    {
        cin>>s;
        fr a;
        for(i=0;i<26;++i)
            a[i]=0;
        for(i=0;i<10;++i)
            ++a[s[i]-'a'];
        string s2;
        for(i=0;i<26;++i)
        s2+=(char)(a[i]+'0');
        mp[s2]++;
    }
    for(auto i:mp)
        ans+=i.nd*(i.nd-1)/2;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,k,i,l=0,s[100]={0};
	cin>>a>>b>>k;
	for (int i=1;i<=min(a,b);i++)
	{
	if(a%i==0 && b%i==0)	
	s[l]=i,l++;
	}
	cout<<s[l-k];
	return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if a > b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def lcm(a, b):
    return a * b // gcd(a, b)

a, b = map(int, input().split())
print(lcm(a, b))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int N;cin>>N;
    ll a=0,b=0,c=0,aa;
    for(int i=0; i<N;i++){
      cin>>aa;
      if(aa%2==1) a++;
      else if(aa%4==0) c++;
      else b++;
    }
    if(a<=c) cout<<"Yes"<<endl;
    else if(a==(c+1) && (a+c)==N) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000000+7
using namespace std;
typedef long long ll;

int main(){
  int N;  cin >> N;
  float yen = 0.0;
  rep(i, 0, N){
    float x;  cin >> x;
    string u; cin >> u;
    if(u == "JPY")  yen += x;
    else if(u == "BTC") yen += 380000.0 * x;
  }
  cout << yen << endl;
  return 0;
}

Measured memory_bytes: 256
N, C = map(int, raw_input().split())
D = [map(int, raw_input().split()) for _ in range(C)]
G = [map(int, raw_input().split()) for _ in range(N)]
GC = []
GC.append([0]*C)
GC.append([0]*C)
GC.append([0]*C)
for y in range(N):
  for x in range(N):
    GC[(y+x)%3][G[y][x]-1] += 1
ans = 1000000000
for a in range(C):
  for b in range(C):
    if a == b:
      continue
    for c in range(C):
      if a == c or b == c:
        continue
      cost = 0
      for i in range(C):
        cost += GC[0][i]*D[i][a]
        cost += GC[1][i]*D[i][b]
        cost += GC[2][i]*D[i][c]
      ans = min(ans, cost)
print ans


Measured memory_bytes: 4612
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

long long gcd( long long x, long long y ) {
    if ( x < y ) swap( x, y );
    return y == 0 ? x : gcd( y, x % y );
}

long long lcm( long long x, long long y ) {
    return x * y / gcd( x, y );
}

long long calc( long long a, long long m ) {
    long long t = 0;
    long long x = 1;
    do {
        x = ( a * x ) % m;
        t ++;
    } while ( x != 1 );
    return t;
}

int main() {
    long long a[3];
    long long m[3];
    long long t[3];
    while ( true ) {
        for ( int i = 0; i < 3; ++ i ) {
            cin >> a[i] >> m[i];
        }
        if ( a[0] == 0 && m[0] == 0 &&
             a[1] == 0 && m[1] == 0 &&
             a[2] == 0 && m[2] == 0 ) break;
        for ( int i = 0; i < 3; ++ i ) {
            t[i] = calc( a[i], m[i] );
        }
        cout << lcm( t[0], lcm( t[1], t[2] ) ) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int a, b, c; cin >> a >> b >> c;
  int k; cin >> k;

  while (b <= a) {
    b *= 2;
    k--;
  }

  while (c <= b) {
    c *= 2;
    k--;
  }

  if (k >= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		char[] s = sc.next().toCharArray();
		long k = sc.nextLong();
		int firstNoOne = -1;
		char none = '0';
		for (int i = 0; i < s.length; i++) {
			if (s[i] != '1') {
				firstNoOne = i;
				none = s[i];
				break;
			}
		}
		out.println(firstNoOne == -1 || k <= firstNoOne ? '1' : none);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 23124
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

# (始点、三角形)の組に対して、3K番目を求めればよい

N,K = map(int,read().split())

import numpy as np

theta = np.pi/N

def test(x):
    # 答 < x である。
    # area = 2sin(a)sin(b)sin(c) < x となるものの個数
    A = np.arange(1,N-1)
    sA = np.sin(A * theta)
    # sin(b)sin(c) > x / 2sA
    # cos((b-c)theta) + cos(a theta) > x/sA
    diff = np.arccos(x/sA - np.cos(A*theta)) / theta
    diff[np.isnan(diff)] = -(N+N)
    upper = np.minimum(N-A-1,(N-A+diff)/2).astype(int)
    lower = (N-A) - upper
    cnt = np.maximum(0, upper - lower + 1).sum()
    return N*((N-1)*(N-2)//2 - cnt) < 3*K

left = 0
right = 4
for _ in range(100):
    x = (left + right)/2
    if test(x):
        left = x
    else:
        right = x
print(x)

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

P=[0]*(N+1)
Q=[0]*(M+1)

for i in range(1, N+1):
  P[i]=P[i-1]+A[i-1]
  
for i in range(1, M+1):
  Q[i]=Q[i-1]+B[i-1]
  
import bisect
ans=0
for i in range(N+1):
  t=K-P[i]
  if t>=0:
    tmp=i+bisect.bisect_right(Q, t)-1
    ans=max(ans, tmp)
  
print(ans)

Measured memory_bytes: 48776
N = int(input())
As = list(map(int, input().split()))
M = max(As)+1
cnt = [0 for _ in range(M)]

for A in As:
  if cnt[A] != 0:
    cnt[A] = 2
    continue
  for n in range(A, M, A): cnt[n] += 1

ans = 0
for A in As:
  if cnt[A] == 1:
    ans += 1

print(ans)

Measured memory_bytes: 32048
#include <stdio.h>

#define N 100

int main(){

  int i, j, k, key, n, a[N];

  scanf("%d",&n);

  scanf("%d ",&a[0]);

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

  for(i=1;i<n;i++){

      printf("%d",a[0]); 

  for(k=1;k<n;k++)
    printf(" %d",a[k]); 

   printf("\n");
    j = i-1;
    key = a[i];
    
    while(j>=0 && a[j]>key){
      
      a[j+1] = a[j];
      a[j] = key;
      j--;
    }
   
  }

    printf("%d",a[0]); 

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

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

int main() {
    int A, B; cin >> A >> B;
    int maxOut = -1001;
    maxOut = max(maxOut, A+B);
    maxOut = max(maxOut, A-B);
    maxOut = max(maxOut, A*B);

    cout << maxOut << endl;
}


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

int main()
{
    long long n,k;
    cin>>n>>k;
    long long sum=1,mod=pow(2,31)-1;
    for(int i=1;i<=n;i++)
    {
        if(i==1)sum*=k,sum=sum%mod;
        else sum*=(k-1),sum=sum%mod;
    }
    cout<<sum<<endl;
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 405, P = 998244353;

int n, a[N], b[N], sa, sb;
int fac[N], inv[N], pw[N][N];

void init() {
	fac[0] = 1;
	for (int i = 1; i < N; ++i) {
		fac[i] = 1ll * fac[i - 1] * i % P;
	}
	inv[1] = 1;
	for (int i = 2; i < N; ++i) {
		inv[i] = 1ll * (P - P / i) * inv[P % i] % P;
	}
}

int f[N][N];

int main() {
	read(n);
	for (int i = 1; i <= n; ++i) {
		read(a[i]), read(b[i]);
		sa += a[i], sb += b[i];
	}
	init();
	for (int i = 1; i <= n; ++i) {
		pw[i][0] = 1;
		for (int j = 1; j <= b[i]; ++j) {
			pw[i][j] = 1ll * pw[i][j - 1] * a[i] % P;
		}
	}
	f[0][0] = P - 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = sa; j >= a[i]; --j) {
			for (int k = sb; k >= 0; --k) {
				int s = 1;
				for (int l = 0; l < b[i] && l <= k; ++l) {
					f[j][k] = (f[j][k] + 1ll * (P - f[j - a[i]][k - l]) * s % P * pw[i][l]) % P;
					s = 1ll * s * inv[l + 1] % P;
				}
			}
		}
	}
	int ans = 0;
	for (int i = 1; i <= sa; ++i) {
		int s = 1;
		for (int j = 0; j <= sb; ++j) {
			s = 1ll * s * inv[i] % P;
			ans = (ans + 1ll * f[i][j] * fac[j] % P * s) % P;
		}
	}
	print(1ll * ans * sa % P);
}


Measured memory_bytes: 4940
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define VL vector < ll >
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
#define cu cout<<
#define en endl
#define sp " "
#include<cstdio>
#include<cstring>
void bug()
{
    cout << "here\n";
}
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
/*#define N 100000009
bool prime[N];
vector<ll> prm;
void seive ()
{
    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {

        if (prime[i] == true)
        {
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
    for (ll i=2; i<=N; i++)
    {
        if(prime[i]) prm.pb(i);
    }
}*/
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
bool isprime(ll n)
{
    if(n<2) return 0;
    if(n==2) return 1;
    else
    {
        for(int i=2; i*i<=n; i++)
            if(n%i==0) return 0;
    }
    return 1;

}
ll countSum(ll x)
{
    ll res = 0;
    while (x != 0)
    {
        res += (x % 10);
        x /= 10;
    }
    return res;
}
ll power(ll a,ll b)
{
    if(b==0) return 1;
    if(b==1) return a;
    else
    {
        ll  res = power(a,b/2);
        if(b%2)
            return res * a*res;
        else
            return res*res;
    }
}
ll p [20005];
int main()
{
    fast;
    ll a,b;
    string s;
    cin >> s;
    if(s[s.sz-1]=='s')
        cout << s+"es"<<endl;
    else
        cout << s+"s"<<endl;

}



Measured memory_bytes: 3664
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, K;

  std::cin >> N >> K;

  std::cout << N - K + 1 << std::endl;

  return 0;
}


Measured memory_bytes: 888
n, m, c = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for item in A:
    if  sum([a * b for a, b in zip(item, B)]) + c > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cmath>
#include <string> 
using namespace std;

int main(){
	int x,y,board[12][12],c=0,k=0;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			board[i][j]=0;
		}
	}	
	char input[5];
	while( scanf("%s",&input)!=EOF){
		x=input[0]-'0';
		y=input[2]-'0';
		if(input[4]=='1'){
			board[x][y]++;
			board[x+1][y]++;
			board[x-1][y]++;
			board[x][y+1]++;
			board[x][y-1]++;
		}
		if(input[4]=='2'){
			board[x][y]++;
			board[x+1][y]++;
			board[x-1][y]++;
			board[x][y+1]++;
			board[x][y-1]++;
			board[x+1][y+1]++;
			board[x-1][y-1]++;
			board[x-1][y+1]++;
			board[x+1][y-1]++;
		}
		if(input[4]=='3'){
			board[x][y]++;
			board[x+1][y]++;
			board[x-1][y]++;
			board[x][y+1]++;
			board[x][y-1]++;
			board[x+1][y+1]++;
			board[x-1][y-1]++;
			board[x-1][y+1]++;
			board[x+1][y-1]++;
			board[x+2][y]++;
			board[x-2][y]++;
			board[x][y+2]++;
			board[x][y-2]++;
		}
	}
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if(board[i][j]==0){
				c++;
			}
			if(board[i][j]>k){
				k=board[i][j];
			}
		}
	}
	printf("%d\n%d\n",c,k);
	
			
	return 0;
}

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

#[macro_use]
extern crate lazy_static;

// use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
// use std::convert::TryInto;
use libm::*;
use std::cmp::*;
use std::collections::BinaryHeap;
use std::io::*;
use std::str::FromStr;
use superslice::*;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//abc175-A
// #[fastout]
fn main() {
    input![s: String];

    let ans = match &s[..] {
        "SSS" => 0,
        "SSR" => 1,
        "SRS" => 1,
        "SRR" => 2,
        "RSS" => 1,
        "RSR" => 1,
        "RRS" => 2,
        "RRR" => 3,
        _ => panic!("a"),
    };

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

fn go(mid: usize, d: usize, use_num: usize, num753_cand: &mut Vec<usize>, n: usize) {}

// use lazy_static::lazy_static;
// use std::sync::Mutex;

// lazy_static! {
//     static ref VALUES: Mutex<Vec<i32>> = Mutex::default();
// }

// let mut values = VALUES.lock().unwrap();
// values.extend_from_slice(&[1, 2, 3, 4]);
// assert_eq!(&*values, &[1, 2, 3, 4]);


Measured memory_bytes: 2104
result = []
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)

    if op == '+':
        result.append(a + b)
    elif op == '-':
        result.append(a - b)
    elif op == '*':
        result.append(a * b)
    elif op == '/':
        result.append(a // b)
    elif op == '?':
        break
for i in result:
    print(i)


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

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

    int N = 0;
    int i = 0;
    set<char> H = {};
    char S;
    cin >> N;
    while(i < N && cin >> S){
        H.insert(S);
        if(H.size() == 4){
            cout << "Four" << endl;
            return 0;
        }
        ++i;
    }
    if(H.size() == 3){
         cout << "Three" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cctype>
#include<string>
#include<cmath>
using namespace std;
char s[105][105];
int a[105][105];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>s[i][j];
            if(s[i][j]=='#'){
                a[i-1][j-1]++;
                a[i-1][j]++;
                a[i-1][j+1]++;
                a[i][j-1]++;
                a[i][j+1]++;
                a[i+1][j-1]++;
                a[i+1][j]++;
                a[i+1][j+1]++;
            }
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i][j]=='#') putchar('#');
            else cout<<a[i][j];
        }
        cout<<endl;
    }
	return 0;
}

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

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

typedef long long ll;
typedef pair<int, int> P;

#define MAX 500005

void solve(vector<int> a, ll x) {
  int l = 0, r = 0;
  ll sum = 0;
  int n = a.size();
  ll ans = 0;
  while (l < n) {
    while (r < n && sum+a[r] <= x) sum += a[r++];
    ans += r-l;
    sum -= a[l++];
  }
  cout << ans << endl;  
}

int main(int, char**)
{
  int n, q;
  cin >> n >> q;

  vector<int> a(n);
  rep(i,n) cin >> a[i];

  ll x;
  rep(i,q) {
    cin >> x;
    solve(a, x);
  }

  return 0;
}



Measured memory_bytes: 3692
def func(N, K, h_i):
    count = 0
    for i in range(N):
        if h_i[i] >= K:
            count += 1
    return count

N, K = map(int, input().split(" "))
h_i = list(map(int, input().split(" ")))
print(func(N, K, h_i))

Measured memory_bytes: 11912
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define test ll t; cin>>t; while(t--)
typedef long long int ll;
ll find(string s,string t){
    ll ans=0;
    for(int i=0;i<s.length();i++){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    return ans;
}
int main() {
    FIO;
    //test
    {
       string s,t;
       cin>>s>>t;
       int n=s.length(); int m=t.length();
       ll ans=LONG_MAX;
       for(int i=0;i<=n-m;i++){
           ans=min(ans,find(s.substr(i,m),t));
       }
       cout<<ans<<endl;
    }
	return 0;
}


Measured memory_bytes: 3660
n = int(input())
A = input()
B = input()
C = input()
a = [0] * n
for i in range(n):
  if (A[i] == B[i] == C[i]):
    a[i] += 0
  elif (A[i] == B[i] or B[i] == C[i] or A[i] == C[i]):
    a[i] += 1
  else:
    a[i] += 2

print(sum(a))


Measured memory_bytes: 3064
from collections import Counter

n,m=map(int,input().split())
primes=[]

mod=10**9+7

def modinv(x):
    return pow(x,mod-2,mod)


i=2
while i*i<=m:
    if m%i==0:
        while m%i==0:
            primes.append(i)
            m//=i
    
    i+=1
if m>1:
    primes.append(m)

cnt=Counter(primes)

invlst=[1]*(2*10**5)
factlst=[1]*(2*10**5)

for i in range(2,2*10**5):
    invlst[i]=modinv(i)*invlst[i-1]
    factlst[i]=i*factlst[i-1]
    invlst[i]%=mod
    factlst[i]%=mod
ans=1
for v in cnt.values():
    ans*=factlst[v+n-1]*invlst[n-1]*invlst[v]
    ans%=mod

print(ans)


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

int main(){
    int n;
    cin >> n;
    if ((n % 1000) > 0) {
        cout << 1000 - n % 1000 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
n = int(input())
w = list(map(int, input().split()))

total = sum(w)
s1 = [0]*(n-1)
s2 = [0]*(n-1)
for i in range(n-1):
    s1[i] = sum(w[:i+1])
    # スライス[始点:終点]
    s2[i] = total - s1[i]

d = [0] * (n-1)
for i in range(n-1):
    d[i] = abs(s1[i] - s2[i])

print(min(d))

Measured memory_bytes: 38384
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#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 _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

signed main() {
  int n;cin>>n;
  vector<int> a(n);
  set<int> s;
  rep(i, n) {
    cin>>a[i];
    if (s.find(a[i])!=s.end()){
      cout << "NO" << endl;
      return 0;
    }
    s.insert(a[i]);
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto & i : (a))
#define SZ(x) ((int)(x).size())
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
	int a, v, b, w, t;
	std::cin >> a >> v >> b >> w >> t;

	if(a > b){
		a *= -1;
		b *= -1;
	}

	ll on = b+1ll*w*t;
	ll ja = a+1ll*v*t;

	if(ja >= on) std::cout << "YES\n";
	else std::cout << "NO\n";

	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string a,b;
  cin>>a>>b;
  int k=0;
  for(int i=0;i<a.length();i++)
  {
    if(a.at(i)!=b.at(i))
        k++;
   }
  cout<<k<<endl;
  return 0;
}

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

int main() {
    int n, a, s;
    vector<int> x;
    vector< vector<long long> > dp;
    cin >> n >> a;
    x.assign(n, 0);
    for(int i=0;i<n;i++){
        cin >> x[i];
        x[i] -= a;
    }
    s = n * (1<<6);
    dp.assign(2, vector<long long>());
    for(int i=0;i<2;i++){
        dp[i].assign(s*2, 0);
    }
    dp[1][s] = 1;
    for(int i=0;i<n;i++){
        int m = i%2;
        int b = m^1;
        for(int j=0;j<s*2;j++){
            long long res = dp[b][j];
            if(j-x[i]>=0)res += dp[b][j-x[i]];
            dp[m][j] = res;
            
        }
    }
    cout << dp[(n-1)%2][s]-1 << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define nl cout<<"\n"
#define pb push_back
#define S second
#define F first
typedef long long int ll;


int main(){
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//~ freopen("input.txt", "r", stdin); 
    //~ freopen("output.txt", "w", stdout); 
	int n;
	cin>>n;
	n=n%10;
	if(n==2|| n==4|| n==5 || n==7||n==9){
		cout<<"hon"<<endl;
	}else if(n==0 || n==1 || n==6 || n==8) cout<<"pon"<<endl;
	else cout<<"bon"<<endl;
	return 0;
}


Measured memory_bytes: 3608
n, k = map(int, input().split())
s = list(input())
if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'
print(''.join(s))

Measured memory_bytes: 3060
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		int student = -1;
		while(true){
			student =scan.nextInt();
			if (student == 0){
				break;
			}
			
			int[] score = new int[student];
			double average = 0.0;
			for(int i=0;i<student; i++){
				score[i] = scan.nextInt();
				average += score[i];
			}
			average /= student;		//????¨??????° / ????????° ??? ?????????
			double deviation = 0.0;
			for(int i=0; i<student; i++){
				deviation += (score[i] - average) * (score[i] - average);
			}
			deviation /= student;
			deviation = Math.sqrt(deviation);
			System.out.println(deviation);
		}
	}
}

Measured memory_bytes: 31448
#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
bool fai[90][90],vis[90][90]={false};
int best;
int n,m;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
void DFS(int x,int y,int len){
    if(fai[y][x]==false||x==-1||y==-1||x==m||y==n||vis[y][x]==true){
        best=max(best,len);
        return;
    }
    len++;
    vis[y][x]=true;
    for(int i=0;i<4;i++)
        DFS(x+dx[i],y+dy[i],len);
    vis[y][x]=false;
}
int main(){
    while(true){
    cin>>n>>m;
    if(n==0&&m==0)
        break;
    best=0;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>fai[i][j];
 
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            DFS(j,i,0);
 
    cout<<best<<endl;
    }
    return 0;
}

Measured memory_bytes: 3076