akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       (s.find(x) != s.end())

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 4e5+5;
const ll mod = 1e9+7;


ll n;
ll a[SZ];
ll pgc[SZ], sgc[SZ];



int main() {
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
//    ll a, b, d;
    string s, s1, s2;

    cin1(n);
    for1(i, n) cin1(a[i]);

    for1(i, n) pgc[i] = __gcd(pgc[i-1], a[i]);
    forb(i, n, 1) sgc[i] = __gcd(sgc[i+1], a[i]);

    for1(i, n) {
        ans = max(ans, __gcd(pgc[i-1], sgc[i+1]));
    }
    cot1(ans);

    return 0;
}



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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int a,b,n,m,c[maxn],id[maxn];
char s[maxn];

int cmp(int a,int b) {return c[a]>c[b];}

int main() {
    read(n),read(m),read(a),read(b);
    if(a*2>m||b*2>n) return puts("-1"),0;
    int px=-1,py;
    for(int i=0;i<=n;i++)
        for(int j=0;j<=m;j++)
            if(a*i+(m-a)*(n-i)==b*j+(n-b)*(m-j)) px=i,py=j;
    if(px==-1) return puts("-1"),0;
    // printf("%d %d\n",px,py);
    for(int i=1;i<=m;i++) if(i<=py) c[i]=b;else c[i]=n-b;
    for(int i=1;i<=n;i++) {
        int cnt;
        if(i<=px) cnt=a;
        else cnt=m-a;
        for(int j=1;j<=m;j++) id[j]=j;
        sort(id+1,id+m+1,cmp);
        for(int j=1;j<=m;j++) {
            int t=id[j];
            if(!c[t]) s[t]='0';
            else if(cnt) s[t]='1',cnt--,c[t]--;
            else s[t]='0';
        }puts(s+1);
    }
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int N=1000005;
string s[N];
map<string,long long >mp;
int main(){
	int n;
	int t;
	scanf("%d",&n);
	mp.clear();
	for(int i=0;i<n;++i){
		cin>>s[i];
	//	cout<<s[i]<<endl;
		sort(s[i].begin() ,s[i].end() );
	//	cout<<s[i]<<endl;
		mp[s[i]]++;
	}
	map<string,long  long>::iterator it;
	long long  ans=0;
	for(it=mp.begin();it!=mp.end();++it){
		if(it->second>1){
			ans+=(it->second*(it->second-1))/2;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 25216
N,T=map(int,input().split())
c=[None]*N
t=[None]*N
okCost=[None]*N
for i in range(N):
    c[i],t[i]=map(int,input().split())
    if t[i]<=T:
      okCost[i]=c[i]
okCost=[x for x in okCost if x is not None]
if okCost==[]:
    print("TLE")
else:
    print(min(okCost))

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

typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
const double pi = 3.141592653589793238;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

void printV(vector<int> &v);
void printVV(vector<vector<int>> &vv);


int main() {
  string S;
  cin >> S;

  int N = S.size();
  string T = S;
  reverse(S.begin(), S.end());
  // cout << "S:" << S << endl;
  // cout << "T:" << T << endl;

  string a = T.substr(0, (N-1)/2);
  string b = a;
  reverse(a.begin(), a.end());
  // cout << "a:" << a << endl;
  // cout << "b:" << b << endl;

  string c = T.substr(((N+3)/2)-1);
  string d = c;
  reverse(c.begin(), c.end());

  // cout << "c:" << c << endl;
  // cout << "d:" << d << endl;

  if(S != T) { // 回文でなければ終了
    cout << "No" << endl;
    return 0;
  }

  if(a != b) { // 回文でなければ終了
    cout << "No" << endl;
    return 0;
  }

  if(c != d) { // 回文でなければ終了
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;

}


// ベクターの中身を全部出力
void printV(vector<int> &v) {
  cout << "  [ ";
  for(int i = 0; i < (int)v.size(); i++) {
    cout << v.at(i) << " ";
  }
  cout << "]" << endl;
}

void printVV(vector<vector<int>> &vv) {
  cout << "{" << endl;
  for(int i = 0; i < (int)vv.size(); i++) {
    cout << "  [ ";
    for(int j = 0; j < (int)vv.at(i).size(); j++) {
      cout << vv.at(i).at(j) << " ";
    }
    cout << "]," << endl;
  }
  cout << "}" << endl;
}

// 連想配列の中身を全部出力
// void printM(vector<int> &v) {
//   cout << "  [ ";
//   for(int i = 0; i < (int)v.size(); i++) {
//     cout << v.at(i) << " ";
//   }
//   cout << "]" << endl;
// }
//
// void printMM(vector<vector<int>> &vv) {
//   cout << "{" << endl;
//   for(int i = 0; i < (int)vv.size(); i++) {
//     cout << "  [ ";
//     for(int j = 0; j < (int)vv.at(i).size(); j++) {
//       cout << vv.at(i).at(j) << " ";
//     }
//     cout << "]," << endl;
//   }
//   cout << "}" << endl;
// }


Measured memory_bytes: 256
// clang-format

#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;

using lli = long long int;

void solve(long long N, std::string S, std::string T) {
  rep(i,N){
    cout << S[i] << T[i];
  }
  cout << endl;
}

int main() {
  int a;
  long long N;
  scanf("%lld", &N);
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  solve(N, S, T);
  return 0;
}


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

using namespace std;

int main()
{
  string s;
  cin >> s;
  if(s == "Sunny")
  {
    cout << "Cloudy";
  }
  else if(s == "Cloudy")
  {
    cout << "Rainy";
  }
  else
  {
    cout << "Sunny";
  }

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

int main(int argc, char *argv[]) {
  // read inputs
  int A, B;
  scanf("%d %d", &A, &B);

  // solve
  char ans[100][100];
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      ans[i][j] = i < 50 ? '#' : '.';
    }
  }
  for (int k = 0; k < A - 1; k++) {
    const int i = 2 * (k / 50), j = 2 * (k % 50);
    ans[i][j] = '.';
  }
  for (int k = 0; k < B - 1; k++) {
    const int i = (100 - 1) - 2 * (k / 50), j = 2 * (k % 50);
    ans[i][j] = '#';
  }

  printf("100 100\n");
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      printf("%c", ans[i][j]);
    }
    printf("\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N, M;
  cin >> N >> M;
  vll A(N);
  ll sum = 0;
  priority_queue<ll> que;
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    sum += A.at(i);
    que.push(A.at(i));
  }
  ll x;
  for(int i = 0; i < M; i++){
    x = que.top();
    que.pop();
  }
  if(4 * M * x >= sum) cout << "Yes" << endl;
  else cout << "No" << endl;

}

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

namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var count = int.Parse(Console.ReadLine());
            var str = Console.ReadLine()
                .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(x => int.Parse(x))
                .OrderByDescending(x=> x)
                .ToList();
            var alice = 0;
            var unti = 0;
            for (int i = 0; i < count; i++)
            {
                if (i%2 == 0)
                {
                    alice += str[i];
                }
                else
                {
                    unti += str[i];
                }
            }
            Console.WriteLine(alice - unti);
            Console.ReadLine();
        }
    }

}

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

