akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int a, b, t;
	cin >> a >> b >> t;
	int ans = 0;
	for(int i = a; i <= t; i += a){
		ans += b;
	}
	cout << ans << endl;

	return 0;
}

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

cnt = [0]*N
for i in range(N):
    for j in range(i+1, N):
        dist = min(abs(i-j),
                   abs(X-i) + abs(Y-j) + 1,
                   abs(X-j) + abs(Y-i) + 1)
        cnt[dist] += 1

print(*cnt[1:], sep='\n')


Measured memory_bytes: 3444
N = int(input())
A = input().split(' ')
a = 0
sum = 0
for i in range(1, N):
    sum += int(A[i])
for i in range(N):
    a += int(A[i]) *  sum
    if i < N - 1:
        sum -= int(A[i + 1])
    
print(int(a % (10 ** 9 + 7)))

Measured memory_bytes: 25092
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;
import static java.lang.Math.*;

public class Main
{
    int n;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();
	
	out();
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	n = sc.nextInt();
    }

    void out()
    {
	boolean flg = false;
	for(int i = n; i >= 0; i -= 4) {
	    if(i % 7 == 0 || i % 4 == 0) flg = true;
	}

	out(flg ? "Yes" : "No");
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(double n)
    {
	System.out.println(n);
    }

    void out(long n)
    {
	System.out.println(n);
    }
    
    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
}


Measured memory_bytes: 23892
n,m=map(int,input().split())
edges=[set() for i in range(n+1)]
for i in range(m):
	a,s=map(int,input().split())
	edges[a].add(s)
	edges[s].add(a)
for i in range(2,n):
	if i in edges[1] and i in edges[n]:
		print("POSSIBLE");exit()
print("IMPOSSIBLE")

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

using namespace std;

#define llong long long int
#define ldouble long double
#define ternary(condition, x, y) ((condition) ? x : y) 
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static llong MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

const static int N = 100000;
int visit[N + 1] = {}, sum_cost[N + 1] = {};
vector<vector<pair<int, int> > > G(N + 1);

