akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define lk (k<<1)
#define rk (k<<|1)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf=0x3f3f3f3f;
const int N=1e2+10;
char s[5];
int main()
{
    scanf("%s",s);
    int ans=0,tot=0;
    for(int i=0;i<3;i++){
        if(s[i]=='R') tot++,ans=max(ans,tot);
        else tot=0;
    }
    ans=max(ans,tot);
    printf("%d\n",ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll n;
        cin >> n;
        vector<string> s(n);
        unordered_map<string, ll> c;
        rep(i, n) {
            cin >> s[i];
            sort(all(s[i]));
            c[s[i]]++;
        }
        ll ans = 0;
        each(e, c) {
            ans += e.second * (e.second - 1) / 2;
        }
        cout << ans << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 17700
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
int main (){
	int X,Y,Z,num = 0;
	while(~scanf("%d%d%d",&X,&Y,&Z)){
		num = (X - Z) / (Y + Z);
		printf("%d\n",num);
	}
	return 0;
}


Measured memory_bytes: 256
/*

        শুভ নববর্ষ ।
        ঘরে থাকুন , সুস্থ থাকুন ।
    wan-_-s
*/

#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define stay_home_stay_safe return 0
#define pb push_back
const ll N = 200007 ;
void scan(ll &n) { scanf("%lld",&n) ; }
void scan(ll &n, ll &m) { scanf("%lld%lld",&n,&m) ; }
void scan(vector<ll> &v) { ll n = v.size() ; for(ll i=0 ;i<n;i++) scanf("%lld",&v[i]) ; }
vector<ll> adj[N] ;
ll vis[N] , lvl[N] ,lvl1[N],vis1[N] ;
void edge (ll u , ll v) {
    adj[u].pb(v) ;
    adj[v].pb(u) ;
}


int main() {

   ll n , m ;
   cin >> n >> m ;
   vector<ll> v(m) ;
   scan(v) ;
   ll sum = 0 ;
   for(ll i=0;i<m;i++) sum+=v[i] ;
cout << max(-1LL,n-sum) << endl ;
    stay_home_stay_safe ;
}






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

// #undef DEBUG
// #define DEBUG
/// {{{ DEBUG --- ///
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if(&o == &cerr) { o << '{'; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; } else { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); } return o; }
#ifdef DEBUG
#ifdef USE_COUT
#define dump(...) (cout<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
#else
#define dump(...) (cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
#endif
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
template<class T, class U> ostream & operator<<(ostream &o, pair<T, U> const &p) { o << "(" << p.first << ", " << p.second << ")"; return o; }
#else
#define dump(...) (0)
#endif
/// }}}--- ///

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

int f[2][700][700];
vector<int> ddx[2], ddy[2];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, d[2];
  cin >> n >> d[0] >> d[1];
  for(int j = 0; j < 2; j++) {
    for(int i = 0; i <= 601; i++) {
      int k = d[j] - i * i;
      if(k < 0) continue;
      int kk = sqrt(k);
      if(kk * kk != k) continue;
      ddx[j].emplace_back(i);
      ddy[j].emplace_back(kk);
    }
  }
  for(int k = 0; k < 2; k++) {
    for(int i = 0; i < 2*n; i++) for(int j = 0; j < 2*n; j++) if(f[k][i][j] == 0) {
      f[k][i][j] = 1;
      queue<pair<int, int>> q;
      q.emplace(i, j);
      while(q.size()) {
        int ii = q.front().first, jj = q.front().second;
        q.pop();
        for(int t = 0; t < ddx[k].size(); t++) {
          for(int d = 0; d < 4; d++) {
            int ni = ii + dx[d] * ddx[k][t];
            int nj = jj + dy[d] * ddy[k][t];
            if(ni < 0 || nj < 0 || ni >= 2*n || nj >= 2*n) continue;
            assert(f[k][ni][nj] != f[k][ii][jj]);
            if(f[k][ni][nj] != 0) continue;
            f[k][ni][nj] = 3 - f[k][ii][jj];
            q.emplace(ni, nj);
          }
        }
      }
    }
  }
  vector<pair<int, int>> ans;
  for(int k = 1; k <= 2; k++) for(int l = 1; l <= 2; l++) {
    ans.clear();
    for(int i = 0; i < 2*n; i++) for(int j = 0; j < 2*n; j++) {
      if(f[0][i][j] == k && f[1][i][j] == l) ans.emplace_back(i, j);
    }
    if(ans.size() >= n * n) goto out;
  }
  out:
  assert(ans.size() >= n * n);
  for(int i = 0; i < n * n; i++) cout << ans[i].first << " " << ans[i].second << endl;
}



Measured memory_bytes: 5748
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cmath>
using namespace std;

