akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
        val n = readLine()!!.toInt()
        val tList = mutableListOf<Int>()
        val xList = mutableListOf<Int>()
        val yList = mutableListOf<Int>()
        for (i in 1..n) {
            val list = readLine()!!.split(" ").map(String::toInt)
            tList.add(list[0])
            xList.add(list[1])
            yList.add(list[2])
        }
     
        var currentT = 0
        var currentX = 0
        var currentY = 0
        
        for (i in 0..(n - 1)) {
            val distance = calcDistance(currentX, currentY, xList[i], yList[i])
            val timeDistance = tList[i] - currentT
            if (distance <= timeDistance && checkSame(distance, timeDistance)) {
            } else {
                println("No")
                return
            }
            currentT = tList[i]
            currentX = xList[i]
            currentY = yList[i]
        }
     
        println("Yes")
    }
     
    fun calcDistance(x1: Int, y1: Int, x2: Int, y2: Int) = Math.abs(x1 - x2) + Math.abs(y1 - y2)
    fun checkSame(v1: Int, v2: Int) = (v1 % 2 == 0 && v2 % 2 == 0) || (v1 % 2 == 1 && v2 % 2 == 1)

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


int main(){
	int n, a;
	int ans=0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a;
		ans += a - 1;
	}
	cout << ans << endl;;
	
	return 0;
}


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

