akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>

#define INF 1000000000
using namespace::std;



long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


int min(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int x) {
	if (x < 0) {
		return -x;
	}
	return x;
}

long long N,wa, K,c,ans,a,b,d;

int main() {
	cin >> N;
	if (N % 3 == 0) {
		cout << N / 3 << endl;
	}
	if (N % 3 == 1) {
		cout << ((N-1) / 3) << endl;
	}
	if (N % 3 == 2) {
		cout << (N-2) / 3 << endl;
	}
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 100012;
const ll MOD = 998244353;
ll n,arr[MN];
ll modpow (ll a, ll b, ll m) {
    ll res = 1;
    a %= m;
    while (b) {
        if (b&1) res = res*a%m;
        a *= a;
        a %= m;
        b >>= 1;
    }
    return res;
}
ll mul (ll a, ll b) { return a*b%MOD; }
int main (void) {
    ios::sync_with_stdio(false);cin.tie(0);
    cin >> n;
    ll max_depth = 0;
    for (ll i = 0; i < n; i++) {
        ll x; cin >> x;
        if (i == 0 and x > 0) {
            cout << "0\n";
            return 0;
        }
        arr[x]++;
        max_depth = max(max_depth, x);
    }
    if (arr[0] != 1) {
        cout << "0\n";
        return 0;
    }
    ll ans = 1;
    for (ll i = 1; i <= max_depth; i++) {
        ans = mul(ans, modpow(arr[i-1],arr[i],MOD));
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
     
    int main()
    {
    	ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        //std::numeric_limits<int>::max();
        int a,b,c;
        cin>>a>>b>>c;
        if((a!=b && b!=c && c!=a )|| (a==b && b==c))
        	cout<<"No"<<endl;
        else
        	cout<<"Yes"<<endl;
    }

Measured memory_bytes: 256
using System;
 
class Program{
	static void Main(){
		int[] n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

		Array.Sort(n);

		for (int i = 4; i > 0; i--) Console.Write(n[i] + " ");
		Console.WriteLine(n[0]);
    }
}

Measured memory_bytes: 9312
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ls x<<1
#define rs x<<1|1
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=3e5+100;
int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
ll qpow(ll a,ll b){
	ll ret=1;
	while(b){
		if(b&1)ret*=a;
		b>>=1;
		a*=a;
	}
	return ret;
}
ll get(ll x){
	return x*(x+1)/2;
}
int a[maxn];
void solve()
{
    int n;scd(n);
    rep1(i,n)scd(a[i]);
    int cnt=0,ans=0;
    for(int i=2;i<=n;i++){
    	if(a[i]<=a[i-1])cnt++;
    	else ans=max(ans,cnt),cnt=0;
	}ans=max(ans,cnt);
	ac;
}
int main(){
	//freopen("in.txt","r",stdin);
	//freopen("D://out.txt","w",stdout);
    //IOS;
    solve();
    return 0;
}

Measured memory_bytes: 640
def print_rectangle(H, W):
    
    for i in range(H):
        for j in range(W):
            if i == 0 or i == (H - 1):
                print("#",end="")
            else:
                if j == 0 or j == (W - 1):
                    print("#",end="")
                else:
                    print(".", end="")
                
        print()
    print()



if __name__ == "__main__":

    while(1):

        param = input().split(" ")
        h = int(param[0])
        w = int(param[1])

        if h != 0 and w != 0:
            print_rectangle(h, w)
        else:
            break



Measured memory_bytes: 7004
#include <stdio.h>

int N;
int weights[101];
int sum[101];

int _abs(int num)
{
	return (num < 0) ? -num : num;
}

int main()
{
	int ans = 2147483647;

	scanf("%d", &N);

	for (int i = 1; i <= N; ++i)
	{
		scanf("%d", &weights[i]);
		sum[i] = sum[i - 1] + weights[i];
	}

	
	for (int i = 1; i <= N; ++i)
	{
		if (_abs((sum[N] - sum[i]) - sum[i]) < ans) ans = _abs((sum[N] - sum[i]) - sum[i]);
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 128
//Beg 132 C.cpp
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
#define int long long

int32_t main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    if(v[n/2]==v[(n/2)-1])
    {
        cout<<0;
    }
    else
    {
        cout<<v[n/2]-v[(n/2)-1];
    }
    return 0;
}


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

ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a%b);
}


int main(){
	ll a,b,ans=0,g;
	scanf("%lld%lld",&a,&b);
	g=gcd(a,b);
	for(int i=2;i<=sqrt(g);i++){
		if(g%i==0){
			ans++;
			while(g%i==0)g/=i;
		}
	}
	if(g>2)ans++;
	cout<<ans+1<<endl;
}

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

public class Main {
    public static void main(String[] args) throws IOException {
      final long mod = 1_000_000_007L;
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String[] p = br.readLine().split(" ");
	  int h = Integer.parseInt(p[0]);
	  int w = Integer.parseInt(p[1]);
	  int k = Integer.parseInt(p[2]);
      br.close();
	  long[][] a = new long[h+1][w+2];
	  long[] f = new long[w+2];
	  a[0][1] = 1; f[0] = 0; f[1] = f[2] = 1;
	  for (int i=3;i<w+2;i++) f[i] = f[i-1] + f[i-2];
	  for (int i=1;i<h+1;i++) for (int j=1;j<w+1;j++) a[i][j] = (f[j-1]*f[w-j+1]*a[i-1][j-1]%mod + f[j]*f[w-j+1]*a[i-1][j]%mod + f[j]*f[w-j]*a[i-1][j+1]%mod) % mod;
	  System.out.println(a[h][k]);
    }
}

Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {

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

    int n = sc.nextInt();
    long[] b = new long[n - 1];
    for (int i = 0; i < n - 1; i++) {
      b[i] = sc.nextInt();
    }

    long sum = b[0];
    for (int i = 1; i < b.length; i++) {
      sum += Math.min(b[i - 1], b[i]);
    }
    System.out.println(sum + b[b.length - 1]);
  }
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int H, W, N;
    cin >> H >> W >> N;
    cout << (N + max(H, W) - 1) / max(H, W) << '\n';

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	ll n;
	cin >> n;
	vector<string>s(n);
	map<string, ll>ss;
	ll sum = 0;
	rep(i, n) {
		string s;
		cin >> s;
		sort(s.begin(),s.end());
		if (ss[s] == 0) {
			ss[s] = 1;
		}
		else {
			sum += ss[s];
			ss[s] +=1;
		}
	}
	
	cout << sum;
	return 0;
}

Measured memory_bytes: 11904
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
int n,a,b;
int ans;
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++){
		int sum=0,x=i;
		while(x){
			sum+=x%10;
			x/=10;
		}
		if(sum>=a&&sum<=b) ans+=i;
	}
	cout<<ans;
	re 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X[i];
    ll ans = 1e9+7;
    for(int i = 1; i<=100; i++){
        ll sum = 0;
        rep(j, N) sum += pow(X[j]-i,2);
        ans = min(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int n,h[101];
    int i,j,k;
    int s[101],b[101];
    int f;
      
    scanf("%d",&n);
    while(n!=0){
        for(i=0;i<n+1;i++){
            scanf("%d",&h[i]);
        }
        for(i=0;i<n+1;i++){
            k=0;
            for(j=0;j<n+1;j++){
                if(i!=j){
                    b[k]=h[j];
                    k++;
                }
            }
            for(j=0;j<n-1;j++){
                s[j]=b[j+1]-b[j];
            }
            f=0;
            for(j=0;j<n-2;j++){
                if(s[j]!=s[j+1]){
                    f=1;
                }
            }
            if(f==0){
                printf("%d\n",h[i]);
                break;
            }
        }   
        scanf("%d",&n);
    }
    return 0;
}

Measured memory_bytes: 600
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim A As Integer = NextInt()
        Dim B As Integer = NextInt()
        Dim C As Integer = NextInt()
        Dim D As Integer = NextInt()

        Dim ans As Integer = 0
        For i As Integer = A To B - 1
            If C <= i AndAlso i < D Then
                ans += 1
            End If
        Next

        WriteLine(ans)
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

ll MOD = 1000000007;

int label(int i, int j, int mlabel) {
    for(int t=0;t<mlabel;t++) {
        if (((i & (1<<t)) == 0) && 
            ((j & (1<<t)) != 0)) {
                return (t+1);
            }
        else if (((i & (1<<t)) != 0) && 
            ((j & (1<<t)) == 0)) {
                return (t+1);
            }
    }
    return -1;
}

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

    int N;
    
    cin >> N;
    
    int tp = 1;
    int maxlabel = 0;
    while (tp < N) {
        tp *= 2;
        maxlabel += 1;
    }

    for (int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            cout << label(i, j, maxlabel) << " \n"[j+1==N];
        }
    }

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/