int main(){
	char x, y;
	cin >> x >> y;
	if (x == y)
		cout << "=" << endl;
	else if (x > y)
		cout << ">" << endl;
	else
		cout << "<" << endl;
}

Measured memory_bytes: 256
#b
n,k=map(int, input().split() )
h=[int(i) for i in input().split()]
a=[10**10]*n
a[0]=0
a[1]=abs(h[0]-h[1])
for i in range(2,n):
    for j in range(1,min(i,k)+1):
        a[i]=min(a[i],a[i-j]+abs(h[i]-h[i-j]))
print(a[-1])

Measured memory_bytes: 52448
/*
Looking from a window above
It's like a story of love
Can you hear me?
Came back only yesterday
I'm moving further away
Want you near me
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you
Sometimes when I think of her name
When it's only a game
And I need you
Listen to the words that you say
It's getting harder to stay
When I see you
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you
Uh uh uh only you, only you
Only you, only you, only you
This is going to take a long time
And I wonder what's mine
Can't take no more
Wonder if you'll understand
It's just the touch of your hand
Behind a closed door
And all I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you, only you
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you, only you
Only you
*/

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ld long double
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define repn for(int x=0;x<n;x++)
#define rep1n for(int x=1;x<=n;x++)
#define rep1m for(int y=1;y<=m;y++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define bits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) ((int)(x.size()))
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define see(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define see(x...)
#endif

const int inf = 3e18;
const int N = 5e5 + 100;




int32_t main(){ 
   FAST;
   int a, b, c;
   cin >> a >> b >> c;
   cout << (a + b >= c ? "Yes": "No");
}

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

long long cnt;
vector<int> G;

void InsertionSort(int a[],int n,int step){
  for(int i=step;i<n;i++){
    int temp=a[i],j=i-step;
    while(j>=0 && a[j]>temp){
      a[j+step]=a[j];
      j-=step;
      cnt++;
    }
    a[j+step]=temp;
  }
}

void ShellSort(int a[],int n){
  for(int h=1; ; ){
    if(h>n) break;
    G.push_back(h);
    h=3*h+1;
  }
  for(int i=G.size()-1;i>=0;i--) InsertionSort(a,n,G[i]);
}

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++) scanf("%d",&a[i]);
  cnt=0;
  ShellSort(a,n);

  cout << G.size() << endl;
  for(int i=G.size()-1;i>=0;i--){
    printf("%d",G[i]);
    if(i) printf(" ");
  }
  cout << endl;
  cout << cnt << endl;
  for(int i=0;i<n;i++) cout << a[i] << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;

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

  int total = 0;
  for (int i = 1; i < n + 2; i++) {
    total += abs(a[i] - a[i - 1]);
  }

  for (int i = 1; i < n + 1; i++) {
    if((a[i - 1] <= a[i] && a[i] <= a[i + 1]) || (a[i + 1] <= a[i] && a[i] <= a[i - 1])) {
      cout << total << endl;
    } else {
      cout << total - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1]) << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3728
def main():
    import sys
    input=sys.stdin.readline
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    mod=998244353
    dp=[[0]*(s+1) for _ in range(n+1)]
    dp[0][0]=1
    for i in range(1,n+1):
        for j in range(s+1):
            a=A[n-i]
            if j-a>0:
                dp[i][j]=(dp[i-1][j]+dp[i-1][j-a])%mod
            elif j==a:
                dp[i][j]=(dp[i-1][j]+i)%mod
            else:
                dp[i][j]=dp[i-1][j]
    ans=0
    for i in range(1,n+1):
        a=A[i-1]
        if s>a:
            ans=(ans+dp[n-i][s-a]*i)%mod
        elif s==a:
            ans=(ans+(n-i+1)*i)%mod
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 111964
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

int main()
{
	unsigned long long N;
	std::cin >> N;

	std::map<std::string, int> stringCountMap;
	for (int i = 0; i < N; ++i) {
		std::string s;
		std::cin >> s;
		++stringCountMap[s];
	}
	
	int maxCount = 0;
	for (auto it : stringCountMap) {
		maxCount = std::max(maxCount, it.second);
	}

	std::set<std::string> strings;
	for (auto it : stringCountMap) {
		if (it.second == maxCount) {
			strings.insert(it.first);
		}
	}

	for (auto it : strings) {
		std::cout << it << std::endl;
	}

	return 0;
}

Measured memory_bytes: 34560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define re register
#define ls (o<<1)
#define rs (o<<1|1)
#define pb push_back
const double PI= acos(-1.0);
const int M = 1e5+7;
/*
int head[M],cnt=1;
void init(int n){cnt=1;for(int i=0;i<=n;i++)head[i]=0;}
struct EDGE{int to,nxt,w;}ee[M*2];
void add(int x,int y,int w){ee[++cnt].nxt=head[x],ee[cnt].w=w,ee[cnt].to=y,head[x]=cnt;}
*/

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	int n;
  	cin>>n;
  	for(int i=1;i<=n;i++)cout<<"ACL";
  	cout<<endl;
	return 0;
}