int dfs(int x) {
    visit[x] = 1;

    for(size_t i = 0; i < G[x].size(); i++) {
        if (visit[G[x][i].first]) {
            if (sum_cost[G[x][i].first] != sum_cost[x] + G[x][i].second) return 0;
        } else {
            sum_cost[G[x][i].first] = sum_cost[x] + G[x][i].second;
            if (dfs(G[x][i].first) == 0) return 0;
        }
    }
    return 1;
}

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    int l, r, d;
    rep(i, m) {
        cin >> l >> r >> d;
        G[l].push_back(make_pair(r, d));
        G[r].push_back(make_pair(l, -d));
    }

    for (int i = 1; i <= n; ++i) {
        if (dfs(i) == 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define FOR(i,l,r) for(long long i=l; i<r; i++)
#define FOR_REV(i,r,l) for(long long i=r; i>=l; i--)
#define pb push_back
#define mp make_pair

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

    int a[100006];
    int sum = 0;

    FOR(i,0,n)
    {
        cin>>a[i];
        sum += a[i];
    }
    
    if (sum < h)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 640
#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) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

ll f(ll n){
    if(n <= 2)return 1;
    return n * f(n - 2);
}

int main(){

    ll N;
    cin >> N;
    if(N <= 2 || N % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    ll cnt = 0;
    for(ll x = 10; x <= N; x *= 5){
        cnt += N / x;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define ppll pair<pll,ll>
#define vi vector <ll>
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define f(i,x,n) for(ll i=x;i<n;i++)
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;} 
const ll N = 1e3 + 5, M = 1e9 + 7;
        
int main(){
    FAST;
    ll n, k, m = 0, x = 0, i, t = 1, ans = 0, j, y = 0, z = 0, c = 0, w, last = -1;
    cin >> n >> k;
    ll a[n + 1];
    bool b[n + 1] = { 0 };
    f(i, 1, n + 1) cin >> a[i];

    vi v;
    i = 1;
    
    while(!b[i]){
        v.pb(i);
        b[i] = 1;
        i = a[i];
    }

    f(j, 0, v.size()){
        if(v[j] == i){
            x = v.size() - j;
            break;
        }
    }

    if(k > v.size()){
        k -= v.size();    
        k %= x;

        while(k --){
            i = a[i];
        }
        cout << i;

    }
    else{
        v.pb(i);
        out(v[k]);
    }

}

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

#define ll long long
#define ld long double
#define fi first
//#define endl "\n"
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define initialize(array,size,value) for(ll i=0;i<size;i++) array[i]=value
#define couta(array,size) for(ll i=0;i<size;i++) cout<<array[i]<<" "
#define debug(x) cout<<"x: "<<x<<endl
#define dbug(x,y) cout<<"x: "<<x<<"    "<<"y: "<<y<<endl
#define inf (long long int) 1e18
#define eps 0.000001
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
#define mod 1000000007
#define MAXN 100001
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
ll spf[MAXN]; 
ll gcd(ll a,ll b);
ll palindrome(string s);
ll modexp(ll a,ll b,ll m);
void sieve();
ll ceil(ll a, ll b);
vl getFactorization(ll x);
void getZarr(string str, ll Z[]);
vector<ll> prefix_function(string s);


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
        
    string s;
    cin>>s;
    ll n=s.length();
    string s1, s2;
    loop(i,0,n){
        if(i%2==0){
            s1.pb('1');
        }
        else s1.pb('0');
    }
    loop(i,0,n){
        if(i%2==0){
            s2.pb('0');
        }
        else s2.pb('1');
    }

    ll ans1=0, ans2=0;
    loop(i,0,n){
        if(s1[i]!=s[i]) ans1++;
        if(s2[i]!=s[i]) ans2++;
    }
    cout<<min(ans2, ans1)<<endl;
}

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

ll palindrome(string s){
    ll l = 0;
    ll h = s.length() - 1;
    while (h > l){
        if (s[l++] != s[h--]){
            return 0;
        }
    }
    return 1;
}

ll modexp(ll a, ll b, ll m){
    if (b==0)
        return 1;
    ll temp = modexp(a,b/2,m);
    temp = (temp*temp)%m;
    if (b&1)
        return (temp*(a%m))%m; // if b is odd a^b = a^(b/2)*a^(b/2)*a
    return temp;
}

void sieve() { 
    spf[1] = 1; 
    for (ll i=2; i<MAXN; i++) 
        spf[i] = i; 
    for (ll i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (ll i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) { 
            for (ll j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 


Measured memory_bytes: 720
#include <bits/stdc++.h>
#define ll long long
#define EB emplace_back
#define F first
#define S second


using namespace std;

#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}



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

	int tt; //cin>>tt;
	ll n,a,b; cin>>n>>a>>b;
	cout<<min((n*a),b)<<endl;
	
		

	
	
		////------------------------------------------------------------------////
	// #ifndef ONLINE_JUDGE    
 //    t = clock() - t; 
 //    double time_taken = ((double)t)/CLOCKS_PER_SEC; 
 //    printf("Time: %fs\n", time_taken); 
 //    #endif
	return 0;
}

Measured memory_bytes: 256
import Data.List
import Control.Applicative

decode :: [String] -> [(String, Int)]
decode [] = []
decode (x:xs) =
  let y = words x
  in
      (head y, read (last y)) : decode xs

sortByAlphabet :: [(String, [Int])] -> [(String, [Int])]
sortByAlphabet [] = []
sortByAlphabet (p:xs) = sortByAlphabet lt ++ [(fst p, qsort (snd p))] ++ sortByAlphabet gteq
  where lt   = [x | x <- xs, fst x <  fst p]
        gteq = [x | x <- xs, fst x >= fst p]


encode :: [(String, [Int])] -> [String]
encode [] = []
encode (x:xs) = fst x : unwords (map show (snd x)) : encode xs

grouping :: [(String, Int)] -> [(String, [Int])]
grouping [] = []
grouping (x:xs) =
  let fs = filter (\y -> fst y == fst x) xs
      sd = snd x : map snd fs
      rs = xs \\ fs
  in (fst x, sd) : grouping rs


qsort :: [Int] -> [Int]
qsort [] = []
qsort (p:xs) = qsort lt ++ [p] ++ qsort gteq
  where lt   = [x | x <- xs, x <  p]
        gteq = [x | x <- xs, x >= p]

solver :: [String] -> [String]
solver xs =
  let ys = decode xs
      gs = grouping ys
      fsort = sortByAlphabet gs
  in
      encode fsort

main :: IO()
main = do
  contents <- lines <$> getContents
  mapM_ putStrLn $ solver contents

Measured memory_bytes: 3940
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void)
{	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int w = c - a;
	int h = d - b;
	print(c - h);
	print(d + w);
	print(a - h);
	print(b + w);
	
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	aa := make([]int, n)
	mm := make([]int, n+1)
	j := 0

	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
		l := 0
		r := j
		for l < r {
			m := (l + r) >> 1
			if mm[m] < aa[i] {
				r = m
				continue
			}
			l = m + 1
		}
		mm[l] = aa[i]
		if l == j {
			j++
		}
	}

	fmt.Fprintln(writer, j)

	writer.Flush()
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int arr[] = new int[n];
        long sum=0;
        for(int i=0;i<n;i++){
            arr[i]=s.nextInt();
            sum+=arr[i];
        }
        int q = s.nextInt();
        while(q--!=0){
            int x = s.nextInt(),price = s.nextInt();
            System.out.println(sum-arr[x-1]+price);
        }

    }


}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())
#define SORT_GRE(vec) sort(vec.begin(), vec.end(), greater<LL>())

int main(){
    string s;
    cin >> s;
    int zero = 0, one = 0;
    int ans = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '0'){
            zero++;
        } else {
            one++;
        }
    }
    ans = min(zero, one) * 2;
    cout << ans << endl;
    return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


ll N, M;

void solve()
{
    cin >> N >> M;
    ll ans = 0;
    if(M / 2 < N)
    {
        cout << M / 2 << endl;
        return;
    }
    ans += N;
    M -= 2 * N;
    ans += M / 4;
    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define bug cout<<"--------------"<<endl
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=1e9;
const ll llf=1e18;
const int mod=1e9+7;
const int maxn=1e5+10;
int n,m;
char s[1010][1010];
int xx[]={1,-1,0,0};
int yy[]={0,0,1,-1};
typedef pair<int,int> pii;
queue<pii>q[2];
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>(s[i]+1);
		for(int j=1;j<=m;j++){
			if(s[i][j]=='#') q[0].push(pii(i,j));
		}
	}
	int o=0;
	int ans=0;
	while(!q[o].empty()){
		int flag=0;
		while(!q[o].empty()){
			pii u=q[o].front();
			q[o].pop();
			for(int i=0;i<4;i++){
				int dx=xx[i]+u.fi;
				int dy=yy[i]+u.se;
				if(dx<1||dx>n||dy<1||dy>m||s[dx][dy]=='#') continue;
				flag=1;
				s[dx][dy]='#';
				q[o^1].push(pii(dx,dy));
			}
		}
		if(flag) ans++;
		o^=1;
	}
	cout<<ans<<endl; 
	return 0;
}



