akhauriyash/Code-Regression huggingface dataset:
N = int(input())

even = True
S = ''
while abs(N) > 0:
    if N % 2 == 1:
        if even:
            N -= 1
        else:
            N += 1
        S = '1' + S
    else:
        S = '0' + S
    N //= 2
    even = not even

if len(S) == 0:
    print('0')
else:
    print(S)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
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 main(){
  int x; cin >> x;
  for(ll b = -150; b < 150; b++){
    for(ll a = b+1; a < 150; a++){
      if(a*a*a*a*a-b*b*b*b*b == x){
        cout << a << " " << b;
        return 0;
      }
    }
  }
  cout << "\n";
  return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C>> D;
  if (D==1) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

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

using namespace std;

const int N = 2e5 + 5;
vector<int> adj[N];
int vis[N] , n , m;

int opp (int node) {
    if (node > n)
        return node - n;
    return node + n;
}

void dfs (int node) {
    if (vis[node])
        return;

    vis[node] = 1;

    dfs(opp(node));
    for (int child : adj[node])
        dfs(child);
}

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

    cin >> n >> m;

    for (int i = 0 ;i < m ;i++) {
        int x , y , z;
        cin >> x >> y >> z;

        if (z&1) {
            adj[opp(x)].push_back(y);
            adj[opp(y)].push_back(x);
        } else {
            adj[x].push_back(y);
            adj[y].push_back(x);
        }
    }

    int ans = 0;
    for (int i = 1 ;i <= n ;i++) {
        if (!vis[i]) {
            ans++;
            dfs(i);
            dfs(opp(i));
        }
    }

    cout << ans;
}

Measured memory_bytes: 18468
const fi='CAITUI.INP';
      fo='CAITUI.OUT';
      maxn=100; maxw=trunc(1e5);

var F:array[0..maxn,0..maxw] of int64;

    n,w:longint;
    a,c:array[1..maxn] of longint;
//================================
procedure Doc;
var i:longint;
begin
  readln(n,w);
  for i:=1 to n do readln(a[i],c[i]);
end;
//================================
procedure Xuli;
var i,j:longint; x:longint;
begin
  fillchar(f,sizeof(f),0);

  for i:=1 to n do
    for j:=0 to w do
      begin
        f[i,j]:=f[i-1,j];

        if (j>=a[i]) and (f[i,j]<f[i-1,j-a[i]]+c[i]) then
          f[i,j]:=f[i-1,j-a[i]]+c[i];
      end;

  writeln(f[n,w]);
end;
//================================
BEGIN
  //assign(input,fi); reset(input);
  //assign(output,fo); rewrite(output);
  doc; xuli;
  //close(input); close(output);
END.

Measured memory_bytes: 78976
import sys

N, Y = map(int, input().split())

for x in range(N + 1):
    for y in range(N + 1 - x):
        value = 10000 * x + 5000 * y + 1000 * (N - x - y)
        if value > Y:
            break
        elif value == Y:
            print(x, y, N - x - y)
            sys.exit(0)