Measured memory_bytes: 3604
a=int(input())
p=a%10
b=int(input())
q=b%10
c=int(input())
r=c%10
d=int(input())
s=d%10
e=int(input())
t=e%10
l=[a,b,c,d,e]
m=[p,q,r,s,t]
ans=0
if set(m)==set([0]):
    minimum=10
else:
    minimum=min(list(set(m)-set([0])))
def func(n):
    if n%10==0:
        return n
    else:
        return (n//10)*10+10
for i in range(5):
    ans+=func(l[i])
ans=ans-10+minimum
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>

using namespace std;

int solve(vector<int> list) {
  int diff_max = list[1] - list[0];
  int tmp_min = list[0];
  for (int j = 1; j < list.size(); ++j) {
    diff_max = max(diff_max, list[j] - tmp_min);
    tmp_min = min(tmp_min, list[j]);
  }
  return diff_max;
}

int main() {
  int N;
  cin >> N;
  vector<int> v;
  for (int i = 0; i < N; ++i) {
    string n;
    cin >> n;
    v.push_back(stoi(n));
  }
  cout << solve(v) << endl;
}

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


int main() {
  int n;
  int p[21];
  int cnt = 0;
  cin >> n;
  rep(i, n) {
    cin >> p[i];
  }
  for (int i = 1; i < n - 1; i ++) {
    if ((p[i - 1] < p[i] && p[i] < p[i + 1]) || 
        (p[i - 1] > p[i] && p[i] > p[i + 1])) {
      cnt += 1;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>

    using namespace std;
    using Graph = vector<vector<int>>;

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    const int dx[4] = {1,0,-1,0};
    const int dy[4] = {0,1,0,-1};
    
    
    
    int main(){
      char c,d;
      cin>>c;
      d = c+1;
      cout <<d<<endl;
    }

      
      

     
    

    

     

Measured memory_bytes: 256
N,M=list(map(int,input().split()))
L=[]
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)

    def find_root(self, x):
        if(self.root[x]<0):
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]

    def Unite(self, x, y):
        x=self.find_root(x)
        y=self.find_root(y)

        if(x==y):
            return 
        elif(self.rnk[x]>self.rnk[y]):
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y
            if(self.rnk[x]==self.rnk[y]):
                self.rnk[y]+=1
    def isSameGroup(self,x,y):
        if(self.find_root(x)==self.find_root(y)):
            return True
        else:
            False

    def Size(self,x):
        return -self.root[self.find_root(x)]

for i in range(M):
    li = list(map(int,input().split()))
    L.append(li)
L=L[::-1]

ans = [0]*(M)
ans[0] = N*(N-1)/2
T = UnionFind(N)
for i in range(M-1):
    if(T.isSameGroup(L[i][0],L[i][1])):
        ans[i+1] = ans[i]
        continue
    else:
        ans[i+1] = max(0, ans[i]-T.Size(L[i][0])*T.Size(L[i][1]))
        T.Unite(L[i][0],L[i][1])

for i in ans[::-1]:
    print(int(i))
#print(len(ans))

Measured memory_bytes: 34300
from sys import stdin
input = stdin.readline

N = int(input())

ans = [0] * (10 ** 4 + 1)


def calc(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x


for i in range(1, 150):
    for j in range(1, 150):
        for k in range(1, 150):
            tmp = calc(i, j, k)
            if tmp <= 10 ** 4:
                ans[tmp] += 1


for i in range(1, N + 1):
    print(ans[i])


Measured memory_bytes: 69412
#include <iostream>
#include <stdio.h>
#include <cctype>
#include <cmath>
#include <math.h>
using namespace std;

float myabs(float a){
  return a>0 ? a : -a;    
}

int main(){
  double a=0,n=0,m=0,tmp=0;
  int s[1000];
  while(1){
    m=0;tmp=0;
    cin >> n;
    if (n==0) break;
    for(int i=0;i<n;i++){
      cin >> s[i]; 
      m += s[i];
    }
    m = m/n;
    for(int i=0;i<n;i++){
      tmp += (s[i]-m)*(s[i]-m);
    }
    a = sqrt(tmp/n);
    printf("%.8lf\n",a);
  }
}


Measured memory_bytes: 3212
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<set>
#include<map>

using namespace std;

#define x first
#define y second
#define NMAX 100005

int n, m, frec[NMAX];

int main (){
    int a, b;

    scanf("%d%d",&n,&m);
    for(int i = 1; i <= m; i++) {
        scanf("%d%d",&a,&b);
        frec[a]++;
        frec[b]++;
    }
    
    for(int i = 1; i <= n; i++) {
        if(frec[i] & 1) {
            printf("NO\n");
            return 0;
        }
    }
    
    printf("YES\n");
    return 0;
}



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

int main()
{
    long long int n,a,b;
    cin >> n >> a >> b;

    long long int c,d;
    c = n / (a+b);
    d = n - c * (a+b);
    if(d >= a) cout <<  c*a+a << endl;
    else cout << c*a+d << endl;
}

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

using namespace std;

int main() {
	int a, b, c, x;
	cin >> a >> b >> c >> x;
	int ans = 0;
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				if (500 * i + 100 * j + 50 * k == x) ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }


const int q = 1e9+9;


int main()
{
    int n,k;
    cin>>n>>k;
    if(n%k==0) cout<<"0"<<endl;
    else cout<<"1"<<endl;

    return 0;
}
// gotcha;


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

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	lint A, B, N;
	cin >> A >> B >> N;

	cout << A * min(B - 1, N) / B - A * (min(B - 1, N) / B) << "\n";

	return 0;
}

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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ll n;
  cin >> n;
  VLL p(n);
  rep(i,n) cin >>  p[i];
  VLL a(n);
  VLL b(n);

  rep(i,n) a[i] = (i+1)*30000;
  rep(i,n) b[i] = (n-i)*30000;
  rep(i,n)  p[i]--;
  rep(i,n) b[p[i]] += i;


  rep(i,n){
    cout << a[i]<< ' ';
  }
  cout << endl;

  rep(i,n){
    cout << b[i]<< ' ';
  }
  cout << endl;

  // rep(i,n){
  //   cout << a[p[i]]+b[p[i]] << ' ';
  // }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1152
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|i| i.parse().ok().unwrap())
        .collect()
}

