akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define ALL(x) begin(x), end(x)
using ll = long long;
using namespace std;

ll solve(int n, vector<ll> const & a, vector<ll> const & b) {
    vector<int> order(n);
    iota(ALL(order), 0);
    sort(ALL(order), [&](int i, int j) {
        return a[i] + b[i] > a[j] + b[j];
    });
    ll delta = 0;
    REP (i, n) {
        int j = order[i];
        if (i % 2 == 0) {
            delta += a[j];
        } else {
            delta -= b[j];
        }
    }
    return delta;
}

int main() {
    int n; cin >> n;
    vector<ll> a(n), b(n);
    REP (i, n) cin >> a[i] >> b[i];
    cout << solve(n, a, b) << endl;
    return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;


int main()
{
    long long n;
    long long q;
    vector<long long> s;
    long long a[100001];
    for (long long i = 0; i < 100001; i++) a[i] = 0;

    cin >> n;

    s.push_back(0);

    for (long long i = 0; i < n; i++) {
        long long aa; cin >> aa;
        s[0] += aa;
        a[aa]++;
    }

    cin >> q;

    for (long long i = 0; i < q; i++) {
        long long b, c;
        cin >> b >> c;
        long long cnt = a[b];
        s[i] += cnt * (c - b);
        a[c] += cnt;
        a[b] = 0;

        s.push_back(s[i]);
    }


    for (int i = 0; i < q; i++) {
        cout << s[i] << endl;
    }
}

Measured memory_bytes: 5072
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d;
  cin>>d;
  if(d==25){cout<<"Christmas"<<endl;}
  else if(d==24){cout<<"Christmas Eve"<<endl;}
  else if(d==23){cout<<"Christmas Eve Eve"<<endl;}
  else {cout<<"Christmas Eve Eve Eve"<<endl;}
}




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

int main(){
  int N, M, C, i, j, ac = 0;
  cin >> N >> M >> C;
  int B[M] = {};
  int A[N][M] = {};
  for(i = 0; i < M; i++){
    cin >> B[i];
  }
  for(j = 0; j < N; j++){
    for(i = 0; i < M; i++){
      cin >> A[j][i];
    }
  }
  for(j = 0; j < N; j++){
    int score = C;
    for(i = 0; i < M; i++){
      score += A[j][i]*B[i];
    }
    if(score > 0) ac++;
  }
  cout << ac << endl;
  return 0;
}


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

using namespace std;

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

  long long a_max = 0, a_min = 10000000000;
  for (int i = 0; i < N; ++i)
  {
    long long A;
    cin >> A;
    if (a_max < A)a_max = A;
    if (a_min > A) a_min = A;
  }

  cout << a_max - a_min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define TEST cout << "test" << endl;
using namespace std;

int main(void){
	int n;
	cin >> n;
	vector<int> arr(n);
	for(int i = 0; i != n; i++)cin >> arr[i];
	int maxvalue = *max_element(arr.begin(),arr.end());
	int counter = 0;
	for(int i = 0; i != n; i++)if(arr[i] == maxvalue)counter++;

	if(counter != 1)for(int i = 0; i != n; i++)cout << maxvalue << endl;
	else{
		for(int i = 0; i != n; i++){
			if(arr[i] == maxvalue){
				sort(arr.begin(),arr.end());
				cout << arr[n - 2] << endl;
				for(int j = i + 1; j != n; j++){
					cout << maxvalue << endl;
				}
				return 0;
			}
			else cout << maxvalue << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2432
import sys
sys.setrecursionlimit(10000)
H, W = map(int, input().split())
A = [input() for _ in range(H)]
homon = [[False]*W for _ in range(H)]
dx = [0, 1]
dy = [1, 0]

def dfs(x, y):
    homon[y][x] = True
    if x == W-1 and y == H-1:
        return
    for i in range(2):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < 0 or W <= nx or ny < 0 or H <= ny:
            continue
        if A[ny][nx] == '#':
            dfs(nx, ny)
            break
    return 

if __name__ == '__main__':
    dfs(0, 0)
    for i in range(H):
        for j in range(W):
            if A[i][j] == '#' and homon[i][j] == False:
                print('Impossible')
                exit()
    print('Possible')


Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int[] x = new int[N];
        for (int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
        }
        System.out.println(solve3(N, A, x));
    }

    private static long solve(int n, int a, int[] x) {
        int[] y = Arrays.stream(x).map(i -> i - a).toArray();
        return brute(n - 1, 0, y);
    }

    private static long brute(final int i, final int n, final int[] y) {
        if (i < 0) return 0;
        return (n + y[i] == 0 ? 1 : 0) + brute(i - 1, n, y) + brute(i - 1, n + y[i], y);
    }

    private static long solve2(int n, int a, int[] x) {
        // dp[i][j][k] := {x_1 ... x_i} から j 個選んで，和が k となる組み合わせの数 O(n^3X)
        int X = Math.max(a, Arrays.stream(x).max().getAsInt());
        long[][][] dp = new long[n + 1][n + 1][n * X + 1];
        dp[0][0][0] = 1;
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                for (int k = 0; k <= n * X; k++) {
                    if (k - x[i - 1] >= 0 && j - 1 >= 0) {
                        dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]];
                    } else {
                        dp[i][j][k] = dp[i - 1][j][k];
                    }
                }
            }
        }
        long ans = 0;
        for (int i = 1; i <= n; i++) {
            ans += dp[n][i][i * a];
        }
        return ans;
    }

    private static long solve3(int n, int a, int[] x) {
        // 平均 0 を求めるようにすると，O(n^2X)
        int[] y = Arrays.stream(x).map(v -> v - a).toArray();
        int X = Math.max(a, Arrays.stream(x).max().getAsInt());
        long[][] dp = new long[n + 1][2 * n * X + 1];
        dp[0][n * X] = 1;
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j <= 2 * n * X; j++) {
                if (0 <= j - y[i - 1] && j - y[i - 1] <= 2 * n * X ) {
                    dp[i][j] = dp[i - 1][j] + dp[i - 1][j - y[i - 1]];
                } else {
                    dp[i][j] = dp[i - 1][j];
                }
            }
        }
        return dp[n][n * X] - 1;
    }

}