else:
    print(-1, -1, -1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<long long, long long>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

struct UnionFind {
    vector<int> d;
    int cc_cnt;
    UnionFind(int n): d(n, -1) { cc_cnt = n; }
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        cc_cnt--;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};

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

    ll n,m;
    cin>>n>>m;
    ll a[m],b[m];
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        a[i]--; b[i]--;
    }
    ll ans[m+1];
    ans[m]=n*(n-1)/2;
    ll diff=0;
    UnionFind uf(n);
    for(int i=m-1;i>=0;i--){
        ans[i]=ans[i+1]-diff;
        if(uf.same(a[i],b[i])){
            diff=0;
            continue;
        }
        diff=((ll)uf.size(a[i]))*((ll)uf.size(b[i]));
        uf.unite(a[i],b[i]);
    }
    for(int i=0;i<m;i++){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 6160
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,n;
char s[10];
int main(){
	cin>>n;
	while(n--){
		cin>>s;
		if(s[0]=='A')a++;
		else if(s[0]=='W')b++;
		else if(s[0]=='T')c++;
		else d++;
	}
	printf("AC x %d\n",a);
	printf("WA x %d\n",b);
	printf("TLE x %d\n",c);
	printf("RE x %d\n",d);
} 

Measured memory_bytes: 3760
S = input()
N = len(S) + 1

n = [0]
for i in range(1, N + 1):
  n.append(n[-1] + i)

ans = 0
cnt_L = 0
cnt_R = 0
for i in range(N - 1):
  if i == 0:
    if S[i] == "<":
      cnt_L += 1
    else:
      cnt_R += 1
  elif S[i] != S[i - 1] and S[i] == "<":
    if cnt_L > 0:
      ans += n[max(cnt_L, cnt_R)] + n[min(cnt_L, cnt_R) - 1]
    else:
      ans += n[cnt_R]

    cnt_L = 1
    cnt_R = 0
  else:
    if S[i] == "<":
      cnt_L += 1
    else:
      cnt_R += 1
if S[-1] == "<":
  ans += n[cnt_L]
else:
  if cnt_L > 0:
    ans += n[max(cnt_L, cnt_R)] + n[min(cnt_L, cnt_R) - 1]
  else:
    ans += n[cnt_R]
print(ans)

Measured memory_bytes: 27676
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
bool isPrime[1000002];

int main()
{
	int N;
	int H;
	cin>>N>>H;
	vector<int> a(N);
	vector<int> b(N);
	for(int i = 0; i < N; i++){
		cin>>a[i]>>b[i];
	}
	sort(a.begin(),a.end(),greater<int>());
	sort(b.begin(),b.end(),greater<int>());
	int usualAttack = a[0];
	int ans = 0;
	for(int i = 0;i < N && b[i] >= usualAttack; i++){
		H = H - b[i];
		ans++;
		if( H <= 0) break;
	}
	//cout<<"nokori:"<<H<<",usualAttack:"<<usualAttack<<endl;
	if( H <= 0){
		//do nothing
	}else if( H % usualAttack == 0){
		ans = ans + (H/usualAttack);
	}else{
		ans = ans + (H/usualAttack) + 1;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3708
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

void solve(void)
{
  int H,W;
  cin>>H>>W;
  vector<vector<char> > data(H,vector<char>(W));
  for (int h = 0; h < H; h++)
  {
    for (int w = 0; w < W; w++)
    {
      cin>>data[h][w];
    }
    
  }
  vector<vector<int> > ANS(H,vector<int>(W,-1));
  for (int h = 0; h < H; h++)
  {
    for (int w = 0; w < W; w++)
    {
      if(data[h][w] == '.')
      {
        int COUNT = 0;
        for (int x_h = -1;  x_h <= 1; x_h++)
        {
          for (int x_w = -1; x_w <= 1; x_w++)
          {
            int p_h = x_h + h;
            int p_w = x_w + w;
            if(p_h >= 0 && p_h < H && p_w >= 0 && p_w < W)
            {
              if(data[p_h][p_w] == '#') COUNT++;
            }
          }
        }
        ANS[h][w] = COUNT;
        
      }
    }
    
  }

  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if(ANS[i][j] == -1)
      {
        cout<<'#';
      }
      else
      {
        cout<<ANS[i][j];
      }
    }
    cout<<endl;
    
  }
  
  


  

   
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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

int main(){
  int N;
  cin >>N;
	
  vector<int> A(N);
  rep(i,0,N) cin >>A[i];
  
  int ans = 0;
  rep(i,0,N){
    int d;
    rep(j,i+1,N){
      d = abs(A[i]-A[j]);
      ans = max(ans,d);
    }
  } 
  cout<<ans<<endl;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll a, b, c, d;
map<ll, ll> dp;
ll dfs(ll k)
{
    if (dp.find(k) != dp.end())
        return dp[k];
    if (k == 0)
    {
        dp[0] = 0;
        return 0;
    }
    if (k == 1)
    {
        dp[k] = d;
        return d;
    }
    ll res = d * k;
    if (res < 0)
        res = LINF;
    //cout << k << " " << res << "\n";
    if (k >= 2)
    {
        ll temp = (k % 2) * d + a;
        if(k%2==1){
            ll temp1=a+d;
            temp1+=dfs((k+1)/2);
            chmin(res,temp1);
        }
        temp += dfs(k / 2);
        chmin(res, temp);
        //chmin(res, temp1);
    }
    if (k >= 3)
    {
        ll temp = (k % 3) * d + b;
        ll temp1 = (3 - (k % 3)) * d + b;
        temp += dfs(k / 3);
        temp1 += dfs((k + 3) / 3);
        chmin(res, temp);
        chmin(res, temp1);
    }
    if (k >= 5)
    {
        ll temp = (k % 5) * d + c;
        ll temp1 = (5 - (k % 5)) * d + c;
        temp1 += dfs((k + 5) / 5);
        temp += dfs(k / 5);
        chmin(res, temp);
        chmin(res, temp1);
    }
    dp[k] = res;
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll t, n;
    cin >> t;
    vector<ll> ans;
    while (t--)
    {
        cin >> n >> a >> b >> c >> d;
        ll ret = dfs(n);
        dp.clear();
        ans.push_back(ret);
    }
    rep(i, ans.size()) cout << ans[i] << "\n";
}


Measured memory_bytes: 4640
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define int long long int
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int>>
#define umpii unordered_map<int,int>
#define mem(a,b) memset(a, b, sizeof a)
#define mii map<int,int>
#define pqh priority_queue<int>
#define pql priority_queue<int,vi,greater<int>>
#define setbits(x) __builtin_popcountll(x);
#define zerobits(x)__builtin_ctzll(x);
#define dbg(x) cerr<<#x<<" :: "<<x<<endl;
#define dbg2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
const int INF = 1e9;
#define mod 1000000007
int go(int i, int n, int a[], int dp[])
{
	if (i == n - 1)
		return 0;
	if (i >= n) return INT_MAX;
	if (dp[i] != -1)
		return dp[i];

	int first = abs(a[i] - a[i + 1]) + go(i + 1, n, a,dp);
	int second = abs(a[i] - a[i + 2]) + go(i + 2, n, a,dp);

	dp[i] = min(first, second);
	return min(first, second);
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	//FUCK RATINGS
	//Once a CHARAS, always a CHARAS


	//int t; cin>>t;
	//while(t--){
	//}
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int dp[n + 1];
	mem(dp, -1);
	cout << go(0, n, a, dp);



	return 0;
}

Measured memory_bytes: 13036
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
int dgts2(int n){return (n?dgts2(n>>1)+1:0);}
int dgts(int n, int k){return (n?dgts(n/k,k)+1:0);}
inline int v2(int n){return __builtin_ctzll(n);}
 
const int maxn=5005;
//i_am_noob
int a,b;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> a >> b;
	rep(10000){
		if(floor(i*0.08)==a&&floor(i*0.1)==b){
			print1(i);
			return 0;
		}
	}
	print1(-1);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;
const double INF=1000000;

double dist(double x1, double x2, double y1, double y2){
  return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

double C(double x, double y){
  return x*x+y*y;
}

int main(){
  int N;
  cin >> N;
  vector<double> x(N), y(N);
  double ans=INF;
  rep(i,N) cin >> x[i] >> y[i];
  rep(i,N-1){
    for(int j=i+1; j<N; j++){
      double X=(x[i]+x[j])/2, Y=(y[i]+y[j])/2;
      double max_dist=0;
      rep(k,N) max_dist=max(max_dist,dist(X,x[k],Y,y[k]));
      ans=min(ans,max_dist);
    }
  }

  rep(i,N-2){
    for(int j=i+1; j<N-1; j++){
      for(int k=j+1; k<N; k++){
        double X, Y;
        double a=x[i]-x[j], b=y[i]-y[j], c=x[j]-x[k], d=y[j]-y[k];
        if(a*d-b*c==0) continue;
        else{
          X=d*(C(x[i],y[i])-C(x[j],y[j]))-b*(C(x[j],y[j])-C(x[k],y[k]));
          Y=-c*(C(x[i],y[i])-C(x[j],y[j]))+a*(C(x[j],y[j])-C(x[k],y[k]));
          X/=2*(a*d-b*c), Y/=2*(a*d-b*c);
        }
        double max_dist=0;
        rep(l,N) max_dist=max(max_dist,dist(X,x[l],Y,y[l]));
        ans=min(ans,max_dist);
      }
    }
  }
  cout << setprecision(15) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc,char** argv){
    int n;
    scanf("%d",&n);
    int b[n],a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&b[i]);
    }
    for(int i=0;i<n;i++){
        for(int j=n-i;j>0;j--){
            if(j==b[j-1]){
                for(int k=j;k<n;k++)b[k-1]=b[k];
                a[i]=j;
                j=1;
            }else if(j==1){
                printf("-1\n");
                return 0;
            }
        }
    }
    for(int i=n-1;i>=0;i--)printf("%d\n",a[i]);
    return 0;
}




Measured memory_bytes: 128
(defun split (string &key (delimiterp #'(lambda (c) (char= c #\Space))))
  (loop :for beg = (position-if-not delimiterp string)
        :then (position-if-not delimiterp string :start (1+ end))
        :for end = (and beg (position-if delimiterp string :start beg))
        :when beg :collect (subseq string beg end)
        :while end))

(defun main ()
  (let* ((n (parse-integer (read-line)))
         (st (loop for i from 0 below n
                   collect (split (read-line))))
         (x (read-line)))
    (format t "~d~%" (loop for s in st
                           for remain on st
                           do (when (string= x (car s))
                                (return (loop for y in (cdr remain)
                                              summing (parse-integer (cadr y)))))))))

(main)


Measured memory_bytes: 15976
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  ll a,b;cin>>a>>b;
  n%=12;
  for(ll i=1;i<=n;i++)
    if(i%2){a-=b;}
    else {b+=a;}
  cout<<a<<" "<<b<<endl;
  return 0;
}



Measured memory_bytes: 3212
def main():
    s = input()
    ans = len(s)
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            tmp = max(i+1, len(s)-i-1)
            ans = min(ans, tmp)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 ln         PIC X(400).
01 maxlen     PIC 9(10) VALUE 100 COMP.
01 cur        PIC 9(10) VALUE 1 COMP.
01 i          PIC 9(10) VALUE 1 COMP.
01 j          PIC 9(10) COMP.
01 k          PIC 9(10) COMP.
01 len        PIC 9(10) COMP.
01 ans        PIC 9(10) VALUE ZERO.
01 zs         PIC Z(9)9.
01 N          PIC 9(10).
01 d1.
   03 d11 OCCURS 100 DEPENDING ON N.
      05 d    PIC 9(10).

PROCEDURE DIVISION.
  ACCEPT N.
  ACCEPT ln.
  MOVE N TO maxlen.
  PERFORM maxlen TIMES
    PERFORM VARYING j FROM cur BY 1 UNTIL ln(j:1) = SPACE
    END-PERFORM
    COMPUTE len = j - cur
    MOVE ln(cur:len) TO d(i)
    COMPUTE cur = j + 1
    ADD 1 TO i
  END-PERFORM.
  PERFORM VARYING i FROM 1 BY 1 UNTIL 50 < i
    COMPUTE k = i + 1
    PERFORM VARYING j FROM k BY 1 UNTIL 50 < j
      COMPUTE ans = ans + d(i) * d(j)
    END-PERFORM
  END-PERFORM.
  MOVE ans TO zs.
  DISPLAY FUNCTION TRIM(zs).
  STOP RUN.


Measured memory_bytes: 3924
#include <stdio.h>

int main(){
	int i,j,n,m,a,b,c;
	int matrixA[101][101];
	int matrixB[101];
	
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a);
			matrixA[i][j] = a;
		}
	}
	
	for(j=0;j<m;j++){
		scanf("%d",&b);
		matrixB[j] = b;
	}
	c=0;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			c += matrixA[i][j] * matrixB[j];
		}
		printf("%d\n",c);
		c=0;
	}
}