fn main() {
    let input = read_vec::<usize>();
    let k = input[0];
    let n = input[1];
    let mut an = read_vec::<usize>();

    an.sort();

    let mut sub: Vec<usize> = vec![0; n];
    
    for i in 0..n-1 {
        sub[i] = an[i+1] - an[i];
    }
    sub[n-1] = k + an[0] - an[n-1];

    sub.sort();

    println!("{}", k - sub[n-1]);

}

Measured memory_bytes: 10492
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn=1e5+10;
int n,t;
LL a[maxn],b[maxn];
int main() {
    while (~scanf("%d%d",&n,&t)) {
        memset(b,0,sizeof(b));
        for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
        for (int i=n;i>=1;i--) b[i]=max(b[i+1],a[i]);
        LL mx=0,cnt=0;
        for (int i=1;i<n;i++) {
            if (mx<b[i+1]-a[i]) {
                mx=b[i+1]-a[i];
                cnt=1;
            } else if (mx==b[i+1]-a[i]) cnt++;
        }
        printf("%lld\n", cnt);
    }
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;

    cout << (a-1)*(b-1) << endl;

    return 0;
}

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

int main() {
	int h, w;
	cin >> h >> w;
	string masu[100];

	for (int i = 0; i < h; i++)
	{
		cin >> masu[i];
	}
	int x[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
	int y[8] = { -1,-1,-1,0,0,1,1,1 };

	for (int i=0; i < h; i++)
	{
		for(int j=0; j < w; j++ )
		{
			if (masu[i][j] == '#') continue;
			int num = 0;
			for (int k = 0; k < 8; k++)
			{
				int nx = i - x[k];
				int ny = j - y[k];
				if (nx < 0 || h <= nx) continue;
				if (ny < 0 || w <= ny) continue;
				if (masu[nx][ny] == '#') num++;
			}
			masu[i][j] = char(num + '0');
		}
	}

	for (int i = 0; i < h; i++) cout << masu[i] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t a, b;
  cin >> a >> b;
  if(a == 0 || b == 0){
    cout << "Zero" << endl;
    return 0;
  }
  if(a > 0 && b > 0){
    cout << "Positive" << endl;
    return 0;
  }
  if(a < 0 && b > 0){
    cout << "Zero" << endl;
    return 0;
  }
  if(a < 0 && b < 0){
    if((b - a) % 2 == 0){
      cout << "Negative" << endl;
      return 0;
    }
    if((b - a) % 2 == 1){
      cout << "Positive" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3632
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>


using namespace std;


int main()
{
    int x,y;
    cin>>x>>y;
    if(x==1)
    x=14;
    if(y==1)
    y=14;
    if(x>y)
    cout<<"Alice";
    if(x==y)
    cout<<"Draw";
    if(x<y)
    cout<<"Bob";

    return 0;
}     

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

/////////////////////////////////////////////////////////////////////////
// UNION FIND
/////////////////////////////////////////////////////////////////////////
class UnionFind {
private:
  int siz;
  vector<int> a;

public:
  UnionFind(int x) : siz(x), a(x, -1) {}

  int root(int x) {
    return a[x] < 0 ? x : a[x] = root(a[x]);
  }

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    siz--;
    if (a[x] > a[y]) swap(x, y);
    a[x] += a[y];
    a[y] =x;
    return true;
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  int size(int x) {
    return -a[root(x)];
  }
  
  int connected_component() {
  	return siz;
  }
};
/////////////////////////////////////////////////////////////////////////
// END UNION FIND
/////////////////////////////////////////////////////////////////////////

signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //d
  int h, w;
  cin >> h >> w;
  int sx, sy;
  cin >> sx >> sy;
  sx--;
  sy--;
  int gx, gy;
  cin >> gx >> gy;
  gx--;
  gy--;
  vector<string> s(h);
  for (auto& ss : s) cin >> ss;
  UnionFind uf(h * w);
  int dx[] = {-1, 1, 0, 0};
  int dy[] = {0, 0, -1, 1};
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '#') continue;
      for (int k = 0; k < 4; k++) {
        int x = i + dx[k];
        int y = j + dy[k];
        if (x < 0 || x >= h || y < 0 || y >= w || s[x][y] == '#') continue;
        uf.unite(i * w + j, x * w + y);
      }
    }
  }
  vector<int> dist(h * w, 1 << 30);
  vector<vector<int>> cell(h * w);
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) if (s[i][j] != '#') cell[uf.root(i * w + j)].push_back(i * w + j);
  dist[uf.root(sx * w + sy)] = 0;
  vector<int> que = {uf.root(sx * w + sy)};
  for (int i = 0; i < (int) que.size(); i++) {
    for (auto& cur : cell[que[i]]) {
      for (int u = -2; u <= 2; u++) for (int v = -2; v <= 2; v++) {
        int x = cur / w + u;
        int y = cur % w + v;
        if (x < 0 || x >= h || y < 0 || y >= w || s[x][y] == '#') continue;
        if (dist[uf.root(x * w + y)] != 1 << 30) continue;
        que.push_back(uf.root(x * w + y));
        dist[uf.root(x * w + y)] = dist[uf.root(cur)] + 1;
      }
    }
  }
  int ans = dist[uf.root(gx * w + gy)];
  cout << (ans == 1 << 30 ? -1 : ans) << endl;
  return 0;
}

