akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  long int suuretu[n],sum=0;
  int i,j=0;
  
  for(i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0){
      suuretu[j]=i;
      j++;
    }
  }
  for(i=0;i<j;i++)
    sum=sum+suuretu[i];
  printf("%ld",sum);
}

Measured memory_bytes: 5888
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for (int i = 1; i < 7; i++) {
            int pow = (int) Math.pow(2, i);
            if (N == pow) {
                int ans = (int) Math.pow(2, i);
                System.out.println(ans);
                return;
            } else if (N < pow) {
                int ans = (int) Math.pow(2, i - 1);
                System.out.println(ans);
                return;
            }
        }

        System.out.println(64);
    }
}

Measured memory_bytes: 23124
# -*- coding: utf-8 -*-
import sys
from itertools import permutations
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    l=[[] for _ in range(N+1)]
    l[0]=[('a',ord('a'))]
    for i in range(N-1):
        for a,z in l[i]:
            for j in range(ord('a'),z+2):
                l[i+1].append((a+chr(j),max(z,j)))
    l.sort()
    for a,z in l[N]:
        print(''.join(a))

if __name__ == '__main__':
    main()


Measured memory_bytes: 68572
#include<bits/stdc++.h>
using namespace std;
int a;
bool b=true;
string A;
int main(){
  cin>>A;
  a=A.size();
  for(int i=0;i<a;i++){
    int c=A.at(i),d=A.at(a-i-1);
    if(c!=d)b=false;
  }
  for(int i=0;i<(a-1)/2;i++){
    int c=A.at(i),d=A.at((a-1)/2-i-1);
    if(c!=d)b=false;
  }
  for(int i=0;i<a+1-(a+3)/2;i++){
    int c=A.at((a+3)/2+i-1),d=A.at(a-i-1);
    if(c!=d)b=false;
  }
  if(b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

class ORDER {
public:
	int N;
	void CARD() {
		cin >> N;
		vector<int> a(N);
		for (int i = 0; i < N; i++) {
			cin >> a[i];
		}
		sort(a.begin(), a.end(), greater<int>());
		int temp_ALICE = 0;
		int temp_BOB = 0;
		for (int i = 0; i < N; i++) {
			if (i % 2 == 0) {
				temp_ALICE += a[i];
			}
			else {
				temp_BOB += a[i];
			}
		}
		cout << temp_ALICE - temp_BOB << endl;
	}
};

int main() {
	ORDER x;
	x.CARD();
	return 0;
}

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

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
          int[] a = ReadLine().Split(' ').Select(int.Parse).ToArray();

          if(a[0] == a[1]){
              if(a[1] == a[2]){
                  WriteLine("No");
                  return;
              }else{
                  WriteLine("Yes");
                  return;
              }
          }else{
              if(a[1] == a[2]){
                  WriteLine("Yes");
                  return;
              }else{
                  if(a[0] == a[2]){
                      WriteLine("Yes");
                      return;
                  }
                  WriteLine("No");
                  return;
              }
          }
      }
   }
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <deque>
#include <functional>
#include <initializer_list>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

void VintOut(std::vector<int>& A){
    const int n = A.size();
    if(n == 0){putchar('\n'); return;}
    printf("%d", A[0]);
    for(int i = 1; i < n; ++i) printf(" %d", A[i]);
    putchar('\n');
}
void VintOut(std::vector<long long int>& A){
    const int n = A.size();
    if(n == 0){ putchar('\n'); return;}
    printf("%lld", A[0]);
    for(int i = 1; i < n; ++i) printf(" %lld", A[i]);
    putchar('\n');
}

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

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

inline bool bitUP(int state, int k){ return (state >> k) & 1; }
inline bool bitUP(long long int state, int k){ return (state >> k) & 1;}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


constexpr int mod = 1e9 + 7;

// 累乗の余りを求める関数
inline lli power_mod(lli a, lli n, lli mod_number___ = mod){
    lli res = 1LL, waiting = a;
    while(n != 0LL){ if((n & 1LL) != 0LL){ res *= waiting; res %= mod_number___;}
        waiting *= waiting; waiting %= mod_number___; n >>= 1; }
    return res;
}

std::vector<lli> A;