Measured memory_bytes: 9488
#include<bits/stdc++.h>
using namespace std;
#define pi pair<int,int>
const int N=1e3+10;
int vis[N][N];
char A[N][N];
int dir[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
queue<pi>Q;
int main()
{
	int n,m;scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf(" %s",A[i]);
		for(int j=0;j<m;j++)if(A[i][j]=='#')vis[i][j]=1,Q.push({i,j});
	}
	int mx=1;
	while(!Q.empty()){
		auto p=Q.front();Q.pop();
		//cout<<p.first<<' '<<p.second<<'\n';
		for(int i=0;i<4;i++){
			int x=p.first+dir[i][0],y=p.second+dir[i][1];
			if(x<0||y<0||x>=n||y>=m||vis[x][y])continue;
			vis[x][y]=vis[p.first][p.second]+1;
			Q.push({x,y});
			mx=max(vis[x][y],mx);
		}
	}cout<<mx-1<<'\n';
}


Measured memory_bytes: 13328
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,nn) for(int i=0;i<nn;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int main(){
  int a,b;
  cin >> a >> b;
  if(a>12){
    cout << b << endl;
  }else if(a>5){
    cout << b/2 << endl;
  }else{
    cout << 0 << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}



int main(){
  ll h,w;
    cin>>h>>w;
    ll ans = 0;
    if(h==1||w==1){
        cout<<1<<endl;
        return 0;
    }
    if(h%2==0){
        ans = (h/2)*w;
    }else{
        if(w%2==0){
            ans=(w/2)*h;
        }else{
            ans += (h+1)/2 *( (w/2)+1);
            ans += (h/2)*(w/2);
        }
    }

    cout<<ans<<endl;
    
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  cin >> n >> k;
  int64 ans = 0;
  int64 mn = k * 1ll * (k - 1) / 2;
  int64 rest = n - k;
  int64 mx = n * 1ll * (n + 1) / 2 - rest * (rest + 1) / 2;
  for (int i = k; i <= n + 1; ++i) {
    //cout << mn << ' ' << mx << '\n';
    ans = (ans + mx - mn + 1) % mod;
    mn += i;
    mx += n - i;
  }
  cout << ans << '\n';
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}



Measured memory_bytes: 3648
//WA解法
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

struct info {int who; int honest; };

int main()
{
    int N;
    cin >> N;
    vector<vector<info>> List(N);
    for(int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        for(int j = 0; j < A; ++j) {
            int x, y;
            //以下の2行の順番を間違えていたのでWAになったと考えられる。
            cin >> x >> y;
            --x; //0-indexedにする。
            List[i].push_back(info{x,y});
        }
    }
    
    //全探索
    int res = 0;
    for(int bits = 0; bits < (1<<N); ++bits){
        bool flag = true;
        int num = 0; //正直者の人数
        for(int j = 0; j < N; ++j) if( bits&(1<<j) ){
            ++num;
            for(int k = 0; k < List[j].size(); ++k) {
                int who = List[j][k].who;
                int honest = List[j][k].honest;
                int certify = (bits>>who) & 1;
                if(honest ^ certify) flag = false;
            }
        }
        if(flag) res = max(res, num);
        /*
        for(int i = 0; i < N; ++i) if((bits>>i)&1) cout << 1; else cout << 0;
        cout << ": " << num;
        if(flag) cout << "true" << endl; else cout << "false" << endl;
        */
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

int N;
ll dp[101][4][4][4];
//dp[i][j][k][l]: i文字目(1-index)を考えるとき、
//i文字目がj、i - 1文字目がk、i - 2文字目がlのときの組み合わせの総和
//j, kは 0 -> A  1 -> T  2 -> G  3 -> C

int main() {
	cin >> N;

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				if ((i == 0 && j == 2 && k == 3) ||
					(i == 0 && j == 3 && k == 2) ||
					(i == 2 && j == 0 && k == 3)) {
					continue;
				}
				dp[3][i][j][k] = 1;
			}
		}
	}

	for (int i = 4; i <= N; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				for (int l = 0; l < 4; l++) {

					//A -> 0  T -> 1  G -> 2  C -> 3
					if (j == 2 && k == 0 && l == 3)continue;//GAC
					if (j == 0 && k == 2 && l == 3)continue;//AGC
					if (j == 0 && k == 3 && l == 2)continue;//ACG

					for (int m = 0; m < 4; m++) {
						if ((j == 0 && l == 2 && m == 3) ||
							(j == 0 && k == 2 && m == 3)) {
							//上から順にA?GC, AG?C これらをはじく
							continue;
						}
						dp[i][j][k][l] += dp[i - 1][k][l][m];
					}
					dp[i][j][k][l] %= MOD;
				}
			}
		}
	}

	ll ans = 0;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				if (i == 2 && j == 0 && k == 3)continue;//GAC
				if (i == 0 && j == 2 && k == 3)continue;//AGC
				if (i == 0 && j == 3 && k == 2)continue;//ACG
				ans += dp[N][i][j][k];
			}
		}
	}

	cout << ans % MOD << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