Measured memory_bytes: 1064
n = int(input())
a_list = list(map(int, input().split()))
alice = 0
bob = 0


for i in range(len(a_list)):
    if i % 2:
        bob += sorted(a_list, reverse=True)[i]
    else:
        alice += sorted(a_list, reverse=True)[i]

print(str(alice - bob)) 

Measured memory_bytes: 3060
N=int(input())
B=list(map(int,input().split()))
total=B[0]
if N==2:
    print(B[0]*2)
    exit()
    
if N==3:
    print(B[0]+min(B[1],B[0])+B[1])
    exit()
for i in range(N-2):
    total+=min(B[i],B[i+1])
    
#if N%2==0:
total+=B[-1]
print(total)

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

bool check_next (int now, int next, vector<vector<int>> &nexts) {
    for (int i: nexts[now]) {
        if (i == next) return true;
    }
    return false;
}

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> next(n);
    for (int i=0; i<m; i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        next[a].push_back(b);
        next[b].push_back(a);
    }
    int ans = 0;
    vector<int> order(n-1);
    for (int i=1; i<=n-1; i++) order[i-1] = i;
    do {
        bool can = check_next(0, order[0], next);
        if (!can) continue;
        for (int i=0; i<n-2; i++) {
            if (!check_next(order[i], order[i+1], next)) {
                can = false;
                break;
            }
        }
        if (can) ans++;
    } while (next_permutation(order.begin(), order.end()));
    cout << ans << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i32, b: i32, c: i32,
        k: i32,
    }

    let mut v = Vec::new();
    v.push(a);
    v.push(b);
    v.push(c);

    v.sort();

    for _i in 0..k {
        v[2] *= 2;
    }

    println!("{}", v[0] + v[1] + v[2]);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rfor(i, a, b) for (int i=a; i<(b); i++)
