akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;
 
void main() {
    auto s = readln.split.map!(to!long);
    auto N = s[0].to!int;
    auto L = s[1];
    auto T = s[2];
    auto A = new Tuple!(int, long, long)[](N);
    foreach (i; 0..N) {
        s = readln.split.map!(to!long);
        A[i] = tuple(i, s[0], s[1]);
    }
 
    long conflict = 0;
    foreach (i; 0..N) {
        if (A[0][2] == 1 && A[i][2] == 2) {
            long t = 2 * T - A[i][1] + A[0][1];
            if (t >= 0)
                conflict += t / L + 1;
        } else if (A[0][2] == 2 && A[i][2] == 1) {
            long t = 2 * T - (L - A[i][1] + A[0][1]);
            if (t >= 0)
                conflict -= t / L + 1;
        }
        conflict = (conflict % N + N) % N;
    }
 
    auto B = new Tuple!(int, long)[](N);
    foreach (i; 0..N) {
        if (A[i][2] == 1) B[i] = tuple(i, (A[i][1] + T) % L);
        else B[i] = tuple(i, ((A[i][1] - T) % L + L) % L);
    }
    if (A[0][2] == 1) B.sort!"a[1] == b[1] ? a[0] > b[0] : a[1] < b[1]"();
    else B.sort!"a[1] == b[1] ? a[0] < b[0] : a[1] < b[1]"();

    debug B.writeln;
 
    foreach (i; 0..N) {
        if (B[i][0] == 0) {
            foreach (j; 0..N) B[(i + j) % N][0] = (conflict + j) % N;
            break;
        }
    }
 
    debug B.writeln;
    B.sort!"a[0] < b[0]"();
    foreach (b; B) b[1].writeln;
 
}


Measured memory_bytes: 6140
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int H, A;

  cin >> H >> A;

  cout << (H + A - 1) / A << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

using P = pair<string, string>;

map<P, int> build(const string& S) {
  const int N = S.size();
  map<P, int> mp;
  for (int m = 0; m < (1 << N); m++) {
    string a = "", b = "";
    for (int i = 0; i < N; i++) {
      if ((m >> i) & 1) {
        a += S[i];
      } else {
        b += S[i];
      }
    }
    ++mp[P(a, b)];
  }
  return mp;
}

