akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);

ll my_min(ll a, ll b) {
    if(a < b) return a;
    else return b;
}
ll my_max(ll a, ll b) {
    if(a > b) return a;
    else return b;
}

int main() {
    ll n, k; cin >> n >> k;
    vector<ll> a(n), b(n, 0);
    rep(i, n) cin >> a[i];

    rep(i, my_min(45, k)) {
        rep(j, n) {
            ll l = my_max(0, j-a[j]);
            b[l]++;
            if(j+a[j] < n-1) {
                b[j+a[j]+1]--;
            }
        }
        frep(j, 1, n-1) {
            b[j] += b[j-1];
        }
        rep(j, n) {
            a[j] = b[j];
            b[j] = 0;
        }
    }
    rep(i, n) {
        cout << a[i] << " ";
    }
    cout << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 6416
N = int(input())
T = [int(input()) for i in range(N)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


if N == 1:
    print(T[0])
    exit()

now = lcm(T[0], T[1])
for i in range(1, N):
    now = lcm(now, T[i])

print(now)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	long H = Long.parseLong(scan.next());
	long W = Long.parseLong(scan.next());

	long min = calcMin(H, W);
	if(H != W) {
	    long tmp = calcMin(W, H);
	    min = tmp < min ? tmp : min;
	}
	System.out.println(min);
	scan.close();
    }

    private static long calcMin(long height, long width) {
	long ans = Long.MAX_VALUE;

	if(height >= 3) {
	    if(height%3 == 0) return 0;
	    else ans = width;
	}

	int r1 = (int)height % 3;
	for (int i = 0; i <= r1; i++) {
	    long h1 = height/3 + i;
	    long h2 = height - h1;

	    long w1 = width / 2;
	    long w2 = width - w1;

	    long s1 = h1 * width;
	    long s2 = h2 * w1;
	    long s3 = h2 * w2;
	    
	    long tmp = difference(s1, s2, s3);
	    ans = tmp < ans ? tmp : ans;
	}
	return ans;
    }

    private static long difference(long a, long b, long c) {
	if(a<b) {
	    if(b<c) return c-a;
	    else {
		if(a<c) return b-a;
		else return b-c;
	    }
	} else {
	    if(a<c) return c-b;
	    else {
		if(b<c) return a-b;
		else return a-c;
	    }
	}
    }
}    


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

#define     ll     long long int

const int N = 2000006;
ll mod = 1000000007;
ll fact[N];
ll inv[N];

ll bigmod(ll a, ll b, ll mod)
{
    if (b == 0) return 1LL;
    ll x = bigmod(a, b / 2, mod);
    x = (x * x) % mod;
    if (b % 2 == 1) x = (x * a) % mod;
    return x;
}

void pre(int n)
{
    int i, j, k;
    fact[0] = 1;
    fact[1] = 1;
    inv[1] = 1;
    for (i = 2; i <= n; i++)
    {
        fact[i] = (fact[i - 1] * i) % mod;
        inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
    }
    inv[0] = 1;
    inv[1] = 1;
    for (i = 2; i <= n; i++)
        inv[i] = (inv[i - 1] * inv[i]) % mod;
}

int main( )
{
    pre(2000000);
    ll s = 0, t = 1, i, j, a, b, tt, x, y, x_plus_y, x_minus_y;
    cin >> a >> b;
    if (a < b) swap(a, b);
    if ( (a + b) % 3 != 0 )
    {
        cout << "0\n";
        return 0;
    }
    x_plus_y = (a + b) / 3;
    x_minus_y = a - b;
    x = (x_plus_y + x_minus_y) / 2;
    y = (x_plus_y - x_minus_y) / 2;
    if (x < 0 || y < 0 || 2 * x + y != a || x + 2 * y != b)
    {
        cout << "0\n";
        return 0;
    }
    t = ((fact[(x + y)] * inv[x]) % mod * inv[y]) % mod;
    cout << t << '\n';
    return 0;
}


Measured memory_bytes: 31488
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  string s; cin >> s;
  int n=s.size();
  int k; cin >> k;
  priority_queue<string, vector<string>, greater<string>> q;
  set<string> st;
  rep(i,n){
    string t;
    for(int j=i;j<min(i+k,n);j++){
      t+=s[j];
      st.insert(t);
    }
  }
  for(auto c:st){
    q.push(c);
  }
  rep(i,k-1){
    q.pop();
  }
  cout << q.top() << endl;
}

Measured memory_bytes: 1920
import java.util.Scanner;

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

        sc.close();

        while (n > 0) {
            if (n % 4 == 0 || n % 7 == 0 || n % 11 == 0) {
                System.out.println("Yes");
                return;
            }
            n -= 4;
        }
        while (n > 0) {
            if (n % 4 == 0 || n % 7 == 0 || n % 11 == 0) {
                System.out.println("Yes");
                return;
            }
            n -= 7;
        }

        System.out.println("No");
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace _gnu_pbds;
#define vb __int128
#define ll long long
#define ld long double
#define full(a) a.begin(),a.end()
#define fr(i,a,b) for(ll i = a ; i < b ; i++)
#define stoink stack<ll>
#define quu queue<ll>
#define quee queue<pair<ll,ll>>
#define vec vector <ll>
#define vecd vector<ld>
#define vg vector<vector<ll> >
#define eg vector<pair<ll,ll>>
#define vgw vector<vector<pair<ll,ll> > >
#define pa pair<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define pre 0.00000000000000000001
#define inf 100000000
#define mod 998244353
#define endl '\n'
    // gp_hash_table<ll, int,chash> dist;
