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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left!=NIL){
    x = x->left;
    return x;
  }

}

Node treeMaximum(Node x){

  while(x->right!=NIL){
    x = x->right;
    return x;
  }

}

Node treeSearch(Node u, int k){

  Node x;

  if(x==NIL || k==x->key){
    return x;
      }
  if(k<x->key){
    return treeSearch(x->left,k);
    }
    else{
      return treeSearch(x->right,k);
	}
}

Node treeSuccessor(Node x){
  Node y;

  if(x->right !=NIL){
    return treeMinimum(x->right);
  }
  y=x->parent;

  while(y!=NIL && x!=y->right){
    x=y;
    y=y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
    z->parent=y;

    if(y==NIL) root = z;
    else if(z->key < y->key){
      y->left = z;
    }
    else{
      y->right=z;
    }
  }


void inorder(Node u){
  if(u!=NIL){
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
 }
}
 
  
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!=NIL)preorder(u->left);
  if(u->right!=NIL) preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24040
#include<iostream>

using namespace std;

int main(){
    int N,i,j,k,tmp;
    cin >> N;
    int a[N];
    for (i=0;i<N;i++){
        cin >> a[i];
    }
    for (j=0;j<N/2;j++){
        tmp = a[j];
        a[j] = a[N-j-1];
        a[N-j-1] = tmp;
    }
    for(k=0;k<N-1;k++){
        cout << a[k] << " ";
    }
    cout << a[N-1] <<endl;
}


Measured memory_bytes: 3092
using System.Collections.Generic;
using System.Linq;
using System;

public static class Permi
{
    public static IEnumerable<IEnumerable<T>> Perm<T>(this IEnumerable<T> items, int? k = null)
    {
        if (k == null) k = items.Count();
        if (k == 0) yield return Enumerable.Empty<T>();
        else
        {
            var i = 0;
            foreach (var x in items)
            {
                var xs = items.Where((_, index) => i != index);
                foreach (var c in Perm(xs, k - 1))
                    yield return c.Before(x);
                i++;
            }
        }
    }
    public static IEnumerable<T> Before<T>(this IEnumerable<T> items, T first)
    {
        yield return first;
        foreach (var i in items) yield return i;
    }
}

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var org = "";
        for (int i = 0; i < n; i++) org += line[i];
        var org2 = int.Parse(org);
        var a = Enumerable.Range(1, n).Perm();
        var w = new int[fact(n)];
        var p = 0;
        var temp = "";
        foreach (var x in a)
        {
            temp = "";
            foreach (var xx in x)
                temp += xx.ToString();
            w[p++] = int.Parse(temp);
        }
        Array.Sort(w);
        var r = Array.BinarySearch(w, org2);
        for (int i = r - 1; i <= r + 1; i++) print(w, i);
    }
    public static void print(int[] w, int n)
    {
        var wL = w.Length;
        if (n < 0 | n >= wL) return;
        var t = w[n].ToString();
        for (int i = 0; i < t.Length; i++)
        {
            if (i == t.Length - 1) Console.WriteLine(t[i]);
            else Console.Write("{0} ", t[i]);
        }
    }
    public static int fact(int n)
    {
        var ret = 1;
        for (int i = 1; i <= n; i++) ret *= i;
        return ret;
    }
}