Measured memory_bytes: 16976
#include<bits/stdc++.h>
#define MAXN 3010010
using namespace std;
 
int W[MAXN + 10] , E[MAXN + 10];
 
int main()
{	
	       int N;
	       cin >> N;
	       string str;
	       cin >> str;
	       W[0] = (str[0] == 'W');
	       for(int i = 1; i < str.size(); i++) W[i] = W[i - 1] + (str[i] == 'W');
	       E[str.size() - 1] = (str[str.size() - 1] == 'E');
	   	   for(int i = str.size() - 2 ; i >= 0 ; i--) E[i] = E[i + 1] + (str[i] == 'E');
	   	   int ans = E[0];
	   	   for(int i = 1 ; i < str.size(); i++) {
	   	   		ans = min(ans , W[i - 1] + E[i + 1]);
	   	   } 	
	   	   cout << ans << endl;
}

Measured memory_bytes: 5892
def main():
    A,V = map(int,input().split())
    B,W = map(int,input().split())
    T = int(input())
    
    if A <= B:
        if A+V*T >= B+W*T:
            ans = 'YES'
        else:
            ans = 'NO'
    else:
        if A-V*T <= B-W*T:
            ans = 'YES'
        else:
            ans = 'NO'
    
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

string s[51], t[51];

// ??????????????´?????????????????????????????¢??°
bool check(int n, int k) {
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      //cout << i << " " << j << " ";
      //cout << t[i].substr(0, k) << " " << t[j].substr(0, k) << endl;
      if (t[i].substr(0, k) == t[j].substr(0, k)) return false;
    }
  }
  return true;
}

