akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		V = n;
		E = m;
		edges = new Edge[E];
		for (int i = 0; i < E; i++) {
			edges[i] = new Edge();
			edges[i].from = sc.nextInt() - 1;
			edges[i].to = sc.nextInt() - 1;
			edges[i].cost = -sc.nextInt();
		}
		infZone = new boolean[V];
		BF(0);
		if (infZone[V - 1]) {
			System.out.println("inf");
		} else {
			System.out.println(-d[V - 1]);
		}
	}

	static int V; // 頂点の数=n
	static int E; // 辺の数=m
	static Edge[] edges;
	static long[] d;
	static long INF = Long.MAX_VALUE / 2;
	static boolean infZone[];

	static class Edge {
		int from;
		int to;
		long cost;
	}

	static boolean BF(int sv) {
		d = new long[V];
		Arrays.fill(d, INF);
		d[sv] = 0;

		for (int count = 0; count < V; count++) {
			for (int i = 0; i < edges.length; i++) {
				int u = edges[i].from;
				int v = edges[i].to;
				long c = edges[i].cost;
				if (d[u] + c < d[v]) {
					d[v] = d[u] + c;
					if (count == V - 1) {
						infZone[v] = true;
					}
				}
			}
		}
		return true;
	}
}

Measured memory_bytes: 28240
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define YES(n) cout << (n?"YES":"NO")<<endl;
#define Yes(n) cout << (n?"Yes":"No")<<endl;

