akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	int a, i;

	i = 1;
	while (1){
		scanf("%d", &a);

		if (a == 0){
			break;
		}
		else {
			printf("Case %d: %d\n", i, a);
		}
	i++;
	}
	
	return (0);
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		// 整数の入力
		double a = sc.nextInt();
		double b = sc.nextInt();
		double x = sc.nextInt();
		
		
		//String s = sc.next();

		//String[] ss = s.split("");

		//int[] a = new int[n];
		
		x= x/a;
		double ans = 0;
		
		
		if(x>a*b/2) {
			double s = b- (x-a*b/2)*2/a;
			ans = Math.atan(s/a);
		}else {
			double t = 2*x/b;
			ans = Math.atan(b/t);
		}

		System.out.println(ans*180/Math.PI);

		/*
		TreeMap<Integer,Integer> treeMap = new TreeMap<>();//sorted no duplication
		treeMap.put(b[n], n);
		*/

	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;


ll func(ll x){
    ll ans = 0;
    ll tmp = 1;
    while (x > 0){
        tmp *= x;
        x -= 2;
        if(tmp % 10 == 0){
            //cout << "x:" << x + 2 << endl;
            //cout << tmp << endl;
            tmp /= 10;
            ans++;
        }
        tmp %= 1000000000;
    }
    return ans;
}

ll sum(ll x, ll div){
    ll tmp = 0;
    while (x != 0)
    {
        x /= div;
        tmp ++;
    }
    
    return tmp;
}



int main(){

    ll n;
    cin >> n;

    if(n % 2){
        cout << 0 << endl;
        return 0;
    }


   ll ans = 0;
   for(ll i = 10ll; i <= n; i*= 5ll){
       ans += n / i;
   }
    cout << ans << endl;





}

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

int n;

int a[200005];


int main() {
	ios_base::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	int d = 0, x = 1;
	for (int i = 0; i < n; ++i) {
		if (a[i] == x) {
			++x;
			continue;
		} else {
			++d;
		}
	}
	if (d == n) {
		cout << -1 << endl;
	} else cout << d << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;

const int M = 1299800;
bool isPrime[M];

vector<int> primes;

void sieve(){
    for(int i=2;i<M;i++) isPrime[i] = true;
    for(int i=2;i*i < M;i++){
        if(!isPrime[i]) continue;
        for(int j=i*i;j<M;j+=i){
            isPrime[j] = false;
        }
    }
    for(int i=2;i<M;i++) {
        if(isPrime[i]) primes.push_back(i);
    }
}

int main(){
    sieve();
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        if(isPrime[n]){
            cout << 0 << endl;
        }else{
            cout << (*upper_bound(all(primes),n)) -  *(upper_bound(all(primes),n)-1) << endl;
        }
    }
    return 0;
}

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

using namespace std;

void init(vector<int>& v){
  int n = 0;
  int input;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> input;
    v.push_back(input);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}

int binarySearch(int key, vector<int> v, int count){
  int r = v.size(), l = 0;
  int m;
  while(l < r){
    m = (l + r)/2;
    if (key == v[m]) return count+1;
    else if(key < v[m]) r = m;
    else l = m + 1;
  }
  return count;
}

int main(int argc, char* argv[]){
  vector<int> a, b;
  int count = 0;
  init(a);
  init(b);
  for (auto i : a) count = binarySearch(i, b, count);
  cout << count << endl;
}

Measured memory_bytes: 3532
def solve():
    def measurement(a, b, w):
        a_root = root[a]
        b_root = root[b]
        if a_root != b_root:
            a_member = member[a_root]
            b_member = member[b_root]
            offset = w - (weight[b] - weight[a])
            if len(a_member) > len(b_member):
                a_member.extend(b_member)
                for n in b_member:
                    root[n] = a_root
                    weight[n] += offset
            else:
                b_member.extend(a_member)
                for n in a_member:
                    root[n] = b_root
                    weight[n] -= offset
    
    def inquiry(a, b):
        if root[a] == root[b]:
            return weight[b] - weight[a]
        else:
            return 'UNKNOWN'
                    
    import sys
    file_input = sys.stdin
    
    while True:
        N, M = map(int, file_input.readline().split())
        if N == 0:
            break
        
        root = [i for i in range(N + 1)]
        member = [[i] for i in range(N + 1)]
        weight = [0] * (N + 1)
        
        for _ in range(M):
            line = file_input.readline()
            if line[0] == '!':
                a, b, w = map(int, line[2:].split())
                measurement(a, b, w)
            else:
                a, b= map(int, line[2:].split())
                print(inquiry(a, b))

solve()


Measured memory_bytes: 36272
s = input().split(" ")

k = int(s[3])

sum = 0

if k >= int(s[0]) :
    sum += int(s[0])
    k -= int(s[0])
else :
    sum += k
    k =0

if k >= int(s[1]) :
    k -= int(s[1])
else :
    k =0

if k :
    sum -= k