int main(void){
    int n; scanf("%d", &n);
    A.resize(n); REP(i, n) scanf("%lld", &A[i]);
    std::sort(A.begin(), A.end());
    lli res = 0;
    REP(i, n) (res += (n - i + 1) * A[i] % mod) %= mod;
    (res *= power_mod(2, 2 * n - 2)) %= mod;
    printf("%lld\n", res);



    
    


    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD 1000000007
#define INV_10 299473306
#define INF 1000000000
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int a, b, k;
	cin >> k >> a >> b ;
	for(int i = a; i <= b; i++)
	{
		if(i%k==0)
		{
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
}

Measured memory_bytes: 3652
/*****TEMPLATE*****/
      

#include <algorithm>
#include <array>
#include <bitset>
#include <cctype> 
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cstring>
#include <cstdio>
#include <stdio.h>
//INCLUDES
using namespace std;

#define lld long long int
#define ulld unsigned long long int
#define mod 1000000007
#define pb push_back
#define umap unordered_map
#define mp make_pair
#define fi first
#define se second 
#define rep(n) for(int i=0;i<n;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//DEFINES

lld gcd(lld a,lld b){ if(a<b) { a=a+b; b=a-b; a=a-b;}while(b!=0){lld r=a%b; a=b; b=r;} return a;}
lld bs(lld arr[], lld l, lld r, lld x) { if (r >= l) {  lld mid = l + (r - l) / 2;  if (arr[mid] == x)  return mid; if (arr[mid] > x)  return bs(arr, l, mid - 1, x);  return bs(arr, mid + 1, r, x);  }  return -1; }
lld mypower(lld x, lld n){	if (n == 0)	return 1;	if (n & 1) 	return (((x * mypower(x, n / 2))%mod) * (mypower(x, n / 2)%mod)%mod);return (((mypower(x, n / 2))%mod) * (mypower(x, n / 2)%mod))%mod;}
lld modinv(lld a) { lld g = gcd(a, mod); if (g != 1) return -1;else{  return mypower(a, mod-2)%mod; } } 

lld dp[1000001]={};
lld vis[1000001]={};

void dfs(vector <vector <lld>> &adj,lld src)
{
    vis[src]=1;
    for (int i = 0; i < adj[src].size(); i++) {
        if(!vis[adj[src][i]])
        {
            dfs(adj,adj[src][i]);
            vis[adj[src][i]]=1;
            dp[src]=max(dp[adj[src][i]]+1,dp[src]);
        }
        else
        {
            dp[src]=max(dp[adj[src][i]]+1,dp[src]);
        }
    }
}

//FUNCTIONS
void solve()
{
    lld n,m;
    cin>>n>>m;
    vector <vector <lld>> adj(n+1);
    umap <lld,lld> mp;
    for (int i = 0; i < m; i++) {
        lld x,y;
        cin>>x>>y;
        adj[x].pb(y);
        mp[y]=1;
    }
    lld src=1;
    lld ans=-1;
    
    while(src<=n)
    {
        if(mp[src]==0)
        {
            
            vis[src]=1;
            
            dfs(adj,src);
            ans=max(dp[src],ans);
            
        }
        src++;
    }
    
    cout<<ans<<"\n";
    
    
    return;
}
int main() 
{
    fast
    solve();
    return 0;
}



Measured memory_bytes: 22236
#include <string>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <math.h>
 
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
 
	int x;
    int y = 0;
	cin >> x;
    vector<int> vec(x);
    for(int i=0; i<x;i++){
      cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    for(int i=0;i<x-1;i++){
      if(vec.at(i)==vec.at(i+1)){
        cout << "NO" << "\n";
        return 0;
      }
    }
    cout << "YES" << "\n";
  
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;




int main() {

	ll N;
	cin >> N;

	vector<long long> res;
	for (long long i = 1LL; i*i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
		}
	}
	
	cout << res[res.size()-1] -1 + N/res[res.size()-1]-1<< endl;

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define inf std::numeric_limits<double>::infinity()
#define DECI(n) fixed<<showpoint<<setprecision(n)
#define MOD 1000000007LL
#define FOR(i,start,end) for (int i=start;i<end;i++)
#define FORR(i,end,start) for(int i=end-1;i>start;i--)
#define INPUT(arr,n) FOR(i,0,n) cin>>arr[i];
#define INPUT2d(arr,n,k) FOR(i,0,n) FOR(j,0,k) cin>>arr[i][j];
#define SIZE 100005
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define SUM cout<<sum<<endl;
#define pr(x) cout<<x<<endl;
#define prs(x) cout<<x<<" ";
#define iii(i)      cin>>i
#define ooo(i)      cout<<i
#define sss         cout<<" "
#define nnn         cout<<"\n"/**
#define iii(i)      iii<<i
#define ooo(i)      ooo<<i
#define sss         ooo<<" "
#define nnn         ooo<<"\n"*/
#define ff          first
#define ss          second
#define psb         push_back


int main(){

string S;
cin>>S;
ll n=S.length();
if(S[n-1]=='s'){
	cout<<S<<"es"<<endl;
}
else if(S[n-1]!='s'){
	cout<<S<<"s"<<endl;
}


return 0;
}

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

vector<int> G[200000],cycle;
int used[200000],a[200000],nxt;

bool dfs(int v,int par){
	for(int to : G[v]){
		if(used[to] == par){
			cycle.push_back(v);
			return true;
		}else if(used[to] != -1) continue;
		used[to] = v;
		if(dfs(to,par)){
			cycle.push_back(v);
			return true;
		}
	}
	return false;
}
int calc(int v,int ext){
	if(a[v] != -1) return a[v];
	set<int> st;
	for(int to : G[v]){
		if(to == ext) continue;
		st.insert(calc(to,-1));
	}
	a[v] = 0;
	while(st.count(a[v])) a[v]++;
	if(v == cycle[0]){
		nxt = a[v] + 1;
		while(st.count(nxt)) nxt++;
	}
	return a[v];
}

int main(){
	int n,p[200000];
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> p[i];p[i]--;
		G[p[i]].push_back(i);
		used[i] = -1;
		a[i] = -1;
	}
	for(int i = 0;i < n;i++){
		if(used[i] == -1) {
			used[i] = i;
			dfs(i,i);
		}
	}
	bool flag = false;
	for(int i = 0;i < 2;i++){
		calc(cycle[0],cycle[cycle.size() - 1]);
		if(i) a[cycle[0]] = nxt;
		for(int j = 1;j < cycle.size();j++) calc(cycle[j],-1);
		int tmp = a[cycle[0]];
		a[cycle[0]] = -1;
		calc(cycle[0],-1);
		if(tmp == a[cycle[0]]) flag = true;
		for(int j = 0;j < n;j++) a[j] = -1;
	}
	if(flag) cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 21496
#include <iostream>

using namespace std;

string s;
long long ans = 0;

void dfs(int pos, long long prev_sum, long long continue_sum) {
    if (pos == s.size()) {
        ans += prev_sum + continue_sum;
        return;
    }
    // +する
    dfs(pos + 1, prev_sum + continue_sum, s[pos] - '0');
    // 付け加える
    dfs(pos + 1, prev_sum, continue_sum * 10 + (s[pos] - '0'));
    return;
}

int main() {
    cin >> s;
    dfs(1, 0, s[0] - '0');
    cout << ans;
    return 0;
}

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

/* // Ordered Set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define os_find(k) find_by_order(k)
#define os_order(k) order_of_key(k)
*/

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loop1(i,a,b) for(int i=a;i<=b;i++)
#define rloop(i,a,b) for(int i=a;i>b;i--)
#define rloop1(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define ncr(n,r) fact[n]*modInv(fact[r])*modInv(fact[n-r])
#define modInv(a) binExp(a,mod-2)
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) int x,y; f0(i,0,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define test int t;cin>>t;while(t--)

bool isPrime(int num){
    bool flag=true;
    for(int i = 2; i <=sqrt(num); i++) {
       if(num % i == 0) {
          flag = false;
          break;
       }
    }
    return flag;
}
int dp[100005][5];
int n;
int a[100005],b[100005],c[100005];
int func(int day,int task){
    if(dp[day][task]!=0){
        return dp[day][task];
    }
    else{
        if(day==n){
            if(task==1){
                return max(b[day],c[day]);
            }
            else if(task==2){
                 return max(b[day],c[day]);
            }
            else{
                  return max(b[day],c[day]);
            }
        }
             int maxx=0;
if(task==1){
    maxx=max(maxx,b[day]+func(day+1,2));
      maxx=max(maxx,c[day]+func(day+1,3));
}
else if(task==2){
     maxx=max(maxx,a[day]+func(day+1,1));
      maxx=max(maxx,c[day]+func(day+1,3));
}
else{
    maxx=max(maxx,a[day]+func(day+1,1));
    maxx=max(maxx,b[day]+func(day+1,2));
}
 dp[day][task]=maxx;
 return maxx;

    }

}
signed main()
{
cin>>n;
 for(int i=0;i<n;i++){
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
 }
 int maxx=0;
 maxx=max(a[0]+func(1,1),maxx);
  maxx=max(b[0]+func(1,2),maxx);
   maxx=max(c[0]+func(1,3),maxx);
 cout<<maxx;
}


Measured memory_bytes: 14444
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;

int main()
{
	double L;
	cin >> L;
	L /= 3;
	L = pow(L, 3);
	printf("%.12lf", L);
	return 0;
}

Measured memory_bytes: 512
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
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()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    cout<<(a+b+1)/2<<"\n";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#define INF 10000000000000000LL

using namespace std;

struct edge {int to; long long int cap; int rev;} ;

vector<edge> G[202];
int level[202];
int iter[202];

void add_edge(int from, int to, long long int cap){
	edge e;
	e.to=to, e.cap=cap, e.rev=G[to].size();
	G[from].push_back(e);
	e.to=from, e.cap=0, e.rev=G[from].size()-1;
	G[to].push_back(e);
}

void bfs(int s){
	memset(level, -1, sizeof(level));
	queue<int> que;
	level[s]=0;
	que.push(s);
	while(!que.empty()){
		int v=que.front();
		que.pop();
		for(int i=0; i<G[v].size(); i++){
			edge e=G[v][i];
			if(e.cap>0 && level[e.to]<0){
				level[e.to]=level[v]+1;
				que.push(e.to);
			}
		}
	}
}

long long int dfs(int v, int t, long long int f){
	if(v==t) return f;
	for(int &i=iter[v]; i<G[v].size(); i++){
		edge &e=G[v][i];
		if(e.cap>0 && level[v]<level[e.to]){
			long long int d=dfs(e.to, t, min(f, e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}

long long int max_flow(int s, int t){
	long long int flow=0;
	while(1){
		bfs(s);
		if(level[t]<0) return flow;
		memset(iter, 0, sizeof(iter));
		long long int f;
		while((f=dfs(s, t, INF))>0){
			flow+=f;
		}
	}
}

int main()
{
	int n;
  scanf("%d", &n);
  int a[101], b[101], c[101], d[101];
  for(int i=1; i<=n; i++){
    scanf("%d %d", &a[i], &b[i]);
  }
  for(int i=1; i<=n; i++){
    scanf("%d %d", &c[i], &d[i]);
  }
  for(int i=1; i<=n; i++){
    add_edge(0, i, 1);
  }
  for(int j=n+1; j<=2*n; j++){
    add_edge(j, 2*n+1, 1);
  }
  for(int i=1; i<=n;i++){
    for(int j=n+1; j<=2*n; j++){
      if(a[i]<c[j-n] && b[i]<d[j-n]) add_edge(i, j, 1);
    }
  }
  printf("%lld\n", max_flow(0, 2*n+1));
	return 0;
}


Measured memory_bytes: 512
mod = 1000000007

n = int(input())
s1 = input()
s2 = input()

if s1[0] == s2[0]:
    ans = 3
    now = 1
    flag = True
else:
    ans = 6
    now = 2
    flag = False

while now < n:
    if flag:
        if s1[now] == s2[now]:
            ans *= 2
            ans %= mod
            now += 1
            flag = True
        else:
            ans *= 2
            ans %= mod
            now += 2
            flag = False
    else:
        if s1[now] == s2[now]:
            now += 1
            flag = True
        else:
            ans *= 3
            ans %= mod
            now += 2
            flag = False

print(ans)

Measured memory_bytes: 61748
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>


using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }


constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s, t; cin >> s >> t;
	int res = inf;
	for (int st = 0; st + t.size() <= s.size(); st++) {
		int cnt = 0;
		for (int i = st; i < st + t.size(); i++) {
			if (s[i] != t[i - st]) cnt++;
		}
		chmin(res, cnt);
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/


const long long mod = 1e+7 ;
const int N = 1e5+5;
const double PI=acos(-1);


#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define fr(i,l,m) for(ll i=l;i<m;i++)
#define frr(i,l,m) for(int i=l;i>m;i--)
# define vii vector<int>
#define vll vector<ll>
#define vpr vector<pair<ll,ll> >
#define dbg(x) cout << #x << " is " << x << endl;
#define gcd(l,r) __gcd(l,r)
#define cd complex<double>
#define vcd vector<cd>
#define clr(x) memset(x,0,sizeof(x))
/*
pow(2,20)->1e6;
pow(2,30)->1e9;
stoll - string to ll;
string with space getline(cin, str);
*/
ll pwr(ll x,ll y, ll m);
ll mult(ll a,ll b,ll m);

////
ll a[N],dp[N];
///
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL),cout.tie(NULL);

int n,k;
cin>>n>>k;
fr(i,1,n+1){cin>>a[i];}

frr(i,n-1,0)
{
    dp[i]=INT_MAX;
    fr(j,1,k+1){
   if((i+j)<=n)dp[i]=min(dp[i+j]+abs(a[i+j]-a[i]),dp[i]);
    }
}
cout<<dp[1]<<endl;

return 0;

 }
 ////
 ////

ll pwr(ll x,ll y,ll m)
{ll ans=1;x=x%m;while(y){if(y&1)ans=(x*(ans%m))%m;x=(x*x)%m;y>>=1;}
return ans%mod;}
////
////
ll mult(ll x,ll y, ll m){
    ll ans=0;
    while(y){if(y&1)ans=(ans+x)%m;
x=(x+x)%m;
y>>=1;}
return ans%m;}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdio.h>
#include <cmath>
using namespace std;

typedef long long ll;

#define min(a, b) (((a) < (b))? (a):(b))
#define max(a, b) (((a) > (b))? (a):(b))
#define REP(i, a, n) for(int i=(a); i<(n); i++)
#define rep(i, n) REP(i, 0, (n))
#define square(a) (a)*(a)
#define pb push_back

int n,k;
int main(){
    cin >> n;
    cin >> k;
    int j = 1;
    rep(i,n){
        if(j>=k)j+=k;
        if(j<k)j =2*j;
    }
    cout << j << endl;
}


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

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

void solve(long long N, std::vector<long long> A, std::vector<long long> B) {
    vector<long long> as, bs;
    rep (i, N) {
        as.emplace_back(A[i]);
        bs.emplace_back(B[i]);
    }

    sort(as.begin(), as.end());
    sort(bs.rbegin(), bs.rend());

    if (N % 2 == 1) {
        long long med1 = as[N/2];
        long long med2 = bs[N/2];
        cout << med2 - med1 + 1 << endl;
    }
    else {
        long long med1 = (as[N/2] + as[N/2-1]);
        long long med2 = (bs[N/2] + bs[N/2-1]);
        cout << med2 - med1 + 1 << endl;
    }
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
        scanf("%lld", &B[i]);
    }
    solve(N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 9756
#include<iostream>
using namespace std;
int main(){
    
    int c1=0,c2=0,c3=0,c4=0,n;
    cin>>n;
    string ch;
    for(int i=0; i<n; i++)
    {
        cin>>ch;
        if(ch=="AC")
          c1++;
        else if(ch=="WA")
          c2++;
        else if(ch=="TLE")
          c3++;
        else if(ch=="RE")
          c4++;
    }
    cout<<"AC x "<<c1<<endl;
    cout<<"WA x "<<c2<<endl;
    cout<<"TLE x "<<c3<<endl;
    cout<<"RE x "<<c4<<endl;
    return 0;
}

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

using namespace std;

const int maxn = 22, mod = 1e9 + 7;
int a[maxn][maxn], dp[1 << maxn], n;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> a[i][j];

    dp[0] = 1;
    for (int mask = 1; mask < 1 << n; mask++)
    {
        int x = __builtin_popcount(mask) - 1;
        for (int i = 0; i < n; i++)
            if (mask >> i & 1)
            {
                if (a[i][x])
                    (dp[mask] += dp[mask ^ (1 << i)]) %= mod;
            }
    }

    cout << dp[(1 << n) - 1];

    return 0;
}


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

int main() {
    string S, T;
    int cnt = 0;
    while (cin >> S >> T) {
        for (int i = 0; i < S.size(); ++i) {
            if (S[i] != T[i]) cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3920
import sys
N, Q = map(int, input().split())
query = []
for i in range(Q):
    v, w = map(int, input().split())
    if v < w:
        v, w = w, v
    query.append((v - 1, w - 1))


def f(v, w):
    L = set()
    L.add(0)
    while w != 0:
        L.add(w)
        w = (w - 1) // N
    while v != 0:
        if v in L:
            return v + 1
        v = (v - 1) // N
    return 1

if N==1:
    for v, w in query:
        print(w+1)
    sys.exit()
for v, w in query:
    print(f(v, w))

Measured memory_bytes: 65240
#include<bits/stdc++.h>
using namespace std;
 
int len,p;
string S;
bool flag;
 
int compute();
 
int getNum(){
  if(p>=len){
    flag=true;
    return 0;
  }
   
  if(S[p]=='-'){
    p++;
    return -getNum();
  }else if(S[p]=='0'){
    p++;
    return 0;
  }else if(S[p]=='1'){
    int res=0;
    while(p<len && (S[p]=='0'||S[p]=='1') ){
      res*=2;
      res+=(S[p]-'0');
      p++;
    }
    return res;
  }else if(S[p]=='('){
    p++;
    int res=compute();
    if(S[p-1]!=')')flag=true;
    return res;
  }else{
    flag=true;
    return 0;
  }
}
 
int compute(){
  if(p>=len){
    flag=true;
    return 0;
  }
   
  stack<int> st;
  st.push( getNum() );
   
  while(p<len){
    char ch=S[p];p++;
    if(ch==')')break;
 
    int num=getNum();
    if(ch=='+'){
      st.push(num);
    }else if(ch=='-'){
      st.push(-num);
    }else if(ch=='*'){
      int x=st.top();
      st.pop();
      st.push(x*num);
    }else{
      flag=true;
      break;
    }
  }
  int res=0;
  while(st.size()>0){
    res+=st.top();
    st.pop();
  }
  return res;
}
 
int check(string str){
 
  string le,ri;
   
  int cnt=0,index;
  for(int i=0;i<(int)str.size();i++)
    if(str[i]=='=')cnt++, index=i;
 
   
  if(cnt!=1)return 0;
  if(index==0 || index+1==(int)str.size())return 0;
 
   
  flag=false;
  S=str.substr(0,index);
  p=0;
  len=S.size();
  le=S;
  int lv=compute();
  int ca=0,cb=0;
   
  for(int i=0;i<S.size();i++)
    if(S[i]=='(')ca++;
    else if(S[i]==')')cb++;
  if( ca!=cb || flag || p<len)return 0;
   
  flag=false;
  S=str.substr(index+1);
  ri=S;
  p=0;
  len=S.size();
  int rv=compute();
  ca=0,cb=0;
  for(int i=0;i<S.size();i++)
    if(S[i]=='(')ca++;
    else if(S[i]==')')cb++;
  if( ca!=cb || flag || p<len)return 0;
 
   
  if(lv==rv){
    //    cout<<le<<' '<<ri<<endl;
    return 1;
  }else return 0;
}
 
 
int solve(string str){
 
  string tmp="01+-*()=";
  sort(tmp.begin(),tmp.end());
   
  map<string,bool> used;
  int res=0;
  do{
    map<char,char> mp;
    string s=str;
    for(int i=0;i<(int)s.size();i++){
      if( ('A'<=s[i]&&s[i]<='Z') || ('a'<=s[i]&&s[i]<='z') ){
        if(mp.count( s[i] )>0){
          s[i]=mp[ s[i] ];
        }else{
          int id=mp.size();
          mp[ s[i] ]=tmp[id];
          s[i]=tmp[id];
        }
      }
    }
    if(!used[s]){
      used[s]=true;
      res+=check(s);
    }
  }while(next_permutation(tmp.begin(),tmp.end()));
    return res;
}
 
int main(){
  string str;
  cin>>str;
  cout<<solve(str)<<endl;
  return 0;
}

Measured memory_bytes: 8348
#define DINGER_GISBAR
#include <bits/stdc++.h>
using namespace std;
const long long MOD = static_cast<int>(1e9) + 7;
//{{{TEMPLATE_BEGIN
#include <unistd.h>
using namespace std::rel_ops;
#ifdef ZEROKUGI
#include <dumper.hpp>
#define dump(x) dumper::dumper(cerr, __LINE__, (#x), (x), 50, 1, 1)
#define tick(...) dumper::tick(__VA_ARGS__)
#pragma message "Compiling " __FILE__
#else
#define dump(x)
#define tick(...)
#endif
typedef long long lint;
typedef unsigned long long ulint;
typedef long double ldouble;
typedef vector<int> vint;
#define rep(i, n) \
    for (int i = 0, i##_len = static_cast<int>(n); i < i##_len; i++)
#define all(c) begin(c), end(c)
#define perm(c)   \
    sort(all(c)); \
    for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))
#define uniquenize(v) (v).erase(unique(all(v)), end(v))
#define cauto const auto &
#define memset(x, y) memset(x, y, sizeof(x))
#define popcount __builtin_popcount
#define gcd __gcd
inline lint bit(int x) { return 1LL << x; }
template <class T>
inline int size(const T& a) {
    return (int)a.size();
}
template <class T>
inline bool chmin(T& a, const T& b) {
    return a > b ? a = b, 1 : 0;
}
template <class T>
inline int clamp(T v, T lo, T hi) {
    return (v > hi) - (v < lo);
}
template <class T>
inline bool chmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0;
}
template <class T>
inline pair<vector<T>, char> operator*(const vector<T>& v, const char& c) {
    return make_pair(v, c);
}
template <class T>
inline istream& operator>>(istream& is, vector<T>& v) {
#ifdef ZEROKUGI
    if (v.empty()) {
        cerr << "Error L" << __LINE__ << ": vector size is zero." << endl;
        exit(EXIT_FAILURE);
    }
#endif
    for (auto& x : v) is >> x;
    return is;
}
template <class T>
inline ostream& operator<<(ostream& os, const pair<vector<T>, char>& v) {
    bool t = 0;
    for (const T& x : v.first) {
        if (t) os << v.second;
        os << x;
        t = 1;
    }
    return os;
}
template <class T>
inline ostream& operator<<(ostream& os, vector<T>& v) {
    return os << v * ' ';
}
struct before_main {
    before_main() {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
        tick(0, 0);
    };
} __before_main;
//}}}TEMPLATE_END

int main() {
    string s;
    cin >> s;
    uniquenize(s);
    cout << s.size() - 1 << endl;
}



Measured memory_bytes: 512
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
vector<int> primes;
map<vector<int>,int> table;

long long exp(long long b,long long e,long long p){
	long long ret = 1;
	while(e>0){
		if((e&1)!=0){
			ret = (ret*b)%p;
		}
		b = (b*b)%p;
		e>>=1;
	}
	return ret%p;
}

bool fermat(long long p){
	if(p<=1)return false;
	if(p!=2 && p%2==0)return false;
	if(p!=3 && p%3==0)return false;
	if(p!=5 && p%5==0)return false;
	if(p!=7 && p%7==0)return false;
	if(p!=11 && p%11==0)return false;
	if(p!=13 && p%13==0)return false;
	for(int x=0;x<100;++x){
		long long a = rand()%(p-1)+1;
		if(exp(a,p-1,p)!=1)return false;
	}
	return true;
}

bool triangle(int a,int b,int c){
	return a+b>c && a+c>b && b+c>a;
}

int main(){
	primes.clear();
	for(int x=2;x<30005;++x){
		if(fermat(x))primes.push_back(x);
	}
	int n;
	while(scanf("%d",&n)==1,n){
		table.clear();
		int s = 0;
		for(int x=0;x<primes.size();++x){
			if(primes[x]>n)break;
			for(int y=x;y<primes.size();++y){
				if(primes[x]+primes[y]>=n)break;
				int w = n - primes[x] - primes[y];
				bool t = triangle(w,primes[x],primes[y]);
				if(t && binary_search(primes.begin(),primes.end(),w)){
					vector<int> tmp;
					tmp.push_back(primes[x]);
					tmp.push_back(primes[y]);
					tmp.push_back(w);
					sort(tmp.begin(),tmp.end());
					table[tmp]++;
				}
			}
		}
		cout<<table.size()<<endl;
	}
	return 0;
}	

Measured memory_bytes: 7540
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
//using ll = long long;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
bool isprime[1000009];
void Eratosthenes(){
    for(int i = 2; i <= 1000001; i++){
        isprime[0] = false;
        isprime[1] = false;
        if (isprime[i] == 1){
            for(int j = i*2; j < 1000001; j += i){
                isprime[j] = false;
            }
        }
    }
}
int main(){
    vector<int> ans(0);
    fill(isprime,isprime+1000009,true);
    Eratosthenes();
    for(;;){
        int a,b,n; cin >> a >> b >> n;
        if (a == 0 && b == 0 && n == 0) break;
        int cnt = 0,num = a;
        while(cnt < n){
            if (isprime[num]){
                cnt++;
                if (cnt == n){
                    ans.push_back(num);
                }
            }
            num += b;
        }
    }
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }
}
  




Measured memory_bytes: 3988
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int ans = gcd(x, y);
        System.out.println(ans);
        sc.close();

    }

    private static int gcd(int x, int y) {

        if(x == 0 || y == 0) return 0;
        int t;
        if(y > x){
            t = y;
            y = x;
            x = t;
        }
        while((t = x % y) != 0 ){
            x = y;
            y = t;
        }
        return y;
    }

}



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

int main(){
	int x, y, p, pt;
	string str;
	int field[10][10];
	int res_M, res_zero;
	
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			field[i][j] = 0;
		}
	}
	
	while(getline(cin, str)){
		x = 0; y = 0; p = 0;
		pt = 0;
		
		while(pt < str.size() && str[pt] != ','){
			x = x * 10 + (str[pt] - 48);
			pt++;
		}
		pt++;
		while(pt < str.size() && str[pt] != ','){
			y = y * 10 + (str[pt] - 48);
			pt++;
		}
		pt++;
		while(pt < str.size() && str[pt] != ','){
			p = p * 10 + (str[pt] - 48);
			pt++;
		}
		
		//1st
		field[y][x]++;
		if(y > 0) field[y - 1][x]++;
		if(x > 0) field[y][x - 1]++;
		if(y + 1 < 10) field[y + 1][x]++;
		if(x + 1 < 10) field[y][x + 1]++;
		p--;
		if(p > 0){
			//2nd
			if(x > 0 && y > 0) field[y - 1][x - 1]++;
			if(x + 1 < 10 && y > 0) field[y - 1][x + 1]++;
			if(x > 0 && y + 1 < 10) field[y + 1][x - 1]++;
			if(x + 1 < 10 && y + 1 < 10) field[y + 1][x + 1]++;
			p--;
		}
		if(p > 0){
			//3rd
			if(x - 2 >= 0) field[y][x - 2]++;
			if(x + 2 < 10) field[y][x + 2]++;
			if(y + 2 < 10) field[y + 2][x]++;
			if(y - 2 >= 0) field[y - 2][x]++;
		}
	}
	
	res_M = 0; res_zero = 0;
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			if(field[i][j] == 0) res_zero++;
			else res_M = max(res_M, field[i][j]);
		}
	}
	
	cout << res_zero << endl << res_M << endl;
	
	return 0;
}