int main(void) {
  int n, ans = -1, m_size = 0;
  cin.tie(0);
  ios::sync_with_stdio(false);

  while (cin >> n, n) {
    ans = -1;
    for (int i = 0; i < n; i++) s[i] = t[i] = "";
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      if(s[i].size() > m_size) m_size = s[i].size();
    }
    for (int j = 0; j < n; j++) t[j] = s[j][0]; // ?????????

    //for (int j = 0; j < n; j++) cout << t[j] << endl;

    for (int j = 0; j < n; j++) {
      for (int k = 1; k < s[j].size(); k++) {
        if (s[j][k-1] == 'a' || s[j][k-1] == 'i' || s[j][k-1] == 'u' || s[j][k-1] == 'e' || s[j][k-1] == 'o') {
          t[j]+=s[j][k]; // ???????????????
        }
      }
    }
    //sort(t, t + n);
    //for (int k = 0; k < n; k++) cout << t[k] << endl;


    //????????????1?????????????¢????????????????????????´????????°??????????????????
    for (int i = 1; i <= m_size; i++) {
      //cout << i << endl;
      if(check(n, i)) {
        ans = i;
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int main(){
 ios::sync_with_stdio(false);
 cin.tie(NULL);
   int a, b, c;

   cin >> a;
   cin >> b;
   cin >> c;

   cout << ((a+b)*c)/2 << "\n";

   return 0;



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define FOR(i, x, y) for(int i = x; i < y; i++)
#define endll cout << "\n"
#define For(n) for(int i = 0; i < n; i++)
const ll maxn = 1000000 + 100;
const int mod = 1e9 + 7;
int a[maxn];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int a, b , c;
    cin >> a >> b >> c;
    if(a % 3 == 0 || b % 3 == 0 || (a + b )% 3 == 0)
        cout << "Possible";
    else
        cout << "Impossible";
    return 0;
}


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

public class Main {

	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(
					System.in));

			String[] strs = br.readLine().split(" ");
			int w = Integer.parseInt(strs[0]);
			int h = Integer.parseInt(strs[1]);
			int x = Integer.parseInt(strs[2]);
			int y = Integer.parseInt(strs[3]);
			int r = Integer.parseInt(strs[4]);

			if ((0 > (x - r)) || (0 > (y - r))) {
				// x??? or y??? ???????????????????¶????
				System.out.println("No");
			} else if ((w < (x + r)) || (h < (y + r))) {
				// x??? or y??? ????????????????¶????
				System.out.println("No");
			} else {
				System.out.println("Yes");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 17092
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    int n[4];
    rep(i, 4) cin >> n[i];
    sort(n, n+4);
    if(n[0]==1 && n[1]==4 && n[2]==7 && n[3]==9) cout << "YES\n";
    else cout << "NO\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			String input = scanner.next();			
			String[][] map = new String[3][3];
			
			for(int i=0; i<input.length(); i++)
			{
				map[i/3][i%3] = input.substring(i, i+1);
			}
			
			String output = "d";
			for(int i=0; i<3; i++)
			{
				int count = 1;
				for(int j=0; j<3; j++)
				{
					if(map[i][j].equals("s"))
					{
						break;
					}
					if(j > 0)
					{
						if(map[i][j].equals(map[i][j-1]))
						{
							count ++;
						}
						else {
							break;
						}
					}
				}
				
				if(count == 3)
				{
					output = map[i][0];
					break;
				}
			}
			
			
			for(int i=0; i<3; i++)
			{
				int count = 1;
				for(int j=0; j<3; j++)
				{
					if(map[j][i].equals("s"))
					{
						break;
					}
					if(j > 0)
					{
						if(map[j][i].equals(map[j-1][i]))
						{
							count ++;
						}
						else {
							break;
						}
					}
				}
				
				if(count == 3)
				{
					output = map[0][i];
					break;
				}
			}
			
			int count = 1;
			for(int i=0; i<3; i++)
			{
				if(map[i][i].equals("s"))
				{
					break;
				}
				if(i > 0)
				{
					if(map[i][i].equals(map[i-1][i-1]))
					{
						count ++;
					}
					else {
						break;
					}
				}
			}			
			if(count == 3)
			{
				output = map[0][0];
			}
			
			
			count = 1;
			for(int i=0; i<3; i++)
			{
				int j = 2-i;
				if(map[i][j].equals("s"))
				{
					break;
				}
				if(i > 0)
				{
					if(map[i][j].equals(map[i-1][j+1]))
					{
						count ++;
					}
					else {
						break;
					}
				}
			}
			
			if(count == 3)
			{
				output = map[0][2];
			}
			
			System.out.println(output);
		}
	}
}

Measured memory_bytes: 25924
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i

count = 0
i = 0
while i <= a
  y = x - 500*i
  if y == 0
    count += 1
    # printf("%d\n",i)
  elsif y > 0
    j = 0
    while j <= b
      z = y - 100*j
      if z == 0
        count += 1
        # printf("%d,%d\n",i,j)
      elsif z > 0
        k = z / 50
        if k <= c
          count += 1
          # printf("%d,%d,%d\n",i,j,k)
        end
      end
      j += 1
    end
  end
  i += 1
end
print count

Measured memory_bytes: 1788
#include<iostream>
#include<vector>
using namespace std;
int main(){
	int n, ans = 0;
	cin >> n;
	vector<int> l(n), r(n);
	for (int i = 0; i < n; i++){
		cin >> l.at(i) >> r.at(i);
	}

	for (int i = 0; i < n; i++){
		ans += r.at(i) - l.at(i) + 1;
	}

	cout << ans << endl;
}

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

using namespace std;

using ll = long long;

const int maxn = 600000;

vector<int>g[maxn];

int num[maxn];
bool used[maxn];

void dfs(int v) {
	used[v] = true;
	int cur = -1;
	for (auto u : g[v]) {
		if (!used[u]) {
			dfs(u);
		}
		cur = max(cur, num[u]);
	}
	num[v] = cur + 1;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size() + 1;
	for(int i = 0; i < n -1; i++) {
		if (s[i] == '<') {
			//cout << i + 1 << " " << i;
			g[i + 1].push_back(i);
		}
		else {
			//cout << i << " " << i + 1;
			g[i].push_back(i + 1);
		}
		//cout << endl;
	}
	for (int i = 0; i < n; i++) {
		if (!used[i]) {
			dfs(i);
		}
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += num[i];
		//cout << num[i] << " ";
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 56732
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: u64
    }

    let mut result = 0;

    for i in 1..=n {
        if !isFizzBuzz(i) {
            result += i;
        }
    }

    println!("{}", result);
}

fn isFizzBuzz(num: u64) -> bool {
    if num % 3 == 0 || num % 5 == 0 {
        true
    } else {
        false
    }
}


Measured memory_bytes: 2140
def cc086():
    n = int(input())
    txy = list()
    for i in range(0, n):
        t = list(map(int, input().split()))
        txy.append(t)

    pos = [0, 0, 0]
    for i in range(0, n):
        t,x,y = txy[i][0:]
        dt = t - pos[0]
        dx = abs(pos[1] - x)
        dy = abs(pos[2] - y)
        dz = dx + dy

        if dz <= dt and dt%2 == dz%2:
            pos = [t, x, y]
        else:
            print('No')
            import sys
            sys.exit()

    print('Yes')

cc086()

Measured memory_bytes: 27324
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで


using namespace std;
//A=0,C=1,G=2,T=3
lint dp[4][4][4][150];
int N;

int main(){
  cin >> N;
  REP(i,4){
    REP(j,4){
      REP(k,4){
        dp[i][j][k][3] = 1;
      }
    }
  }
  dp[0][2][1][3] = 0;
  dp[0][1][2][3] = 0;
  dp[2][0][1][3] = 0;
  for(int i=4;i<=N;i++){
    REP(j,4){
      REP(k,4){
        REP(l,4){
          REP(m,4){
            if((j==0&&k==2&&l==1)||(m==0&&k==2&&l==1)||(j==2&&k==0&&l==1)||(j==0&&k==1&&l==2)||(m==0&&j==2&&l==1)) continue;
            else {//c
              dp[j][k][l][i] += dp[m][j][k][i-1];
              dp[j][k][l][i] %= MOD;
            }
          }
        }
      }
    }
  }
  lint ans = 0;
  REP(i,4){
    REP(j,4){
      REP(k,4){
        //char b[4] = {'A','C','G','T'};
        //cout << b[i] << b[j] << b[k] << dp[i][j][k][N] << endl;
        ans += dp[i][j][k][N];
        ans %= MOD;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> k(n+1,0);
  vector<int> w(n+1,0);
  rep(i,n-1){
    if(s[i]=='A'&&s[i+1]=='C'){
      k[i+1]++;
      w[i+2]++;
    }
  }
  rep(i,n-1){
    k[i+2]+=k[i+1];
    w[i+2]+=w[i+1];
  }
  rep(i,q){
    int l,r;
    cin >> l >> r;
    cout << w[r]-w[l] << endl;
  }
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define max_n 1000000

using namespace std;

void solve()
{
	double l;
	cin>>l;
	double ans;
	ans=(l/3)*(l/3)*(l-2*l/3);
	cout<<std::setprecision(20)<<ans<<endl;
}

int32_t main() 
{
	IOS	
	ll T=1;
	// cin>>T;
	for(ll i=1;i<=T;++i)
	{		
		// cout<<"Case #"<<i<<": ";
    	solve();
	}
	return 0;
}

Measured memory_bytes: 256
S = gets.chomp

if S[0] == S[1] and S[1] == S[2] and S[2] == S[3] then
  print "No"
elsif S[0] == S[1] and S[2] == S[3] then
  print "Yes"
elsif S[0] == S[2] and S[1] == S[3] then
  print "Yes"
elsif S[0] == S[3] and S[1] == S[2] then
  print "Yes"
else
  print "No"
end


Measured memory_bytes: 1788
using System;

namespace _20190324_02 {
    class Program {
        static void Main(string[] args) {
            var s = Console.ReadLine();
            var max = 0;
            var count = 0;
            for (int i = 0; i < s.Length; i++) {
                if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C') {
                    count++;
                    if (max < count) {
                        max = count;
                    }
                } else {
                    count = 0;
                }
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 11092
#define DBG 0 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <queue>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif
 
using namespace std;
 
 
int main(){
    int a,b,ans=0;
    
    bool flag=false;

    cin >> a >> b;

    for(int i=a;i<=b;i++){
        if(i/10000 == i%10 && i/1000%10 == i/10%10)
            ans++;
    }

    //cout << (flag ? "Yes" : "No") << endl;
    cout << ans << endl;
    //printf("%.10f",ans_d);cout<<endl;
}


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

int solve(const std::vector<int>& ls) {
	int cs[] = { 5, 12, 17, 24, 31 };
	for (int i = 0; i < ls.size(); i++) {
		int c = 0;
		int l = 0;
		for (int j = i; j < ls.size(); j++) {
			l += ls.at(j);
			if (cs[c] == l) {
				c++;

				if (c >= 5) {
					return i+1;
				}
			}
			else if (cs[c] < l) {
				break;
			}
		}
	}
	return -1;
}

int main()
{
	while (true)
	{
		int n;
		std::cin >> n;
		if (n == 0) {
			break;
		}

		std::vector<int>ws;
		ws.resize(n);

		for (int i = 0; i < n; i++) {
			std::string s;
			std::cin >> s;
			ws.at(i) = s.size();
		}

		std::cout << solve(ws) << std::endl;


	}
}

Measured memory_bytes: 3196
#include<stdio.h>
int main()
{
	int A,B,C,K,count=0;
	scanf("%d%d%d%d",&A,&B,&C,&K);
	while(A>=B)
	{
		B*=2;
		count++;
	}
	while(B>=C)
	{
		C*=2;
		count++;
	}
	if(count<=K)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
 } 

Measured memory_bytes: 1732
import sys

f_i = sys.stdin

V, E = map(int, f_i.readline().split())

adj_list = [[] for i in range(V)]

is_visited = [False] * V

for l_i in f_i:
    s, t = map(int, l_i.split())
    adj_list[s].append(t)

import collections

out = collections.deque()

def dfs(u):
    is_visited[u] = True
    for v in adj_list[u]:
        if not is_visited[v]:
            dfs(v)
    out.appendleft(u)

for s in range(V):
    if not is_visited[s]:
        dfs(s)

print(*out, sep = '\n')

Measured memory_bytes: 11504
n=int(input())
l=[int(i) for i in input().split()]
s=sum(l)
d={}
for i in range(n):
  if(l[i] in d):
    d[l[i]]+=1
  else:
    d[l[i]]=1
q=int(input())
for w in range(q):
  b,c=(int(i) for i in input().split())
  if(b in d):
    s-=(d[b]*b)
    s+=(d[b]*c)
    if(c in d):
        d[c]+=d[b]
    else:
        d[c]=d[b]
    d[b]=0
  print(s)

Measured memory_bytes: 21288
import Foundation
import CoreFoundation

#if swift(>=4.0)
#else
extension String {
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map{String($0)}
    }
    var count: Int {
        return self.characters.count
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    mutating func swapAt(i: Int, _ j: Int) {
        swap(&self[i], &self[j])
    }
    func joined(separator separator: String = " ") -> String {
        return self.map{String($0)}.joinWithSeparator(separator)
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func reverse() {
        self = self.reversed()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: Character = " ") -> [String] {
    return readLine()!.split(separator: separator)
}
func readIntSplit(by separator: Character = " ") -> [Int] {
    return readLine()!.split(separator: separator).map{Int($0)!}
}
prefix operator * { }
prefix func * <T> (a: [T]) -> (T, T)          { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T)       { return (a[0], a[1], a[2]) }
prefix func * <T> (a: [T]) -> (T, T, T, T)    { return (a[0], a[1], a[2], a[3]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T) { return (a[0], a[1], a[2], a[3], a[4]) }
infix operator ** { associativity right precedence 155 }    // 右結合，乗除算より強くビットシフトより弱い
func **(lhs: Int, rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
func **(lhs: Int, rhs: Double) -> Double {
    return pow(Double(lhs), rhs)
}
//func gcd(x: Int, _ y: Int) -> Int {
//    return y>0 ? gcd(y, x%y) : x
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}
let MOD = 10**9+7

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // タプル配列のソート

/*************** メインプログラム ***************/

let N = readInt()!
var ans = 0
for i in 1...N {
    if String(i).count % 2 > 0 {
        ans += 1
    }
}
print(ans)


Measured memory_bytes: 7140
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <numeric>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#include <cmath>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef __int128 lll;
constexpr ll mod = 1000000007;

#define bs(n) (1ull<<(ull)(n))
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)

int main() {
    int n;
    char buf[256];
    map<int, set<int>> p;
    cin >> n;
    rep(i, n) {
        cin >> buf;
        rep(j, n) {
            if (buf[j] == '1')p[i].insert(j);
        }
    }
    int d[200], r = -1;
    queue<int> q;
    rep(i, n) {
        q.push(i);
        rep(j, n)d[j] = -1;
        d[i] = 1;
        bool ok = true;
        while (!q.empty()) {
            auto c = q.front();
            q.pop();
            for (auto &e:p[c]) {
                if (d[e] == -1) {
                    d[e] = d[c] + 1;
                    q.push(e);
                } else if (d[e] == d[c] + 1 || d[e] == d[c] - 1) {

                } else {
                    ok = false;
                    break;
                }
            }
        }
        if (!ok) continue;
        rep(j, n)r = max(r, d[j]);
    }
    cout << r << endl;
}


Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define ill long long
#define fcout cout << fixed << setprecision(10)
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<ill> a(n);
  rep(i, 0, n) cin >> a[i];
  ill sum = 1000, kabu = 0;
  rep(i, 0, n-1) {
    if(a[i] < a[i+1]) {
      kabu += sum / a[i];
      sum = sum % a[i];
      /*while(1) {
        if(sum >= a[i]) {
          kabu++;
          sum -= a[i];
        } else {
          break;
        }
      }*/
     // cout << i << " " << sum << " " << kabu << "\n";
    } else if(a[i] > a[i+1]) {
      sum += kabu * a[i];
      kabu = 0;
      /*while(1) {
        if(kabu > 0) {
          kabu--;
          sum += a[i];
        } else {
          break;
        }
      }*/
      //cout << i << " " << sum << " " << kabu << "\n";
    }
  }
  /*while(1) {
    if(kabu > 0) {
      kabu--;
      sum += a[n-1];
    } else {
      break;
    }
  }*/
  sum += kabu * a[n-1];
  kabu = 0;
  cout << sum << "\n";
}


Measured memory_bytes: 3624
# ABC081C - Not so Diverse (ARC086C)
n, k = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().rstrip().split())))
dic = {}
for i in lst:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1

cnt = sorted([i for i in dic.values()], reverse=True)
ans = 0
for i in range(len(cnt)):
    if k > 0:
        k -= 1
        continue
    ans += cnt[i]
print(ans)

Measured memory_bytes: 33696
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
Ans = [True] * (N+1)
for _ in range(M):
    a, b = map(int, input().split())
    Ha, Hb = H[a], H[b]
    if Ha <= Hb:
        Ans[a] = False
    if Ha >= Hb:
        Ans[b] = False
print(sum(Ans)-1)


Measured memory_bytes: 20032
#include <bits/stdc++.h>
using namespace std;
int main() {
	int x, y;
	cin >> x >> y;
	int ans = 0;
	if(x == 1) {
		ans += 300000;
	}
	if(x == 2) {
		ans += 200000;
	}
	if(x == 3) {
		ans += 100000;
	}
	if(y == 1) {
		ans += 300000;
	}
	if(y == 2) {
		ans += 200000;
	}
	if(y == 3) {
		ans += 100000;
	}
	if(x == 1 && y == 1) {
		ans += 400000;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
import numpy as np
import itertools
cnt = 0
N = int(input())
S = {'M':0,'A':0,'R':0,'C':0,'H':0}
march = ['M','A','R','C','H']
for i in range(N):
    s = input()[0]
    if s in march:
        S[s] += 1
seq = S.values()
for i in list(itertools.combinations(seq, 3)):
    i = np.array(i)
    cnt += np.prod(i)

print(cnt)

Measured memory_bytes: 12504
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

vector<bool> isprime;
vector<int> Era(int n) {
    isprime.resize(n, true);
    vector<int> res;
    isprime[0] = false; isprime[1] = false;
    for (int i = 2; i < n; ++i) isprime[i] = true;
    for (int i = 2; i < n; ++i) {
        if (isprime[i]) {
            res.push_back(i);
            for (int j = i*2; j < n; j += i) isprime[j] = false;
        }
    }
    return res;
}

int main(){
  int n; cin >> n;
  auto p = Era(200000);
  cout << *lower_bound(p.begin(), p.end(), n) << endl;
}


Measured memory_bytes: 512
# coding: utf-8
import os
from sys import stdin
from functools import total_ordering

# __dirname = os.path.dirname(__file__)
# __basename = os.path.splitext(os.path.basename(__file__))[0]
# __targetname = './input/' + __basename + '.txt'
# target_path = os.path.join(__dirname, __targetname)
# stdin = open(target_path)

@total_ordering
class struct(object):
    def __init__(self,a,b):
        self.a=a
        self.b=b
    def __lt__	(self,other):
        return self.a < other.a
    def __eq__	(self,other):
        return self.a == other.a

def main():
    # st = struct(10,1)
    # print(st.a)
    input_line = stdin.readline().rstrip().split(' ')
    N, M = map(int, input_line)
    A = list()
    for _ in range(N):
        input_line = stdin.readline().rstrip().split(' ')
        a,b=map(int, input_line)
        st=struct(a,b)
        A.append(st)
    A.sort()
    ans=0
    time=0
    for x in A:
        # print(x.a,x.b)
        if(time>M):
            continue
        if((time+x.b)<=M):
            ans += x.a*x.b
            time += x.b
        else:
            ans += x.a*(M-time)
            time = M
    print(ans)



if __name__ == "__main__":
    main()
    

Measured memory_bytes: 27692
n,m = map(int, input().split())
wa = 0
ac_list = {'AC':{}, 'WA':{}}
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s = input().split()
        ac_list[s][p] = ac_list[s].get(p, 0) + 1* int(not(p in ac_list['AC'].keys()))
    kyotu_key = list(set(ac_list['AC'].keys()) & set(ac_list['WA'].keys()))
    wa_list = [ac_list['WA'][p] for p in kyotu_key]
    print(len(ac_list['AC'].keys()), sum(wa_list))

Measured memory_bytes: 21468
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  scanf("%d", &n);

  int a[200];
  REP(i,n){
    scanf("%d", &a[i]);
  }

  bool make = true;
  int ans = 0;
  while(make){
    make = false;

    REP(i,n){
      if(a[i] % 2 != 0){
        make = false;
        break;
      }else{
        a[i] /= 2;
        make = true;
      }
    }

    if(make){
      ans++;
    }
  }

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



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n;
struct A {
	int x, y, h;
};
A a[100];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].x >> a[i].y >> a[i].h;
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			int k = 0;
			while (a[k].h <= 0) k++;
			int r = a[k].h + abs(a[k].x - i) + abs(a[k].y - j);
			for (k = 0; k < n; k++) {
				if (max(r - abs(i - a[k].x) - abs(j - a[k].y), 0ll) != a[k].h) {
					goto loop;
				}
			}
			cout << i << " " << j << " " << r << endl;
			return 0;
		loop:;
		}
	}
}

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define intMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;

int n;
int main(){
  cin >> n;
  vector<ll>a(n+1);
  vector<ll>ans(n+1);
  ll sum = 0;
  rep(i,1,n+1){
    cin >> a[i];
    sum += a[i];
  }
  ll tmp_sum = 0;
  for(int i = 1; i <= (n-1)/2; i++){
    tmp_sum += 2 * a[2*i];
  }
  ans[1] = sum - tmp_sum;
  cout << ans[1] << " ";
  for(int i=1;i < n; i++){
    ans[i+1] = 2 * a[i] - ans[i];
    cout << ans[i+1] << " ";
  }
  cout << endl;
}


Measured memory_bytes: 2944
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> l(n + 1);
    l[0] = 2LL, l[1] = 1LL;
    for(int i = 2; i <= n; ++ i) {
        l[i] = l[i - 1] + l[i - 2];
    }
    cout << l[n] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3628
def gcd_core(a,b):
    if b == 0:
        return a
    else:
        return gcd_core(b,a%b)

def gcd(arr):
    g = gcd_core(arr[0],arr[1])
    for i in range(2,len(arr)):
        g = gcd_core(g,arr[i])
    return g

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

if a[0]==a[1] and a[1]==a[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import numpy as np
H,W=map(int,input().split())
X=np.array([list(input()) for _ in range(H)])
Y=np.array([[0]*(W+2)]*(H+2))

for i in range(H):
  for j in range(W):
    if X[i][j]=='#':
      Y[i+1][j+1]=1
      
hantei = True      
for i in range(1,H+1):
  for j in range(1,W+1):
    if Y[i][j]==1:
      if Y[i-1][j]==0 and Y[i+1][j]==0 and Y[i][j+1]==0 and Y[i][j-1]==0:
        hantei =False
        break
print('Yes' if hantei else'No')

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

#define SZ 100

int rowSum[SZ], fileSum[SZ];
  
int main(void){
  char fld[SZ][SZ];
  int w,h;
  
  cin >> h >> w;
  for (int i=0; i<h; i++){
    char buf[SZ];
    cin >> buf;
    for (int j=0; j<w; j++){
      fld[j][i] = buf[j];
      rowSum[i] += fld[j][i]=='#'?1:0;
      fileSum[j] += fld[j][i]=='#'?1:0;
    }
  }
  for (int i=0; i<h; i++){
    int flg=0;
    for (int j=0; j<w; j++){
      if (fileSum[j] && rowSum[i]){
        cout << fld[j][i];
        flg = 1;
      }
    }
    if (flg) cout << endl;
  }
}

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

int main() {
  int N;
  int a[110];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];

  sort(a, a + N, greater<int>());
  int Alice = 0;
  int Bob = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      Alice +=a[i];
    } else {
      Bob +=a[i];
    }
  }
  int res = Alice - Bob;
  cout << res << endl;
}


Measured memory_bytes: 256
k = int(input())
s = input()

buf = []
if len(s) <= k:
    print(s)
else:
    for i in range(k):
        buf.append(s[i])
    buf.append('.')
    buf.append('.')
    buf.append('.')
    for i in range(k + 3):
        print(buf[i], end="")

Measured memory_bytes: 9192
#include<stdio.h>
int main(){
	int m,f,r;
	scanf("%d%d%d",&m,&f,&r);
	while(m!=-1||f!=-1||r!=-1){
		if(m==-1||f==-1){
			printf("F\n");
		}
		else if(m+f>=80){
			printf("A\n");
		}
		else if(m+f>=65){
			printf("B\n");
		}
		else if(m+f>=50) printf("C\n");
		
		else if(m+f>=30&&r>=50) printf("C\n");
		
		else if(m+f>=30) printf("D\n");
		
		else printf("F\n");
		scanf("%d%d%d",&m,&f,&r);
	}
	return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	if (a == b && b == c) {
		if (a % 2 == 0) {
			cout << -1 << endl;
		}
		else {
			cout << 0 << endl;
		}
		
		return 0;
	}

	int count = 0;
	while (1) {
		if (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
			count++;
			int x = a / 2;
			int y = b / 2;
			int z = c / 2;
			a = x + y;
			b = y + z;
			c = z + x;
		}
		else {
			break;
		}
	}

	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <complex>

using namespace std;

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

typedef complex<int> P;

int w,h;

inline bool in(P const& p){
    return 1<=p.real() && p.real() <= w && 1<=p.imag() && p.imag() <= h;
}

int main(){
    while(cin>>w>>h, w|h){
        P cur = P(1,1);
        P d = P(0,1);
        while(true){
            string s; cin>>s;
            char op = s[0];
            if(op=='S'){
                cout << cur.real() << ' ' << cur.imag() << endl;
                break;
            } else if(op == 'F' || op == 'B'){
                P b = op == 'F' ? P(1,0) : P(-1,0);
                int k; cin>>k;
                rep(i,k){
                    P next = cur+d*b;
                    if(in(next)) cur = next;
                    else break;
                }
            } else if(op == 'R'){
                d/=P(0,1);
            } else if(op == 'L'){
                d*=P(0,1);
            }
        }
    }
}

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


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const int mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0):x(x%mod){}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		res -= a;
	}
	mint operator*(const mint a)const {
		mint res(*this);
		return res *= a;
	}
};

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};