int main() {
    llong m1, d1;
    llong m2, d2;

    cin >> m1 >> d1;
    cin >> m2 >> d2;

    cout << m2 - m1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long

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

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());

    return ret;
}

int main(){

  ll n;
  cin >> n;
  ll ans = 0;
  vector<long long> ret = divisor(n);

  ll p;
  if(ret.size() % 2 == 0){
    p = ret.size()/2;
    cout << ret.at(p-1) + ret.at(p) -2 << endl;
  } else {
    p = ret.size()/2 + 1;
    cout << ret.at(p-1) * 2 -2 << endl;
  }

  return 0;
}

Measured memory_bytes: 3600
package main

import "fmt"

func main() {
	var num1, num2, num3, num4 int
	var ans = "NO"
	fmt.Scanf("%d %d %d %d\n", &num1, &num2, &num3, &num4)

	if num1 == 1 || num2 == 1 || num3 == 1 || num4 == 1 {
		if num1 == 9 || num2 == 9 || num3 == 9 || num4 == 9 {
			if num1 == 7 || num2 == 7 || num3 == 7 || num4 == 7 {
				if num1 == 4 || num2 == 4 || num3 == 4 || num4 == 4 {
					ans = "YES"
				}
			}
		}
	}

	fmt.Println(ans)

}

Measured memory_bytes: 512
S = input()
code = ["A","C","G","T"]
mask = [None] * len(S)
ans = 0
temp = 0

for el in S:
    if el in code:
        temp += 1
    else:
        ans = max(ans,temp)
        temp = 0
ans = max(temp, ans)
print(ans)    

