akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define ft front()
#define bk back()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
template <class t> bool ckmin(t& a, const t& b) { return a > b ? a = b, true : false; }
template <class t> bool ckmax(t& a, const t& b) { return a < b ? a = b, true : false; }
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p);
template <class T> struct IsC {
  template <class C>
  static char test(typename C::const_iterator*);
  template <class C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <> struct IsC<string> { static const bool value = false; };
template <class C> typename enable_if<IsC<C>::value, ostream&>::type operator<<( ostream& o, const C& c) { o << '{'; for (auto it = c.begin(); it != c.end();) o << *it << (++it != c.end() ? ", " : "}"); return o; }
template <class a, class b> ostream& operator<<(ostream& o, const pair<a, b>& p) { return o << '(' << p.fi << ", " << p.se << ')'; }


void solve() {
    int n;
    cin >> n;

    unordered_set<string> s;
    F0R(i, n) {
        string str;
        cin >> str;
        s.insert(str);
    }
    cout << SZ(s) << endl;
}

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

    solve();
}




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

using namespace std;

int main () {
	string s1, s2;
	while (cin >> s1, s1 != ".") { 
		cin >> s2;
		if (s1 == s2) {
			cout << "IDENTICAL" << endl;
			continue;
		}
		bool quote = false, flag = true;
		int mcnt = 0, i = 0, j = 0;
		while (i < s1.size () && j < s2.size ()) {
			if (s1[i] == '"' && s2[j] == '"') quote ^= true;
			if (s1[i] != s2[j]) {
				if (!quote || mcnt >= 1) {
					flag = false;
					break;
				}
				while (s1[i] != '"') i++;
				while (s2[j] != '"') j++;
				mcnt++;
				quote = false;
			}
			i++, j++;
		}
		if (i != s1.size () || j != s2.size ()) flag = false;
		cout << (flag ? "CLOSE" : "DIFFERENT") << endl;
	}

	return 0;
}


