akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int n,x[100],y[100],i=0,j,k;
double ans,d[205],P=acos(-1);
main(){
	cin>>n;
	for(;i<n;i++)cin>>x[i]>>y[i];
	for(i=0;i<n;i++){
		k=ans=0;
		for(j=0;j<n;j++)if(i-j)d[k++]=atan2(y[j]-y[i],x[j]-x[i]);
		sort(d,d+k);
		for(j=0;j<k;j++)d[j+k]=d[j]+2*P;
		for(j=0;j<k;j++)ans=max(ans,P-d[j+k-1]+d[j]);
		cout<<ans/2./P<<'\n';
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int darahMusuh;
    int attackServal;
    int jumlahSerangan;
    
    scanf("%d %d", &darahMusuh, &attackServal);
    jumlahSerangan=darahMusuh/attackServal;
    darahMusuh%attackServal!=0?jumlahSerangan+=1:jumlahSerangan;
    printf("%d", jumlahSerangan);


    return 0;
}

Measured memory_bytes: 1712
program problemA
  implicit none

integer :: S, L, R
integer :: N, m, yr, a,b,c


read(*,*) N

a=int(N/100)
N=N-100*int(N/100)
b=int(N/10)
N=N-10*int(N/10)
c=N

if (a==7) then
  write(*,*) 'Yes'
  stop
else if (b==7) then
  write(*,*) 'Yes'
  stop
else if (c==7) then
  write(*,*) 'Yes'
  stop
else
  write(*,*) 'No'
end if



stop
end program


Measured memory_bytes: 2784
#include<iostream>
using namespace std;
int main(){
	int a;
	int b;
	int c;
	cin>>a;
	cin>>b;
	cin>>c;
	if(a<b&&b<c){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#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()
static const int INF (1<<30);
typedef long long ll;

int main() {
  ll N; cin >> N;
  ll x[5];
  rep(i, 5) cin >> x[i];

  ll minx = *min_element(x, x+5);

  ll ans = 4LL + (N + (minx - 1LL)) / minx;

  cout << ans << endl;

  return 0;
}

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


int main (){
    int s[1000]= {0};
    int n;
    int i = 0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    sort(s,s+n);
    printf("%d\n",s[n-1]-s[0]);
    return 0;
}


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

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


void solve()
{
   int n;
   cin>>n;
   cout<<n+n*n+n*n*n<<endl;
}


int main()
 {  fast();
    solve();
	return 0;
}

Measured memory_bytes: 3608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt( br.readLine());
		Node[] tree = new Node[n];
		//??¨??????????????????????????????????????£?????????
		for(int i = 0; i < n; i++){
			tree[i] = new Node(i);
		}
		
		for(int i = 0; i < n; i++){
			
			String[] tmpArray = br.readLine().split(" ");
			
			int inputID = Integer.parseInt(tmpArray[0]);
			int childNum = Integer.parseInt(tmpArray[1]);
			for(int j = 0; j < childNum ; j++){
				int tmpIndex = Integer.parseInt(tmpArray[j + 2]);
				tree[inputID].addChild(tree[tmpIndex]);
				tree[tmpIndex].parent = inputID;
				//tree[tmpIndex].depth = tree[inputID].depth + 1;
				//System.out.println("test");
			}
			
		}
		/*
		for(int i = 0; i < n; i++){
			
			int childNum = tree[i].children.size();
			for(int j = 0; j < childNum ; j++){
				int tmpIndex = tree[i].children.get(j).id;
				//tree[tmpIndex].parent = inputID;
				tree[tmpIndex].depth = tree[i].depth + 1;
				//System.out.println("test");
			}
			
		}*/
		for(int i = 0; i < n ;i++){
			if(tree[i].parent == -1){
				tree[i].initDepth(0);
				break;
			}
		}
			
		
		for(int i = 0; i < n; i++){
			System.out.print("node " + tree[i].id + ": parent = " + tree[i].parent + ", depth = "
					+ tree[i].depth + ", " + tree[i].type() + ", ");
			tree[i].printChildren();
			System.out.println();
		}
	}

}

class Node {
	int parent = -1;
	int id = -1;
	ArrayList<Node> children = new ArrayList<Node>();
	int depth = 0;
	
	public Node (int id){
		this.id = id;
	}
	
	public void addChild(Node n){
		children.add(n);
	}
	
	public void printChildren(){
		System.out.print("[");
		for(int i = 0; i < children.size(); i++){
			System.out.print(children.get(i).id);
			if(i != children.size() - 1){
				System.out.print(", ");
			}
		}
		System.out.print("]");
	}
	
	public String type(){
		if(parent == -1){
			return "root";
		}
		else if(children.size() == 0){
			return "leaf";
		}
		else{
			return "internal node";
		}
	}
	
	public void initDepth(int depth){
		this.depth = depth;
		
		for(int i = 0; i < children.size() ; i++){
			children.get(i).initDepth(depth + 1);
		}
	}
}

Measured memory_bytes: 108048
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

template <class T> inline bool chmin(T &a, const T &b) {
  return (a > b) ? a = b, true : false;
}

template <class T> inline bool chmax(T &a, const T &b) {
  return (a < b) ? a = b, true : false;
}

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  long long H, W;
  std::cin >> H >> W;

  long long res;
  if (H == 1 or W == 1) {
    res = 1;
  } else if (H % 2 == 0 and W % 2 == 0) {
    res = (H * W / 2);
  } else if (H % 2 == 1 and W % 2 == 0) {
    res = ((H - 1) * W / 2) + W / 2;
  } else if (H % 2 == 0 and W % 2 == 1) {
    res = ((H) * (W - 1) / 2) + H / 2;
  } else {
    res = ((H - 1) * (W - 1) / 2) + H / 2 + W / 2 + 1;
  }

  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int q;
    string x,y;
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>x>>y;
        int m=x.size();
        int n=y.size();
        int c[m+1][n+1];
        for(int j=0;j<=m;j++){
            c[j][0]=0;
        }
        for(int j=1;j<=n;j++){
            c[0][j]=0;
        }
        for(int j=1;j<=m;j++){
            for(int k=1;k<=n;k++){
                if(x[j-1]==y[k-1]){
                    c[j][k]=c[j-1][k-1]+1;
                }
                else{
                    c[j][k]=max(c[j-1][k],c[j][k-1]);
                }
            }
        }
        cout<<c[m][n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 7036
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    int N; cin >> N;
    vector<int> f(N+1);
    for (int x = 1; x*x < N; x++) {
        for (int y = 1; x*x + y*y + x*y < N; y++) {
            for (int z = 1; x*x + y*y + z*z + x*y + y*z + z*x <= N; z++) {
                f[x*x + y*y + z*z + x*y + y*z + z*x]++;
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        cout << f[i] << endl;
    }
}


Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int ans = 0;
int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a*500+b*100+c*50<c)
    {
        cout << 0<<endl;
        return 0;
    }
    for(int i = 0; i <= a; i++)
    {
        if(i*500>d)
        {
            cout<<ans<<endl;
            return 0;
        }
        for(int j = 0; j <= b; j++)
        {
            if(j*100+i*500>d) break;
            for(int k = 0; k <= c; k++)
            {
                if(i*500+j*100+k*50==d)
                {
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using ll = long long;

template<typename A>
void out_(A a) {
	for(auto k : a) 
		std::cerr << k << ' ';
	std::cerr << '\n';
}

int const inf = 1e9;

void init(std::vector<int>& mx, int n, int val) {
	mx.resize(n * 2 + 5);
	for(int i = 0; i < n * 2 + 5; ++i)
		mx[i] = val;
}

void motifiy(std::vector<int>& mx, int k, int l, int r, int pos, int val) {
	if(l == r) {
		mx[k] = val;
		return ;
	}
	int mid = (l + r) >> 1;
	if(pos <= mid) 
		motifiy(mx, k << 1, l, mid, pos, val);
	else 
		motifiy(mx, k << 1 | 1, mid + 1, r, pos, val);
	mx[k] = std::max(mx[k << 1], mx[k << 1 | 1]);
}

int query(std::vector<int>& mx, int k, int l, int r, int _l, int _r) {
	if(l == _l && r == _r)
		return mx[k];
	int mid = (l + r) >> 1;
	if(_r <= mid)
		return query(mx, k << 1, l, mid, _l, _r);
	if(_l > mid)
		return query(mx, k << 1 | 1, mid + 1, r, _l, _r);
	return std::max(query(mx, k << 1, l, mid, _l, mid), query(mx, k << 1 | 1, mid + 1, r, mid + 1, _r));
}

int main() {
	std::ios::sync_with_stdio(0);
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	for(int i = 0; i < n; ++i)
		std::cin >> a[i];

	std::vector<int> b(n, 0);
	int mx = 0;
	for(int i = 0; i < n; ++i) {
		if(a[i] > mx) 
			b[i] = 2;
		else
			b[i] = 1;
		mx = std::max(mx, a[i]);
	}

	std::vector<int> fenw_odd, fenw_even;
	init(fenw_odd, (n + 1) * 2, -inf);
	init(fenw_even, (n + 1) * 2, 0);

	for(int i = n - 1; i >= 0; --i) {
		int odd = -inf, even = 0;
		if(b[i] == 1) {
			even = query(fenw_odd, 1, 1, n + 1, a[i] + 1, n + 1) + 1;
			odd = query(fenw_even, 1, 1, n + 1, a[i] + 1, n + 1) + 1;
		} else {
			even = query(fenw_even, 1, 1, n + 1, a[i] + 1, n + 1) + 2;
			odd = query(fenw_odd, 1, 1, n + 1, a[i] + 1, n + 1) + 2;
		}
		if(even > 0)
			motifiy(fenw_even, 1, 1, n + 1, a[i], even);
		if(odd > 0)
			motifiy(fenw_odd, 1, 1, n + 1, a[i], odd);
	}

	int sum = 0;
	for(int i = 0; i < n; ++i)
		sum += b[i] == 2;

	auto chk = [&] (int val, int need) -> bool {
		if(need < 0) 
			return 0;
		val = std::max(val, 1);
		if(need & 1) 
			return query(fenw_odd, 1, 1, n + 1, val, n + 1) >= need;
		else 
			return query(fenw_even, 1, 1, n + 1, val, n + 1) >= need;
	};

	if(chk(1, sum) == 0) {
		std::cout << -1 << '\n';
		return 0;
	}

	std::string ans;
	int diff = 0, mx0 = 0, mx1 = 0;
	for(int i = 0; i < n; ++i) {
		sum -= b[i] == 2;
		motifiy(fenw_odd, 1, 1, n + 1, a[i], -inf);
		motifiy(fenw_even, 1, 1, n + 1, a[i], 0);
		if(mx0 < a[i]) {
			if(chk(a[i], sum - (diff + 1)) || chk(mx1, sum + diff + 1)) {
				ans += '0';
				++diff;
				mx0 = a[i];
			} else {
				ans += '1';
				if(mx1 < a[i]) {
					--diff;
					mx1 = a[i];
				}
			}
		} else {
			if(chk(mx0, sum - diff) || chk(mx1, sum + diff)) 
				ans += '0';
			else {
				ans += '1';
				if(mx1 < a[i]) {
					--diff;
					mx1 = a[i];
				}
			}
		}
	}
	std::cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 8580
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    mat = [list(map(int, readline().split())) for _ in range(n)]

    cur = 0
    for a, b in mat[::-1]:
        a2 = a + cur
        cur += (b - (a2 % b)) % b

    print(cur)


if __name__ == '__main__':
    main()


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

void insert(int);
void inorder(Node);
void preorder(Node);
Node  find(Node,int);
void delete(Node );
Node treeSuccessor(Node);
Node treeMinimum(Node);
Node root;
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x!=NIL){
    y=x;
    if(z->key < x->key){
        x = x->left;
    }else{
      x = x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else {if(z->key < y->key){
      y->left = z;
    }else{
        y->right = z;
    }
  }
}

void inorder(Node t){
  if(t==NIL) return;
  inorder(t->left);
  printf(" %d",t->key);
  inorder(t->right);
}
void preorder(Node t){
  if(t==NIL)return;
  printf(" %d",t->key);
  preorder(t->left);
  preorder(t->right);
}
Node find(Node t,int k){
  while(t!=NIL && k!=t->key){
    if(k<t->key)
      t=t->left;
    else
      t=t->right;
  }
  return t;
}
void delete(Node a){
  Node y;
  Node x;
  if(a->left==NIL||a->right==NIL)
    y=a;
  else
    y=treeSuccessor(a);
  if(y->left!=NIL){
    x=y->left;
  }
  else{
    x=y->right;
  }
  if(x!=NIL){
    x->parent=y->parent;
  }
  if(y->parent==NIL){
    root=x;
  }
  else{
    if(y==y->parent->left){
      y->parent->left=x;
    }
    else{
      y->parent->right=x;
    }
  }
  if(y!=a){
    a->key=y->key;
  }
  free(y);
}
Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL)
    return treeMinimum(x->right);
  y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
Node treeMinimum(Node x){
  while(x->left!=NIL){
    x=x->left;
  }
  return x;
}
    
int main(){
  int n, i, a;
  char com[20];
  Node u;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &a);
      insert(a);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( com[0] == 'f' ){
      scanf("%d", &a);
      u=find(root,a);
      if(u!=NIL)printf("yes\n");
      else printf("no\n");
    }
    else if(com[0] == 'd'){
      scanf("%d",&a);
      delete(find(root,a));
    }
  }
  return 0;
}


Measured memory_bytes: 20480
#include <math.h>
#include <stdio.h>
#include <algorithm>

#define EPS 1e-10

using namespace std;

int func(double x1, double y1, double x2, double y2, double xp, double yp) {
    double naiseki, norm1, norm2, gaiseki;
    norm1   = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
    norm2   = sqrt((xp - x1) * (xp - x1) + (yp - y1) * (yp - y1));
    naiseki = (xp - x1) * (x2 - x1) + (yp - y1) * (y2 - y1);
    gaiseki = (x2 - x1) * (yp - y1) - (xp - x1) * (y2 - y1);
    if (gaiseki > EPS) {
        return 1;
    } else if (gaiseki < -EPS) {
        return -1;
    }

    if (naiseki < -EPS) {
        return 2;
    }

    if (norm1 < norm2) {
        return -2;
    }
    return 0;
}

int main() {
    double x1, x2, x3, x4, y1, y2, y3, y4;
    int    q;
    scanf("%d", &q);

    for (int i = 0; i < q; i++) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3,
              &x4, &y4);

        if (func(x1, y1, x2, y2, x3, y3) * func(x1, y1, x2, y2, x4, y4) <= 0 &&
            func(x3, y3, x4, y4, x1, y1) * func(x3, y3, x4, y4, x2, y2) <= 0) {
            printf("1\n");
        } else {
            printf("0\n");
        }
    }

    return 0;
}



Measured memory_bytes: 2752
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <queue>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

typedef int weight;
struct edge {
	int to;
	weight cost;
	edge(int t, weight c):to(t), cost(c){}
};
typedef pair<weight, int> P;
constexpr int INF = 0xfffffff;

vector<int> dijkstra(int s, int cap, const vector<vector<edge>>& es) {
	priority_queue<P, vector<P>, greater<P> > que;
	vector<int> dist(es.size(), INF);
	que.push(P(0, s));
	dist[s] = 0;

	while(!que.empty()) {
		const P p = que.top();
		que.pop();
		const int v = p.second;

		if(dist[v] < p.first)
			continue;

		for(int i = 0; i < (int)es[v].size(); ++i) {
			const edge& e = es[v][i];
			const weight next_dist = dist[v] + e.cost;
			if(next_dist > cap * 10) continue;

			if(dist[e.to] > next_dist) {
				dist[e.to] = next_dist;
				que.push(P(dist[e.to], e.to));
			}
		}
	}

	return dist;
}

unordered_map<string, int> en;
inline int encode(const string& s) {
	if(!en.count(s)) en.insert(make_pair(s, en.size()));
	return en[s];
}

inline int input_city() {
	string s;
	cin >> s;
	return encode(s);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	for(int n, m, cap; cin >> n >> m >> cap && n;) {
		en.clear();
		const int s = input_city();
		const int t = input_city();

		vector<tuple<int, int, int>> edges;
		edges.reserve(n);
		for(int i = 0; i < n; ++i) {
			const int a = input_city();
			const int b = input_city();
			int cost;
			cin >> cost;
			edges.emplace_back(a, b, cost);
		}

		const int number_of_city = static_cast<int>(en.size());
		vector<vector<edge>> es(number_of_city);
		for(int i = 0; i < n; ++i) {
			int a, b, cost;
			tie(a, b, cost) = edges[i];
			es[a].emplace_back(b, cost);
			es[b].emplace_back(a, cost);
		}

		vector<int> dist = dijkstra(s, cap, es);
		for(int i = 0; i < m; ++i) {
			const int next = input_city();
			vector<int> tmp = dijkstra(next, cap, es);
			for(int i = 0; i < number_of_city; ++i) {
				chmin(dist[i], dist[next] + tmp[i]);
			}
		}

		cout << (dist[t] == INF ? -1 : dist[t]) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 2096
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


using namespace std;

// vector<vector<int>> mat(N, vector<int>(M, 0));

int main(int argc, const char *argv[])
{
    //ABC136_C
    int N;
    cin>>N;
    vector<int> vec(N,0);
    for (int i = 0; i < N; i++)
    {
        cin>>vec[i];
    }

    int check = 1;
    //右からやるといい
    for (int i = N-1; i >= 0; i--)
    {
        if (vec[i + 1] - vec[i] == -1)
            vec[i]--;
    }

    for (int i = 0; i < N-1; i++)
    {
        if(vec[i+1]-vec[i] <= -1)
        check = 0;
    }
    
    if(check == 1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

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

	if ( (a*100 + b*10 + c) % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;
 
#define fi first
#define se second
 
int main(){
    string s;
    int a, b, c;
    cin >> s;
    a = atoi(s.substr(0, 4).c_str());
    b = atoi(s.substr(5, 2).c_str());
    c = atoi(s.substr(8, 2).c_str());
    if(a <= 2019 && b <= 4 && c <= 30)cout << "Heisei";
    else cout << "TBD";
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int R, G, B, N;
    scanf("%d %d %d %d", &R, &G, &B, &N);

    int numOfSets = 0;
    for (int r = 0; r <= N; r += R)
    {
        for (int rg = r; rg <= N; rg += G)
        {
            if ((N - rg) % B == 0)
            {
                numOfSets++;
            }
        }
    }
    printf("%d\n", numOfSets);

    return 0;
}


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

namespace ABC157B
{
    class Program
    {
        static void Main(string[] args)
        {
            var As = new int[3][];
            for (var i = 0; i < 3; i++)
                As[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var N = int.Parse(Console.ReadLine());

            var bs = new HashSet<int>();
            for (var i = 0; i < N; i++)
                bs.Add(int.Parse(Console.ReadLine()));

            for (var i = 0; i < 3; i++)
            {
                var bingo = true;
                for (var j = 0; j < 3; j++)
                    bingo &= bs.Contains(As[i][j]);

                if (bingo)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            for (var i = 0; i < 3; i++)
            {
                var bingo = true;
                for (var j = 0; j < 3; j++)
                    bingo &= bs.Contains(As[j][i]);

                if (bingo)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            if (bs.Contains(As[0][0]) && bs.Contains(As[1][1]) && bs.Contains(As[2][2]))
            {
                Console.WriteLine("Yes");
                return;
            }
            if (bs.Contains(As[0][2]) && bs.Contains(As[1][1]) && bs.Contains(As[2][0]))
            {
                Console.WriteLine("Yes");
                return;
            }

            Console.WriteLine("No");
        }
    }
}


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

int main(void)
{
  char s[19];
  for(int i=0;i<19;i++){
    cin>>s[i];
  }
  for(int i=0;i<19;i++){
    if(s[i]==',')
      s[i]=' ';
  }
  for(int i=0;i<19;i++){
    cout<<s[i];
  }
  cout<<endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string q;
  cin >> q;
  if(q.at(0) == q.at(1)) {
    if(q.at(1) == q.at(2)) {
      cout << "No" << endl;
    }
    else{
      cout << "Yes" << endl;
  }
  }
  else {
    cout << "Yes" << endl;
  }
}

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


bool pairCompare(const P& firstElof, const P& secondElof){
  return firstElof.second < secondElof.second;
}

int main(){
  int n;
  int cnt=0;
  cin >> n;
  vector <int> x(n),l(n);
  vector <P> p(n);
  rep(i,n)cin >> x[i] >> l[i];
  rep(i,n){
    p[i]=P(x[i]-l[i],x[i]+l[i]);
  }
  sort(p.begin(),p.end(),pairCompare);
  //rep(i,n)cout << p[i].first << " " << p[i].second << endl;;
  int right=p[0].second;
  cnt+=1;
  for(int i=1;i<n;i++){
    if(p[i].first<right)continue;
    right=p[i].second;
    cnt+=1;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
# coding: utf-8
while 1:
    n,m=map(int,input().split())
    if n==0:
        break
    taro=[]
    hana=[]
    for i in range(n):
        taro.append(int(input()))
    for i in range(m):
        hana.append(int(input()))
    t_sum=sum(taro)
    h_sum=sum(hana)
    d=t_sum-h_sum
    mn=99999999
    ans=[-1]
    for i in range(n):
        for j in range(m):
            if (t_sum-taro[i]+hana[j])==(h_sum-hana[j]+taro[i]):
                if mn>taro[i]+hana[j]:
                    mn=taro[i]+hana[j]
                    ans=(taro[i],hana[j])
    print(*ans)


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

int main(){
    ll n,cnt=0;
    cin>>n;
    ll a[200005];
    ll maxnum=0;
    for(int i=0;i<n;i++) cin>>a[i];

    for(int i=0;i<n;i++){
        chmax(maxnum,a[i]);
        cnt+=maxnum-a[i];
    }
    cout<<cnt<<endl;
    return 0;

}

Measured memory_bytes: 5116
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

typedef long long ll;
typedef pair <int, int> ii;

const int Maxn = 100005;

int n;
vector <ii> neigh[Maxn];
int q, k;
ll res[Maxn];

void Solve(int v, int p)
{
	for (int i = 0; i < neigh[v].size(); i++) {
		ii u = neigh[v][i];
		if (u.first == p) continue;
		res[u.first] = res[v] + u.second;
		Solve(u.first, v);
	}
}

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		int a, b, c; scanf("%d %d %d", &a, &b, &c);
		neigh[a].push_back(ii(b, c));
		neigh[b].push_back(ii(a, c));
	}
	scanf("%d %d", &q, &k);
	Solve(k, 0);
	for (int i = 0; i < q; i++) {
		int x, y; scanf("%d %d", &x, &y);
		cout << res[x] + res[y] << endl;
	}
	return 0;
}

Measured memory_bytes: 15360
#include <iostream>

int main() {
	unsigned long long low, high;
	
	std::cin >> low >> high;
	
	if (high - low >= 2019) { 
		std::cout << 0; 
		return 0;
	}
	int low_mod_2019, high_mod_2019, min = 3000;
	low_mod_2019 = low % 2019;
	high_mod_2019 = high % 2019;
	for (int i = low_mod_2019; i < high_mod_2019; i++) {
		for (int j = low_mod_2019 + 1; j <= high_mod_2019; j++) {
			int result = (i * j) % 2019;
			min = min > result ? result : min;
		}
	}
	
	std::cout << min;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

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

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    ll cur = v[0];
    for (int i = 1; i < n; i++) {
        ll tmp = gcd(cur, v[i]);
        cur /= tmp;
        cur *= v[i];
    }
    cout << cur << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>

using namespace std;

int main() {
	int n, *nums, counter = 0;

	cin >> n;
	nums = (int *)malloc(sizeof(int) * n);

	for (int i = 0; i < n; i++) cin >> nums[i];
	
	for (int i = 0; i < n - 1; i++)
	{
		int mini = i;
		for (int j = i + 1; j < n; j++)
			if (nums[mini] > nums[j]) mini = j;
			
		if (mini != i) {
			int tmp = nums[i];
			nums[i] = nums[mini];
			nums[mini] = tmp;
			counter++;
		}
	}

	for (int i = 0; i < n; i++)
	{
		cout << nums[i];
		if (i != n - 1) cout << " ";
	}

	cout << endl << counter << endl;

	return 0;
}

Measured memory_bytes: 1192
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N := ReadInt()
	ps := ReadFloats(N)

	dp := make([][]float64, N+1)
	for i, _ := range dp {
		dp[i] = make([]float64, N+1)
	}

	dp[0][0] = 1
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			dp[i+1][j+1] += dp[i][j] * ps[i]
			dp[i+1][j] += dp[i][j] * (1 - ps[i])
		}
	}

	ans := 0.0
	for i := N/2 + 1; i <= N; i++ {
		ans += dp[N][i]
	}
	fmt.Println(ans)
}

var ps []float64

func f(i int, j int) float64 {
	if i < j {
		return 0
	}
	if i == 0 && j == 0 {
		return 1
	}
	return f(i-1, j)*(1-ps[i-1]) + f(i-1, j-1)*ps[i-1]
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadFloats(n int) []float64 {
	v := make([]float64, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 76940
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n, m;
vector<llong> a;

llong lca(llong x, llong y) {
    return x / __gcd(x, y) * y;
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        llong x;
        cin >> x;
        a.push_back(x);
    }

    llong lc = 1;
    for (int i = 0; i < n; i++) {
        lc = lca(lc, a[i]);
    }

    lc /= 2;
    for (int i = 0; i < n; i++) {
        if (lc % a[i] != a[i] / 2) {
            cout << 0 << endl;
            return 0;
        }
    }

    if (m < lc) {
        cout << 0 << endl;
        return 0;
    }
    cout << 1 + (m - lc) / (lc * 2) << endl;
    
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using Graph = vector<vector<ll>>;
vector<ll> G[100005];
ll par[100005];
bool seen[100005];

void dfs(int prev, int v)
{
  seen[v] = true;
  par[v] = prev;
  for (auto next_v : G[v])
  {
    if (seen[next_v])
      continue;
    dfs(v, next_v);
  }
}

int main()
{
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++)
  {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  ll dist[100005];
  ll ans[100005]; 
  queue<int> que;

  fill(dist,dist + 100005,-1);
  fill(ans,ans + 100005,-1);
  

  
  dist[1] = 0;
  ans[1] = 1;
  que.push(1); 


  while (!que.empty())
  {
    int v = que.front(); 
    que.pop();

    
    for (int nv : G[v])
    {
      if (dist[nv] != -1)
        continue; 

      ans[nv] = v;
      dist[nv] = dist[v] + 1;
      que.push(nv);
    }
  }



  bool flagseen = true;
  for (int i = 1; i <= n; i++)
  {
    if (dist[i] == -1)
      flagseen = false;
  }

  if (flagseen)
  {
    cout << "Yes" << endl;
    for (int i = 2; i <= n; i++)
    {
      cout << ans[i] << endl;
    }
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 13528
#include <iostream>
#include <queue>
#include <string>

using namespace std;

struct B {
	int button, count;
};

string blist[] = {
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz"
};	

int main() {
	int inputn;
	cin >> inputn;
	for(int i=0; i<inputn; i++){
		string input;
		cin >> input;
		queue<B> q;
		for(int j=0; j<input.size(); j++) {
			int count = 0;
			int button = input[j] - '0';
			for (; input[j] != '0'; j++) {
				count++;
			}
			if (count!=0) q.push({button, count});
		}
		
		while (!q.empty()) {
			B b = q.front(); q.pop();
			//cout << b.count << endl;
			cout << blist[b.button][(b.count-1) % blist[b.button].size()];
		}
		cout << endl;

	}
	return 0;
}

Measured memory_bytes: 1208
n = int(input())
s = "MARCH"
d = { i:0 for i in s }
for _ in range(n):
  f =  input()[0]
  if f in s:
    d[f] += 1
ans = 0
for i in range(3):
  for j in range(i+1, 4):
    for k in range(j+1, 5):
      ans += d[s[i]]*d[s[j]]*d[s[k]]
print(ans)

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{

    ll n;
    double sum=0.0;
    cin >> n;
    while(n--)
    {

        double x;
        cin >> x;
        sum+=1.0/x;
    }
    printf("%.6lf\n", 1.0/sum);
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,j,k;
    scanf("%d",&i);
    if(i >= 1 && i <= 9)
    {
        printf("%d\n",i);
    }
    else if(i >= 10 && i <= 99)
    {
        printf("9\n");
    }
    else if(i >= 100 && i <= 999)
    {
        j = (i - 100) + 1;
        k = j + 9;
        printf("%d\n",k);
    }
    else if(i >= 1000 && i <= 9999)
    {
        printf("909\n");
    }
    else if(i >= 10000 && i <= 99999)
    {
        j = (i - 10000) + 1;
        k = j + 900 + 9;
        printf("%d\n",k);
    }
    else if(i >= 100000 && i <= 999999)
    {
        printf("90909\n");
    }
    return 0;
}


Measured memory_bytes: 1696
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  int T;
  cin>>T;
  for(int i=0; i<T; ++i){
    ll A,B,C,D;
    cin>>A>>B>>C>>D;
    bool CAN=true;
    
    if(A<B) CAN=false;
    if(D<B) CAN=false;
    if(C<B){
      ll G=gcd(B,D);
      if(C%B<(B-G+A%G)%B) CAN=false;
    }
    
    if(CAN) COYe;
    else CONo;
  }
  return 0;
}

Measured memory_bytes: 256
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut $ iter = s . split_whitespace ( ) ; input_inner ! { $ iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , mut $ var : usize $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , $ var : usize $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , { chars : $ base : expr } ) => { read_value ! ( $ iter , String ) . chars ( ) . map ( | c | ( c as u8 - $ base as u8 ) as usize ) . collect ::< Vec < usize >> ( ) } ; ( $ iter : expr , { char : $ base : expr } ) => { read_value ! ( $ iter , { chars : $ base } ) [ 0 ] } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , char ) => { read_value ! ( $ iter , chars ) [ 0 ] } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
fn main() {
    input! { n, a: [usize; n], b: [usize; n] };
    let mut idx = (0..n).collect::<Vec<_>>();
    idx.sort_by_key(|&i| b[i]);
    let a = idx.iter().map(|&i| a[i]).collect::<Vec<_>>();
    let b = idx.iter().map(|&i| b[i]).collect::<Vec<_>>();
    let mut idx = (0..n).collect::<Vec<_>>();
    idx.sort_by_key(|&i| a[i]);
    let mut ans = true;
    if (0..n).any(|i| a[idx[i]] > b[i]) {
        ans = false;
    } else {
        let mut vis = vec![false; n];
        vis[0] = true;
        let mut i = idx[0];
        while !vis[i] {
            vis[i] = true;
            i = idx[i];
        }
        if vis.iter().all(|&b| b) {
            if (0..n - 1).all(|i| b[i] < a[idx[i + 1]]) {
                ans = false;
            }
        }
    }
    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

typedef long long LL;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int mod = 1e9 + 7;
const int oo = 0x7fffffff;

template<typename T> T read() {
	T n(0), f(1);
	char ch = getchar();
	for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

long long N, A, B;

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    cin >> A >> B;

    if(abs(A - B) >= 2) { return puts("0"), 0; }

    LL fac1 = 1, fac2 = 1;
    for(int i = 1; i <= A; i++) fac1 = fac1 * i % mod;
    for(int i = 1; i <= B; i++) fac2 = fac2 * i % mod;

    printf("%lld\n", ((A == B) + 1) * fac1 *fac2 % mod);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;

int main(){
	int n, l[200], cnt = 0;
	scanf("%d", &n);
	for (int i = 0; i < 2 * n; i++){
		scanf("%d", &l[i]);
	}
	sort(l, l + 2 * n);
	for (int i = 0; i < 2 * n; i++){
		if (!(i & 1)){
			cnt += l[i]; 
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int cnt=0;

    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=s[s.size()-1-i])
        {
            cnt++;
        }
    }
    cout<<cnt/2<<endl;//jeheto 2 ta number omil hole 1bar swap korte hoy
    exit(0);
}


Measured memory_bytes: 3644
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ADoubleHelix solver = new ADoubleHelix();
        solver.solve(1, in, out);
        out.close();
    }

    static class ADoubleHelix {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char c = in.next().charAt(0);
            if (c == 'A') out.println('T');
            if (c == 'T') out.println('A');
            if (c == 'G') out.println('C');
            if (c == 'C') out.println('G');
        }

    }
}



Measured memory_bytes: 21716
#include <iostream>
#include <map>
#include <vector>
using namespace std;
using Map = map<char, int>;

template <class T> inline bool chmin(T& a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int n;
  cin >> n;
  string s;
  vector<Map> maps(n);
  for(int i = 0; i < n; ++i) {
    cin >> s;
    for(int j = 0; j < s.size(); ++j) {
      maps[i][s[j]]++;
    }
  }

  for(int i = 0; i < 26; ++i) {
    int mnv = 1000;
    char a = 'a' + i;
    for(int j = 0; j < maps.size(); ++j) {
      chmin(mnv, maps[j][a]);
    }
    for(int j = 0; j < mnv; ++j) {
      cout << a;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABeginner solver = new ABeginner();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABeginner {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int r = in.nextInt();
            int res;
            if (n >= 10) {
                res = r;
            } else {
                res = r + 100 * (10 - n);
            }
            out.println(res);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream in) {
            this(new InputStreamReader(in));
        }

        public FastReader(InputStreamReader input) {
            br = new BufferedReader(input);
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    String s = br.readLine();
                    if (s == null)
                        return null;
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

    }
}



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

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

  int Y=0;

  int i;
  for(i=0;i<n;i++) {
    string input;
    cin >> input;
    
    if(input=="Y") Y=1;
  }

  
  if(Y) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
n = input()
k = int(input())
l = len(n)
dp0 = [[0 for _ in range(k+1)] for i in range(l+1)]
dp1 = [[0 for _ in range(k+1)] for i in range(l+1)]
dp0[0][0] = 1
for i in range(l):
  t = int(n[i])
  for j in range(k+1):
    if j == 0:
      dp0[i+1][j] = 0 if t != 0 else dp0[i][j]
      dp1[i+1][j] = dp1[i][j]
      if t != 0:
        dp1[i+1][j] += dp0[i][j]
    else:
      if t != 0:
        dp0[i+1][j] =  dp0[i][j-1]
      else:
        dp0[i+1][j] = dp0[i][j]
      dp1[i+1][j] = dp1[i][j] + dp1[i][j-1]*9
      if t != 0:
        dp1[i+1][j] += dp0[i][j]
      dp1[i+1][j] += dp0[i][j-1]*max(t-1, 0)
print(dp0[l][k] + dp1[l][k])

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

const int mod = 1000000007;
//const int mod = 998244353;
const int INF = 1001001001;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    if(s[0] == 'A'){
        ans++;
    }
    int cnt = 0;
    rep(i, 2, s.size()-1){
        if(s[i] == 'C') cnt++;
    }
    if(cnt == 1) ans++;
    cnt = 0;
    rep(i, 0, s.size()){
        if('a' <= s[i] && s[i] <= 'z') continue;
        if(s[i] == 'A' || s[i] == 'C') continue;
        else cnt++;
    }
    if(cnt == 0) ans++;
    if(ans == 3) cout << "AC" << endl;
    else cout << "WA" << endl;
    return 0;
}


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

int func(long long a){
    int ans = 0;
    while(1){
        if(a % 2 == 0){
            a = a / 2;
            ans++;
        }else{
            break;
        }
    }

    return ans;
}

int main(void){
    int n; cin >> n;
    int ans = 100000;

    for(int i = 0; i < n; i++){
        long long a; cin >> a;
        ans = min(ans, func(a));
    }

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

Measured memory_bytes: 256
N = int(input())
W = list(map(int,input().split()))
li = [0]
sum = 0
min = 10**9
for i in range(N):
    sum += W[i]
    li.append(sum)
for j in range(N):
    if min> abs((li[-1]-li[j])-li[j]):
        min = abs((li[-1]-li[j])-li[j])
print(min)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,d;cin>>n>>m>>d;
  double ans = 0;
  ans += (double)(n-d)*(m-1)*(1+(d>0))/(n*n);
  printf("%.7lf\n",ans);
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
double pie=3.14159265358979;
long long mod=998244353;
//
int main(){
	int x,n;
	int p[100];
	cin>>x>>n;
	set<int> s;
	for(int i=0;i<n;i++){
		cin>>p[i];
		s.insert(p[i]);
	}
	int ans;
	int sa=1e9+7;
	for(int i=x-1000;i<=x+1000;i++){
		if(s.find(i)==s.end()){
			if(sa>abs(i-x)){
				sa=abs(i-x);
				ans=i;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3640