akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define fst	first
#define scn second

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;

int dist(pii a, pii b) {
	return (a.fst - b.fst)*(a.fst - b.fst) + (a.scn - b.scn)*(a.scn - b.scn);
}

int solve(vector<pii> p) {
	if (p.size() == 1)	return mod;
	if (p.size() < 10) {
		int ret = mod;
		rep(i, p.size())	rep(j, i)	ret = min(ret, dist(p[i], p[j]));
		return ret;
	}
	vector<pii> np;
	for (auto it : p)	np.push_back(mp(it.scn, it.fst));
	sort(np.begin(), np.end());
	int n = np.size() / 2;
	vector<pii> a, b;
	rep(i, n)	a.push_back(np[i]);
	srep(i, n, np.size())	b.push_back(np[i]);
	int ret = min(solve(a), solve(b));
	int border = b[0].fst;
	while (border + ret <= b[b.size() - 1].fst)	b.erase(b.end() - 1);
	rep(i, b.size())	b[i] = mp(b[i].scn, b[i].fst);
	sort(b.begin(), b.end());
	rrep(i, a.size()) {
		if (a[i].fst + ret <= border)	break;
		for (auto it = lower_bound(b.begin(), b.end(), mp(a[i].scn - ret, a[i].fst)); it != b.end(); it++) {
			if (a[i].scn + ret <= it->fst)	break;
			ret = min(ret, dist(*it, mp(a[i].scn, a[i].fst)));
		}
	}
	return ret;
}

int main() {
	int n;	cin >> n;
	vector<pii> p(n);
	rep(i, n)	cin >> p[i].fst >> p[i].scn;
	cout << solve(p) << endl;
	return 0;
}

Measured memory_bytes: 34072
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1000+110;

int H, W;
vector<int>r[maxn], c[maxn];
int sum[maxn][maxn];
ll ans;
char s[maxn][maxn];

int solve1(int x,int y1, int y2)
{
    if(x<1 || x>H+W) return 0;
    return sum[x][y2]-sum[x-1][y2]-sum[x][y1-1]+sum[x-1][y1-1];
}

int solve2(int y, int x1, int x2)
{
    if(y<1 || y>H+W) return 0;
    if(x1>x2) return 0;
    return sum[x2][y] - sum[x1 - 1][y] - sum[x2][y - 1] + sum[x1 - 1][y - 1];
}

int main()
{
    scanf("%d%d", &H, &W);
    for(int i=1;i<=H;i++)
    {
        scanf("%s", s[i]+1);
        for(int j=1;j<=W;j++)
        {
            if(s[i][j]=='#')
            {
                sum[i+j][i-j+W]++;
                r[i+j].push_back(i-j+W);
                c[i-j+W].push_back(i+j);
            }
        }
    }
    for(int i=1;i<=H+W;i++)
    {
        for(int j=1;j<=H+W;j++)
        {
            sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
        }
    }
    ll ans=0;
    for(int i=1;i<=H+W;i++)
    {
        sort(r[i].begin(), r[i].end());
        for(int j=0;j<int(r[i].size());j++)
        {
            for(int k=j+1; k<int(r[i].size());k++)
            {
                int l=r[i][k]-r[i][j];
                ans += solve1(i-l, r[i][j], r[i][k]);
                ans += solve1(i+l, r[i][j], r[i][k]);
            }
        }
    }
    for(int i=1;i<=H+W;i++)
    {
        sort(c[i].begin(), c[i].end());
        for(int j=0;j<int(c[i].size());j++)
        {
            for(int k=j+1;k<int(c[i].size());k++)
            {
                int l=c[i][k]-c[i][j];
                ans += solve2(i-l, c[i][j]+1, c[i][k]-1);
                ans += solve2(i+l, c[i][j]+1, c[i][k]-1);
            }
        }
    }
    printf("%lld\n", ans);

}


Measured memory_bytes: 4608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	private class DisjointSet {
		
		int[] p, rank;
		
		public DisjointSet(int size) {
			p = new int[size];
			rank = new int[size];
			for (int i = 0; i < size; i++) {
				makeSet(i);
			}
		}

		private void makeSet(int x) {
			p[x] = x;
			rank[x] = 0;
		}
		
		public boolean same(int x, int y) {
			return findSet(x) == findSet(y);
		}

		private int findSet(int x) {
			while (x != p[x]) {
				x = p[x];
			}
			return p[x];
		}
		
		public void unite(int x, int y) {
			link(findSet(x), findSet(y));
		}

		private void link(int x, int y) {
			if (rank[x] > rank[y]) {
				p[y] = x;
			} else {
				p[x] = y;
				if (rank[x] == rank[y]) {
					rank[y]++;
				}
			}
		}
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(reader.readLine());
		int n = Integer.parseInt(st.nextToken());
		DisjointSet ds = new DisjointSet(n);
		int q = Integer.parseInt(st.nextToken());
		for (int i = 0; i < q; i++) {
			st = new StringTokenizer(reader.readLine());
			int c = Integer.parseInt(st.nextToken());
			int x= Integer.parseInt(st.nextToken());
			int y = Integer.parseInt(st.nextToken());
			if (c == 0) {
				ds.unite(x, y);
			} else {
				System.out.println(ds.same(x, y)?"1":"0");
			}
		}
		reader.close();
	}
}