int main() {
  int N;
  string S;
  while (cin >> N >> S) {
    string R = string(S.rbegin(), S.rend());
    auto F = build(S.substr(0, N));
    auto B = build(R.substr(0, N));
    ll res = 0;
    for (auto& entry : F) {
      P p = entry.first;
      P q = P(p.second, p.first);
      res += (ll)B[q] * entry.second;
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 109824
#include<bits/stdc++.h>
int main()
{
    int n;
    long long ans=0;
    std::cin>>n;
    for(register int i=1;i<=n;i++)
        if(i%3!=0&&i%5!=0)
            ans+=i;
    std::cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
typedef long long ll;
const  double PI = 3.141592654;
#define rep(i,x) for(int(i)=0;(i)<(ll)(x);(i)++)
#define all(s)      (s).begin(),(s).end()
#define allv(v)      (v).begin(),(v).end()
#define allr(v)      (v).rbegin(),(v).rend()
#define pb          push_back
#define sz          s.size()
#define ssz          ss.size()
#define vz          v.size()
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int dx[] = { 0, 0, -1, 1, -1, 1, -1, 1 };
int dy[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
//x = atoill(s.c_str())
void fast()
{
#ifndef ONLINE_JUDGE
	/*

	**    ** ** **    *********   ** ** **
	**    **          **     **   **
	**    **          *********   **
	**    **          **          **
	**    ** ** **    **          ** ** **
	*/
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(NULL), cout.tie(NULL);
}
int main()
{
	fast();
	int a, b, mo = 1, d = 1, c = 0;
	cin >> a >> b;
	while (1)
	{
		if (mo == a && d == b)
		{
			if (mo == d)
				c++;
			break;
		}
		if (d == 32)
			d = 0, mo++;
		if (mo == d)
			c++;
		d++;
	}
	cout << c;
	return 0;
}

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

int main(){
  int x,a,b;
  cin >> x >> a>> b;
  if(a-b>=0){cout << "delicious" << endl;}
  else if(a-b>=-x && a-b<0){cout << "safe" << endl;}
  else if(a-b<x){cout << "dangerous" << endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  long long int n,m,ans = 1;
  const long long int S = 1000000007;
  cin >> n;

  for(int i =1;i <= n;i++){
    ans *= i*1;
    ans = ans % S;
  }
  cout << ans << endl;
}


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

int main() {
  int N, a, b, c, d, e, f, g, h, i; 
  cin >> N; // a b c d e f g h
  a = N/10000000;
  b = (N-10000000*a)/1000000;
  c = (N-10000000*a-1000000*b)/100000;
  d = (N-10000000*a-1000000*b-100000*c)/10000;
  e = (N-10000000*a-1000000*b-100000*c-10000*d)/1000;
  f = (N-10000000*a-1000000*b-100000*c-10000*d-1000*e)/100;
  g = (N-10000000*a-1000000*b-100000*c-10000*d-1000*e-100*f)/10;
  h = (N-10000000*a-1000000*b-100000*c-10000*d-1000*e-100*f-10*g);
  i = a+b+c+d+e+f+g+h;
  
  if(N%i ==0) {
    cout << "Yes" <<endl;
  }
  else {
    cout <<"No" <<endl;
  }
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int w, h, n;
    cin >> w >> h >> n;

    vector<vector<bool>> table(h, vector<bool>(w, false));

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

        int sx, sy, ex, ey;
        switch (a)
        {
        case 1:
            sx = 0;
            ex = x;
            sy = 0;
            ey = h;
            break;
        case 2:
            sx = x;
            ex = w;
            sy = 0;
            ey = h;
            break;
        case 3:
            sx = 0;
            ex = w;
            sy = 0;
            ey = y;
            break;
        case 4:
            sx = 0;
            ex = w;
            sy = y;
            ey = h;
            break;
        }

        for (int j = sy; j < ey; j++)
        {
            for (int k = sx; k < ex; k++)
            {
                table[j][k] = true;
            }
        }
    }
    int count = 0;
    for (auto& row : table)
    {
        for (int i = 0; i < row.size(); i++)
        {
            if (!row[i])
            {
                count++;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
import java.util.*;
 
class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[100_001];
        
        Arrays.fill(b,0);
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
            b[a[i]]++;
        }
        
        int max = 0;
        for(int i=1; i<100_000; i++){
            if(max<b[i-1]+b[i]+b[i+1]){
                max=b[i-1]+b[i]+b[i+1];
            }
        }
        System.out.println(max);
    }
}

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

int main(void){
 int a,b;
 string s;
 cin>>a>>b>>s;
 bool ok=true;
 if(s.size()!=a+b+1){
     ok=false;
 } 
 for (int i=0;i<s.size();i++){
     if(i!=a){
         if(!(s[i]>='0'&&s[i]<='9')){
             ok=false;
             break;
         }
     }else{
         if(s[i]!='-'){
             ok=false;
         }
     }
 }
 if(ok==true){
     cout<<"Yes"<<endl;
 }else{
     cout<<"No"<<endl;
 }
 return 0;
}

Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll H = 0, W = 0;
    cin(H);cin(W);

    vector<vector<char>> S(H,vector<char>(W));
    for(int i=0;i<H;i++){
        for(int j =0; j<W;j++){
            cin(S[i][j]);
        }
    }

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

    for(int i=0;i<H;i ++){
        for(int j =0; j<W;j++){
            if(S.at(i).at(j)=='.'){
                int ans = 0;
                for(int l =0; l<8; l++){
                    int nx = j + dx[l];
                    int ny = i + dy[l];
                    if(nx<0 or nx>=W) continue;
                    if(ny<0 or ny>=H) continue;
                    if(S[ny][nx]=='#') ans++;
                }
                 string b = to_string(ans);
            const char* cs = b.data();
                S.at(i).at(j) = cs[0];
            }
        }
    
    
    }

    REP(i,H){
        REP(j,W){
            cout << S[i][j];
            if(j == W-1) cout << endl;
        }

    }


    //本文
    //出力
    //cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

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

int main(void){
int x,a,b;
int N;
string koe;
cin>>x>>a>>b;
cin>>N;

for(int i=0;i<N;i++){
cin>>koe;
if(koe=="nobiro")x=max(x+a,0);
else if(koe=="tidime")x=max(x+b,0);
else x=0;
}
cout<<x<<endl;

return 0;
}



Measured memory_bytes: 3176
class Tree():
    def __init__(self, n, edge, indexed=1):
        self.n = n
        self.tree = [[] for _ in range(n)]
        for e in edge:
            self.tree[e[0] - indexed].append(e[1] - indexed)
            self.tree[e[1] - indexed].append(e[0] - indexed)

    def setroot(self, root):
        self.root = root
        self.parent = [None for _ in range(self.n)]
        self.parent[root] = -1
        self.order = []
        self.order.append(root)
        stack = [root]
        while stack:
            node = stack.pop()
            for adj in self.tree[node]:
                if self.parent[adj] is None:
                    self.parent[adj] = node
                    self.order.append(adj)
                    stack.append(adj)

N = int(input())
edge = [tuple(map(int, input().split())) for _ in range(N - 1)]

tree = Tree(N, edge)
tree.setroot(0)

grundy = [0 for _ in range(N)]

for node in tree.order[::-1]:
    for adj in tree.tree[node]:
        if tree.parent[node] == adj:
            continue
        grundy[node] ^= grundy[adj] + 1

print('Alice' if grundy[0] != 0 else 'Bob')

Measured memory_bytes: 45408
/**< 🤣🤣🤣 */
#include<bits/stdc++.h>
using namespace  std ;
typedef long long  ll;
typedef pair<ll, ll> Pll;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define deb(X) cout << (X) << endl
#define ASH(X) cout << (X) << " "
#define debug(x) cout << #x << " " << x << endl;
#define debug2(x,y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define FOR(I,A,B) for(ll I = (A); I <= (B); I++)
#define RFOR(I,B,A) for(ll I = (B); I >=(A); I--)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define SORT(c) (sort(c.begin(),c.end()))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASES int ___T; cin >> ___T; for(int cs=1;cs<=___T;cs++)
#define FAST()  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//template<typename T>T gcd(T x, T y){if(y==0)return x;else return gcd(y,x%y);}
ll fx[] = {1, 1, 0, -1, -1, -1, 0, 1};
ll fy[] = {0, 1, 1, 1, 0, -1, -1, -1};
vector<ll>a1,b1,c1;


/************************************************/

void Execute()
{   ll n, y=0, x;
   FOR(i,1,5)
   {
       cin >> x;
       if(x==0) {y=i;}
   }
   deb(y);

}

int32_t main()
{   //  #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    //#endif

    FAST();
    //CASES
   // {
     Execute();
        //cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "sec \n";
    //}
}
/**< 🤣🤣🤣 */


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int N,K;
cin >> N >> K;
int sunuke[105] ={0};
for(int i = 1; i <= K; i++){
  int d ;
  cin >> d;
  int a[105];
  for(int j = 0; j < d ; j++){
    cin >> a[j];
  }
  for(int j = 0; j < d ; j++){
    sunuke[a[j]]++;
  }
}
int count = 0;
for(int k = 1; k < N +1 ; k++){
  if(sunuke[k] == 0)  count++;
}
cout << count << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ui unsigned int
#define ll long long
#define db double
#define ld long double
#define ull unsigned long long
const int MAXN=500+10,MAXM=30+10,inf=0x3f3f3f3f;
int n,m,was[MAXM][MAXM],G[MAXN][MAXN],ans=inf,value[4][MAXM];
template<typename T> inline void read(T &x)
{
	T data=0,w=1;
	char ch=0;
	while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(ch>='0'&&ch<='9')data=((T)data<<3)+((T)data<<1)+(ch^'0'),ch=getchar();
	x=data*w;
}
template<typename T> inline void write(T x,char ch='\0')
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
	if(ch!='\0')putchar(ch);
}
template<typename T> inline void chkmin(T &x,T y){x=(y<x?y:x);}
template<typename T> inline void chkmax(T &x,T y){x=(y>x?y:x);}
template<typename T> inline T min(T x,T y){return x<y?x:y;}
template<typename T> inline T max(T x,T y){return x>y?x:y;}
int main()
{
	read(n);read(m);
	for(register int i=1;i<=m;++i)
		for(register int j=1;j<=m;++j)read(was[i][j]);
	for(register int i=1;i<=n;++i)
		for(register int j=1;j<=n;++j)read(G[i][j]);
	for(register int i=1;i<=n;++i)
		for(register int j=1;j<=n;++j)
			for(register int k=1;k<=m;++k)value[(i+j)%3][k]+=was[G[i][j]][k];
	for(register int i=1;i<=m;++i)
		for(register int j=1;j<=m;++j)
			if(i!=j)
				for(register int k=1;k<=m;++k)
					if(i!=k&&j!=k)chkmin(ans,value[0][i]+value[1][j]+value[2][k]);
	write(ans,'\n');
	return 0;
}

Measured memory_bytes: 1280
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])

#1円効果の数
a = int(arr_data[1][0])


cnt =n //500

#print(cnt)

print("Yes" if n-cnt*500<=a else "No")
    

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

const int N = 1100;

int H, W, A, B;
char ans[N][N];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> H >> W >> A >> B;
	for (int i = 0; i < B * 2; i++) {
		for (int j = 0; j < W; j++)
			ans[i][j] = '0' + ((i & 1) ^ (A <= j));
	}
	for (int i = B * 2; i < H; i++) {
		for (int j = 0; j < W; j++)
			ans[i][j] = '0' + (A <= j);
	}
	for (int i = 0; i < H; i++)
		cout << ans[i] << '\n';
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

struct c {
	ll x, y;
	ld ang;
} z[101];

bool comp(c a, c b) {
	return a.ang < b.ang;
}

int main()
{
	// 入力
	ll N;
	cin >> N;

	// vector<c> z(N);
	REP(i, N) {
		cin >> z[i].x >> z[i].y;
		z[i].ang = atan2(z[i].y, z[i].x);
	}

	// vdebug(ang);
	sort(z, z + N, comp);

	double tempx, tempy;
	// double angmin, angmax;
	double ans = 0;
	ll j = 0;
	REP(i, N) {
		tempx = z[i].x;
		tempy = z[i].y;
		j = i + 1;
		j %= N;
			Max(ans, (double)sqrt(pow(tempx, 2) + pow(tempy, 2)));
		while (j != i) {
			tempx += z[j].x;
			tempy += z[j].y;
			Max(ans, (double)sqrt(pow(tempx, 2) + pow(tempy, 2)));
			j++;
			j %= N;
		}
	}

	cout << setprecision(150) << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

count = []
ans = 0
pt = [0 for i in range(n)]
for k, v in c.items():
  count.append([k,v])
  if v > 1:
    ans += v*(v-1)//2
    pt[k-1] = v-1
    
for i in a:
  print(ans - pt[i-1])
  

Measured memory_bytes: 102604
#include <iostream>
#include <stdio.h>
#include <cctype>
using namespace std;
int main(){


char ch;
for (;;){

	scanf("%c",&ch);
	if (islower(ch)){
		ch = toupper(ch);
    }
    else if (isupper(ch)){
    	ch = tolower(ch);
    }
	cout << ch;
	if (ch == '\n')break;
	
}


    return 0 ;


}   

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
// please, read the question correctly (do you need set or multiset)???
const int N=200010; //check the limits, dummy
int a[N];
int n, m, cnt[44];
char s[1000010];
string c[N];
ll mp1[5761455], mp2[5761537], mp3[5761543], mp4[5705543], mp5[5703199];
int main(){
	scanf("%d",&n);
	ll ans=0, mod1=5761455, mod2=5761537, mod3=5761543, mod4=5705543, mod5=5703199;
	for(int i=0; i<n; ++i){
		scanf("%s",s);
		int sz=strlen(s);
		c[i]=s;
		int hsh2=0, hsh1=0, hsh3=0, hsh4=0, hsh5=0;
		for(int j=sz-1; j>=0; --j){
			hsh1*=29;
			hsh1+=s[j]-'a'+1;
			hsh1%=mod1;
			hsh2*=31;
			hsh2+=s[j]-'a'+1;
			hsh2%=mod2;
			hsh3*=37;
			hsh3+=s[j]-'a'+1;
			hsh3%=mod3;
			hsh4*=41;
			hsh4+=s[j]-'a'+1;
			hsh4%=mod4;
			hsh5*=43;
			hsh5+=s[j]-'a'+1;
			hsh5%=mod5;
		}
		++mp1[hsh1];
		++mp2[hsh2];
		++mp3[hsh3];
		++mp4[hsh4];
		++mp5[hsh5];
	}
	for(int i=0; i<n; ++i){
		int sz=c[i].size();
		for(int j=0; j<26; ++j)
			cnt[j]=0;
		for(int j=0; j<sz; ++j){
			++cnt[c[i][j]-'a'];
		}
		ll hsh3=0, hsh4=0, hsh1=0, hsh2=0, tmp1, tmp2, tmp3, tmp4, hsh5=0, tmp5;
		for(int j=sz-1; j>=0; --j){
			for(int k=0; k<26; ++k){
				if(cnt[k]){
					tmp1=hsh1*29;
					tmp1+=k+1;
					tmp1%=mod1;
					tmp2=hsh2*31;
					tmp2+=k+1;
					tmp2%=mod2;
					tmp3=hsh3*37;
					tmp3+=k+1;
					tmp3%=mod3;
					tmp4=hsh4*41;
					tmp4+=k+1;
					tmp4%=mod4;
					tmp5=hsh5*43;
					tmp5+=k+1;
					tmp5%=mod5;
					ans+=min(min(min(mp3[tmp3], mp4[tmp4]),min(mp1[tmp1], mp2[tmp2])), mp5[tmp5]);
				}
			}
			hsh1*=29;
			hsh1+=c[i][j]-'a'+1;
			hsh1%=mod1;
			hsh2*=31;
			hsh2+=c[i][j]-'a'+1;
			hsh2%=mod2;
			hsh3*=37;
			hsh3+=c[i][j]-'a'+1;
			hsh3%=mod3;
			hsh4*=41;
			hsh4+=c[i][j]-'a'+1;
			hsh4%=mod4;
			hsh5*=43;
			hsh5+=c[i][j]-'a'+1;
			hsh5%=mod5;
			--cnt[c[i][j]-'a'];
		}
	}
	ans-=n;
	cout<<ans<<endl;
}


Measured memory_bytes: 234028
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long int lli;

int main()
{
	int n;
	int arr[3][3];
	for(int i=0;i<3;++i)
		for(int j=0;j<3;j++)
			cin>>arr[i][j];
	map<int,int>mp;
	cin>>n;
	int val;
	for(int i=0;i<n;i++)
	{
		cin>>val;
		mp[val]=1;
	}
	int cnt,chk;
	bool find=false;
	for(int i=0;i<3;i++)
	{
		cnt=0;
		for(int j=0;j<3;j++)
		{
			chk=arr[i][j];
			if (mp[chk])
				++cnt;
		}
		if (cnt==3)
		{
			find=true;
			break;
		}
	}
	for(int i=0;i<3;i++)
	{
		cnt=0;
		for(int j=0;j<3;j++)
		{
			chk=arr[j][i];
			if (mp[chk])
				++cnt;
		}
		if (cnt==3)
		{
			find=true;
			break;
		}
	}
	if (mp[arr[0][0]]+mp[arr[1][1]]+mp[arr[2][2]]==3)
		find=true;
	if (mp[arr[0][2]]+mp[arr[1][1]]+mp[arr[2][0]]==3)
		find=true;
	
	if (find)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	
	
	
	
	return 0;
}

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

#define int     long long int
#define pii     pair<int, int>
#define vi      vector<int>
#define vii     vector<pair<int, int>>
#define pb      push_back
#define all(a)  (a).begin(),(a).end()
#define f       first
#define s       second
#define endl    '\n'
#define mod     1000000007    		

void solve()
{
	int n ;
	cin >> n ;
	multiset<string> st ;
	for(int i = 0 ; i < n ; i++)
	{
		string s ;
		cin >> s ;
		st.insert(s) ;
	}
	cout << "AC x " << st.count("AC") << endl ;
	cout << "WA x " << st.count("WA") << endl ;
	cout << "TLE x " << st.count("TLE") << endl ;
	cout << "RE x " << st.count("RE") << endl ;
}

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

    int t = 1 ;
    //cin >> t ;
    while(t--)
    {
        solve() ;
    }
    return 0 ;
}

Measured memory_bytes: 11476
#prag\
ma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	ios::sync_with_stdio(false);
	int n,a;
	cin>>n>>a;
	for(int ff=1;ff<=200000;ff++) {
		int xx;
		xx++;
	}
	if((n%500)>a) cout<<"No";
	else cout<<"Yes";
}

Measured memory_bytes: 764
fun main(args: Array<String>) {
    val (N, K) = listOfInt()
    val H = IntArray(N) { nextInt() }.sorted()
    var ans = Int.MAX_VALUE
    for (n in 0 .. N - K) {
        ans = Math.min(ans, H[n + K - 1] - H[n])
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfInt() = listOfString().map(String::toInt)


Measured memory_bytes: 42120
#include <bits/stdc++.h>
using namespace std;
int main(){
    int  a, b ,c;
    char X,Y;
    string S1,S2,S3;
    cin >>a >> b >> c;
    if(a <= c && c <= b) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<algorithm>
using namespace std;
int main(){
  int n; cin >> n;
  unordered_map<string,long long> mp;
  for(int i=0;i<n;++i){
    string s; cin >> s;
    sort(s.begin(), s.end());
    mp[s]++;
  }
  long long ans = 0;
  for(auto c:mp){
    //cout << c.second << endl;
    ans += c.second*(c.second-1)/2;
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int N,M;
    string tmp;
    unordered_map<string, int> map;
    cin >> N;
    while(N--){
        cin >> tmp;
        if(map.count(tmp) == 0){
            map[tmp] = 1;
        }else{
            map[tmp]++;
        }
    }
    cin >> M;
    while(M--){
        cin >> tmp;
        if(map.count(tmp) == 0){
            map[tmp] == -1;
        }else{
            map[tmp]--;
        }
    }
    
    int max = 0;
    for(auto s : map){
        if(s.second > max) max = s.second;
    }
    cout << max << endl;
    return 0;
}


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

using namespace std;
#define ll long long
#define ull unsigned ll
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
const int N = 1e5 + 10;

int main() {
    int n;
    cin >> n;
    vector<bool> same(n);
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        same[i] = x == y;
    }
    for (int i = 0; i + 2 < n; ++i) {
        if (same[i] & same[i + 1] & same[i + 2])
            return cout << "Yes" << endl, 0;
    }
    cout << "No" << endl;
}

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

using namespace std;

#define int long long
#define f(i,from,to) for(int i = from ; i < to ; i++)
#define tie() ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int sz = 1e5 + 7;
int dp[sz];

int dfs(vector <int> g[] , int x)
{
    if(dp[x] != -1)
        return dp[x];
    int mx = 0;
    for(int node : g[x])
        mx = max(dfs(g , node) + 1, mx);
    return dp[x] = mx;
}

int32_t main()
{
    int n,p,mx = INT_MIN;cin>>n>>p;

    vector <int> g[n+1];

    f(i,0,p)
    {
        int a,b;cin>>a>>b;
        g[b].push_back(a);
    }


    memset(dp , -1 , sizeof dp);

    for(int i = 1 ; i <= n ;i++)
        if(dp[i] == -1)
            dp[i] = dfs(g , i);

    for(int i = 1 ; i<= n ; i++) mx = max(dp[i],mx);

    cout<<mx<<endl;
    return 0;
}


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

long long n,k,x[100005],l[100005],d[100005],p=-1;


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

    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>x[i];
        if(x[i]>0&&p==-1)
            p=i;
    }
    if(p==-1)
    {
        cout<<-x[n-k+1]<<endl;
        return 0;
    }
    else
    {
        long long o=1000000005;
        for(int i=0;i<=k;i++)
        {
            if(p+i-1>n)
                continue;
            else if(p-(k-i)>=1)
            {
                if(i==0)
                {
                    long long m=-x[p-k];
                    if(m<o)
                        o=m;
                }
                else if(i==k)
                {
                    long long m=x[p+k-1];
                    if(m<o)
                        o=m;
                }
                else
                {
                    long long m=-x[p-(k-i)]+x[p+i-1]+min(-x[p-(k-i)],x[p+i-1]);
                    if(m<o)
                        o=m;
                }
            }
        }
        cout<<o<<endl;
        return 0;
    }
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = double.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(double.Parse).ToArray();

            var mother = A.Select(z => 1 / z).Sum();
            Console.WriteLine(1/mother);

        }
    }
}


Measured memory_bytes: 13396
#coding utf-8
N,M=map(int,input().split())
A=list(map(int,input().split())) 
BC=[[int(i) for i in input().split()] for i in range(M)]
A.sort()
BC.sort(key=lambda x:x[1])
BC.reverse()

k=0
t=0
for i in range(M):
  if t==1 or k==N:
    break
  for j in range(BC[i][0]):
    if BC[i][1]>A[k]:
      A[k]=BC[i][1]
      k+=1
      if k==N:
        break
    else:
      t=1
      break
      
      
print(sum(A))    

Measured memory_bytes: 26688
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;

ll n;
int main() {
    //freopen("jumping.in", "r", stdin);
    IOS
    cin >> n;
    cout << 3 * (n*n) << endl;
    return 0;


}


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

int A[1000000], n;

int main(){
    int q, k, sum = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }

    cin >> q;
    for(int i = 0; i < q; i++){
        scanf("%d", &k);
        if(*lower_bound(A, A + n, k) == k) sum++;
    }
    
    cout << sum << endl;

    return 0;
}


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

