akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
        int int1 = Integer.parseInt(scan.next());
        int int2 = Integer.parseInt(scan.next());
//        int int3 = Integer.parseInt(scan.next());
//        int int4 = Integer.parseInt(scan.next());
//        double db = Double.parseDouble(scan.next());
        int ans_int = 0;
        String ans = "";
//        String temp_str1 = "";
//        String temp_str2 = "";
        int temp_int1 = 0;
//        String str1 = scan.next();
//        String str2 = scan.next();
//        String str3 = scan.next();
        ArrayList<Integer> list = new ArrayList<>();
        if(int1 <10&&int2<10){
            ans_int = int1*int2;

        }else{
            ans_int = -1;
        }

        PrintWriter out = new PrintWriter(System.out);
        out.println(ans_int);
        out.flush();
        scan.close();
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n, k; cin>>n>>k;
	ll ans = 0;
	n-=2;
	if(n<=0)
	{
		cout<<0<<'\n';
		return 0;
	}
	for(int i = 1; i <= 5; i++)
	{
		ll mod = k-9-9*i;
		mod%=11;
		if(mod<0) mod+=11;
		mod=(mod*7)%11;
		ans+=n/11;
		if(n%11>= mod&&mod>0) ans++;
		//if(n<11&&mod==0) ans--;
		//cerr<<mod<<' '<<ans<<'\n';
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 256
n = int(input())
def make(x):
    if x == 3:
        return [(1, 3), (2, 3)]
    else:
        pre = make(x-1)
        edge = []
        for a, b in pre:
            edge.append((x-b, x-a))
        if x % 2 == 0:
            for i in range(2, x):
                edge.append((i, x))
        else:
            for i in range(1, x):
                edge.append((i, x))
        return edge
ans = make(n)
print(len(ans))
for a, b in ans:
    print(a, b)

Measured memory_bytes: 4296
from math import ceil

n, a, b = map(int, input().split())
x_array = [int(x) for x in input().split()]

now = x_array[0]
ans = 0
for x in x_array[1:]:
    if abs(x-now)*a > b:
        ans += b
    else:
        ans += abs(now-x)*a
    now = x
print(ans)

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

int main()
{
    int N, K;
    cin >> N >> K;

    string S;
    cin >> S;

    string tmp = S;

    transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);

    S.at(K-1) = tmp.at(K-1);

    cout << S << endl;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};


int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<P>x(n);
  rep(i,0,n){
    cin>>x[i].fi>>x[i].se;
    if(x[i].fi>x[i].se)swap(x[i].fi,x[i].se);
  }
  ll rx=INF,ry=0,bx=INF,by=0;
  multiset<ll,greater<ll>>st;
  sort(ALL(x));
  rep(i,0,n){
    chmin(rx,x[i].fi);
    chmax(ry,x[i].fi);
    chmin(bx,x[i].se);
    chmax(by,x[i].se);
    st.insert(x[i].se);
  }
  res=(ry-rx)*(by-bx);
  ll i=0;
  buf=INF;
  while(1){
    if(rx>buf)break;
    while(i<n&&rx==x[i].fi){
      chmin(buf,x[i].se);
      chmin(bx,x[i].fi);
      chmax(ry,x[i].se);
      st.erase(st.find(x[i].se));
      i++;
    }
    //cout<<i spa rx spa buf spa x[i].fi<<endl;
    if(i==n)break;
    if(rx==x[i].fi)break;
    rx=x[i].fi;
    by=*st.begin();
    chmin(res,(ry-min(rx,buf))*(by-bx));
    //cout<<ry spa rx spa by spa bx<<endl;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    ll n;
    cin>>n;
   vector<ll> a;
    vector<ll> b;
    rep(i,n){
        ll k;
        cin>>k;
        a.push_back(k);
        b.push_back(k);

    }


    sort(a.begin(),a.end());
    set<ll> even;
    set<ll> odd;
    rep(i,a.size()){
        (i%2?odd.insert(a[i]):even.insert(a[i]));
    }
    ll ans=0;
    rep(i,b.size()){
        if(i%2){
            if(!odd.count(b[i]))ans++;
        }
    }
    cout<<ans<<endl;



    return 0;
}


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

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

    if(abs(x-a) < abs(x-b)){
        cout << "A" << endl;
    }else{
        cout << "B" << endl;
    }

    return 0;
}

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