Measured memory_bytes: 38416
/*

*/
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout << setprecision(12)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((ll)(x).size())
#define cin1(x) cin >> x
#define cin2(x, y) cin >> x >> y
#define cin3(x, y, z) cin >> x >> y >> z
#define cin4(x, y, z, _) cin >> x >> y >> z >> _
#define cin5(x, y, z, p, q) cin >> x >> y >> z >> p >> q
#define cou(x) cout << x
#define cous(x) cout << x << " "
#define coul(x) cout << x << "\n"
#define ret(x) return x
#define MAX 5000001
#define start int main() {   fastio
#define finish ret(0); }
#define Test ll _t; cin1(_t); rep(w, 0, _t)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cntv(v,a) count(v.begin(),v.end(),a)
struct point{    int x, y, ind;   char ch;  };
typedef long long ll;
typedef vector<ll> VI;
typedef pair<ll,ll> PII;
typedef double db;
//mt19937 mrand(random_device{}());
const ll mod=1000000007;
//ll rnd(ll x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}ret(res);}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll fact[13];
void factorial() {   fact[0]=1;  rep(i, 1, 12) fact[i]=(fact[i-1]*i);  }
vector <ll> sie; //for sieve function
ll spf[MAX+7];  //for sieve function
void sieve() {    rep(i, 2, MAX)  {  if (spf[i] == 0) {  spf[i] = i;   sie.pb(i);  }    for (ll j=0; j<SZ(sie) && i*sie[j] <= MAX && sie[j] <= spf[i]; j++)   spf[i * sie[j]] = sie[j]; }   }
bool cmp(point A, point B){   if(A.x != B.x) ret(A.x < B.x);  ret(A.y < B.y);   }
// head collected
// Don't use variable name as --> prev, time, _t, w, y1

struct po{
    ll year, ind;
};
ll n, m, t, a, _, an, col = 9999999999999999999.0, re, __;
vector < po > city[100005];
bool xoss(po A, po B){
    ret( A.year < B.year );
}
string ans[100007];
start;
    cin2(n, m);

    rep(i, 0, m){
        cin2( _, __ );
        po p;
        p.ind = i;
        p.year = __;
        city[ _ ].pb( p );
    }

    rep(i, 1, n+1){
//cout << i <<endl;
        sort( all( city[ i ] ), xoss );
        rep(j, 0, SZ( city[ i ] )){
            stringstream ss;
            ss << i;// 1st
            string st = ss.str();
            ll siz = SZ(st);
            string sa(6 - siz, '0');
            string ma = sa + st;
            stringstream sf;
            sf << j+1;
            st = sf.str();
            siz = SZ(st);
            string sb(6 - siz, '0');
            ma += sb + st;

            ans[ city[ i ][ j ].ind ] = ma;
        }
    }

    rep(i, 0, m)
        coul(ans[ i ]);

finish



/*



2 5 4 8 7 3 2 9 6
3 8 6 5 9 2 7 1 4
7 2 9 6 4 1 8 3 5
8 2 3 7 2 5 1 4 9
9 7 5 3 1 4 6 2 8
4 1 2 9 6 8 3 5 7
6 3 2 4 5 7 9 8 2
5 9 8 2 3 6 4 7 1
2 4 7 1 8 9 5 6 3






*/







Measured memory_bytes: 13440
import math
a,b,h,m = map(int,input().split())
aangle = (h*60+m)*0.5
bangle = 6*(h*60+m)%360
angle = min(abs(aangle-bangle),360-abs(aangle-bangle))
rad = math.radians(angle)
c = a**2+b**2-2*a*b*math.cos(rad)
print(c**0.5)

