akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()
S = input()

num_r = S.count('R')
ans = num_r

for i in range(num_r):
    if S[i] == 'R':
        ans -= 1

print(ans)


Measured memory_bytes: 9504
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=1_000_000_007
n,k = gets.chomp.split.map(&:to_i)

def solve(n)
  n * (n+1) / 2
end

ans = 1
k.upto(n) do |i|
  ans += solve(n) - solve(n - i) - solve(i-1) + 1
  ans %= MOD #=
end

puts (ans+MOD) % MOD

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

int a[100009];
int main()
{
  int H, N, ata = 0;
  cin>>H>>N;
  
  for (int i = 0; i<N; i++){
  	cin>>a[i];
  }
  
  for(int i = 0; i<N; i++){
  	ata += a[i];
  }
  
  if(ata >= H){
  	cout<<"Yes"<<endl;
  }
  else{
  	cout<<"No"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 640
from collections import Counter

def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans

N=int(input())
A=list(map(int,input().split()))
C=Counter()
C.update(A)
ans=0
L=[0]*N
for i in range(N):
    L[A[i]-1]+=1
Most=C.most_common()
#print(Most)
for i in range(len(C)):
    ans+=Comb(Most[i][1],2)
for i in range(N):
    pri=ans
    pri=ans-L[A[i]-1]+1
    print(pri)

Measured memory_bytes: 30916
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define set setprecision　//小数点以下何位まで知りたいか
#define mod 1000000007
#define pi 3.14159265
#include<numeric>
using namespace std;
int gcd(int a, int b)//最大公約数
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
int lcm(int a, int b)//最小公倍数
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if ((a == b) && (a == c)&&(a%2==0))cout << "-1" << endl;
	else {
		int i = 0;
		int d, e, f;
		while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
			d = a;
			e = b;
			f = c;
			a = (e + f) / 2;
			b = (d + f) / 2;
			c = (d + e) / 2;
			i++;
		}
		cout << i << endl;
	}
}


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

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;


signed main(){
    int a, b, c;
    cin >> a >> b >> c;
    vector<vector<vector<int>>> dp(310, vector<vector<int>>(310, vector<int>(310, MOD)));
    dp[a][b][c] = 0;
    for(int i = 0; i < 300; ++i){
        for(int j = 0; j < 300; ++j)
            for(int k = 0; k < 300; ++k){
                a = i, b = j, c = k;
                dp[a + 1][b + 1][c] = min(dp[a + 1][b + 1][c], dp[a][b][c] + 1);
                dp[a + 1][b][c + 1] = min(dp[a + 1][b][c + 1], dp[a][b][c] + 1);
                dp[a][b + 1][c + 1] = min(dp[a][b + 1][c + 1], dp[a][b][c] + 1);
                dp[a + 2][b][c] = min(dp[a + 2][b][c], dp[a][b][c] + 1);
                dp[a][b + 2][c] = min(dp[a][b + 2][c], dp[a][b][c] + 1);
                dp[a][b][c + 2] = min(dp[a][b][c + 2], dp[a][b][c] + 1);
            }
    }

    int ans = MOD;
    for(int i = 0; i < 305; ++i)
        ans = min(ans, dp[i][i][i]);
    cout << ans << endl;
}


Measured memory_bytes: 120192
x, y = map(int, input().split())
wins = [300000, 200000, 100000]
ans = 0
if x <= 3:
    ans += wins[x - 1]
if y <= 3:
    ans += wins[y - 1]

if x == 1 and y == 1:
    ans += 400000

print(ans)


Measured memory_bytes: 38256
import sys
input = sys.stdin.readline

#Z[i]:length of the longest list starting from S[i] which is also a prefix of S
def Z_algorithm(s):
    N = len(s)
    Z_alg = [0]*N

    Z_alg[0] = N
    i = 1
    j = 0
    while i < N:
        while i+j < N and s[j] == s[i+j]:
            j += 1
        Z_alg[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < N and k + Z_alg[k]<j:
            Z_alg[i+k] = Z_alg[k]
            k += 1
        i += k
        j -= k
    return Z_alg


def main():
    n = int(input())
    a = tuple(map(int,input().split()))
    b = tuple(map(int,input().split()))


    BAA = []
    for i in range(n-1):
        BAA.append(b[i]^b[i+1])
    BAA.append(b[0]^b[-1])

    BAA.append(-1)

    for i in range(n-1):
        BAA.append(a[i]^a[i+1])
    BAA.append(a[0]^a[-1])
    for i in range(n-1):
        BAA.append(a[i]^a[i+1])
    BAA.append(a[0]^a[-1])

    z = Z_algorithm(BAA)

    for k in range(n):
        if z[n+k+1] >= n:
            print(k,b[0]^a[k])

if __name__ == '__main__':
    main()

Measured memory_bytes: 121680
import java.util.*;

public class Main {

	static public void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = 0;
		N = scan.nextInt();
		int[] A = new int[N];
		int four = 0, two = 0;
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
			if (A[i] % 4 == 0) {
				four++;
			} else if (A[i] % 2 == 0) {
				two++;
			}
		}
		two /= 2;
		if (N / 2 <= four + two) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 50016
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
using i64 = long long;
using namespace std;

const int mod = 998244353;

class ModInt {
public:
  int value;
  ModInt() : value(0) {}
  ModInt(int value) {
    this->value = normalize(value);
  }  
  ModInt operator+(ModInt const &other) {
    return ModInt(normalize(this->value + other.value));
  }
  ModInt& operator+=(const ModInt& other) {
      this->value = normalize(this->value + other.value);
      return *this;
}
  int normalize(i64 value) {
    while (value < 0) value += mod;
    value %= mod;
    return value;
  }
};

ostream& operator<<(ostream& os, ModInt const &m) {
  os << (m.value);
  return os;
}

const int maxn = 3000;
ModInt dp[maxn + 1];
int a[maxn];

int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) 
    cin >> a[i];
  ModInt ans;
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = s; j >= a[i]; j--)
      dp[j] += dp[j - a[i]];
    dp[a[i]] += i;
    ans += dp[s];
  }
  cout << ans << '\n';
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N=int(input())
P=[list(map(int,input().split())) for i in range(N)]
ANS=[1<<60]*(N+1)
ANS[-1]=0