Measured memory_bytes: 12448
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
using namespace std;
int main(void){
  int n,i,j,k;
  string s[210];
  vector<int> g[210];
  cin >> n;
  for (i=0;i<n;i++) cin >> s[i];
  for (i=0;i<n;i++) for (j=0;j<n;j++){
    if (s[i][j]=='1'){
      g[i].push_back(j);
      g[j].push_back(i);
    }
  }
  
  int p,e,c[210]={};
  bool ans=true;
  queue<int> que;
  c[0]=1;
  que.push(0);
  while (!que.empty()){
    p=que.front();
    que.pop();
    e=c[p];
    for (i=0;i<g[p].size();i++){
      if (c[g[p][i]]==e){
        ans=false;
        break;
      }
      if (c[g[p][i]]==0){
        c[g[p][i]]=-e;
        que.push(g[p][i]);
      }
    }
    if (!ans) break;
  }
  if (!ans){
    cout << -1 << endl;
    return 0;
  }
  
  int d[210][210]={},dmax=0;
  const int INF=1e9;
  bool con=true;
  for (i=0;i<n;i++) for (j=0;j<n;j++){
    if (i==j) continue;
    if (s[i][j]=='1') d[i][j]=1;
    else d[i][j]=INF;
  }
  while (con){
    con=false;
    for (i=0;i<n-1;i++) for (j=i+1;j<n;j++){
      for (k=0;k<n;k++) if (d[i][j]>d[i][k]+d[k][j]){
        d[i][j]=d[j][i]=d[i][k]+d[k][j];
        con=true;
      }
    }
  }
  for (i=0;i<n;i++) for (j=0;j<n;j++){
    if (dmax<d[i][j]) dmax=d[i][j];
  }
  cout << dmax+1 << endl;
  return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
using namespace std;

int main() {
    int N;

    cin >> N;
    vector <int> val(N);
    unordered_map <int, int> cnt;

    for (int i = 0; i < N; ++i) {
        cin >> val[i];
        ++cnt[val[i]];
    }

    long long sum = 0;

    auto iter = cnt.begin();

    while (iter != cnt.end()) {
        sum += (iter->second * (iter->second - 1LL)) / 2;
        ++iter;
    }

    for (int i = 0; i < N; ++i) {
        long long vcnt = cnt[val[i]];

        cout << sum - (vcnt * (vcnt-1))/2 + (vcnt-1)*(vcnt-2)/2 << endl;
    }

    return 0;
}

Measured memory_bytes: 8392
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
while (true) {
   var n = arr.shift() - 0;
   if (n == 0) break;
   var nww = [];
   for (var i = 0; i < n; i++) nww[i] = arr.shift().split(" ");
   nww = nww.map(v => [v[0], v[1] - 0, v[2] - 0]);
   nww.sort((a,b)=>{
      return b[1]-a[1];
   });
   var max = 0;
   var ans = [];
   var bomb = function (strA, strB, sum, g) {
      if (strB.length == 0) {
         if (max < g / sum) {
            ans = strA;
            max = g / sum;
         }
         return;
      }
      for(var i=0;i<strB.length;i++){
         var v=strB[i];
         if (sum <= nww[v][2]) {
            var a = strA+v;
            var b = strB.replace(v,"");
            bomb(a, b, sum + nww[v-0][1], g + nww[v-0][1] * (strA.length + 1));
         }
      }
   };
   var str = "";
   for (var i = 0; i < n; i++) str+=i;
   bomb("", str, 0, 0);
   console.log(ans.split("").map(v => nww[v-0][0]).reverse().join("\n"));
}


Measured memory_bytes: 19308
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

void z_algorithm(const string& s, vector<ll>& A) {
    A.resize(s.size(), 0);
    A[0] = s.size();

    int i = 1, j = 0;
    while(i < s.size()) {
        while(i + j < s.size() && s[i + j] == s[j]) ++j;
        A[i] = j;
        if (j == 0) {++i; continue;}
        int k = 1;
        while(i + k < s.size() && k + A[k] < j) A[i+k] = A[k], ++k;
        i += k; j -= k;
    }
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    string S;

    cin >> N;
    cin >> S;

    ll ans = 0;
    REP(i, N) {
        string s = S.substr(i, S.size());
        vector<ll> A(s.size());

        z_algorithm(s, A);

        REP(j, A.size()) {
            if (j > A[j] - 1) ans = max(A[j], ans);
        }
    }

    print(ans);
}


Measured memory_bytes: 3716
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    cin >> k;
    queue<ll> que;
    rep(i,9) que.push(i+1);
    while(k > 0){
        ll p = que.front();
        que.pop();
        if(--k == 0){
            cout << p << endl;
            return 0;
        }
        ll r = p % 10;
        if(r-1 >= 0) que.push(p*10 + r-1);
        que.push(p*10 + r);
        if(r+1 <= 9) que.push(p*10 + r+1);
    }
    return 0;
}


Measured memory_bytes: 4764
s=list(input())
B=0;W=0;b=0;w=0
for i in range(len(s)):
  if s[i]=='B':B+=i+1
  elif s[i]=='W':W+=i+1
x=B-W
t=sorted(s)
t.reverse()
for j in range(len(t)):
  if t[j]=='B':b+=j+1
  elif t[j]=='W':w+=j+1
y=b-w
print(int(abs(x-y)/2))

Measured memory_bytes: 6692
#include <bits/stdc++.h>
#define MOD 1000000007

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}


template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
	ModInt &operator^=(long long p){
		ModInt res = 1;
		for (; p; p >>= 1) {
			if (p & 1) res *= *this;
			*this *= *this;
		}
		return *this = res;
	}
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
	ModInt operator^(long long p)const{return ModInt(*this)^=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    explicit operator int() const { return x; }                           // added by QCFium
    ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            std::swap(a,b);
            u-=t*v;
            std::swap(u,v);
        }
        return ModInt(u);
    }
    friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};
typedef ModInt<MOD> mint;