int n,k,a[105];
int DP[105][114514];
signed main() {
	cin>>n>>k;
	rep(i,n){
		cin>>a[i];
	}
	DP[0][0]=1;
	DP[0][1]=-1;
	rep(i,n){
		rep(j,k+1){
			DP[i][j]=(DP[i][j]+mod)%mod;
			DP[i+1][j]+=DP[i][j];
			DP[i+1][min(k,j+a[i])+1]-=DP[i][j];
			DP[i][j+1]+=DP[i][j];
		}
	}
	rep(i,k+1){
		DP[n][i]=(DP[n][i]+mod)%mod;
		DP[n][i+1]+=DP[n][i];
	}
	cout<<DP[n][k]<<endl;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    vector<int> ans;
    for(int i = 0; i < 4; i++){
    	ans.resize(n);
    	ans[0] = i%2;
    	ans[1] = i/2;
    	for(int j = 1; j < n-1; j++){
    		if(s[j] == 'o'){
    			if(ans[j] == 0) ans[j+1] = ans[j-1];
    			else ans[j+1] = !ans[j-1];
    		}
    		else{
    			if(ans[j] == 0) ans[j+1] = !ans[j-1];
    			else ans[j+1] = ans[j-1];
    		}
    	}
    	if(s[0] == 'o'){
    		if((ans[0] == 0) ^ (ans[1] == ans.back())) continue;
    	}
    	else{
    		if((ans[0] == 0) ^ (ans[1] != ans.back())) continue;
    	}
    	if(s.back() == 'o'){
    		if((ans.back() == 0) ^ (ans[0] == ans[n-2])) continue;
    	}
    	else{
    		if((ans.back() == 0) ^ (ans[0] != ans[n-2])) continue;
    	}
    	for(int j = 0; j < n; j++){
    		cout << "SW"[ans[j]];
    	}
    	cout << endl;
    	return 0;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 976
#include <cstdio>
using namespace std;
#define E 2000*n
int main(){
	int n;	scanf("%d",&n);
	int a;
	bool data[E];
	for(int i=1;i<E;i++)	data[i]=false;
	data[0]=true;
	int max=0;
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		for(int j=max;j>=0;j--){
			if(data[j])	data[j+a]=true;
		}
		max+=a;
	}
	int q;	scanf("%d",&q);
	int m;
	for(int i=0;i<q;i++){
		scanf("%d",&m);
		printf("%s\n",(data[m]?"yes":"no"));
	}
	return 0;
}

Measured memory_bytes: 1044
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;
typedef long long ll;

struct XStruct
{
	int x;
	int Left;
	int Right;

	bool operator<(const XStruct &x) const
	{
		return Left < x.Left;
	};
};

int main()
{
	int N;
	int A[100000];
	
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	
	sort(A, A+N);
	
	int count = 0;
	for(int i = 0; i < N-1; i++){
		if(A[i] == A[i+1]){
			count++;
		}
	}
	
	if( count % 2 == 0){
		printf("%d\n", N - count);
	}
	else
	{
		printf("%d\n", N - count - 1);
	}
	
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll H, W, N, sr, sc; string S, T;
    cin >> H >> W >> N >> sr >> sc >> S >> T;
    sr--; sc--;

    reverse(S.begin(), S.end());
    reverse(T.begin(), T.end());

    ll left = 0, right = W-1, up = 0, down = H-1;
    Rep (i, N) {
        if (T[i] == 'L') right = min(right+1, W-1);
        if (T[i] == 'R') left = max(left-1, (ll)0);
        if (T[i] == 'U') down = min(down+1, H-1);
        if (T[i] == 'D') up = max(up-1, (ll)0);
        if (S[i] == 'L') left++;
        if (S[i] == 'R') right--;
        if (S[i] == 'U') up++;
        if (S[i] == 'D') down--;
        if (left > right || up > down) {
            cout << "NO\n";
            return 0;
        }
    }

    // cout << left << " " << right << " " << up << " " << down << endl;
    if (left <= sc && sc <= right && up <= sr && sr <= down) cout << "YES\n";
    else cout << "NO\n";
}

Measured memory_bytes: 920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll N; cin >> N;
    vector<int> a(N + 1); 
    for (int i = 1; i <= N; ++i) cin >> a[i];
    vector<int> b(N + 1, 0); 
    ll all = 0;
    for (int i = N; i >= 1; --i) {
        for (int j = 2; i * j <= N; ++j) b[i] += b[i * j];
        b[i] %= 2;
        b[i] = !(b[i] == a[i]);
        all += b[i];
    }
    cout << all << endl;
    for (int i = 1; i <= N; ++i) {
        if (b[i] == 1) cout << i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4756
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

void dfs(int cur, vector<vector<int>> &g, vector<bool> &used, set<pair<int, int>> &edges) {
  
  used[cur] = true;
  for (auto nxt : g[cur]) {
    if (used[nxt]) continue;
    
    edges.insert({min(cur, nxt), max(cur, nxt)});
    dfs(nxt, g, used, edges);
  }
}

void dfs2(int cur, int par, vector<vector<int>> &tree, vector<int> &deg, vector<pair<int, int>> &ans) {

  for (auto nxt : tree[cur]) {
    if (nxt == par) continue;
    dfs2(nxt, cur, tree, deg, ans);
  }
  
  if (deg[cur] % 2 == 0) {
    if (par == -1) return;
    ans.push_back({par + 1, cur + 1});
    deg[par]++;
  } else {
    ans.push_back({cur + 1, par + 1});
  }

}

int main() {
  
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int a, b; cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  if (m % 2 == 1) {
    cout << -1 << endl;
    return 0;
  }

  
  // 適当に全域木を作る
  vector<bool> used(n, false);
  set<pair<int, int>> edges;
  dfs(0, g, used, edges);

  vector<vector<int>> tree(n);
  for (auto e : edges) {
    int u, v;
    tie(u, v) = e;
    tree[u].push_back(v);
    tree[v].push_back(u);
  }
  
  vector<int> deg(n, 0);
  // 木以外の辺は適当にやる
  vector<pair<int, int>> ans;
  for (int u = 0; u < n; u++) {
    for (auto v : g[u]) {
      if (u < v) continue;
      if (edges.find({min(u, v), max(u, v)}) == edges.end()) {
        ans.push_back({u + 1, v + 1});
        deg[u]++;
      }
    }
  }


  dfs2(0, -1, tree, deg, ans);

  for (auto i : ans) {
    cout << i.first << " " << i.second << endl;
  }
  return 0;
}


Measured memory_bytes: 30964
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string s;
    cin >> s;
    string ans;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='0') ans+='0';
        if(s[i]=='1') ans+='1';
        if(s[i]=='B' && ans.size()) ans.pop_back();
    }
    cout << ans << endl;






    /*
    for(int i=s.size()-1; i>=0; i--){
        if(s[i]=='0') ans+='0';//,cout<< "0";
        if(s[i]=='1') ans+='1';//,cout<< "1";
        //Bだった場合、この先いくつBがあるかを見る
        if(s[i]=='B'){
            int j=i;
            int wk=0; //飛ばす値
            while(s[j--]=='B'){
                wk++;
            }
            i=i-wk;
        }
        
        /*
        if(s[i]=='B' && s[i-1]!='B') i=i-1;
        if(s[i]=='B' && s[i-1]=='B') i=i-2;//,cout<< "B";
    }
    for(int i=ans.size()-1; i>=0; i--){
        cout << ans[i];
    }
    cout << "\n";
    return 0;
    }*/
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>

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