Measured memory_bytes: 1176
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

N = _I()

ans = (N)** 3
print(ans)


Measured memory_bytes: 80440
#include<iostream>

int main()
{
	int a,b;
  std::cin >> a >> b;
  for(int i = 1;i <= 3;i++){
    if(a * b * i % 2 == 1){
      std::cout << "Yes";
      return 0;
    }
  }
  
  std::cout << "No";
}

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

using namespace std;

int main(){
    int A, B, C, X;
    cin >> A;
    cin >> B;
    cin >> C;
    cin >> X;
    
    int ans=0;
    for(int a=0; a<(A+1); a++){
        for(int b=0; b<(B+1); b++){
            for(int c=0; c<(C+1); c++){
                int sum = 500*a + 100*b + 50*c;
                if(sum == X){
                    ans++;
                }
            }
        }
    }
    
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    d = [int(i) for i in input().split()]

    s = 0
    for i in range(n):
        for j in range(i):
            s += d[i] * d[j]

    print(s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

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

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}


int main() {

   int n ;
   cin >> n ;

   int cnt = 0 ;
   while( n ){
     cnt += n % 10 == 1 ;
     n /= 10 ;
   }
   cout << cnt ;

   return 0 ;
}



Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val argList = Scanner(System.`in`)

    val r = argList.nextInt()

    val e = Dodecagon()
    println(e.execute(r))

}