struct MComb {
    std::vector<mint> fact;
    std::vector<mint> inversed;
    MComb(int n) { // O(n+log(mod))
        fact = std::vector<mint>(n+1,1);
        for (int i = 1; i <= n; i++) fact[i] = fact[i-1]*mint(i);
        inversed = std::vector<mint>(n+1);
        inversed[n] = fact[n] ^ (MOD-2);
        for (int i = n - 1; i >= 0; i--) inversed[i]=inversed[i+1]*mint(i+1);
    }
    mint ncr(int n, int r) {
        return (fact[n] * inversed[r] * inversed[n-r]);
    }
    mint npr(int n, int r) {
        return (fact[n] * inversed[n-r]);
    }
    mint nhr(int n, int r) {
        assert(n+r-1 < (int)fact.size());
        return ncr(n+r-1, r);
    }
};


int main() {
	int n = ri();
	int a[n + 1];
	for (int i = 0; i <= n; i++) a[i] = ri();
	
	int l, r;
	std::map<int, int> used;
	for (int i = 0; i <= n; i++) {
		if (used.count(a[i])) l = used[a[i]], r = i;
		else used[a[i]] = i;
	}
	MComb com(n + 1);
	int amari = l + (n - r);
	for (int i = 1; i <= n + 1; i++) {
		std::cout << com.ncr(n + 1, i) - (i - 1 <= amari ? com.ncr(amari, i - 1) : 0) << std::endl;
	}
	
	return 0;
}



Measured memory_bytes: 7040
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
#include <math.h>

using namespace std;
using ll = long long;

int main() {

	int n, k;
	cin >> n >> k;
	
	if (k == 1)
		cout << 0 << endl;
	else
		cout << n - k << endl;

	cin >> n;
}


Measured memory_bytes: 256
import copy
n,k = map(int,input().split())
p = list(map(int,input().split()))

ans = sum(p[:k])
ans_tmp = copy.copy(ans)

for i in range(n-k):
    ans_tmp += p[k+i] - p[i]
    ans = max(ans,ans_tmp)


print((ans+k)/2)


Measured memory_bytes: 25692
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}

int n,m,v,p;
vector<pi>vec;
int a[M+3];
bool vis[M+3];
bool chk(int idx)
{
   int big=p-1;
   int use=v-1;
   int mn=min(big,use);
   big-=mn;
   use-=mn;
   vector<pi>yo;
   if(vis[idx])return true;
   int mx=vec[idx].fi+m;
   int sum=use*m;
   //cout<<sum<<" ### "<<endl;
   for(int i=p-1;i<n;i++)
   {
       if(i==idx)continue;
       int val=vec[i].fi;
       int gap=mx-val;
       if(gap<0)
       {
           //cout<<i<<" "<<mx<<" "<<val<<endl;
       }
       if(gap<0)return false;
       int can=min(gap,m);
       sum-=can;
   }
   if(sum<=0)return true;
   else return false;
}
 main()

{
    fast
    cin>>n>>m>>v>>p;
    f(i,1,n)
    {
        int x;
        cin>>x;
        a[i]=x;
        vec.pb(mp(x,i));
    }
    sort(vec.rbegin(),vec.rend());
    int last;
    for(int i=0;i<p;i++)
    {
        vis[i]=true;
        last=vec[i].fi;
    }
    for(int i=p;i<n;i++)
    {
        if(vec[i].fi==last)
        {
            vis[i]=true;
        }
        else break;
    }
   // cout<<chk(3)<<"#"<<endl;
    int lo=0,hi=n-1;
    while(hi-lo>=2)
    {
        int mid=(lo+hi)>>1;
        if(chk(mid))lo=mid;
        else hi=mid-1;
    }
    int ses=-1;
    for(int i=lo;i<=hi;i++)
    {
        if(chk(i))ses=i;
    }
    if(ses==-1)
    {
        cout<<"0"<<endl;
        return 0;
    }
    ses=ses+1;
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 3956
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long long int sum=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                int a=__gcd(i, j);
                sum+=__gcd(a,k); 
            }
        }
    }
    cout<<sum<<"\n";
}

Measured memory_bytes: 3636
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long 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 debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int dp[1<<12];

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,m;
   cin>>n>>m;
   int a[m];
   int cost[m];
   for(int i=0;i<m;i++)
   {
       cin>>cost[i];
       int k;
       cin>>k;
       int val=0;
       for(int j=0;j<k;j++)
       {
           int x;cin>>x;
           x--;
           val+=(1LL<<x);
       }
       a[i]=val;
   }
   memset(dp,0x3f,sizeof(dp));
   dp[0]=0;
   int full_mask=(1LL<<n)-1;
   for(int mask=0;mask<=full_mask;mask++)
   {
       for(int i=0;i<m;i++)
       {
           dp[a[i]|mask]=min(dp[a[i]|mask],dp[mask]+cost[i]);
       }
   }
   if(dp[full_mask]>1e18)
    cout<<-1<<endl;
   else
   cout<<dp[full_mask]<<endl;



}



Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