Measured memory_bytes: 62420
function Main(input) {
    input = input.split("\n");
    const S = Array.from(input[0])
    const T = Array.from(input[1])
    const result = S.filter((item, index) => item === T[index]).length;
    console.log(result)
  }
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    int N;
    cin >> N;
    int cnt = 0;
    bool ok = true;
    for(int i=0; i<N; ++i) {
        string s;
        cin >> s;
        if(!ok) {
            continue;
        }
        if(s == "A") {
            cnt++;
        } else {
            if(cnt == 0) {
                ok = false;
            } else {
                cnt--;
            }
        }
    }
    if(ok && cnt == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


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

int a, b, x, y;
char a1[105][105];

int main(){
	
	for( int i = 0 ; i < 50 ; i++ ){
		for( int j = 0 ; j < 100 ; j++ ){
			a1[i][j] = '.';
		}
	}
	
	for( int i = 50 ; i < 100 ; i++ ){
		for( int j = 0 ; j < 100 ; j++ ){
			a1[i][j] = '#';
		}
	}
	cin >> a >> b;
	a--;
	b--;
	
	x = 0;
	y = 0;	 
	for( int i = 0 ; i < b ; i++ ){
		if( y >= 100 ){
			x += 2;
			y = 0;
		}
		a1[x][y] = '#';
		y += 2;
	}
	
	x = 51;
	y = 0;
	
	for( int i = 0 ; i < a ; i++ ){
		if( y >= 100 ){
			x += 2;
			y = 0;
		}
		a1[x][y] = '.';
		y += 2;
	}
	
	cout << "100 100" << endl;
	
	for( int i = 0 ; i < 100 ; i++ ){
		for( int j = 0 ; j < 100 ; j++ ){
			cout << a1[i][j];
		}
		cout << endl;
	}
	
	
}

Measured memory_bytes: 256
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
 

int main() {
	// 入力
	ll N,P;
	cin >> N>>P;
 
	// 解法
	bool f[2000001]; // 素数かどうかの判別リスト, falseなら素数、もしくは未確認
	for (ll i=2; i<=2000001; i++){ // 2-10000までの整数に対し
		if (!f[i]){ 
			// f[i]=0ならばiはまだ見ていない=iは素数である。
			// !f[i]: iが素数であるなら
			for (ll j = i+i; j<=2000001; j+=i){// iの倍数jに対し
				f[j]= true ; // iの倍数jが素数でないことを記録する。
			}
		}
	}	
	
	
	if (N==1)cout << P << endl;
	else if (N>=41)cout << 1 << endl;
	else{
		ll ans = 1;
		ll i = 2;
		while ((ll)pow(i,N)<=P){
			ll count = 0;
			if (!f[i]){
				ll count = 0;
				while (P%i==0){
					count++;
					P /= i;
				}
				if (count/N>=1) ans *= (ll)pow(i, count/N);
				
				// printf("P: %lld i: %lld ans: %lld\n", P, i, ans);
			}
			i++;
		}
		//出力
		cout << ans << endl;
	}
	// cout << (ll)pow(206,N) << endl;
	// cout << 972439611840/(ll)pow(206,N) << endl;
	// cout << (ll)pow(206,N)*540 << endl;
}


Measured memory_bytes: 2176
#include<iostream>

using namespace std;



int main() {
	string s, t;
	int size_s,size_t, i;
	bool flag = true;

	cin >> s >>t;

	size_s = s.length();
	size_t = t.length();


	if (size_s + 1 != size_t) flag = !(flag);

	for (i = 0; i < size_s && flag; i++)
	{
		if (s[i] != t[i]) flag = !(flag);
	}

	if (flag) cout << "Yes " << endl;
	else cout << "No" << endl;

	return 0;
}




Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;


int main(){
	int N;
	cin >> N;
	vector<int> a(N);
	int i;
	for (i = 0;i < N;i++) cin >> a.at(i);
	sort(a.begin(), a.end());
	cout << a.at(N - 1) - a.at(0) << endl;
	return 0;
}


Measured memory_bytes: 256
n, m, l = [int(i) for i in input().split()]

matrix_A = [list(map(int, input().split())) for i in range(n)]
matrix_B = [list(map(int, input().split())) for i in range(m)]
output_matrix = [[0 for i in range(l)] for j in range(n)]
for i in range(m):
    for j in range(l):
        for k in range(n):
            output_matrix[k][j] += matrix_A[k][i] * matrix_B[i][j]

for  tmp_list in output_matrix:
    print(" ".join(map(str, tmp_list)))

Measured memory_bytes: 8940
<?php
fscanf(STDIN, "%d%d%d", $a, $b, $c);
if($a==$b && $b==$c && $a % 2 == 0){
    echo "-1\n";exit;
}
for($i = 0; $i < 1000; $i++){
    if($a%2+$b%2+$c%2){
        echo $i;
        exit;
    }
    $A = ($b+$c)/2;
    $B = ($a+$c)/2;
    $C = ($a+$b)/2;
    $a = $A;
    $b = $B;
    $c = $C;
}


Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
const int M = 1000000007;
 
int main() {
    int n, a;
    cin >> n >> a;
    vector<int> x(n);
    for (int i = 0; i < n; ++i) cin >> x[i];
 
    vector<vector<long long>> dp(n + 1, vector<long long>(n * a + 1));
    dp[0][0] = 1;
    for (int i = 0; i < n; ++i)
        for (int j = n; j > 0; --j)
            for (int k = x[i]; k < n * a + 1; ++k)
                dp[j][k] += dp[j - 1][k - x[i]];
 
    long long ans = 0;
    for (int i = 1; i <= n; ++i) ans += dp[i][i * a];
 
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>
#include <string.h>

int main()
{
	int i;
	char str[1000];
	scanf("%s",str);
	for(i=0;i<strlen(str);i++)putchar((((str[i]-0x2A)%26)+'A'));
	putchar('\n');
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {

    vector<int> number(3);
    cin >> number[0] >> number[1] >> number[2];

    sort(number.begin(), number.end());

    cout << number[0] + stoi(to_string(number[2]) + to_string(number[1])) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

constexpr long long INF = 1e18;
struct edge {
    int from;
    int to;
    int cost;
};

vector<int> go_0; // 0からいける？
vector<int> go_N; // N-1からいける？
void dfs_0(vector<vector<edge>> &G, int n) {
    for (auto e : G[n]) {
        if (!go_0[e.to]) {
            go_0[e.to] = 1;
            dfs_0(G, e.to);
        }
    }
}

void dfs_N(vector<vector<edge>> &G, int n) {
    for (auto e : G[n]) {
        if (!go_N[e.to]) {
            go_N[e.to] = 1;
            dfs_N(G, e.to);
        }
    }
}

int main() {
    int N, M, P;
    cin >> N >> M >> P;
    vector<edge> edges(M);
    rep(i, M) {
        int A, B, C;
        cin >> A >> B >> C;
        edges[i] = {A - 1, B - 1, C};
    }
    
    go_0 = vector<int>(N, 0);
    go_0[0] = 1;
    vector<vector<edge>> graph_0(N);
    for (auto e : edges) {
        graph_0[e.from].push_back(e);
    }
    dfs_0(graph_0, 0);
    go_N = vector<int>(N, 0);
    go_N[N - 1] = 1;
    vector<vector<edge>> graph_N(N);
    for (auto e : edges) {
        graph_N[e.to].push_back({e.to, e.from, e.cost});
    }
    dfs_N(graph_N, N - 1);
    
    vector<edge> use;
    for (auto e : edges) {
        if (go_0[e.from] && go_N[e.to]) {
            use.push_back({e.from, e.to, -(e.cost - P)});
        }
    }
    vector<long long> dist(N, INF);
    dist[0] = 0;
    rep(i, N) for(auto e : use) {
        if (dist[e.from] + e.cost < dist[e.to]) {
            dist[e.to] = dist[e.from] + e.cost;
            if (i == N - 1) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    cout << max(-dist[N - 1], 0LL) << endl;
    return 0;
}


Measured memory_bytes: 896
X = gets.chomp.to_i

left = 0
right = 10**9

def eq(mid)
  mid * (mid+1)/2
end

prev = 10**9
mid = (left + right)/2


while 1
  mid = (left + right)/2
  break if prev == mid

  if eq(mid) > X
    right = mid
  else
    left = mid
  end

  prev = mid

end

if eq(mid) < X
  p mid + 1
else
  p mid
end



Measured memory_bytes: 1788
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	sort.Ints(as)
	x1, x2 := as[0], as[n-1]
	as = as[1 : n-1]

	ops := make([][]int, 0)
	for _, y := range as {
		if y >= 0 {
			ops = append(ops, []int{x1, y})
			x1 -= y
		} else {
			ops = append(ops, []int{x2, y})
			x2 -= y
		}
	}
	ops = append(ops, []int{x2, x1})

	fmt.Println(x2 - x1)
	for _, op := range ops {
		fmt.Println(op[0], op[1])
	}
}


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

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

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

  vector<string> words(n);
  rep(i, n) { cin >> words.at(i); }
  sort(words.begin(), words.end());
  for (string w : words) {
    cout << w;
  }
  cout << endl;
}


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

public class Main {
    public static void main(String[] args) throws java.io.IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = in.readLine();
        int i = Integer.parseInt(s);
        i *= i * i;

        System.out.println(i);
    }
}


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


int main(){

  double x1,x2,x3,y1,y2,y3,xp,yp,A,B,C;
  double s,t;
 
 while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
   A=(x2-x1)*(y3-y1) - (x3-x1)*(y2-y1);
   B=(xp-x1)*(y3-y1) - (x3-x1)*(yp-y1);
   C=(x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);

   s=B/A;
   t=C/A;

   if(s>0 && t>0 && 0<s+t && s+t<1){printf("YES\n");}
   else{printf("NO\n");}
   
  }
  return 0;
}

Measured memory_bytes: 612
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter


val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (a, b, c, d) = readLongList()
    val divCCount = b / c - (a - 1) / c
    val divDCount = b / d - (a - 1) / d
    val divCDCount = b / lcm(c, d) - (a - 1) / lcm(c, d)
    val ans = (b - a + 1) - (divCCount + divDCount - divCDCount)
    out.println(ans)
}

/** O(log(n)): n = min(a, b) */
tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)