Measured memory_bytes: 60772
S = input()

flag = 1
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == 'L':
            flag = -1
            break
    else:
        if S[i] == 'R':
            flag = -1
            break

if flag == 1:
    print("Yes")
else:
    print("No")


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

const int MAX = 100;

int SelectionSort(int A[],  int n){  // 不稳定 
	int count = 0;
	int min;
	for( int i = 0; i < n-1; i ++){
		min = i;
		for( int j = i; j < n; j++)
			if( A[min] > A[j] )
				min = j;
		swap(A[i], A[min]);
		if( i != min )  // 如果i==min，说明最小的元素是未排序序列的第一个，不需要交换 
			count++; 
	}
	return count;
}

void PrintInfo(int A[], int n){
	for(int i = 0; i < n; i++){
		if(i) cout << " ";
		cout << A[i];
	}
	cout << "\n";
	
		
}

int main()
{
	int n;
	int A[MAX];
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> A[i];
	int count = SelectionSort(A, n);
	PrintInfo(A, n);
	cout << count << "\n";
	return 0;	
} 












Measured memory_bytes: 3104
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter out = new PrintWriter(System.out);

    String s = in.next();

    int res = Integer.MAX_VALUE;

    for (int i = 2; i < s.length(); i++) {
      res = Math.min(res, Math.abs(753 - Integer.parseInt(s.substring(i - 2, i + 1))));
    }

    out.println(res);

    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

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

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

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }

  static void print(int[] arr) {
    Arrays.stream(arr).forEach(i -> System.out.print(i + " "));
    System.out.println();
  }

  public static int[] mergeSort(int[] a) {
    if (a.length <= 1)
      return a;

    int mid = a.length / 2;
    int[] left = new int[mid];
    int[] right = new int[a.length - mid];

    for (int i = 0; i < mid; ++i)
      left[i] = a[i];

    for (int i = mid; i < a.length; ++i)
      right[i - mid] = a[i];

    return merge(mergeSort(left), mergeSort(right));
  }

  public static int[] merge (int[] l, int[] r) {
    int[] merged = new int[l.length + r.length];

    int i = 0, j = 0, k = 0;
    while (i < l.length && j < r.length) {
      if (l[i] <= r[j])
        merged[k++] = l[i++];
      else
        merged[k++] = r[j++];
    }

    while (i < l.length)
      merged[k++] = l[i++];
    while (j < r.length)
      merged[k++] = r[j++];

    return merged;
  }

}



Measured memory_bytes: 23252
q = int(input())
lr = [list(map(int, input().split())) for _ in range(q)]
#nの素数判定
def is_prime(n):
    if n == 1:
        return 0
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return 0
    return 1

m = 0
for l, r in lr:
    m = max(l, r, m)
prime_count = [0, 0]
for i in range(2, m+1):
    prime_count += [is_prime(i)]
similar = [0]*(m+1)
for i in range(3, m+1):
    if prime_count[i] == 1 and prime_count[(i+1)//2] == 1:
        similar[i] = 1
for i in range(m):
    similar[i+1] = similar[i+1] + similar[i]

for l, r in lr:
    print(similar[r]-similar[l-1])

Measured memory_bytes: 70744
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using namespace std;
ll power(ll a,ll n)
{
          ll result=1;
          while(n>0)
          {
               if(n&1)
                    result=result*a;
               a=a*a;
               n=n>>1;
          }
          return result;
}
ll lcm(ll a,ll b)
{
          return ((a*b)/__gcd(a,b));
}
bool ispow2(ll n)
{
          return (ceil(log2(n))==floor(log2(n)));
}
bool isprime(ll n)
{
          if(n==1)
               return false;
          else if(n==2)
               return true;
          else
          {
               for(ll i=2;i*i<=n;++i)
               {
                    if(n%i==0)
                         return false;
               }
               return true;
          }
}

ll ncr(ll n,ll r)
{
    if(r > n - r)
          r = n - r;
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++)
     {
        ans *= n - r + i;
        ans /= i;
    }

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

          int t=1;
          //cin>>t;
          while(t--)
          {
                    int n;
                    cin>>n;
                    if(n%2==0 || n==5)
                         cout<<"-1";
                    else
                    {
                         ll count=1;
                         ll num=7;
                         while(true)
                         {
                              if(num%n==0)
                                   break;
                              if(count>n)
                              {
                                   cout<<"-1";
                                   return 0;
                              }
                              num = (num%n)*10 + 7;
                              count++;
                         }
                         cout<<count;
                    }
          }
          return 0;
}