a.sort_by! { |a| -a }

if a.find_index(0) != nil
    puts 0
    exit
end

c = 10 ** 18

r = 1
a.each { |v|
    r *= v
    if r > c
        puts -1
        exit
    end
}

puts r

Measured memory_bytes: 26276
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Multiple of 9
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

char s[MAX_N + 4];

/* subroutines */

/* main */

int main() {
  scanf("%s", s);

  int sum = 0;
  for (int i = 0; s[i]; i++) sum += s[i] - '0';

  if (sum % 9 == 0) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 3284
#include <stdio.h>
#include <math.h>

int main()
{
	double r;
	double s, c;
	
	scanf("%lf", &r);

	s = r * r * M_PI;
	c = 2 * r * M_PI;
	
	printf("%lf %lf", s, c);
	
	return 0;
}

Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t,u;
  cin >> s >> t >> u;
  char a,b,c;
  a=s.at(0)-32;
  b=t.at(0)-32;
  c=u.at(0)-32;
  cout << a<<b<<c;
}

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

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

  long long int sum = 0;
  int i;

  for(i = 0;i<n;i++)
  {
  	if(i>0)
  	{
  		int y=min(A[i],B[i-1]);
  		A[i]-=y;
  		B[i-1]-=y;
  		sum+=y;
  	}
  	int x=min(A[i],B[i]);
  	sum+=x;
  	A[i]-=x;
  	B[i]-=x;
  }
  sum+=min(A[n],B[n-1]);


  cout<<sum<<endl;
  return 0;
}

// #include <bits/stdc++.h>

// using namespace std;

// template <class T>inline T updmax(T &a, T b) { return a = max(a, b); }
// template <class T>inline T updmin(T &a, T b) { return a = min(a, b); }

// int main()
// {
// 	ios_base::sync_with_stdio(false);
// 	cin.tie(nullptr);
// 	int n;
// 	cin >> n;
// 	vector<int> a(n+1, 0), b(n, 0);
// 	for(int i=0; i<n+1; i++)cin >> a[i];
// 	for(int i=0; i<n; i++)cin >> b[i];
// 	long long ret = 0;
// 	for(int i=0; i < n; i++){
// 		int x = min(a[i], b[i]);
// 		a[i]-=x;
// 		b[i]-=x;
// 		int y = min(a[i+1], b[i]);
// 		a[i+1]-=y;
// 		b[i]-=y;
// 		ret += x+y;
// 	}
// 	cout << ret << "\n";
	
