akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def sum(a,b):
        return ((b+a)*(b-a+1)) >> 1
    def fact(n):
        if n < 4:
            return [1,n]
        res = [1]
        i = 2
        while i**2 <= n:
            if n%i == 0:
                res.append(i)
                m = n//i
                if i != m:
                    res.append(m)
            i += 1
        res.append(n)
        return res
    s = I()
    if s == 1:
        print(1)
        return
    lis = fact(s)
    f = defaultdict(lambda : 0)
    p = defaultdict(lambda : 1)
    lis.sort()
    for k in lis:
        for a in range(1,k+1):
            b = k-a
            if a <= b:
                if p[(a,b)]:
                    f[sum(a,b)] += 1
                    p[(a,b)] = 0
                    
        for a in range(1,s+1):
            b = k+a-1
            if p[(a,b)]:
                s_ = sum(a,b)
                if s_ > s:
                    break
                f[s_] += 1
                p[(a,b)] = 0
    ans = 0
    for k in lis:
        ans += f[k]*f[s//k]
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()



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

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x)  cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
//グラフ用
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};	
//ここから書き始める

ll combination(ll n, ll i){
	ll count = 0;
	ll multi = 1;
	ll div =1;
	int limit = i;
	while(count < limit){
		multi *= n;
		n--;
		multi/= count+1;
		count ++ ;
	}
	return multi / div;
}

int main()
{
	cout <<setprecision(10);
	ll n , c, k;
	cin >> n >> c >> k ;
	vector<ll> time(n);
	rep(i,n) cin >>time[i];

	SORT(time);
	ll active_start = 0 ;
	ll rider = 0;
	ll active = 0;
	ll bus = 0;
	bool newbus = true;
	rep(i,n){
		rider ++;
		if(i==0||newbus){
			active_start = time[i];
			newbus = false;
		}
		active = time[i] - active_start ;
		if( active > k){
			bus ++ ;
			//今いるところからもう一度やらないといけない
			active_start = time[i];
			rider = 1;
		} else if(rider == c ){//k分を超えてしまったらダメ 1戻す必要がある
			bus ++ ;
			newbus = true;
			rider = 0;
		}	
	}
	if(rider > 0) bus ++ ;
	cout << bus << endl;
}