class Dodecagon {
    fun execute(r: Int): Int {
        return 3 * r * r
    }
}

Measured memory_bytes: 31396
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	long long N, M, K;
	cin >> N >> M >> K;

	vector<long long> A(N + 1, 0);
	for (int i = 1; i <= N; i++)
	{
		cin >> A[i];
		A[i] += A[i - 1];
	}

	vector<long long> B(M + 1, 0);
	for (int i = 1; i <= M; i++)
	{
		cin >> B[i];
		B[i] += B[i - 1];
	}

	int result = 0;
	int j = M;
	for (int i = 0; i <= N; i++)
	{
		if (A[i] > K) break;

		while (A[i] + B[j] > K) j--;

		result = max(result, i + j);
	}

	cout << result;
	
	return 0;
}


Measured memory_bytes: 6328
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	string N;
	cin >> N;
	if(N[0] == N[2]){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

using ll = long long;
const ll MOD = 998244353;
const ll INF = 1e18;

int main() {
    int N;
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N));
    vector<vector<int>> d(N, vector<int>(N));
    vector<vector<int>> r(0, vector<int>(3));
    rep(i, N) rep(j, N) {
        cin >> A[i][j];
        d[i][j] = A[i][j];
        r.push_back({A[i][j], i, j});
    }
    rep(k, N) rep(i, N) rep(j, N) {
        int x = d[i][k] + d[k][j];
        if (x < d[i][j]) {
            d[i][j] = x;
            d[j][i] = x;
        }
    }
    ll ans = 0;
    rep (i, N * N) {
        int x = r[i][1], y = r[i][2], z = r[i][0];
        if (x == y) continue;
        if (A[x][y] > d[x][y]) {
            cout << -1 << endl;
            return 0;
        }
        bool f = true;
        rep(j, N) {
            if (j == x || j == y) continue;
            if (d[x][j] + d[j][y] == A[x][y]) {
                f = false;
                break;
            }
        }
        if (f) ans += A[x][y];
    }
    cout << ans / 2 << endl;
}

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