int main() {
    int M;
    cin >> M;
    cout << 24 - M + 24 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

template<typename T, typename S>
istream& operator>> (istream& in, pair<S, T>& p) {
    in >> p.fs >> p.sn;
    return in;
}
template<typename T, typename S>
ostream& operator<< (ostream& out, pair<S, T>& p) {
    out << p.fs << ' ' << p.sn << ' ';
    return out;
}

template<typename T>
istream& operator>> (istream& in, vector<T>& v) {
    for (T& x : v) in >> x;
    return in;
}
template<typename T>
ostream& operator<< (ostream& out, vector<T>& v) {
    for (T& x : v) out << x << ' ';
    return out;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    string s;
    cin >> s;
    int west = 0;
    forn(i, 0, n)
        if (s[i] == 'W')
            ++west;
    int before = 0;
    int ans = INF;
    forn(i, 0, n) {
        int cur = before;
        before += (s[i] == 'W');
        cur += (n - i - 1) - (west - before);
        setmin(ans, cur);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC098A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d, f, max;
            var word = (Console.ReadLine()).Split();
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = a + b;
            d = a - b;
            f = a * b;
            max = c;
            if (d > max) { max = d; }
            if (f > max) { max = f; }
            Console.WriteLine(max);
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
from collections import deque

def main():
    N = int(input())
    path = [[] for _ in range(N)]
    ab = []
    ans = {}
    visited = [False] * N
    visited[0] = True
    for _ in range(N-1):
        a, b = map(int, input().split())
        path[a-1].append(b-1)
        path[b-1].append(a-1)
        ab.append((a-1, b-1))
    
    que = deque([(0, 0)])
    while que:
        k = 1
        # k = 0
        pre, c = que.popleft()
        for next_node in path[pre]:
            if visited[next_node]:
                continue
            
            if c == k:
                k += 1
            visited[next_node] = True
            ans[(pre, next_node)] = k
            que.append((next_node, k))
            k += 1
            

    print(max(ans.values()))
    for key in ab:
        print(ans[key])

if __name__ == '__main__':
    main()

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

main()
{
	int n , m;
	cin >> n >> m;
	
	if(m == n)return cout << 1 , 0;
	
	for(int i = m / n; i >= 1; i--)
	{
		if( m % i == 0)
				return cout << i , 0;
	}


}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
    h: usize,
    w: usize,
    }
    let ans = if h % 2 != 0 && w % 2 != 0 {h * w / 2 + 1} else { h * w / 2 };
    if h == 1 || w == 1 {println!("{}" ,1); return;}
    println!("{}",  ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

#define pb push_back
#define INF 1010001000
#define loop(i, n) for (int i = 0; i < n; i++)

typedef pair<int, int> i_i;
typedef struct edge{ int st, en, cst; } Edge;

int main()
{
    int v, e, r;
    cin >> v >> e >> r;
    
    vector<vector<i_i> > G(v);
    vector<int> ans(v, INF);

    loop(i, e) {
        int st, en, d;
        cin >> st >> en >> d;
        G[st].pb(i_i(d, en));
    }

    priority_queue<i_i, vector<i_i >, greater<i_i > > pq;
    pq.push(i_i(0, r));
    ans[r] = 0;
    while (!pq.empty()) {
        i_i p = pq.top(); pq.pop();
        int u = p.second;
        if (ans[u] < p.first) {
            continue;
        }
        for (int j = 0; j < G[u].size(); j++) {
            i_i i = G[u][j];
            if (ans[i.second] > ans[u] + i.first) {
                ans[i.second] = ans[u] + i.first;
                pq.push(i_i(ans[i.second], i.second));
            }
        }
    }

    loop(i, v) {
        if (ans[i] != INF) {
            cout << ans[i] << endl;
        } else {
            cout << "INF" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 12916
#include<stdio.h>
int main(void)
{
	int i,j,n,m,up,down,mostup,mostdown,x[100+1];
	scanf("%d",&n);
	for(i=1;i<=n;i++) {
	mostup=0;
	mostdown=0;
		scanf("%d",&m);
		for(j=1;j<=m;j++) {
			scanf("%d",&x[j]);
		}
		for(j=1;j<=m-1;j++) {
			if(x[j]<=x[j+1]) {
				up=x[j+1]-x[j];
				if(mostup<=up) {
					mostup=up;
				}
			}
			else {
			down=x[j]-x[j+1];
				if(mostdown<=down) {
					mostdown=down;
				}

			}
		}
		printf("%d %d\n",mostup,mostdown);
	}
	return 0;
}

Measured memory_bytes: 596
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def count_sums(n):
    c = 1    
    while True:
        if n - c < 0:
            break
        n -= c
        c += 1
    return c - 1

N = int(input())
if N == 1:
    print(0)
else:
    # p_N : 素因数分解の結果
    p_N = factorization(N)
    if p_N == [N, 1]:
        print(1)
    else:
        count = 0
        for arr in p_N:
            count += count_sums(arr[1])
        print(count)

Measured memory_bytes: 9496
s = gets.chomp.split('')
k = gets.chomp.to_i

ss = s.sort.uniq
sss = ss.first

if k == 1
  puts sss
  exit
end

arr = []
ss.each do |ssss|
  inds = s.size.times.select { |x| s[x] == ssss }
  inds.each do |ind|
    0.upto(k) do |i|
      if ind + i <= s.size
        arr.push(s.slice(ind..ind+i).join(''))
      end
    end
  end
  break if arr.uniq.size >= k
end
puts arr.sort.uniq[k-1]


Measured memory_bytes: 8608
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
//#define vi vector<int>
#define vb vector<bool>
#define pii pair<int, int>
#define mii map<int, int>
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define inf (long long)1e18
#define F first
#define S second
#define SZ(x) ((int)(x).size())
//#define rep(i, n) for (int i = 0; i < n; i++)
//#define repd(i,n) for(int i=n-1;i>=0;i--)
//#define rep1(i,n) for(int i=1;i<=n;i++)
const int N = 1e9 + 7;

int pow(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = ((res) * (x));
        res %= N;
        y = y >> 1;
        x = ((x) * (x));
    }
    return res;
}
int powm(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

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

void solve()
{
    string s;
    cin >> s;

    ll sum = 0;
    for (auto c : s)
    // for (int i = 0; i < s.size(); i++)
    {
        sum += c - '0';
    }
    // cout << sum;
    if (sum % 9 == 0)
        cout << "Yes";
    else
    {
        cout << "No";
    }
}

int32_t main()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // int t;
    // cin >> t;
    // while (t--)
    // {
    solve();
    // }
}

Measured memory_bytes: 3716
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << i

#define int long long // at least int64 > 9*10^18

signed main() {
  int sx,sy,tx,ty;
  std::cin >> sx >> sy >> tx >> ty;
  rep(dx,tx-sx) print('R');
  rep(dy,ty-sy) print('U');
  print('R');
  rep(dy,ty-sy+1) print('D');
  rep(dx,tx-sx+1) print('L');
  print('U');
  rep(dy,ty-sy) print('U');
  rep(dx,tx-sx) print('R');
  print('U');
  rep(dx,tx-sx+1) print('L');
  rep(dy,ty-sy+1) print('D');
  print('R');
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n, m;
llong s, t;
vector<llong> g[1005];
llong min_cost[1005][1005];
bool link[1005][1005];

queue<llong> que;

void bfs(llong s) {
    for (int i = 0; i < n; i++) {
        min_cost[s][i] = 1ll << 60ll;
    }
    min_cost[s][s] = 0;

    que.push(s);
    while (!que.empty()) {
        llong pos = que.front();
        que.pop();

        for (auto e:g[pos]) {
            if (min_cost[s][e] > min_cost[s][pos] + 1) {
                min_cost[s][e] = min_cost[s][pos] + 1;
                que.push(e);
            }
        }
    }
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> s >> t;
        s--, t--;
        g[s].push_back(t);
        link[s][t] = true;
    }

    for (int i = 0; i < n; i++) {
        bfs(i);
    }

    llong k = 1ll << 60ll;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;

            if (link[i][j]) {
                k = min(k, min_cost[j][i] + 1);
            }
        }
    }

    if (k <= n) cout << 0 << endl;
    else cout << -1 << endl;

    return 0;
}


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

int main(){
  long long N;
  cin >> N;
  long long ans=0;
  for(int i=1; i<=N; i++){
    if(i%3 > 0 && i%5 > 0){
      ans = ans + i;
    }
  }

  cout << ans << endl;

}


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

typedef long long ll;
typedef unsigned long long ull;

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

    ll A[100][100],B[100][100],C[100][100];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> A[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++){
            cin >> B[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            C[i][j]=0;
            for(int k=0;k<m;k++){
                C[i][j]+=A[i][k]*B[k][j];
            }
            cout << C[i][j];
            if(j<l-1) cout << " ";
            else cout << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3244
#include <iostream>
using namespace std;
main () {
	int k, a, b;
	cin>>k>>a>>b;
	string s = "NG";
	int res = a;
	for (int i=a;i<=b;i++) {
		if (i % k == 0) {
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG"<<endl;
}

Measured memory_bytes: 3632
def sum_n(n):
    #n-1の和を求めたい
    ans = 0
    for i in range(n):
        ans += i
    return ans

def main():
    s = list(input())
    ans = 0
    cnt = 0
    for i,dst in enumerate(s):
        if dst=="W":
            ans += i
            cnt += 1
    ans -= sum_n(cnt)
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 61552
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main()
{
    long int d[100000];
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> d[i];
    sort(d, d+n);
    cout << abs(d[(n/2)] - d[(n/2) - 1]);
}

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

int main()
{
	int cups[3] = { 1 , 0 , 0 } ;
	char get[3] ;
	int change[2] ;

	while( cin >> get )
	{
		for( int i = 0 ; i < 2 ; i ++ )
		{
			if( get[i*2] == 'A' ) change[i] = 0 ;
			if( get[i*2] == 'B' ) change[i] = 1 ;
			if( get[i*2] == 'C' ) change[i] = 2 ;
		}

		swap( cups[change[0]],cups[change[1]] ) ;
	}

	if( cups[0] == 1 ){ cout << 'A' << endl ; }
	else if( cups[1] == 1 ){ cout << 'B' << endl ; }
	else if( cups[2] == 1 ){ cout << 'C' << endl ; }

	return 0 ;
}

Measured memory_bytes: 1136
#include <bits/stdc++.h>
using namespace std;
int main(){
	string n;
	cin>>n;
	int a=0;
	for(int i=0; i<n.size(); i++){
		a+=n.at(i)-48;
	}
	if(a%9==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

}

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

#define Mset(s, n)      memset(s, n, sizeof(s))
#define All(a)          (a).begin(), (a).end()
#define Lwb             lower_bound
#define Upb             upper_bound
#define Sz(a)           int((a).size())
#define Exist(a, b)     (find(All(a), (b)) != (a).end())
#define Sort(x)         sort(All(x))
#define Gsort(x)        sort(All(x), greater<typeof(*((x).begin()))>())
#define Unique(v)       Sort(v); (v).resize(unique(ALL(v)) - (v).begin())

#define fi              first
#define se              second
#define pb              push_back
#define pf              push_front
#define is              insert
#define ooi             INT_MAX
#define ool             LLONG_MAX
#define ll              long long
#define ull             unsigned ll
#define ld              long double
#define pii             pair<int, int>
#define vi              vector<int>
#define vpii            vector<pii>

const ll MOD = (ll) 1e9 + 7;
const ld PI = acos((ld) -1);
inline int Get_bit(int x, int k){return (x >> (k - 1)) & 1;}
inline ll Gcd(ll a, ll b) {ll r; while(b){ r = a % b; a = b; b = r;} return a;}
inline ll Lcm(ll a, ll b) {return a / Gcd(a, b) * b;}
inline ll Pow(ll n, ll k) {ll r = 1; for(; k; k >>= 1, n = n * n % MOD){if(k & 1) r = r * n % MOD;} return r;}
const int base = 311;


const int N = 1e5 + 5;


ll n, m, k, q;


void Solve(){
	int a, b, c;
	cin >> a >> b >> c;
	if(a + b + c < 22){
		cout << "win";
	} else cout << "bust";
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    Solve();
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input_values = sc.nextInt();
        int X = sc.nextInt();
        int values[] = new int[input_values];
        for (int i = 0; i < input_values; i++) {
            values[i] = Math.abs(sc.nextInt() - X);
        }
        int buf;
        if (input_values != 1) {
            buf = gcd(values[0], values[1]);
            for (int i = 1; i < input_values; i++) {
                buf = gcd(buf, values[i]);
            }
        }else{
            buf=values[0];
        }
        System.out.println(buf);
    }

    public static int gcd(int a, int b) {
        if (a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }
        int r = -1;
        while (r != 0) {
            r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
}


Measured memory_bytes: 47644
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
	double l[40]={0},r[40]={0};int A=0,A2=0,B=0,B2=0,C=0,C2=0,D=0,D2=0;
	for(int i=0;i<40;i++)
	{
		scanf("%lf %lf",&l[i],&r[i]);
		if(l[i]>=1.1)
		{
			A=A+1;
		}
		else if(l[i]>=0.6)
		{
			B=B+1;
		}
		else if(l[i]>=0.2)
		{
			C=C+1;
		}
		else
		{
			D=D+1;
		}
		if(r[i]>=1.1)
		{
			A2=A2+1;
		}
		else if(r[i]>=0.6)
		{
			B2=B2+1;
		}
		else if(r[i]>=0.2)
		{
			C2=C2+1;
		}
		else
		{
			D2=D2+1;
		}
	}
	printf("%d %d\n%d %d\n%d %d\n%d %d\n",A,A2,B,B2,C,C2,D,D2);
	return 0;
}


Measured memory_bytes: 3080
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let a: String = sc.cin();
    let b: String = sc.cin();
    let c: String = sc.cin();
    put!(a.chars().zip(b.chars().zip(c.chars())).map(|(x, (y, z))| {
        if x == y && y == z {
            0
        } else if x == y || y == z || z == x {
            1
        } else {
            2
        }
    }).sum::<u64>())
        ;
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
n = int(input())
a = [int(x) for x in input().split()]
l = a[0]
r = sum(a[1:])
ans = 2020202020
for i in range(1, n):
    ans = min(ans, abs(l-r))
    l += a[i]
    r -= a[i]
print(ans)

Measured memory_bytes: 26220
program sum_of_large_numbers
  implicit none
  integer(8) :: n, k
  read(*,*) n, k
  write(*,'(i0)') mod(((n+1)*(n+k+1)*(n-k+2)*3+(n-k+2)*6-(n+1)*(n+2)*(2*n+3)+(k-1)*k*(2*k-1))/6,1000000007)
end program sum_of_large_numbers

Measured memory_bytes: 2860
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    ll dp[n + 1] = {0};
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
    for(int i = 3; i <= n; i++){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout << dp[n] << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,A,ans,a,b,X[100000],Y[100000],rans;
vector<ll> v;
int main(void){
    cin>>n>>k;
    v.push_back(k);
    for(int i=29;i>0;i--){
        //cout<<((k>>i)&1);
        if(k>>i&1){
            A=(1<<i)-1;
            A+=ans;
            ans+=(1<<i);
            v.push_back(A);
        }
    }
    for(int i=0;i<n;i++)cin>>X[i]>>Y[i];
    //cout<<endl;
    for(auto x:v){
        ans=0;
        for(int i=0;i<n;i++){
            int ok=0;
            for(int j=29;j>=0;j--){
                if(X[i]>>j&1){
                    if((x>>j&1)==0){ok=1;break;}
                }
            }
            if(!ok)ans+=Y[i];
        }
        rans=max(rans,ans);
    }
    cout<<rans<<endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string a;
int main(){
	cin>>a;
	if(a.length()%2)puts("No");
	else{
		int flg=0;
        for(int i=0;i<a.size();i++)
			if(i%2==0&&a[i]!='h'||i%2==1&&a[i]!='i')flg=1;
		puts(flg?"No":"Yes");
	}
}

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

using namespace std;

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

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

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

	int cnt = 0;

	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			for (int k = j + 1; k < n; k++)
			{
				if (arr[k] < arr[i] + arr[j])
				{
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi X(N);
  rep(i,N) {
    cin >> X[i];
  }
  sort(rng(X));
  ll ans = LINF;
  srep(k,1,100) {
    ll tmp = 0;
    rep(i,N) {
      tmp += (X[i]-k) * (X[i]-k);
    } 
    ans = min(ans,tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
K = int(input())
n = len(S)
S = S + S[0]
samecount = 1
count = 0
pre = ''
for s in S:
    if s == pre:
        samecount += 1
    else:
        count += samecount//2
        samecount = 1
    pre = s

ans = count * K

if samecount == 1:
    pass
else:
    samecount -= 1
    right = samecount
    if samecount == n:
        if samecount % 2 == 0:
            ans += K*(samecount//2)
        else:
            ans += K*(samecount//2)
            ans += K//2
    else:
        left = 1
        pre = S[0]
        for s in S[1:-1]:
            if s == pre:
                left += 1
            else:
                break
        if right % 2 == 0 or left % 2 == 0:
            ans += K*(right//2)

        else:
            ans += K*(right//2)
            ans += K-1

print(ans)


Measured memory_bytes: 3064
n=int(input())

A=list(map(int,input().split()))

anow=0
anxt=0

m=1000
s=0

for i in range(n-1):
    if A[i+1]>A[i]:
        s+=m//A[i]
        m-=A[i]*(m//A[i])
    elif A[i+1]<A[i]:
        m+=A[i]*s
        s=0

m+=A[n-1]*s
print(m)

Measured memory_bytes: 9188
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	c := next()[0]
	switch c {
	case 'a', 'i', 'u', 'e', 'o':
		puts("vowel")
	default:
		puts("consonant")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <vector>
#include <cmath>
#include <map>
#include <stack>
#include <algorithm>
typedef long long int ll;
using namespace std;
const int MAX=5000+10;
const double eps=1e-9;
const double PI=acos(-1.0);

int sgn(double x)
{
    if (fabs(x)<eps) {
        return 0;
    }
    if (x<0) {
        return -1;
    }
    else return 1;
}
struct point
{
    double x,y;
    point(){}
    point(double _x,double _y)
    {
        x=_x;y=_y;
    }
    point operator +(const point &b)const
    {
        return point(x+b.x,y+b.y);
    }
    point operator -(const point &b)const
    {
        return point(x-b.x,y-b.y);
    }
    double operator ^(const point &b)const
    {
        return x*b.y-y*b.x;
    }
    double operator *(const point &b)const
    {
        return x*b.x+y*b.y;
    }
    point operator *(const double k)const
    {
        point kk;kk.x=k*x;kk.y=k*y;return kk;
    }
    double len(void)
    {
        return sqrt(x*x+y*y);
    }
};
int main(){
    //freopen("/Users/mac/Desktop/C++?¨????/test/test.txt", "r", stdin);
    int q;
    point p1,p2,p;
    scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
    scanf("%d",&q);
    while(q--){
        scanf("%lf%lf",&p.x,&p.y);
        point base=p2-p1;
        point hypo=p-p1;
        double t=(hypo*base)/base.len();
        point x=p1+(base*(t/base.len()));
        point y=p+(x-p)*2;
        printf("%.8lf %.8lf\n",y.x,y.y);
    }
    return 0;
}

Measured memory_bytes: 3248
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve(ll N, vector<string> a) {
  bool no = true;
  REP(i,N) REP(j,N) if (a[i][j] == '#') no = false;
  if (no) { cout << -1 << endl; return; }
    
  int res = 1e9;
  int cnt = 0;
  REP(j,N) {
    bool flag = false;
    REP(i,N) if (a[i][j] == '.') flag = true;
    cnt += flag;
  }
  REP(i,N) {
    int sum = 0;
    REP(j,N) if (a[i][j] == '.') ++sum;
    bool flag = true;
    REP(j,N) if (a[j][i] == '#') flag = false;
    if (flag) ++sum;
    chmin(res, sum);
  }
  cout << res + cnt << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<string> a(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  cin >> a[i];
	}
	solve(N, a);
	return 0;
}


Measured memory_bytes: 768
// author -> LetsGoAC
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using    namespace std;
using    namespace __gnu_pbds; 
#define  ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef  long double ld;
#define  int long long
typedef  pair<int,int> pii;
#define  RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  rep(i,n) for(i=0; i <n; i++)
#define  repv(i,k,n) for(int i=k; i<=n; i++)
#define  pb push_back
#define  mp make_pair
#define  F  first
#define  S  second
#define  sz(x)  (int)x.size()
#define  all(v) v.begin(),v.end()
#define  endl '\n'
#define  deb(x) cout<<#x<<" = "<<x<<endl
#define  gcd   __gcd
#define  inf   LLONG_MAX
#define  minf  LLONG_MIN 
#define  gi  greater<int> 
#define  gpi greater<pii>  
#define  sp(n) fixed<<setprecision(n)
vector   <int> Fact(100005 , 0);
const int mod = (int)(1e9+7);
int power(int x,int n)
{   
    if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}
int mod_inverse(int n , int m)
{   //mod = m; // change const mod;
    int modi = power(n , m-2);
    return modi;
}
int  pct(int x)
{    return __builtin_popcountll(x);}
int  lcm(int a,int b){return a*b/gcd(a,b);}
bool is_power_2(int n){ return log2(n)==floor(log2(n));}
bool is_prime(int n){for(int i=2; i*i<=n; i++)if(n%i==0)return 0; return 1;}
void cal_fac()
{
     Fact[0] = Fact[1] = 1;
     for(int i=2; i<1e5; i++)
         Fact[i] = (Fact[i-1]*i)%mod;
}
int C(int n , int k)
{
    int res = Fact[n];
    res = (res * mod_inverse( Fact[k] , mod ))%mod;
    res = (res * mod_inverse( Fact[n-k] ,mod ))%mod;
    return res;
}
void db()
{   
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
void timeit()
{  
    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " <<sp(5)<< 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}
int     dx []    =  {-1 , 0 , 1 , 0 ,-1,-1, 1,  1};
int     dy []    =  { 0 , 1 , 0 ,-1 ,-1, 1, 1, -1};
char    dir[]    =  {'U','R','D','L'};
/* ---------------------- new.cpp --------------------------------- */
const int maxn = 1e4+5; 
void solve(int tc)
{
    //  cout<<"Case #"<<tc<<": ";
    int n,i,j,k,m,q,l,r;
    string s;
    cin>>s;
    if(s.find("RRR") != string::npos)
        cout<<3;
    else
    if(s.find("RR") != string::npos)
        cout<<2;
    else
    if(s.find( 'R')!=string::npos)
        cout<<1;
    else
        cout<<0;
}
signed main()
{
    // new.cpp
    RAGE;
  //  db();  
    int t=1;
    //cin>>t;
    for(int i=1; i<=t; i++)
    {
        solve(i);
    }
   // timeit();
    return 0;
}
/*
    1. To find 2's complement , reverse all the bits after 1st set bit. (right - >left.)

*/

Measured memory_bytes: 3792
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> A;
  tools::read(A, N);

  std::vector<bool> signs;
  signs.reserve(N);
  std::transform(A.begin(), A.end(), std::back_inserter(signs), [](const i64& A_i) { return A_i >= 0; });

  for (i64 i = 0; i < N - 1; ++i) {
    if (!signs[i]) {
      signs[i] = !signs[i];
      signs[i + 1] = !signs[i + 1];
    }
  }
  std::transform(A.begin(), A.end(), A.begin(), [](const i64& A_i) { return std::abs(A_i); });
  if (!signs.back()) {
    auto it = std::min_element(A.begin(), A.end());
    *it = -*it;
  }

  std::cout << std::accumulate(A.begin(), A.end(), static_cast<i64>(0)) << std::endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    string S;
    cin >>N>>S;
    long long ii,jj,kk;
    ii = 0;
    jj = 0;
    kk = 0;
    for(int i = 0; i<N; i++) {
        if(S[i] == 'R') ii++;
        if(S[i] == 'G') jj++;
        if(S[i] == 'B') kk++;
    }
    long long tmp_asr = 0;
    tmp_asr = ii * jj * kk;

    long long exc = 0;
    for(int j = 1; j<N; j++) {
        for(int i = 0; i<j; i++) {
            int k = 2 * j - i;
            if (k < N && S[i] != S[j] && S[i] != S[k] && S[j] != S[k]) exc++;
        }
    }
    cout << tmp_asr - exc << endl;
    return 0;
}



Measured memory_bytes: 3612
//============================================================================
// Name        : template.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

int main() {
    string s;
    cin >> s;
    if(s == "Cloudy") {
        cout << "Rainy";
    } else if(s == "Sunny") {
        cout << "Cloudy";
    } else if(s =="Rainy") {
        cout << "Sunny";
    }
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N;cin>>N;
  ll tmp = 0;
  repn(i,N){
    tmp += i;
    if(tmp >= N){
      cout<<i<<endl;
      return 0;
    }
  }

}


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

using namespace std;

void solve(void)
{
	int n;
	cin >> n;
	vector<int> xs(n), as, bs;
	int pc = 0, nc = 0;
	for (int& x : xs)
	{
		cin >> x;
		if (x>=0) pc++;
		else nc++;
	}
	sort(xs.begin(), xs.end());
	if (pc==0)
	{
		nc--;
		pc++;
	}
	else if(nc==0)
	{
		pc--;
		nc++;
	}
	long res = xs[0], res2 = xs[n-1];
	for (int i = nc; i < n-1; i++)
	{
		as.push_back(res);
		bs.push_back(xs[i]);
		res -= xs[i];
	}
	for (int i = 1; i < nc; i++)
	{
		as.push_back(res2);
		bs.push_back(xs[i]);
		res2 -= xs[i];
	}
	as.push_back(res2);
	bs.push_back(res);
	res2 -= res;
	cout << res2 << '\n';
	for (int i = 0; i < n-1; i++)
	{
		cout << as[i] << ' ' << bs[i] << '\n';
	}
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <set>

using namespace std;

int l;
string a0;
int used[10000001];
int main(){
  while(cin>>a0>>l&&(l)){
    memset(used,-1,sizeof(used));
    //set<int> st;
    int sz=l-a0.size();
    //st.insert(atoi(a0.c_str()));
    used[atoi(a0.c_str())]=0;
    for(int i=0;i<sz;i++)a0='0'+a0;
    string init=a0;
    string cur=a0;
    //cout<<cur<<endl;
    for(int i=1;;i++){
      string nxt=cur;
      sort(nxt.begin(),nxt.end());
      reverse(nxt.begin(),nxt.end());
      int b=atoi(nxt.c_str());
      reverse(nxt.begin(),nxt.end());
      int a=atoi(nxt.c_str());
      int c=b-a;
      if(used[c]!=-1){
	cout<<used[c]<<" "<<c<<" "<<i-used[c]<<endl;
	break;
      }
      //st.insert(c);
      used[c]=i;
      stringstream ss;
      ss<<c;
      cur=ss.str();
      int sz=l-cur.size();
      for(int i=0;i<sz;i++){
	cur='0'+cur;
      }
      //cout<<cur<<endl;
    }
  }
  
  return 0;
}

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

using namespace std;

int main() {
    // Input
    int N, L;
    vector<string> S;

    cin >> N >> L;
    S = vector<string>(N);
    for (int i = 0; i < N; i++) cin >> S[i];

    // Process
    sort(S.begin(), S.end());

    // Output
    for (string s : S) cout << s;
    cout << endl;

    return 0;
}


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

using namespace std;

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

int mem[10000];

int next(int n) {
  int a[4];
  rep (i, 4) {
    a[i] = n % 10;
    n /= 10;
  }
  sort(a, a + 4);
  int p = 0, q = 0;
  rep (i, 4) p = p * 10 + a[i];
  rep (i, 4) q = q * 10 + a[3 - i];
  return q - p;
}

int solve(int n) {
  if (n == 6174) return 0;
  if (mem[n] != 0) return mem[n];
  return mem[n] = solve(next(n)) + 1;
}

int main() {
  int n;
  rep (i, 10) mem[1111 * i] = -1;
  while (true) {
    cin >> n;
    if (n == 0) break;
    if (mem[n] == -1) {
      cout << "NA" << endl;
      continue;
    }
    if (mem[n] != 0) {
      cout << mem[n] << endl;
      continue;
    }
    cout << solve(n) << endl;
  }
  return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef vector < long long > vll;
typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef vector < int > vii;

#define deb(x) cout << #x << " : " << x << endl
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,a,n) for(int i = a; i < n; i++)
#define rsz(x,n) x.clear(); x.resize(n)
#define rrsz(x,a,n) x.clear(); x.resize(n,a)
#define wt while(true)
#define all(x) x.begin(),x.end()
#define pb push_back
#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define s(n) cin >> n
#define ls(x) ((2*(x)) + 1)
#define rs(x) ((ls(x)) + 1)
#define md(a,b) ((b)+((a) - (b))/2)
#define test(testcase) for(int i = 0;i < testcase;i++)

ll t, u, v, n, k,testcase;
const ll IN = (1e11 + 7);

int main(){
    csl;
    ll k;
    cin >> t;
    cin >> k;

    vector<ll> a(t);
    for (ll& x : a){
        cin >> x;
    }

    vector<ll>dp(t, IN);
    dp[0] = 0;
    for (ll i = 0 ; i < t ; i++) {
        for (ll j = i+1 ; j <= i+k ; j++){
            if (j < t) {
                dp[j] = min(dp[j] , dp[i]+abs(a[j]-a[i]));
            }
        }
    }

    cout << dp[t-1] << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;
 
int N,M;
LL DP[3000+1][4000+1][2];
LL mod=1e9+7;
 
int main(void){
    cin>>N>>M;
    REP(i,M)
        REP(j,N+1){
            if(i==0){
                if(j==0)
                    DP[i][j][1]=1;
                else
                    DP[i][j][0]=1;
            }
            DP[i][j][0]%=mod;
            DP[i][j][1]%=mod;
            // k==0
            if(j==0){
                // DP[i+1][j+1][1]+=DP[i][j][0];
                // DP[i+1][j][1]+=DP[i][j][0];
            }else if(j==1){
 if(j!=N){
                DP[i+1][j+1][0]+=DP[i][j][0];
                DP[i+1][j][0]+=DP[i][j][0];
}
                DP[i+1][j][1]+=DP[i][j][0];
                DP[i+1][j-1][1]+=DP[i][j][0];
            }else{
                if(j!=N){
                    DP[i+1][j+1][0]+=DP[i][j][0];
                    DP[i+1][j][0]+=DP[i][j][0];
                }
                DP[i+1][j][0]+=DP[i][j][0];
                DP[i+1][j-1][0]+=DP[i][j][0];
            }
            // k==1
            if(j==0){
                DP[i+1][j][1]+=DP[i][j][1];
                DP[i+1][j+1][1]+=DP[i][j][1];
            }else if(j==1){
if(j!=N){
                DP[i+1][j+1][1]+=DP[i][j][1];
                DP[i+1][j][1]+=DP[i][j][1];
}
                DP[i+1][j][1]+=DP[i][j][1];
                DP[i+1][j-1][1]+=DP[i][j][1];
            }else{
                if(j!=N){
                    DP[i+1][j+1][1]+=DP[i][j][1];
                    DP[i+1][j][1]+=DP[i][j][1];
                }
                DP[i+1][j][1]+=DP[i][j][1];
                DP[i+1][j-1][1]+=DP[i][j][1];
            }
        }
    LL ans=0;
    REP(i,N+1){
        ans+=DP[M][i][1];
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 187264
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

		int N = scanner.nextInt();
		Set<String> items = new HashSet<String>();

		for (int i = 0; i <= N; i++) {
			items.add(scanner.nextLine());
		}

		scanner.close();

		items.removeIf(s -> s.equals(""));

		System.out.println(items.size());
	}

}


Measured memory_bytes: 79768