DP1=[20000]*N

S=0
for i in range(N):
    x,y,p=P[i]
    DP1[i]=min(abs(x),abs(y))
    S+=DP1[i]*p

ANS[0]=S

def dfs(DP,now,used):
    if used==N-1:
        return
    for next_town in range(now,N):
        x,y,p=P[next_town]

        DP2=list(DP)
        S=0
        for i in range(N):
            DP2[i]=min(DP2[i],abs(P[i][0]-x))
            S+=DP2[i]*P[i][2]

        #print(DP,now,used,next_town,DP2)
            
        ANS[used+1]=min(ANS[used+1],S)
        if S!=0:
            dfs(DP2,next_town+1,used+1)

        DP2=list(DP)
        S=0
        for i in range(N):
            DP2[i]=min(DP2[i],abs(P[i][1]-y))
            S+=DP2[i]*P[i][2]

        #print(DP,now,used,next_town,DP2)
            
        ANS[used+1]=min(ANS[used+1],S)
        if S!=0:
            dfs(DP2,next_town+1,used+1)

dfs(DP1,0,0)

for i in range(1,N):
    ANS[i]=min(ANS[i],ANS[i-1])

print(*ANS)

Measured memory_bytes: 79556
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
ant = [a,b,c,d,e]
trig=0
for m in range(5):
  for i in range(5):
    if -k <= (ant[m]-ant[i]) and (ant[m]-ant[i]) <=k:
      pass
    else: 
      trig = 1
      break

if trig == 0:
  print('Yay!')
else:
  print(':(')

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

typedef long long ll;

const int pMax = 6000, nMax = 60000;
ll prime[pMax];
bool is_prime[nMax + 10];

void sieve(ll n) {
	int p = 0;
	for (ll i = 0; i <= n; i++) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	for (ll i = 2; i <= n; i++) {
		if (is_prime[i]) {
			prime[p++] = i;
			if (p == pMax) return;
			for (ll j = 2 * i; j <= n; j += i) is_prime[j] = false;
		}
	}
}
int main() {
	sieve(nMax);
	int n;
	while (cin >> n && n) {
		int p = 0, q = pMax - 1;
		while (1) {
			if (prime[p] >= n) break;
			p++;
		}
		while (1) {
			if (prime[q] <= n) break;
			q--;
		}
		cout << prime[p - 1] << " " << prime[q + 1] << endl;
	}
}


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <queue>
#define N 100
using namespace std;
int Change(string);
int Change_2(string);
int Search(string,string,int);
int Check(int,string,int);
int date[N];
string title[N],author[N];
int main(){
  int n,q,begin,end,need_check[4],r,flag,flag2,len,i,j,k;
  string indate,q_title,q_author,q_date_from,q_date_to,out;
  queue<string> Q;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> title[i] >> author[i] >> indate;
    date[i]=Change(indate);
  }
  cin >> q;
  flag2=0;
  for(i=0;i<q;i++){
    cin >> q_title >> q_author >> q_date_from >> q_date_to;
    if(q_date_from!="*") begin=Change(q_date_from);
    if(q_date_to!="*") end=Change(q_date_to);
    for(j=0;j<n;j++){
      for(k=0;k<4;k++) need_check[k]=0;
      if(q_title!="*"){
	need_check[0]=1;
	r=Search(q_title,"title",j);
	if(r==1) need_check[0]=0;
      }
      if(q_author!="*"){
	need_check[1]=1;
	r=Search(q_author,"author",j);
	if(r==1) need_check[1]=0;
      }
      if(q_date_from!="*"){
	need_check[2]=1;
	r=Check(begin,"from",j);
	if(r==1) need_check[2]=0;
      }
      if(q_date_to!="*"){
	need_check[3]=1;
	r=Check(end,"to",j);
	if(r==1) need_check[3]=0;
      }
      flag=0;
      for(k=0;k<4;k++){
	if(need_check[k]==1){
	  flag=1;
	  break;
	}
      }
      if(flag==0){
	Q.push(title[j]);
      }
    }
    len=Q.size();
    for(j=0;j<len;j++){
      out=Q.front();
      Q.pop();
      cout << out << endl;
    }
    if(i!=q-1) cout << endl;
  }
  return 0;
}
int Change(string s){
  int ret;
  string a,b,c,d;
  a=s.substr(0,4);
  b=s.substr(5,2);
  c=s.substr(8,2);
  ret=Change_2(a+b+c);
  return ret;
}
int Change_2(string s){
  int len=s.size(),ret=0,x=10,i=0;
  while(len){
    ret=ret*x+(s[i]-'0');
    i++;
    len--;
  }
  return ret;
}
int Search(string str,string c,int n){
  int flag,len,len2,i;
  string a;
  if(c=="title") len=title[n].size();
  else len=author[n].size();
  len2=str.size();
  flag=0;
  for(i=0;i<=len-len2;i++){
    if(c=="title") a=title[n].substr(i,len2);
    else a=author[n].substr(i,len2);
    if(a==str){
      flag=1;
      break;
    }
  }
  if(flag==1) return 1;
  return 0;
}
int Check(int y,string c,int n){
  if(c=="from"){
    if(y<=date[n]) return 1;
  }else{
    if(y>=date[n]) return 1;
  }
  return 0;
}