Measured memory_bytes: 41736
N, D, A = gets.chomp.split(" ").map(&:to_i)
M = []
N.times{
  M << gets.chomp.split(" ").map(&:to_i)
}

M.sort_by!{|x, h| x}
ans, sum, lst = [0, 0, []]
(0...N).each{|i|
  x, h = M[i]
  while (not lst.empty?) && lst[0][0] < x do
    r, d = lst.shift
    sum -= d
  end
  h -= sum
  next if h <= 0
  wk = (h / A.to_f).ceil
  ans += wk
  rng = x + 2 * D
  dmg = wk * A
  lst << [rng, dmg]
  sum += dmg
}

puts ans


Measured memory_bytes: 22392
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;



      cin>>str;

      i=0;

      j=str.size()-1;

      while(i<j)
      {
        if(str[i]!=str[j])ans++;
        i++;
        j--;
      }

      cout<<ans<<endl;







}



Measured memory_bytes: 3652
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
string a,b,c;

int main(){
  cin >> a >> b >> c;
  cout << "A" << b[0] << "C" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    long long int a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    if(a>c) printf("%lld %lld",a-c,b);
    else if(b-(c-a)>=0)    printf("0 %lld",b-(c-a));
    else printf("0 0");
}


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

int main()
{
    /*
    int n;
    cin>>n;
    for(int i=0;i<=n;i++)
    {
        int x = i*1.08;
        if(x==n)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    */
    /*
    int n,m,c;
    cin>>n>>m>>c;
    int a[n][m];
    int b[m];
    int count = 0;
    for(int i=0;i<m;i++)
    {
        cin>>b[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }

    for(int i=0;i<n;i++)
    {
        int sum=0;
        for(int j=0;j<m;j++)
        {
            sum+=a[i][j]*b[j];
        }
        if(sum+c>0)
        {
            count++;
        }
    }

    cout<<count<<endl;
    */
    ll h,w;
    cin>>h>>w;
    if(h==1 || w==1)
    {
        cout<<1<<endl;
        return 0;
    }
    if(h*w%2==0)
    {
        cout<<(h*w)/2<<endl;
    }
    else
    {
        cout<<(h*w)/2+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
#define pb push_back
const int mxN = 1e6 + 500;
const int mod = 1e9 + 7;
int ar[mxN];


int32_t main() {

	fastio();
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int T;
	// cin >> T;
	T = 1;
	while (T--) {

		int n, k, l = 0, ans = 0;
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		int t1 = a * c;
		int t2 = a * d;
		int t3 = b * d;
		int t4 = b * c;

		cout << max({t1, t2, t3, t4});

		// cout << t*t2;


		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    char a[99];
    cin >> a >> a;
    cout << "A" << a[0] << "C";
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
using namespace std;
typedef long long ll;
const int N = 100000;

int n;
map<ll,ll> mp, cnt, nxt;
ll p[N];
ll isp[N + 10], pcnt = 0;
inline void prepare() {
  isp[0] = isp[1] = 1;
  for(ll i = 2;i <= N;i ++) {
    if(!isp[i]) p[++ pcnt] = i, mp[1LL * i * i] = i;
    for(ll j = 1;j <= pcnt && i * p[j] <= N;j ++) {
      isp[i * p[j]] = 1;
      if(i % p[j] == 0) break;
		}
	}
}

int main() {
	mp.clear(); cnt.clear(); nxt.clear();
	prepare();
	scanf("%d", &n);
	for(ll i = 1;i <= n;i ++) {
	  ll x, y; scanf("%lld", &x); y = x;
//	  cout << x << ' ';
	  ll now1 = 1LL, now2 = 1LL;
	  for(ll j = 1;j <= pcnt && 1LL * p[j] * p[j] * p[j] <= x;j ++) {
	    if(x % p[j] == 0) {
	    	ll tmp = 0;
	      while(x % p[j] == 0) {
	      	tmp ++;
	      	x /= p[j];
	      }
	      tmp %= 3;
	      for(int _ = 1; _ <= tmp; _ ++) now1 *= p[j];
	      for(int _ = 1; _ <= (3 - tmp) % 3; _ ++) now2 *= p[j];
			}
		}
		if(x != 1) {
		  now1 *= x;
		  if(mp.find(x) != mp.end()) now2 *= mp[x];
		  else now2 *= x * x;
		}
//		cout << now1 << ' ' << now2 << endl;
		cnt[now1] ++;
		nxt[now1] = now2;
		nxt[now2] = now1;
	}
	ll Ans = 0;
	map<ll,ll>::iterator tmp;
	tmp = cnt.find(1);
	if(tmp != cnt.end()) {
	  Ans ++;
	  cnt.erase(tmp);
	}
	for(tmp = cnt.begin();tmp != cnt.end();tmp ++) {
//		cout << tmp->first << ' ' << nxt[tmp->first] << endl;
	  if(cnt.find(nxt[tmp->first]) == cnt.end()) {
	    Ans += tmp->second;
		}
		else {
			Ans += max(tmp->second,cnt[nxt[tmp->first]]);
			cnt[nxt[tmp->first]] = 0;
			tmp->second = 0;
		}
	}
	printf("%lld\n", Ans);
  return 0;
}

Measured memory_bytes: 20480
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	string s; cin >> s;
	int n = s.length();
	s = " " + s;
	if (s[n] != '0' || s[1] != '1' || s[n - 1] != '1') {
		cout << "-1\n";
		return 0;
	}
	for (int i = 2, j = n - 2; i < j; i++, j--)
		if (s[i] != s[j]) {
			cout << "-1\n";
			return 0;
		}
	int i = 1;
	for (int j = 2; j <= n / 2; j++)
		if (s[j] == '1' || j == n / 2)
			while (i < j) {
				cout << i << ' ' << j << '\n';
				i++;
			}
	if (s[i] == '1') {
		i++;
		cout << i - 1 << ' ' << i << '\n';
	}
	for (int j = i + 1; j <= n; j++)
		cout << i << ' ' << j << '\n';
	return 0;
}


Measured memory_bytes: 3796
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
const ll INF = numeric_limits<ll>::max() / 2;

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

    int n;cin>>n;
    ll mi=INF;
    ll res=-INF;
    for(int i=0;i<n;i++){
        ll r;cin>>r;
        res=max(res,r-mi);
        mi=min(mi,r);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3204
N,M=map(x->parse(Int,x),split(readline()))
A=Array{Pair{Int,Int}}(0)
for i=1:N
	a,b=map(x->parse(Int,x),split(readline()))
	push!(A,a=>b)
end
sort!(A)
ans=0
for (a,b)=A
	if M>b
		ans+=a*b
		M-=b
	else
		ans+=a*M
		M=0
	end
end
println(ans)


Measured memory_bytes: 157060
import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val C = readLine()

  def solve() = {
    val rCnt = C.count(_ == 'R')
    (0 until rCnt).foldLeft(0) { (acc, i) =>
      if(C(i) == 'W') acc + 1 else acc
    }
  }

  println(solve())

}



Measured memory_bytes: 56660
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():

    
    N,K=MI()
    a=LI()#下位の連続するn枚が不要なはず
    a.sort()
    for i in range(N):#K以上ならば必要
        if a[i]>=K:
            a=a[:i]
            break
    N=len(a)
                    
                    
    #x番目の数が必要かどうかの判定 
    #必要なものだけで構成された集合をもとに考えれば良いわけではない，不必要な分も考えなければならない             
    def ch(x):
        
        #使い回す，i番目まででjが作れるか
        dp=[0]*K
        dp[0]=1
        for i in range(N):
            if i==x:
                continue
            else:
                for j in range(K-1,a[i]-1,-1):
                    dp[j]|=dp[j-a[i]]
                
                        
        #K未満K-a[x]以上が作れれば良い    
        for j in range(K-a[x],K):
            if  dp[j]:
                return True
        return False
            
    
                        
    ng=-1
    ok=N
    while abs(ok-ng)>1:
        med=(ok+ng)//2
        
        if ch(med):
            ok=med
        else:
            ng=med
            
    print(ng+1)
    
    
   
    
            
    
    
    

main()


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

int main(){
    int N, X, T;
    cin >> N >> X >> T;
    if (N % X == 0)
    {
        cout << N / X * T;
    }
    else 
    {
        cout << (N / X + 1) * T;
    }
} 

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int n;
	double sum=0;
	cin >> n;
	vector<double>x(n);
	vector<string>u(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i];
		cin >> u[i];
		if (u[i] == "BTC") {
			x[i]= 380000 * x[i];
		}
		sum += x[i];

	}
	printf("%.9f", sum);

}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(reader.readLine());
		System.out.println(N/3);
	}

}


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