/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
int main() {
	//sort(a.begin(),a.end());
	string s;
	cin >> s;
	bool a = false;
	rep(i, s.size()-1) {
		if (s[i] == s[i + 1]) a = true;
	}
	if (a) cout << "Bad";
	else cout << "Good";
	return 0; 
}









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

namespace AtCoder200531
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            ulong[] nums = Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();

            ulong result = 1;
            ulong old = 1;
            bool zero = false;
            bool over = false;

            foreach(ulong x in nums)
            {
                if (x == 0)
                {
                    zero = true;
                    break;
                }

                result *= x;

                if (result > 1000000000000000000)
                {
                    over = true;
                }
                if (result < old)
                {
                    over = true;
                }

                old = result;
            }

            if (zero)
            {
                Console.WriteLine(0);
            }
            else if(over)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(result);
            }

        }
    }
}


Measured memory_bytes: 41540
#include <iostream>
#include<string>
int main()
{
    int K;
    std::string S;
    std::cin>>K>>S;
    if(K>=S.size())
    std::cout<<S;
    else
    {
        for(int i=0;i<K;i++)
        std::cout<<S[i];
        std::cout<<"..."<<std::endl;
    }
    
}

Measured memory_bytes: 3616
import java.util.Scanner;

class Node {
	public int id;
	public int startTime = -1;
	public int finishTime = -1;
	int[] childrenIds;
	public Node[] children;
	