#define zfor(i, a) for (int i=0; i<(a); i++)
#define brfor(i,a,b) for (int i = (b)-1; i >= a; i--)
#define bzfor(i,a) for (int i = (a)-1; i >= 0; i--)

int main(){
    ll a;
    double b;
    cin>>a>>b;
    b*= 100.0001;
    ll b2 = (ll)b;
    ll ans = (a*b2)/100;
    cout<<ans;
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n,l,i,dif=0,ans=100,sum=0,num=0;
  scanf("%d%d",&n,&l);
  for(i=1; i<=n; i++){
     num=l+i-1;
     dif=abs(l+i-1);
     sum+=num;
     if(ans>dif){
       ans=dif;
     }
  }
  if(l<0){
    printf("%d\n",sum+ans);
  }
  else{
    printf("%d\n",sum-ans);
  }
  return 0;
}


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

int main() {
  string a;
  cin >> a;
  vector<int> data(4);
  for (int i = 0; i < 4; i++) {
    data.at(i) = a.at(i) - '0';
  }
  for (int i = 0; i < 8; i++) {
    bitset<3> op(i);
    int sum = data.at(0);
    for (int j = 0; j < 3; j++) {
      if (op.test(j)) {
        sum += data.at(j + 1);
      }
      else {
        sum -= data.at(j + 1);
      }
    }
    if (sum == 7) {
      string s;
      s += to_string(data.at(0));
      for (int i = 0; i < 3; i++) {
        if (op.test(i)) {
          s += "+" + to_string(data.at(i + 1));
        }
        else {
          s += "-" + to_string(data.at(i + 1));
        }
      }
      s += "=7";
      cout << s << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let n: usize = read();
    let mut a: Vec<i64> = (0..n).map(|_| read()).collect();
    a.sort();
    a.reverse();
    let mut tar = a[0];
    let mut ind = 0;
    let mut ans = 0;
    let mut cnt = 0;
    let mut lim = 1;
    for i in 1..n {
        ans += tar;
        cnt += 1;
        if (cnt == lim) {
            lim += 2;
            ind += 1;
            tar = a[ind];
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4364
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
lli n,k;

lli calc(lli arr[],lli ind,lli memo[])
{
    if(ind >= (n-1))
        return 0;
    if(memo[ind] != -1)
        return memo[ind];
    lli res = INT_MAX;
    for(lli i=1;i<=k;i++)
    {
        if(ind+i < n)
        {
            res = min(res,abs(arr[ind] - arr[ind+i]) + calc(arr,ind+i,memo));
        }
    }
    memo[ind] = res;
    return res;
}

int main()
{
    cin>>n>>k;
    lli arr[n];
    lli memo[n];
    for(lli i=0;i<n;i++)
    {
        memo[i] = -1;
        cin>>arr[i];
    }
    memo[n-1] = 0;
    cout<<calc(arr,0,memo)<<endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, 0, n) cin >> a[i];
  sort(a.rbegin(), a.rend());

  priority_queue<int> pq;
  pq.push(a[0]);
  ll ans = 0;
  rep(i, 1, n) {
    ans += pq.top();
    pq.pop();
    pq.push(a[i]);
    pq.push(a[i]);
  }

  cout << ans << endl;
}


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second

#define length(a) (hypot((a).imag() , (a).real()))
#define point complex<ld>
#define perp(a) point((-(a).Y,(a).X))
#define dot(a,b) ( (conj(a)*(b)).real() )
#define cross(a,b) ( (conj(a)*(b)).imag() )
#define rotate0(p,ang) (p * exp(point(0,ang)) )

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

    ll x;
    cin >> x;
    if (x < 30) cout << "No\n";
    else cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jiglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
#define str string
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x1, ld y1, ld x2, ld y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
	return (a * (a + 1LL)) / 2;
}
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };


const int N = 4e5 + 30;
const lli mod = 1e9 + 7;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-6;

lli bp(lli a, lli b = mod - 2LL)
{
	lli ret = 1;
	while (b)
	{
		if (b & 1) ret *= a, ret %= mod;
		a *= a;
		a %= mod;
		b >>= 1;
	}
	return ret;
}
ostream& operator<<(ostream& c, pir a)
{
	c << a.fr << " " << a.sc;
	return c;
}



int n, a[N];
lli k;
lli col[N];
lli cyc, V;
void dfs(int v, int xr)
{
	if (col[v])
	{
		k -= col[v] - 1LL;
		cyc = xr - col[v];
		V = v;
		return;
	}
	col[v] = xr;
	dfs(a[v], xr + 1);
}
void dfs1(int v, int xr)
{
	if (xr == 0)
	{
		cout << v;
		exit(0);
	}
	dfs1(a[v], xr - 1);
}
int main()
{
	fastio;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	if (k < n)
	{
		dfs1(1, k);
	}
	dfs(1, 1);
	k %= cyc;
	if (k > n)
	{
		vector <int> dddfd;
		dddfd[0] = 1;
	}
	dfs1(V, k);
	return 0;
}


/*


  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/



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

using namespace std;

typedef pair <int, int> pii;

set <pii> S;
vector <int> T;
int X[20202], C[20202];
bool chk[20202];
int n;

void dfs1(int p, int d)
{
	bool f = 0;
	
	chk[p] = 1;
	
	for(; ; ){
		auto it = S.lower_bound(pii(X[p] - d + 1, -1));
		if(f){
			if(it == S.end()) break;
			else it = next(it);
		}
		if(it == S.end() || it -> first >= X[p] + d) break;
		
		int t = it -> second;
		if(t == p) f = 1;
		else{
			S.erase(it);
			if(!chk[t ^ 1]) dfs1(t ^ 1, d);
		}
	}
	
	T.push_back(p);
}

void dfs2(int p, int d, int s)
{
	bool f = 0;
	
	chk[p] = 1; C[p] = s;
	
	for(; ; ){
		auto it = S.lower_bound(pii(X[p ^ 1] - d + 1, -1));
		if(f){
			if(it == S.end()) break;
			else it = next(it);
		}
		if(it == S.end() || it -> first >= X[p ^ 1] + d) break;
		
		int t = it -> second;
		if(t == (p ^ 1)) f = 1;
		else{
			S.erase(it);
			if(!chk[t]) dfs2(t, d, s);
		}
	}
}

bool check(int d)
{
	int i, s;
	
	S.clear();
	
	for(i=0; i<n+n; i++){
		S.insert(pii(X[i], i));
		chk[i] = 0;
	}
	
	for(i=0; i<n+n; i++){
		if(!chk[i]) dfs1(i, d);
	}
	
	S.clear();
	
	for(i=0; i<n+n; i++){
		S.insert(pii(X[i], i));
		chk[i] = 0;
	}
	
	for(s=0; !T.empty(); T.pop_back()){
		if(!chk[T.back()]) dfs2(T.back(), d, ++s);
	}
	
	for(i=0; i<n; i++){
		if(C[i << 1] == C[i << 1 | 1]) return 0;
	}
	
	return 1;
}

int main()
{
	int i, s, e;
	
	scanf("%d", &n);
	
	for(i=0; i<n+n; i++){
		scanf("%d", X + i);
	}
		
	for(s=0, e=1e9; s<=e; ){
		if(check(s + e >> 1)) s = (s + e >> 1) + 1;
		else e = (s + e >> 1) - 1;
	}
	
	printf("%d\n", s - 1);
	
	return 0;
}

Measured memory_bytes: 3072
//*****Jai Mata di*****//

#include<bits/stdc++.h>
using namespace std;
#define Nitroboost  ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int 
const int mod=1e9+7;
const int N=2e5+15;
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

vector<int>adj[N];
int h[N];
ll ans=0;
priority_queue<int,vector<int>,greater<int> >q;
vector<pair<int,int> >L,R;

int main()
{
    Nitroboost;
    int n;
    cin>>n;
    int l=ceil(n*1.0/1000)*1000;
    cout<<l-n;
}

Measured memory_bytes: 8280
#include "bits/stdc++.h"
using namespace std;
typedef pair<int,int> pii;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

template<class T>
class segtree{
private:
    vector<T> dat;
    int _size;
    T _init;

public:
    segtree(int __size=0 , T init=numeric_limits<T>::max() ):_size(__size) , _init(init) , dat(4*__size,init){
        if(__size==0)return ;
        int x=1;
        while(x<_size)x*=2;
        _size = x;
    }
    
    int size(){
        return _size;
    }

    void update(int m,int x){
        int i = m+_size;
        dat[i] = x;
        while(i!=1){
            dat[i/2] = min(dat[i],dat[i^1]);
            i/=2;
        }
    }
    
    // call find(s,t)
    T find(int s,int t,int num=1,int a=0,int b=-1){
        if(b==-1)b=_size-1; //I couldn't "int b=_size".
        if(b<s||t<a)return _init;
        if(s<=a&&b<=t)return dat[num];
        return min( find(s,t,num*2,a,(a+b)/2) , find(s,t,num*2+1,(a+b)/2+1,b) );
    }
    
};

int main(){
    int n,q;
    cin>>n>>q;
    segtree<int> x(n);
    rep(i,q){
        int a,b,c;
        cin>>a>>b>>c;
        if(a==0)x.update(b,c);
        else    cout<<x.find(b,c)<<endl;
    }
}

Measured memory_bytes: 2588
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

ll N;
ll A[200001];

int main(){
    cin>>N;
    repn(i,N) cin>>A[i];

    vector<ll> sum(N+1);
    repn(i,N){
        sum[i]+=sum[i-1]+A[i];
        sum[i]%=MOD;
    }

    ll ans=0;
    repn(i,N){
        ans+=A[i]*(sum[N]-sum[i]);
        ans%=MOD;
    }
    if(ans<0) ans+=MOD;

    cout<<ans<<endl;
}

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

int wa(int x) {
    int answer = 0;
    if (x < 10) {
        answer = x;
        return answer;
    }
    while(x > 9) {
       answer = answer + (x % 10);
       x = x / 10;
    }
    answer = answer + x;
    return answer;
}

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int answer = 0;
    for (int i=1; i<=n; ++i) {
       int x = wa(i);
       if (a <= x && x <= b) {
           answer += i;
        }
    }
    cout << answer << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) throws Exception {
		nint();
		int q = nint();
		TreeMap<Integer,Integer> map = new TreeMap<>();
		map.put(-1, Integer.MAX_VALUE);
		while (q-- > 0) {
			int command = nint();
			if (command == 0) {
				int s = nint();
				int t = nint();
				int x = nint();
				int rightValue = map.floorEntry(t+1).getValue();
				map.subMap(s, t+1).clear();
				map.put(s,x);
				map.put(t+1,rightValue); 
			} else {
				int i = nint();
				System.out.println(map.floorEntry(i).getValue());
			}
		}
	}
	
	static int nint(){
		return Integer.parseInt(sc.next());
	}
	
}