int main(){
  int h, n; cin >> h >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
  	cin >> a[i];
  	h -= a[i];
  }
  
  if(h <= 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
from itertools import groupby

def solve():
    S = input()
    K = int(input())
    a = [len(tuple(s)) for _, s in groupby(S)]
    
    if S[0] == S[-1] and K > 1:
        if len(a) == 1:
            return a[0] * K // 2
        else:
            ans = a[0] // 2 + a[-1] // 2 + (a[0]+a[-1]) // 2 * (K-1)
            ans += sum(n // 2 for n in a[1:-1]) * K
            return ans
    else:
        return sum(n // 2 for n in a) * K
    
print(solve())

Measured memory_bytes: 3064
// Problem: D - An Invisible Hand
// Contest: AtCoder - AtCoder Regular Contest 063
// URL: https://atcoder.jp/contests/arc063/tasks/arc063_b
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 1e6 + 1;

int n, t;
int a[N];

int32_t main() { cin.tie(0)->sync_with_stdio(0);
  cin >> n >> t;
  set<int> s;
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (!s.empty()) {
      mx = max(mx, a[i] - *s.begin());
    }
    s.insert(a[i]);
  }
  s.clear();
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!s.empty() && mx == a[i] - *s.begin()) {
      ans++;
    }
    s.insert(a[i]);
  }
  cout << ans;
}