using namespace std;

int N, M, a[5009], st[5009], mat[5009][209];
long long ans, x[5009], cost[5009][5009];

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &M);
for (int i=2; i<=N; i++)
{
    int dx;
    scanf ("%d", &dx), x[i] = x[i - 1] + dx;
}
for (int i=1; i<=N; i++)
    for (int j=1; j<=M; j++)
        scanf ("%d", &mat[i][j]);
for (int step = 1; step <= M; step ++)
{
    for (int i=1; i<=N; i++)
        a[i] = mat[i][step];
    int nr = 0;
    for (int i=1; i<=N; i++)
    {
        while (nr && a[st[nr]] <= a[i])
        {
            int lft = st[nr - 1] + 1, rgt = st[nr];
            cost[lft][i] += a[i] - a[st[nr]];
            cost[rgt + 1][i] += a[st[nr]] - a[i];
            nr --;
        }
        st[++nr] = i, cost[i][i] += a[i], cost[i + 1][i] -= a[i];
    }
}
for (int i=1; i<=N; i++)
    for (int j=1; j<=N; j++)
        cost[i][j] += cost[i][j - 1] + cost[i - 1][j] - cost[i - 1][j - 1];
for (int i=1; i<=N; i++)
    for (int j=i; j<=N; j++)
        if (i + j == 2 || x[i] - x[j] + cost[i][j] > ans)
            ans = x[i] - x[j] + cost[i][j];