	public Node(int id, int[] children) {
		this.id = id;
		this.childrenIds = children;
		this.children = new Node[children.length];
	}
	
	public void getChildrenNodes(Node[] list) {
		for (int i = 0; i < this.childrenIds.length; i++) {
			for (int j = 0; j < list.length; j++) {
				if (this.childrenIds[i] == list[j].id) {
					this.children[i] = list[j];
				}
			}
		}
	}
}

public class Main {
	public static int currTime = 0;
	
	public static void traverseNode(Node node) {
		if (node.startTime != -1) return;
		
		node.startTime = currTime;
		
		for (int i = 0; i < node.children.length; i++) {
			if (node.children[i].startTime == -1) {
				currTime += 1;
				traverseNode(node.children[i]);
			}
		}
		
		currTime += 1;
		node.finishTime = currTime;
	}
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int numNodes = scanner.nextInt();
		Node[] nodes = new Node[numNodes];
		
		//create our graph
		for (int i = 0; i < numNodes; i++) {
			int id = scanner.nextInt();
			int numChildren = scanner.nextInt();
			int[] children = new int[numChildren];
			
			for (int j = 0; j < numChildren; j++) {
				children[j] = scanner.nextInt();
			}
			nodes[i] = new Node(id, children);
		}
		scanner.close();
		
		//first get children nodes of each node
		for (int i = 0; i < nodes.length; i++) {
			nodes[i].getChildrenNodes(nodes);
		}
		
		//traverse the nodes
//		traverseNode(nodes[0]);
		for (int i = 0; i < nodes.length; i++) {
			if (nodes[i].startTime == -1) currTime += 1;
			traverseNode(nodes[i]);
		}
		
		//say that we're done
		for (int i = 0; i < nodes.length; i++) {
			System.out.println(nodes[i].id + " " + nodes[i].startTime + " " + nodes[i].finishTime);
		}
	}
}



Measured memory_bytes: 28624