int main() {
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  int p1=A+C;
  int p2=A+D;
  int p3=B+C;
  int p4=B+D;
  int minimumplan=min(p1,min(p2,min(p3,p4)));
  
  cout<<minimumplan<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define UI unsigned int

string getM(char mask){
  string s;
  for( int i=4;i>=0;i-- ){
    if( mask & 1<<i ) s+="1";
    else s+="0";
  }
  return s;
}
void pr(vector<char> v){
  cout <<" ***** " << v.size() << endl;
  for( int i=v.size()-1;i>=0;i-- )
    cout << getM(v[i]) << endl;
}

int main(){
  int n, d,p,q, index;
  char ms[5], ful=0, mask;

  for( int i=0;i<5;i++ )
    ful += (ms[i]=1<<i);

  while( cin>>n && n ){
    vector<char> v;
    for( int lp=0;lp<n;lp++ ){
      //      cout << "lp="<<lp<<endl;

      cin >> d >> p >> q; // 向き・長さ・位置
      q--;

      if( d==1 ){ // 横向き
	mask=0;
	for( int i=0;i<p;i++ )	  mask |= ms[q+i];

	index=v.size()-1;
	for( ;index>=0;index-- )
	  if( v[index] & mask ) break;
	index++;
	if( index>=(int)v.size() ) v.push_back(mask);
	else v[index] |= mask;
      }else{ // 縦向き
	mask = ms[q];
	index=v.size()-1;
	for( ;index>=0;index-- )
	  if( v[index] & mask ) break;
	index++;
	for( int i=0;i<p;i++,index++ ){
	  if( index>=(int)v.size() )
	    v.push_back(mask);
	  else
	    v[index] |= mask;
	}
      }
      //      pr( v );

      // 消去チェック
      for( UI i=0;i<v.size();i++ ){
	if( v[i]==ful ){
	  v.erase( v.begin()+i );
	  i--;
	  //	  cout << "  ERASE" << endl;
	  //	  pr( v );
	}
      }
    }
    int ans=0;
    for( UI i=0;i<v.size();i++ ){
      for( int j=0;j<5;j++ )if( v[i] & 1<<j ) ans++;
    }
    cout << ans << endl;

    //    break;
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 200000
#define ll long long
using namespace std;

int main(){
    long double a,b;
    cin>>a>>b;
    long double p=a*b;
    
    cout<<fixed<<setprecision(0)<<floor(p)<<endl;
}

Measured memory_bytes: 3792
//ABC157B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	vector<vector<int>> a(3, vector<int>(3));
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin >> a.at(i).at(j);
		}
	}
	int n;
	cin >> n;
	vector<int> b(n);
	vector<vector<int>> x(3, vector<int>(3));
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			x.at(i).at(j) = 0;
		}
	}
	for(int k=0;k<n;k++){
		cin >> b.at(k);
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(b.at(k) == a.at(i).at(j)){
					x.at(i).at(j) = 1;
				}
			}
		}
	}
	for(int i=0;i<3;i++){
		bool flag = true;
		for(int j=0;j<3;j++){
			if(!x.at(i).at(j)){
				flag = false;
			}
		}
		if(flag){
			cout << "Yes" << endl;
			return 0;
		}
	}
	for(int i=0;i<3;i++){
		bool flag = true;
		for(int j=0;j<3;j++){
			if(!x.at(j).at(i)){
				flag = false;
			}
		}
		if(flag){
			cout << "Yes" << endl;
			return 0;
		}
	}
	bool flagL = true;
	for(int i=0;i<3;i++){
		if(!x.at(i).at(i)){
			flagL = false;
		}
	}
	if(flagL){
		cout << "Yes" << endl;
		return 0;
	}
	bool flagR = true;
	for(int i=0;i<3;i++){
		if(!x.at(i).at(2-i)){
			flagR = false;
		}
	}
	if(flagR){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
#define REPS(a,i,n) for(int i = a ; i < n ; ++i)
using namespace std;

int tile[20][20];


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

	REP(i, n){
		string a,b;
		cin >> a;
		b = a;


		sort(a.begin(), a.end());
		sort(b.begin(), b.end(), greater<char>());

		long c = stoi(b) - stoi(a);

		cout << c << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main() {
    char S[101];
    scanf("%s",S);

    int K, sN;
    sN = strlen(S);
    scanf("%d",&K);

    int i, a=1, b=1;
    i=1;  while (i < sN && S[i] == S[i-1]) { i++; a++; }

    if (a == sN) {
        printf("%.0lf", K/2.0*sN);
        return 0;
    }

    i=sN-2;  while (i > 0 && S[i] == S[i+1]) { i--; b++; }

    unsigned long ops=0;
    for (i=1; i<sN; i++) {
        if (S[i] == S[i-1]) {
            S[i]='A';
            ops++;
        }
    }

    unsigned long sub = 0;
    if (S[i-1] == S[0]) {
        sub = (K-1)*((int)a/2 + (int)b/2 - (int)(a+b)/2);
    }
   
    printf("%lu", K*ops - sub);
    return 0;
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
A.append(0)
A.insert(0,0)

l = 0
for i in range(1, N+2):
    l += abs(A[i]-A[i-1])
#print(l)

for i in range(1, N+1):
    if A[i+1] - A[i] >= 0 and A[i] - A[i-1] >= 0:
        print(l)
    elif A[i+1] - A[i] <= 0 and A[i] - A[i-1] <= 0:
        print(l)
    else:
        tmp = 2 * min(abs(A[i+1] - A[i]), abs(A[i] - A[i-1]))
        ans = l-tmp
        print(ans)


Measured memory_bytes: 14048
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>
using namespace std;
 
#define CASES int t;cin>>t;while(t--)
#define REP(i, val, b) for (int i = val; i < b; ++i)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
 
int main() {
	fastio
	int n;
	int x;
	int ans = 0;
	cin >> n;
	REP(i,0,n) {
		cin >> x;
		while(x%2 == 0) {
			x/=2;
			ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
// Written By NewbieChd
#include <cstdio>
#include <cctype>
#define int long long
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; }
inline int read() {
    register int f = 0;
    char c;
    while (!isdigit(c = getChar())) {}
    do
        f = f * 10 + (c ^ 48);
    while (isdigit(c = getChar()));
    return f;
}

const int maxN = 100003;
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

signed main() {
    int a = read() - 1, b = read(), c = read(), d = read(), lcm = c * d / gcd(c, d), ac = a / c, ad = a / d, bc = b / c, bd = b / d, acd = a / lcm, bcd = b / lcm;
    printf("%lld\n", b - a - bc - bd + bcd + ac + ad - acd);
    return 0;
}


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

int main(){
    int H,W;
    cin >> H >> W;
    while(H!=0||W!=0){
        for(int j=0; j<H; j++){
            for(int i=0; i<W; i++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
    return 0;
}


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

using namespace std;

using ll = long long;

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

    int n;

    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a.begin(), a.end());

    ll m = a[n - 1], k = a[0];
    if (m % 2 == 0) {
        ll mid = m / 2;
        for (int i = 0; i < n; ++i)
            if (abs(mid - a[i]) < abs(mid - k))
                k = a[i];
    }
    else {
        ll mid1 = (m + 1) / 2, mid2 = mid1 - 1;
        for (int i = 0; i < n; ++i) {
            if (min(abs(mid1 - a[i]), abs(mid2 - a[i])) <
                min(abs(mid1 - k), abs(mid2 - k)))
                k = a[i];
        }
    }

    cout << m << ' ' << k << '\n';

    return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();

        int n = in.intNext();
        int m = in.intNext();

        StringBuilder result = new StringBuilder();
        int half = m / 2;
        int ln = half * 2;
        for (int i = 1; i <= half; i++) result.append(i).append(' ').append(ln - i + 2).append("\n");
        int k = half * 2 + 2;
        if (m % 2 == 1) {
            half += 1;
            ln = half * 2;
        }
        for (int i = 0; i < half; i++) result.append(i + k).append(' ').append(ln - i - 1 + k).append("\n");
        out.println(result);

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 40152
n = int(input())
words = []
f = True
for i in range(n):
  w = input()
  if w in words:
    f = False
  if i != 0:
    if words[-1][-1] != w[0]:
      f = False 
  words.append(w)
if f:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vpll flag, D; vll path;
//***********//
int main() {
	ll A, B;
	cin >> N >> A >> B;
	if (A + B > N + 1 || A*B<N) cout << -1;
	else {
		vll P(B);
		ll cnt = A;
		ll now = 0;
		for (i = 0; i < N; i++) {
			P[now].push_back(i + 1);
			//debug(i + 1, now);
			cnt--;
			if (cnt == 0 && i!=N-1) {
				now++;
				cnt = (N - i - 1) / (B - now);
			}
		}
		vpll Q;
		for (i = 0; i < B; i++) {
			for (j = 0; j < P[i].size(); j++) {
				//debug(P[i][j]);
				Q.push_back(mp(j * 1000000 + (B - i), P[i][j]));
			}
		}
		sort(Q.begin(), Q.end());
		for (i = 0; i < N; i++) {
			co3(Q[i].second);
		}
	}
}

Measured memory_bytes: 20984
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(void)
{
  int n;

  for(;scanf("%d",&n)!=EOF;){
    int a,b,c;
    int count=0;
    for(a=0;a<10;a++){
      for(b=0;b<10;b++){
	for(c=0;c<10;c++){
	  if(n-a-b-c>=0 && n-a-b-c<10)
	    count+=1;
	}
      }
    }
    printf("%d\n",count);
  }

  return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

int main(void){
    int n;
    char s[10001];
    scanf("%d %s",&n,s);
    for(int i=0; s[i]!='\0'; i++){
        s[i]+=n;
        if(s[i]>'Z')
            printf("%c",s[i]-26);
        else
            printf("%c",s[i]);
    }
    
    return 0;
}


Measured memory_bytes: 128
import sys

def minChange(S2, S1):
   
    n, m = len(S1), len(S2) 
  
    ans = sys.maxsize 

    for i in range(m - n + 1): 
        minRemovedChar = 0
  
        for j in range(n): 
            if (S1[j] != S2[i + j]): 
                minRemovedChar += 1
                  
        ans = min(minRemovedChar, ans) 

    return ans 

S = str(input())
T = str(input())
print(minChange(S, T))

Measured memory_bytes: 67524
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
    int K;
    int N[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin >> K;

    cout << N[K - 1] << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
 
class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
 
    int cnt = 0;
    int N;
    void solve()
    {
        N = cin.nextint;
        var A = cin.scanint;
        bool flag = false;
 
        dfs(0, 1, A);
        WriteLine(cnt);
 
 
        //for (int i = 0; i < N; i++)
        //{
        //    if (A[i] % 2 == 1)
        //    {
        //        cnt++;
        //    }
 
        //}
 
 
        
    }
    void dfs(int idx, long sum, int[] A)
    {
        if (idx == N)
        {
            if (sum % 2 == 0)
            {
                cnt++;
            }
            return;
        }
        for (int i = -1; i <= 1; i++)
        {
            dfs(idx + 1, sum * (A[idx] + i), A);
        }
    }
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

#define MOD 1000000007ll
#define pb     push_back
#define mp     make_pair
#define MAX 100005
#define all(v) v.begin() , v.end()
#define allr(v) v.rbegin(), v.rend()

int n, d, sum;
vector<int> ndiv;

int main(int argc, char const *argv[])
{
   cin >> n;
  sum = 0;

  for(int i = 0 ; i < n ; i++){
  	cin >> d;

  	if(d%10 != 0)
  		ndiv.pb(d);

  	sum = sum + d;
  }

  if(sum%10 != 0)
  	cout << sum;
  else
  {
  	if(ndiv.size() == 0)
  		cout << "0";
  	else
  	{
  		sort(all(ndiv));
  		sum = sum - ndiv[0];
  		cout << sum;
  	}
  }



  return 0;
}  

Measured memory_bytes: 256
fn main() {
    let v = read_vec::<u32>();
    let a = v[0];
    let b = v[1];
    let c = v[2];
    let d = v[3];

    if a + b == c + d {
        println!("Balanced");
    } else if a + b > c + d {
        println!("Left");
    } else if a + b < c + d {
        println!("Right");
    }
}

#[allow(dead_code)]
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()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

using namespace std;

bool EX[200][200];
bool OP[200][200];
bool KL[200][200], KR[200][200];
bool CL[200][2000], CR[200][200];

bool latte[200][200], malta[200][200];
bool ei[200][200];

bool update(int a, int b, int c)
{
  bool beet = false;
  if(!ei[a][c] && EX[a][b] && OP[b][c]) beet = ei[a][c] = true;
  if(!latte[a][c] && EX[a][b] && KR[b][c]) beet = latte[a][c] = true;
  if(!malta[a][c] && EX[a][b] && CR[b][c]) beet = malta[a][c] = true;

  if(!EX[a][c] && ei[a][b] && EX[b][c]) beet = EX[a][c] = true;
  if(!EX[a][c] && KL[a][b] && latte[b][c]) beet = EX[a][c] = true;
  if(!EX[a][c] && CL[a][b] && malta[b][c]) beet = EX[a][c] = true;
  return (beet);
}

int main()
{
  int N, M, S, T;
  while(cin >> N >> M >> S >> T, N) {

    memset(EX, false, sizeof(EX));
    memset(OP, false, sizeof(OP));
    memset(KL, false, sizeof(KL));
    memset(KR, false, sizeof(KR));
    memset(CL, false, sizeof(CL));
    memset(CR, false, sizeof(CR));
    memset(latte, false, sizeof(latte));
    memset(malta, false, sizeof(malta));
    memset(ei, false, sizeof(ei));


    queue< pair< int, int > > que;
    for(int i = 0; i < M; i++) {
      int A, B;
      char C;
      cin >> A >> B >> C;
      --A, --B;
      if(C == 'a') EX[A][B] = true;
      else if(C == '*' || C == '+') OP[A][B] = true;
      else if(C == '(') KL[A][B] = true;
      else if(C == ')') KR[A][B] = true;
      else if(C == '[') CL[A][B] = true;
      else CR[A][B] = true;
      que.emplace(A, B);
    }

    while(!que.empty()) {
      int l, r;
      tie(l, r) = que.front();
      que.pop();
      for(int i = 0; i < N; i++) {
        if(update(l, r, i)) que.emplace(l, i);
        if(update(i, l, r)) que.emplace(i, r);
      }
    }

    if(EX[--S][--T]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

int main() {
	int i,j,k,a,b,c,m,n,an,g[100][100],lk[100][100],ln[100];
	while(cin >> n >> m && n>0) {
	for (i=0;i<100;i++) { ln[i]=0; for (j=0;j<100;j++) { g[i][j]=99999999; if (i==j) g[i][j]=0;}}	
	for (i=0;i<m;i++) {
		cin >> a >> b >> c; a--; b--;
		g[a][b]=g[b][a]=c; lk[a][ln[a]++]=b; lk[b][ln[b]++]=a;
	}
	for (k=0;k<n;k++) for (i=0;i<n;i++) for (j=0;j<n;j++) {c=g[i][k]+g[k][j]; if (g[i][j]>c) g[i][j]=c;}
	an=99999999;
	for (k=0;k<n;k++) for (i=0;i<ln[k];i++) for (j=0;j<ln[k];j++) {
	c=g[0][lk[k][i]]+g[lk[k][j]][n-1]; if (i!=j && c<an) an=c;}
	if (an>g[0][n-1]) an=g[0][n-1];
	if (n==2) an=g[0][1]; 
	cout << an << endl;
	} 
  return 0;
} 

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

int search(int A[], int n, int key)
{
  int i = 0;
  A[n] = key;
  while (A[i] != key)
    i++;
  return i != n;
}

int main()
{
  int n, A[10000 + 1], q, key, sum = 0;

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

  cin >> q;
  for (int i = 0; i < q; i++)
  {
    cin >> key;
    if (search(A, n, key))
    {
      sum++;
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

vi ans(101010,-1);

int dfs(int pos, vvi &v) {
    // fin(pos);
    int res=1;
    for(auto i:v[pos]){
        res+=dfs(i,v);
    }
    return ans[pos]=res;
}

int main() {

    int n;
    cin>>n;
    vvi v(n);
    rep(i,n-1){
        int a;
        cin>>a;a--;
        v[a].pb(i+1);
    }
    // dfs(0,v);
    rep(i,n)fin(v[i].size());
}

Measured memory_bytes: 14608
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-09 19:32:35
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

template<typename T> void fastin(T &num) {
  bool negative = false;
  T c;
  num = 0;
  c = getchar_unlocked();
  if (c == '-') {
    negative = true;
    c = getchar_unlocked();
  }
  for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (num << 3) + (num << 1) + c - 48;
  if (negative) num *= -1;
}

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

  int n; fastin(n); int64 k; fastin(k);
  vector<int64> a(n);
  for (int i = 0; i < n; ++i) {
    fastin(a[i]);
    --a[i];
  }

  vector<int64> sum(n + 1, 0LL);
  for (int i = 0; i < n; ++i) {
    sum[i + 1] = sum[i] + a[i];
    sum[i + 1] %= k;
  }
 
  map<int64, int> mp;
 
  int64 ans = 0;
 
  for (int i = 0; i < n + 1; ++i) {
    ans += mp[sum[i]];
    ++mp[sum[i]];
    if (i >= k - 1) {
      --mp[sum[i - k + 1]];
    }
  }  

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 15872
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs)        \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%ld", &xs[i]);
#define fillDouble(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    scanf("%lf", &xs[i]);
#define fillString(xs)       \
  for (int i = 0; i < (xs).size(); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

const int mod = 1000000007;
const int MAX_V = 100005;

struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}

    mint& operator+=(const mint a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator-=(const mint a) {
        if (x < a.x) {
          x += mod;
        }
        x -= a.x;
        return *this;
    }

    mint& operator*=(const mint a) {
        x = (x * a.x) % mod;
        return *this;
    }

    mint& operator/=(const mint a) {
        *this *= a.inv();
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    mint pow(ll n) const {
        mint a(*this);
        mint res = 1;
        while (n > 0) {
            if (n & 1) res *= a;
            a *= a;
            n >>= 1;
        }
        return res;
    }

    mint inv() const {
        return pow(mod - 2);
    }
};

mint dp[2005][2005];

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

  int n, m;
  cin >> n >> m;

  vector<long> s(n);
  vector<long> t(m);

  fillLong(s);
  fillLong(t);

  rep(i, n+1) {
    dp[i][0] = 1;
  }

  rep(i, m+1) {
    dp[0][i] = 1;
  }

  rep(i, n) rep(j, m) {
    dp[i+1][j+1] = dp[i][j+1] + dp[i+1][j];
    if (s[i] != t[j]) {
      dp[i+1][j+1] -= dp[i][j];
    }
  }


  cout << dp[n][m].x << endl;
}


Measured memory_bytes: 31744
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iostream>
#include <utility>
 
using namespace std;
using ll = long long;
using ld = long double;
using Vl = vector<ll>;
using pll = pair<ll, ll>;
using vb = vector<bool>;
using vs = vector<string>;

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

ll N, W;
Vl w(N), v(N);
ll dp[101][100001]; //0

int main() {
    cin >> N >> W;
    w.resize(N);
    v.resize(N);
    ll maxValue = 0;
    REP(i,N){
        cin >> w[i] >> v[i];
        maxValue+=v[i];
    }


    REP(i,N) REP(vi,maxValue+1) dp[i][vi] = ll(1e18);//クソ重くしとく
    dp[0][0] = 0;

    REP(i,N) REP(vi,maxValue+1){
        if(vi>=v[i]){ //同価値で軽い人を入れる。
            dp[i+1][vi]=min(dp[i][vi],dp[i][vi-v[i]]+w[i]);
        } else { // 同価値のものが見つからないばやい
            dp[i+1][vi]=dp[i][vi];
        }
    }
    int ans=0; 
    for(int vi=0;vi<=maxValue;vi++){
        if(dp[N][vi]<=W)ans=vi; //viのときの重さ
    }

    cout << ans;
    
    return 0;
}


Measured memory_bytes: 79104
#include <iostream>


int main()
{
	int R;
	std::cin >> R;
	if (R < 1200) {
		std::cout << "ABC" << std::endl;
	}
	else if (R < 2800) {
		std::cout << "ARC" << std::endl;
	}
	else {
		std::cout << "AGC" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
GC.disable
def lcs c1, c2, l, m
	dp = Array.new(m + 1){0}
	l.times do |i|
		tmp = dp.dup
		m.times do |j|
			jj = j + 1
			if c1[i] == c2[j]
				dp[jj] = tmp[jj - 1] + 1
			elsif  dp[jj] < dp[jj - 1] 
				dp[jj] = dp[jj - 1]
			end
		end
	end
	return dp[-1]
end

n = gets.to_i
n.times do
	c1 = gets.chomp.split("")
	c2 = gets.chomp.split("")
	l = c1.size
	m = c2.size
	puts lcs(c1, c2, l, m)
end

Measured memory_bytes: 169200
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	vector<bool> dp(n + 100, false);
	dp[0] = true;
	rep(i, n + 1) {
		dp[i + 4] = dp[i + 4] | dp[i];
		dp[i + 7] = dp[i + 7] | dp[i];
	}
	puts(dp[n] ? "Yes" : "No");
	return 0;
}

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

long long int gcd(const long long int a, const long long int b) {
	return (b == 0) ? a : gcd(b, a % b);
}
int main() {
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		std::vector<long long int> numbers(n * (n + 1) / 2), even; for (auto& b : numbers) std::cin >> b;
		std::copy_if(numbers.begin(), numbers.end(), std::back_inserter(even), [](const long long int n) {return n % 2 == 0; });
		std::sort(even.begin(), even.end());
		long long int odd_min = LLONG_MAX;
		for (const auto& b : numbers) if (b % 2 == 1) odd_min = std::min(odd_min, b);
		const auto a0g = gcd(even[0], even[1]);
		const auto ab = (even[0] / a0g) * (even[1] / a0g);
		const auto gcd_square = odd_min / ab;
		const auto gcd = static_cast<int>(std::sqrt(gcd_square));
		const auto a0 = a0g / gcd;
		std::cout << a0 << '\n';
		for (auto i = 0; i < even.size(); ++i) {
			if (i != 0) std::cout << ' ';
			std::cout << even[i] / a0;
		}
		std::cout << '\n';
	}
}


Measured memory_bytes: 3356
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	long long num[10000010] = {};
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j += i) {
			num[j]++;
		}
	}

	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += i * num[i];
	}
	cout << ans << endl;

	return 0;
}

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


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int[] input = sc.intarr;

            int a = input[0];
            int b = input[1];
            int c = input[2];
            int x = input[3];
            int y = input[4];

            int sum = a * x + b * y;

            int sum_tmp = sum;

            int c_count = 0;

            while(true)
            {
                if (x <= 0)
                {
                    sum_tmp = sum_tmp + (2 * c) - b;
                }
                else if (y <= 0)
                {
                    sum_tmp = sum_tmp + (2 * c) - a;
                }
                else
                {
                    sum_tmp = sum_tmp + (2 * c) - a - b;
                }

                x--;
                y--;
                if (sum_tmp >= sum)
                {
                    break;
                }
                else if (x < 0 && y < 0)
                { 
                    break;
                }
                else
                {
                    sum = sum_tmp;
                    c_count++;
                }
            }
            wr.wri(sum);
        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>

int main(){
char S[10000];
int N;
scanf("%d%s",&N,&S);

for(int i=0;S[i]!='\0';i++){
    if(S[i]+N>90)
    {
       S[i]='A'+((S[i]+N)-91);
    }

    else
        S[i]=S[i]+N;

}

printf("%s",S);

return 0;

}

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

using namespace std;
// using Graph = vector<vector<ll>>;

typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

const ll MOD = 1000000007;
const ll INF = 1e18; //1*10^18
const double PI = 3.14159265;

int ctoi(char c)
{
  if (c >= '0' && c <= '9')
  {
    return c - '0';
  }
  return 0;
}

ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; }
//最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//最小公倍数

ll powll(ll a, ll n)
{ //O(log n)
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a;
    }
    a = a * a;
    n >>= 1; //(n & 1)=(n % 2 !=0)
  }
  return res;
}

ll modpow(ll a, ll n, ll mod) //O(log n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a % mod;
    }
    a = a * a % mod;
    n >>= 1; //(n>>=1)=(n/2)
  }
  return res;
}

int ReturnDigit(ll num)
{
  string number = to_string(num);
  return number.length();
}

const ll MAX = 1e6;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() //MODは素数じゃないとだよ！！
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k)
{
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind
{
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N)
  { //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++)
      par[i] = i;
  }

  int root(int x)
  { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y)
  {                   // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry)
      return;     //xとyの根が同じ(=同じ木にある)時はそのまま
    par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }

  bool same(int x, int y)
  { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

ll subordinate[500000];
int main()
{
  // COMinit();
  // srand((unsigned int)time(NULL));//--> rand()
  ll i, j, k, l, ans = 0;
  ll n, boss;
  cin >> n;
  for (i = 0; i < n; i++)
  {
    subordinate[i] = 0;
  }
  for (i = 0; i < n - 1; i++)
  {
    cin >> boss;
    subordinate[boss - 1]++;
  }

  for (i = 0; i < n; i++)
  {
    if (i != 0)
    {
      cout << ' ';
    }
    cout << subordinate[i];
  }
  // cout << ans << endl;
}


Measured memory_bytes: 5160
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
long long int __lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
 //__gcd 最大公約数
 //__lcm 最小公倍数

int main() {
  int a;
  cin>>a;
  vector<int> b(a);
  for(int i=0;i<a;i++)
    cin>>b[i];
  int c=0,d=0,e=1000000;
  for(int i=0;i<a;i++)
    c+=b[i];
  for(int i=0;i<a;i++){
    d+=b[i];
    e=min(e,max(c-2*d,2*d-c));
    }
  cout<<e;
  }


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

#define int long long
#define pb push_back
#define pii pair<int,int>
#define ppii pair<pii,pii>
#define fr(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define ccM 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
long double pi = 3.14159265358979323;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int max(int b,int a){if(b>a)return b;else return a;}
int min(int b,int a){if(b<a)return b;else return a;}
int Abs(int b){return max(b,-b);}
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){return a.second<b.second;}

int32_t main()
{   
    int k;
    cin>>k;
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int sum=0;
    for(int i=1;i<n;i++){
        sum+=arr[i]-arr[i-1];
    }
    sum+=arr[0]+k-arr[n-1];
    int mi=-1;
    for(int i=1;i<n;i++){
        mi=max(arr[i]-arr[i-1],mi);
    }
    mi=max(mi,arr[0]+k-arr[n-1]);
    cout<<sum-mi<<endl;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  for (int i = 0; i <= n; i++) {
    string tmp = s;
    tmp = tmp.substr(0, i);
    tmp += t;
    tmp = tmp.substr(0, n);
    if (tmp == s) {
      dump(n+i);
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256