Measured memory_bytes: 1252
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>

template <class Integer>
auto boost_irange(Integer last) { return boost::irange(static_cast<Integer>(0), last); }
template <class Integer>
auto boost_irange(Integer first, Integer last) { return boost::irange(first, last); }

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { cout << '\n'; }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy operator<<(T&& val)
    {
        cout << val;
        return {};
    }
};

int main()
{
    input in;
    output out;

    int n, a, b;
    in >> n, a, b;

    out << std::min(n * a, b);

    return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
N=int(input())
A=[]
L=[[]for i in range(N+1)]
for i in range(N-1):
    a,b=map(int,input().split())
    L[a].append(b)
    L[b].append(a)
    A.append((a,b))

P=[-1 for i in range(N+1)]
P[1]=0
Q=[]
for i in L[1]:
    Q.append([i,1])

for i in range(N):
    if len(Q)==i:
        break
    P[Q[i][0]]=Q[i][1]
    for j in L[Q[i][0]]:
        if P[j]==-1:
            Q.append([j,Q[i][0]])
#print(P)
#print(Q)
D={}
D[(0,1)]=0
cnt=1
p=0
for i in range(N-1):
    if p!=Q[i][1]:
        p=Q[i][1]
        cnt=1
        for j in range(cnt,10**6):
            if D[(min(Q[i][1],P[Q[i][1]]),max(Q[i][1],P[Q[i][1]]))] != j:
                D[(min(Q[i]),max(Q[i]))] = j
                cnt = j+1
                break
    else:
        for j in range(cnt,10**6):
            if D[(min(Q[i][1],P[Q[i][1]]),max(Q[i][1],P[Q[i][1]]))] != j:
                D[(min(Q[i]),max(Q[i]))] = j
                cnt = j+1
                break
print(max(D.values()))
for i in range(N-1):
    print(D[A[i][0],A[i][1]])

Measured memory_bytes: 96800
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

int dy[5] = {-1, 0, 1, 0, 0};
int dx[5] = {0, -1, 0, 1, 0};

int main(void) {
    string s;
    int now = 0;
    int count[26] = {};
    cin >> s;
    for (int i = 0; i <= 3; i++) {
        count[s[i] - 'A']++;
    }

    for (int i = 0; i <= 25; i++) {
        if (count[i] == 2) {
            now++;
        }
    }

    if (now == 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  if( x + r > W){printf("No\n");}
  else if( x - r < 0 ){printf("No\n");}
  else if( y + r > H ){printf("No\n");}
  else if( y - r < 0 ){printf("No\n");}
  else {printf("Yes\n");}

  return 0;
}

Measured memory_bytes: 584
Node = Struct.new(:id, :c, :parent, :depth, :type)

nodes = $<.gets.to_i.times.map do
  id, k, *c = $<.gets.split.map(&:to_i)
  Node.new(id, c)
end.sort_by(&:id)

h = nodes.map {|n| [n.id, n]}.to_h
nodes.each {|n| n.c.each {|c| h[c].parent = n.id} }

root = nodes.find {|n| !n.parent}
root.parent = -1

search = ->(node, depth) {
  node.depth = depth
  if node.c.empty?
    node.type = "leaf"
  else
    node.type = "internal node"
    node.c.each {|c| search.(h[c], depth + 1)}
  end
}
search.(root, 0)
root.type = "root"

puts nodes.map {|n| "node #{n.id}: parent = #{n.parent}, depth = #{n.depth}, #{n.type}, #{n.c}"}


Measured memory_bytes: 53992
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#define F(i,x,y) for(int i=x;i<=y;++i)
using namespace std;
map<string,int>m;
int n,maxx;
char s[15];
int main(){
	scanf("%d",&n);
	F(i,1,n){
		scanf("%s",s);
		++m[string(s)];
	}
	for(map<string,int>::iterator it=m.begin();it!=m.end();++it){
		maxx=max(maxx,it->second);
	}
	vector<string>v;
	for(map<string,int>::iterator it=m.begin();it!=m.end();++it){
		if(it->second==maxx)v.push_back(it->first);
	}
	sort(v.begin(),v.end());
	F(i,1,(int)v.size())printf("%s\n",v[i-1].c_str());
	return 0;
}


Measured memory_bytes: 25584
n = gets.to_i
ary = gets.split(' ').map(&:to_i)
pre = 0
ary.each_with_index do |num,i|
  if pre > num
    puts 'No'
    exit
  end
  if ary[i]-1 >= pre
    ary[i] = ary[i]-1
  end
  pre = ary[i]
end
puts 'Yes'

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

int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  int cmp_minimum = 1e8;
  int sum = 0;
  rep(i, n) {
    cin >> w[i];
    sum += w[i];
  }
  int s1 = 0;
  int s2 = sum;
  rep(i, n-1) {
    s1 += w[i];
    s2 -= w[i];
    cmp_minimum = min(abs(s2-s1), cmp_minimum);
  }
  
  cout << cmp_minimum << endl;
  return 0;
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int n,k,t,u,v,L;
    scanf(" %d %d %d %d %d %d", &n, &k, &t, &u, &v, &L);
    vector<int> d(n);
    rep(i,n) scanf(" %d", &d[i]);

    int idx=0;
    int st=-1;
    int stock=0;
    double ans=0;

    bool boost=false;

    rep(i,L)
    {
        if(idx<n && d[idx]==i)
        {
            if(stock<k) ++stock;
            else st=i;

            ++idx;
        }

        if(st+t*v==i)
        {
            st=false;
            boost=false;
        }

        if(!boost && stock>0)
        {
            boost=true;
            --stock;
            st=i;
        }

        if(boost) ans+=1.0/v;
        else ans+=1.0/u;
    }

    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 3232
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void A_task();

int main()
{
	A_task();
	fflush(stdout);
	return 0;
}

static void A_task()
{
	char c;
	c = getchar();
	printf("%c\n", c + 1);
}


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

namespace ABC140_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var B = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var C = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var ans = 0;
            var last = -1;
            for (int i = 0; i < N; i++)
            {
                ans += B[A[i] - 1];
                if (A[i] - last == 1)
                {
                    ans += C[A[i] - 2];
                }

                last = A[i];
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <string>
#include <string.h>
#include <strings.h>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a,s;
    cin>>a>>s;
    if(a>s){
        cout<<a-s;
    }
    else{
        cout<<0;
    }

    return 0;
}


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

typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

int cnt = 1;
int mp[100][100];
int did[100] = {0};
void fin(int x,int n){
    for(int i = 1;i<=n ;i++){
        if(mp[x][i] == 1 && did[i] == 0){
            cnt++;
            did[i] = 1;
            fin(i,n);
        } 
    }
}

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

    
    REP(i,n+1) REP(j,n+1) mp[i][j] = 0;

    int ans = 0;

    vector<pair<int,int>> s(m+1);
    for(int i = 1; i<=m ;i++){
        int a,b;
        cin >> a >> b;
        s[i] = MP(a,b);
        mp[b][a] = 1;
        mp[a][b] = 1;
      //cerr << s[i].fi << " " << s[i].se << endl;
    }

    for(int i = 1; i<=m ;i++){
        mp[s[i].fi][s[i].se] = 0;
        mp[s[i].se][s[i].fi] = 0;
      	
        
        did[s[i].fi] = 1;
		fin(s[i].fi,n);
		cerr << cnt << endl;
        if(cnt != n) ans++;

        mp[s[i].fi][s[i].se] = 1;
        mp[s[i].se][s[i].fi] = 1;
      	cnt = 1;
      	REP(i,n+1) did[i] = 0;
    }

    cout << ans <<endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))