/** O(log(n)): n = min(a, b) */
fun lcm(a: Long, b: Long)= a / gcd(a, b) * b

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 36244
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, sum=0, ans=0;
    scanf("%d", &n);
    for(int i=1; i<=n; i+=2){
        for(int j=1; j<=i; j+=2){
            if(i%j==0) sum++;
        }
        if(sum==8) ans++;
        sum=0;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <tuple>
#include <vector>
#include <set>
#include <map>
#include <iterator>
#include <random>
#include <cmath>

using namespace std;
using lint = long long int;



int main() {
	int n;
	cin >> n;
	int* l = new int[n];

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

	sort(l, l + n,
		[](int const& left, int const& right) {
			return left > right;
		});
	
	lint count = 0;
	for (int i = 0; i < n - 2; i++) {
		for (int j = i + 1; j < n - 1; j++) {
			int ab = l[i] - l[j];
			for (int k = j + 1; k < n; k++) {
				if (l[k] > ab)
					count++;
				else
					break;
			}
		}
	}

	cout << count << endl;

	return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

#define UF_NUM 200200
li parent[UF_NUM];

inline void init_uf() {
    rep(i, UF_NUM)parent[i] = i;
}

inline li find(li x) {
    if (parent[x] == x)return x;
    else return (parent[x] = find(parent[x]));
}

inline void union_(li x, li y) {
    li parent_x = find(x);
    li parent_y = find(y);
    parent[parent_x] = parent_y;
}
li n, m;
set<li> k[100100];

int main() {
    init_uf();
    cin >> n >> m;
    rin{
        li kk;
        cin >> kk;
        rep(j, kk) {
            li l;
            cin >> l;
            k[l].insert(i);
        }
    }
    rep(i, m + 1) {
        li prev = -1;
        foreach (it, k[i]) {
            if (prev >= 0) {
                union_(prev, *it);
            }
            prev = *it;
        }
    }

    rep(i, n)find(i);

    li prev = -1;
    rep(i, n) {
        if (prev >= 0) {
            if (prev != find(i)) {
                puts("NO");
                return 0;
            }
        }
        prev = find(i);
    }
    puts("YES");


    return 0;
}

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

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

    dsu uf(N);
    while (Q--) {
        int t, u, v;
        cin >> t >> u >> v;

        if (t == 0) {
            uf.merge(u, v);
        } else {
            cout << uf.same(u, v) << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 4072
#include <stdio.h>

#define LENGTH 100

int main(void) {
  int x1 = 1;
  int x2 = 2;
  int x3 = 3;
  int x4 = 4;
  int x5 = 5;
  char input[LENGTH];
  //while (1) {
    fgets(input, LENGTH-1, stdin);
    sscanf(input, "%d %d %d %d %d", &x1, &x2, &x3, &x4, &x5);
    int n = 0;
    if (x1 == 0) n = 1;
    else if (x2 == 0) n = 2;
    else if (x3 == 0) n = 3;
    else if (x4 == 0) n = 4;
    else n = 5;
    printf("%d\n", n);
//  }
  return 0;

}


Measured memory_bytes: 2120
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#define Rep(i,n)for(int i=0;i<n;i++)
#define ret return 0
using namespace std;
int main()
{
	int a, b;
	vector<vector<int>> vect;
	while((cin >> a >> b && (a != 0 || b != 0)))
	{
		vector<int> tmp = { a,b };
		vect.push_back(tmp);

		string ans;

		Rep(i, a)
		{
			Rep(j, b)
			{
				ans += "#";
			}
			ans += "\n";
		}
		cout << ans << endl;
	}
	ret;
}


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

int main(){
	int n,t=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int k=i,c=0;
		while(k){
			c++;
			k/=10;
		}
		if(c%2!=0){
			t++;
		}
	}
	printf("%d",t);
}

Measured memory_bytes: 256
f = lambda: map(int, input().split())
n,h = f()
mA,B = 0,[]
for _ in range(n):
    a,b = f()
    mA = max(mA,a)
    B.append(b)
B = sorted([i for i in B if i > mA], reverse=True)
ans = 0
while h>0:
    if not B:
        ans += -(-h//mA)
        break
    else:
        h -= B[0]
        B.pop(0)
        ans += 1
print(ans)

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

int main() {
    int a, b, coins = 0;  cin >> a >> b;
    rep(i,2) {
        if (a >= b) {
            coins += a;
            a--;
        }
        else {
            coins += b;
            b--;
        }
    }
    cout << coins << endl;
}

Measured memory_bytes: 256