int main() {
  int n;
  cin >> n; 
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  
  int count = 0;
  for (int i = 1; i < n; i++) {
    if (p.at(i-1) == i) {
      p.at(i-1) = p.at(i);
      p.at(i) = i;
      count++;
    }
  }
  if (p.at(n-1) == n) count++;

  cout << count << endl;
}


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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n;
    cin >> n;
    long long a[n + 1][3], dp[n + 1][3];
    for(long long i = 1; i <= n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
        dp[i][0] = dp[i][1] = dp[i][2] = 0;
    }
    dp[1][0] = a[1][0];
    dp[1][1] = a[1][1];
    dp[1][2] = a[1][2];
    for(long long i = 2; i <= n; i++) {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i][0];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + a[i][1];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + a[i][2];
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string.h>
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int at = a, bt = b, ct = c;
  int tmp1,tmp2,n=0;
  while(at%2==0&&bt%2==0&&ct%2==0){
    tmp1 = at;
    tmp2 = bt;
    at = bt/2+ct/2;
    bt = tmp1/2+ct/2;
    ct = tmp1/2+tmp2/2;
    n +=1;
    if(a == at&& b == bt&& c == ct){
        n = -1;
        break;
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, p, w, g, y;
  string S;
    cin >> N;
    p = 0;
    w = 0;
    g = 0;
    y = 0;
  
  for ( int i; i < N; i++ ) {
    cin >> S;
    
      
    
    if ( S == "P" ) {
      p = 1;
    }
    
    else if ( S == "W" ) {
      w = 1;
    }
    
    else if ( S == "G" ) {
      g = 1;
    }
    
    else if ( S == "Y" ) {
      y = 1;
    }
  }
  if ( p + w + g + y == 1 ) {
    cout << "One" << endl;
  }
  if ( p + w + g + y == 2 ) {
    cout << "Two" << endl;
  }
  if ( p + w + g + y == 3 ) {
    cout << "Three" << endl;
  }
  if ( p + w + g + y == 4 ) {
    cout << "Four" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void call(int n){

	int i = 1;
	do
	{
		int x = i;
		if ( x % 3 == 0 )
		{
			cout << " " << i;
		}
		else
		{
			do
			{
				if ( x % 10 == 3 ){
					cout << " " << i;
					break;
				}
				x /= 10;
			}while(x);
		}
		i++;
	}while(i <= n);
	cout << endl;
}

int main()
{
	int n = 0;
	cin >> n;
	call(n);

	return 0;
}

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

using namespace std;


int main(){
  int N, L;
  cin >> N >> L;
  
  int eated_apple = 10000000;
  int sum_taste = 0;
  for(int i=1; i<=N; i++){
    sum_taste += L+i-1;
    if(abs(eated_apple)>abs(L+i-1)) eated_apple = L+i-1;
  }
  
  cout << sum_taste-eated_apple << endl;
  
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

char toLowerCase(char c){
  if(isLowerCase(c)){
    return c;
  }else{
    return c+'a'-'A';
  }
}
char toUpperCase(char c){
  if(isLowerCase(c)){
    return c-('a'-'A');
  }else{
    return c;
  }
}
ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  string s;cin>>s;
  int w;cin>>w;
  for(int i=0;i<s.size();i+=w){
    cout<<s[i];
  }
  cout<<endl;
  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

const int MOD = 1e9+7;
const int INF = (1<<28);
const ll INFL = (1LL<<60);

int main() {
  int a, b; cin >> a >> b;
  if (a > b) swap(a, b);
  rep(i,b) cout << a;
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <limits.h>
#include <list>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;

typedef vector<lint> vl;
typedef pair<lint,lint> pll;

const int di[4] = {-1, 0, 1, 0};
const int dj[4] = {0, -1, 0, 1};


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

    int n; cin>>n;
    vi p(n*n);
    for (int & i : p) cin>>i;

    vector<vi> _mp(n, vi(n));

    for (int i=0; i<n*n; ++i){
        int c = p[i]-1;
        _mp[c/n][c%n] = i;
    }
    const vector<vi> mp = _mp;

    vector<vi> ans(n, vi(n, INT_MAX));

//    deque<pii> bfs;



    for (int i=0; i<= n-1; i++){
        for (int j=0; j<=n-1; j ++){
            int a = min(i, j);
            int na = min(n-1-i, n-1-j);
            ans[i][j] = min(a, na) +1;
        }
    }
    int res = 0;
//    vector<vi> dirs({{0,1}, {0,-1}, {-1,0}, {1,0}});

    vector<pii> bfs;
    for (int i=0; i<n*n; ++i){
        int c = p[i]-1;
        res += ans[c/n][c%n]-1;
        ans[c/n][c%n]--;

        bfs.clear();
        bfs.push_back({c/n, c%n});

        int cur = mp[c/n][c%n];

        for (int i=0; i<bfs.size(); ++i){
            pii pos = bfs[i];

            for (int did = 0; did<4; ++did){
                int len = ans[pos.first][pos.second];

                int nx = pos.first + di[did];
                int ny = pos.second + dj[did];
                if (nx >=0 && nx <n && ny>=0 && ny < n){
                    if (mp[nx][ny] < cur){
                        if (ans[nx][ny] > len){
                            ans[nx][ny] = len;
                            bfs.emplace_back(nx, ny);
                        }
                    } else {
                        if (ans[nx][ny] > len+1){
                            ans[nx][ny] = len+1;
                            bfs.emplace_back(nx, ny);
                        }
                    }
                }
            }
        }

    }


//    while(!bfs.empty()){
//        pii pos = bfs.front(); bfs.pop_front();
//        for (vi dir : dirs){
//            int nx = pos.first + dir[0];
//            int ny = pos.second + dir[1];
//            int len = ans[pos.first][pos.second];
//            if (nx >=0 && nx <n && ny>=0 && ny < n){
//                if (mp[nx][ny] < mp[pos.first][pos.second]){
//                    push({nx, ny}, len+1, 1);
//                } else {
//                    push({nx, ny}, len, 0);
//                }
//            }
//        }
//    }

//    int res = 0;
//    for (vi & va : ans){
//        for (int i : va) res += i;
//    }
    cout<<res;


}


Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"


signed main() {
    int r, D, x;
    cin >> r >> D >> x;
    int ans = x;
    for (int i = 1; i <= 10; i++) {
        ans = r * ans - D;
        cout << ans << endl; 
    }
}

Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1e18;

V<int> b[55];

V<int> f(V<int> a,int p,int c,int n){
    V<int> b;
    for(int i=p-1;i<p-1+c;i++){
        b.push_back(a[i]);
    }
    for(int i=0;i<p-1;i++) b.push_back(a[i]);
    for(int i=p-1+c;i<n;i++) b.push_back(a[i]);
    return b;
}

signed main(){
    while(true){
        int n,r;
        cin>>n>>r;
        if(n==0&&r==0) break;
        V<int> a,ans;
        for(int i=n;i>0;i--) a.push_back(i);
        for(int i=1;i<=r;i++){
            int p,c;
            cin>>p>>c;
            if(i==1) b[i]=f(a,p,c,n);
            else b[i]=f(b[i-1],p,c,n);
        }
        cout<<b[r][0]<<endl;
    }
}


Measured memory_bytes: 3128
#include <stdio.h>
 
int main(void) {
    int n;
    int h[22];
    int i;
    int x=0;
    int max=0;
  
    scanf("%d\n", &n);
    for(i=1;i<=n;i++){
      scanf("%d ",&h[i]);
    }
    max=h[1];x=1;
    for(i=2;i<=n;i++){
      if(h[i]>=max){
        max=h[i];
        x++;
      }
    }
   
    printf("%d\n",x);
 
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int h, w, n;
    cin >> h;
    cin >> w;
    cin >> n;
    int num;
    num = max(h, w);
    if(n % num == 0){
        cout << n / num << endl;
    }
    else{
        cout << (n / num) + 1 << endl;
    }

    solve();
    return 0;
}



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

typedef pair<string,int> P;
typedef pair<int,string> P2;

int main() {
  string s;
  P2 a[101];
  int cnt=0;
  while(cin >> s) {
    int n;
    cin >> n;
    a[cnt]=P2(n,s);
    cnt++;
  }
  sort(a,a+cnt);
  P b[cnt];
  for(int i=0; i<cnt; i++) b[i]=P(a[i].second,a[i].first);
  sort(b,b+cnt);
  
  string name="";
  bool ck=false;
  for(int i=0; i<cnt; i++) {
    if(b[i].first!=name) {
      if(ck) cout << endl;
      cout << b[i].first << endl;
      name=b[i].first;
      ck=false;
    }
    if(ck) cout << " ";
    cout << b[i].second;
    ck=true;
  }
  cout << endl;
  return 0;
}
	


Measured memory_bytes: 1236
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      int a,b,c;
      cin >> a >> b >> c;
      int kari = c;
      for(int i = 0;i < 10;i++){
        kari = kari*a-b;
        cout << kari << endl;
      }
    }

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

int main() {
	string n;
	cin >> n;
	int ans = 0;
	int x = 0;
	for (int i = 0;i < n.size();i++) {
		if (n[i] == 'A' || n[i] == 'T' || n[i] == 'C' || n[i] == 'G') {
			x++;
			if (x > ans)
				ans = x;
		}
		else
			x = 0;
	}
	cout << ans << endl;
}

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


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};
int main() {
	//sort(a.begin(),a.end());
	int n;
	double  ans = 0,a;
	cin >> n;
	rep(i, n) {
		cin >> a;
		ans += 1 / a;
	}
	ans = 1 / ans;
	cout << ans;
	return 0;
}









Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
};

typedef vector<set<Edge>> Graph;

ll fact[100001] = {};

ll factorial(ll n) {//階乗
	if (fact[n] != 0) return fact[n];
	if (n > 0) {
		return fact[n] = n * factorial(n - 1) % MODU;
	}
	else {
		return 1;
	}
}


ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
ll divmod(ll a, ll b, ll m) { // a/b(mod m)
								  // a/b (mod m)
								  // a*b^-1
								  // b^-1 * b = 1
								  // b^(m-1) = 1 
								  // b^(m-2) * b = 1
								  // b^-1 = b^(m-2)

								  // a/b = a * b^(m-2)

	return (a * 1LL * mod_pow(b, m - 2, m)) % m;
}

ll ncr(ll n, ll r) {
	return divmod(factorial(n) , (factorial(r) * (factorial(n - r)) % MODU), MODU);
}


signed main(void) {
	int n, x;
	cin >> n >> x;
	vector<ll> s(n);
	REP(i, n)
		scnaf("%lld", &s[i]);
	//n++;/*
	//s.push_back(x + 1);*/
	sort(ALL(s), greater<ll>());

	ll dp[203][100010] = {};
	
	dp[0][x] = 1;
	REP(i, n) {
		REP(j, x + 1) {
			if (dp[i][j]) {
				dp[i + 1][j % s[i]] += dp[i][j];
				dp[i + 1][j] += dp[i][j] * (n - i - 1) % MODU;
			}
		}
	}
	ll ans = 0;

	REP(i, x + 1) {
		ans += dp[n][i] * i % MODU;
		ans %= MODU;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 158848
a,b,x = map(int,input().split())
import math
S = a*b
S_x = x / a
c = 2*b - (2*x)/(a*a)
d = 2*x / a*b
theta1 = math.degrees(math.atan((2*b-(2*x)/(a*a))/a))
theta2 = math.degrees(math.atan(b/((2*x)/(a*b))))
if S_x >= S/2:
    print(theta1)
else:
    print(theta2)

Measured memory_bytes: 3064
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
ll MOD = 1000000007;
#define INF (1e9)

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; }
typedef pair <ll,ll> P;


int main()
{
    ll a, b;
    cin >> a >> b;
    cout << (a+b+2-1)/2 << endl;
    return 0;
}


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

int main(){
  int N; cin>>N;
  if(N%10==3) cout<<"bon\n";
  else if(N%10==0||N%10==1||N%10==6||N%10==8){
    cout<<"pon\n";
  }else cout<<"hon\n";
  return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string a;   
    bool v[2]={0};
    cin>>a;
    for(int i=0;i<a.length();i++)
    {
        if(a[i]=='C') 
            v[0]=1;
        if(a[i]=='F'&&v[0])  
            v[1]=1; 
    }
    if(v[1]) 
        cout<<"Yes"; 
    else 
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 500
#define MAX_M 30000
struct edge{ int from,to,id; };
int N,M;
int a[MAX_M],b[MAX_M];
vector<edge> G[MAX_N];

bool visited[MAX_N];
int depth[MAX_N];
int cnt[MAX_N];
vector<edge> bridges;

void dfs(int pos,int prev){
  visited[pos]=true;
  for(int i=0;i<(int)G[pos].size();i++){
    int to=G[pos][i].to;
    if(to==prev)continue;
    if(!visited[to]){
      depth[to]=depth[pos]+1;
      dfs(to,pos);
      cnt[pos]+=cnt[to];
      if(cnt[to]==0)bridges.push_back(G[pos][i]);
    }else if(depth[to]<depth[pos]){
      cnt[pos]++;
      cnt[to]--;
    }
  }
}

int countB(int id){
  bridges.clear();
  memset(visited,false,sizeof(visited));
  memset(depth,0,sizeof(depth));
  memset(cnt,0,sizeof(cnt));
  for(int i=0;i<N;i++)G[i].clear();
  for(int i=0;i<M;i++){
    if(i==id)continue;
    G[ a[i] ].push_back( (edge){ a[i],b[i],i } );
    G[ b[i] ].push_back( (edge){ b[i],a[i],i } );
  }
  for(int i=0;i<N;i++){
    if(visited[i])continue;
    dfs(i,-1);
  }
  return bridges.size();
}

bool check(int id){
  int B=countB(id);

  memset(visited,false,sizeof(visited));
  int U=0;
  for(int i=0;i<N;i++)
    if(!visited[i])U++,dfs(i,-1);
  
  if(B+U<3)return false;
  
  queue<int> Q;
  vector<int> C(N,0);
  for(int i=0;i<M;i++)
    if(id!=i)C[ b[i] ]++;
  for(int i=0;i<N;i++)
    if(C[i]==0)Q.push(i);
  int cc=0;
  while(!Q.empty()){
    int pos=Q.front();Q.pop();
    cc++;
    for(int i=0;i<(int)G[pos].size();i++){
      int to=G[pos][i].to;
      C[to]--;
      if(C[to]==0)Q.push(to);
    }
  }
  if(cc==N)return true;
  else return false;
}

vector<edge> loope;
bool rec(int pos,int si,int pre=-1){
  if(visited[pos])return (pos==si);
  visited[pos]=true;
  for(int i=0;i<(int)G[pos].size();i++){
    edge e=G[pos][i];
    if(e.id==pre)continue;
    
    if( rec(e.to,si,e.id) ){
      loope.push_back(e);
      return true;
    }
  }
  return false;
}

bool solve2(){

  for(int i=0;i<M;i++){
    if(check(i))return true;
  }
  
  for(int i=0;i<N;i++){
    memset(visited,false,sizeof(visited));
    memset(depth,0,sizeof(depth));
    loope.clear();
    if( rec(i,i) ){
      break;
    }
  }
  for(int i=0;i<(int)loope.size();i++){
    if(check( loope[i].id ))return true;
  }
  return false;
}

bool solve(){
  if(countB(-1)==M)return false;
  
  for(int i=0;i<N;i++)G[i].clear();
  for(int i=0;i<M;i++)G[ a[i] ].push_back( (edge){a[i],b[i],i} );
  if(solve2())return true;
  
  for(int i=0;i<N;i++)G[i].clear();
  for(int i=0;i<M;i++)G[ a[i] ].push_back( (edge){a[i],b[i],i} );
  for(int i=0;i<M;i++)G[ b[i] ].push_back( (edge){b[i],a[i],i} );
  if(solve2())return true;  
  return false;
}

int main(){
  cin>>N>>M;
  for(int i=0;i<M;i++){
    cin>>a[i]>>b[i];
    a[i]--;
    b[i]--;
  }
  cout<< ( solve() ? "YES" : "NO" ) <<endl;
  return 0;
}

Measured memory_bytes: 3248
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 100000000;
using namespace std;

int main(){
    long long h, w, n;
    map<pair<long long , long long >, long long> m;

    cin >> h >> w >> n;

    rep(i,n){
        long long a, b;
        cin >> a >> b;
        a--; b--;
        rep(j,3){
            rep(k,3){
                if(a - j < 0) continue;
                if(a - j >= h - 2) continue;
                if(b - k < 0) continue;
                if(b - k >= w - 2) continue;
                m[make_pair(a - j, b - k)]++;
            }
        }
        assert(m.size() < 1000000);
    }
    
    
    long long ans[10] = {0}, sum = 0;
    range(i,1,10){
        long long cnt = 0;
        for(auto it = m.begin(); it != m.end(); it++){
            if(i == it->second) cnt++;
        }
        ans[i] = cnt;
        sum+=cnt;
    }
    ans[0] = (h - 2) * (w - 2) - sum;
    rep(i,10) cout << ans[i] << endl;
        //for(auto it = m.begin(); it != m.end(); it++){ cout << it->first.first << ' ' << it->first.second << endl; }
}


Measured memory_bytes: 56448
def check(hs, h, n)
    n.times do |i|
        return 0 if hs[i] > h
    end
    return 1
end

def test
    n = gets.to_i
    hs = gets.split(" ").map(&:to_i)
    ans = 0
    n.times do |i|
        ans += check(hs, hs[i], i)
    end
    ans
end

puts test

Measured memory_bytes: 3836
#include<cstdio>
int main()
{
	int n,k;long long ans;
	scanf("%d%d",&n,&k);
	ans=1LL*(n/k)*(n/k)*(n/k);
	if(k%2==0)n+=k/2,ans+=1LL*(n/k)*(n/k)*(n/k);
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef long long LL;
struct robot {
	LL core;
	LL left;
	LL right;
	LL range;
};

bool compare(struct robot a, struct robot b)
{
	if (a.right == b.right) return a.range < b.range;
	else return a.right < b.right;
}
int main()
{
	int n;
	scanf("%d", &n);
	struct robot* input = (struct robot*)calloc(n, sizeof(struct robot));
	struct robot* point;
	for (int i = 0; i < n; i++)
	{
		point = input + i;
		scanf("%lld %lld", &point->core, &point->range);
		point->left = point->core - point->range;
		point->right = point->core + point->range;
	}
	sort(input, input + n, compare);
	int cnt = 1;
	LL last = input->right;
	for (int i = 1; i < n; i++)
	{
		point = input + i;
		if (point->left >= last)
		{
			cnt++;
			last = point->right;
		}
	}
	printf("%d", cnt);
	free(input);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define pf push_front
#define sec second
#define sz(x) ((int)(x).size())
#define ALL( c ) (c).begin(), (c).end()
#define gcd(a,b) __gcd(a,b)
#define mem(x,n) memset(x,n,sizeof(x))
#define endl "\n"
using namespace std;
template <int POS, class TUPLE> void deploy(std::ostream &os, const TUPLE &tuple){}
template <int POS, class TUPLE, class H, class ...Ts> void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get<POS>(t); deploy<POS + 1, TUPLE, Ts...>(os, t); }
template <class T,class U> std::ostream& operator<<(std::ostream &os, std::pair<T,U> &p){ os << "(" << p.first <<", " << p.second <<")";return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; }
#define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; }
#define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); }
using ll = long long;



int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int N,A,B;
  cin >> N >> A >> B;
  string S;
  cin >> S;
  int a = 0, b = 0;
  bool y;
  numa(c,S){
    y = false;
    if (c == 'a') {
      if (a + b < A + B) {
        y = true;
        a++;
      }

    }else if (c == 'b') {
      if (a + b < A + B && b < B) {
        y = true;
        b++;
      }

    }
    if (y) {
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }
  
  return 0;
}



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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
void debug(istringstream&){}
template <char sep=',', class Head, class... Tail>
void debug(istringstream& iss, Head&& head, Tail&&... tail)
{
  string name;
  getline(iss, name, ',');
  cerr << sep << name << "=" << head;
  debug(iss, forward<Tail>(tail)...);
}
#define DEBUG(...) \
  do{ \
    istringstream ss(#__VA_ARGS__); \
    debug<' '>(ss, __VA_ARGS__); \
    cerr<<endl; \
  }while(0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  VI xs(4);
  cin >> xs;
  SORT(xs);

  bool ok = xs[0] == 1 && xs[1] == 4 && xs[2] == 7 && xs[3] == 9;
  cout << (ok ? "YES": "NO") << endl;

  return 0;
}


Measured memory_bytes: 256
S=input()
abc=[chr(ord('a')+i) for i in range(26)]

if len(S)<26:
    for s in S:
        abc.remove(s)
    print(S+abc[0])
    exit()
for i in range(24,-1,-1):
    for j in range(25,i,-1):
        if S[i]<S[j]:
            print(S[:i]+S[j])
            exit()

print(-1)


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdbool.h>

bool less_than(int h1, int w1, int h2, int w2)
{
	int s = h1*h1 + w1*w1;
	int t = h2*h2 + w2*w2;

	return s < t || (s == t && h1 < h2);
}	

int main(void)
{
	for (;;) {
		int h, w;
		int ans_h, ans_w;
		int i, j;

		scanf("%d %d", &h, &w);
		if (h == 0 && w == 0)
			break;

		ans_h = 150;
		ans_w = 150;
		for (i = 1; i <= 150; i++) {
			for (j = i+1; j <= 150; j++) {
				if (less_than(h, w, i, j) && less_than(i, j, ans_h, ans_w)) {
					ans_h = i;
					ans_w = j;
				}
			}
		}

		printf("%d %d\n", ans_h, ans_w);
	}
	return 0;
}

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

int main() {
    long long x, y;
    cin >> x >> y;
    long long ans = abs(abs(x) - abs(y));

    if (x + ans == y) cout << ans << endl;
    else if (-x + ans == y || -(x + ans) == y) cout << ans + 1 << endl;
    else cout << ans + 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; ll W; cin >> N >> W;
    vector<ll> v(N),w(N);
    rep(i,N) cin >> v[i] >> w[i];
    
    int M = N/2;
    vector<pair<ll,ll>> left,right;
    for (int tmp = 0; tmp < (1 << M); tmp++) {
        bitset<20> s(tmp);
        ll val = 0;
        ll wei = 0;
        rep(i,M) {
            if (s.test(i)) {
                val += v[i];
                wei += w[i];
            } 
        }
        left.emplace_back(wei,val);
    }
    for (int tmp = 0; tmp < (1 << (N - M)); tmp++) {
        bitset<20> s(tmp);
        ll val = 0;
        ll wei = 0;
        rep(i,(N - M)) {
            if (s.test(i)) {
                val += v[M+i];
                wei += w[M+i];
            } 
        }
        right.emplace_back(wei,val);
    }

    sort(all(left)); sort(all(right));
    for (int i = 1; i < (1 << M); i++) {
        if (left[i].second <= left[i-1].second) {
            left[i] = left[i-1];
        }
    }
    for (int i = 1; i < (1 << (N-M)); i++) {
        if (right[i].second <= right[i-1].second) {
            right[i] = right[i-1];
        }
    }

    ll ans = 0;
    rep(i,(1 << M)) {
        int k = upper_bound(all(right),make_pair(W - left[i].first,ll(1e18))) - right.begin();
        if (k == 0) continue;
        k--;
        chmax(ans,right[k].second+left[i].second);
    }

    cout << ans << endl;
}


Measured memory_bytes: 43788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int sum = 0;
		int num = n;
		while (num > 0) {
			sum += num % 10;
			num /= 10;
		}
		
		String ans = n % sum == 0 ? "Yes" : "No";
		System.out.println(ans);
		
		sc.close();
	}
}




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

int main() {
	int N, K;
	cin >> N >> K;
	int X;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> X;
		sum += min(X, abs(X - K));
	}
	cout << sum * 2 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const long long MOD=1004535809;
const long long LMOD=154590409516822759;
//const long long LMOD=1000000007;
#define Fi first
#define Se second
#define P2 pair
#define Pii pair<int,int>
#define Pll pair<long long,long long>
#define Cb make_pair
#define ll long long
#define Ull unsigned long long
#define Sf scanf
#define Pf printf
#define Pb push_back
#define Psh push
#define Stc stack
#define Vct vector
#define Ret return
#define Re0 return 0
#define Sz size
#define Is insert
#define Que queue
#define Emp empty
#define Fro front
#define Rv reverse
#define Er erase
#define Bg begin
#define Srt sort
#define Pq priority_queue
#define Ins insert
#define Ite iterator
#define Cou count
#define Cot continue
#define Beg begin
int main()
{
	int a,b;
	cin>>a>>b;
	cout<<6-a-b;
	return 0;
}

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

using namespace std;

#define ll long long
#define mp make_pair
#define f first
#define s second
#define pb push_back

int v[101000],n,mx,i;

int main()
{
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);

    cin>>n;
    for(i=1; i<=n; ++i)
    {
        cin>>v[i];
        if(i>1)
        {
            if(v[i]<mx-1)
            {
                cout<<"No";
                return 0;
            }
        }
        mx = max(mx,v[i]);
    }
    cout<<"Yes";

}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

int main(){
        using namespace std;
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        int n,sum;
        long long count = 0;
        string s;
        vector<int> r, g, b;
        cin >> n >> s;
        for(int i=0; i<=n; i++) {
                switch(s[i]) {
                case 'R':
                        r.push_back(i+1);
                        break;
                case 'G':
                        g.push_back(i+1);
                        break;
                case 'B':
                        b.push_back(i+1);
                        break;
                default:
                        break;
                }
        }
        for(int i=0; i<(int)r.size(); i++) {
                for(int j=0; j<(int)g.size(); j++) {
                        for(int k=0; k<(int)b.size(); k++) {
                                sum=r[i]+g[j]+b[k];
                                if(3*r[i]==sum || 3*g[j]==sum || 3*b[k]==sum){
                                  count--;
                                  continue;
                                }
                        }
                }
        }
        count += r.size()*g.size()*b.size();
        cout << count << endl;
        return 0;
}


Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
bool she(int x)
{
	if(x>=0&&x<10){
		return true;
	}else if(x>=100&&x<1000)
	{
		return true;
	}else if(x>=10000&&x<100000)
	{
		return true;
	}else
	{
		return false;
	}
}
int main()
{
	int n;
	cin>>n;
	int ans=0; 
	for(int i=1;i<=n;i++)
	{
		if(she(i)==true)
		{
			
			ans++;
		}
	}
	cout<<ans<<endl;
}

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

int main(){
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long x3, y3, x4, y4;
    x3 = x2 + y1 - y2;
    y3 = y2 - x1 + x2;
    x4 = (x1+y1+x3-y3)/2;
    y4 = (x3+y1-x1+y3)/2;

    cout << x3 << " "<< y3 << " "<< x4 << " "<< y4 <<endl;;
    return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            for (int i = 1; i <= 9; i++)
            {
                if (N <= 111 * i)
                {
                    Console.WriteLine(111 * i);
                    return;
                }
            }
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <climits>
#include <ctime>
#include <cmath>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

#define sz(x) (int)(x.size())

typedef long long ll;
typedef tuple<int, int, int> tri;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef __gnu_pbds::tree<
    int,
    __gnu_pbds::null_type,
    less<int>,
    __gnu_pbds::rb_tree_tag,
    __gnu_pbds::tree_order_statistics_node_update>
    ordered_set;

const ll MODULO = 1000000007;

void ftime()
{
#ifndef ONLINE_JUDGE
    cout << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
#endif
}

static int speed_increase = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    return 0;
}();
string s, t;
void solve()
{
    cin>>s>>t;
    int n = sz(s), m = sz(t);
    int ms = INT_MAX;
    for(int i=0; i<=n-m; ++i) {
        int score = 0;
        for(int x=0; x<m; ++x) {
            score += (s[x+i] != t[x]);
        }
        ms = min(ms, score);
    }
    cout<<ms<<"\n";
}

int main()
{
    solve();
    // ftime();
    return 0;
}

Measured memory_bytes: 3616
import sys
input = sys.stdin.readline

def costs(a):
    prev = 0
    for x in a:
        yield abs(x - prev)
        prev = x

def main():
    input()
    A = [0] + [int(c) for c in input().split()] + [0]
    total = sum(costs(A))
    for i, x in enumerate(A[1:-1],1):
        prev_cost = abs(x - A[i-1])
        succ_cost = abs(A[i+1] - x)
        print(total - (prev_cost+succ_cost) + abs(A[i+1]-A[i-1]))

if __name__ == "__main__":
    main()

Measured memory_bytes: 14044
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

vector<int> make_char_cnt(const vector<char>& S, const int& index) {
  vector<int> answer(26, 0);
  rep(i, index) {
    ++answer[S[i]-'a'];
  }
  return answer;
}
int get_same(const vector<int>& X, const vector<int>& S) {
  int answer {};
  rep(i, 26) {
    if (X[i]>0 && (S[i]-X[i])>0) {
      ++answer;
    }
  }
  return answer;
}

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

  int N;
  cin >> N;
  vector<char> S(N);
  rep(i, N) cin >> S[i];

  vector<int> char_cnt(26, 0);
  rep(i, N) {
    ++char_cnt[S[i]-'a'];
  }
  int answer {};
  rep(i,N) {
    vector<int> X = make_char_cnt(S, i);
    maxs(answer, get_same(X, char_cnt));
  }
  cout << answer << '\n';
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt(), m = sc.nextInt();
        int k = sc.nextInt();
        long[] a = new long[n], b = new long[m];
        int ans = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i != 0) a[i] += a[i - 1];
            if (a[i] <= k) ans = i + 1;
        }
        for (int i = 0; i < m; i++) {
            b[i] = sc.nextInt();
            if (i != 0) b[i] += b[i - 1];
            if (b[i] <= k) ans = Math.max(ans, i + 1);
            int lo = 0, hi = n - 1;
            while (lo <= hi) {
                int mid = lo + hi >> 1;
                if (a[mid] <= k - b[i]) {
                    ans = Math.max(ans, i + mid + 2);
                    lo = mid + 1;
                } else hi = mid - 1;
            }
        }
        out.println(ans);
        out.flush();
        out.close();
    }

    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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