// using namespace __gnu_pbds;
// ll power(ll x,ll exp)
// {ll res=1;while(exp>0){if(exp%2==1)res=((res%mod)*(x%mod)%mod);
// 	x=((x%mod)*(x%mod)%mod);exp=exp>>1;}return res;}
struct chash {
    const int RANDOM = (long long)(make_unique<char>().get()) ^ chrono::high_resolution_clock::now().time_since_epoch().count();
    static unsigned long long hash_f(unsigned long long x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    static unsigned hash_combine(unsigned a, unsigned b) { return a * 31 + b; }
    int operator()(int x) const { return hash_f(x)^RANDOM; }
};
struct block {
    ll w,st,val;
    void read() {
        cin >> w >> st >> val;
    }
    bool operator < (const block &b) const {
        return w + st < b.w + b.st;
    }
};
int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
    cin >> n;
    vector<block> arr(n);
    ll maxi = 20000;
    fr(i,0,n){
        arr[i].read();
        maxi = max(maxi,arr[i].w);
    }
    vec dp(maxi + 1,0);
    sort(full(arr));
    for(auto i : arr) {
        for(ll w = min(i.st,maxi - i.w) ; w >= 0 ; w--){
            dp[w + i.w] = max(dp[w + i.w],dp[w] + i.val);
        }
    }
    ll ans = 0;
    fr(i,0,maxi + 1) {
        ans = max(ans,dp[i]);
    }
    cout << ans;
    return 0;
}	

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }

int main(){
    string S, T;
    cin >> S >> T;
    
    cout << T << S << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
int main(void){
    int N;
    cin>>N;
    char str[N][15];
    for(int i=0;i<N;i++){
        cin>>str[i];
    }
    int ans=0;
    for(int i=0;i<N-1;i++){
      int L=strlen(str[i]);
      if(str[i][L-1]==str[i+1][0]) ans++;
    }
    int check=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            int a=strcmp(str[i],str[j]);
            if(a==0) check=1;
        }
    }
    if(ans==N-1&&check==0) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 1000400
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
ll get(ll n){
	ll ret=0;
	while(n){
		ret+=n%10;
		n/=10;
	}
	return ret;
}
void solve(){
	ll n,k,i,pos=0;
	cin>>n>>k;
	vll vec(n);
	nfl(i,n){
		in(vec[i]);
		if(vec[i]==1){
			pos=i;
		}
	}
	if(n==1){
		cout<<0<<endl;
		return;
	}
	if(n==k){
		cout<<1<<endl;
		return;
	}
	ll ans=1;
	n-=k;
	k-=1;
	while(n>0){
		n-=k;
		ans++;
	}
	cout<<ans<<endl;
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
}	


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,m;
  cin>>s;
 int count=0;
 bool check=true;
     for(int i=0;i<s.size();i++){
         if(i>0&&s.at(i)=='A'&&s.at(i-1)=='A'){check=false;break;}
         if(i>0&&i<s.size()-1&&(s.at(i-1)=='K'&&s.at(i)=='A'&&s.at(i+1)=='I'||s.at(i-1)=='I'&&s.at(i)=='A'&&s.at(i+1)=='H')){check=false;break;}
         if(s.at(i)=='A')count++;
         else m.push_back(s.at(i));
     }
     if(count>5||m.size()!=5||m.at(0)!='K'||m.at(1)!='I'||m.at(2)!='H'||m.at(3)!='B'||m.at(4)!='R')check=false;
  if(check)cout<<"YES"<<endl;
   else cout<<"NO"<<endl;
}

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