using namespace std;

typedef unsigned long ul;



ul p, q, r;

int main() {

//    ifstream in("/Users/koichihasegawa/src/repository/cpp/AtCoder/ABC/abc130/input.txt");
//    cin.rdbuf(in.rdbuf());

    cin >> p >> q >> r;

    cout << p + q + r - max(p, max(q, r));

    return 0;
}


Measured memory_bytes: 888
/* ex4-4
   takayanagi.y.aa
   Yuta Takayanagi  */

#include<stdio.h>
int main(void){
    int number, bit1, bit2, i;

    scanf( "%d" , &number);

    bit1 = number % 10;
    number = (number - bit1) / 10;

    for(i=0; i < 3; i++){

        bit2 = number % 10;
        number = (number - bit2) / 10;

        if(bit1==bit2){

            printf( "Bad\n" );

            return 0;

        }

        bit1 = bit2;

    }

    printf( "Good\n" );

    return 0;

}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int h, w, c, p[8][8];
bool used[8][8];

int search(int color) {
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) used[i][j] = false;
  int before = p[0][0];
  queue<P> que;
  que.push(P(0, 0));
  p[0][0] = color;
  used[0][0] = true;
  int counter = 1;
  while (!que.empty()) {
    P q = que.front(); que.pop();
    int x = q.first, y = q.second;
    for (int i = 0; i < 4; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
      if (used[ny][nx]) continue;
      used[ny][nx] = true;
      if (p[ny][nx] == before) {
        counter++;
        p[ny][nx] = color;
        que.push(P(nx, ny));
      }
    }
  }
  return counter;
}