// 	return 0;
// }


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int a,b;cin>>a>>b;
  vector<int> c(a);
  for(int i = 0; a > i; i++){
    cin>>c[i];
  }
  vector<int> f[a];
  for(int i = 0; b > i; i++){
    int d,e;cin>>d>>e;d--;e--;
    f[d].push_back(e);
    f[e].push_back(d);
  }
  int ans = 0;
  for(int i = 0; a > i; i++){
    bool nya = true;
    for(int j = 0; f[i].size() > j; j++){
      if(c[i]<=c[f[i][j]]){
        nya = false;
        break;
      }
    }
    if(nya)ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 8776
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100000;

// ──────────────────────────────────────────────────────────────────

// UnionFind 解説：https://youtu.be/TdR816rqc3s?t=8424

int w, h, t[50][50], cnt = 0;
bool check[50][50];

void dfs(ii pos) {
	int y = pos.first;
	int x = pos.second;

	rep(i, 8) {
		int nx = x + dx[i], ny = y + dy[i];

		if (0 <= nx && nx < w &&
			0 <= ny && ny < h &&
			check[ny][nx] == false &&
			t[ny][nx] == 1) {
			check[ny][nx] = true;
			dfs({ ny,nx });
		}
	}
}

int main() {
	vi ans;
	while (true) {
		cin >> w >> h;

		if (!w && !h) break;

		cnt = 0;
		rep(i, 50) rep(j, 50) check[i][j] = false;
		rep(i, h) rep(j, w) cin >> t[i][j];

		rep(i, h) {
			rep(j, w) {
				if (t[i][j] == 1 && check[i][j] == false) {
					check[i][j] = true;
					dfs({ i, j });
					cnt++;
				}
			}
		}
		ans.push_back(cnt);
	}
	rep(i, ans.size()) cout << ans[i] << endl;
}


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

public class Main {

	/** 「紙」を配列として定義 */
	private static int[][] paper = new int[10][10];

	/** インクのサイズ：小を表す数字 */
	private final static String INK_SIZE_S = "1";

	/** インクのサイズ：中を表す数字 */
	private final static String INK_SIZE_M = "2";

	/** インクのサイズ：大を表す数字 */
	private final static String INK_SIZE_L = "3";

	/** 色のついていない部分のマス目の個数：初期値100 */
	private static int plainCells = 100;

	/** 一番濃いマス目の濃さ */
	private static int maximumValue = 0;

	/**
	 *
	 *
	 * @param args
	 *            利用しない。
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {

		// 入力値を受け取る
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// インクを垂らす
		String line = null;
		while ((line = br.readLine()) != null) {

			String[] inkInfo = line.split(",");
			int x = Integer.parseInt(inkInfo[0]);
			int y = Integer.parseInt(inkInfo[1]);
			String size = inkInfo[2];

			// 小のサイズのインクの濃さを加算
			dropInk(x, y); // 真ん中
			dropInk(x - 1, y); // 左
			dropInk(x + 1, y); // 右
			dropInk(x, y - 1); // 下
			dropInk(x, y + 1); // 上

			if (INK_SIZE_S.equals(size)) {
				continue;
			}

			// 中のサイズのインクの濃さを加算
			dropInk(x - 1, y - 1); // 左下
			dropInk(x - 1, y + 1); // 左上
			dropInk(x + 1, y - 1); // 右下
			dropInk(x + 1, y + 1); // 右上

			if (INK_SIZE_M.equals(size)) {
				continue;
			}

			// 大のサイズのインクの濃さを加算
			dropInk(x - 2, y); // 2つ左
			dropInk(x + 2, y); // 2つ右
			dropInk(x, y - 2); // 2つ下
			dropInk(x, y + 2); // 2つ上
		}

		// 結果を出力
		System.out.println(plainCells); // 色のついていない部分のマス目の個数
		System.out.println(maximumValue); // １番濃いマス目の濃さ
	}

	/**
	 * <p>
	 * 引数で指定されたマス目にインクを落とせるか（「紙」の大きさの範囲内か）を確認し、 落とせる場合はマス目の濃さを+1する。</br>
	 * この際、インクを落としたマス目の濃さが0であれば「色のついていない部分のマス目の個数」から1を引く。<br/>
	 * 「一番濃いマス目の濃さ」よりも濃くなるのであれば濃さを更新する。<br/>
	 * </p>
	 *
	 * @param x
	 *            インクを落とすマス目のx座標
	 * @param y
	 *            インクを落とすマス目のy座標
	 */
	private static void dropInk(int x, int y) {

		if (0 <= x && x < 10 && 0 <= y && y < 10) {
			if (paper[x][y] == 0) {
				plainCells -= 1;
			}

			paper[x][y] += 1;

			if (paper[x][y] > maximumValue) {
				maximumValue = paper[x][y];
			}

		}
	}

}

Measured memory_bytes: 16924
#Dubious Document 2
SD = input()
T = input()
wordList = []
for i in range(len(SD)-len(T)+1):
    #print('i %s' % i) #
    found = True
    for j in range(len(T)):
        #print('j %s' % j) #
        if T[j]==SD[i+j] or SD[i+j]=='?': continue
        else:
            found = False
            break
    if found: 
        s = SD[:i]
        for j in range(len(T)): s +=  T[j]
        s += SD[i+len(T):]
        wordList.append(s)
wordList.sort()
#print(wordList) #
if wordList==[]:
    S = 'UNRESTORABLE'
else:
    S = ''
    for c in wordList[0]:
        if c=='?': S += 'a'
        else:    S += c
print(S)



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

int main() {
  int n,k,s;
  cin>>n>>k;
  s = 1;
  for(int i=0; i<n; i++){
    int a,b;
    a = 2*s;
    b = s + k;
    if(a>b){
      s = b;
    }
    else{
      s = a;
    }
  }
  cout<<s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
     int a,b,c,X;
     cin >> a >> b >> c >> X;
     int cnt = 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) cnt++;
               }
          }
     }
     cout << cnt << endl;
}

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