print(sum)

Measured memory_bytes: 9100
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    ll right = 0, val = 0, xo = 0, ans = 0;
    for (ll left = 0; left < N; left++) {
        while (right < N && val + A[right] == (xo^A[right])) {
            val += A[right];
            xo ^= A[right];
            right++;
        }
        ans += (right - left);
        if (right == left) right++;
        val -= A[left];
        xo ^= A[left];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <set>
#include <vector>
using namespace std;

int main(){

  int n;
  cin >> n;
  int tmp;
  set<int> s;
  for(int i=0; i<n; ++i){
    cin >> tmp;
    s.insert(tmp);
  }

  if(s.size() == n) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 9728
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

    ok = max(A)
    ng = 0
    mid = (ok+ng) // 2
    while ok - ng > 1:
        cnt = 0
        for a in A:
            cnt += ((a-1) // mid)
        if cnt <= K:
            ok = mid
        else:
            ng = mid
        mid = (ok+ng)//2
    print(ok)


if __name__ == '__main__':
    main()


Measured memory_bytes: 92436
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <string>

#define repd(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
	int a;
	cin >> a;
	return a;
}

void inputArray(int *p,int a){
	rep(i,a){
		cin >> p[i];
	}
}

void inputVector(vector<int> *p,int a){
	rep(i,a){
		int input;
		cin >> input;
		p -> push_back(input);
	}
}

template <typename T>
void output(T a,int precision){
	if(precision > 0){
		cout << setprecision(precision) << a << "\n";
	}else{
		cout << a << "\n";
	}
}

int main(){
	//source
	int n,k;
	cin >> n >> k;
	int ans;
	if(n%k==0){
		ans=0;
	}else{
		ans=1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int,input().split()))
timestamp = [0]*n
position = 1
period = 0
start=0
for i in range(n*2):
  if timestamp[position-1] != 0:
    start = timestamp[position-1]
    period = i-timestamp[position-1]
    break
  timestamp[position-1] =i
  position = a[position-1]
  

if k <=start:
  position = 1
  for i in range(k):
    position = a[position-1]
  print(position)
  
else:
  cycle = (k-start)%period
  for i in range(cycle):
    position = a[position-1]
  print(position) 
  

Measured memory_bytes: 32384
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    maze = [input() for i in range(h)]
    now_x = now_y = 0
    is_used = [[False for j in range(w)] for i in range(h)]
    is_used[0][0] = True

    while True:
        now = maze[now_y][now_x]
        if now == '>':
            now_x += 1
        elif now == '<':
            now_x -= 1
        elif now == 'v':
            now_y += 1
        elif now == '^':
            now_y -= 1
        else:
            print(now_x, now_y)
            break
        if is_used[now_y][now_x]:
            print("LOOP")
            break
        is_used[now_y][now_x] = True

Measured memory_bytes: 7716
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,i,j;
	scanf("%d %d",&a,&s);
	d=a+s;
	if(d>=24)
		d=d-24;
	printf("%d\n",d);
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    if(N == 2){
        cout << -1 << endl;
        return 0;
    }
    string ans[1000];
    for(int i=0; i<N; i++) ans[i] = string(N, '.');

    string pat3[3], pat4[4], pat5[5], pat7[7];
    pat3[0] = "a..";
    pat3[1] = "a..";
    pat3[2] = ".bb";

    pat4[0] = "abcc";
    pat4[1] = "abdd";
    pat4[2] = "eegh";
    pat4[3] = "ffgh";

    pat5[0] = "aabbc";
    pat5[1] = "de..c";
    pat5[2] = "de..f";
    pat5[3] = "h.ggf";
    pat5[4] = "hiijj";

    pat7[0] = "aabbcc.";
    pat7[1] = "d..e..f";
    pat7[2] = "d..e..f";
    pat7[3] = ".gg.hhk";
    pat7[4] = "i..j..k";
    pat7[5] = "i..j..n";
    pat7[6] = ".ll.mmn";

    if(N%3 == 0){
        int n3 = N/3;
        int p = 0;
        while(n3--){
            for(int i=0; i<3; i++) for(int j=0; j<3; j++) ans[i+p][j+p] = pat3[i][j];
            p += 3;
        }
    }else{
        int n4, n5, n7;
        bool ok = false;
        for(n4=0; n4<N; n4++){
            for(n5=0; n5<N; n5++){
                int r = N - n4*4 - n5*5;
                if(r >= 0 && r%7 == 0){
                    n7 = r/7;
                    ok = true;
                    break;
                }
            }
            if(ok) break;
        }
        int p = 0;
        while(n4--){
            for(int i=0; i<4; i++) for(int j=0; j<4; j++) ans[i+p][j+p] = pat4[i][j];
            p += 4;
        }
        while(n5--){
            for(int i=0; i<5; i++) for(int j=0; j<5; j++) ans[i+p][j+p] = pat5[i][j];
            p += 5;
        }
        while(n7--){
            for(int i=0; i<7; i++) for(int j=0; j<7; j++) ans[i+p][j+p] = pat7[i][j];
            p += 7;
        }
        assert(p == N);
    }
    for(int i=0; i<N; i++) cout << ans[i] << endl;
    return 0;
}


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

long long int n,a[200010],i;
string s;
bool tr;

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	for (i=1;i<n+1;i++) cin>>a[i];
	sort(a+1,a+n+1);tr=true;
	for (i=2;i<n+1;i++) if (a[i]==a[i-1]) tr=false;
	if (tr) cout<<"YES";else cout<<"NO";
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;     
int main(){
	fastIO;                                  
	string s;
	cin>>s;
	int cnt=0;	
	for(int i=1;i<(int)s.size();i++){
		if(s[i]!=s[i-1])cnt++;
	}
	cout<<cnt<<'\n';
	return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int):
    print(N**3)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
typedef complex<double> Point;
const int Nmax = 1e5;
int N;
ll R, C;
ll X1[Nmax], Y1[Nmax], X2[Nmax], Y2[Nmax];

bool onEdge(ll x, ll y){
	return x==0 || x==R || y==0 || y==C;
}

ll linear(ll x, ll y){
	if(y == 0){
		return x;
	}
	else if(x == R){
		return R+y;
	}
	else if(y == C){
		return R+R+C-x;
	}
	else{
		return 2*R+2*C-y;
	}
}


int main(){
	cin >> R >> C >> N;
	for(int i=0; i<N; i++){
		cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
	}

	vector<pair<ll, int> > vec;
	for(int i=0; i<N; i++){
		if(onEdge(X1[i], Y1[i]) && onEdge(X2[i], Y2[i])){
			vec.push_back(make_pair(linear(X1[i], Y1[i]), i));
			vec.push_back(make_pair(linear(X2[i], Y2[i]), i));
		}
	}

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

	stack<int> st;
	vector<bool> instack(N);
	for(int i=0; i<vec.size(); i++){
		//cout << vec[i].first << " " << vec[i].second << endl;
		if(instack[vec[i].second]){
			if(st.top() != vec[i].second){
				cout << "NO" << endl;
				return 0;
			}
			else{
				st.pop();
				instack[vec[i].second] = false;
			}
		}
		else{
			st.push(vec[i].second);
			instack[vec[i].second] = true;
		}
	}

	cout << "YES" << endl;

	return 0;
}


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

struct mountain {
	int top = 0; int topn; int dis = 0;
};

string s; mountain m[10000]; int area[10000] = { 0 }, ff = 1, wind = 0;

int disp(int num) {
	int aa = 0, fff = 0, j = 0;
	for (int i = 0; i < num; i++)aa += area[i];
	if (!area[num - 1])num--;
	if (!area[0])num--, fff = 1, j++;
	if (num <= 0) num = 0;
	cout << aa << endl << num;
	if (0 < num) {
		if (j)num++;
		for (j; j < num; j++) cout << " " << area[j];
	}
	cout << endl;
	return 0;
}

int calc(int act, int *num) {
	int begin = *num - 1, lis = 0;
	for (begin; begin >= 0 && act > m[begin].top; begin--) {
		if (act - 1 == m[begin].top) lis++;
	}
	if (ff || begin == -1) return 1;

	int d = m[begin].dis, max = m[begin].top;
	for (int i = m[begin].topn; max >= act; i++) {
		if (s[i] == '\\')max--, d--;
		if (s[i] == '_')d--;
	}
	area[*num - 1] += d + 1;

	for (int i = *num - 1; i > *num - lis - 1; i--) {
		area[*num - 1 - lis] += area[i];
		area[i] = 0;
		m[i].dis = 0;
	}
	*num -= lis;

	return 1;
}

int main() {
	int num = 1, act = 0, flag = 0;
	m[0].topn = 0; cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '/') {
			act++;
			flag = calc(act, &num);
			m[num].top = act;
			m[num].topn = i + 1;
			wind = 1;
		}
		if (s[i] == '_')m[num].topn = i + 1;
		if (s[i] == '\\') {
			if (flag)num++, flag = 0;
			ff = 0, act--, wind = 1;
		}
		if (i == s.size() - 1 && !wind)num++;
		for (int j = 0; j < num;j++)m[j].dis++;
	}
	disp(num);

	return 0;
}

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define int long long int
mt19937 rng(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=200005;
#define M 1000000007
#define double long double
#define BINF 10000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 5000004
#define deb(x) cout << #x << " " << x << "\n";
const int LG = 22;

vector<pair<int, int>> adj[N];
int p[N];
int d[N];
 
void dijkstra(int s) {
 
    d[s] = 0;
    using pii = pair<int, int>;
    priority_queue<pii, vector<pii>, greater<pii>> q;
    q.push({0, s});
    while (!q.empty()) {
        int v = q.top().second;
        int d_v = q.top().first;
        q.pop();
        if (d_v != d[v])
            continue;
 
        for (auto edge : adj[v]) {
            int to = edge.first;
            int len = edge.second;
 
            if (d[v] + len < d[to]) {
                d[to] = d[v] + len;
                p[to] = v;
                q.push({d[to], to});
            }
        }
    }
}

#undef int 
int main() {
#define int long long int
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0);
 

 


    int n, x, y;
    cin >> n >> x >> y;
    for(int i = 1; i <= n - 1; i++){
        int u = i, v = i + 1, w = 1;
        adj[u].push_back(make_pair(v, w)); 
        adj[v].push_back(make_pair(u, w));
    }

    int u = x, v = y, w = 1;
    adj[u].push_back(make_pair(v, w)); 
    adj[v].push_back(make_pair(u, w));

    map<int, int>deep;
    for(int i = 1; i <= n; i++){

        for(int j = 0; j <= n; j++){
                d[j] = BINF, p[j] = -1;
        }

        dijkstra(i);
        for(int j = i + 1; j <= n; j++)
            deep[d[j]]++;
    }

    for(int i = 1; i < n; i++)
        cout << deep[i] << endl;
    
    





return 0;  
}