cost = [0] * N
cost[1] = abs(h[1] - h[0])
for i in range(2, N):
    cost[i] = min(cost[i - 1] + abs(h[i] - h[i-1]), cost[ i - 2] + abs(h[i] - h[i-2]))
print(cost[N-1])
    
    

Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repi(i,x,n) for(ll i=x;i<(ll)(n);i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);ios::sync_with_stdio(false);

long long mpow(long long a, long long n) {//a^n(MOD)を求める
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;//次の準備
        n >>= 1;
    }
    return res;
}

ll dp[1010][(1<<12) +1];

signed main(){
    int n,m;cin>>n>>m;
    vector<PL> key(m);

    rep(i,1010)rep(j,(1<<12) +1){
        dp[i][j]=INF;
    }
    dp[0][0]=0;

    rep(i,m){
        ll a,b;cin>>a>>b;
        key[i].fs=a;
        rep(j,b){
            ll x;cin>>x;
            key[i].sc+=mpow(2,x-1);
        }
    }

    rep(i,m){
        rep(j,(1<<12) +1){
            dp[i+1][(j|key[i].sc)]=min(dp[i][j]+key[i].fs,dp[i+1][(j|key[i].sc)]);
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        }
    }

    if(INF<=dp[m][(1<<(n))-1]){
        cout<<-1<<endl;
    }else{
        cout<<dp[m][(1<<(n))-1]<<endl;
    }
}