printf ("%lld\n", ans);
return 0;
}


Measured memory_bytes: 200320
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>

#define INF 1000000000

using namespace std;

int p[] = {380, 550, 850, 1870, 1520, 2244};
int w[] = {200, 300, 500, 1200, 1000, 1500};

int main(void){

    int dp[5001];
    int g;

    for(int i = 0; i < 5001; i++){
        dp[i] = INF;
    }
    dp[0] = 0;
    for(int i = 0; i < 5000; i++){
        for(int j = 0; j < 6; j++){
            if(w[j] + i < 5001){
                if(dp[i] + p[j] < dp[i+w[j]]){
                    dp[i+w[j]] = dp[i] + p[j];
                }
            }
        }
    }


    while(scanf("%d", &g) && g != 0){
        printf("%d\n", dp[g]);
    }

    return 0;
}

Measured memory_bytes: 0
import java.util.*;

class Main {
	Scanner sc;
	
	private void calc() {
		sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long K = sc.nextLong();
		
		long ra;
		long rb;
		if (K > A) {
			ra = 0;
			rb = Math.max(0, B - K + A);
		} else {
			ra = A - K;
			rb = B;
		}
			
		System.out.println(ra+" "+rb);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}

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

using namespace std;

int sum(int m){
    int ans = 0;
    ans += m%10; m /= 10;
    ans += m%10; m /= 10;
    ans += m%10; m /= 10;
    ans += m%10; m /= 10;
    ans += m%10; m /= 10;
    return ans;
}

int main(void){
    int N, A, B;
    cin >> N >> A >> B;
    int ans = 0;
    for(int i=1;i<=N;i++){
        int s = sum(i);
        if(A <= s && s <= B) ans += i;
    }
    cout << ans << endl;
    return 0;
}

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

int A[310][310];
bool del[310][310];

int main(){ 
  int N,M; scanf("%d %d", &N, &M);
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      scanf("%d", &A[i][j]);
    }
  }
  
  int ans = 1e8;
  
  for(int k = 0; k < M; k++){ //1つ1つスポーツを消して行く
    
    map<int,int> mp;
    
    for(int i = 0; i < N; i++){
      for(int j = 0; j < M; j++){
        
        if( del[i][A[i][j]] ){   //remaining もうその競技が除外されている
          continue;}
        
        mp[A[i][j]]++; break;
      }
    }
    
      int cnt = 0; int kind = 0;
      
      for(int j = 1; j <= M; j++){
        if( cnt < mp[j] ){ cnt = mp[j]; kind = j;}
      }//どの競技に一番集中するか/その競技は何か　を調べる
      
      ans = min(ans, cnt);
      
      for(int i = 0; i < N; i++){ 
        del[i][kind] = true;
      } //kindを除外
      
      
      
    }
    
  printf("%d\n", ans);
  
  return 0;
} 

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