Measured memory_bytes: 3680
//  main.cpp
//  CppTest

#include <iostream>
#include <set>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {

    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    int N,count = 0;
    unsigned long long int L[110];
    cin >> N;
    for(int i = 0; i < N ; i++) cin >> L[i];


    sort(L, L+N);
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]!=L[j] && L[j]!=L[k]){
                    if(L[i] + L[j] > L[k]) count++;
                }
            }
        }
    }
    cout << count << endl;
    /////////////////////

    return 0;
}


Measured memory_bytes: 3664
//
// Created by Ильдар Ялалов on 14.01.2020.
//
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
typedef unsigned int uint;
#define pb push_back
#define eb emplace_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define mp make_pair
#define all(a) a.begin(),a.end()

#ifdef zxc

#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

bool debug = 0;
const int MAXN = 4e6 + 100;
const int LOG = 21;
const int mod = 1e9 + 7;
const int MX = (1e7 + 100);


void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i]--;
    }
    sort(all(a));
    reverse(all(a));
    debug(a);

    int id = 0;
    while (id + 1 < n && id + 1 <= a[id + 1]) {
        id++;
    }


    int id2 = id;
    while (id2 + 1 < n && a[id2 + 1] >= id) {
        id2++;
    }
    debug(id);
    debug(id2);

    int len1 = a[id] - id;
    int len2 = id2 - id;
    if ((len1 % 2) == 0 && (len2 % 2) == 0) {
        cout << "Second";
    } else {
        cout << "First";
    }

}


// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES ( n==1)
signed main() {
#ifdef zxc
    freopen("../input.txt", "r", stdin);
//    freopen("../output.txt", "w", stdout);
#else
#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(2);


    int t = 1;
    while (t--) {
        solve();
    }
    debug(1.0 * clock() / CLOCKS_PER_SEC);
}

Measured memory_bytes: 640
//include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <utility>
#include <string>
#include <set>
#include <map>
#include <cassert>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pf push_front
#define pof push_front
#define pb push_back
#define pob pob_back
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FOR_(i, n) for (int i = n; i >= 0; i--)
#define FOR1(i, n) for(int i = 1; i <= n; i++)
#define FOR2(i, a, b) for (int i = a; a <= b; i++)
#define FOR2_(i, b, a) for (int i = b; i >= a; i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#ifdef momo
#define  debug(...) do{\
fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
_do(__VA_ARGS__);\
}while(0)
template<typename t> void _do(t &&_x){cerr<<_x<<endl;}
template<typename t,typename ...T> void _do(t &&_x,T &&...tail){cerr<<_x<<", ";_do(tail...);}
#else
#define debug(...)
#endif


int main(void)
{
    IOS;
    int A, B; cin >> A >> B;
    if (A == B) puts("Draw");
    else if (A == 1 || (B != 1 && A > B)) puts("Alice");
    else puts("Bob");
    return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

ll cmp(ll a) {
    ll b = a - (a%4);
    ll r = 0;
    for (ll i = b; i < a; i++)
        r ^= i;
    return r;
}

int main() {
    ll a = gli();
    cout << (cmp(a) ^ cmp(gli()+1)) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;



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

    	 int ans=0;

    	 int C[] = new int[5];
    	 for(int i =0;i<5;i++){
    		A[i]=sc.nextInt();
    		total += A[i];

    		C[i] = A[i]%10;
    		if(C[i]!=0){
    		C[i]= 10-C[i];
    		ans += C[i];
    		}


    	 }
    	 Arrays.sort(C);

    	 System.out.println(ans+total-C[4]);

    }

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200015

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;

ll N ,ant,sol[maxn],Pad[maxn],a,b,A[maxn],P[maxn],top;
vector<ll> G[maxn];


void dfs(int nod)
{

    for(auto ady:G[nod]){
        if(Pad[ady])
            continue;
        Pad[ady] = nod;

        int ant = -1;
        int pos = lower_bound(P+1,P+1+top,A[ady]) - P;
        if(pos<=top)
             ant = P[pos], P[pos] = A[ady];
        else
             P[++top] = A[ady] ;


        sol[ady] = top;
        dfs(ady);
        if(ant == -1)
            P[top--] = 0;
        else
            P[pos] = ant;
    }
}

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;

    for(int i=1;i<=N;i++)
        cin >> A[i];

    for(int i=1;i<N;i++){
        cin >> a >> b;
        G[a].pb(b);
        G[b].pb(a);
    }
    sol[1] = 1;
    P[++top] = A[1];
    Pad[1] = -1;

    dfs(1);

    for(int i=1;i<=N;i++)
        cout << sol[i] << "\n";






}


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

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