int main(){
    int n;
    double a,b,m,a2;
    while(1){
        cin>>n;
        int s[1000]={};
        a=0;
        b=0;
        if(n==0)break;
        for(int i=0;i<n;i++){
            cin>>s[i];
            a+=s[i];
        }
        m=1.0*a/n;
        for(int i=0;i<n;i++){
            b+=(s[i]-m)*(s[i]-m);
        }
        a2=sqrt(b/n);
        printf("%lf\n",a2);
    }

    return 0;
}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define endl '\n'
#define ll 'long long'

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

	int x, y;
	cin >> x >> y;
	if (y % 2 != 0) cout << "No";
	else if (2 * x <= y && 4 * x >= y) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
string a[10];
int b[10][10];
int n,m,k;
int judge(int x,int y) {
	int num=0;
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			if(b[i][j]&&a[i][j]=='#')
				num++;
		}
	}
	return num;
}
int main() {
	cin>>n>>m>>k;
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	int ans=0;
	for(int i=0;i<(2<<(n-1));i++) {
		for(int j=0;j<(2<<(m-1));j++)
        {
            memset(b,1,sizeof b);

            for(int ii=0;ii<n;ii++)
            {
		          if((i>>ii)&1)
		          {
			            for(int jj=0;jj<m;jj++) b[ii][jj]=0;
		          }
	        }
	        for(int jj=0;jj<m;jj++)
	        {
		           if((j>>jj)&1)
		           {
			          for(int ii=0;ii<n;ii++) b[ii][jj]=0;
		           }
            }
			if(judge(i,j)==k) ans++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3596
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	int N, M;
	cin >> N >> M;
	if (N % 2 == 1) {
		for (int i = 0; i < M; ++i) {
			cout << M - i << ' ' << M + i + 1 << '\n';
		}
	}
	else {
		for (int i = 0; i < M; ++i) {
			if (i < N / 4) {
				cout << M - i << ' ' << M + i + 1 << '\n';
			}
			else {
				cout << M - i << ' ' << M + i + 2 << '\n';
			}
		}
	}
	return 0;
}

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

int main()
{
	string S,T;
	cin >> S;
	cin >> T;
	int ans = 10000;
	rep(i,S.size()-T.size()+1)
	{
		int temp = 0;
		rep(j,T.size())
		{
			if (S[i+j] != T[j]) temp++;
		}
		ans = min(ans,temp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
A=input()
n=3

for i in range(2**n):
    result=A[0]
    result_sum=int(A[0])
    for j in range(n):
        if (i>>j)&1:
            result=result+"-"+A[j+1]
            result_sum-=int(A[j+1])
        else:
            result=result+"+"+A[j+1]
            result_sum+=int(A[j+1])
    if result_sum==7:
        print(result+"=7")
        exit()
            

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
const double EPS=1e-10;

int main(){
    int N;
    cin>>N;vector<int>L(N);
    REP(i,N)cin>>L[i];
    SORT(L);
    int sum=0;
    REP(i,N-1)sum+=L[i];
    if(sum>L.back()){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

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

int main(){
   string a,b;
   cin >> a >> b;
   if(a.size() == b.size()){
      if(a>b){
         cout << "GREATER";
      }else if(a<b){
         cout << "LESS";
      }else{
         cout << "EQUAL";
      }
   }else{
      if(a.size()>b.size())
         cout << "GREATER";
      else
         cout << "LESS";
   }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////


//経路圧縮，繋ぎ変え

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size,-1) { }

    int root(int x){
        if (data[x] < 0) return x;
        else return data[x] = root(data[x]);
    }

    int size(int x){
        return -data[root(x)];
    }

    bool isConnect(int x,int y){
        return root(x) == root(y);
    }

    bool connect(int x , int y){
        x = root(x);
        y = root(y);

        if(x==y) return false;

        if(data[x] > data[y]){
            x ^= y;
            y ^= x;
            x ^= y;
        }

        data[x] = data[x] + data[y]; // membersize++
        data[y] = x;
        return true;
    }
};

int main() {
	vector<int> ans; // 増える便利さを格納する
	int N,M; cin >> N >> M;
	vector<pair<int, int>> A; 
	UnionFind UF(N+2);

	rep(i,M){int a,b; cin >> a >> b; A.PB(MP(a,b));}
	reverse(ALL(A));
	rep(i,M)
	{
		ll a = UF.size(A.at(i).first);
		ll b = UF.size(A.at(i).second);
		if(UF.connect(A.at(i).first,A.at(i).second) == true){ans.PB(a * b);}
		else {ans.PB(0);}

	}
	reverse(ALL(ans));
	ll sum = 0;

	rep(i,M){sum += ans.at(i); cout << sum << "\n"; }
}

Measured memory_bytes: 3444
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	n, _ := strconv.Atoi(nextLine())
	ret := n * (n + 1) / 2
	fmt.Println(ret)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    string k;
    int d;
    cin >> k >> d;
    vector< vector<int> > dp(d, vector<int>(2));
    dp[0][true] = 1;

    rep(i, k.size()) {
        int here = k[i] - '0';
        vector< vector<int> > after(d, vector<int>(2));

        for(int prevmod = 0; prevmod < d; prevmod++) {
            for(int now = 0; now < 10; now++) {
                int nowmod = (prevmod + now) % d;
                if(now < here) {
                    after[nowmod][false] += dp[prevmod][true];
                    after[nowmod][false] %= MOD;
                } else if(now == here) {
                    after[nowmod][true] += dp[prevmod][true];
                    after[nowmod][true] %= MOD;
                }
                after[nowmod][false] += dp[prevmod][false];
                after[nowmod][false] %= MOD;
            }
        }
        dp = after;
    }

    cout << (dp[0][true] + dp[0][false] - 1 + MOD) % MOD << endl;
    return 0;
}

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

int main(){
	int i, n, x, mini=3000, maks=-1;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x;
		mini=min(mini, x);
		maks=max(maks, x);
	}
	cout<<maks-mini<<endl;
	return 0;
}

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

ll cal(vector<ll> group) {
    
    if (group.size() == 0) {
        return 0;
    }
    if (group.size() == 1) {
        return group[0];
    }
    ll smallest = group[0];
    vector<ll> minIndice;
    for (int i = 0; i < group.size(); i++) {
        if (smallest > group[i]) {
            smallest = group[i];
            minIndice.clear();
            minIndice.push_back(i);
        }
        else if (smallest == group[i]) {
            minIndice.push_back(i);
        }
    }
    if (minIndice.size() == group.size()) {
        return smallest;
    }
    ll ret = smallest;
    for (int i = 0; i <= minIndice.size(); i++) {
        vector<ll> _g;
        if (i == 0) {
            for (ll k = 0; k < minIndice[0]; k++) {
                _g.push_back(group[k]-smallest);
            }
        }
        else if (i == minIndice.size()) {
            for (ll k = minIndice[i-1] + 1; k < group.size(); k++) {
                _g.push_back(group[k]-smallest);
            }
        }
        else {
            for (ll k = minIndice[i-1]+1; k < minIndice[i]; k++) {
                _g.push_back(group[k]-smallest);
            }
        }
        ret += cal(_g);
    }
    return ret;
}

int main() {
    ll n; cin >> n;
    vector<ll> h;
    for (int i = 0; i < n; i++) {
        ll _h; cin >> _h;
        h.push_back(_h);
    }
    ll ans = 0;
    ans = cal(h);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a, b;
   cin >> a >> b;
   if((a==1 && b==2) || (a==2 && b==1))
   cout << 3 << endl;
   else if((a==2 && b==3) || (a==3 && b==2))
   cout << 1 << endl;
   else
   {
       cout << 2 << endl;
   }
   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<map>
#include<cmath>
#define int long long
#include<string>
 
 
 
using namespace std;
signed main()
{
	int d,t,s;
	cin>>d>>t>>s;
	if(t*s>=d) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 3592