Measured memory_bytes: 84680
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let mut mxk = 0;
    let mut keta = 0usize;
    let mut tmp = n;
    while tmp > 0 {
        keta += 1;
        mxk = tmp % 10;
        tmp /= 10;
    }
    let mx = (mxk+1)*10usize.pow(keta as u32-1)-1;
    let res = mxk+(keta-1)*9;
    if n == mx {
        println!("{}", res);
    } else {
        println!("{}", res-1);
    }
}


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

int main(){
	long N;
	cin >> N;
	vector<long> A(N);
	for(auto& a: A){
		cin >> a;
	}
	long ans = 0;
	long prevStand = 0;
	for(long i=1; i<A.size(); ++i){
		long stand = A[i-1]-A[i]+prevStand;
		if(stand>0){
			ans += stand;
			prevStand = stand;
		}
		else{prevStand = 0;}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4752
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);	
		int N = in.nextInt();
		int[] A = new int[N];
		
		for (int i = 0; i < N; i++) {
			A[i] = in.nextInt();
		}
		
		for (int k = 0; k < A.length-1; k++) {
			System.out.print(A[k] + " ");					
		}
		System.out.println(A[A.length -1]);
		for (int i = 1; i <= A.length-1; i++) {
			int key = A[i];
			int j = i-1;
			while (j >= 0 && A[j] > key) {
				A[j+1] = A[j];
				j--;
				
				
			}
			A[j+1] = key;
			for (int k = 0; k < A.length-1; k++) {
				System.out.print(A[k] + " ");					
			}
			System.out.println(A[A.length -1]);
			
		}
		
	}
}