int dfs(int counter, int nowNumber) {
  int copy[8][8];
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) copy[i][j] = p[i][j];
  int ans = nowNumber;
  for (int i = 1; i <= 6; i++) {
    if (i == copy[0][0]) continue;
    if (counter == 0 && i != c) continue;
    for (int j = 0; j < h; j++)
      for (int k = 0; k < w; k++) p[j][k] = copy[j][k];
    search(i);
    int temp = search(p[0][0]);
    if (counter == 0) ans = max(ans, temp);
    else if(temp != nowNumber) ans = max(ans, dfs(counter - 1, temp));
  }
  return ans;
}

int main() {
  while (1) {
    scanf("%d%d%d", &h, &w, &c);
    if (h == 0) break;
    for (int i = 0; i < h; i++)
      for (int j = 0; j < w; j++) scanf("%d", &p[i][j]);
    printf("%d\n", dfs(4, 0));
  }
}



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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  string ans = (a[a.length()-1] == b[0] && b[b.length()-1] == c[0]) ? "YES" : "NO";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N;
  int s[110];
  int res=0;
  cin >> N;

  rep(i,N) cin >> s[i];

  rep(i,N){
    res += s[i];
  }

  sort(s, s+N);

  if(res % 10 != 0) {
    cout << res << endl;
    return 0;
  }
  rep(i,N){
    if((res - s[i]) % 10 != 0){
      cout << res - s[i] << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}


Measured memory_bytes: 256
/*Lower_Rating*/
/*AGC 036 GP 2 组合数学综合能力测试*/
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;

#define LL long long
#define MAXN 2000000
#define MOD 998244353
#define Pr pair<int,int>
#define X first
#define Y second
#define INF 2000000000
#define mem(x,p) memset(x,p,sizeof(x))

LL read(){
  LL x=0,F=1;char c=getchar();
  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
  while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
  return x*F;
}
int add(int x,int y){return (x+y>=MOD)?x+y-MOD:x+y;}
int dec(int x,int y){return (x-y<0)?x-y+MOD:x-y;}
int mul(int x,int y){return 1LL*x*y%MOD;}

int n,m;
int fac[MAXN+5],inv[MAXN+5];
int fst_pow(int a,int b){
    int res=1;
    while(b){
        if(b&1)res=mul(res,a);
        a=mul(a,a);
        b>>=1;
    }return res;
}
void prepare(){
    fac[0]=1;
    for(int i=1;i<=MAXN;i++)
    fac[i]=mul(fac[i-1],i);
    inv[MAXN]=fst_pow(fac[MAXN],MOD-2);
    for(int i=MAXN-1;i>=0;i--)
    inv[i]=mul(inv[i+1],i+1);
}
int Comb(int a,int b){
    return mul(fac[a],mul(inv[b],inv[a-b]));
}
int cal(int num,int sum,int odnum){
    int res=0;
    for(int i=0;i<=min(num,odnum);i++)
    if((sum-i)%2==0){
        int pnum=(sum-i)/2;
        res=add(res,mul(Comb(pnum+num-1,num-1),Comb(num,i)));
    }
    return res;
}
int main()
{
    prepare();
    n=read(),m=read();
    printf("%d",dec(cal(n,m*3,m),mul(n,dec(cal(n,m,m),cal(n-1,m,m))))) ;
}
/*
Condition:
1.a_1+a_2+...+a_n=3m
2.max{a_1,a_2,...,a_n}<=2m(暴力)
3.tot_{a_i is odd}<=m
如果没猜错的话应该是充要条件
容斥，发现只会有一个数大于2m...
然后将它减去2m(容斥套路,这样奇偶性不变)
1.a_1+a_2+...+a_n=m
2.tot_{a_i is odd}<=m(暴力)
3.a_p>0***(WA了半天才发现...a_p=0,a_p去掉再计算一遍)
这几行字花了我1h40min...
*/


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

int main(){
    long long N;
    scanf( "%lld" , &N );

    if( N & 1LL ){
        puts( "0" );
        return 0;
    }

    long long Value = 5LL , Count = 0;
    N /= 2LL;
    
    while( N >= Value ){
        Count += N / Value;
        Value *= 5LL;
    }

    printf( "%lld\n" , Count );
    return 0;
}

Measured memory_bytes: 256
# 全方位木DP
import sys
input = sys.stdin.readline
from collections import deque

N, mod = map(int, input().split())
X = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

P = [-1] * N
Q = deque([0])
R = []
while Q:
    i = deque.popleft(Q)
    R.append(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            X[a].remove(i)
            deque.append(Q, a)

##### Settings
unit = 1
merge = lambda a, b: a * b % mod
adj_bu = lambda a, i: a + 1
adj_td = lambda a, i, p: a + 1
adj_fin = lambda a, i: a
#####

ME = [unit] * N
XX = [0] * N
TD = [unit] * N
for i in R[1:][::-1]:
    XX[i] = adj_bu(ME[i], i)
    p = P[i]
    ME[p] = merge(ME[p], XX[i])
XX[R[0]] = adj_fin(ME[R[0]], R[0])

# print("ME =", ME) # Merge before adj
# print("XX =", XX) # Bottom-up after adj

for i in R:
    ac = TD[i]
    for j in X[i]:
        TD[j] = ac
        ac = merge(ac, XX[j])
    ac = unit
    for j in X[i][::-1]:
        TD[j] = adj_td(merge(TD[j], ac), j, i)
        ac = merge(ac, XX[j])
        XX[j] = adj_fin(merge(ME[j], TD[j]), j)

# print("TD =", TD) # Top-down after adj
# print("XX =", XX) # Final Result

print(*XX, sep = "\n")

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

using ll=long long;
const ll MOD=1e9+7;

int main(){
  int N,K;
  cin >> N >> K;
  int ans=K;
  for(int i=2;i<=N;i++){
    ans=ans*(K-1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
idx = 0
work = int(input())
I = str(work) + ','
while work != 0:
    work = int(input())
    I += str(work) + ','
    idx += 1

O = I.split(',')

i = 0
while i < idx:
    print("Case " + str(i + 1) + ": " + O[i])
    i += 1

Measured memory_bytes: 8328
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
ll mul(ll a, ll b, ll md){
	return a*b % md;
}
const int N = 1e5 + 5;
vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}
ll komb(ll a, ll b){
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	int c = n%10;
	if(c == 2 || c == 4 || c == 5 || c == 7 || c == 9) cout<<"hon";
	else if(c == 0 || c == 1 || c == 6 || c == 8) cout<<"pon";
	else cout<<"bon";
}

Measured memory_bytes: 3644
n,A,B=map(int,input().split())
contestant=list(input())
aa=0
bb=0
for i in range(n):
  if contestant[i]=="c":
    print("No")
  elif contestant[i]=="b":
    if aa+bb<A+B and bb<B:
      print("Yes")
      bb+=1
    else:
      print("No")
    
  elif contestant[i]=="a":
    if aa+bb<A+B:
      print("Yes")
    else:
      print("No")
    aa+=1


Measured memory_bytes: 4708
#define REP(i, n) for (int i = 0;i<(int)(n);i++)
#define REPI(i, a, n) for(int i=int(a);i<int(b);i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())

typedef long long ll;

#include <bits/stdc++.h>

using namespace std;


int main(){
    std::cin.tie(0);
    int a,b,c,d;
    cin >>a>>b>>c>>d;
    if(a+b < c+d)cout<<"Right";
    else if(a+b == c+d)cout<<"Balanced";
    else cout << "Left";
    cout<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,r;
    cin>>a>>b>>c;
    r=a+b+c;

    if(r>=22)
    {
        cout<<"bust"<<endl;
    }
    else
    {
        cout<<"win"<<endl;
    }

 return 0;
}


Measured memory_bytes: 3624
class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n)) #親ノード
        self.size = [1]*n #グループの要素数
 
    def root(self, x): #root(x): xの根ノードを返す．
        while self.parent[x] != x:
            self.parent[x] = self.parent[self.parent[x]]
            x = self.parent[x]
        return x 
 
    def merge(self, x, y): #merge(x,y): xのいる組とyのいる組をまとめる
        x, y = self.root(x), self.root(y)
        if x == y: return False
        if self.size[x] < self.size[y]: x,y=y,x #xの要素数が大きいように
        self.size[x] += self.size[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True
 
    def issame(self, x, y): #same(x,y): xとyが同じ組ならTrue
        return self.root(x) == self.root(y)
        
    def getsize(self,x): #size(x): xのいるグループの要素数を返す
        return self.size[self.root(x)]

# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,k,l = map(int,readline().split())

UF1 = UnionFind(n)
UF2 = UnionFind(n)

for _ in range(k):
    p,q = map(int,readline().split())
    UF1.merge(p-1,q-1)

for _ in range(l):
    r,s = map(int,readline().split())
    UF2.merge(r-1,s-1)

from collections import Counter
d = Counter()
for i in range(n):
    p1 = UF1.root(i)
    p2 = UF2.root(i)
    d[(p1,p2)] += 1

ans = [0]*n
for i in range(n):
    p1 = UF1.root(i)
    p2 = UF2.root(i)
    ans[i] = d[(p1,p2)]

print(*ans)

Measured memory_bytes: 131156
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

ll mod=1000000007;
vecll perm;

ll modpow(ll a,ll b){
    if(b==0)return 1;
    if(b%2==0){
        ll d=modpow(a,b/2);
        return d*d%mod;
    }
    return a*modpow(a,b-1)%mod;
}

ll divide(ll a,ll b){
    return a*modpow(b,mod-2)%mod;
}

void makeperm(vecll v, ll size){
    v.resize(size);
    v[0]=1;
    rep(i,size-1)v[i+1]=v[i]*(i+1)%mod;
}

ll comb(ll a,ll b){
    return divide(divide(perm[a],perm[b]),perm[a-b]);
}

int main(){
    int n=in(),k=in();
    makeperm(perm,n+3);
    vecll cnt(k+1);
    cnt[k]=1;
    ll ans=0;
    rep3(i,k-1,1){
        cnt[i]=modpow(k/i,n);
        ll tmp=i*2;
        while(tmp<=k){
            cnt[i]-=cnt[tmp];
            tmp+=i;
        }
    }
    rep(i,k){
        ans+=cnt[i+1]*(i+1)%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4428
while True:
    a,b,c = map(int, input().strip().split(' '))
    temp = 0
    if a == 0 and b == 0 and c == 0:
        break
    for i in range(1, c):
        for j in range(i, c):
            if i*(100+a)//100 + j*(100+a)//100 == c:
                if temp < i*(100+b)//100 + j*(100+b)//100:
                    temp = i*(100+b)//100 + j*(100+b)//100
    print(temp)


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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	string s;cin>>s;
    char a = s[0];
    bool flag = false;
    int count = 0;
    rep(i, s.length()){
        if(s[i]!=a){
            a=s[i];
            count++;
        }
    }
    cout << count << endl;
	
	return 0;
}


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

int main()
{
    long long n , sum = 0, a[100000];
    cin >> n;
    a[0] = a[n+1] = 0;
    for (int i = 1 ; i <= n; i++){
        cin >> a[i];
        sum += abs(a[i-1]-a[i]);
    }
    sum += abs(a[n]-a[n+1]);
    
    for (int i = 1 ; i <= n ; i++){
        cout << sum - abs(a[i-1]-a[i]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1]) << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
import bisect

n = int(input())
a = list(map(int,input().split()))
a.sort()
sect = 0
col = 0
for i in range(400,3201,400):
    nsect = bisect.bisect_left(a,i)
    if nsect>sect:
        sect = nsect
        col += 1
print(max(col,1),col+n-nsect)

Measured memory_bytes: 9056
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] arr = new long[n];
        for(int i = 0; i < n; i++)
        	arr[i] = sc.nextLong();

        long cnt = 0;
        int leftIdx = 0;
        long curSum = 0;
        long curXOR = 0;
        for(int i = 0; i < n; i++) {
        	curSum += arr[i];
        	curXOR ^= arr[i];
        	while(curSum != curXOR) {
        		long leftNum = arr[leftIdx++];
        		curSum -= leftNum;
        		curXOR ^= leftNum;
        	}
        	cnt += i - leftIdx + 1;
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 83604
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll A, B, K;
    cin >> A >> B >> K;

    vector<ll> V;
    // iで割る
    FOR(i, 1, 101){
        if(A%i==0 && B%i==0){
            V.push_back(i);
        }
    }
    
    ll L = V.size();
    p(V[L-K]);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using ll = long long;
using ld = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VI = vector<int>;
using VVI = vector<VI>;
using Vll = vector<ll>;
using VVll = vector<Vll>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  if (K == 0)
  {
    cout << N*N << endl;
    return 0;
  }
  ll ans = 0;
  for (ll i = 1; i < N-K+1; ++i)
  {
    ll num = (N-K+1) / (i+K);
    ans += num*i;
    ans += min(i, N-((i+K)*num+K)+1);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;

    int num = 0;
    for (int i = 0; i < s.length(); ++i) {
        if (s[i] == '+')
            ++num;
        else
            --num;
    }
    cout << num << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    
    if(a<=b&&b<=c){
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
    else if(a<=c&&c<=b){
        cout<<a<<" "<<c<<" "<<b<<endl;
    }
    else if(b<=a&&a<=c){
        cout<<b<<" "<<a<<" "<<c<<endl;
    }
    else if(b<=c&&c<=a){
        cout<<b<<" "<<c<<" "<<a<<endl;
    }
    else if(c<=a&&a<=b){
        cout<<c<<" "<<a<<" "<<b<<endl;
    }
    else if(c<=b&&b<=a){
        cout<<c<<" "<<b<<" "<<a<<endl;
    }
    return 0;
    
}


Measured memory_bytes: 3100
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def DFS(N, string, val, L):
	L.append(int(string))
	if N == 11:
		return
	else:
		if val == 0:
			DFS(N + 1, string + "0", 0, L)
			DFS(N + 1, string + "1", 1, L)
		elif val == 9:
			DFS(N + 1, string + "9", 9, L)
			DFS(N + 1, string + "8", 8, L)
		else:
			DFS(N + 1, string + str(val + 1), val + 1, L)
			DFS(N + 1, string + str(val), val, L)
			DFS(N + 1, string + str(val - 1), val - 1, L)

#処理内容
def main():
	K = int(input())
	L = []
	for i in range(10):
		DFS(0, str(i), i, L)

	L = sorted(list(set(L)))

	print(L[K])


if __name__ == '__main__':
	main()

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

int main()
{ 
  string s ;
  cin >> s ;
  if(s.size() == 2)
  {
    cout << s << endl ;
  }
  else
  {
    reverse(s.begin(), s.end()) ;
    cout << s << endl ;
  }
  
}


Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cmath>
#include <limits>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mod 1000000007
#define fst first
#define pb push_back
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 x, ll y) { return y ? gcd(y, x % y) : x; }


int main()
{
	ll n;
	cin >> n;
	ll cnt = 0;
	cout << (n - 1) / 2 << endl;
}

Measured memory_bytes: 256
#!/usr/bin/ruby
class TLLI
	def initialize
		@trianies=[nil,[0,0,0]]
	end
	def root_triany
		1
	end
	def allocate_triany
		siz=@trianies.size
		@trianies[siz]=[0,0,0]
		return siz
	end
	def set_a(id,value)
		return if !@trianies[id]
		@trianies[id][0]=value
	end
	def set_b(id,value)
		return if !@trianies[id]
		@trianies[id][1]=value
	end
	def set_c(id,value)
		return if !@trianies[id]
		@trianies[id][2]=value
	end
	def get_a(id)
		return if !@trianies[id]
		@trianies[id][0]
	end
	def get_b(id)
		return if !@trianies[id]
		@trianies[id][1]
	end
	def get_c(id)
		return if !@trianies[id]
		@trianies[id][2]
	end
end

class SETI <TLLI # a=>key, b=>left, c=>right
	def set_entry(key)
		x=root_triany
		y=0
		while x!=0&&!(x==root_triany&&get_a(x)==0) #fixme
			y=x
			if key<get_a(x)
				x=get_b(x)
			else
				x=get_c(x)
			end
		end
		if y==0
			set_a(root_triany,key)
		else
			leaf=allocate_triany
			set_a(leaf,key)
			if key<get_a(y)
				set_b(y,leaf)
			else
				set_c(y,leaf)
			end
		end
	end
	def find_entry(key)
		t=root_triany
		loop{
			return true if key==get_a(t)
			if key<get_a(t)
				t=get_b(t)
				return false if t==0
			else
				t=get_c(t)
				return false if t==0
			end
		}
	end
	def delete_entry(key)
		left=false
		prev=nil
		t=root_triany
		loop{
			break if key==get_a(t)
			prev=t
			if key<get_a(t)
				t=get_b(t)
				left=true
				return false if t==0
			else
				t=get_c(t)
				left=false
				return false if t==0
			end
		}
		if get_b(t)>0&&get_c(t)>0
			children=inorder_internal(get_c(t))+[t]
			set_a(t,get_a(children[0]))
 
			prev=children[1]
			#left of parent of t
			if prev!=t
				set_b(prev,0)
				left=true
			else
				left=false
			end
			t=children[0]
		end
		if get_b(t)+get_c(t)>0
			n=get_b(t)+get_c(t)
			if left
				set_b(prev,n)
			else
				set_c(prev,n)
			end
		else
			if left
				set_b(prev,0)
			else
				set_c(prev,0)
			end
		end
	end
	def inorder_internal(t)
		t==0 ? [] : inorder_internal(get_b(t))+[t]
	end
	def print_preorder(t)
		return if t==0
		Kernel.print " #{get_a(t)}"
		print_preorder(get_b(t))
		print_preorder(get_c(t))
	end
	def print_inorder(t)
		return if t==0
		print_inorder(get_b(t))
		Kernel.print " #{get_a(t)}"
		print_inorder(get_c(t))
	end
	def print_postorder(t)
		return if t==0
		print_postorder(get_b(t))
		print_postorder(get_c(t))
		Kernel.print " #{get_a(t)}"
	end
	def print
		print_inorder(root_triany);puts
		print_preorder(root_triany);puts
	end
end
 
seti=SETI.new
gets
$<.each{|l|
	a=l.split
	if a[0]=='insert'
		seti.set_entry(a[1].to_i)
	elsif a[0]=='find'
		puts seti.find_entry(a[1].to_i) ? :yes : :no
	elsif a[0]=='delete'
		seti.delete_entry(a[1].to_i)
	elsif a[0]=='print'
		seti.print
	end
}

Measured memory_bytes: 53652
// luogu-judger-enable-o2
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 1e5+5;
struct Edge
{
    int next, to;
    Edge(int next = 0, int to = 0):next(next), to(to) {};
}edge[N<<1];
int tot, head[N];
void _add(int x, int y) { edge[++tot] = Edge(head[x], y); head[x] = tot; }
void add(int x, int y) { _add(x, y); _add(y, x); }
int n, m, cn, w[N], f[N], fa[N], s[N], p, q, ans;
int find(int x) { return f[x] == x?x:f[x] = find(f[x]); }
void dfs(int x, int f, int c)
{
    fa[x] = f, s[x] = c;
    for(int i = head[x]; i; i = edge[i].next)
    {
        int y = edge[i].to; if(y == f) continue;
        dfs(y, x, -c); s[x] += s[y];
    }
}
int main()
{
    n = read(), m = read(), p = 1;
    for(int x = 1; x <= n; ++x) f[x] = x;
    for(int i = 1; i <= m; ++i)
    {
        int x = read(), y = read();
        if(find(x) == find(y)) p = x, q = y;
        else f[find(y)] = find(x), add(x, y);
    }
    dfs(p, 0, 1);
    if(n == m)
    {
        for(int x = q; x; x = fa[x]) w[++cn] = s[x];
        if(cn&1)
        {
            if(s[p]&1) return puts("-1"), 0;
            for(int x = q; x; x = fa[x]) s[x] -= s[p]>>1;
        } 
        else
        {
            if(s[p]) return puts("-1"), 0;
            sort(w+1, w+1+cn);   
            for(int x = q; x; x = fa[x]) s[x] -= w[cn>>1];
        }
    }
    else if(s[p]) return puts("-1"), 0;
    for(int x = 1; x <= n; ++x) ans += abs(s[x]);
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

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

  double R;
  cin >> R;

  cout << setprecision(16) << 2 * 3.1415926535 * R << endl;

  return 0;
}


Measured memory_bytes: 3816