Measured memory_bytes: 32640
#include<iostream>
using namespace std;
#define m int64_t
#define r(s,i,n) for(m i=s;i<n;i++)
m w[555][555],p[1234];
main(){m n;cin>>n;m t=0,k=555;r(2,i,1e4){bool a=1;r(2,j,i){if(i%j==0)a=0;}if(a)p[t]=i,t++;}r(0,i,k)r(0,j,k)if(i%2==j%2)w[i][j]=p[(i+j)/2]*p[(i+k*3-j)/2];r(0,i,k)r(0,j,k)if(w[i][j]==0&&i>0&&i<554)w[i][j]=w[i-1][j]*w[i+1][j]+1;r(0,i,n)r(0,j,n)cout<<w[i+1][j+1]<<" ";}

Measured memory_bytes: 6016
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	if((a+b)%2==0){
		cout << (a+b)/2 << endl;
		return 0;
	}else{
		cout << ((a+b)/2)+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<deque>
#include<queue>
#include<string>
#include<string.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;

ll x[100010][3];
P r[100010];

int main() {
	int n, m;
	cin >> n >> m;
	for (int j = 0; j < n; j++) {
		for (int i = 0; i < 3; i++) {
			cin >> x[j][i];
		}
	}
	ll res = 0;
	for (int i = 1; i <= 8; i++) {
		int num = i;
		for (int j = 0; j < n; j++) {
			r[j].first = 0;
		}
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < n; k++) {
				if (num % 2 == 1) {
					r[k].first -= x[k][j];
				}
				else {
					r[k].first += x[k][j];
				}
				r[k].second = k;
			}
			num /= 2;
		}
		sort(r, r + n, greater<P>());
		ll b = 0, d = 0, p = 0;
		for (int j = 0; j < m; j++) {
			b += x[r[j].second][0];
			d += x[r[j].second][1];
			p += x[r[j].second][2];
		}
		res = max(res, abs(b) + abs(d) + abs(p));
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, t;
    cin >> a >> b >> t;
    cout << b * (t / a);
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int c;
	int i, j;
	int tront[9];
	int check;
	int count;
	int flag;
	while (1) {
		flag = 0;
		for (i = 0; i < 10; i++) {
			if ((c = getchar()) == EOF)
				break;
			if (c == 's')
				tront[i] = 0;
			else if (c == 'o')
				tront[i] = 1;
			else if (c == 'x')
				tront[i] = 2;
		}
		if (i != 10)
			break;
		
		for (check = 1; check <= 2; check++) {
			for (i = 0; i < 3; i++) {
				for (j = 0, count = 0; j < 3; j++) {
					if (tront[i*3+j] == check)
						count++;
				}
				if (count == 3)
					flag = check;
			}
			for (i = 0; i < 3; i++) {
				for (j = 0, count = 0; j < 3; j++) {
					if (tront[i+j*3] == check) {
						count++;
					}
				}
				if (count == 3)
					flag = check;
			}
			for (i = 0, j = 0, count = 0; i < 3 || j < 3; i++, j++) {
				if (tront[i*3+j] == check) {
					count++;
				}
				if (count == 3)
					flag = check;
			}
			for (i = 2, j = 0, count = 0; i >= 0 || j < 3; i--, j++) {
				if (tront[i*3+j] == check) {
					count++;
				}
				if (count == 3)
					flag = check;
			}
		}
		if (flag == 1)
			printf("o");
		else if (flag == 2)
			printf("x");
		else
			printf("d");
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i) = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

// const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  int r,g,b,n;cin>>r>>g>>b>>n;

  int ans = 0;
  rep(i,n+1){
    rep(j,n+1){
      int tmp = n-(r*i+g*j);
      if(tmp >=0 && tmp%b == 0)ans++;
    }
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3]){cout<<"No";return 0;}
	if(s[0]==s[1]&&s[2]==s[3]){cout<<"Yes";return 0;}
	if(s[0]==s[2]&&s[1]==s[3]){cout<<"Yes";return 0;}
	if(s[0]==s[3]&&s[1]==s[2]){cout<<"Yes";return 0;}
	cout<<"No";
}

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

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  vector<int> v(3,0);
  for(int i=0;i<3;i++) cin >> v[i];
  sort(v.begin(), v.end());
  cout << v[0]*v[1]/2 << "\n";
  return 0;
}

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