Measured memory_bytes: 31228
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

/// n 番目のフィボナッチ数を求める
/// F(0) = 0, F(1] = 1, F(2) = 1, F(3) = 2, F(4) = 3
int fib(int n) {
    if (n == 0) return 0;

    auto mat = new Mat2x2([[1, 1], [1, 0]]);
    auto m = mat.pow(n, int.max);
    return m.get(0, 1);
}

void main() {
    int n = readint;
    // 問題文の定義だとF(0) = 1, F(1) = 1 なので値を 1 だけずらす
    writeln(fib(n + 1));
}

class Mat2x2 {
    private const N = 2;
    private const int[][] _mat;

    this(const int[][] init) {
        assert(init.length == N);
        assert(init[0].length == init[1].length && init[0].length == N);

        _mat = init.dup;
    }

    int get(int r, int c) const {
        return _mat[r][c];
    }

    Mat2x2 mul(const Mat2x2 m, int mod) const {
        auto t = new int[][](N, N);

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                int x = 0;
                for (int k = 0; k < N; k++) {
                    x = (x + (_mat[i][k] * m.get(k, j)) % mod) % mod;
                }
                t[i][j] = x;
            }
        }
        return new Mat2x2(t);
    }

    Mat2x2 copy() const {
        return new Mat2x2(_mat);
    }

    Mat2x2 pow(int k, int mod) const {
        assert(k > 0);
        if (k == 1) return this.copy();

        auto m = this.pow(k / 2, mod);
        return k % 2 == 0
            ? m.mul(m, mod)
            : this.mul(m.mul(m, mod), mod);
    }

    void dump() const {
        writeln(_mat[0][0], " ", _mat[0][1]);
        writeln(_mat[1][0], " ", _mat[1][1]);
    }
}