int main()
{
    // 入力
    int N;
    cin >> N;

    vector<int> A(N);
    int M = 0;
    rep (i, N) {
        cin >> A[i];

        if (i % 2 == 0) {
            M += A[i];
        } else {
            M -= A[i];
        }
    }

    vector<int> Mountain(N);
    Mountain[0] = M;
    for (int i = 1; i < N; i++) {
        M = -1 * M + 2 * A[i - 1];
        Mountain[i] = M;
    }

    // 出力
    rep (i, N) {
        printf("%d%c", Mountain[i], i == N ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 2048
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<int> a(N + 1);
    for (int i = 1; i <= N; i++) cin >> a[i];
    vector<int> b(N + 1);
    for (int i = N; i >= 1; i--) {
      b[i] = a[i];
      for (int j = i + i; j <= N; j += i) {
        b[i] ^= b[j];
      }
    }
    int M = accumulate(b.begin(), b.end(), 0);
    cout << M << endl;
    for (int i = 1; i <= N; i++) {
      if (b[i]) {
        cout << i << endl;
      }
    }
  }
  return 0;
}


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

typedef pair <int, int> ii;

const int Maxn = 100005;

int n;
ii a[Maxn];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i].first);
        a[i].second = i + 1;
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++)
        printf("%d%c", a[i].second, i + 1 < n? ' ': '\n');
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<int> sum(9, 0);
    rep(i, n){
        int a;
        cin >> a;
        if(a >= 3200) sum[8]++;
        else sum[a / 400]++;
    }
    int mn = 0;
    int mx = 0;
    rep(i, 8) if(sum[i] > 0) mn++;
    mx = mn + sum[8];
    if(mn == 0) mn = 1;
    cout << mn << " " << mx << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