Measured memory_bytes: 1024
#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> s(n);
  rep(i,n) cin>>s[i];
  sort(s.begin(),s.end());
  bool ans=true;
  rep(i,n-1) {
    if (s[i]==s[i+1]) ans=false;
  }
  cout<<(ans ? "YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

constexpr int INF = 1'000'000'001;

class arc092_e {
private:
    vector<int> solve(set<int> &take, vector<int> &a) {
        vector<int> res;
        int n = a.size();
        vector<int> keep(n, 0);
        for (int i = 0; i < n; ++i) {
            keep[i] = take.count(i);
        }
        while (keep.size() > 1U) {
            int m = keep.size();
            //cout << m << endl;
            if (!keep[m - 1]) {
                //cout << 1 << " " << m << endl;
                res.push_back(m);
                keep.pop_back();
            } else if (!keep[0]) {
                //cout << 2 << " " << 1 << endl;
                res.push_back(1);
                keep.erase(begin(keep));
            } else {
                for (int i = 1; i + 1 < m; ++i) {
                    if (keep[i - 1] && keep[i + 1]) {
                        keep[i - 1] = 1;
                        //cout << 3 << " " << i + 1 << endl;
                        res.push_back(i + 1);
                        keep.erase(begin(keep) + i, begin(keep) + i + 2);
                        break;
                    } else if (!keep[i - 1] && !keep[i + 1]) {
                        keep[i - 1] = 0;
                        //cout << 4 << " " << i + 1 << endl;
                        res.push_back(i + 1);
                        keep.erase(begin(keep) + i, begin(keep) + i + 2);
                        break;
                    }
                }
            }
        }
        return res;
    }
public:
    void solve(istream& in, ostream& out) {
        int N;
        in >> N;
        vector<int> a(N);
        for (int i = 0; i < N; ++i) {
            in >> a[i];
        }
        set<int> take0, take1;
        for (int i = 0; i < N; ++i) {
            if (a[i] >= 0) {
                if (i % 2) take1.insert(i);
                else take0.insert(i);
            }
        }
        if (take0.empty()) {
            int mx = -INF, ind = -1;
            for (int i = 0; i < N; i += 2) {
                if (a[i] > mx) {
                    mx = a[i];
                    ind = i;
                }
            }
            take0.insert(ind);
        }
        if (take1.empty()) {
            int mx = -INF, ind = -1;
            for (int i = 1; i < N; i += 2) {
                if (a[i] > mx) {
                    mx = a[i];
                    ind = i;
                }
            }
            take1.insert(ind);
        }
        long long sum0 = 0, sum1 = 0;
        for (int i : take0) sum0 += a[i];
        for (int i : take1) sum1 += a[i];
        vector<int> res;
        if (sum0 >= sum1) {
            res = solve(take0, a);
        } else {
            res = solve(take1, a);
        }
        out << max(sum0, sum1) << "\n" << res.size() << "\n";
        for (int x : res) {
            out << x << "\n";
        }
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc092_e solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int n = sc.nextInt();
        int t = sc.nextInt();

        int[] c = new int[n];
        int[] time = new int[n];

        for(int i = 0; i < n; i++){
            c[i] = sc.nextInt();
            time[i] = sc.nextInt();
        }

        int answer = 1001;

        for(int i = 0; i < n; i++){
            if(time[i] <= t){
                answer = Math.min(answer, c[i]);
            }
        }
        if(answer != 1001){
            System.out.println(answer);
        }else{
            System.out.println("TLE");
        }
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
int main(void)
{
   int A,B,C,D;

  scanf("%d%d%d%d", &A, &B, &C, &D);

    int L = A+B;
    int R = C+D;

if(L > R){
   printf("Left\n");
}
if(L == R){
    printf("Balanced\n");
}
if(L < R){
    printf("Right\n");
}

return 0;
}


Measured memory_bytes: 128
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools, copy
from math import *
from bisect import *
from heapq import *
from collections import *


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

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N = In.int()
A = In.ints()
drueb = [defaultdict(int) for i in range(N)]

for i in range(N):
    # if i>=1:
    #     drueb[i] = copy.copy(drueb[i-1])
    val = i+1
    drueb[-1][A[i]-val] += 1

ans=0
for i in range(N):
    j = i+A[i]+1

    if j<len(drueb):
        if -A[i]-(i+1) in drueb[-1]:
            ans+=drueb[-1][-A[i]-(i+1)]
    
Out.int(ans)
        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

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

namespace AOJ
{
	class Program
	{
		public static void Main(string[] args)
		{
			int pass = 0;
			var s = "";
			while((s = Console.ReadLine()) != null)
			{
				var arr = s.ToCharArray();
				for(var i = 0; i < s.Count(); i++)
				{
					if(isNumber(arr[i]))
					{
						var c = new System.Collections.Generic.List<char>();
						while(i < s.Count() && isNumber(arr[i]))
						{
							c.Add(arr[i]);
							i++;
						}
						pass += int.Parse(new string(c.ToArray()));
					}
				}
			}
			Console.WriteLine(pass);
		}
		
		static bool isNumber(char c)
		{
			return c >= '0' && c <= '9';
		}
	}
}

Measured memory_bytes: 5840
#include<cstdio>

using namespace std;

int main() {
    int A, B, C;
    scanf("%d%d%d", &A, &B, &C);

    int max = A;
    if(max < B) max = B;
    if(max < C) max = C;
    int sum = A + B + C;
    if(sum % 2 != max % 2) {
        ++max;
    }
    printf("%d\n", ((max * 3) - sum)/2);
    return 0;
}


Measured memory_bytes: 1736
#pragma region template
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define vint vector<int>
#define vll vector<ll>
#define vstr vector<string>
#define vbl vector<bool>
#define pb push_back
using namespace std;
using ll = long long;

static inline void ignore_ret(int x) {x++;}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> inline T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> inline T sum(vector<T>v){return reduce(all(v),0LL);}
#pragma endregion template

void solve(ll N, ll A, ll B) {
  ll cnt = 0;
  rep2(i, 1, N) {
    ll sum_digits = 0;
    for (char x: to_string(i)) sum_digits += x - '0';
    if (A <= sum_digits && sum_digits <= B) cnt += i;
  }
  cout << cnt << endl;
}

int main() {
  ll N;
  ignore_ret(scanf("%lld",&N));
  ll A;
  ignore_ret(scanf("%lld",&A));
  ll B;
  ignore_ret(scanf("%lld",&B));
  solve(N, A, B);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
 
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;
 int main() {
   int N;
   cin >> N;
   vector<string> gacha(N);
   for (int i = 0; i < N; i++) {
     cin >> gacha.at(i);
   }
   int cnt = 0;
   sort(gacha.begin(),gacha.end());
   for (int i = 0; i + 1 < N; i++){
     
     if(gacha.at(i) != gacha.at(i+1) ){
       cnt++;
     }
   }
   cout << cnt + 1 << endl;
 }

Measured memory_bytes: 9580
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 104 A "Rated for Me"
 *   https://abc104.contest.atcoder.jp/tasks/abc104_a/
 */
public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	}

	static class Task {

		public void run(InputScanner in, PrintWriter out) {

			int R = in.nextInt();

			String ans = "";
			if (R < 1200) {
				ans = "ABC";
			} else if (R < 2800) {
				ans = "ARC";
			} else {
				ans = "AGC";
			}

			out.println(ans);
		}
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

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

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

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

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

}


Measured memory_bytes: 21972
/**************************************************
 *
 *
 *
 *
 *
 **************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void swapNode(int H[], int i, int j){
  int tmp=H[i];
  H[i]=H[j];
  H[j]=tmp;
}
void maxHeapify(int H[], int size, int node){
  int left=2*node, right=2*node+1;
  int largest;  
  if((left<=size)&&(H[left]>H[node]))
	largest=left;
  else 
	largest=node;
  if((right<=size)&&(H[right]>H[largest]))
	largest=right;
  if(largest!=node){
	swapNode(H, largest, node);
	maxHeapify(H, size, largest);
  }
}
void buildMaxheap(int H[], int size){
  int i;
  for(i=size/2; i>0; --i){
	maxHeapify(H, size, i);
  }
}
void increseKey(int Q[], int size, int x, int key){
  if(Q[x]>key)
	return;
  else{
	Q[x]=key;
	while((x>1)&&(Q[x/2]<Q[x])){
	  swapNode(Q, x, x/2);
	  x=x/2;
	}
  }
}
void insert(int Q[], int *size, int key){
  ++(*size);
  Q[*size]=-1;
  increseKey(Q, *size, *size, key);
}
int extractMax(int Q[], int *size){
  int max=Q[1];
  swapNode(Q, 1, *size);
  --(*size);
  maxHeapify(Q, *size, 1);
  return max;
}
void print(int Q[], int size){
  int i;
  printf("queue: ");
  for(i=1; i<=size; ++i){
	printf("%d ", Q[i]);
  }
  
  printf("\n");
  printf("size: %d\n", size);
}
int main(){
  char line[100];
  int key;
  char *str_ptr;
  int priorityQueue[2000005];
   int queueSize=0;
   int max;
   while(1){
	fgets(line, sizeof(line), stdin);
	if(	line[strlen(line)-1]=='\n')
	  line[strlen(line)-1]='\0';
	str_ptr=strtok(line, " ");
	if(strcmp(str_ptr, "end")==0)
	  break;
	if(strcmp(str_ptr, "extract")==0){
	  max=extractMax(priorityQueue, &queueSize);
	  printf("%d\n", max);
	}
	if(strcmp(str_ptr, "insert")==0){
	  str_ptr=strtok(NULL, " ");
	  sscanf(str_ptr, "%d", &key);
	  insert(priorityQueue, &queueSize, key);
	}
	if(strcmp(str_ptr, "print")==0)
	  print(priorityQueue, queueSize);
  }
  return 0;
}



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

int main() {
  int n; cin >> n;
  for(int i = 1; i <=n;i++){
    int x = floor(i*1.08);
    if(x == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  int N;
  cin>>N;
  vector<char> cha;
  string S[N];
  for(int i=0;i<N;i++){
    cin>>S[i];
    sort(S[i].begin(),S[i].end());
  }
  sort(S,S+N);
  for(int i=0;i<S[0].size();i++){
    int cnt=0;
    for(int j=1;j<N;j++){
      for(int k=0;k<S[j].size();k++){
        if(S[j][k]==S[0][i]){
          S[j][k]='0';
          cnt++;
          break;
        }
      }
    }
    if(cnt==N-1) cha.push_back(S[0][i]);
  }
  sort(cha.begin(),cha.end());
  if(cha.size()==0){
    cout<<""<<endl;
    return 0;
  }
  for(int i=0;i<cha.size();i++) cout<<cha[i];
  cout<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NABC = Sarray();
            var N = NABC[0];
            var A = NABC[1];
            var B = NABC[2];
            var C = NABC[3];
            var li = new long[N];
            for (var i = 0; i < N; ++i)
                li[i] = Sarray()[0];
            var lst = 1 << (2 * (int)N);
            var ans = long.MaxValue;
            for (var s = 0; s < lst; ++s)
            {
                var t = s;
                var abc = new long[4];
                var abcNum = new long[4];
                for (var i = 0; i < N; ++i)
                {
                    abc[t % 4] += li[i];
                    ++abcNum[t % 4];
                    t >>= 2;
                }
                var abcs = abc.Skip(1).ToArray();
                var abcNums = abcNum.Skip(1).ToArray();
                if (0 != abcs.Count(a => a == 0)) continue;
                var mp = Abs(abcs[0] - A) + Abs(abcs[1] - B) + Abs(abcs[2] - C) + (abcNums.Sum() - 3) * 10;
                ans = Min(ans, mp);
            }
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

#define ALL(a) a.begin(),a.end()

// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}

vector<int> edges[2 * 100000 + 5];
int value[2 * 100000 + 5];
int tmp[2 * 100000 + 5];

void dfs(int n, int sum, int from){
  value[n] = sum + tmp[n];
  for(int i : edges[n]){
    if(i != from){
      dfs(i, value[n], n);
    }
  }
}

void solve(){
  int n, q;
  cin >> n >> q;
  rep(i, n-1){
    int a, b;
    cin >> a >> b;
    a--;b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }

  rep(i, q){
    int p, x;
    cin >> p >> x;
    p--;
    tmp[p] += x;
  }

  dfs(0, 0, -1);

  rep(i, n){
    cout << value[i];
    if(i != n-1)
      cout << " ";
  }
  cout << endl;
}

int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 24064
N, X, Y = map(int, input().split())
graph = [[i + 1] for i in range(N - 1)]
graph.append([])
for i in range(1, N):
    graph[i].append(i-1)
graph[X-1].append(Y-1)
graph[Y-1].append(X-1)

# print(graph)
from collections import deque
def bfs_graph(G, start):
    # 隣接リストを食わせる
    dist = [-1] * N
    que = deque([start])
    dist[start] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w in G[v]:
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            que.append(w)
    return dist

ans = [0] * (N - 1)
for s in range(N - 1):
    res = bfs_graph(graph, s)
    # print(res)
    for val in res[s+1:]:
        if val >= 1:
            ans[val-1] += 1
print(*ans, sep="\n")


Measured memory_bytes: 4312
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

typedef double ld;
typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int main(){ _

	int a,b,c,d;
	cin >> a >> b >> c >> d;

	cout << max(a*b,c*d) << endl;

	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;


int main(){
    int N;
    cin >> N;
    vector<long long> a(N);
    long long x=0,y=0,ans=1e12+1;
    for (int i=0; i<N; ++i) {
        cin >> a[i];
        x+=a[i];
    }
    for (int i=0; i<N; ++i) {
        y+=a[i];
        if (i+1<N) ans=min(ans,abs(x-y*2));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

const ll INF = 1LL << 60;

int main(){
  ll n; cin >> n;
  vi a(n); rep(i, n) cin >> a[i];
  sort(all(a));
  a.erase(unique(all(a)), a.end());
  //rep(i, n) std::cout << a[i] << " ";
  int ans = a.size();
  if(ans%2 != n%2) ans--;

  std::cout << ans << '\n';
}


Measured memory_bytes: 640
#include <cassert>
#include <algorithm>
#include <map>
#include <vector>
#include <iostream>
using namespace std;

long long subtreeCount[100100];
long long revtreeCount[100100];
vector<long long> prodL[100100], prodR[100100];
vector<int> adj[100100];
int n, m, parent[100100];

void calcSTC(int v, int p) {
    long long ans = 1;
    parent[v] = p;
    for (int u : adj[v])
        if (u != p) { calcSTC(u, v); ans = ans * (1 + subtreeCount[u]) % m; }
    subtreeCount[v] = ans;
}

void calcRTC(int v, int p) {
    long long ans = 1;
    if (p != -1) {
        auto it = lower_bound(adj[p].begin(), adj[p].end(), v);
        assert (it != adj[p].end());
        assert (*it == v);
        int j = it - adj[p].begin();
        ans = ans * prodL[p][j] % m * prodR[p][j] % m;
        ans = ans * revtreeCount[p] % m;
        ans++;
    }
    revtreeCount[v] = ans;
    for (int u : adj[v]) if (u != p) calcRTC(u, v);
}

int main() {
    cin >> n >> m;
    for (int i = 1; i < n; i++) {
        int x, y; cin >> x >> y;
        x--; y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    for (int i = 0; i < n; i++) sort(adj[i].begin(), adj[i].end());

    calcSTC(0, -1);
    for (int i = 0; i < n; i++) {
        int sz = adj[i].size();
        prodL[i].resize(sz); prodR[i].resize(sz);
        long long acc = 1;
        for (int j = 0; j < sz; j++) {
            prodL[i][j] = acc;
            if (adj[i][j] != parent[i])
                acc = acc * (1 + subtreeCount[adj[i][j]]) % m;
        }
        acc = 1;
        for (int j = sz-1; j >= 0; j--) {
            prodR[i][j] = acc;
            if (adj[i][j] != parent[i])
                acc = acc * (1 + subtreeCount[adj[i][j]]) % m;
        }
        // for (int j = 0; j < sz; j++) cerr << i << ' ' << j << ' ' << prodL[i][j] << ' ' << prodR[i][j] << endl;
    }

    calcRTC(0, -1);
    // for (int i = 0; i < n; i++) cerr << i << " " << revtreeCount[i] << endl;
    for (int i = 0; i < n; i++) {
        cout << subtreeCount[i] * revtreeCount[i] % m << endl;
    }
}


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

int main(){
    int a, b;
    cin >> a >> b;
    if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0)cout << "Possible";
    else cout << "Impossible";
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
void solve(long long N){
  while(N){
    ll i=1;
    while((i*(2+(i-1))/2) < N)i++;
    cout << i << endl;N-=i;
  }
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int min(int x, int y) {
	if (x < y) {
		return x;
	}
	else {
		return y;
	}
}

int main() {
	int a, b, c, d;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cout << min(a, b) + min(c, d);
}

Measured memory_bytes: 256
r, c = map(int, input().split())
 
mat = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    mat[i] = list(map(int, input().split()))
 
for i in range(r):
    s = sum(mat[i])
    mat[i].append(s)
 
for j in range(c):
    s = 0
    for i in range(r):
        s += mat[i][j]
    mat[r][j] = s
 
mat[r][c] = (sum(mat[r]))
 
for i in range(r+1):
    for j in range(c+1):
        if j == c:
            print(str(mat[i][j]))
        else:
            print(str(mat[i][j]) + " ", end="")


Measured memory_bytes: 6216
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    ll n, k, q;
    cin >> n >> k >> q;
    ll neg_score[n] = {};
    for(int i=0;i<n;++i)
    {
        neg_score[i] = q;
    }

    for(int i=0;i<q;++i)
    {
        int tmp;
        cin >> tmp;
        neg_score[tmp-1]--;
    }

    for(int i=0;i<n;++i)
    {
        cout << (k - neg_score[i] > 0 ? "Yes" : "No") << endl;
    }

}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main(){
	ll N,K,ans=0;cin >> N >> K;
	vector<ll> A(N);
	rep(i,N)cin>>A[i];
	if(N <= K){
		cout << 0 << endl;
		return 0;
	}
	sort(A.begin(), A.end());

	rep(i,K)A.pop_back();
	rep(i,N-K)ans += A[i];

	cout << ans << endl;

}


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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int x = 0, ans = 0;
    for(char c: s){
        if(c == 'I')x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    N,K=map(int,input().split())
    h=list(map(int,input().split()))
    ans=[0]*N
    for i in range(1,N):
        ans[i]= min(abs(h[i]-h[j])+ans[j] for j in range(max(0,i-K),i))
    print(ans[-1])
main()

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

const int INF = 1001001001;

int main(){
	int n, m, k;cin >> n >> m >> k;
	vector<vector<int>> fri(n), blo(n);
	vector<int> g(n,0);
	int a, b;
	//cout << "a";
	rep(i,m){
		cin >> a;
		cin >> b;

		fri[a-1].push_back(b-1);
		fri[b-1].push_back(a-1);
	}
	int c, d;
	//cout <<"b";
	rep(i,k){
		cin >> c;
		cin >> d;

		blo[c-1].push_back(d-1);
		blo[d-1].push_back(c-1);
	}
	queue<int> q;

	vector<int> num(n, 0);
	int g_num=0;

	//cout << "initialized" << endl;
	rep(i,n){
		if(g[i] == 0){
			q.push(i);
			++g_num;
			g[i] = g_num;
			++num[g_num-1];
			while(!q.empty()){
				int node = q.front();q.pop();
				//cout << g_num << num[g_num-1] << endl;
				for(auto ite: fri[node]){
					if(g[ite] == 0){
						g[ite] = g_num;
						++num[g_num - 1];
						q.push(ite);
					}
				}
			}
		}
	}
	//cout << "cal_total" << endl;

	int ans;
	rep(i,n){
		ans = num[g[i] - 1];
		//cout << "g[" << i << "]" << g[i] << endl;
		//cout << "num[" << i << "]" << num[g[i]-1] << endl;
		ans -= fri[i].size();
		for(auto ite:blo[i]){
			if(g[i] == g[ite]) --ans;
		}
		--ans;
		cout << ans << " ";
	}
	cout << endl;

	return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int cnt=0;
    bool flag=true;
    int i=0;
    int j=1;
    while(i<n){
        while(i<n){
            if(a[i]!=j) cnt++;
            else{
                i++;
                break;
            }
            i++;
        }
        j++;
    }
    if(cnt!=n) cout<<cnt<<"\n";
    else cout<<-1<<"\n";
    return 0;
}

Measured memory_bytes: 4032
N, x = map(int, input().split())
aList = [int(x) for x in input().split()]
aList.sort()

score = 0
for a in aList:
    if x >= a:
        x -= a
        score += 1
    else:
        break

if x > 0:
    if score == len(aList):
        score -= 1
print(score)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <atcoder/maxflow>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<string> S(n);
    for (auto &s: S) cin >> s;

    atcoder::mf_graph<int> flow(n * m + 2);
    const int s = n * m, t = n * m + 1;
    array<int, 4> dh = {0, 0, 1, -1}, dw = {1, -1, 0, 0};
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            if (((i ^ j) & 1) == 1){
                flow.add_edge(i * m + j, t, 1);
                continue;
            }
            flow.add_edge(s, i * m + j, 1);
            if (S[i][j] == '#')
                continue;
            for (int k = 0; k < 4; k++){
                auto ni = i + dh[k];
                auto nj = j + dw[k];
                if (ni < 0 or ni >= n or nj < 0 or nj >= m)
                    continue;
                if (S[ni][nj] == '#')
                    continue;
                flow.add_edge(i * m + j, ni * m + nj, 1);
            }
        }
    }

    cout << flow.flow(s, t) << endl;
    for (const auto &[from, to, cap, f]: flow.edges()){
        if (f == 0)
            continue;
        if (from == s or to == s or from == t or to == t)
            continue;
        int i = from / m, j = from % m;
        int k = to / m, l = to % m;

        if (i == k){
            if (j > l)
                swap(j, l);
            S[i][j] = '>';
            S[k][l] = '<';
        } else {
            if (i > k)
                swap(i, k);
            S[i][j] = 'v';
            S[k][l] = '^';
        }
    }

    copy(S.begin(), S.end(), ostream_iterator<string>(cout, "\n"));
}

Measured memory_bytes: 5408
import java.util.*;

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


    for(int i = 0 ; i < S.length() ; i++){
      if( S.charAt(i) == 'o' ){
        result = result + 100 ;
      }
    }
    System.out.println(result);
  }
}


Measured memory_bytes: 21844
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e8)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
const int MAXN = 1e6;
vii adj(MAXN);
vector<bool>vis(MAXN);
void dfs(int v){
	vis[v] = 1;
	for(int x:adj[v]){
		if(!vis[x]){
			dfs(x);
		}
	}
}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int v,u;
		cin>>v>>u;
		v--;u--;
		adj[v].pb(u);
		adj[u].pb(v);
	}
	int cnt = 0;
	for(int i=0;i<n;i++){
		if(!vis[i]){
			dfs(i);
			cnt++;
		}
	}
	cout<<cnt-1;
}



Measured memory_bytes: 30452
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;
int main()
{
	static int n,a,b,k[101],u;
	cin>>n>>a>>b;
	k[a]=1;
	k[b]=2;
	k[0]=3;
	k[n+1]=3;
	while(1)
	{
		if(k[a-1]==3&&k[a+1]==2||k[a-1]==2&&k[a+1]==3)
		{
			cout<<"Borys"<<endl;
			break;
		}
		if(a<b)
		{
			if(k[a+1]==0)
			{
				k[a+1]=1;
				k[a]=0;
				a=a+1;
			}
			else
			{
				k[a-1]=1;
				k[a]=0;
				a=a-1;
			}
		}
		else
		{
			if(k[a-1]==0)
			{
				k[a-1]=1;
				k[a]=0;
				a=a-1;
			}
			else
			{
				k[a+1]=1;
				k[a]=0;
				a=a+1;
			}
		}
		if(k[b-1]==3&&k[b+1]==1||k[b-1]==1&&k[b+1]==3)
		{
			cout<<"Alice"<<endl;
			break;
		}
		if(a>b)
		{
			if(k[b+1]==0)
			{
				k[b+1]=2;
				k[b]=0;
				b=b+1;
			}
			else
			{
				k[b-1]=2;
				k[b]=0;
				b=b-1;
			}
		}
		else
		{
			if(k[b-1]==0)
			{
				k[b-1]=2;
				k[b]=0;
				b=b-1;
			}
			else
			{
				k[b+1]=2;
				k[b]=0;
				b=b+1;
			}
		}		
	}		
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,c,n=0;
    cin>>a>>b>>c;
    for(int i=a;i<=b;i++){
        if(i>c)break;
        if(c%i==0)n++;
    }
    cout<<n<<endl;
    return 0;
}


Measured memory_bytes: 3104
goal = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
readlines.each{|line|
  arr = line.chomp.split("")
  flag = "d"
  goal.each{|i,j,k|
    if arr[i] != "s" && arr[i] == arr[j] && arr[j] == arr[k]
      flag = arr[i]
      break
    end
  }
  puts flag
}

Measured memory_bytes: 8632
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    List<Integer> list = new ArrayList<>();

    if(s.equals("SUN")){
        System.out.println(7);
    }else if(s.equals("MON")){
        System.out.println(6);
    }else if(s.equals("TUE")){
        System.out.println(5);
    }else if(s.equals("WED")){
        System.out.println(4);
    }else if(s.equals("THU")){
        System.out.println(3);
    }else if(s.equals("FRI")){
        System.out.println(2);
    }else{
        System.out.println(1);
    }
    
    



    





}
}

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

int main(){
  int N,M;
  cin >> N >> M;
  
  vector<int> s(M);
  vector<char> c(M);
  for(int i=0;i<M;i++){
    cin >> s.at(i) >> c.at(i);
  }
  
  char tmp[1000];  
  int i_min = pow(10,N-1);
  int i_max = pow(10,N);
  if(i_min == 1 ){
    i_min = 0;
  }
  for(int i=i_min;i<i_max;i++){
    bool ok = true;
    sprintf(tmp,"%d",i);
    for(int j=0;j<M;j++){
   //   printf("%c %c\n",tmp[s[j]-1],c[j]);
      if(tmp[s[j]-1]!=c[j]){
        ok = false;
      }
    }
    if(ok == true){
      printf("%d\n", i);
      return 0;
    }
  }  
  printf("%d\n", -1);
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

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

//loops
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(int i=(ll)(n)-1;i>=0;i--)
#define OneToN(i,n) for(int i=1;i<(ll)(n+1);i++)
#define ZeroToN(i,n) for(int i=0;i<(ll)(n+1);i++)
#define AToB(i,a,b) for(int i=a;i<(ll)(b+1);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

//bitsearch
#define BITSEARCH(bit, n) for (int bit = 0; bit < (1<<n); ++bit)
#define isOne(bit, i) bit & (1<<i)


//arrays
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define add push_back


#define remove_unique(v) v.erase(unique(ALL(v)), v.end())

//pair
#define fir first
#define sec second

//types
#define ll long long
#define vec vector
#define cord2d pair<int,int>
//UNCOMMENT WHEN NEEDED
//#define int ll

//input
template <class T> T get(){ T s; cin >> s; return(s);}
#define gi get<int>()
#define gs get<string>()

template <class T> vector<T> getv(int n) { vec<T> v(n); REP(i, n) cin >> v[i]; return v; }
#define gim(n) getv<int>(n)
#define gsm(n) getv<string>(n)

//output
void print(int a){ cout << a << endl; }
void print(long long a){ cout << a << endl; }
void print(string a){ cout << a << endl; }
void print(char a){ cout << a << endl; }
void print(double a){ cout << a << endl; }
void print(double a, int dig){ cout << std::setprecision(dig) << a << endl; }

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T = int>
void print(vec<T> v){ cout << v << endl; }

template <class T = int>
void print2dVec(vec<vec<T>> v2d){for(vec<T> v: v2d) {print(v);}}

void YesNo1(bool i = true){ return print(i?"Yes":"No"); }
void YESNO2(bool i = true){ return print(i?"YES":"NO"); }

//debug output
#define var_name(var) #var
template <class T> void debug(T &var, int nest = 0, string before = "") { cout << string("          ", nest) << before; print(var); }

//name replacement
#define y0 y0__
#define y1 y1__
#define j0 j0__
#define j1 j1__

//bool lambdas
#define lamb(exp) [](auto i){return exp;}
#define isEven [](int i){return i % 2 == 0;}
#define isOdd [](int i){return i % 2 != 0;}

//constants
const ll INF = 1e18;
const int MOD = 10000007;

//maths
int factorial(int k){ int sum = 1; for (int i = 1; i <= k; ++i) { sum *= i; } return sum; }
int gcd(int a, int b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

////////////////////

void Main() {
    //code here
    int n = gi;
    vec<int> fib = {};
    REP(i, n+1) {
        if (i == 0 || i == 1) {
            fib.add(1);
        } else {
            fib.add(fib[i-1] + fib[i-2]);
        }
    }
    print(fib[n]);
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Main();
}



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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    char c;
    cin >> c;
    if(isupper(c))cout << 'A' << endl;
    else cout << 'a' << endl;


    return 0;
}


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

typedef long long ll;

ll md = 1000000007;

vector<ll> a;

int main(int, char**) 
{
	ll n, ans = 0;
	std::cin >> n;
	a.resize(n);
	for(int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i < n - 1; i++)
		for (int j = i + 1; j < n; j++)
			ans += a[i] * a[j];
	cout << ans << endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
using ll = long long;
using namespace std;

int main() {
	int n, m,k,a;
	cin >> n >> m;
	map<int, int>mp;
	rep(i, n) {
		cin >> k;
		rep(j, k) {
			cin >> a;
			mp[a]++;
		}
	}
	int cnt = 0;
	for (auto itr : mp) {
		if (itr.second == n)cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, int>;
int x,y,a,b,c;
priority_queue< ii > pq;
int main() {
    scanf("%d %d %d %d %d", &x, &y, &a, &b, &c);
    int d;
    for(int i = 0; i < a; ++i) {
        scanf("%d", &d); pq.emplace(d, 1);
    }
    for(int i = 0; i < b; ++i) {
        scanf("%d", &d); pq.emplace(d, 2);
    }
    for(int i = 0; i < c; ++i) {
        scanf("%d", &d); pq.emplace(d, 0);
    }
    ll ans = 0;
    int cont_x = 0, cont_y = 0, cont_z = 0;
    while(cont_x + cont_y + cont_z < x + y) {
        auto cur = pq.top(); pq.pop();
        if(cur.second == 1) {
            if(cont_x < x) cont_x++, ans += cur.first;
        } else if(cur.second == 2) {
            if(cont_y < y) cont_y++, ans += cur.first;
        } else cont_z++, ans += cur.first;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 10476
import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		TreeMap<Integer, Integer> map1=new TreeMap<Integer, Integer>();
		TreeMap<Integer, Integer> map2=new TreeMap<Integer, Integer>();
		for(;;){
			String s=sc.nextLine();
			if(s.equals(""))
				break;
			String[] ss=s.split(",");
			int id=Integer.parseInt(ss[0]);
			if(!map1.containsKey(id))
				map1.put(id, 0);
			map1.put(id, map1.get(id)+1);
		}

		for(; sc.hasNext();){
//		for(int i=0;i<3 ;i++){
			String[] ss=sc.nextLine().split(",");
			int id=Integer.parseInt(ss[0]);
			if(!map2.containsKey(id))
				map2.put(id, 0);
			map2.put(id, map2.get(id)+1);
		}

		for(Entry<Integer, Integer> entry : map1.entrySet()){
			int id=entry.getKey();
			if(map2.containsKey(id)){
				println(id+" "+(entry.getValue()+map2.get(id)));
			}
		}

		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000