int main(){
	
	int l,r,d;
	cin>>l>>r>>d;int cnt=0;
	for(int i=l;i<=r;i++){
		if(i%d==0){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
	
}

Measured memory_bytes: 3604
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
x = 0
y = 0
t = 0
for i in range(n):
    if abs(a[i][1] - x) + abs(a[i][2] - y) > abs(a[i][0] - t) or (a[i][1] - x + a[i][2] - y) % 2 != (a[i][0] - t) % 2:
        print('No')
        exit()
    else:
        x = a[i][1]
        y = a[i][2]
        t = a[i][0]
print('Yes')

Measured memory_bytes: 60632
#include<iostream>
#include<cmath>
using namespace std;
int main(void){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int remain(k);
    int ans(0);
    ans += min(a,remain);
    remain -= min(a,remain);
    remain -= min(b,remain);
    ans -= min(c,remain);
    cout<<ans<<endl;
    return 0;
}

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

int main(void)
{
    int n,k;
    string s;

    cin >> n;
    cin >> s;
    cin >> k;
    
    char c = s[k-1];
    string ans = "";

    for(int i = 0; i < n; i++)
    {
        if (s[i]==c) {
            ans += c;
        } else {
            ans += '*';
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from sys import stdin, stdout

input = lambda: stdin.readline()
# write = stdout.write

def main():
    H, W = map(int, input().split())
    A = [list(map(int, input().split())) for _ in [0] * H]

    ans = []
    cnt = 0
    for y in range(H):
        for x in range(W - 1):
            if A[y][x] % 2:
                A[y][x] -= 1
                A[y][x+1] += 1
                cnt += 1
                ans.append([y+1, x+1, y+1, x+2])

    for y in range(H - 1):
        if A[y][-1] % 2:
            A[y][-1] -= 1
            A[y+1][-1] += 1
            cnt += 1
            ans.append([y+1, W, y+2, W])

    print(cnt)
    for a in ans:
        print(*a)

main()


Measured memory_bytes: 30252
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
ll int large=(ll int)1e13+7;
ll int mod=(ll int)1e5;
ll int const N=(ll int)1e5+10;

ll int mod_exp(ll int x,ll int n)
{
    ll int result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=(x*x)%mod;
        n=n/2;
    }
    return result;
}

ll int mod_inverse(ll int a)
{
    return mod_exp(a,mod-2);
}




int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll int T,i,j,ij;
T=1;
//cin>>T;
while(T--)
{
  ll int n;
  cin>>n;
  vector<ll int>a(n);
  rep(i,0,n)
  cin>>a[i];

  sort(a.begin(),a.end());
  ll int ans=0;
  n--;
  if(n!=0)
  {
    ans+=a.back();
    a.pop_back();
    n--;
  }

  while(n!=0)
  {
     ans+=a.back();
       n--;
       if(n==0)
        break;
       ans+=a.back();
       n--;
       a.pop_back();
  }
  cout<<ans;


}
return 0;
}
















Measured memory_bytes: 4776
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
namespace IO{
template<typename T>
void __RI(T&x){
	int ch=getchar(),neg=1;
	x=0;
	for(;!(isdigit(ch)||ch=='-'||ch==EOF);ch=getchar());
	if(ch==EOF)return;
	if(ch=='-')neg=-1,ch=getchar();
	for(;isdigit(ch);ch=getchar())x=x*10+ch-48;
	x*=neg;
}
void R(int&x){__RI(x);}
#ifndef int
void R(int64_t&x){__RI(x);}
#endif
template<typename T1,typename T2>
void R(std::pair<T1,T2>&x){
	R(x.first);
	R(x.second);
}
template<typename T>
void R(std::vector<T>&x){
	for(auto&i:x){R(i);}
}
template<typename T>
void R(T&x){
	std::cin>>x;
}
template<typename T,typename...Args>
void R(T &x,Args&...args){
	R(x),R(args...);
}
template<typename T>
void RA(T *arr,int l,int r){
	arr+=l;
	int p=r-l+1;
	while(p--)R(*arr++);
}
char space=' ';
template<typename T>
void __WI(T x){
	if(x==0)putchar('0');
	if(x<0)putchar('-'),x=-x;
	char ch[64];
	int pos=0;
	while(x)ch[pos++]=x%10+48,x/=10;
	while(pos)putchar(ch[--pos]);
}
void W(){}
void W(const int&x){__WI(x);}
#ifndef int
void W(const int64_t&x){__WI(x);}
#endif
void W(const double&x){printf("%lf",static_cast<double>(x));}
void W(const char&x){putchar(x);}
void W(const std::string&x){printf("%s",x.c_str());}
template<typename T1,typename T2>
void W(const std::pair<T1,T2>&x){
	W(x.first);
	W(space);
	W(x.second);
}
template<typename T>
void W(const std::vector<T>&x){
	for (auto it=x.cbegin();it!=x.cend();it++){
		W(*it);
		W(space);
	}
	W('\n');
}
template<typename T>
void W(const T&x){
	std::cout<<x;
}
template<typename T,typename...Args>
void W(const T&x,const Args&...args){
	W(x),W(space),W(args...);
}
template<typename...Args>
void WL(const Args&...args){
	W(args...),W('\n');
}
template<typename T>
void WA(T *arr,int l,int r){
	arr+=l;
	int p=r-l;
	while(p--)W(*arr++),W(space);
	W(*arr);
}
template<typename T>
void WAL(T *arr,int l,int r){
	arr+=l;
	int p=r-l;
	while(p--)W(*arr++),W(space);
	WL(*arr);
}
}; // namespace IO
int main(){
	int n;
	IO::R(n);
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			int t=1,x=i,y=j;
			while((x%2)==(y%2))x/=2,y/=2,t++;
			IO::W(t);
			IO::W(' ');
		}
		IO::W('\n');
	}
	return 0;
}


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

using namespace std;

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

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

  sort(A, A + N * 3, greater<int>());

  long answer = 0;
  for (int i = 0; i < N * 2; i++) {
    if (i % 2 != 0) {
      answer += A[i];
    }
  }

  cout << answer << endl;
}