int main()
{
  int h, w;
  const int n = 101;
  cin >> h >> w;
  char masu[101][101];
  int d[101][101];
  int dx[2] = {0, 1}, dy[2] = {1, 0};
  int gx = w - 1, gy = h - 1;

  for (int i = 1; i <= h; ++i)
  {
    string s;
    cin >> s;
    for (int j = 1; j <= w; ++j)
    {
      masu[i][j] = s[j - 1];
      d[i][j] = INT_MAX;
    }
  }

  if (masu[1][1] == '.')
  {
    d[1][1] = 0;
  }
  else
  {
    d[1][1] = 1;
  }

  for (int i = 1; i <= h; ++i)
  {
    for (int j = 1; j <= w; ++j)
    {
      if (i + 1 <= h)
      {
        if (masu[i + 1][j] == '#')
          d[i + 1][j] = min(d[i + 1][j], d[i][j] + (masu[i][j] == '.'));
        else
          d[i + 1][j] = min(d[i + 1][j], d[i][j]);
      }
      if (j + 1 <= w)
      {
        if (masu[i][j + 1] == '#')
          d[i][j + 1] = min(d[i][j + 1], d[i][j] + (masu[i][j] == '.'));
        else
          d[i][j + 1] = min(d[i][j + 1], d[i][j]);
      }
    }
  }

  cout << d[h][w] << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
const int MX = 200005;
//----------------------------------------------------------------

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------
void Main(){
  vi a(3);
  cin>>a;
  sort(rng(a));
  int ans=0;
  ans+=a[2]-a[1];
  a[0]+=ans;
  a[1]+=ans;
  ans += dup(a[1]-a[0],2);
  if((a[1]-a[0])%2==1) ans++;
  cout<<ans<<endl;
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 2000000

int n,tree[MAX+1];

void maxHeapify(int i){
  int l,r,large,t;
  l=2*i;
  r=2*i+1;
  if(l<=n&&tree[l]>tree[i])large=l;
  else large=i;
  if(r<=n&&tree[r]>tree[large])large=r;
  if(large!=i){
    t=tree[i];
    tree[i]=tree[large];
    tree[large]=t;
    maxHeapify(large);
  }
}

int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&tree[i]);
  for(i=n/2;i>=1;i--)maxHeapify(i);
  for(i=1;i<=n;i++)printf(" %d",tree[i]);
  printf("\n");

  return 0;
}



Measured memory_bytes: 3816
import numpy as np

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

X = [[] for _ in range(N)]

for i in range(N):
    X[i] = list(map(int,input().split()))
    
def dist(x,y):
    temp = 0
    for i in range(D):
        temp += (x[i]-y[i])**2
    
    return np.sqrt(temp)

ans = 0    

for i in range(N):
    for j in range(i+1,N):
        dic = dist(X[i],X[j])
        
        if dic%1 == 0:
            ans += 1
        
print(ans)

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

int findSumOfDigits (int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}


int main() {
  int N;
  cin >> N;
  int A, B;
  cin >> A >> B;
  int tmp_sum = 0;
  int all_sum = 0;

 
  for (int i = 1; i <= N; i++) {
    tmp_sum = findSumOfDigits(i);
    if (tmp_sum >= A && tmp_sum <= B) {
      all_sum += i;
    }
  }
  cout << all_sum << endl;
}

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

int main(){
  int h,w;
  cin >> h >> w;
  queue<pair<int,int>> q;

  vector<vector<char>> a(h,vector<char> (w));
  vector<vector<int>> cost(h,vector<int> (w,-1));

  for (int i = 0; i < h; i++)
  {
    for (int j = 0; j < w; j++)
    {
      cin >> a[i][j];
      if(a[i][j]=='#') {
        cost[i][j]=0;
        q.emplace(i,j);
      }
    }
  }

  int dx[4] = {0,0,1,-1};
  int dy[4] = {1,-1,0,0};
  int ans = 0;
  while(!q.empty()){
    pair<int,int> p = q.front();
    int y = p.first;
    int x = p.second;
    q.pop();

    for (int i = 0; i < 4; i++)
    {
      if(x+dx[i]<w && x+dx[i]>=0 && y+dy[i]< h && y+dy[i]>=0 && cost[y+dy[i]][x+dx[i]]==-1){
        cost[y+dy[i]][x+dx[i]] = cost[y][x] + 1;
        q.emplace(y+dy[i],x+dx[i]);
        ans = max(ans,cost[y+dy[i]][x+dx[i]]);
      }
    }
  }
    cout << ans << endl;
}

Measured memory_bytes: 13456
S = input()
N = len(S)
ans = 0
def dfs(i, s=S[0]):
    if i == N-1:
        global ans
        ans += eval(s)
        return
    dfs(i+1, s+'+'+S[i+1])
    dfs(i+1, s+S[i+1])
dfs(0)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,m;
        cin>>n>>m;
        if(abs(n-m)>1)
        cout<<"0";
        else
        {
            if(n==m)
            {
                ll k=fact(n);
                ll ans=(k*k*2)%1000000007;
                cout<<ans;
            }
            else
            {
                ll k=fact(n);
                ll l=fact(m);
                ll ans=(k*l)%1000000007;
                cout<<ans;
            }
        }
    }    
    return 0;
}


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