class Position {
 public:
  int index;
  int x;
  int y;
  double CalcDistance(Position p) {
    return sqrt((double)((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y)));
  }

  bool operator<(const Position& B) const { return index < B.index; }
  bool operator>(const Position& B) const { return index > B.index; }
  bool operator<=(const Position& B) const { return index <= B.index; }
  bool operator>=(const Position& B) const { return index >= B.index; }
};

int main() {
  int n;
  cin >> n;
  vector<Position> positions;
  for (int i = 0; i < n; i++) {
    Position position;
    position.index = i;
    cin >> position.x >> position.y;
    positions.push_back(position);
  }
  double cnt = 1.0;
  for (int i = n; i > 0; i--) {
    cnt *= (double)i;
  }

  double average_distance = 0.0;
  do {
    double distance = 0.0;
    for (auto itr = positions.begin(); itr != positions.end();) {
      Position pos_a = (*itr);
      itr++;
      if (itr == positions.end()) break;
      Position pos_b = (*itr);
      distance += pos_a.CalcDistance(pos_b);
    }
    average_distance += distance / cnt;
  } while (next_permutation(positions.begin(), positions.end()));
  printf("%10.10f\n", average_distance);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
int main(){
    int n;
    std::cin >> n;
    std::vector <int> v(n);
    std::vector <int> c(n);
    for(int i=0; i<n; ++i)  std::cin >> v[i];
    for(int i=0; i<n; ++i)  std::cin >> c[i];
    int ans = 0;
    for(int i=0; i<n; ++i)  ans += std::max((v[i]-c[i]),0);
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,d,r;
  double f;
  
  scanf("%d%d",&a,&b) ;

  d = a/b;
  r = a%b;
  f =(double)a/(double)b;
  printf("%d %d %.5lf\n",d,r,f);

  return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n,k; cin >> n >> k;
    VI x(n); REP(i,n) cin >> x[i];
    int ans = 0;
    REP(i,n) ans += min(x[i]*2,abs(k-x[i])*2);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n, a[100000];
ll s, _s, co;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    cin >> a[i];
  }
  ll ans = linf;
  FOR(j, 0, 2){
    s = 0;
    co = 0;
    FOR(i, 0, n){
      _s = s + a[i];
      if((i+j)%2){
        if(_s >= 0){
          co += _s + 1;
          s = -1;
        }else{
          s = _s;
        }
      }else{
        if(_s <= 0){
          co += 1 - _s;
          s = 1;
        }else{
          s = _s;
        }
      }
    }
    mins(ans, co);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>

using namespace std;

int main(){

	int a,b;
	vector<int> road[101];
	int cnt;

	while(cin>>a>>b){
		road[a].push_back(b);
		road[b].push_back(a);
		while(1){
			cin>>a>>b;
			if(a==0&&b==0) break;
			road[a].push_back(b);
			road[b].push_back(a);
		}

		cnt=0;
		for(int i=0;i<101;i++){
			if(road[i].size()%2==1) cnt++;
		}
		if(cnt==2&&road[1].size()%2==1&&road[2].size()%2==1) cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
		
		for(int i=0;i<101;i++){
			if(!road[i].empty()) road[i].clear();
		}
	}
 
}
 

Measured memory_bytes: 1208
// https://atcoder.jp/contests/abc104/tasks/abc104_c

#include <algorithm>
#include <cmath>
#include <iostream>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
//問題数、コンプリートボーナス、合計点
typedef tuple<int, int, int> mytuple;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d, g, ans = INF;
    vector<mytuple> v;
    cin >> d >> g;

    for (int i = 1; i <= d; i++) {
        int p, c;
        cin >> p >> c;
        v.push_back(make_tuple(p, c, i * p * 100 + c));
    }
    //ビット探索で完答する組み合わせを求めてから難易度の高い問題から解く
    for (uint32_t i = 0; i < (1UL << d); i++) {
        int sumAns = 0, sumScore = 0;
        for (int j = 0; j < d; j++) {
            //ビットマスクして合計点と回答数を計算
            if (i & (1UL << j)) {
                sumAns += get<0>(v[j]);
                sumScore += get<2>(v[j]);
                //目標をクリアしたら、回答数が少ない方に更新
                if (sumScore >= g) {
                    ans = min(ans, sumAns);
                    break;
                }
            }
        }
        // 指定した難易度の問題を全て解いても目標点未満なら
        // 残った問題の難易度の高いもの1つのみを目標点を超えるまで解く
        bool endF = true;
        for (int j = d - 1; j >= 0 && endF; j--) {
            // 残った問題なら1問を残して解いて目標点を超えるか判定
            int bMask = (i & (1UL << j));
            // cout << i << ":" << (1UL << j) << ":" << bMask << endl;
            if (bMask == 0) {
                endF = false;
                for (int k = 0; k < get<0>(v[j]) - 1; k++) {
                    sumAns++;
                    sumScore += (j + 1) * 100;
                    //目標をクリアしたら、回答数が少ない方に更新
                    if (sumScore >= g) {
                        ans = min(ans, sumAns);
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

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

  double sum = 0;
  for(int i = 0; i < n; ++i){
    sum += 1.0 / a[i];
  }
  double ans = 1.0 / sum;

  cout <<fixed;
  cout << setprecision(8);
  cout << ans << endl;
  return 0;
}


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

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define INF 9223372036854775807
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0;
string s;
bool flag;
#pragma endregion
#define MAX 111111


int main(void) {
  ll h, w;
  char c;
  cin >> h >> w;
  FOR(i, 0, h*w) {
	cin >> c;
	if (c == '#') cnt++;
  }
  if (cnt == h + w - 1) {
	cout << "Possible" << endl;
  }
  else {
	cout << "Impossible" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
# Problem https://atcoder.jp/contests/abc102/tasks/abc102_b
# Ruby 2nd Try
N = gets.chomp.to_i
Ai = gets.chomp.split(' ').map(&:to_i)
maxAi = 1
minAi = 10**9
answer = 0
for j in 0..(N-1) do
    if maxAi <= Ai[j]
        maxAi = Ai[j]
    end
    if Ai[j] <= minAi
        minAi = Ai[j]
    end
end
answer = (maxAi-minAi).abs
puts(answer)


Measured memory_bytes: 3836
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int s; cin>>s;
	set<int> st; st.insert(s);
	for(int i=2; ; i++){
		if(s&1){
			s=3*s+1;
		}else{
			s>>=1;
		}
		if(st.find(s)!=st.end()){
			cout<<i<<endl;
			return 0;
		}
		st.insert(s);
	}
	return 0;
}

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



int main() {
	//cout << fixed << setprecision(10);
	long long int a, b, c, d, n, m;
	cin >> n>>m;
	n++;
	if (n / 2 >= m) { cout << "YES"; }
	else {
		cout << "NO";
	}
}

Measured memory_bytes: 256
#include<stdio.h>


int main() {
	int n ;
	scanf("%d", &n);
	int count =  0 ;
	for (int i = 1 ; i < n ; i++) {
		if (n % i == 0) {
			count += ((n / i) - 1);
		}
		else {
			count += (n / i);
		}
	}
	printf("%d", count);
}

Measured memory_bytes: 1696
#include<stdio.h>

int main(){
    unsigned long long N, A, B;
	unsigned long long cnt = 0;

    //入力
	scanf("%lld %lld %lld", &N, &A, &B);
	
    cnt = (N/(A+B))*A;

    if((N % (A+B)) <= A){
        cnt = cnt + (N % (A+B));
    }else{
        cnt = cnt + A;
    }
    
    //結果出力
    printf("%lld", cnt);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main() {
	cin>>a>>b;  
	if (a == b){
		cout<<"Draw";
	}
	else{
		if (a == 1)cout<<"Alice";
		if (b == 1)cout<<"Bob";
		if (a!=1&&b!=1){
			if (a>b)cout<<"Alice";
			if (a<b)cout<<"Bob";
		}
	}
}

Measured memory_bytes: 256
import math
N=int(input())
risuto=list(map(int,input().split()))
ans=1
kari=0
if 0 in risuto:
    print(0)
else:
    for j in range(N):
        kari+=math.log10(risuto[j])

    if kari<18:
        for i in range(N):
            ans*=risuto[i]
        print(ans) 
    elif kari==18:
        for i in range(N):
            ans*=risuto[i]
        if ans>10**18:
            print(-1)
        else:
            print(ans)
    else:
        print(-1)


Measured memory_bytes: 22148
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main(){
 ll n,k ;cin>>n>>k ;
 vector<ll> A(n) ;rep(i,n) cin>>A[i] ;
 ll all = 0;
 rep(i,n) all+= A[i] ;
 vector<ll> div ;
 for(ll i=1;i*i<=all ;i++){
   if(all%i==0){
     div.pb(i) ;
     div.pb(all/i) ;
   }
 }
  ll ans=0 ;
  for(ll u :div){
   vector<ll> B(n) ;
   ll sum=0 ;
   rep(i,n){
   B[i]= A[i]%u  ;
   sum+= B[i] ; 
   }
  ll ko= sum/u ;
  sort(B.begin(),B.end()) ;
  ll rem=0 ;
  rep(i,n-ko){
  rem+=B[i] ;
  }
  if(rem<=k) chmax(ans,u) ;
  }
  cout<<ans<<endl ;
  return 0;
  }

Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

const int N = 100010;

int n, cnt;
long long sum1, sum2, ans;
int a[N], b[N], d[N];
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	int p = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] > b[i]) {
			sum1 += (a[i] - b[i]);
			d[++p] = (a[i] - b[i]);
		}
		if (a[i] < b[i]) {
			sum2 += (b[i] - a[i]);
			cnt++;
		}
	}
	if (!cnt) cout << 0 << endl;
	else if (sum1 < sum2) cout << -1 << endl;
	else {
		sort(d + 1, d + 1 + p);
		
		int i;
		for(i = p; i >= 1; i--){
			ans += d[i];
			if (ans >= sum2) break;
		}
		cout << cnt + p - i + 1 << endl;
	}
	
	return 0;
}

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

using i64 = int64_t;

constexpr i64 MOD = 1e9 + 7;

i64 dp[4][4][4][4][102]={0};

string acgt = "ACGT";

int main(){
    i64 n;
    cin >> n;
    if(n == 3){
        cout << 61 << endl;
        return 0;
    }


//    int cnt = 0;
    for(int c3=0;c3<4;++c3){
        for(int c2=0;c2<4;++c2){
            for(int c1=0;c1<4;++c1){
                if(acgt[c1] == 'A' && acgt[c2] == 'G' && acgt[c3] == 'C'
                    || acgt[c1] == 'G' && acgt[c2] == 'A' && acgt[c3] == 'C'
                    || acgt[c1] == 'A' && acgt[c2] == 'C' && acgt[c3] == 'G')continue;
                for(int c=0;c<4;++c){
                    if(acgt[c1] == 'A' && acgt[c3] == 'G' && acgt[c] == 'C'
                        || acgt[c1] == 'A' && acgt[c2] == 'G' && acgt[c] == 'C')continue;
                    if(acgt[c2] == 'A' && acgt[c3] == 'G' && acgt[c] == 'C'
                        || acgt[c2] == 'G' && acgt[c3] == 'A' && acgt[c] == 'C'
                        || acgt[c2] == 'A' && acgt[c3] == 'C' && acgt[c] == 'G')continue;
                    //cerr << acgt[c1] << acgt[c2] << acgt[c3] << acgt[c] << endl;
                    dp[c1][c2][c3][c][3] = 1;
                    //cnt++;
                }
            }
        }
    }

//    cout << "cnt:" << cnt << endl;


    for(int i=4;i<n;++i){
        for(int c=0;c<4;++c){
            for(int c3=0;c3<4;++c3){
                for(int c2=0;c2<4;++c2){
                    for(int c1=0;c1<4;++c1){
                        if(acgt[c2] == 'A' && acgt[c1] == 'G' && acgt[c] == 'C'
                            || acgt[c2] == 'G' && acgt[c1] == 'A' && acgt[c] == 'C'
                            || acgt[c2] == 'A' && acgt[c1] == 'C' && acgt[c] == 'G')continue;
                        if(acgt[c3] == 'A' && acgt[c1] == 'G' && acgt[c] == 'C'
                            || acgt[c3] == 'A' && acgt[c2] == 'G' && acgt[c] == 'C')continue;
                        for(int c4=0;c4<4;++c4){
                            dp[c3][c2][c1][c][i] += dp[c4][c3][c2][c1][i-1];
                            dp[c3][c2][c1][c][i] %= MOD;
                        }
                    }
                }
            }
        }
    }

    i64 ans = 0;
    for(int c3=0;c3<4;++c3){
        for(int c2=0;c2<4;++c2){
            for(int c1=0;c1<4;++c1){
                for(int c=0;c<4;++c){
                    ans += dp[c3][c2][c1][c][n-1];
                    ans %= MOD;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

typedef pair<long long, long long> P;
//typedef pair<string, long long> Q;
//typedef tuple<string, string, long long> P;
int main(){
    long long n;
    long long m;
    cin>>n>>m;
    vector<pair<P,long long>>v(m);
    rep(i,m){
        cin>>v[i].first.first>>v[i].first.second;
    }
    rep(i,m){
        v[i].second=i;
    }
    sort(v.begin(),v.end());
    vector<string> ans(m);
    long long j=1;
    rep(i,m){
        long long p=v[i].first.first;
        string zen = to_string(p);
        //cout<<zen.size()<<endl;
        while(6>zen.size()){
            zen="0"+zen;
        }
       
        if(i!=0){
            if(v[i-1].first.first==v[i].first.first){
            j++;
            }
            else{
                j=1;
            }
        }
        string bor= to_string(j);
        while(6>bor.size()){
            bor="0"+bor;
        }
        ans[v[i].second]=zen+bor;
    }
    rep(i,m){
        cout<<ans[i]<<endl;
    }
    
}


Measured memory_bytes: 9344
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	double a,b,c,d,e,f;
	while(cin >> a >> b >> c >> d >> e >> f){
		if(a == 0){
			swap(a,d);
			swap(b,e);
			swap(c,f);
		}
		b /= a;
		c /= a;
		a = 1;
		if(d != 0){
			e -= b*d;
			f -= c*d;
			d = 0;
		}
		f /= e;
		e = 1;
		c -= b*f;
		b = 0;
		printf("%.3f %.3f\n",c,f);
	}
}

Measured memory_bytes: 1236
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(string, S);
    IN(string, T);
    YES(T.substr(0, S.size()) == S);
}

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

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

	int n; cin >> n;
	string c; cin >> c;

	int cntW = 0;
	int cntR = 0;
	REP(i, n) {
		if (c[i] == 'W') cntW++;
		if (c[i] == 'R') cntR++;
	}
	string sub;
	if (n % 2 && n > 1)
		sub = c.substr(n - cntW);
	else
		sub = c.substr(n - cntW);
	// cout << sub << '\n';

	int cnt = 0;
	REP(i, (int)sub.size())
		if (sub[i] == 'R') cnt++;
	if (cntR == n) cnt = 0;
	cout << cnt << '\n';
	return 0;
}

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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; }

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


int main() {
    cout<<fixed<<setprecision(10);

    ll a,b,c,d; cin>>a>>b>>c>>d;
    cout<<max({a*c, a*d, b*c, b*d})<<endl;

    return 0;

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define N 101
#define M 51
using namespace std;
int n,m,l;
double p[N],t[N],d[N],mem[M][M];

double nCr(int n, int r){
  if(mem[n][r]!=0)return mem[n][r];
  double a=1;
  for(int i=0;i<r;i++) a*=(n-i)/(i+1.0);
  return mem[n][r]=a;
}

double DP(){
  double dp[N][M]={};
  for(int i=0;i<=m;i++)dp[0][i]=pow(1-p[0],m-i)*pow(p[0],i)*nCr(m,i);
  
  for(int i=1;i<n;i++)
    for(int j=0;j<=m;j++)
      for(int k=0;k<=m;k++)
	if(d[0]+j*t[0]<d[i]+k*t[i]) 
	  dp[i][j]+=dp[i-1][j]*pow(1-p[i],m-k)*pow(p[i],k)*nCr(m,k);

  double res=0;
  for(int i=0;i<=m;i++)res+=dp[n-1][i];
  return res;
}

int main(){
  cin>>n>>m>>l;
  for(int i=0;i<n;i++){
    cin>>p[i]>>t[i]>>d[i];
    p[i]/=100;
    d[i]=l/d[i];
  }
  
  for(int i=0;i<n;i++){
      printf("%.10f\n",DP());
      swap(p[0],p[i+1]);
      swap(t[0],t[i+1]);
      swap(d[0],d[i+1]);    
  }
  return 0;
}

Measured memory_bytes: 3552
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int a[110];
int main()
{
    int n,k,i,j,ans=0;
    scanf("%d%d",&n,&k);
    for(i=1; i<=n; i++)
        scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(i=n; i>n-k; i--)
        ans+=a[i];
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
i,a[10],b[10],h,g,c,x;
main(n)
{ 
  for(scanf("%d",&n);n--;puts(x?"NO":"YES"))
    {
      for(a[0]=b[0]=h=g=i=x=0;i++<10;)
	{
	  scanf("%d",&c);
	  if(x!=0)continue;
	  if(a[h]<c || b[g]<c)
	    {
	      if(a[h]<c && (a[h]>b[g] || b[g]>=c))
		a[++h]=c;
	      else
		b[++g]=c;
	    }
	  else x=-1;
	}
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define INF 2100000000
#define MOD 1000000007

bool dbgflag = false; //debug


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

  string c;
  cin >> c;
  cout << ((c[1] == 'B') ? "ARC" : "ABC") << endl;

}


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

vector<long> a;

int main() {
    int n;
    cin >> n;
    a.resize(n);
    
    rep(i, n) {
        cin >> a[i];
    }

    long ans = 0;
    rep(i, n) {
        if (i == 0) continue;
        if (a[i] < a[i-1]) {
            ans += a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
typedef std::pair<int, int> ipair;
#define int long long
#define pb push_back
#define ff first
#define INF INT_MAX
#define ss second
#define fr(i, j, a) for (int i = j; i < a; i++)
#define cnt_ones(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<ipair>
#define mod 1000000007
#define IOS                                                                    \
  std::ios::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
void init() {
  int n;
  cin >> n;
  vi a(n);
  for (int &i : a)
    cin >> i;
  int res = 0;
  for (int i = 1; i < n; i++) {
    if (a[i - 1] > a[i]) {
      res += a[i - 1] - a[i];
      a[i] = a[i - 1];
    }
  }
  cout << res << endl;
}

int32_t main() {
  IOS;
  init();
  return 0;
}

Measured memory_bytes: 4784
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<ll> H(N);
  rep(i,N) cin >> H[i];
  for(int i=1;i<N;i++){
    if(H[i-1] < H[i]){
      H[i]--;
    }
  }
  bool ans = true;
  for(int i=1;i<N;i++){
    if(H[i-1] > H[i]) ans = false;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main(){
    int c,r;
    cin >> r >> c;
    vector< vector< int > > a(r+1, vector< int >(c+1));
    for (int i=0; i<r;i++){
        for(int j=0;j<c;j++){
            cin >> a[i][j];
        }
    }
    for (int i=0; i<r+1;i++){
        for(int j=0;j<c+1;j++){
            if(j != c)a[i][c] += a[i][j];
            if(i != r)a[r][j] += a[i][j];
            if(i ==r && j == c) a[r][c]/=2;
            cout << a[i][j];
            if(j != c) cout << " ";
        }
        cout << endl;
    }
return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dy={1,0,-1,0};
vector<int> dx={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    string s;
    cin>>s;
    int n=sz(s);
    
    auto dp=make_vec<ll>(100010,2);
    dp[0][0]=1;
    
    rep(i,n) {
        rep(smaller,2) {
            int D = s[i]-'0';
            for(int d=0; d<=(smaller ? 1 : D); d++) {
                dp[i+1][smaller || (d<D)] += (dp[i][smaller] * (d==0 ? 1 : 2));
                dp[i+1][smaller || (d<D)] %= MOD;
            }
        }
    }
    
    cout<<(dp[n][0]+dp[n][1])%MOD<<endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    string S, T;
    cin >> S >> T;
    ll ans = INF;
    rep(i, sz(S)-sz(T)+1){
        ll tmp = 0;
        rep(j, sz(T)){
            if(T.at(j) != S.at(i+j)){
                tmp++;
            }
        }
        chmin(ans, tmp);
    }
    cout << ans << endl;
}

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

int main(){
    char w[101];
    int i, s, cnt[26];
    for(i=0;i<26;i++)cnt[i]=0;
    scanf("%s", w);
    s = strlen(w);
    for(i=0;i<s;i++)
    {
        cnt[w[i]-'a']++;
    }
    for(i=0;i<26;i++)
    {
        if(cnt[i]%2!=0)
        {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
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};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};

void dfs(const vector<vector<int> > &g, int now,int from,vector<ll> &weight){
    for (auto e : g[now]){
        if (e == from) continue;
        weight[e] += weight[now];
        dfs(g,e,now,weight);
    }
}


int main(){
    int N,Q; cin >> N >> Q;
    vector<vector<int> > g(N);
    vector<ll> weight(N,0);
    for (int i = 0; i < N-1; i++){
        int a,b; cin >> a >> b; a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i = 0; i < Q; i++){
        ll p,x; cin >> p >> x; p--;
        weight[p] += x;
    }
    for (auto e : g[0]){
        if (e == 0) continue;
        weight[e] += weight[0];
        dfs(g,e,0,weight);
    }
    for (auto e : weight){
        cout << e << " ";
    }
    cout << endl;
}

Measured memory_bytes: 30464
#include <iostream>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4]==s[5])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N;
	
	scanf("%d",&N);
	int p[N + 1];
	int i = 1;
	int ans = 0;
	int min;
	
	while(i <= N){
		scanf("%d",&p[i++]);
	}
	i = 1;
	min = p[1];
	while(i <= N){
		if(min >= p[i]){
			min = p[i];
			ans ++;
		}
		i++;
	}	
	printf("%d\n",ans);
}
	
	

Measured memory_bytes: 896
#include <iostream>
#include <cstring>

int main()
{
    int N, K;
    std::cin >> N >> K;
    auto sunuke_okasi = new bool[N];
    memset(sunuke_okasi, 1, sizeof(bool) * N);
    for(int i = 0; i < K; ++i) {
        int d;
        std::cin >> d;
        for(int j = 0; j < d; ++j) {
            int a;
            std::cin >> a;
            sunuke_okasi[a - 1] = 0;
        }
    }
    int count = 0;
    for(int i = 0; i < N; ++i) {
        count += sunuke_okasi[i];
    }
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
int main(){
	int l1,l2,l3,n,i,j,tmp;
	i=0;
	scanf("%d",&n);
	while(i<n){
		scanf("%d %d %d",&l1,&l2,&l3);
		if((l1*l1==(l2*l2)+(l3*l3))||(l2*l2 == l1*l1+l3*l3)||(l3*l3 ==l1*l1+l2*l2))
			printf("YES\n");
		else
			printf("NO\n");
		i++;
	}
	return 0;
}

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

signed main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    int64_t a, b, c, d;
    std::cin >> a >> b >> c >> d;

    int64_t x = a * c;
    int64_t y = a * d;
    int64_t z = b * c;
    int64_t t = b * d;

    std::cout << std::max({x, y, z, t});

    return 0;
}



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

int main() {
    int n, H[20];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> H[i];
    }

    int high  = 0;
    int count = 1;

    high = H[0];
    for (int j = 1; j < n; j++) {
        if (H[j] > high) {
            high = H[j];
        }
        if (H[j] >= high) {
            count++;
        }
    }

    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 100000000
for i in range(N):
    dif = abs(A - (T - H[i] * 0.006))
    if ans > dif:
        ans = dif
        spot = i+1
print(spot)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

char buf[110];

int main(void) {
  scanf("%s", buf);
  int len = strlen(buf);
  printf("%c%d%c\n", buf[0], len-2, buf[len-1]);
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String arare[] = new String[N];
		boolean answer = false;
		for (int i = 0; i < N; i++) {
			arare[i] = sc.next();
		}
		for (int i = 0; i < N; i++) {
			if (arare[i].equals("Y")) {
				answer = true;
			}
		}
		if (answer == true) {
			System.out.println("Four");
		} else {
			System.out.println("Three");
		}
	}

}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<class T>
struct Point {
	typedef Point P;
	T x, y;
	explicit Point(T x=0, T y=0) : x(x), y(y) {}
	bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
	bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
	P operator+(P p) const { return P(x+p.x, y+p.y); }
	P operator-(P p) const { return P(x-p.x, y-p.y); }
	P operator*(T d) const { return P(x*d, y*d); }
	P operator/(T d) const { return P(x/d, y/d); }
	T dot(P p) const { return x*p.x + y*p.y; }
	T cross(P p) const { return x*p.y - y*p.x; }
	T cross(P a, P b) const { return (a-*this).cross(b-*this); }
	T dist2() const { return x*x + y*y; }
	double dist() const { return sqrt((double)dist2()); }
	// angle to x-axis in interval [-pi, pi]
	double angle() const { return atan2(y, x); }
	P unit() const { return *this/dist(); } // makes dist()=1
	P perp() const { return P(-y, x); } // rotates +90 degrees
	P normal() const { return perp().unit(); }
	// returns point rotated 'a' radians ccw around the origin
	P rotate(double a) const {
		return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
};

using P = Point<long double>;

template<class P>
int segmentIntersection(const P& s1, const P& e1,
		const P& s2, const P& e2, P& r1, P& r2) {
	if (e1==s1) {
		if (e2==s2) {
			if (e1==e2) { r1 = e1; return 1; } //all equal
			else return 0; //different point segments
		} else return segmentIntersection(s2,e2,s1,e1,r1,r2);//swap
	}
	//segment directions and separation
	P v1 = e1-s1, v2 = e2-s2, d = s2-s1;
	auto a = v1.cross(v2), a1 = v1.cross(d), a2 = v2.cross(d);
	if (a == 0) { //if parallel
		auto b1=s1.dot(v1), c1=e1.dot(v1),
		     b2=s2.dot(v1), c2=e2.dot(v1);
		if (a1 || a2 || max(b1,min(b2,c2))>min(c1,max(b2,c2)))
			return 0;
		r1 = min(b2,c2)<b1 ? s1 : (b2<c2 ? s2 : e2);
		r2 = max(b2,c2)>c1 ? e1 : (b2>c2 ? s2 : e2);
		return 2-(r1==r2);
	}
	if (a < 0) { a = -a; a1 = -a1; a2 = -a2; }
	if (0<a1 || a<-a1 || 0<a2 || a<-a2)
		return 0;
	r1 = s1-v1*a2/a;
	return 1;
}


int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	int q;
	cin >> q;
	for(int i = 0; i < q; i++){
		P p0, p1;
		cin >> p0.x >> p0.y >> p1.x >> p1.y;
		P p2, p3;
		cin >> p2.x >> p2.y >> p3.x >> p3.y;
		P r1, r2;
		assert(segmentIntersection(p0, p1, p2, p3, r1, r2));
		cout << r1.x << ' ' << r1.y << '\n';
	}
}


Measured memory_bytes: 3252