Measured memory_bytes: 2488
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

main(){
  int a,b,c,d;

  cin>>a>>b>>c>>d;

  int s=min(a,b);
  int t=min(c,d);

  cout<<s+t<<endl;
}


Measured memory_bytes: 256
n  = int(input())
cs = {}

for i in range(0, n):
	s = "".join(sorted(input()))
	
	if s in cs:
		cs[s] += 1
	else:
		cs[s] = 1
		
count = 0

for c in cs.values():
	count += c * (c - 1) // 2

print(count)


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

int main(){
  int n,m;cin>>n>>m;
  vector<int> edge[n],ans(n,-1);
  while(m--){
    int u,v;cin>>u>>v;u--;v--;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  queue<int>que;
  que.push(0);
  while(que.size()){
    int p=que.front();que.pop();
    for(int q:edge[p])
      if(!~ans[q]){
        ans[q]=p;
        que.push(q);
      }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++)cout<<ans[i]+1<<endl;
}


Measured memory_bytes: 10252
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

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

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...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n, k; cin >> n >> k;
	vector<int> freq(n + 1, 0);
	for (int i = 1; i <= k; i++) {
		int d; cin >> d;
		for (int j = 1; j <= d; j++) {
			int a; cin >> a;
			freq[a]++;
		}
	}

	int ans = 0;
	for (int i = 1; i <= n; i++) if (freq[i] == 0) ans++;
	cout << ans;

	return 0;
}

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