Measured memory_bytes: 3140
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int count = 0;
		for(int i = 0; i < n; i++){
			int now = a[i];
			while(now%2==0) {
				now/=2;
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 47848
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    int a[n];
    REP(i,n){
        cin >> a[i];
    }
    int ans = 0;
    int now = 1;
    REP(i,n){
        if(a[i] == now){
            now++;
        }else{
            ans++;
        }
    }
    if(now == 1) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

const int MOD = 998244353;

class P2 {
public:
	explicit P2(int x = 0, int y = 0) : x(x), y(y) {}
	int x, y;
};

int cross(const P2& a, const P2& b, const P2& c){
	int dx1 = b.x - a.x;
	int dy1 = b.y - a.y;
	int dx2 = c.x - a.x;
	int dy2 = c.y - a.y;
	return dx1 * dy2 - dx2 * dy1;
}

int main(){
	vector<int> pow2(300);
	pow2[0] = 1;
	for(int i=1;i<pow2.size();i++) pow2[i] = 2 * pow2[i-1] % MOD;
	int N;
	while(cin >> N){
		vector<P2> vp(N);
		for(auto& p : vp) cin >> p.x >> p.y;
		int res = pow2[N];
		res = (res + MOD - (1+N)) % MOD;
		vector<vector<int>> checked(N, vector<int>(N, 0));
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				if(checked[i][j]) continue;
				vector<int> idx;
				for(int k=0;k<N;k++){
					if(!cross(vp[i], vp[j], vp[k])) idx.push_back(k);
				}
				int sub = pow2[idx.size()] - idx.size() - 1;
				res = (res + MOD - sub) % MOD;
				for(int k=0;k<idx.size();k++){
					for(int l=k+1;l<idx.size();l++){
						checked[idx[k]][idx[l]] = 1;
					}
				}
			}
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 384
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      double x = (double) (a+b)/2;
      double y = (a+b)/2;
      if(x == y) System.out.println((a+b)/2);
      else System.out.println("IMPOSSIBLE");
    }
}

Measured memory_bytes: 23892
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	LL N, K;
	cin >> N >> K;
	LL ans = 0;
	LL L = 0;
	LL R = N;
	for (int i = 1; i <= N+1; ++i) {
		if (i >= K) {
			LL A = (R - L + MOD + 1) % MOD;
			ans = (ans + A) % MOD;
		}
		L = (L+i)%MOD;
		R = (R + (N - i)) % MOD;
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 3648
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,avx2,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0)
typedef long long ll;


ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

//#######################################

int main(){
  boost;
  
  string s1,s2;
  cin>>s1>>s2;
  int count=0;
  for(int i=0;i<s1.size();i++){
	  if(s1[i]!=s2[i])
	  count++;
  }
  cout<<count;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define M 1000000007
using namespace std;
typedef unsigned long long ll;
ll dp[500][500];
ll rec(ll i,ll j,ll c[]){
	if(i==j)return 0;
	if(dp[i][j]!=-1){
		return dp[i][j];
	}
	ll mini=(ll)pow(2,63)-1;
	for(ll k=i;k<j;k++){
		mini=min(mini,rec(i,k,c)+rec(k+1,j,c)+c[j]-c[i-1]);
	}
	return dp[i][j]=mini;
}
int main() {
	// your code goes here
	ll n,i,j;
	cin>>n;
	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			dp[i][j]=-1;
		}
	}
	ll a[n+1];
	ll c[n+1];
	c[0]=0;
	for(i=1;i<=n;i++){cin>>a[i],c[i]=a[i];}
	for(i=1;i<=n;i++){
		c[i]=c[i]+c[i-1];
	}
	/*for(i=1;i<=n;i++){
		cout<<c[i]<<" ";
	}*/
	ll ans=rec(1,n,c);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

N, M = LI()
L, R = [], []
for i in range(M):
    x, y = LI()
    L.append(x)
    R.append(y)

if min(R) - max(L) >= 0:
    print(min(R) - max(L)+1)
else:
    print(0)


Measured memory_bytes: 11024
#include <iostream>

int main() {
    int N;
    int V[20];
    int C[20];
    std::cin >> N;
    for (int i = 0; i < N; ++i) {
        std::cin >> V[i];
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        std::cin >> C[i];
        if (V[i] > C[i]) {
            ans += V[i] - C[i];
        }
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

R=[a,b,c,d,e,k]

for i in range(5):
 f=R[i]-R[0]
 g=R[i]-R[1]
 h=R[i]-R[2]
 j=R[i]-R[3]
 if f>k or g>k or h>k or j>k:
  print(":(")
  exit()
print("Yay!")


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <stack>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N;
int c[13];
vector<int> V;

int calc_MIN(int b){ // 0 <=  b < 1<<24
  int MIN=12;
  int prev = -1;
  bool flag = false;
  rep(i, 25)  {
    if (i==0) continue;
    int mask = 1<<i;
    if (b & mask) {
      if (!flag) MIN = i;
      else MIN = min(MIN, i-prev);
      prev = i;
      flag = true;
    }
  }
  return MIN;
}

void create_vec(int idx, stack<int> st) {
  if (idx==13) {
    int d=1;
    while(!st.empty()) {
      int q = st.top();st.pop();
      d+=(1<<q);
    }
    d+=(1<<24);
    V.push_back(d);
    return;
  }
  if (c[idx]==1) {
    st.push(idx);
    create_vec(idx+1, st);
    st.pop();
    if (idx < 12) {
      st.push(24-idx);
      create_vec(idx+1, st);
    }
  } else if (c[idx]==2) { // 同じものに関しては最終的に0になり、候補外 
    st.push(idx);
    st.push(24-idx);
    create_vec(idx+1, st);
  }
  else create_vec(idx+1, st);
}

int main() {
  INCANT;
  cin >> N;
  int d;
  rep(i, N) {
    cin >> d;
    c[min(24-d, d)]++;
  }
  c[0]++; // 高橋
  if (c[0]>1 || c[12]>1) {
    cout << 0 << endl;
    return 0;
  }
  rep(i,13) {
    if (c[i]>2) {
      cout << 0 << endl;
      return 0;
    }
  }
  stack<int> st;
  create_vec(1, st);
  int MAX=0;
  rep(i, V.size()) MAX  = max(MAX, calc_MIN(V[i]));
  cout << MAX << endl;
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
b = list(map(int, input().split()))

ans = []
fault = False
for _ in range(N):
    for cursol in range(len(b) - 1, -1, -1):
        if b[cursol] == cursol + 1:
            ans.append(b.pop(cursol))
            break
    else:
        fault = True
if fault:
    print(-1)
else:
    ans.reverse()
    for el in ans:
        print(el)

Measured memory_bytes: 38736
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int N,M;
ll dp[100010];
#define MOD 1000000007
//int A[100010];
ll call(int n)
{
    if(n==0) return 1;
    if(n<0) return 0;
    if(dp[n]!=-1) return dp[n];
    return dp[n]=((call(n-1))%MOD+(call(n-2))%MOD)%MOD;
}
int main()
{
cin>>N>>M;
memset(dp,-1,sizeof(dp));
for(int i=0;i<M;i++)
{
    int x;
    cin>>x;
    dp[x]=0;
}
cout<<(call(N))%MOD;
    return 0;
    
}

Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
   int H, W;
   cin >> H >> W;
   vector<string> a;
   for(int h=0; h < H; h++){
      string s;
      cin >> s;
      a.push_back(s);
   }

   // true  : '#'
   // false : '.'
   vector<bool> height(H, false), width(W, false);

   for(int h=0; h < H; h++){
      for(int w=0; w < W; w++){
         if(a[h][w] == '#'){
            height[h] = true;
            width[w] = true;
         }
      }
   }

   for(int h=0; h < H; h++){
      // false : '.' : continue
      if(!height[h]){continue;}
      for(int w=0; w < W; w++){
         if(!width[w]){continue;}
         cout << a[h][w];
      }
      cout << endl;
   }
   return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = 1234567;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	
	cout<<a+b+c-max(a,max(b,c))+max(a,max(b,c))*10<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  NodePointer st;
  for(st=nil->next;;st=st->next){
    if(st==nil || st->key==key)break;
  }
  return st;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if(t != nil){
    t->next->prev = t->prev;
    
    t->prev->next = t->next;
    free(t);
  }
  
  
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  deleteNode(nil->prev);
  

  
}

void delete(int key){
  /* your code */
  NodePointer a;
  a = listSearch(key);
  deleteNode(a);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  /*your code */
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 33052
#include<stdio.h>
#include<math.h>

using namespace std;

int main(){
    int n;
    while(true){
        double s[1000]={0};
        double m=0,a=0;
        scanf("%d",&n);
        if(n==0) break;
        for(int i=0;i<n;i++){
            scanf("%lf",&s[i]);
            m+=s[i];
        }
        m/=n;
        for(int i=0;i<n;i++){
            a+=(s[i]-m)*(s[i]-m);
        }
        a/=n;
        printf("%.8lf\n",sqrt(a));
    }
}


Measured memory_bytes: 2716
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/* ソート関数 */
int int_sort( const void * a , const void * b ) {
  /* 引数はvoid*型と規定されているのでint型にcastする */
  if( *( int * )a < *( int * )b ) {
    return -1;
  }
  else
  if( *( int * )a == *( int * )b ) {
    return 0;
  }
  return 1;
}

int main(void){
    
    char po[114514];
    scanf("%s",po);
    int k=strlen(po);
    int kazu[3]={};
    for(int i=0;i<k;i++)kazu[po[i]-'a']++;
    qsort(( void * )kazu , 3 , sizeof( kazu[0] ), int_sort );
    if(kazu[0]==kazu[1]&&kazu[0]==kazu[2]){printf("YES");return 0;}
    if(kazu[0]==kazu[1]&&kazu[0]+1==kazu[2]){printf("YES");return 0;}
    if(kazu[0]+1==kazu[1]&&kazu[1]==kazu[2]){printf("YES");return 0;}
    printf("NO");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define INF 1000000000

struct max_flow
{
    int V;
    struct edge{int to,cap,rev;};
    using Graph=vector<vector<edge>>;
    Graph graph;
    vector<bool> visit;
public:
    max_flow(int n) //与えられた頂点は別にスタートとシンクを設定する場合
    {
        V=n;
        graph.resize(V+2,vector<edge> ());
        visit.resize(V+2,false);
    }

    void add_edge(int from,int to, int cap)
    {
        graph[from].pb((edge){to,cap,(int)graph[to].size()});
        graph[to].pb((edge){from,0,(int)graph[from].size()-1});
        return ;
    }

    int dfs(int s, int t, int f)
    {
        if (s==t) return f;
        visit[s]=true;
        for (int i=0;i<graph[s].size();i++)
        {
            edge &e=graph[s][i];
            if (!visit[e.to] && e.cap>0)
            {
                int d=dfs(e.to,t,min(f,e.cap));
                if (d>0)
                {
                    e.cap-=d;
                    graph[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    int run(int s,int t)
    {
        int flow=0;
        for (;;) //while文
        {
            for (int i=0;i<V+2;i++) visit[i]=false;//memsetは初期化
            int f=dfs(s,t,INF);
            if (f==0) return flow;
            else flow+=f;
        }
    }
};

int main()
{
    int N; cin >> N;
    int cnt[28][28];string input;
    for (int i=0;i<27;i++)
        for (int j=0;j<27;j++) cnt[i][j]=0;
    for (int i=0;i<N;i++)
    {
        cin >> input;
        cnt[(int)input[0]-'a'][(int)input[input.size()-1]-'a']++;
    }
    vector<char> ans;
    for (int s=0;s<26;s++)
    {
        max_flow solve(26);
        for (int i=0;i<26;i++)
        {
            if (i!=s)
            {
                for (int j=0;j<26;j++)
                {
                    if (j!=s && cnt[i][j]>0 &&i!=j) solve.add_edge(i+1,j+1,cnt[i][j]);
                }
            }
            else continue;
        }
        int sum=0;
        bool ok=false;
        if (cnt[s][s]>0) {ok=true;solve.add_edge(0,27,cnt[s][s]);}
        for (int i=0;i<26;i++)
        {
            sum+=cnt[s][i];
            if (cnt[s][i]>0 && i!=s ) solve.add_edge(0,i+1,cnt[s][i]);
            if (cnt[i][s]>0 && i!=s) {solve.add_edge(i+1,27,cnt[i][s]);ok=true;}
        }
        if (solve.run(0,27)==sum && ok)
        {
            char a='a'+s;
            ans.pb(a);
        }
    }
    for (int i=0;i<ans.size();i++) cout << ans[i] << endl;
return 0;
}


Measured memory_bytes: 3232
#include<stdio.h>
int main(){
  char s[4];
  int X=700;
  scanf("%s",s);
  if(s[0]=='o'){
  X=X+100;
  }
  if(s[1]=='o'){
  X=X+100;
  }
  if(s[2]=='o'){
  X=X+100;
  }
  printf("%d",X);     
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

string s;

int main() {
	cin >> s;
	
	bool ans = true;
	inc(i, 3) { if(s[i] == s[i + 1]) { ans = false; } }
	
	cout << (ans ? "Good" : "Bad") << endl;
	
	return 0;
}


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

int main() {
    int N,A,B,n,sum,total=0;
    scanf("%d %d %d",&N,&A,&B);
    for (int i=0; i <= N; i++) { 
        sum = 0;
        n = i;
        for (int m=10000; m>=1; m/=10) {
            sum += n/m;
            n %= m;
        }
        if (A <= sum && sum <= B) {
            total += i;
        }
    }
    printf("%d\n",total);
}

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

using namespace std;

int32_t main () {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int N, G, a, b;
  cin >> N >> G;
  vector < int > dp (G + 1);
  while (N --) {
    cin >> a >> b;
    for (int i = G; i >= a; --i)
      dp[i] = max (dp[i], dp[i - a] + b);
  }
  cout << dp[G];
}


Measured memory_bytes: 3868
#include "bits/stdc++.h"
using namespace std;

int main() {
	int x, y;
	for (int i = 0; ; i++) {
		cin >> x >> y;
		if (x == 0 && y == 0) break;
		cout << min(x, y) << " " << max(x, y) << endl;
	}
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
using namespace std;
using ll = long long;


int main(){
    string s;
    cin >> s;
    bool f = true;
    if(s[0] != 'A') f = false;
    int g = 0;
    rep(i,3-1,s.size()-1){
        if(s[i] == 'C') g++;
    }
    if(g != 1) f = false;
    rep(i,0,s.size()){
        if(s[i]!='A'&&s[i]!='C'){
            int h = isupper(s[i]);
            if(h) f = false;
        }
    }
    if(f) cout << "AC" <<"\n";
    else cout <<"WA"<<"\n";
}

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

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

  string ans = "WA";
  int A = 0;

  if (S.at(0) == 'A') {
    for (int i = 1; i < S.size(); i++) {
      if (S.at(i) < 'a') A++;
    }
  }

  if (A == 1) {
    for (int i = 2; i < S.size() - 1; i++) {
      if (S.at(i) == 'C') {
        ans = "AC";
      }
    }
  }

  cout << ans << endl;
}

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


int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<int>> a(h,vector<int>(w,0));
  for(int i=0;i<h;++i){
    for(int j=0;j<w;++j){
      cin >> a[i][j];
    }
  }
  vector<tuple<int,int,int,int>> ans;
  for(int i=0;i<h;++i){
    for(int j=0;j<w-1;++j){
      if(a[i][j]%2==1){
        a[i][j]--;
        a[i][j+1]++;
        ans.push_back(make_tuple(i,j,i,j+1));
      }
    }
  }
  for(int i=0;i<h-1;++i){
    if(a[i][w-1]%2==1){
      a[i][w-1]--;
      a[i+1][w-1]++;
      ans.push_back(make_tuple(i,w-1,i+1,w-1));
    }
  }
  int n=ans.size();
  cout << n << endl;
  for(auto p : ans){
    cout << get<0>(p)+1 << " " << get<1>(p)+1 << " " << get<2>(p)+1 << " " << get<3>(p)+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 6364
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
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A_01Matrix solver = new A_01Matrix();
        solver.solve(1, in, out);
        out.close();
    }

    static class A_01Matrix {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int height = in.nextInt();
            int width = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            char[][] s = new char[height][width];
            for (int r = 0; r < height; r++) {
                for (int c = 0; c < width; c++) {
                    if ((r < b) == (c < a)) {
                        s[r][c] = '0';
                    } else {
                        s[r][c] = '1';
                    }
                }
            }
            for (int r = 0; r < height; r++) {
                out.println(new String(s[r]));
            }
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 28856
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] strs = new String[str.length()];                    
                    
                    for(int i=0;i<str.length();i++){
                        strs[i] = String.valueOf(str.charAt(i));
                        if(strs[i].toUpperCase().equals(strs[i])){
                            strs[i] = strs[i].toLowerCase();
                        }else if(strs[i].toLowerCase().equals(strs[i])){
                            strs[i] = strs[i].toUpperCase();
                        }
                    }
                    
                    StringBuilder sb = new StringBuilder();
                    for(int i=0;i<strs.length;i++){
                        //System.out.print(strs[i]);
                        sb.append(strs[i]);
                    }
                    System.out.println(sb.toString());
  }
}

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

int main() {
    int n;
    int ans = 0;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++)cin >> p.at(i);
    for(int i = 0; i < n-2; i++){
        vector<int> buf(3);
        for(int j = 0; j < 3; j++){
            buf.at(j) = p.at(i+j);
        }
        sort(buf.begin(),buf.end());
        if(p.at(i+1) == buf.at(1)){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		int numFriend = sc.nextInt();
		int maxHeight = sc.nextInt();

		int canGo = 0;
		for(int i=0; i<numFriend; i++){
			int height = sc.nextInt();
			if(height >= maxHeight)
				canGo+=1;
		}
		System.out.println(canGo);

	}
}

Measured memory_bytes: 47008
l, r = [int(e) for e in input().split()]
m = 2019
for i in range(l, r):
  ir = i % 2019
  for j in range(i + 1, r + 1):
    t = (ir * j) % 2019
    if t < m:
      m = t
    if m == 0:
      break
  if m == 0:
    break
print(m)

Measured memory_bytes: 2940
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 2e18;


bool ac[100010];
int cnt[100010];
void solve() {
	int N, M; cin >> N >> M;
	REP(i, M) {
		int p; cin >> p;
		string S; cin >> S;
		if (ac[p])continue;
		if (S == "WA")cnt[p]++;
		else ac[p] = true;
	}
	ll ans = 0;
	int ans2 = 0;
	REP(i, N + 1) {
		if (ac[i])ans2++;
	}
	REP(i, N + 1) {
		if (ac[i])ans += cnt[i];
	}
	pe(ans2);
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

// AtCoder Grand Contest 037
int main(){

    int K;
    cin >> K;
    
    typedef pair<int, int> edge;
    #define to first
    #define cost second

    vector<vector<edge>> graph(K);
    rep(i, K){
        if(i % 10 != 9)graph[i].push_back(edge((i + 1) % K, 1));
        graph[i].push_back(edge((i * 10) % K, 0));
    }

    const int inf = 1000000000;
    vector<int> dist(K, inf);
    deque<int> deq;
    dist[1] = 1; deq.push_back(1);

    while(deq.size()){
        int v = deq.front();
        deq.pop_front();
        for(edge e : graph[v]){
            if(chmin(dist[e.to], dist[v] + e.cost)){
                if(e.cost == 0)deq.push_front(e.to);
                else deq.push_back(e.to);
            }
        }
    }

    cout << dist[0] << endl;
    return 0;

}

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

int main(){
  int n,k;
  cin >>n>>k;
  double a[n];
  double e[n];
  double s[n];

  rep(i,n)cin>>a[i];
  double maxchecker =0.0;
  double checker = 0.0;

  rep(i,n)e[i]=a[i]+1.0;

  s[0]=e[0];
  for(int i =1; i<n;++i){
    s[i] = s[i-1]+e[i];
  }

  maxchecker = s[k-1];

  for(int i =0 ;i<n-k;++i){
    checker =s[i+k]-s[i];
    maxchecker = max(maxchecker,checker);
  }
  maxchecker/=2.0;
  printf("%.10f\n",maxchecker);
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; k < t; ++k)
#define rng(a) a.begin(),a.end()
#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 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 set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  string s;
  cin >> s;
  int count = 0;
  while(true) {
    if(s == "") {
      cout << count << endl;
      return 0;
    }
    if(s[0] == s[sz(s)-1]) {
      s = s.substr(1,sz(s)-2);
    } else if (s[0] == 'x') {
      s.push_back('x');
      count++;
    } else if(s[sz(s)-1] == 'x') {
      s = "x" + s;
      count++;
    } else {
      cout << -1 << endl;
      return 0;
    }

  }
  return 0;
}

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

// input
int N;
int F[101][10];
int P[101][11];

vector<int> w;


void input() {
    cin >> N;
    rep(i, N) rep(j, 10) cin >> F[i][j];
    rep(i, N) rep(j, 11) cin >> P[i][j];
}


int solve(int x) {
    bitset<10> b(x);
    int ret = 0;
    rep(i, N) {
        int c = 0;
        rep(j, 10) {
            if (F[i][j] == 1 && b.test(j)) c++;
        }
        ret += P[i][c];
    }
    return ret;
}


int main() {
    input();
    int n = pow(2, 10);
    rep(i, n - 1) w.push_back(solve(i + 1));
    int ans = *max_element(w.begin(), w.end());
    cout << ans << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <queue>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

int H, W;
int main()
{
    int num_white = 0;
    int grid[52][52];
    int done_grid[52][52];
    REP(i, 52) {
        REP(j, 52) {
            grid[i][j] = -1;
            done_grid[i][j] = 0;
        }
    }
    cin >> H >> W;
    string s;
    REP(i, H) {
        cin >> s;
        REP(j, W) {
            if (s[j] == '.') {
                grid[i+1][j+1] = 0;
                num_white++;
            }
        }
    }
    //bfs
    queue<pair<int, int> > qp;
    qp.push(make_pair(1, 1));
    grid[1][1] = 1;
    done_grid[1][1] = 1;
    while (!qp.empty()) {
        pair<int, int> p = qp.front();
        qp.pop();
        int x = p.first;
        int y = p.second;
        int dx[4] = { 0,-1,0,1 };
        int dy[4] = { -1,0,1,0 };
        REP(i, 4) {
            if (done_grid[x+dx[i]][y+dy[i]]==0 && (grid[x][y] < grid[x + dx[i]][y + dy[i]] || grid[x+dx[i]][y+dy[i]]==0)) {
                grid[x + dx[i]][y + dy[i]] = grid[x][y] + 1;
                done_grid[x + dx[i]][y + dy[i]] = 1;
                qp.push(make_pair(x + dx[i], y + dy[i]));
            }
        }
    }
    if (grid[H][W] == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << num_white - grid[H][W] << endl;
    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<P,int>PP;
int a[100006];
int cpy[100006];
int ok[100006];
void clear(int n) {
	rep(i, n)cpy[i] = ok[i] = 0;
}
signed main() {
	int n, m, v, p; cin >> n >> m >> v >> p;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	int lb = -1, ub = n;
	while (ub - lb > 1) {	
		int mi = (ub + lb) / 2;
		rep(i, n)cpy[i] = a[i];
		cpy[mi] += m;
		int ns = cpy[mi], np = m*(v - 1);
		int cnt1 = 0;
		rep(i, n)if (cpy[i] > ns)cnt1++;
		if (cnt1 >= p) {
			lb = mi;
//			cout << mi << ' ' << "D1" << endl;
		}
		else {
			swap(cpy[mi], cpy[n - 1]);
			sort(cpy, cpy + n - 1);
			rep(i, n-1) {
				if (cpy[i] + m <= ns) {
					ok[i] += min(m,np);
					np -= min(m, np);
				}
				else if(cpy[i]<=ns) {
					ok[i] += min(np, ns - cpy[i]);
					np -= min(np, ns - cpy[i]);
				}
			}
			if (np == 0) {
				ub = mi;
//				cout << mi << ' ' << "D2" << endl;
			}
			else {
				vector<int>V;
				rep(i, n - 1)V.push_back(m - ok[i]);
				sort(V.begin(), V.end());
				int sum = 0;
				rep(i, p - 1)sum += V[n - 2 - i];
				if (sum >= np) {
					ub = mi;
//					cout << mi << ' ' << "D3" << endl;
				}
				else{
					lb = mi;
//					cout << mi << ' ' << "D4" << endl;
				}
			}
		}
		clear(n);
	}

	cout << n - ub << endl;
}

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

using namespace std;
typedef long long ll;

int main(){
    
    ios_base::sync_with_stdio(0);
    int n,l;
    cin>>n>>l;
    string a[n];
    for(int i=0;i<n;i++)   cin>>a[i];

    sort(a,a+n);
    string res="";
    for(int i=0;i<n;i++)    res += a[i];
    cout<<res<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

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

bool judgeprime(int n){
    if(n == 1 || n % 2 == 0)
        return false;
    int  i,j;
    j = (int)sqrt(n) + 1;
    bool k = true;
    for(i = 3;i < j;i += 2)
        if(n % i == 0){
            k = false;
            break;
        }
    return k;
}

int nextprime(int prime){
    prime++;
    while(judgeprime(prime++) == false);
    return prime - 1;
}

int main(void){
    int p,q;
    scanf("%d%d",&p,&q);

    q /= gcd(p,q);

    int prime = 2,ans = 1;

    while(q > 1){
        if(q % prime == 0){
            ans *= prime;
            while(q % prime == 0)
                q /= prime;
        }
        if(judgeprime(q)){
            ans *= q;
            break;
        }
        prime = nextprime(prime);

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

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

int main(){
    ll N; cin >> N;
    vector <pair<ll,ll>> A(N);
    rep(i,N){
        ll x; cin >> x;
        ll l; cin >> l;
        A[i]=make_pair(x,l);
    }
    sort(A.begin(),A.end());
    
    ll ans=0;
    ll tmp=A[0].first+A[0].second;
    Rep(i,N){
        if (tmp > A[i].first-A[i].second){
            ans++;
            if (tmp>A[i].first+A[i].second){
                tmp=A[i].first+A[i].second;
            }
        }else{
            tmp=A[i].first+A[i].second;
        }
    }
    cout << N-ans;
}

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

int n,m;
vector<int>adj[INF];
bool check[INF];
int mem[INF];

int rec(int pos)
{
    if(mem[pos]!=-1) return mem[pos];
    check[pos]=true;
    int l=0;
    for(int i=0;i<adj[pos].size();i++)
    {
        l=max(l,1+rec(adj[pos][i]));
    }
    return mem[pos]=l;
}

int main()
{
    //freopen("output.txt","r",stdin);
    //freopen("input.txt","w",stdout);
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int aa,bb;
        scanf("%d%d",&aa,&bb);
        adj[aa].push_back(bb);
    }
    memset(check,false,sizeof(check));
    memset(mem,-1,sizeof(mem));
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,rec(i));
    }
    printf("%d\n",ans);
}


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

int main(){
  int N;
  int a;
  set<int> s;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a;
    s.insert(a);
  }
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
mx = 1
L = [0] * (N + 2)
R = [0] * (N + 2)
for i in range(1, N + 1):
    L[i] = gcd(L[i - 1], A[i - 1])
for i in range(N, 0, -1):
    R[i] = gcd(R[i + 1], A[i - 1])
for i in range(1, N + 1):
    mx = max(mx, gcd(L[i - 1], R[i + 1]))
print(mx)


Measured memory_bytes: 16116
#include <iostream>
#include <vector>
#include <fstream>
#include <stdio.h>
#include <cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
//#define REPR(i, n) for(int i = n; i >= 0; i--)
//#define FOR(i, m, n) for(int i = m; i < n; i++)
//#define INF 1e9
//#define ALL(v) v.begin(), v.end()

using namespace std;
//typedef long long ll;

int main() { //int argc, const char * argv[]

    cin.tie(0);
    ios::sync_with_stdio(false);

    //std::cout << "Hello, World!\n";
    
    int A, B, ans=0;
    cin>>A>>B;

    if (A<=B) {
        REP(i,B) {
            ans += A * std::pow(10, i);
        }
        std::cout << ans;
    } else {
        REP(i,A) {
            ans += B * std::pow(10, i);
        }
        std::cout << ans;
    }
    
    return 0;
}


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

int main() {
	while (1) {

		int N, M; cin >> N >> M;
		if (!N&&!M)break;
		vector<int>vs(N + M);
		for (int i = 0; i < N + M; ++i) {
			cin >> vs[i];
		}
		vs.emplace_back(0);
		sort(vs.begin(), vs.end());
		int ans = 0;
		for (int i = 0; i < vs.size() - 1; ++i) {
			ans = max(ans, vs[i + 1] - vs[i]);
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    int sum = 0;
    for(int i = 1;i <= n;i++){
        int k = 0;
        int j = i;
        while(j > 0){
            k += j%10;
            j /= 10;
        }
        if(a <= k && k <= b) sum += i;
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int h[n+1];
    int max=0;
    for(int i=1;i<=n;i++){
        cin >> h[i];
        if(max<h[i]) max=h[i];
    }
    int ans=0;
    int end=0;
    for(int i=1;i<=max;i++){
        for(int j=1;j<=n;j++){
            if(end==1){
              end=0;
              break;
            }
            if(h[j]>=i) ans++;
            for(int k=j;k<=n;k++){
              if(h[k]<i) {
                  j=k;
                  break;
              } 
              if(k==n && j!=n) end=1;
                
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

const ll MOD = 1e9 + 7;
vll m(1010, 0);

void f(ll n) {
    for(ll i = 1; i <= n; i++) {
        ll t = i;
        for(ll j = 2; j * j <= n; j++) {
            if(t % j != 0) continue;
            ll ex = 0;
            while(t % j == 0) {
                ex++;
                t /= j;
            }
            m[j] += ex;
        }
        if(t != 1) m[t] += 1;
    }
    
    return;
}

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

    f(n);

    ll ans = 1;
    rep(i, m.size()) {
        if(m[i] > 0) {
            ans *= (m[i] + 1);
            ans %= MOD;
        } 
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
d = [11, 16, 10, 25, 9, 24, 19, 13, 18, 12, 17]
e = 7 * (n - 1)
r = (e - d[k] - 1) // 77
print(5 * r + len([x for x in range(d[k] + 77 * r, e, 11) if x % 7 > 1]))


Measured memory_bytes: 3064
n = int(input())
s1 = input()
s2 = input()
s3 = ""
i = 0
while i < len(s1):
    if s1[i] == s2[i]:
        s3 += "T"
    else:
        s3 += "Y"
        i += 1
    i += 1
ret = 1
for i in range(len(s3)):
    if i == 0:
        if s3[i] == "T":
            ret *= 3
        else:
            ret *= 6
    else:
        if s3[i] == "T" and s3[i-1] == "T":
            ret *= 2
        if s3[i] == "Y":
            if s3[i-1] == "T":
                ret *= 2
            else:
                ret *= 3
        ret %= 1000000007
print(ret)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

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

const ll mod = 1e9 +7;

int main() {
    

    string s;
    ll n, k;
    cin >> n >> k >> s;
    
    ll bad = 1;
    for (int i = 1; i < s.size(); ++i)
    {
        if (s[i] != s[i - 1])
        {
            bad++;
        }
    }
    
    cout << s.size() - max(bad - k * 2, 1ll) << endl;
    
    return 0;
}

Measured memory_bytes: 512
import collections

n = int(input())
d = list(map(int, input().strip().split()))

counts = collections.Counter(d)
dic = {a: True for a, c in counts.items()}

keys = sorted(dic.keys())
last = keys[-1]

for k in keys:
    if dic[k]:
        n = 2
        while k * n <= last:
            if k * n in dic:
                dic[k * n] = False
            n += 1
    # 重複していた場合の処理
    if counts[k] > 1:
        dic[k] = False

count = len([True for v in dic.values() if v])
print(count)


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

typedef long long ll;

using namespace std;


const ll mod=1000000007;


int  main(){

    int N;

    cin>>N;

    map<ll,ll> mp;

    for(int x=1;x<=N;++x){
        ll p=x;
        for(int a=2;a*a<=p;++a){
            
            ll count=0;
            if(p%a!=0){
                continue;
            }
            
            while(p%a==0){
                p=p/a;
                ++count;
            }
            //cout<<a<<":"<<count<<endl;

            mp[a]+=count;
           
            
        } 
         mp[p]+=1;
        
    }

    ll ans=1;
    for(int i=2;i<=N;++i){
    
            ans=ans*(mp[i]+1)%mod;
        
    }

    cout<<ans<<endl;
 
}



Measured memory_bytes: 3652