typedef int64_t ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

  // test
  /*
  vector<int> P(N);
  iota(ALL(P), 1);

  vector<int> argmax;
  int maxval = 0;
  do {
    int tmp = 0;
    REP(i,N) tmp += (i + 1) % P[i];
    if (tmp > maxval) {
      maxval = tmp;
      argmax = P;
    }
  }while(next_permutation(ALL(P)));


  cout << maxval << endl;
  REP(i,N) cout << " " << argmax[i];
  cout << endl;
  */
  ll ret = (N - 1) * N / 2;
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
k, n, *A = read().split()
far = int(k) + int(A[0]) - int(A[-1])
for x, y in zip(A[1:], A):
    if far < int(x) - int(y):
        far = int(x) - int(y)
print(int(k)-far)

Measured memory_bytes: 21556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

using VecP = Vec1<P>;

Vec pn;

bool isPrime(ll n){
	if(n == 1) return false;
	for(ll i : pn){
		if(i * i > n) return true;
		if(n % i == 0) return false;
	}
	return true;
}

void init(ll n = 2e5){
	pn.pb(2);
	REP(num, 3, n) if(isPrime(num)) pn.pb(num);
}

VecP primeFactorization(ll n){
	VecP res;

	for(ll i : pn){
		ll cnt = 0;
		while(n % i == 0){
			n /= i;
			cnt++;
		}
		if(cnt) res.pb({i, cnt});
		if(n < i * i) break;
	}
	if(n != 1) res.pb({n, 1});

	return res;
}

Vec divisorEnumeration(ll n){
	auto v = primeFactorization(n);

	Vec res, a, b, cp;
	res.pb(1);
	for(auto p : v){
		cp.resize(res.size());
		copy(all(res), cp.begin());
		a.resize(res.size());
		repn(k, p.sc){
			ll t = pow(p.fs, k);
			rep(i, a.size()) a[i] = cp[i] * t;
			merge(all(res), all(a), back_inserter(b));
			swap(res, b);
			b.clear();
		}
	}

	return res;
}

int main(void){
	init();
	ll n;
	cin >> n;

	Vec f(n + 1, 1);
	for (ll i = 2; i <= n; ++i){
		for(ll j = i; j <= n; j += i) ++f[j];
	}

	ll ans = 0;
	repn(i, n) ans += i * f[i];
	co(ans);

	return 0;
}


Measured memory_bytes: 81852
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> P(N), Q(N);
	for (int i = 0; i < N; ++i) { cin >> P[i]; }
	for (int i = 0; i < N; ++i) { cin >> Q[i]; }

	vector<int> v(N);
	for (int i = 0; i < N; ++i) { v[i] = i + 1; }

	int a = 0, b = 0;
	int cnt = 1;
	do {
		bool ok = true;
		for (int i = 0; i < N; ++i) {
			if (v[i] != P[i]) { ok = false; }
		}
		if (ok) { a = cnt; }
		ok = true;
		for (int i = 0; i < N; ++i) {
			if (v[i] != Q[i]) { ok = false; }
		}
		if (ok) { b = cnt; }
		++cnt;
	} while (next_permutation(v.begin(), v.end()));

	int ans = abs(a - b);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
#define inf 10000000
using namespace std;
typedef long long int ll;