Measured memory_bytes: 1408
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

       String s=sc.next();
       String t[]=s.split("");
       int total=700;
       for(int i=0;i<3;i++) {
    	   if(t[i].equals("o")) total+=100;
       }
        System.out.println(total);
    }
}

Measured memory_bytes: 35600
#include<cstdio>
#include<cstring>


int main()
{
	int w,k,hyou[101][101],i,j,checki[101],check[101],l=0;
	memset(check,0,100*sizeof(int));
	char a;
	while(1)
	{
		scanf("%d%d",&w,&k);
		if(w==0)
			break;
		scanf("%c",&a);
		for(i=0;i<w;i++){
			for(j=0;j<=k;j++){
				scanf("%c",&a);
				if(a=='>')
					hyou[i][j]=1;
				else	if(a=='<')
					hyou[i][j]=2;
				else if(a=='v')
					hyou[i][j]=3;
				else if(a=='^')
					hyou[i][j]=4;
				else if(a=='.')
					hyou[i][j]=0;
				else 
					hyou[i][j]=6;
			}
		}
		/*for(i=0;i<w;i++){
			for(j=0;j<=k;j++){
				if(hyou[i][j]==6)
				printf("\n");
				else
					printf("%d",hyou[i][j]);
			}
		}*/
		i=0;
		j=0;
		while(hyou[i][j]!=5&&hyou[i][j]!=0){
			switch(hyou[i][j]){
			case 1:
				hyou[i][j]=5;
				j++;
				break;
			case 2:
				hyou[i][j]=5;
				j--;
				break;
			case 3:
				hyou[i][j]=5;
				i++;
				break;
			case 4:
				hyou[i][j]=5;
				i--;
				break;
			case 0:
				check[l]=i;
				checki[l]=j;
				break;
			case 5:
				check[l]=0;
				break;
			}
		}
		if(hyou[i][j]==0){
			check[l]=i;
			checki[l]=j;
		}
		if(hyou[i][j]==5)
			check[l]=-1;
		l++;
	}
	for(i=0;i<l;i++){
		if(check[i]==-1)
			printf("LOOP\n");
		else
			printf("%d %d\n",checki[i],check[i]);
	}
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef unsigned long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e9+7;
const int N = 1e7+9;
ll nod[N+9];
ll A[N+9];

void pre() {
    for(int i=1;i<N;++i) {
        for(int j=i;j<N;j+=i) nod[j]++;
        A[i] = A[i-1] + nod[i]*i;
    }
}
void solve() {
    int a, b, n;
    cin>>n;
    // for(int i=1;i<=n;++i) cout<<A[i]<<endl;
    cout<<A[n]<<endl;
}
int main() {
    ios_base::sync_with_stdio(0);
    int T=1 ,cas=0;
    pre();
    while(T--) {
        solve();
    }
    return 0;
}

// ll, reset, 1, bottom

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

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

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

using namespace std;
#define int long long
const int MOD = 1000000007;

vector<vector<int> > g;
vector<int> res;
vector<int> A;
vector<int> X;
int N;
int INF = (int)1 << 62;
void dfs(int a, int p = -1) {
	int pos = lower_bound(X.begin(), X.begin() + N, A[a]) - X.begin();
	int b = X[pos];
	X[pos] = A[a];
	res[a] = lower_bound(X.begin(), X.begin() + N, INF) - X.begin();
	for (int i : g[a]) {
		if (i != p) {
			dfs(i, a);
		}
	}
	X[pos] = b;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N;
	g.resize(N);
	res.resize(N);
	X.resize(N, INF);
	A.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	dfs(0);
	for (int i = 0; i < N; i++) {
		cout << res[i] << endl;
	}
}

Measured memory_bytes: 30300
N = int(input())
L = list(map(int, input().split()))
ans = 0
for i in range(N):
  for j in range(i+1, N):
    for k in range(j+1, N):
      if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
        continue
      if L[i] < L[j] + L[k] and L[j] < L[k] + L[i] and L[k] < L[i] + L[j]:
        ans += 1
print(ans)

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

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

    priority_queue<int> pque;

    for (int i = 0; i < n; i++) {
        int e;
        cin >> e;
        pque.push(e);
    }

    for (int i = 0; i < m; i++) {
        int e = pque.top();
        pque.pop();
        pque.push(e / 2);
    }

    long long ans = 0;
    while (pque.size()) {
        ans += pque.top();
        pque.pop();
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  string S;
  cin >> S;
  vector<int> count_direction(4);
  rep(i, S.size())
  {
    if (S[i] == 'N')
      count_direction[0]++;
    else if (S[i] == 'S')
      count_direction[1]++;
    else if (S[i] == 'E')
      count_direction[2]++;
    else if (S[i] == 'W')
      count_direction[3]++;
  }

  if ((count_direction[0] == 0) xor (count_direction[1] == 0))
    cout << "No" << endl;
  else if ((count_direction[2] == 0) xor (count_direction[3] == 0))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

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

  std::vector<lint> x;
  for(int i = 1;i <= sqrt(n);i++){
    if(n%i == 0) x.push_back(i+(n/i)-2);
  };

  cout << *min_element(ALL(x)) << "\n";
  return 0;
}


Measured memory_bytes: 384
//BISMILLAHIR RAHMANIR RAHIM
//RHYTHM_086_NS_01
//ALAN_IS_ON....

#include <bits/stdc++.h>

//define

#define                boost_                         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define                iter_(i,n)                     for (int i = 0; i < int(n); i++)
#define                for_n(i, n)                    for (int i = 1; i <= int(n); i++)
#define                pb                             push_back
#define                mp                             make_pair
#define                itr                            ::iterator
#define                s_sort(s)                      sort(s.begin(),s.end())
#define                n_sort(a)                      sort(a,a+n)
#define                thank_you                      return 0
#define                thanks                         return
#define                pii                            pair<int,int>
#define                precise_impact                 cout<<setprecision(10)<<fixed;

using namespace std;

//data type
typedef long long int ll;
typedef unsigned long long int ulli;
typedef double db;


//constants
#define PI acos(-1.00)
#define MOD 1000000007

ll bigmod(ll a,ll b){
    if(b==0){
        return 1;
    }
    ll tm=bigmod(a,b/2);
    tm=(tm*tm)%MOD;
    if(b%2==1)
        tm=(tm*a)%MOD;
    return tm;

}
int egcd(int a,int b,int &x,int &y){
    if(a==0){
        x=0;
        y=1;
        return b;
    }
    int x1,y1;
    int d=egcd(b%a,a,x1,y1);
    x=y1-(b/a)*x1;
    y=x1;
    return d;
}

void solve();


int main()
{
    boost_;
    precise_impact;
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Here we go...
    int t=1;
    //cin>>t;
    while(t--)
        solve();

    thank_you;
}


void solve()
{
    int n,k;
    cin>>n>>k;
    vector<int> v(k);
    iter_(i,k)
        cin>>v[i];
    while(1){
        int c=n;
        bool f=true;
        while(c){
            int tm=c%10;
            if(find(v.begin(),v.end(),tm)!=v.end()){
                f=false;
                break;
            }
            c/=10;
        }
        if(f){
            cout<<n<<endl;
            return ;
        }
        n++;
    }


}



Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdlib>
#define ll long long
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define per(i, b, a) for(int i = (b); i >= (a); i--)
using namespace std;
const int N = 505;
int n, m;
bool a[N][N], b[N][N];
char c[N][N];
int main(){
    cin >> n >> m;
    rep(i, 1, n) cin >> c[i];
    rep(i, 1, n) {
        if(i % 2) rep(j, 1, m - 1) a[i][j] = 1;
        else rep(j, 2, m) b[i][j] = 1;
    }
    rep(i, 1, n) a[i][1] = 1, b[i][m] = 1;
    rep(i, 1, n) rep(j, 0, m - 1) if(c[i][j] == '#') a[i][j+1] = b[i][j+1] = 1;
    rep(i, 1, n) {
        rep(j, 1, m){
            if(a[i][j]) cout << '#';
            else cout << '.';
        }
        cout << "\n";
    }
    cout << "\n";
    rep(i, 1, n) {
        rep(j, 1, m){
            if(b[i][j]) cout << '#';
            else cout << '.';
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

int main() {
	int h, w, n, a[10000], f[100][100] = { 0 };

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

	int y = 0, x = 0, c = 0, use = 0;
	bool up = false;
	while (x < w) {
		f[y][x] = c + 1;
		use++;
		if (use == a[c]) {
			c++;
			use = 0;
		}
		if (up) {
			if (y - 1 >= 0)
				y--;
			else {
				x++;
				up = false;
			}
		}
		else {
			if (y + 1 < h)
				y++;
			else {
				x++;
				up = true;
			}
		}
	}

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cout << f[i][j];
			if (j < w - 1)
				cout << " ";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 384
N=int(input())
a=list(map(int,input().strip().split()))

a=[a[n]-(n+1) for n in range(N)]
a.sort()
result=sum(a[N//2:N])-sum(a[:N//2]) if N%2==0 else sum(a[N//2+1:N])-sum(a[:N//2])
print(result)

Measured memory_bytes: 30676
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
int n, a[maxn];
int main(){
	cin>>n;
	for(int i = 1; i <= n; i ++)cin>>a[i];
	
	int t = 1, m = n;
	if(n % 2 == 1)t = 2;
	
	printf("%d", a[m]);
	m -= 2;
	while(m > 0){
	    printf(" %d", a[m]);
		m -= 2;
	}
	while(t < n){
		printf(" %d", a[t]);
		t += 2;
	}
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const int INF = 1e9;
int dp[51][13][13];

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) cin >> a[i];
    sort(ALL(a));

    int m = 13;
    dp[0][0][0] = INF;

    REP(i,n) REP(j,m) REP(k,m){
        if (j <= a[i]) dp[i+1][a[i]][k] = max(dp[i+1][a[i]][k], min(dp[i][j][k], a[i] - j));
        if (k <= a[i]) dp[i+1][j][a[i]] = max(dp[i+1][j][a[i]], min(dp[i][j][k], a[i] - k));
    }

    int ans = 0;
    REP(j,m) REP(k,m){
        ans = max(ans, min(dp[n][j][k], 24 - j - k));
    }
    cout << ans << endl;
    return 0;
}





Measured memory_bytes: 256
#include<iostream>
using  namespace std;        
int main(){
	int n,a,b,sum=0,temp,s;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++){
		temp=i;
		s=0;
		while(temp>0){
			s=s+(temp%10);
			temp=temp/10;	
		}
		if(a<=s&&s<=b){
			sum+=i;
		}
	}
	cout<<sum;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;

int main()
{
	int N;
	ll sum = 0;
	cin >> N;
	vector<int>v(N);
	for (auto&i : v)cin >> i;
	sort(v.rbegin(), v.rend());
	int idx = 1, plusN = 1;
	sum += v[0];
	while (plusN < N-1) {
		sum += v[idx];
		if (++plusN == N - 1)break;
		sum += v[idx++];
		plusN++;
	}
	cout << sum;
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int a, b,c;
  cin>>a>>b>>c;
  int k;cin >> k;
  bool ok = true;
  while (true)
  {
    if (b > a) break;
    b *= 2;
    k--;
    if (k < 0) {ok = false; break;}
  }
  
  while (true)
  {
    if (c > b) break;
    c *= 2;
    k--;
    if (k<0) {ok=false; break;}
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,x,j,k,cnt=0,key=0;
    cin>>n;
    vector<int>v;
    for(i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    for(k=0;k<v.size();k++)
    {
        cout<<v[k];
        if(k!=v.size()-1)
        {
            cout<<" ";
        }
    }
    cout<<endl;
    for(i=1;i<v.size();i++)
    {
        key = v[i];
        j=i-1;
        while(j>=0&&v[j]>key)
        {

            v[j+1]=v[j];
            j--;

        }

        v[j+1]=key;
        for(k=0;k<v.size();k++)
    {
        cout<<v[k];
        if(k!=v.size()-1)
        {
            cout<<" ";
        }
    }
    cout<<endl;
    }

    return 0;

}


Measured memory_bytes: 3164
n=gets.to_i

m=Math::sqrt(2*n).floor

if 2*n==m*(m+1)
  puts "Yes"
  puts m+1
  nums=*1..n
  ans=[]
  ans<<nums.shift(m)
  m.times{|i|
    ans << ans.map{|ln|ln[i]} + nums.shift(m-ans.size)
  }
  ans.map{|ln|puts [ln.size,*ln].join" "}
else
  puts "No"
end


Measured memory_bytes: 6908
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    ll x, y;
    cin >> x >> y;
    int ans = 0;
    while (x<=y) {
        x *= 2;
        ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	int n;
	cin>>n;
	vector<int> v(n);
	bool flag = true;
	for(int i=0;i<n;i++){
		cin>>v[i];
		if(!(v[i]%2)){
			if(!(v[i]%3==0 || v[i]%5==0))
				flag&=false;
		}
	}
    flag?cout<<"APPROVED":cout<<"DENIED";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
char s[200005];
int main()
{
    cin >> s;
    int len = strlen(s);
    int num = 0 ;
    for(int i=0;i<len;i++){
        num =  num*10+s[i]-'0';
        num%=9;

    }
    if(num){
        cout << "No\n";
    }
    else
        cout <<"Yes\n";
    return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

#define ll long long int

int main(void){

    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int arr[n],brr[n];

    for(unsigned int i = 0;i < n;++i){
        cin >> arr[i];        
        brr[i] = arr[i];
    }
    if(is_sorted(arr,arr+n)){
        cout << "YES" << endl;
        return 0;
    }

     sort(arr,arr+n);
    int cnt = 0;
    for(unsigned int i = 0;i < n;++i){
        if(arr[i] != brr[i])
            ++cnt;
    }
    if(cnt == 2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int a, p;
	cin >> a >> p;
	cout << (p + a * 3) / 2 << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner input = new Scanner(System.in);

    public static void main(String[] args) {

        int n = 0;
        int m = 0;
        double p = 0;
        while (true) {
            n = input.nextInt();
            m = input.nextInt();
            p = input.nextDouble();
            if (n == 0 && m == 0 && p == 0) break;
            int number = 0;
            int sum = 0;
            for (int i = 0; i < n; i++) {
                int ele = input.nextInt();
                sum += ele*100;
                if (i + 1 == m) {
                    number = ele;
                }
            }
            if (number == 0) {
                System.out.println(0);
                continue;
            }
            double win = sum*(100-p)/100;
            int ans = (int) Math.floor(win/number);
            System.out.println((int) ((sum - sum*(p*0.01))/number));
        }
    }
}


Measured memory_bytes: 39416
import java.util.Scanner;

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

        int a1 = sc.nextInt();
        int an = a1;
        int n = 1;
        int anArray[] = new int[1000000];
        anArray[0] = an;

        for (int i = 0; ; i++) {
            //System.out.println(an);

            if (an == 4 || an == 2 || an == 1) {
                System.out.println(n + 3);
                System.exit(0);
            }
            
            n += 1;
            if (an % 2 == 0) {
                an = an / 2;
            } else {
                an = 3 * an + 1;
            }

            //for (int j = 0; j < i; j++) {
            //    if (an == anArray[j]) {
            //        System.out.println(n);
            //        System.exit(0);
            //    }
            //}

            anArray[n - 1] = an;

            
        }
    }
}

Measured memory_bytes: 25940
N, M, X, Y = list(map(int, input().split(" ")))

x_coord = list(map(int, input().split(" ")))
y_coord = list(map(int, input().split(" ")))

is_war = True

for Z in range(X, Y+1):
  if X < Z <= Y and max(x_coord) < Z and min(y_coord) >= Z:
    is_war = False
    break

if is_war:
  print("War")
else:
  print("No War")

Measured memory_bytes: 9132
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int N, M;
int a[304][304];
int freq[304];
int eliminated[304];

int check(int maximSaFie) {
    int maximActual = 0;
    int elim = 0;
    memset(freq, 0, sizeof(freq));
    memset(eliminated, 0, sizeof(eliminated));
    for(int i = 1; i <= N; ++i) {
        freq[a[i][1]]++;
        maximActual = max(maximActual, freq[a[i][1]]);
        a[i][0] = 1;
    }
    
    while(maximActual > maximSaFie && elim < M) {
        int pos = 0;
        int maximDeElim = 0;
        for(int i = 1; i <= N; ++i) {
            if(maximDeElim < freq[a[i][a[i][0]]]) {
                maximDeElim = freq[a[i][a[i][0]]];
                pos = i;
            }
        }
        
        eliminated[a[pos][a[pos][0]]] = 1;
        ++elim;
        
        for(int i = 1; i <= N; ++i) {
            while(eliminated[a[i][a[i][0]]] == 1) {
                freq[a[i][a[i][0]]]--;
                ++a[i][0];
                freq[a[i][a[i][0]]]++;
            }
        }
        
        maximActual = 0;
        for(int i = 1; i <= M; ++i) {
            maximActual = max(maximActual, freq[i]);
        }
    }
    
    if(maximActual <= maximSaFie && elim < M) {
        return 1;
    }
    
    return 0;
}

int main() {
    cin >> N >> M;
    
    for(int i = 1; i <= N; ++i) {
        for(int j = 1; j <= M; ++j) {
            cin >> a[i][j];
        }
    }
    
    int in, sf;
    
    in = 1, sf = N;
    
    while(in < sf) {
        int mij = (in + sf) / 2;
        
        if(check(mij) == 1) {
            sf = mij;
        }
        else {
            in = mij + 1;
        }
    }

    cout << sf << '\n';
    
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	int n,m,a,d,i,j,x,y;
	while(scanf("%d",&n),n)
	{
		char l[30][20]={},f[30][20]={};
		scanf("%d%d%d",&m,&a,&d);
		for(i=0;i<d;++i)scanf("%s",l[i]+5);
		for(y=d-1,x=a+4;y>=0;--y)
		{
			if(l[y][x]==49)++x;
			else if(l[y][x-1]==49)--x;
			f[y][x]=1;
		}
		if(f[0][m+4])puts("0");
		else
		{
			for(y=0,x=m+4;y<d;++y)
			{
				if(l[y][x]==49)++x;
				else if(l[y][x-1]==49)--x;
				else if(f[y][x+1]&&l[y][x+1]-49){printf("%d %d\n",y+1,x-4);goto N;}
				else if(f[y][x-1]&&l[y][x-2]-49){printf("%d %d\n",y+1,x-5);goto N;}
			}
			puts("1");
		}
N:;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n; cin >> n;
	if(n % 2 == 0){
       cout << (n / 2) * (n / 2) << endl;
    }  
    else{
       cout << (n / 2) * (n / 2 + 1) << endl;
    }  
	cin >> n;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n,m,l,i,j,k;
  int a[100][100]={0};
  int b[100][100]={0};
  long int c[100][100]={0};

  scanf("%d %d %d",&n,&m,&l);

  //配列に読み込み
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }

  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      scanf("%d",&b[i][j]);
    }
  }

  //計算して配列cに書き込み
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      for(k=0;k<m;k++){
	c[i][j]+=a[i][k]*b[k][j];
      }
    }
  }

  //配列cを表示
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      printf("%ld",c[i][j]);
      if(j<l-1){
	printf(" ");
      }
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 768
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

# import numpy as np
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, *W = map(int, read().split())

Wcum = itertools.accumulate(W)
S = sum(W)
answer = min(abs(S - x - x) for x in Wcum)
print(answer)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)


constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;



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

	string s; cin >> s;
	reverse(s.begin(), s.end());
	string t[4] = { "maerd", "remaerd", "esare", "resare" };

	while (s.size()) {
		int sz = s.size();

		rep(i, 0, 4) {
			if (s.size() < t[i].size()) continue;
			bool match = true;
			rep(j, 0, t[i].size())  if (s[j] != t[i][j]) match = false;
			if (match) s.erase(0, t[i].size());
		}

		if (s.size() == sz) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>

using namespace std;

int const nmax = 2e5;
int v[1 + nmax];

int main() {

  long long n, k, ans =0;
  cin >> n >> k;
  for(int i = 1;i <= n;i++){
    cin >> v[i];
  }
  sort(v+1, v+n+1);
  for(int i = 1;i <= n-k;i++){
    ans += 1LL * v[i];
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 1024
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        s: chars,
    }
    //let s = vec!['?'; 100000];
    let d = 1e9 as u64 + 7;
    let n = 13;

    let mut dp = vec![0; n];

    dp[0]= 1;

    let mut mul = 1;
    for v in s.iter().rev() {
        let mut next_dp = vec![0; n];
        if *v == '?' {
           for i in 0..10 {
               for j in 0..n {
                   next_dp[(i*mul+j)%n] = next_dp[(i*mul+j)%n] + dp[j];
                   next_dp[(i*mul+j)%n] = next_dp[(i*mul+j)%n] % d;
                   //next_dp[(i*mul+j)%n] += dp[j];
                   //next_dp[(i*mul+j)%n] %= d;
               }
           } 
        } else {
            let i = v.to_digit(10).unwrap() as usize;

            for j in 0..n {
                next_dp[(i*mul+j)%n] = next_dp[(i*mul+j)%n] + dp[j];
                next_dp[(i*mul+j)%n] = next_dp[(i*mul+j)%n] % d;
                //next_dp[(i*mul+j)%n] += dp[j];
                //next_dp[(i*mul+j)%n] %= d;
            }

        }

        for i in 0..n {
            dp[i] = next_dp[i];
        }
        mul = mul * 10;
        mul = mul % n;
    }

    println!("{}", dp[5]);  

}


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

int main(){
  string s; cin>>s;
  ll n = s.size();
  bool can1=true,can2=true,can3=true;
  for(int i=0; i<n/2; i++) {
    if(s[i]!=s[n-1-i]) can1 = false;
  }
  ll m = (n-1)/2, l = (n+3)/2;
  for(int i=0; i<m/2; i++) {
    if(s[i]!=s[m-1-i]) can2 = false;
  }
  for(int i=l; i<n; i++) {
    if(s[i]!=s[n-1-i]) can3 = false;
  }
  if(can1&&can2&&can3) cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int64_t ans;
  int64_t L1=2,L2=1;
  if(n == 1){
    ans = L2;
  }
  else{
    for(int i=0;i < n-1;i++){
      ans = L1+L2;
      L1=L2;
      L2=ans;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;

int main(void) {
	char a[101][101];
	int dp[27] = {};
	int h, w;
	int co4 = 0, co2 = 0, co1 = 0;
	int p, q, r;

	cin >> h >> w;
	FOR(i, 1, h) {
		cin >> a[i];
		FOR(t, 0, w - 1) {
			dp[a[i][t] - 'a' + 1]++;
		}
	}
	FOR(i, 1, 26) {
		p = dp[i] / 4;
		q = (dp[i] - 4 * p) / 2;
		r = dp[i] - 4 * p - 2 * q;
		co4 += p;
		co2 += q;
		co1 += r;
	}
	if (h % 2 == 0 && w % 2 == 0) {
		if (co4 * 4 == h*w) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (h % 2 == 0 && w % 2 == 1) {
		if (w == 1) {
			co2 += co4 * 2;
			if (2 * co2 == h) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}else if (4 * co4 >= (w - 1)*h) {
			co4 -= ((w - 1)*h) / 4;
			co2 += co4;
			if (2 * co2 == h) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (h % 2 == 1 && w % 2 == 0) {
		if (h == 1) {
			co2 += co4 * 2;
			if (2 * co2 == w) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}else if (4 * co4 >= (h - 1)*w) {
			co4 -= ((h - 1)*w) / 4;
			co2 += co4;
			if (2 * co2 == w) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		if (co1 == 1) {
			if (h == 1 || w == 1) {
				co2 += co4 * 2;
				if (2 * co2 == h + w - 2) {
					cout << "Yes" << endl;
				}
				else {
					cout << "No" << endl;
				}
			}else if (4 * co4 >= (h - 1)*(w - 1)) {
				co4 -= (h - 1)*(w - 1) / 4;
				co2 += co4;
				if (2 * co2 == h + w - 2) {
					cout << "Yes" << endl;
				}
				else {
					cout << "No" << endl;
				}
			}
			else {
				cout << "No" << endl;
			}
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,a[3];
	int t=90000;
	for(int i=t;i;i--){
		for(int j=i;j;j--){
			if(i+j==2)cin>>n;
		}
	}
	while(n--){
		for(int i=0;i<3;i++)cin>>a[i];
		sort(a,a+3);
		cout<<(a[0]*a[0]+a[1]*a[1]==a[2]*a[2]?"YES":"NO")<<endl;
	}
	return 0;
}

Measured memory_bytes: 3024