Measured memory_bytes: 6272
#include<iostream>
#include<vector>
#include<cstring>
#include<map>
#include<bitset>
#include<assert.h>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<set>
#include<queue>
#define long long long
using namespace std;
const int N=1e6,mod=1e9+7;
int aa[N+2],bb[N+2];
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;
  for(int i=1;i<=n;i++)cin>>aa[i]>>bb[i];
  long ans=0;
  for(int i=n;i>=1;i--)
  {
    int md=(ans+aa[i])%bb[i];
    if(md==0)md=bb[i];
    ans+=bb[i]-md;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4736
package main

import (
	"fmt"

	"os"
	"io"
	"bufio"
	"bytes"

	"strings"
	"strconv"
)

//  長い入力を読む
func ReadLongLines(times int) ([]string, error) {
	result := make([]string, times)
	reader := bufio.NewReader(os.Stdin)
	buffer := bytes.NewBuffer(make([]byte, 0))
	readBytes := int64(2)
	for i := 0; i < times; i++ {
		for {
			readBuf, isPrefix, err := reader.ReadLine()
			// fmt.Printf("Reader.Read: %d\n", len(readBuf))
			readBytes += int64(len(readBuf) + 1)
			if err != nil {
				if err == io.EOF {
					fmt.Println("EOF")
					break
				} else {
					return result, err
				}
			}
			_, err = buffer.Write(readBuf)
			if err != nil {
				return result, err
			}
			// end of line
			if !isPrefix {
				result[i] = buffer.String()
				buffer.Reset()
				// reader = bufio.NewReader(os.Stdin)
				break
			}
		}
	}
	// 先読みしてしまうようなので、戻しておく
	os.Stdin.Seek(-int64(reader.Buffered()), os.SEEK_CUR)
	return result, nil
}


// go だと固定長配列とか辛いので無理だった
type ListItem struct {
	value int
	prev *ListItem
	next *ListItem
}
type List struct {
	front *ListItem
	end *ListItem
	current *ListItem
}
func NewList() List {
	front := ListItem{0, nil, nil}
	end := ListItem{0, nil, nil}
	front.next = &end
	end.prev = &front
	return List{&front, &end, &end}
}

// INSERT
func (this *List)Insert(i int) {
	// fmt.Printf("insert: %d\n", i)
	item := ListItem{i, this.current.prev, this.current}
	this.current.prev.next = &item
	this.current.prev = &item
	this.current = &item
	// this.Dump()
}
func (this *List) Move(i int) {
	// fmt.Printf("move: %d\n", i)
	if 0 < i {
		for j := 0; j < i; j++ {
			this.current = this.current.next
		}
	} else {
		i = -i
		for j := 0; j < i; j++ {
			this.current = this.current.prev
		}
	}
	// this.Dump()
}
func (this *List) Erase() {
	if this.current.prev != nil {
		this.current.prev.next = this.current.next
	}
	if this.current.next != nil {
		this.current.next.prev = this.current.prev
	}
	this.current = this.current.next
}

func (this *List) First() *ListItem {
	return this.front.next
}
func (this *List) Next(item *ListItem) *ListItem {
	if item.next == this.end {
		return nil
	}
	return item.next
}

func (this *List) Dump() {
	fmt.Printf("front  : %v\n", this.front)
	fmt.Printf("end    : %v\n", this.end)
	fmt.Printf("current: %v\n", this.current)
	c := this.front
	for ; c != nil; c = c.next {
		fmt.Println(c.value)
	}
	fmt.Println("---- ---- ---- ----\n")
}



func main() {
	var q int
	fmt.Scanf("%d", &q)
	v := NewList()
	lines, _ := ReadLongLines(q)
	for _, line := range lines {
		args := strings.Split(line, " ")
		cmd := args[0]
		switch cmd {
		case "0": // insert
			x, _ := strconv.Atoi(args[1])
			v.Insert(x)
		case "1": // move
			x, _ := strconv.Atoi(args[1])
			v.Move(x)
		case "2": // erase
			v.Erase()
		}
	}
	// v.Dump()
	c := v.First()
	for ; c != nil; c = v.Next(c) {
		fmt.Println(c.value)
	}
}


Measured memory_bytes: 40328
N = input().rstrip()
money = [input().rstrip().split(" ") for i in range(int(N))]
total = 0.0

for i in range(int(N)):
    if str(money[i][1]) == "BTC":
        total += float(money[i][0])*380000.0
    else:
        total += float(money[i][0])
print(total)


Measured memory_bytes: 3060
n, k = map(int,input().split())
x = list(map(int, input().split()))

lis = [0]
for i in range(1,n):
    lis.append(lis[i-1] + abs(x[i]-x[i-1]))
#print(lis)
#print(x)
ans = int(1e10)
for i in range(n-k+1):
    val = min(abs(x[i]),abs(x[i+k-1])) + (lis[i+k-1]-lis[i])
    #print(val,ans)
    #print(ans)
    if val < ans:
        ans = val

print(ans)

Measured memory_bytes: 14224
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

#define fst first
#define snd second
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef pair<int,int> pii;

int n,m;
int dp[210];
pii dolls[210];

const int inf=1<<27;

int main(void){
	while(cin >> n ,n){
		rep(i,210) dp[i]=0;

		rep(i,n) cin >> dolls[i].fst >> dolls[i].snd;
		cin >> m;
		rep(i,m) cin >> dolls[n+i].fst >> dolls[n+i].snd;
		
		sort(dolls,dolls+n+m);

		dp[0]=1;
		rep(i,n+m){
			rep(j,i){
				if(dolls[i].fst > dolls[j].fst && dolls[i].snd > dolls[j].snd)
					dp[i]=max(dp[i],dp[j]+1);
			}
			//cout << dolls[i].fst << " " << dolls[i].snd << endl;
			//cout << i << endl;
			//cout << dp[i] << endl;
		}
		int ans=0;
		rep(i,n+m){
			ans=max(ans,dp[i]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

int dp[MX];

int main() {
  int n,t;
  scanf("%d%d",&n,&t);
  vp p(n);
  cin>>p;
  sort(rng(p));
  int ans = 0;
  rep(i,n) {
    int a = p[i].fi;
    int b = p[i].se;
    drep(j,t) {
      maxs(ans, dp[j]+b);
      maxs(dp[j+a],dp[j]+b);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define F first
#define S second
#define MK make_pair
const int E=1e9+7;







int main(){
    int a,b;
    cin>>a>>b;
    if(a+b==15){cout<<"+"<<endl;}
    else if(a*b==15){cout<<"*"<<endl;}
    else{cout<<"x"<<endl;}
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  int i, j, n, m, p, x, temp;
  long sum = 0;

  int a[100];

  scanf("%d", &n);

  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);

  scanf("%d", &m);

  for (i = 0; i < m; i++) {
    scanf("%d%d", &p, &x);
    temp = a[p - 1];
    a[p - 1] = x;
    sum = 0;
    for (j = 0; j < n; j++)
     sum += a[j];

    printf("%ld\n", sum);
    a[p - 1] = temp;
  }

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    string N;
    cin >> N;
    ll dp[11][8][2]={};
    ll i, j, l;
    
    dp[0][0][1]=1;
    
    /*このdpは、ちょうどN.size桁のものしか考慮できていないので、あとでN.size桁未満で条件を満たすものを加える必要がある。
      3,5,7しか見ていないのでN=3600などのとき、3桁で条件を満たすはずの357などは0357と見なされはじかれてしまうから。*/
    for(i=0; i<N.size(); i++) {
        for(j=0; j<8; j++) {
            
            for(l=3; l<=7; l+=2) {
                dp[i+1][j | 1<<(l/2-1)][0]+=dp[i][j][0];
            }
            
            ll max=N[i]-'0';
            for(l=3; l<max; l+=2) {
                dp[i+1][j | 1<<(l/2-1)][0]+=dp[i][j][1];
            }
            
            if(max==3 || max==5 || max==7) {
                dp[i+1][j | 1<<(max/2-1)][1]+=dp[i][j][1];
            }
            
        }
        
    }
    
    ll ans=dp[N.size()][7][0]+dp[N.size()][7][1];
    
    //N.size桁未満で3,5,7が一回以上含まれるようなものの個数を足す。
    for(i=3; i<N.size(); i++) {
        ans+=pow(3, i)-3*(pow(2, i)-2)-3;
    }
    
    pr(ans);
    
}















Measured memory_bytes: 640
# Problem B - Digit Sums

# input
N = input()
N_str = list(N)
N_num = int(N)

# initialization
digit_sum = 0

# count
for n in N_str:
    tmp = int(n)
    digit_sum += tmp

# check
if N_num%digit_sum==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38384
class Node
  attr_accessor :key, :left, :right
  def initialize key
    @key = key
  end

  def inorder
    left.inorder if left
    print ' ', key
    right.inorder if right
  end

  def preorder
    print ' ', key
    left.preorder if left
    right.preorder if right
  end
end

def insert
  z = Node.new $key
  x = $root
  while x
    y = x
    x = z.key < x.key ? x.left : x.right
  end

  unless y
    $root = z
  else
    z.key < y.key ? y.left = z : y.right = z
  end
end

def find root
  if root == nil
    puts 'no'
  elsif $key == root.key
    puts 'yes'
  elsif $key < root.key
    find root.left
  else
    find root.right
  end
end

gets.to_i.times {
    command, $key = gets.split
    $key=$key.to_i
    if command == 'insert'
      insert
    elsif command == 'find'
      find $root
    else
      $root.inorder
      puts
      $root.preorder
      puts
    end
}

Measured memory_bytes: 149080
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl

//ここから編集する


int main() {
    int N, C;
    cin >> N >> C;
    vector<pair<int, int> > cst[C + 1];
    int imos[200005] = {};
    rep(i, 0, N) {
        int s, t, c;
        cin >> s >> t >> c;
        cst[c].emplace_back(s, t);
    }
    rep(i, 0, C + 1) {
//        cout << "i = " << i << endl;
        sort(all(cst[i]));
        for (int j = 0; j < cst[i].size(); j++) {
//            cout << "first :" << cst[i][j].first << ",second :" << cst[i][j].second << endl;
            if (j > 0) {
                if (cst[i][j - 1].second == cst[i][j].first) {
//                    imos[cst[i][j].first * 2]++;
                    imos[cst[i][j-1].second * 2 + 1]++;
                    imos[cst[i][j].second * 2 + 1]--;
                } else {
                    imos[cst[i][j].first * 2 - 1]++;
                    imos[cst[i][j].second * 2 + 1]--;
                }
            } else {
                imos[cst[i][j].first * 2 - 1]++;
                imos[cst[i][j].second * 2 + 1]--;
            }
        }
    }

    rep(i, 1, 200005) {
        imos[i] += imos[i - 1];
    }
    int ans = 0;
    rep(i, 0, 200005) {
        ans = max(ans, imos[i]);
    }


    cout << ans << endl;


//    int a,b,c;
//    cin >> a >> b >> c;
//    vector<int> v[a][b][c];
//    int ar[a][b][c];
//    rep(i,0,a){
//        rep(j,0,b){
//            rep(k,0,c){
//                cin >> ar[i][j][k];
//            }
//        }
//    }
//    rep(i,0,a){
//        rep(j,0,b){
//            rep(k,0,c){
//                cout << ar[i][j][k] << " ";
//            }
//            cout << endl;
//        }
//        cout << "---" << endl;
//    }

    return 0;
}


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

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    //freopen("input.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cout<<29192<<"\n";

    cout<<"+ "<<0<<" "<<0<<" "<<3<<"\n";
    cout<<"< "<<0<<" "<<3<<" "<<10<<"\n";

    cnt = 2;

    for(int i=1;i<30;i++){
        cout<<"+ "<<9+i<<" "<<9+i<<" "<<10+i<<"\n";
        cnt++;
    }

    for(int i=29;i>=0;i--){
        cout<<"+ "<<10+i<<" "<<50<<" "<<51<<"\n";
        cout<<"< "<<0<<" "<<51<<" "<<900<<"\n";
        cout<<"< "<<900<<" "<<10<<" "<<900<<"\n";

        cnt+=3;

        for(int j=1;j<=i;j++){
            cout<<"+ "<<900<<" "<<900<<" "<<900<<"\n";
            cnt++;
        }

        cout<<"+ "<<900<<" "<<50<<" "<<50<<"\n";
        cout<<"< "<<1000<<" "<<900<<" "<<100+i<<"\n";

        cout<<"< "<<51<<" "<<1000<<" "<<51<<"\n";

        cnt+=3;
    }

    cout<<"< "<<50<<" "<<1000<<" "<<50<<"\n";

    cnt++;

    for(int i=29;i>=0;i--){
        cout<<"+ "<<10+i<<" "<<50<<" "<<51<<"\n";
        cout<<"< "<<1<<" "<<51<<" "<<900<<"\n";
        cout<<"< "<<900<<" "<<10<<" "<<900<<"\n";
        cnt+=3;
        for(int j=1;j<=i;j++){
            cout<<"+ "<<900<<" "<<900<<" "<<900<<"\n";
            cnt++;
        }

        cout<<"+ "<<900<<" "<<50<<" "<<50<<"\n";
        cout<<"< "<<1000<<" "<<900<<" "<<200+i<<"\n";
        cout<<"< "<<200+i<<" "<<10<<" "<<200+i<<"\n";

        cout<<"< "<<51<<" "<<1000<<" "<<51<<"\n";
        cnt+=4;
    }

    for(int i=0;i<30;i++){
        for(int j=0;j<30;j++){

            cout<<"< "<<200+j<<" "<<100+i<<" "<<300<<"\n";
            cnt++;
            for(int t=1;t<=i+j;t++){
                cout<<"+ "<<300<<" "<<300<<" "<<300<<"\n";
                cnt++;
            }
            cout<<"+ "<<2<<" "<<300<<" "<<2<<"\n";
            cnt++;
        }
    }

    assert(cnt==29192);

    return 0;
}


Measured memory_bytes: 3672
#include<cstdio>
typedef long long ll;
const int N=2003,M=924844033;
int n,m,fac[N],f[N+N][N],t,a[N+N],ans;
int main(){
	scanf("%d%d",&n,&m);
	fac[0]=1;
	for(int i=1;i<=n;i++)fac[i]=(ll)fac[i-1]*i%M;
	a[t=0]=1;
	for(int i=1;i<=(n-m)%m;i++)
	  a[t+=(n-m)/m+1]=1,a[t+=(n-m)/m+1]=1;
	for(int i=1;i<=m-(n-m)%m;i++)
	  a[t+=(n-m)/m]=1,a[t+=(n-m)/m]=1;
	f[0][0]=1;
	for(int i=1;i<=t;i++)
	  for(int j=0;j<=n;j++)
		f[i][j]=(f[i-1][j]+(j?f[i-1-(!a[i-1])][j-1]:0))%M;
	for(int j=0;j<=n;j++)
	  ans=(ans+(ll)f[t][j]*fac[n-j]%M*(j&1?M-1:1))%M;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 33000
#include <vector>
#include <iostream>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <cmath>
#include <utility>
#include <bitset>
#include <complex>
#include <stack>
#include <tuple>
#include <math.h>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll INF = 1e15;
const double eps=1e-8;
const ll MOD = (1e9)+7;
const ll MAX_N = 1 << 17;

typedef ll Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

Graph g;
vector<ll> power;
ll N;
bool dame;
ll solve(ll now, ll to){
	vector<ll> flow;
	ll sum=0;
	for(int i=0;i<g[now].size();i++){
		if(g[now][i].dst==to)
			continue;
		flow.push_back(solve(g[now][i].dst, now));
		sum+=flow[flow.size()-1];
	}
	if(flow.empty())
		return power[now];
	ll naibu=sum-power[now];
	if(naibu<0)
		return dame=true;
	ll l=0;
	ll r=flow.size()-1;
	sort(flow.begin(),flow.end());
	while(l<r && naibu>0){
		ll syori=min(flow[l], min(flow[r], naibu));
		flow[l]-=syori;
		flow[r]-=syori;
		if(flow[l]==0)
			l++;
		if(flow[r]==0)
			r--;
		naibu-=syori;
		if(naibu==0)
			break;
	}
	if(naibu>0 && l==r && r<flow.size()-1){
		ll syori=min(naibu, flow[l]/2);
		naibu-=syori;
	}
	if(naibu>0)
		dame=true;
	if(sum==power[now] && now == to)
		return 0;
	return power[now]-(sum-power[now]);
}

int main(){
	cin >> N;
	power =vector<ll>(N);
	for(int i=0;i<N;i++)
		cin >> power[i];
	g = Graph(N);
	dame=false;
	for(int i=0;i<N-1;i++){
		ll a,b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(Edge(a,b,0));
		g[b].push_back(Edge(b,a,0));
	}
	ll ans=solve(0,0);
	if(ans==0 && !dame)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 18688
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
A, B = map(int, input().split())

for i in range(1, 1010):
    if int(i * 0.08) == A and int(i * 0.1) == B:
        print(i)
        break
else:
    print(-1)

Measured memory_bytes: 9468
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
  int res = 1;
  x = x % p;
  while (y > 0)
  {

    if (y & 1)
      res = (res * x) % p;

    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc;
  tc = 1;
  //cin>>tc;
  while(tc--){
    int n, m;
    cin >> n >> m;
    int sum = 0;
    vector<int> v;
    for (int i = 0; i < n;i++){
      int a;
      cin >> a;
      sum += a;
      v.pb(a);
    }
    sum = ceil((sum * 1.0 )/ (1.0*4 * m));
    sort(all(v));
    int i = n - 1;
    while(m){
      if(v[i]>=sum){
        m--;
        i--;
      }
      else{
        break;
      }
    }
    if(m){
      cout << "No" << endl;
    }
    else
    {
      cout << "Yes" << endl;
    }
    
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define vsort(xx) sort(xx.begin(),xx.end())
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
 set<string> s;
 long n;string str;
 cin>>n;
 while(n--){
     cin>>str;
     s.insert(str);
 }
 cout<<s.size();
    return 0;
}




Measured memory_bytes: 19244
#include<iostream>
using namespace std;
int main()
{
    string S,T;
    cin >> S;
    cin >> T;

    int len = T.length();
    int i,j;
    int cnt = 0;
    int mincnt = S.length();
    for(i=0; i<=S.length()-len; i++){
        cnt=0;
        for(j=0;j<len;j++){
            if(S[i+j]!=T[j]) cnt++;
        }
        if(mincnt>cnt){
            mincnt = cnt;
        }
    }
    cout << mincnt << endl;

    return 0;
}


Measured memory_bytes: 3108
from itertools import combinations_with_replacement
n, m, q = map(int, input().split())
list_ABCD = [ list(map(int,input().split(" "))) for _ in range(q)]
list_N = [i for i in range(1, m+1)]
ans = 0

for l in combinations_with_replacement(list_N, n):
    score = 0
    for a, b, c, d in list_ABCD:
        if l[b-1] - l[a-1] == c:
            score += d
    ans = max(ans, score)

print(ans)

Measured memory_bytes: 9192
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.S;
		Console.WriteLine("{0}",(s[0]-'a')>=0?"a":"A");
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 25820
N,X,Y = map(int,input().split())
X,Y = X-1,Y-1
A = [0]*(N+1)
for i in range(N):
    for j in range(N):
        if i>=j:continue
        a = min(j-i-1, abs(j-X)+abs(i-Y),abs(j-Y)+abs(i-X))+1
        A[a]+=1
for i in range(1,N):
    print(A[i])

Measured memory_bytes: 3444
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007
#define PI 3.141592653589793238462643383279

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int a,b,h,m;
	cin >> a >> b >> h >> m;
	//hour hand
	ld hx=0, hy=a;
	ld hdeg = h*30+ld(m)/60*30;
	if(0<=hdeg&&hdeg<=90){
		hdeg /= 2;
		hdeg = PI*hdeg/180;
		hx += a*sin(2*hdeg);
		hy -= 2*a*sin(hdeg)*sin(hdeg);
	}else if(90<=hdeg&&hdeg<=180){
		hdeg = 180-hdeg;
		hdeg /= 2;
		hdeg = PI*hdeg/180;
		hx += a*sin(2*hdeg);
		hy = -a;
		hy += 2*a*sin(hdeg)*sin(hdeg);
	}else if(180<=hdeg&&hdeg<=270){
		hdeg = hdeg-180;
		hdeg /= 2;
		hdeg = PI*hdeg/180;
		hx -= a*sin(2*hdeg);
		hy = -a;
		hy += 2*a*sin(hdeg)*sin(hdeg);
	}else{
		hdeg = 360-hdeg;
		hdeg /= 2;
		hdeg = PI*hdeg/180;
		hx -= a*sin(2*hdeg);
		hy -= 2*a*sin(hdeg)*sin(hdeg);
	}
	//minute hand
	ld mx=0, my=b;
	ld mdeg = m*6;
	if(0<=mdeg&&0<=90){
		mdeg /= 2;
		mdeg = PI*mdeg/180;
		mx += b*sin(2*mdeg);
		my -= 2*b*sin(mdeg)*sin(mdeg);
	}else if(90<=mdeg&&mdeg<=180){
		mdeg = 180-mdeg;
		mdeg /= 2;
		mdeg = PI*mdeg/180;
		mx += b*sin(2*mdeg);
		my = -b;
		my += 2*b*sin(mdeg)*sin(mdeg);
	}else if(180<=mdeg&&mdeg<=270){
		mdeg = mdeg-180;
		mdeg /= 2;
		mdeg = PI*mdeg/180;
		mx -= b*sin(2*mdeg);
		my = -b;
		my += 2*b*sin(mdeg)*sin(mdeg);
	}else{
		mdeg = 360-mdeg;
		mdeg /= 2;
		mdeg = PI*mdeg/180;
		mx -= b*sin(2*mdeg);
		my -= 2*b*sin(mdeg)*sin(mdeg);
	}
	//cout << hx << ' ' << hy << ' ' << mx << ' ' << my << endl;
	ld disx = mx-hx, disy = my-hy;
	//cout << disx << ' ' << disy << endl;
	ld dis = disx*disx + disy*disy;
	dis = sqrt(dis);
	cout << fixed << setprecision(20) << dis << endl;
}	


Measured memory_bytes: 4108
# -*- coding: utf-8 -*-
"""
A - Changing a Character
https://atcoder.jp/contests/abc126/tasks/abc126_a

"""
import sys


def solve(N, K, S):
    ans = ''
    for i, s in enumerate(S, start=1):
        if i == K:
            ans += s.lower()
        else:
            ans += s
    return ans


def main(args):
    N, K = map(int, input().split())
    S = input()
    ans = solve(N, K, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3060
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
#n,m= (int(i) for i in input().split())      #入力整数横2つ
a,b,c = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
d = a
for i in range(100):
    if a%b == c:j(1)
    a+=d
j(0)

Measured memory_bytes: 21616