int main(){

    int X;
    cin >> X;

    if( (X == 7)||(X == 5)||(X == 3) ){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

}

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

int findSumOfDigits(int n){
  int sum = 0;
  while(n > 0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int total = 0;
  for(int i = 1;i <= N; ++i){
    int sum = findSumOfDigits(i);
    if(sum >= A && sum <= B){
      total += i;
    }
  }
  cout << total << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(0);

    int n,k; cin >> n >> k;
    vint a(n);
    rep(i,n) cin >> a[i];

    cout<<ceil((n-1)/(k-1.0))<<endl;
    //cout<<ceil(8.0/3.0)<<endl;
    
}

Measured memory_bytes: 3944
#include<iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <string>
#include<limits>
#include<cstdlib>
#include<functional>
#include<cassert>
#include <cstdio>
#include <stack>
#include <queue>
#include <map>
#define fi(p) for(int i=0;i<(p);i++)
#define ce(d) cout<<d<<endl;
#define ll long long
#define sorts(c) sort((c).begin(),(c).end());

using namespace std;

void solve() {
	int n;
	int res = 0;
	cin >> n ;
	bool f = false;

	for (int i = 1; i < 10; i++) {
		if (n % i == 0 && n/i<10) {
			f = true;
		}
	}

	if (f == true) {
		ce("Yes")
	}
	else {
		ce("No")
	}

	
}



int main()
{

	solve();

	int a;//止める用
	cin >> a;
	return 0;
}

Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9 + 7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
#ifdef LOCAL
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
int dx[4] ={ 1,0,-1,0 };
int dy[4] ={ 0,1,0,-1 };

int N, H, W;

signed main() {
	cin >> N >> H >> W;
	int ans = 0;
	rep(i, N){
		int A, B;
		cin >> A >> B;
		if(A >= H && B >= W) ans++;
	}
	cout << ans << endl;
}

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


int main(void) {
	string s;
	cin >> s;
	int length = s.size();

	map<char, char> m;
	m['0'] = '1';
	m['1'] = '0';

	int ret = 0;
	for (int i = 0; i < length - 1; i++) {
		if (s[i] == s[i + 1]) {
			int cnt_same = 1;
			char c = s[i];
			int j = i + 1;
			while (c == s[j]) {
				j++;
			}

			for (int k = i + 1; k < j; k += 2) {
				s[k] = m[s[k]];
				ret++;
			}
			i = j-2;
		}
	}

	cout << ret;
	return 0;

}

Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int N, K;
  string S;
  cin >> N >> K >> S;
  vector<int> zeroOne;
  int begin = 0;
  for(int i=0; i<N; i++) {
    if(S[i] != S[begin]) {
      zeroOne.push_back(i-begin);
      begin = i;
    }
  }
  zeroOne.push_back(N-begin);

  vector<int> sumZeroOne(zeroOne.size()+1);
  sumZeroOne[0] = 0;
  for(int i=0; i<zeroOne.size(); i++)
    sumZeroOne[i+1] = sumZeroOne[i] + zeroOne[i];

  int ans = 0;
  int ib = S[0] == '0' ? -1 : 0;
  for(int i=ib; i<(int)sumZeroOne.size(); i+=2) {
    int tmp = sumZeroOne[min((int)sumZeroOne.size()-1, i+2*K+1)] - sumZeroOne[max(i,0)];
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}

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

main(){
  
  ll n,m;
  cin>>n>>m;
  vector<ll> l(m),r(m);
  rep(i,m)cin>>l[i]>>r[i];
  
  ll mx=-(1LL<<60),mn=(1LL<<60);
  rep(i,m){
    mx=max(mx,l[i]);
    mn=min(mn,r[i]);
  }
  if(mx>mn){puts("0");return 0;}
  ll ans=mn-mx+1;
  cout<<(ans)<<endl;

}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstdlib>

int main() {
    std::string S;
    std::cin >> S;
    int l = std::atoi(S.substr(0, 2).c_str());
    int r = std::atoi(S.substr(2, 2).c_str());

    if (1 <= l && l <= 12) {
        if (1 <= r && r <= 12) {
            std::cout << "AMBIGUOUS" << std::endl;
        } else {
            std::cout << "MMYY" << std::endl;
        }
    } else {
        if (1 <= r && r <= 12) {
            std::cout << "YYMM" << std::endl;
        } else {
            std::cout << "NA" << std::endl;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0;i < n;++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");

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

    set<string> s;
    rep(n) {
        string temp;
        cin >> temp;
        s.insert(temp);
    }

    cout << s.size() << endl;
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  string s; cin >> s;
  int K; cin >> K;
  vector<string> vs;
  rep(i, s.size()) {
    string base;
    rep(j, s.size() - i) {
      base.push_back(s[i + j]);
      vs.push_back(base);
      if (base.size() >= K) {
        break;
      }
    }
  }
  sort(vs.begin(), vs.end());
  vs.erase(unique(vs.begin(), vs.end()), vs.end());
  cout << vs[K - 1] << "\n";
}


Measured memory_bytes: 1660
using System;
using System.Linq;

namespace B_Between
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().ToLongArray();
            var a = inputs[0];
            var b = inputs[1];
            var x = inputs[2];

            var small = a == 0 ? -1 : (a - 1) / x;
            var big = b / x;

            Console.WriteLine(big -small);
        }
    }
    
    static class StringExtention
    {
        static public int ToInt(this string input)
        {
            return int.Parse(input);
        }

        static public int[] ToIntArray(this string input)
        {
            return input.Split(' ').Select(int.Parse).ToArray();
        }

        static public long ToLong(this string input)
        {
            return long.Parse(input);
        }

        static public long[] ToLongArray(this string input)
        {
            return input.Split(' ').Select(long.Parse).ToArray();
        }
    }
}


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

int main(){
  string w[8];
  string a;
  ll i;
  w[1]="SAT";
  w[2]="FRI";
  w[3]="THU";
  w[4]="WED";
  w[5]="TUE";
  w[6]="MON";
  w[7]="SUN";
  cin >> a;
  for(i=1;i<=7;i++){
    if(a==w[i])cout << i;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var mf = new MaxFlow_Dinic();
		
		int NN = N + 2;
		int S = 0, T = N + 1;
		
		mf.Init(NN);
		long tot = 0;
		long Inf = (long) 1e18;
		
		for(int i=1;i<=N;i++){
			if(A[i-1] <= 0){
				mf.AddEdge(S, i, -A[i-1]);
			}
			if(A[i-1] > 0){
				mf.AddEdge(i, T, A[i-1]);
				tot += A[i-1];
			}
			for(int j=i+i;j<=N;j+=i){
				mf.AddEdge(i, j, Inf);
			}
		}
		var f = mf.MaxFlow(S,T);
		Console.WriteLine(tot - f);
	}
	
	
	
	
	
	int N;
	long[] A;
	public Sol(){
		N = ri();
		A = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


class MaxFlow_Dinic{
	// arihon is god
	class Edge {
		public int To,Rev;
		public long Cap;
		public Edge(int to = 0,long cap = 0,int rev = 0){
			To = to;
			Cap = cap;
			Rev = rev;
		}
	}
	
	List<Edge>[] G;
	long[] Level;
	int[] Iter;
	
	static long Inf = (long) 1e18;
	public int N;
	public void Init(int n){
		N = n;
		G = new List<Edge>[N];
		for(int i=0;i<N;i++) G[i] = new List<Edge>();
		Level = new long[N];
		Iter = new int[N];
	}
	
	
	public void AddEdge(int from, int to, long cap){
		G[from].Add(new Edge(to,cap,G[to].Count));
		G[to].Add(new Edge(from,0,G[from].Count-1));
	}
	
	void bfs(int s){
		for(int j=0;j<G.Length;j++)Level[j] = -1;
		var Q = new Queue<int>();
		Level[s] = 0;
		Q.Enqueue(s);
		
		while(Q.Count>0){
			var v = Q.Dequeue();
			foreach(var e in G[v]){
				if(e.Cap > 0 && Level[e.To] < 0){
					Level[e.To] = Level[v] + 1;
					Q.Enqueue(e.To);
				}
			}
		}
	}
	
	long dfs(int v, int t, long f){
		if(v == t) return f;
		for(;Iter[v] < G[v].Count; Iter[v]++){
			var e = G[v][Iter[v]];
			if(e.Cap > 0 && Level[v] < Level[e.To]){
				long d = dfs(e.To, t, Math.Min(f,e.Cap));
				if(d > 0){
					e.Cap -= d;
					G[e.To][e.Rev].Cap += d;
					return d;
				}
			}
		}
		return 0;
	}
	
	public long MaxFlow(int s,int t){
		long flow = 0;
		while(true){
			bfs(s);
			if(Level[t] < 0) return flow;
			Iter = new int[N];
			
			long f;
			while( ( f = dfs(s,t,Inf)) > 0){
				flow += f;
			}
		}
	}
	
}


Measured memory_bytes: 13396
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
#include<map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 2000000000;

    ll N,M;
    ll A,B,C;
    std::string S,T;
    bool F=true;
    ll ans=0;

int main(){
    ios_base::sync_with_stdio(false);
    cin>>S;
    REP(i,(signed)S.size()){
        if(i==0){if(S[i]!='A')F=false;}
        else{
            if('a'<=S[i]&&S[i]<='z'){}
            else{
                if(2<=i&&i<=(signed)S.size()-2&&S[i]=='C'){
                    A++;
                }else{
                    F=false;
                }
            }
        }
    }
    cout<<(F&&A==1?"AC":"WA")<<endl;

    //cout<<A<<endl<<B;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n;cin >> n;
	vector<double> vv;
	for(int i = 0; i < n; i++){
		double v; cin >> v;
		vv.push_back(v);
	}
	sort(vv.begin(), vv.end());

	double sum = vv[0];
	for(int i = 1; i < n; i++){
		sum +=  vv[i];
		sum /= 2;
	}
	cout << sum << endl;

}

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

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i,N){ cin >> A[i]; }

	vector<int> F(N);
	F[0] = A[0];
	vector<int> B(N);
	B[N-1] = A[N-1];
	for(int i=1; i<N; i++){
		F[i] = __gcd(A[i],F[i-1]);
		B[N-1-i] = __gcd(A[N-1-i], B[N-i]);
	}

	int ans = 0;
	rep(i,N){
		ans = max(ans,__gcd(F[i-1],B[i+1]) );
	}
	cout << ans << endl;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0 && a[0] != 0) {
      cout << -1 << '\n';
      return 0;
    }
  }
  int cur = 0;
  long long ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] < cur) {
      cout << -1 << '\n';
      return 0;
    } else if (a[i] > cur) {
      cur = a[i];
      ans += cur;
    }
    if (cur) --cur;
  }
  cout << (cur ? -1 : ans) << '\n';
  return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