int main() {
   ll a, b, c, d;
   cin >> a >> b >> c >> d;
    ll ans = 0;
  ans = max(a * c, a * d);
  ans = max(ans, max(b * c, b * d));
  if((a <= 0 && b >= 0) || (c <= 0 && d >= 0)) {
      if(ans < 0) ans = 0;
  } 

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

Measured memory_bytes: 3620
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL K;
string S;

string ans = "";

void solve(){
    for(int i=0;i<S.size() && i<K;i++){
        ans += S[i];
    }
    if(K<S.size()) ans += "...";
}

int main(){
    cin >> K;
    cin >> S;

    solve();

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

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);

int main() {
    int n;
    cin >> n;
    vector<int> a(n+1);
    rep(i,n) cin >> a[i+1];
    vector<int> b(n+1);
    for (int i = n; i >= 1; i--) {
        int sum = 0;
        for (int j = i+i; j <= n; j += i) {
            sum ^= b[j];
        }
        b[i] = a[i]^sum;
    }
    vector<int> ans;
    rep(i,n) {
        if (b[i+1]) ans.push_back(i+1);
    }
    cout << ans.size() << endl;
    rep(i,ans.size()) cout << ans[i] << endl;
    return 0;
}

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

int main() {
  int num[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  char ch[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

  int64_t n;
  int m;
  std::cin >> n >> m;
  std::vector<int> a(m);
  for (auto &i : a) {
    std::cin >> i;
  }

  std::vector<int64_t> d(n + 1, -1);
  d[0] = 0;
  for (int64_t i = 1; i < d.size(); i++) {
    for (const auto j : a) {
      if (num[j] <= i && d[i - num[j]] != -1) {
        d[i] = std::max(d[i], d[i - num[j]] + 1);
      }
    }
  }

  std::string str("");
  str.reserve(d[n]);

  int64_t k = n;
  while (d[k] != 0) {
    int64_t next;
    int max = 0;
    for (const auto j : a) {
      if (num[j] <= k) {
        if (d[k] - d[k - num[j]] == 1) {
          if (max < j) {
            max = std::max(max, j);
            next = k - num[j];
          }
        }
      }
    }
    str.push_back(ch[max]);
    k = next;
  }

  std::cout << str << std::endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

constexpr int MAX_WEIGHT = 10000; // 重さの最大値

int calc_cost(vector<int>& weight, int n, int min_weight){
    int cost = 0;

    vector<int> sorted_wight = weight;
    sort(sorted_wight.begin(), sorted_wight.end());   // ソートされた状態を作る

    vector<int> idx_record(MAX_WEIGHT + 1);
    for(int i = 0; i < n; ++i){
        // ソート済みの要素のインデックスがどこにあるか記録
        idx_record[sorted_wight[i]] = i;
    }

    vector<bool> verified(n, false);  // コストを確認済みかどうか
    for(int i = 0; i < n; ++i){
        if(verified[i]){
            continue;   // 確認済みなら次へ
        }
        int cur = i;        // 自分の現在地（カーソル）
        int sum_in_loop = 0;          // ループ内の重さ合計  
        int min_in_loop = MAX_WEIGHT; // ループ内での重さ最小値
        int count = 0;      // 交換回数
        while(true){
            verified[cur] = true;
            count++;
            int current_weight = weight[cur];    // 
            min_in_loop = min(min_in_loop, current_weight);
            sum_in_loop += current_weight;
            cur = idx_record[current_weight];
            if(verified[cur]){
                break;  // 一周回ったら終わり
            }
        }
        // sum_in_loop に min_in_loop が含まれている. 自分は入れ替える必要ない. なので count - 2 
        int not_borrow_weight = sum_in_loop + (count - 2) * min_in_loop;
        
        // min_weight を取ってくるのに 1回 必要なので count + 1
        int borrow_min_weight = min_in_loop + sum_in_loop + (count + 1) * min_weight;
        
        cost += min(not_borrow_weight, borrow_min_weight);
    }
    return cost;
}

int main(){

    int n;
    cin >> n;
    
    int min_weight = MAX_WEIGHT; // 荷物の中での重さ最小値
    vector<int> weight(n);
    for(int i = 0; i < n; ++i){
        cin >> weight[i];
        min_weight = min(min_weight, weight[i]);
    }

    int cost = calc_cost(weight, n, min_weight);

    cout << cost << endl;

    return 0;
}


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

int main() {
    int a,b,c,x;
    cin >> a >> b >> c >> x;
    int cnt = 0;
    for(int i = 0; i <= a; i++){
        for(int j = 0; j <= b; j++){
            for(int k = 0; k <= c; k++){
                if(500*i+100*j+50*k==x)cnt++;
            }
        }
    }
    cout << cnt;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    long long int i,j,k,n;

    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            printf("%lldx%lld=%lld\n",i,j,i*j);

        }
    }
    return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define CIN>>x scanf("%lld",&x);
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
	string S;
    cin >> S;
    n=S.length();
	vl ANS;
	rep(i,n){
		if(S[i]=='R'){
			if(b!=0){
				rep(i,a-1){
					ANS.push_back(0);
				}
				ANS.push_back((a+1)/2+b/2);
				ANS.push_back((b+1)/2+a/2);
				rep(i,b-1){
					ANS.push_back(0);
				}
				a=0;
				b=0;
			}
			a++;
		}
		else b++;

	}

	rep(i,a-1){
					ANS.push_back(0);
				}
				ANS.push_back((a+1)/2+b/2);
				ANS.push_back((b+1)/2+a/2);
				rep(i,b-1){
					ANS.push_back(0);
				}
				a=0;
				b=0;

	rep(i,n){
		cout<<ANS[i]<<" ";
	}
	cout<<endl;
}

Measured memory_bytes: 1528
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

ll x[100003], a[100003];
ll w[100003];

int main() {
	ll n; ll L, T; cin >> n >> L >> T;
	int t = 0;
	for (ll i = 0; i < n; ++i) {
		cin >> x[i] >> w[i];
		if (w[i] == 2) w[i] = -1;
		a[i] = (x[i] + w[i] * T % L + L) % L;
		if (a[i] == a[0]) t = i;
	}
	ll f = a[0];
	sort(a, a + n);
	int b = lower_bound(a, a + n, f) - a;
	if (t != 0 && w[0] > w[t]) ++b;
	ll pos = 0;
	for (ll i = 1; i < n; ++i) {
		if (w[i] == w[0]) continue;
		if (w[0] == 1) {
			ll t = 2 * T;
			pos += x[i] - x[0] <= t ? 1 : 0;
			t = max(0LL, t - x[i] + x[0]);
			pos += t / L;
			pos %= n;
		}
		else {
			ll t = 2 * T;
			pos += L - x[i] + x[0] <= t ? 1 : 0;
			t = max(0LL, t - L + x[i] - x[0]);
			pos += t / L;
			pos %= n;
		}
	}
	if (w[0] == -1) pos = n - pos;
	for (ll i = 0; i < n; ++i) cout << a[(n - pos + b + i) % n] << endl;
	return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n,k;cin >>n>>k;
    vector<int>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    sort(all(a));
    int ans=0;
    for (int i = 0; i < k; ++i) {
        ans+=a[i];
    }
    cout <<ans <<endl;
    return 0;
}


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

using namespace std;
int n,cnt,ans;
string s;
int main() {
    scanf("%d",&n);
    cin>>s;
    for(int i=0;i<n;i++)
        if(s[i]=='W')
            cnt++;
    for(int i=n-cnt;i<n;i++)
        if(s[i]!='W')
            ans++;
    printf("%d\n",ans);
    return 0;
}       

Measured memory_bytes: 3928
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	double x1, y1, x2, y2, x3, y3;
	int n;
	double p, q, r;//円の中心を(p, q)、半径をrとする
	
	scanf("%d", &n);
	
	while(n--){
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		
		p = ((pow(x1,2)-pow(x2,2))*(y2-y3)-(pow(x2,2)-pow(x3,2))*(y1-y2)-(y1-y2)*(y2-y3)*(y3-y1)) / (2*((x1-x2)*(y2-y3)-(x2-x3)*(y1-y2)));
		q = ((pow(y1,2)-pow(y2,2))*(x2-x3)-(pow(y2,2)-pow(y3,2))*(x1-x2)-(x1-x2)*(x2-x3)*(x3-x1)) / (2*((y1-y2)*(x2-x3)-(y2-y3)*(x1-x2)));
		r = sqrt(pow(x1-p,2)+pow(y1-q,2));
		
		//p += 0.0005; q += 0.0005; r += 0.0005;
		
		printf("%.3f %.3f %.3f\n", p, q, r);
	}
	return 0;
}

Measured memory_bytes: 1092
#include<stdio.h>
#include<stdlib.h>

void fibonacci(int);
int main()
{
  int n;
  scanf("%d",&n);
  fibonacci(n);
  return 0;
}

void fibonacci(int n)
{
  int *F,i;
  F = malloc(sizeof(int)*n+1);
  *(F+0) = 1;
  *(F+1) = 1;
  if(n>=2)
    {
      for(i=2;i<=n;i++)
	{
	  *(F+i) = *(F+(i-2)) + *(F+(i-1));
	}
    }
  printf("%d\n",*(F + n));
}



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

using namespace std;

#define ll long long
typedef complex<double> P;

const int MAX_SIZE = 1001;
int q;
int dp[MAX_SIZE][MAX_SIZE] = {};

int main() {
  cin >> q;
  for (int i = 0; i < q; i++) {

    for (int j = 0; j < MAX_SIZE; j++) {
      dp[MAX_SIZE-1][0] = 0;
      dp[0][MAX_SIZE-1] = 0;
    }

    string a, b; cin >> a >> b;

    for (int j = 0; j < a.size(); j++) {
      for (int k = 0; k < b.size(); k++) {
        if(a[j] == b[k]) {
          dp[j+1][k+1] = dp[j][k] + 1;
        }
        else {
          dp[j+1][k+1] = max(dp[j][k+1], dp[j+1][k]);
        }
      }
    }

    cout << dp[a.size()][b.size()] << endl;
  }
}

Measured memory_bytes: 7044
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647

int main() {
	int numSeq[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int k;
	cin >> k;
	cout << numSeq[--k] << endl;

	return 0;
}

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

const int N = 100005;

int n, m;
vector<int> g[N];
int f[N];
int mx = 0;

void dfs(int u) {
	if (~f[u]) {
		return;
	}
	f[u] = 0;
	for (int v : g[u]) {
		dfs(v);
		f[u] = max(f[u], f[v] + 1);
	}
	mx = max(mx, f[u]);
}

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; ++i) {
		f[i] = -1;
	}
	for (int i = 1; i <= m; ++i) {
		int u, v; scanf("%d %d", &u, &v);
		g[u].push_back(v);
	}
	for (int i = 1; i <= n; ++i) {
		if (f[i] == -1) {
			dfs(i);
		}
	}
	printf("%d\n", mx);
}