Measured memory_bytes: 8720
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();

			int ans = 1;
			for (int i = 0; i < 3;i++)
				ans *=N;


			System.out.println(ans);
		}

	}
}


Measured memory_bytes: 22612
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
#include <cstdlib>
#include <cctype>
#include <random>

using namespace std;

int main() {
    int n[4]={0,0,0,0};
    int l, sw=0;
    for (int i=0; i<4; i++) {
        cin >> l;
        if (l == 1) n[0]++;
        else if (l == 7) n[1]++;
        else if (l == 9) n[2]++;
        else if (l == 4) n[3]++;
    }
    for (int i=0; i<4; i++) {
        if (n[i] == 1) sw++;
    }

    if (sw == 4) cout << "YES" << endl;
    else cout << "NO" << endl;



    return 0;
}


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n, c=0;
    cin>> n;
    int a[n];

    for(int i=0; i<n; i++)
        cin>> a[i];

    for(int i=1; i<n-1; i++)
    {
        if( (a[i]> a[i-1]&& a[i]< a[i+1]) || (a[i]> a[i+1]&& a[i]< a[i-1]))
            c++;
    }

    cout << c;
    nl;

    return 0;
}




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

using namespace std;

typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int X;
    cin >> X;
    int ret = 0;
    int q = X / 500;
    ret += q * 1000;
    X -= q * 500;
    q = X / 5;
    ret += q * 5;
    cout << ret<< endl;

    

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
//言語は「C++14(GCC 5.4.1)」
//AtCoder Beginner Contest 45-A

int main(void)
{
	int A, B, C;
	scanf("%d", &A);
	scanf("%d", &B);
	C = A + B;
	if (C >= 24)
		C = C - 24;
	printf("%d", C);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
int main(){
    ll n,check,ans=0;
    cin >> n;
    bool P[n];
    RAP(i, n){
        cin >> check;
        if(check==i+1){
            P[i] = false;
        }else{
            P[i] = true;
        }
    }
    RAP(i, n){
        if(P[i]==false){
            if(i!=(n-1) && P[i+1]==false){
                P[i+1] = true;
            }
          	ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384