void read(pp& x){ scanf("%d%d",&x.first, &x.second); }
void read(pll& x){ scanf("%lld%lld",&x.first, &x.second); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
void cppio(){ ios_base::sync_with_stdio(0); cin.tie(0); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define sz(x) (int)(x).size()

int n, m;

const ll mod = 998244353;
const int maxn = 3e6;

ll fact[maxn];
ll finv[maxn];

ll ipow(ll b, ll e) {
	ll ret = 1;
	while(e) {
		if(e&1) (ret *= b) %= mod;
		(b *= b) %= mod; e /= 2;
	}
	return ret;
}

ll comb(ll n, ll r) {
	if(r < 0 || r > n) return 0;
	return fact[n] * finv[r] % mod * finv[n-r] % mod;
}

ll h(ll n, ll r) { return comb(n+r-1, r); }

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

	fact[0] = 1;
	int T = n + 3*m;
	for(int i=1; i<=T; ++i)
		fact[i] = fact[i-1] * i % mod;
	finv[T] = ipow(fact[T], mod-2);

	for(int i=T; 1<=i; --i)
		finv[i-1] = finv[i] * i % mod;

	ll ans = 0;
	for(int k=m%2; k <= m && k <= n; k+=2) {
		ll shit = 2*m+1;
		ll way = h(n, (3*m-k)/2);

		if(k) {
			ll N = n - 1 + (3*m - shit-(k-1))/2;
			ll R = (3*m - shit-(k-1))/2;

			way += mod - k * comb(N, R) % mod;
			way %= mod;
		}

		++shit;
		if(n > k)
		{
			ll N = n - 1 + (3*m - shit - k) / 2;
			ll R = (3*m - shit - k) / 2;

			way += mod - comb(N, R) * (n-k) % mod;
			way %= mod;
		}

		(ans += comb(n, k) * way) %= mod;
	}

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


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

int N,M,S,T;
vector<vector<int>> graph(333333);
vector<int> dist(333333,-1);

void BFS(){
	queue<int> que;
	dist[3*S]=0;
	que.push(3*S);
	while(!que.empty()){
		int f=que.front();
		que.pop();
		for(auto t:graph[f]){
			if(dist[t]==-1){
				dist[t]=dist[f]+1;
				que.push(t);
			}
		}
	}
} 

int main(){
	cin >> N >> M;
	for(int i=0;i<M;i++){
		int u,v;
		cin >> u >> v;
		u--;
		v--;
		for(int k=0;k<3;k++){
			graph[3*u+k].push_back(3*v+((k+1)%3));
		}
	}
	cin >> S >> T;
	S--;
	T--;
	BFS();
	if(dist[3*T]==-1)cout << "-1" << endl;
	else cout << dist[3*T]/3 << endl;
	return 0;
}

Measured memory_bytes: 18688
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0)
# readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
# gets.split.map(&:to_i)

s = gets.chomp

puts s[0].to_i + s[1].to_i + s[2].to_i


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
#define INF 1<<21
using pii = std::pair<int, int>;
#define SORT(v) std::sort(v.begin(), v.end())
int F[100][15];
int main(void) {
    int N;
    std::cin >> N;
    std::vector<int> a(N);
    std::vector<std::vector<int>> P(N, std::vector<int>(11, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 10; j++) {
            std::cin >> F[i][j];
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 11; j++) {
            std::cin >> P[i][j];
        }
    }
    int res = -(1<<30);
    for (int b =1; b < (1 << 10); b++) {
        int curcost = 0;
        for (int i = 0; i < N; i++) {
            int c = 0;
            for (int j = 0; j < 10; j++) {
                if ((b >> j & 1) && F[i][j]) {
                    c++;
                }
                
            }
            curcost += P[i][c];
        }
        res = std::max(res, curcost);
    }
    std::cout << res << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		
		if(N % 2 == 0) ans = N;
		else ans = N * 2;
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int p=sc.nextInt();
        boolean even=false,odd=false;
        Integer a[]=new Integer[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
            if(a[i]%2==0)even=true;
            if(a[i]%2!=0)odd=true;
        } 
        if(odd){
            System.out.println(1L<<n-1);
        }
        else if((even&&p==0)){
            System.out.println(1L<<n);
        }
        else if(even&&p==1){
            System.out.println(0);
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
int a[maxn],b[maxn];
int cnta[maxn],cntb[maxn],id[maxn];
int n;
bool cmp(int x,int y) {return cntb[x] > cntb[y];}
int main(){
    cin>>n;
    n>>=1;
    for (int i=0;i<n;i++) scanf("%d%d",&a[i],&b[i]);
    sort(a,a+n);    sort(b,b+n);
    a[n] = 100000000; b[n] = 100000000;
    int tota = 0, totb = 0;
    for (int i=0;i<n;i++) if (a[i] == a[tota]) cnta[tota]++;else a[++tota] = a[i], cnta[tota]++;
    for (int i=0;i<n;i++) if (b[i] == b[totb]) cntb[totb]++;else b[++totb] = b[i], cntb[totb]++;
    tota++;totb++;
//    cout<<"tota = "<<tota<<" --- ";for (int i=0;i<tota;i++) cout<<a[i]<<","<<cnta[i]<<"\t";cout<<endl;
//    cout<<"totb = "<<totb<<" --- ";for (int i=0;i<totb;i++) cout<<b[i]<<","<<cntb[i]<<"\t";cout<<endl;

    b[totb] = 10000000; cntb[totb++] = 0;
    for (int i=0;i<totb;i++) id[i] = i;
    sort(id,id+totb,cmp);

    int ans = 2*n;
    for (int i=0,t;i<tota;i++){
        if (a[i] == b[id[0]]) t = 1; else t = 0;
        ans = min(ans, n - cnta[i] + n - cntb[id[t]]);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1280
N = int(input())
ansCnt = 0
for i in range(1, N + 1, 2):
    tmpCnt = 0
    for j in range(1, N + 1):
        if i < j:
            break
        if i % j == 0:
            tmpCnt += 1
    if tmpCnt == 8:
        ansCnt += 1

print(ansCnt)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";

string longPath(string side, int n) {
    string path ="";
    for (int i = 0; i < n; i++) {
        path += side;
    }
    return path;
}

int main() {

    CIN(int, sx);
    CIN(int, sy);
    CIN(int, tx);
    CIN(int, ty);

    string path = "";

    path += longPath("R", (tx - sx));
    path += longPath("U", (ty - sy));
    path += longPath("L", (tx - sx));
    path += longPath("D", (ty - sy));

    path += "L";
    path += longPath("U", (ty - sy) + 1);
    path += longPath("R", (tx - sx) + 1);
    path += "D";
    path += "R";
    path += longPath("D", (ty - sy) + 1);
    path += longPath("L", (tx - sx) + 1);
    path += "U";

    cout << path << "\n";
    return 0;
}

Measured memory_bytes: 256
use std::io;
use std::collections::HashSet;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<u64> = procon_read();
	let mut set = HashSet::new();
	let mut p:Vec<u64> = Vec::new();
	let a = v[0];
	let b = v[1];
	let k = v[2];
	if k <= b - a + 1 {
		for i in a..(a+k) {
			if set.insert(i) {
				p.push(i);
			}
		}
		for i in (b-k + 1)..(b+1) {
			if set.insert(i) {
				p.push(i);
			}
		}
		for i in p {
			println!("{}", i);
		}
	}else{
		for i in a..(b+1) {
			println!("{}", i);
		}
	}
}

Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 10000
using namespace std;
typedef long long int ll;

int main(){
  int n, m;  cin >> n >> m;
  ll ans = 1;
  ll digit = 1000000007;
  if(abs(n-m)==0){
    for(int i = 1; i<=n; i++)  ans = ans * i % digit;
    ans = ans * ans % digit;
    ans = ans * 2 % digit;
  }
  else if(abs(n-m)==1){
    for(int i = 1; i<=n; i++) ans = ans * i % digit;
    for(int i = 1; i<=m; i++) ans = ans * i % digit;
  }
  else{
    ans = 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
inline ll read()
{
	ll x=0,f=1; char ch=0;
	while(!isdigit(ch)) f=(ch=='-'?-1:1),ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*f;
}
int main()
{
	ll l=read(),r=read();
	ll tmp=l/2019;
	if(l%2019) tmp++;
	if(r>=tmp*2019) puts("0");
	else{
		ll ans=0x7fffffff;
		for(register int i=l;i<=r;i++){
			for(register int j=i+1;j<=r;j++){
				ans=min(ans,1ll*i*j%2019);
			}
		}
		printf("%lld\n",ans);
	}
	return 0;	
}

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

vector<pair<ll,ll> > res;

//Nについて素因数分解
void factor(ll N){
    for(ll i=2;i*i <= N;i++){
        
        if(N % i != 0)continue;
        ll count = 0;
        while(N % i == 0){
            count++;
            N /= i;
        }
        res.push_back({i,count});
    }
    if(N !=1)res.push_back({N,1});
}
int main()
{
    ll n,p; cin >> n >> p;
    factor(p);
    ll gcd = 1;
    for(auto a:res){
        for(int i=0;i<a.second/n;i++)gcd *= a.first;
    }
    cout << gcd << endl;
}


Measured memory_bytes: 256