Measured memory_bytes: 8192
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,n,k;
    n=0;
    k=0;
    cin>>a>>b>>c;
    if(a==5){
        n++;
    }else{
        k++;
    }
    if(b==5){
        n++;
    }else{
        k++;
    }
    if(c==5){
        n++;
    }else{
        k++;
    }
    
    if(n==2 and k==1){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  long long a[200000+10], b[200000+10];
  for(int i=0; i<n; i++) cin >> a[i] >> b[i];
  sort(a,a+n);
  sort(b,b+n);
  if(n%2 == 1){
    cout << b[n/2] - a[n/2] +1; 
  } else {
    cout << ((b[n/2]+b[n/2-1])-(a[n/2]+a[n/2-1])) +1;
  }
    
  
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<P> p(m);
    rep(i, m) cin >> p[i].first >> p[i].second;
    rep(x, 1000)
    {
        int nx = x / 10;
        vector<int> d(1, x % 10);
        while (nx)
        {
            d.push_back(nx % 10);
            nx /= 10;
        }
        reverse(d.begin(), d.end());
        if (d.size() != n)
            continue;
        bool ok = true;
        rep(i, m)
        {
            if (d[p[i].first - 1] != p[i].second)
                ok = false;
        }
        if (ok)
        {
            cout << x << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
n, m = map(int, input().split())
x = list(map(int, input().split()))

x = sorted(x)
diff = np.asarray([x[i + 1] - x[i] for i in range(len(x) - 1)])
argsort = diff.argsort()[::-1][:n - 1]

start = 0
sum_length = 0
for split_idx in argsort:
    sum_length += x[split_idx] - x[start]
    start = split_idx + 1
sum_length += x[-1] - x[start]

print(sum_length)

Measured memory_bytes: 22984
#include <cstdio>
using namespace std;
char field[105][105];
int main(void) {
    // Here your code !
    int h, w, i, j, lastPos;
    scanf("%d %d", &h, &w);
    for (i=0; i<h; i++) scanf("%s", field[i]);
    for (i=0; i<h; i++) {
        lastPos = 1000;
        for (j=0; j<w; j++) {
            if(field[i][j] == 'c') lastPos = j;
            if(lastPos <= j) printf("%d", j-lastPos);
            else printf("-1");
            if(j != w-1) printf(" ");
        }
        printf("\n");
    }
}

Measured memory_bytes: 2688
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int n, k;
	cin >> n >> k;
	vint a(n);
	int sum = 0;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	vint b;
	for (int i = 1; i * i <= sum; i++) {
		if (sum % i == 0) {
			b.push_back(i);
			if (i * i != sum) {
				b.push_back(sum / i);
			}
		}
	}
	sort(b.begin(), b.end(), check);
	rep(i, b.size()) {
		vint c;
		llint tmp = 0;
		rep(j, n) {
			tmp += (llint)a[j] % b[i];
			c.push_back(a[j] % b[i]);
		}
		tmp /= b[i];
		sort(c.begin(), c.end());
		llint cnt = 0;
		rep(j, n - tmp) {
			cnt += c[j];
		}
		if (cnt <= k) {
			cout << b[i] << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits//stdc++.h>
using namespace std;
#define rep(i,n) for(int i =0;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long int ll;
int main(){
  int n;cin >>n;vector<int> d(n),e(n);
  rep(i,n) cin >> d[i] >> e[i];
  int sum = 0,cnt = 0;
  rep(i,n){
    if(d[i]==e[i]) {
      sum++;cnt = max(cnt,sum);
    }
    else{
      sum = 0;
    }
  }
  if(cnt >=3) cout << "Yes"<<endl;
  else cout << "No"<<endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(void){

  int A,B,X=0,i;
  scanf("%d %d",&A,&B);
  for(i=0;i<2;i++){
    if(A>B){
      X = X+A;
      A--;
    }
    else{
      X = X+B;
      B--;
    }
  }
  printf("%d",X);

  return 0;
}

Measured memory_bytes: 128