Measured memory_bytes: 62484
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


void  bubbleSort(int number[], int length);

int main() {

	int N, A[1000];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	bubbleSort(A, N);
	
	int sum1 = 0;
	for (int i = 0; i < N; i += 2) {
		sum1 += A[i];
	}
	int sum2 = 0;
	for (int i = 1; i < N; i += 2) {
		sum2 += A[i];
	}

	printf("%d", sum1 - sum2);


}

//---配列を降順ソート（だんだん小さくなる）----
void  bubbleSort(int number[], int length) {
	for (int i = 0; i < length; i++)
		for (int j = i + 1; j < length; j++)
			if (number[i] < number[j]) {
				int tmp = number[i];
				number[i] = number[j];
				number[j] = tmp;
			}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
void dfs(vector<ll> vc[],ll i,ll fl[]){
	fl[i]=1;

	ll j;
	for(j=0;j<vc[i].size();j++){
		if(fl[vc[i][j]]==0){
			dfs(vc,vc[i][j],fl);
			break;
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l;
	vector<ll> vc[5];
	for(i=1;i<=3;i++){
		cin>>k>>l;
		vc[k].ps(l);
		vc[l].ps(k);
	}
	
	ll fl[5]={0};
	dfs(vc,1,fl);
	int f=1;
	for(i=1;i<=4;i++){
		if(fl[i]==0){
			f=0;
			break;
		}
	}
	if(f==1){
		cout<<"YES";
	}
	else cout<<"NO";
	return 0;
}
//ctrl H replace

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())

//最大公約数
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;
}
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

int strsum(const int n){
    string s = to_string(n);
    int b(0);
    rep(i,s.size()){
        b += s[i]-'0';
    }
    return b;
}

int main(){
    int n,k;
    string s;
    cin >> n >> s >> k;
    char t = s[k-1];

    rep(i,n){
        if(s[i]!=t) cout << "*";
        else    cout << t;
    }
    cout  << endl;
    return 0;
}

Measured memory_bytes: 256