int main(){
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  if(N>=K){
    cout << K*X+(N-K)*Y << endl;
    return 0;
  }
  cout << X*N << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 998244353
#define MAX 200003

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

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

  for(int i=K;i<N;i++){
    int x=sum[i]-sum[i-K+1];
    if(x>0){
      cout<<"No"<<endl;
    }else{
      if(A[i]>A[i-K]){
        cout<<"Yes"<<endl;
      }else{
        cout<<"No"<<endl;
      }
    }
  }
}


Measured memory_bytes: 4840
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache
import heapq

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    N = cin.int()
    H = cin.mapInt()
    m = [0] * (N)
    for i in reversed(range(N - 1)):
        if H[i] >= H[i + 1]:
            m[i] = m[i + 1] + 1
        else:
            m[i] = 0
    print(max(m))
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 64240
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 2000000
using namespace std;

int a[maxn+5],h;

void maxheapfy(int i)
{
    int l=i*2;
    int r=i*2+1;
    int large;
    if(l<=h && a[l]>a[i])
        large=l;
    else large=i;
    if(r<=h && a[r]>a[large])
        large=r;

    if(large!=i)
    {
         swap(a[i],a[large]);
         maxheapfy(large);
    }

}

int main()
{
    scanf("%d",&h);
    for(int i=1;i<=h;i++)
        scanf("%d",&a[i]);
    for(int i=h/2;i>=1;i--)
    {
        maxheapfy(i);
    }
    for(int i=1;i<=h;i++)
    {
        printf(" %d",a[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 5116
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, sta, n) for (int i = sta; i < (n); ++i)
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
const int mod = 1000000007;

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
    public static void main(String [] args)
    {
        Scanner key = new Scanner(System.in);
        int eight = key.nextInt();
        int ten = key.nextInt();
        int value = 0;
        int flag = -1;
        end:
        for(int i = 1; i<1001; i++)
        {
            double a = i*(0.08);
            if((int)a == eight)
            {
                double b = i*(0.1);
                if((int)b == ten)
                {
                    flag = 0;
                    value = i;
                    break end;
                }
            }
        }
        if(flag == 0)
            System.out.println(value);
        else
            System.out.println("-1");
    }
}

Measured memory_bytes: 23892