s = input().strip()
q = int(input())
front = []
back = []
flip = False

for i in range(q):
    query = input()
    if query[0] == '1':
        flip = (not flip)
    else:
        _, f, c = query.split()
        if flip:
            if f == '1':
                back.append(c)
            else:
                front.append(c)
        else:
            if f == '1':
                front.append(c)
            else:
                back.append(c)

if flip:
    print(''.join(back[::-1]) + s[::-1] + ''.join(front))
else:
    print(''.join(front[::-1]) + s + ''.join(back))


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

int main() {
  int n;
  cin >> n;
  
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s == "Y") {
      cout << "Four" << endl;
      break;
    }
    else if (i == n - 1) {
      cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int k = sc.nextInt();
    int x = sc.nextInt();
    String ans = "No";

    if(500 * k >= x){
      ans = "Yes";
    }

    System.out.println(ans);
  }
}


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

int main(){
    long long x;
    cin >> x;
    long long sum = 0;

    for(int i = 1;i <= x;i++){
        for(int j = 1;j*i <= x;j++){
            sum += j*i;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
int main(void)
{
	int x, y, z;
	while (1)
	{
		scanf("%d%d", &x, &y);
		if (x > y)
		{
			z = y;
			y = x;
			x = z;
		}
		if (x == 0 && y == 0) {
			break;
		}
		printf("%d %d\n", x, y);
	}
	return 0;
}

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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

template<typename T>
vector<T> sieve(T n) {
    vector<T> res(n + 1, 0);
    for (T i = 2; i <= n; i++) {
        if (res[i]) continue;
        res[i] = i;
        for (T j = 2 * i; j <= n; j += i) {
            if (!res[j]) res[j] = i;
        }
    }
    return res;
}

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

    int n;
    cin >> n;

    vector<int> v = sieve(n);
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        int tar = i;
        map<int, int> cnt;
        while (tar > 1) {
            ++cnt[v[tar]];
            tar /= v[tar];
        }

        ll mem = 1;
        for (auto& p : cnt) {
            mem *= p.second + 1;
        }
        ans += mem * i;
    }
    cout << ans << newl;

    return 0;
}

Measured memory_bytes: 42268
#include<bits/stdc++.h>
using namespace std;
int main()
{
    // ios_base::sync_with_stdio(0);
    // cin.tie(0),cout.tie(0);
    int n,i,ac=0,wa=0,tle=0,re=0;
    scanf("%d",&n);
    string s;
    //map<int,int>m;
    for(i=0;i<n;i++){
        cin>>s;
        if(s=="AC")
          ac++;
        else if(s=="WA")
           wa++;
        else if(s=="TLE")
           tle++;
        else
           re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return  0;
}

Measured memory_bytes: 3644
import sys
mod = pow(10, 9) + 7
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

NNN = (10**5) * 2
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, NNN + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


def erabu(aW):
    r = 0
    for i in range(aW // 2 + 1 + 1):
        sp = aW - (2*i -1)
        r += cmb(sp+i+1-1, sp, mod)
    return r

N, W, K = [int(x) for x in input().strip().split(" ")]
hasi = 0
cc = []
if W == 1:
    if K == 1:
        print(1)
    else:
        print(0)
    sys.exit()
elif W == 2:
    cccl = [1, 1]
    cc = [1, 1]
elif W == 3:
    cccl = [1, 1, 1]
    cc = [2, 1, 2]
elif W >= 4:
    aW = W - 1
    hW = aW - 2
    nhW = aW - 3
    cc = []
    cccl = []
    for w in range(W):
        nn = max(W - 1 - w - 1, 0)
        nnn = max((W - 1) - nn - 2, 0)
        if w == W -1:
            nnn += 1
        cc.append(erabu(nn) * erabu(nnn))
        cccl.append(erabu(nn) * erabu(nnn-1))

cccl[0] = 0
cccr = cccl[::-1]
d = [1] + [0 for x in range(W-1)]
for i in range(N):
    newd = []
    for j in range(W):
        newd.append(0)
        if j != 0:
            newd[j] = (newd[j] + (d[j-1] * cccl[j]) )% mod
        if j != W-1:
            newd[j] = (newd[j] + (d[j+1] * cccr[j])) % mod
        newd[j] = (newd[j] + (d[j] * cc[j])) % mod
    d = newd[:]

print(d[K-1])


Measured memory_bytes: 81776
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

#include <functional>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    vector<vector<int>> G(n);
    REP(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }
    vector<ll> sum(n, 0);
    REP(i, 0, q) {
        int p, x;
        cin >> p >> x;
        sum[p - 1] += x;
    }

    vector<ll> ans(n, 0);
    function<void(int, int, ll)> rec = [&](int v, int prev, ll s) {
        ans[v] += s + sum[v];
        for (auto &vv: G[v]) {
            if (vv == prev) continue;
            rec(vv, v, s + sum[v]);
        }
    };

    rec(0, -1, 0LL);

    REP (i, 0, n) {
        cout << ans[i] << " \n"[i + 1 == n];
    }

    return 0;
}


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

int h, w;
char s[60][60];
int search(int x, int y) {
    int res = 0;
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            if (s[x + i][y + j] == '#')
                res++;
        }
    }
    return res;
}

int main() {
    cin >> h >> w;
    memset(s, '.', sizeof(s));
    for (int y = 1; y <= h; y++) {
        for (int x = 1; x <= w; x++) {
            cin >> s[x][y];
        }
    }
    for (int y = 1; y <= h; y++) {
        for (int x = 1; x <= w; x++) {
            if (s[x][y] == '.')
                cout << search(x, y);
            else
                cout << '#';
        }
        cout << endl;
    }
}

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

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

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let md1: Vec<u32> = read_vec();
    let m1 = md1[0];
    let d1 = md1[1];
    let md2: Vec<u32> = read_vec();
    let m2 = md2[0];
    let d2 = md2[1];
    if d2 == 1 {
        println!("1");
    } else {
        println!("0");
    }
}


Measured memory_bytes: 4352