int main() {
    string s;
    int counter[26] = {0};
    
    while (getline(cin, s)) {
        for (int i = 0; i < s.size(); i++) {
            if (isupper(s[i])) {
                s[i] = tolower(s[i]);
            }
            
            if (isalpha(s[i])) {
                int num = s[i] - 'a';
                counter[num]++;
            }
            
        }
    }
    
    for (int i = 0; i < 26; i++) {
        char a = 97 + i;
        cout << a << " : " << counter[i] << endl;
    }
    
    return 0;
    
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll A[MAXN];
ll dp[MAXN][3];
char op[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>A[1];
	for (int i=2; i<=n; i++) cin>>op[i-1]>>A[i];
	
	dp[1][0]=A[1];
	dp[1][1]=dp[1][2]=-INF;
	for (int i=2; i<=n; i++){
		if (op[i-1]=='+'){
			dp[i][0]=max({dp[i-1][0], dp[i-1][1], dp[i-1][2]})+A[i];
			dp[i][1]=max({dp[i-1][1], dp[i-1][2]})-A[i];
			dp[i][2]=dp[i-1][2]+A[i];
		}
		else{
			dp[i][0]=-INF;
			dp[i][1]=max({dp[i-1][0], dp[i-1][1], dp[i-1][2]})-A[i];
			dp[i][2]=max({dp[i-1][1], dp[i-1][2]})+A[i];
		}
	}
	cout<<max({dp[n][0], dp[n][1], dp[n][2]})<<'\n';
		
	return 0;
}


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

using namespace std;

const int md = int(1e9) + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

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

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

  vector< vector<int> > dp(n + 1, vector<int>(k + 1));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    vector<int> sum(k + 2);
    for (int j = 0; j <= k; j++) {
      add(sum[j + 1], sum[j]);
      add(sum[j + 1], dp[i][j]);
      add(dp[i + 1][j], sum[j + 1]);
      sub(dp[i + 1][j], sum[max(0, j - a[i])]);
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}

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

int main() {
    const long long MOD = 1000000007;
    long long N; 
    cin >> N;
    long long A;

    long long ans = 0;
    long long souwa = 0;
    for(int i = 0; i < N; i++){
        cin >> A;
        ans += souwa * A % MOD;
        souwa += A % MOD;

        if(souwa > MOD){
            souwa = souwa % MOD;
        }
        
        if(ans > MOD){
            ans = ans % MOD;
        }

    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
   int N, M;
   cin >> N >> M;
   cout << (100 * N + 1800 * M) * pow(2, M) << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <numeric>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>
#include <cctype>
#include <string>
#include <cfloat>
#include <array>
#include <fstream>


int main() {
	int l, r; std::cin >> l >> r;
	if (r - l >= 2019) {
		std::cout << 0 << '\n';
	}
	else {
		long long int min = INT_MAX;
		for (long long int i = l; i <= r; ++i) {
			for (long long int j = l; j < i; ++j) {
				min = std::min(min, i * j % 2019);
			}
		}
		std::cout << min << '\n';
	}
}


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

#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 rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double EPS = 1e-9;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

int n, m;

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	while (cin >> n >> m, n || m) {
		int t[n + 1], h[m + 1];
		int sum1 = 0, sum2 = 0;
		REP(i, 1, n + 1) {
			cin >> t[i];
			sum1 += t[i];
		}
		REP(i, 1, m + 1) {
			cin >> h[i];
			sum2 += h[i];
		}
		int ans1 = 100, ans2 = 100;
		REP(i, 1, n + 1) REP(j, 1, m + 1) {
			if (sum1 - t[i] + h[j] == sum2 + t[i] - h[j]) {
				ans1 = min(ans1, t[i]);
				ans2 = min(ans2, h[j]);
			}
		}
		if (ans1 != 100 && ans2 != 100) {
			cout << ans1 << ' ' << ans2 << endl;
		} else {
			cout << -1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

int main(){
    int a=0, b=0, c=0;
    
    // 読み込む
    std::cin >> a >> b >> c;

    if((1 <= a) && (1 <= b) && (1 <= c) && (a <= 10000) && (b <= 10000) && (c <= 10000)){
    
        int m=0;
        
        // 1番目と2番目を交換する
        if((a - b) > 0){
            m=a;
            a=b;
            b=m;
        }
        
        // 2番目と3番目を交換する
        if((b - c) > 0){
            m=b;
            b=c;
            c=m;
        }

        // 1番目と2番目を交換する
        if((a - b) > 0){
            m=a;
            a=b;
            b=m;
        }
    }
    
    // 出力
    std::cout << a << " " << b << " " << c << std::endl;
}


/*
 テストケース
 a,b,cがそれぞれ0より小さいケース
 a,b,cがそれぞれ10000より大きいケース
 a<b<c
 a<c<b
 b<a<c
 b<c<a
 c<a<b
 c<b<a
 
 1<b<c
 1<c<b
 0<a<b<10000
 0<b<a<10000
 
*/


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,k,a[5020];
bitset<5010> dp;
bool Nec(int num){
	dp.reset();
	dp[0]=1;
	for(int i=1;i<=n;i++){
		if(a[i]<k&&i!=num)
			dp|=(dp<<a[i]);
	}
	for(int i=k-a[num];i<k;i++){
		if(dp[i])
			return true;
	}
	return false;
}
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	int pos=n+1;
	for(int i=1;i<=n;i++)
		if(a[i]>=k){
			pos=i;
			break;
		}
	a[n+1]=2e9;
	int le=1,ri=pos,mi;
	while(le<ri){
		mi=(le+ri)>>1;
		if(Nec(mi))
			ri=mi;
		else
			le=mi+1;
	}
	cout<<le-1<<endl;
	return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ n, x ] <- readInts
	xs <- map ( abs . subtract x ) <$> readInts
	print $ foldl1 gcd xs

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

const int MAXN=110;

struct data
{
	char c;
	int num;
};

void Bubble_Sort(int n,data* A)
{
	for(int i=0;i<n;i++)
		for(int j=n-1;j>i;j--)
			if(A[j].num<A[j-1].num)
				std::swap(A[j],A[j-1]);
	for(int i=0;i<n;i++)
		printf("%c%d%c",A[i].c,A[i].num,i+1==n?'\n':' ');
	printf("Stable\n");
}

void Selection_Sort(int n,data* A,data* R)
{
	for(int i=0;i<n;i++)
	{
		int mi=i;
		for(int j=i+1;j<n;j++)
			if(A[j].num<A[mi].num) mi=j;
		if(mi!=i)
			std::swap(A[mi],A[i]);
	}
	bool flag=true;
	for(int i=0;i<n;i++)
	{
		printf("%c%d%c",A[i].c,A[i].num,i+1==n?'\n':' ');
		if(A[i].c!=R[i].c) flag=false;
	}
	if(flag) printf("Stable\n");
	else printf("Not stable\n");
}

int main()
{
	int n;
	data in[MAXN];
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		while(!isalpha(in[i].c=getchar()));
		scanf("%d",&in[i].num);
		//printf("%c%d%c",in[i].c,in[i].num,i+1==n?'\n':' ');
	}
	data BS[MAXN];
	memcpy(BS,in,sizeof(in));
	Bubble_Sort(n,BS);
	Selection_Sort(n,in,BS);
	return 0;
}

Measured memory_bytes: 3172
import numpy as np
import sys

def main():
    s = input()
    old = 'R'
    count =  0
    mass = 0
    op = [0 for i in range(len(s))]
    for i in range(len(s)):
        lr = s[i]
        if lr == old:
            count += 1

        else:
            if lr == 'L':
                rp = count//2
                lp = count - rp

                op[i] += rp
                op[i-1] += lp
                poi = i
                count = 1
            
            if lr == 'R':
                lp = count//2
                rp = count - lp
                op[poi] += rp
                op[poi-1] += lp
                count = 1
        old = lr
    if count:
        lp = count//2
        rp = count - lp

        op[poi] += rp
        op[poi-1] += lp

    print(' '.join(map(str,op)))


        
        


if __name__ == '__main__':
    main()

Measured memory_bytes: 20636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    //ios::sync_with_stdio(false);
    //freopen("data.txt", "r", stdin);

    int k,s,c=0;
    cin>>k>>s;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            if(i+j<=s && s-(i+j)>=0 && s-(i+j)<=k){
                c++;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
N, Y = map(int, input().split())


found = False
for i in range(N+1):
    for j in range(N+1):
        k = (Y - (10000*i + 5000*j)) // 1000
        if i + j + k == N and k >= 0:
            print(i, j, k)
            found = True
            break
    if found:
        break

if not found:
    print(-1, -1, -1)

Measured memory_bytes: 66140
#include<stdio.h>
#include<string.h>
int main()
{

       int a,j,i,count1=0,count2=0,count3=0,count4=0;

       scanf("%d",&a);

      for(i=1;i<=a;i++)
      {
         if(1<=i &&i <=9)
         {
             count1++;
         }
         else if(100<=i && i<=999)
         {
             count2++;
         }
         else if(10000<=i && i<=99999){
            count3++;
         }
         else if(1000000<=i && i<=9999999){
            count4++;
         }
         }

         printf("%d",count1+count2+count3+count4);

      }


Measured memory_bytes: 1700