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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}



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

    int i,j,tmp;
    int A[200000+1] = {0};
    for( i = 0; i < N; i++ ){
        scanf("%d", &A[i]);
    }

    qsort(A, N, sizeof(A[0]), asc);
/*
    for( i = 0; i < N; i++ ){
        for( j = i+1; j < N; j++ ){
            if( A[i] > A[j] ){
                tmp = A[i];
                A[i] = A[j];
                A[j] = tmp;
            }
        }
    }
*/
    

    for( i = 0; i < N-1; i++ ){
        if( A[i] == A[i+1] ){
            printf("NO\n");
            return 0;
        }
    }

    printf("YES\n");

    return 0;
}





Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

typedef long long ll;

string S, T;

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

    vector<ll> start(26, -1), goal(26, -1);
    rep(i, S.size()) {
        int a = S[i] - 'a';
        int b = T[i] - 'a';

        if (start[a] != -1 || goal[b] != -1) {
            if (start[a] != b || goal[b] != a) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            start[a] = b;
            goal[b] = a;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i,cnt[26],len,x,flg=0;
	char str[101];
	for(i=0;i<26;i++){
		cnt[i]=0;
	}
	scanf("%s",str);
	len=strlen(str);
	for(i=0;i<len;i++){
		x=str[i]-'a';
		cnt[x]++;
	}
	for(i=0;i<26;i++){
		if(cnt[i]%2!=0){
			flg=1;
			break;
		}
	}
	if(flg==0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
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();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);

void dfs(vi &cards,int k,int pos,string cur,vi &used,set<string> &s){
	if(pos==k){
		s.insert(cur);
		return;
	}
	REP(i,cards.size()){
		if(!used[i]){
			string ncur=cur+toString(cards[i]);
			vi nused(used);
			nused[i]=1;
			dfs(cards,k,pos+1,ncur,nused,s);
		}
	}
}

int main(){
	int n;
	while(cin>>n,n){
		int k;
		cin>>k;
		vi cards(n);
		REP(i,n){
			cin>>cards[i];
		}
		string cur;
		vi used(n);
		set<string> s;
		dfs(cards,k,0,cur,used,s);
		cout<<s.size()<<endl;
	}
}

Measured memory_bytes: 1492
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
int A[N];
void sol() {
  int n, k;
  //s = 0;
  cin >> k >> n;
  for(int i=0; i<n; i++) {
    cin >> A[i];
  }
  int a = 0;
  int s = 0;
  for(int i=1; i<n; i++) {
    int d = A[i] - A[i-1];
    s += d;
    a = max(d, a);
  }
  a = max(k - s, a);
  cout << (k - a);
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  int data[M][2];
  int ans[100]={};
  for (int i = 0; i < M; i++)
  {
    cin >> data[i][0] >> data[i][1];
  }
  for (int i = 0; i < M;i++){
    for (int j = 1; j <= N;j++){
      if (data[i][0] ==j || data[i][1]==j){
        ans[j - 1]++;
      }
    }
  }
  for (int j = 0; j < N;j++){
    cout << ans[j] << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<sstream>
using namespace std;
typedef long long ll;
const ll maxn=1e6+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
void io(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll num1[maxn],num2[maxn],num3[maxn];
priority_queue<ll,vector<ll>,greater<ll> > q;
ll cmp(ll a,ll b)
{
	return a>b;
}
int main()
{
	io();
	ll x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	for(int i=0;i<a;i++) cin>>num1[i];
	sort(num1,num1+a,cmp);
	for(int i=0;i<b;i++) cin>>num2[i];
	sort(num2,num2+b,cmp);
	for(int i=0;i<c;i++) cin>>num3[i];
	for(int i=0;i<x;i++)
		q.push(num1[i]);
	for(int i=0;i<y;i++)
		q.push(num2[i]);
	for(int i=0;i<c;i++) 
		q.push(num3[i]);
	for(int i=0;i<c;i++)
		q.pop();
	ll sum=0;
	while(!q.empty())
	{
		sum+=q.top();
		q.pop();
	}
	cout<<sum<<endl;
	return 0;
}

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

using namespace std;


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

	if (N == 0) {
		cout << 0 << endl;
		return 0;
	}

	string ans = "";
	while(N != 0) {
		if (N % 2 == 0) {
			ans = "0" + ans;
			
		} else {
			ans = "1" + ans;
			N--;
		}
		N = N / -2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
pw, pw1, pw2 = [0] * n, [0] * n, [0] * n
pw[0], pw1[0], pw2[0] = 1, 1, 1
v, mod1, mod2 = 0, 0, 0
for i in range(n):
    if s[i] == '1':
        v += 1
for i in range(1, n):
    pw1[i] = int(pw1[i - 1] * 2) % (v + 1)
    if v >= 2:
        pw2[i] = int(pw2[i - 1] * 2) % (v - 1)
for i in range(n):
    if s[i] == '1':
        mod1 = (mod1 + pw1[n - i - 1]) % (v + 1)
        if v >= 2:
            mod2 = (mod2 + pw2[n - i - 1]) % (v - 1)    
for i in range(n):
    copy, x, cnt = 0, v, 1
    
    if s[i] == '0':
        x += 1
        copy = (mod1 + pw1[n - i - 1]) % x
    else:
        x -= 1
        if x >= 1:
            copy = (mod2 - pw2[n - i - 1]) % x
        else:
            copy = -1
    if copy == -1:
        print(0)
    else:
        x = bin(copy).count('1')
        while copy > 0:
            copy %= x
            x = bin(copy).count('1')
            cnt += 1
        print(cnt)


Measured memory_bytes: 88508
#include <stdio.h>

int main(void)
{
    int no[31], i,j;
    for(i=0; i < 28; i++){
        scanf("%d", &j);
        no[j] = 1;
    }
    for(i = 1; i <= 30; i++){
        if(no[i]!=1)
            printf("%d\n", i);
    }
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for(int i=a; i<b; i++)

int clc(int a, int b, int c){
	if(a>c) swap(a, c);
	if(a<=b && b<=c) return 0;
	else return abs(a-b)+abs(b-c)-abs(a-c);
}

#define N 112345
int a[N]={};
int main(){
int n;
	scanf("%d", &n);
	REP(i, n) scanf("%d", a+i+1);
	int sum=0;
	REP(i, n+1) sum+=abs(a[i]-a[i+1]);
	REP(i, n) printf("%d\n", sum-clc(a[i], a[i+1], a[i+2]));
}

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

public class Main {

    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc= new Scanner(System.in);
        String s = sc.nextLine();
        if (s.charAt(0) != 'A') {
            System.out.println("WA");
        } else {
            int flag = 0;
            int count = 0;
            for (int i=2; i<s.length()-1; i++) {
                if (s.charAt(i)=='C') count++;
            }
            if (count != 1) {
                System.out.println("WA");
            } else {
                for (int i=1; i<s.length(); i++) {
                    if (s.charAt(i) != 'C') {
                        int z = Integer.valueOf(s.charAt(i));
                        if (z<97 || z > 122) {
                            flag = 1;
                            break;
                        }
                    }
                }
                if (flag==1) System.out.println("WA");
                else System.out.println("AC");
            }
        }
     }
}

Measured memory_bytes: 21972
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

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

template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main() {
	string s;
	cin >> s;
	if (s == "ABC") {
		cout << "ARC" << endl;
	}
	else {
		cout << "ABC" << endl;
	}
	return 0;
}

Measured memory_bytes: 3624
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) (*find_by_order(i))
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
// #define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/


void solve(){
    int n;
    cin >> n;
    vi v(n);
    rep(i, 0, n)cin >> v[i];
    int ans = 0;
    rep(i, 0, n){
        rep(j, i+1, n){
            rep(k, j+1, n){
                vi temp = {v[i], v[j], v[k]};
                sort(all(temp));
                if(temp[0] != temp[1] and temp[1] != temp[2]  and temp[0] != temp[2] and temp[0]+temp[1] > temp[2])ans++;
            }
        }
    }
    cout << ans;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3664
#include <stdio.h>
int main(void){
   char lt;
   int count[26]={};
   int i,num;
   
   while(scanf("%c",&lt)!=EOF) {
       if('A'<=lt&&lt<='Z') {
           num=lt-'A';
           count[num]+=1;
       }
       else if('a'<=lt&&lt<='z') {
           num=lt-'a';
           count[num]+=1;
       }
   }
   
    for(i=0;i<26;i++) printf("%c : %d\n",97+i,count[i]);
   
    return 0;
}


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

int main(){
    long long k;
    string s;
    cin >> s >> k;
    for(int i = 0; i < min((long long)s.size(), k); i++){
        if(s[i] >= '2'){
            cout << s[i] << endl;
            return 0;
        }
    }

    cout << '1' << endl;
    return 0;

}

Measured memory_bytes: 256
import itertools
n = int(input())
num = 4**9
ans = 0
for i in range(num):
    a = 0
    b = 0
    c = 0
    d = 0
    s = i
    for j in range(9):
        a += 0 * int(s % 4 == 0) * 10 ** j
        b += 3 * int(s % 4 == 1) * 10 ** j
        c += 5 * int(s % 4 == 2) * 10 ** j
        d += 7 * int(s % 4 == 3) * 10 ** j
        s = s // 4
    tmp = a + b + c + d
    if tmp > n:
        break
    tmp = str(tmp)
    if b > 0 and c > 0 and d > 0 and tmp.count('0') == 0:
        ans += 1
print(ans)

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<bool> dame(N + 1);
    for (int i = 1; i <= M; i++) {
        int a;
        cin >> a;
        dame[a] = true;
    }
    vector<long long> dp(N + 1);
    dp[0] = 1;
    const int mod = 1e9 + 7;
    for (int i = 1; i <= N; i++) {
        if (!dame[i]) {
            if (i == 1) dp[i] = dp[i - 1] % mod;
            else dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {

    string s;
    cin >>s;

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

    if(s.at(0) == s.at(1) && s.at(2) == s.at(3) && s.at(1) != s.at(2))cout << "Yes" << endl;
    else cout << "No" << endl;
 
}

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

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

int main(){
    ll N;
    cin >> N;
    ll A[N];
    ll count = 0;
    bool has_zero = false;
    
    for(ll i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] < 0){
            A[i] *= -1;
            count++;
        }
        if(A[i] == 0) has_zero = true;
    }
    
    ll min = 2000000000;
    ll ans = 0;
    
    for(ll i = 0; i < N; i++){
        if(min > A[i]) min = A[i];
        ans += A[i];
    }

    if(has_zero)
        cout << ans << "\n";
    else if(count%2 == 0)
        cout << ans << "\n";
    else
        cout << ans - 2*min << "\n";
    return 0;
} 


Measured memory_bytes: 1024
from  collections import deque

n = int(input())

E = [[] for _ in range(n)]

for _ in range(n-1):
    s,t,w =map(int, input().split( ))
    E[s].append([t,w])
    E[t].append([s,w])

r = 0

Q = deque()
Q.append(r)
Done = [0 for _ in range(n)]

Dist = [0 for _ in range(n)]

while Q:
    v = Q.popleft()
    Done[v] = 1
    for e in E[v]:
        if not Done[e[0]]:
            Dist[e[0]] = Dist[v] + e[1]
            Q.append(e[0])
            Done[e[0]] = 1
u = 0

for v in range(n):
    if Dist[u] < Dist[v]:
        u = v

Q = deque()
Q.append(u)
Done = [0 for _ in range(n)]
Dist = [0 for _ in range(n)]

while Q:
    v = Q.popleft()
    Done[v] = 1
    for e in E[v]:
        if not Done[e[0]]:
            Dist[e[0]] = Dist[v] + e[1]
            Q.append(e[0])
            Done[e[0]] = 1

u = 0

for v in range(n):
    if Dist[u] < Dist[v]:
        u = v
print(Dist[u])



Measured memory_bytes: 46628
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;


ll rec(int level, ll x, const vl &thicks, const vl &pats) {
	if (level == 0) {
		return x <= 0 ? 0 : 1;
	} 
	if (thicks[level] / 2 >= x) {
		return rec(level - 1, x - 1, thicks, pats);
	} else if (thicks[level] / 2 + 1 == x) {
		return pats[level - 1] + 1;
	} else if (thicks[level] > x) {
		return pats[level - 1] + 1 + rec(level - 1, x - 2 - thicks[level - 1], thicks, pats);
	} else {
		return pats[level];
	}
}

void Main() {
	ll N, X; cin >> N >> X;
	vl thicks(N + 1);
	vl pats(N + 1);
	thicks[0] = 1;
	pats[0] = 1;
	FOR(i, 1, N + 1) {
		thicks[i] = thicks[i - 1] * 2 + 3;
		pats[i] = pats[i - 1] * 2 + 1;
	}
	cout << rec(N, X, thicks, pats) << endl;
	// debug(thicks);
	// debug(pats);
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
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; }
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

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

  int n;
  cin >> n;
  set<int> s;
  rep(i, 0, n) {
    int tmp;
    cin >> tmp;
    s.insert(tmp);
  }
  cout << s.size() << endl;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
   void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int N;
char S[2][60];
const ll INF = 1e9+7;

int main() {
   cin >> N;
   rep (i, 2) {
      string s;
      cin >> s;
      rep (j, N) {
         S[i][j] = s[j];
      }
   }
   string s;
   rep (i, N) {
      if (S[0][i] == S[1][i]) {
         s.push_back('x');
      } else {
         s.push_back('y');
         i++;
      }
   }
   
   ll ans = 0;
   if (s[0] == 'x') {
      ans += 3;
   } else {
      ans += 6;
   }
   repp (i, 1, s.size()) {
      if (s[i-1] == 'x') {
         ans = ans * 2 % INF;
      } else {
         if (s[i] == 'y') {
            ans = ans * 3 % INF;
         }
      }
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    while (1) {
DONE:
        int n; cin >> n;
        if (!n) break;
        vector<vector<int>> sch(n);
        loop (n, i) {
            int k; cin >> k;
            vector<int> s(k);
            loop (k, j) cin >> s[j];
            sch[i] = s;
        }

        vector<unordered_set<int>> maps(n);
        loop (30, i) {
            int day = i+1;
            vector<int> fnd;
            loop (n, j) {
                int ok = 0;
                for (int d : sch[j]) if (d == day) ok = 1;
                if (ok) fnd.push_back(j);
            }
            for (int f : fnd) {
                for (int t : fnd) {
                    maps[f].insert(t);
                    for (int v : maps[t]) {
                        maps[f].insert(v);
                    }
                }
            }
            for (auto s : maps) {
                if (s.size() == n) {
                    cout << day << endl;
                    goto DONE;
                }
            }
        }
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
int N, M;
int dp[200000];
vector<vector<int> > G;
int rec(int v){
    if(dp[v]!=-1) return dp[v];
    int res = 0;
    for(auto nv: G[v]){
        res = max(res, rec(nv)+1);
    }
    return dp[v] = res;
}

int main(){
    cin >> N >> M;
    G.assign(N, vector<int>());
    for(int i=0; i<M; ++i){
        int x, y;
        cin >> x >> y;
        x--, y--;
        G[x].push_back(y);
    }
    for(int i=0; i<N; ++i) dp[i] = -1;
    int res = 0;
    for(int i=0; i<N; ++i){
        res = max(res, rec(i));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int main() {
  ios_base::sync_with_stdio(0);
 ll int t, i, j, k, p, q, r, x, y, u, v, n, m;
    t=1;
    //cin>>t;
    while(t--){
    cin>>n>>m;
    char a[n][m];
    fo(i,n){
        fo(j,m){
            cin>>a[i][j];
        }
    }
    ll int dp[1000][1000];
    clr(dp);
    dp[0][0]=1;
    //Fo(i,1,n)if(a[i][0]=='.')dp[i][0]=dp[i-1][0];
    //Fo(i,1,m)if(a[0][i]=='.')dp[0][i]=dp[0][i-1];
    fo(i,n){
        fo(j,m){
            if(a[i][j]=='#')continue;
            if(i>0)
            dp[i][j]+=dp[i-1][j]%mod;
          if(j>0)
              dp[i][j]+=dp[i][j-1]%mod;
        
        }
    }
    cout<<dp[n-1][m-1]%mod;
    

    }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;

  return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u - 1].pb(v - 1);
    g[v - 1].pb(u - 1);
  }
}

void dfs(int u, int par) {
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
  }
}





Measured memory_bytes: 19636
def remove_island(i, j, map)
  map[i][j] = '0'
  [[0, 1], [1, 0], [0, -1], [-1, 0]].each do |x, y|
    next if !(0..11).include?(i + x) || !(0..11).include?(j + y)
    if map[i + x][j + y]=='1'
      remove_island(i + x, j + y, map)
    end
  end
end

loop do
  map = 12.times.map{ gets.chomp }
  count = 0
  12.times do |i|
    12.times do |j|
      if map[i][j] == '1'
        count += 1
        remove_island(i, j, map)
      end
    end
  end
  puts count
  break if gets.nil?
end

Measured memory_bytes: 6312
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    C = [list(map(int, input().split())) for i in range(N)]
    ans = N
    for a,b in C:
        for x, y in C:
            if a == x and b == y:
                continue
            p, q = a -x , b - y
            CNT = 0
            for u, v in C:
                for s, t in C:
                    if u == s and v == t:
                        continue
                    if u-s == p and v-t == q:
                        CNT += 1
            ans = min(ans, N-CNT)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9208
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <fstream>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <assert.h>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL 
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
 
 
#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
 
//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)
 
struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
 
};
typedef vector<vector<Edge>> Graph;
typedef unsigned long long ull;
 
 
inline ll ksum(ll n, ll k){
  return k * (2*n - k - 1);
}

pii updtp2(pii p, int nw){
  if(p.first == -1) p.first = nw;
  else if(p.second == -1) p.second = nw;
  else if(p.first >= nw) {
    p.second = p.first;
    p.first = nw;
  }
  else if(p.second >= nw) p.second = nw;
  return p;
}
 
#define isValid(y,x) (y >=0 && y < n && x >= 0 && x < m)

int main(){
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int x = 60 * h1 + m1,y = 60 * h2 + m2;
  cout << max(0, y-x-k) << endl;
	return 0;
} 

Measured memory_bytes: 3672
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
  int r;
  cin>>r;
  cout<<r*r<<endl;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 256
from scipy.misc import comb
n=int(input())
d={}
cnt=0
for i in range(n):
  a=[i for i in input()]
  a.sort()
  b="".join(a)
  d[b]= d[b]+1 if b in d else 1
for k,v in d.items():
  cnt+=comb(v,2,exact=True)
print(cnt)  

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> n = {a, b, c};
  sort(n.begin(), n.end());
  int count = 3;
  if (n.at(0) == n.at(1)) {
    count--;
  }
  if (n.at(1) == n.at(2)) {
    count--;
  }
  cout << count << endl;
}

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

int main(void) {
    int N;cin>>N;
    vector<int> vc(N);
    for (int i = 0; i < N; i++) cin>>vc[i];
    sort(vc.begin(), vc.end());
    reverse(vc.begin(), vc.end());
    bool is_alice = true;
    int alice = 0;
    int bob = 0;
    for (int i = 0; i < N; i++) {
        if (is_alice) {
            alice += vc.at(i);
            is_alice = false;
        } else {
            bob += vc.at(i);
            is_alice = true;
        }
    }
    cout << alice - bob << endl;
    return 0;
}

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

class Dice {
	int num[6];
public:
	void set(int n, int s) {
		num[s] = n;
	}

	void move(char c) {
		if (c == 'E') {
			swap(num[0], num[3]);
			swap(num[3], num[5]);
			swap(num[5], num[2]);
		}
		else if (c == 'N') {
			swap(num[0], num[1]);
			swap(num[1], num[5]);
			swap(num[5], num[4]);
		}
		else if (c == 'S') {
			swap(num[0], num[4]);
			swap(num[4], num[5]);
			swap(num[5], num[1]);
		}
		else if (c == 'W') {
			swap(num[0], num[2]);
			swap(num[2], num[5]);
			swap(num[5], num[3]);
		}
	}

	int up() {
		return num[0];
	}

	void move_up(int n) {
		for (int i = 0; num[0] != n && i < 4; i++)
			move('E');
		for (int i = 0; num[0] != n && i < 4; i++)
			move('N');
	}

	int up_front_to_right(int n, int m) {
		move_up(n);
		if (num[1] == m) {
			return num[2];
		}
		else if (num[2] == m) {
			return num[4];
		}
		else if (num[3] == m) {
			return num[1];
		}
		else {
			return num[3];
		}
	}

	int get_num(int n) {
		return num[n];
	}
};

int main() {
	Dice d1, d2;
	int n, p;
	scanf("%d", &n);
	for (int i = 0; i < 6; i++) {
		scanf("%d", &p);
		d1.set(p, i);
	}
	for (int a = 0; a < n - 1; a++) {
		for (int b = 0; b < 6; b++) {
			scanf("%d", &p);
			d2.set(p, b);
		}
		for (int l = 0; l < 2; l++) {
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					for (int k = 0; k < 6; k++) {
						if (d1.get_num(k) != d2.get_num(k)) {
							break;
						}
						if (k == 5) {
							puts("No");
							exit(0);
						}
					}
					d2.move('E');
				}
				d2.move('N');
			}
			d2.move('N');
			d2.move('E');
			d2.move('S');
		}
	}
	puts("Yes");
}

Measured memory_bytes: 1012
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    string s;
    cin>>s;
    int n = s.size();
    vector<bool> alp(26);
    rep(i, n) {
        alp[s[i] - 'a'] = true;
    }
    rep(i, 26) {
        if (!alp[i]) {
            cout<<char('a' + i)<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    string s, t;
    cin >> s >> t;
    int ans=0;
    for(int i=0; i<s.size(); i++){
        if(s[i] != t[i]){
            ans ++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)


int main() {

	long long N; cin >> N;
	vector<vector<bool>> F(N, vector<bool>(10));
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 10; ++j) {
			bool a; cin >> a;
			F[i][j] = a;
		}
	}
	vector<vector<long long>> P(N, vector<long long>(11));
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 11; ++j) {
			cin >> P[i][j];
		}
	}

	long long ans = -1000000000000000LL;
	FOR(state, 1, 1 << 10) {
		long long ret = 0;
		FOR(i, 0, N) { // 店iについて
			long long cnt = 0;
			FOR(j, 0, 10) { // j番目の時間帯
				if ((state & 1 << j) && (F[i][j])) {
					// お姉ちゃんのお店の時間帯 j番目が営業している
					// and i番目の店がj番目の時間帯で営業している
					cnt++;
				}
			}
			ret += P[i][cnt];
		}

		ans = max(ans, ret);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] HW = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            string[] result = new string[HW[0] + 2];
            for (int k = 0; k < HW[0]; k++)
            {
                string a = Console.ReadLine();
                result[k + 1] = "#" + a + "#";
            }
            for (int z = 0; z < HW[1] + 2; z++)
            {
                result[0] += "#";
                result[HW[0] + 1] += "#";
            }
            for(int j = 0; j < result.Count(); j++)
            {
                Console.WriteLine(result[j]);
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);

Measured memory_bytes: 28272
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=45;
int mp[MAXN][MAXN],n;
LL f[MAXN][MAXN][MAXN];
char ch[MAXN];
int main()
{
	n=read();n<<=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",ch+1);
		for(int j=1;j<=n;j++)mp[i][j]=ch[j]-'0';
	}
	for(int i=1;i<=n;i++)f[i][i][i]=1;
	for(int ln=3;ln<=n;ln+=2)
	for(int i=2;i+ln-1<=n;i++)
	{
		int j=i+ln-1;
		for(int k=i;k<=j;k++)
		{
			for(int u1=i;u1<k;u1+=2)for(int u2=j;u2>k;u2-=2)if(f[u1+1][u2-1][k])
			for(int x=i;x<=u1;x++)if(f[i][u1][x])
			for(int y=u2;y<=j;y++)if(f[u2][j][y]&&mp[x][y])
			f[i][j][k]+=f[i][u1][x]*f[u2][j][y]*f[u1+1][u2-1][k];
		}
	}
	LL ans=0;
	for(int i=2;i<=n;i++)if(mp[1][i])ans+=f[2][n][i];
	pr2(ans);
	return 0;
}


Measured memory_bytes: 640
n = int(input())
x_ls = list(map(int, input().split()))

sorted_x = sorted(x_ls)
bigger = sorted_x[n//2]
smaller = sorted_x[n//2 - 1]

# 含まれてるならそのインデックス 、含まれてないなら-1を返す
def binary_search(l, item):
    left = 0
    right = len(l) - 1
    while left <= right:
        mid  = (left + right) // 2
        if l[mid] == item:
            return mid
        elif l[mid] < item:
            left = mid + 1
        else:
            right = mid - 1
    return -1

for i in range(n):
    target_ind = binary_search(sorted_x, x_ls[i])
    if target_ind <= n // 2 - 1:
        ans = bigger
    else:
        ans = smaller
    print(ans)


Measured memory_bytes: 25220
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var N int
	fmt.Scan(&N)
	m := make(map[int]int)
	r := make([]string, N)
	for i := 1; i <= N; i++ {
		var n int
		fmt.Scan(&n)
		m[n] = i
	}
	for i := 0; i < N; i++ {
		r[i] = strconv.Itoa(m[i+1])
	}
	a := strings.Join(r, " ")
	fmt.Println(a)
}


Measured memory_bytes: 12032
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'that' in s):
    s = s.translate(tbl)
  print s[:-1]

Measured memory_bytes: 6324
import java.util.*;
import java.io.*;
import java.math.BigDecimal;

import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i=0;i<n;i++) {
			l = sc.next(); p = 0;
			System.out.println(exp());
		}
	}
	
	String l; int p;
	char next() {
		return l.charAt(p++);
	}
	
	String exp() {
		BigDecimal v1 = new BigDecimal(term());
		char c = next();
		for( ;c != '=' && c != ')'; c = next() ) { 
			BigDecimal v2 = new BigDecimal(term());
			if( c == '+' ) v1 = v1.add(v2);
			else v1 = v1.subtract(v2);
		}
		p--; 
		return v1.toString();
	}
	
	String term() {
		BigDecimal v1 = new BigDecimal(val());
		char c = next();
		for( ;c != '=' && c != '+' && c != '-' && c != ')';c=next() ) {
			BigDecimal v2 = new BigDecimal(val());
			if( c == '*' ) v1 = v1.multiply(v2);
			else v1 = v1.divideToIntegralValue(v2);
		}
		p--; 
		return v1.toString();
	}
	
	String val() {
		char c = next();
		if( c == '(' ) {BigDecimal v = new BigDecimal(exp()); p++; return v.toString();}
		String v = "" + c;
		for(c = next();'0'<=c && c<='9';c=next()) v += c;
		p--;
		return v;
	}
	
	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

//#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

const int INF = 1 << 29;

signed main() {
	int n;
	while (cin >> n && n) {
		vector<int> dp(1 << n, -1);
		VV ts(n, V(n + 1));
		rep(i, n) input(ts[i]);
		function<int(int)> dfs = [&](int bit) {
			if (~dp[bit]) return dp[bit];
			if (!bit) return 0;

			int ret = INF;
			rep(i, n) if ((bit >> i) & 1) {
				int pre = dfs(bit & ~(1 << i));
				int mini = ts[i][0];
				rep(j, n) if (i != j) if ((bit >> j) & 1) {
					minup(mini, ts[i][j + 1]);
				}
				minup(ret, pre + mini);
			}

			return dp[bit] = ret;
		};

		cout << dfs((1 << n) - 1) << endl;
	}
}

Measured memory_bytes: 3288
import Text.Printf

main = do
  s <- getContents
  let ss = init . filter (not . null) . lines $ s
  mapM_ (mapM_ putStrLn . reverse . (:) "" . solve . map read . words) ss

coverWith :: [a] -> a -> [a]
coverWith ss s =  s : ss ++ [s]
  
solve :: [Int] -> [String]
solve [x,y] = coverWith (replicate (x - 2) (coverWith (replicate (y - 2) '.')'#')) lid
  where lid = (replicate y '#')

Measured memory_bytes: 4020
#include <iostream>

using namespace std;

int N, K;
int a[101];
bool dp[2][100010], vis[101][100010];

// true -> sente, false -> gote
bool rec(int cur, int k)
{
	if (vis[cur][k]) return dp[cur][k];
	if (k == K) {
		return cur % 2 == 1;
	}

	vis[cur][k] = true;

	if (cur % 2 == 0) {
		bool sente = false;
		for (int i = 0; i < N; ++i) {
			if (k + a[i] > K) break;
			sente |= rec((cur + 1) % 2, k + a[i]);
		}
		return dp[cur][k] = sente;
	} else {
		bool sente = true;
		for (int i = 0; i < N; ++i) {
			if (k + a[i] > K) break;
			sente &= rec((cur + 1) % 2, k + a[i]);
		}
		return dp[cur][k] = sente;
	}
}

signed main()
{
	cin >> N >> K;

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

	if (rec(0, 0)) {
		cout << "First" << endl;
	} else {
		cout << "Second" << endl;
	}
}


Measured memory_bytes: 8448
! 2019.11.24
!
      program answer
      implicit none
      character(len=3) :: day
      read(*,*) day
      if(day == 'SUN') then
       write(*,*) '7'
      else if(day == 'MON') then
        write(*,*) '6'
      else if(day == 'MON') then
        write(*,*) '6'
      else if(day == 'TUE') then
        write(*,*) '5'
      else if(day == 'WED') then
        write(*,*) '4'
      else if(day == 'THU') then
        write(*,*) '3'
      else if(day == 'FRI') then
        write(*,*) '2'
      else if(day == 'SAT') then
        write(*,*) '1'
      end if
      end program answer

Measured memory_bytes: 256
n =  int(input())
index=0
count=0
while index<n:
    number = int(input())
    stock =[]
    devideN = 1
    while devideN <= number:
        if len(stock)>2:
            break
        elif devideN==10000:
            stock.append(devideN)
            break
        elif number%devideN==0:
            if devideN!=1 and devideN!=number:
                break
            else:
                stock.append(devideN)
        else:
            pass
        devideN+=1
    if len(stock) == 2:
        count+=1
    index+=1
print(count)


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

int main() {
    int N; cin >> N;
    int cnt = 0;

    for(int i=1; i<N+1; i++){
        if(0<i && i<10) cnt++;
        else if(100<=i && i<1000) cnt++;
        else if(10000<=i && i<100000) cnt++;
    }

    cout << cnt << endl;

}   


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    // 辺
    val sides = Array(m) {
        readLine()!!.split(" ").map(String::toInt).let { it[0] to it[1] }
    }

    val vertexes = (1..n).toList()
    var count = 0

    fun dfs(index: Int, routes: IntArray) {
        if (index == n) {
            count++
        }
        sides.filter { it.first == routes[index - 1] || it.second == routes[index - 1] }.forEach { side ->
            vertexes.filter { !routes.contains(it) }.filter { side.first == it || side.second == it }.forEach {
                val array = routes.copyOf()
                array[index] = it
                dfs(index + 1, array)
            }
        }
    }

    dfs(1, IntArray(n).apply { this[0] = 1 })
    println(count)
}

Measured memory_bytes: 40756
#include<bits/stdc++.h>
#define debug(x) cout<<#x<<"::"<<x<<endl;
using namespace std;
typedef long long ll;

void solve()
{
    ll h;
    cin>>h;
    ll mul=1;
    ll count=0;
    ll addon=1;
    if(h==1)
    {
        count++;
    }
    else
    {
        while(h>1)
        {
            addon*=2;
            count+=mul;
            mul*=2;
            h/=2;
        }
        count+=addon;
    }

    cout<<count<<'\n';
}

int main()
{
    
    int t;
    t=1;
    while(t--)
        solve();
    return 0;
}

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

int main() {
  string S, T, U;
  cin >> S >> T;
  int A, B;
  cin >> A >> B;
  cin >> U;
  
  if (U == S) {
    A = A - 1;
  }
  
  if (U == T) {
    B = B - 1;
  }
  
  cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
 
using namespace std;
 
int a,b,c;
bool used[100];
 
int main(){
  cin >> a >> b >> c;
  int answer = 0, cur = 0;
  bool found = false;
  while( true ){
    if( used[cur%60] ) break;
    used[cur%60] = true;
    if( cur%60 <= c && c <= cur%60+a ) {
      found = true;
      answer = cur + c - cur % 60;
      break;
    }
    cur += a + b;
  }
 
  if( !found ) cout << -1 << endl;
  else cout << answer << endl;
 
  return 0;
}

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

uint64_t LIMIT = 1000000000000000000;

int main(int argc, const char * argv[]) {
    uint64_t N;
    cin >> N;
    uint64_t A = 1;
    bool limit = false;
    for (uint64_t i = 0; i < N; i++) {
        uint64_t tmp;
        cin >> tmp;
        
        if (tmp == 0) {
            A = 0;
            limit = false;
            break;
        }
        A *= tmp;
        
        LIMIT /= tmp;
        
        if (LIMIT == 0) {
            limit = true;
        }
    }
    
    if (limit) {
        cout << "-1";
    }else {
        std::cout << A;
    }
    return 0;
}

Measured memory_bytes: 3196
'use strict';
(function(stdin) { 
  var inputs = stdin.toString();
  var params = inputs.split('\n')[0].split(' ').map(Number);
  (function(a,b,c){
    var result = [a,b,c].sort(function(a,b){
        if( a < b ) return -1;
        if( a > b ) return 1;
        return 0;
    });
    console.log(result.join(' '));
  }(params[0],params[1],params[2])); 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;	cin >> a >> b >> c;
  string x="No";
  if(a==b&&b!=c)	x="Yes";
  if(a==c&&a!=b)	x="Yes";
  if(b==c&&c!=a)	x="Yes";
  cout << x;
}

Measured memory_bytes: 3600
cards = [[False for i in range(13)] for j in range(4)]
pattern = ["S", "H", "C", "D"]
cnt = int(input())
for i in range(cnt):
    ch,rank = input().split()
    rank = int(rank)
    cards[pattern.index(ch)][rank-1] = True

for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print(pattern[i], j+1)



Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

int n, l, r, t;

int main(){

    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> l >> r;
        t = t + (r-l) + 1;
    }

    cout << t;

}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int d(int i) {
    int res = 0;
    while (i != 0) {
        i /= 10;
        ++res;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    int res = 0;
    for (int i = 1; i <= n; ++i) {
        if (d(i) % 2 == 1) ++res;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define Rep(i,a,b) for (int i=(a);i<=(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rRep(i,a,b) for (int i=(a);i>=b;i--)
int n;
int a[2][105],dp[2][105];
int main()
{
	cin>>n;
	rep(k,2)rep(i,n)
	{
		cin>>a[k][i];
	}
	dp[0][0]=a[0][0];
	Rep(i,1,n-1)
	{
		dp[0][i]=dp[0][i-1]+a[0][i];
	}
	dp[1][0]=dp[0][0]+a[1][0];
	Rep(i,1,n-1)
	{
		dp[1][i]=max(dp[0][i],dp[1][i-1])+a[1][i];
	}
	cout<<dp[1][n-1];
	return false;
}


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

int main(void) {
  int N, ans = 0, pre = -2;
  cin >> N;
  vector<int> A(N), B(N), C(N - 1);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> C[i];
  }

  for (int i = 0; i < N; i++) {
    int current = A[i] - 1;
    ans += B[current];

    if (pre + 1 == current) ans += C[pre];

    pre = current;
  }

  cout << ans << endl;

  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0;i < N;i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  
  int sum = 0;//合計点
  for (int i = 0;i < N;i++) {
    sum += vec.at(i);
  }
  
  int Alice = 0;
  for (int i = 0;i < N;i = i + 2) {
    Alice += vec.at(i);
  }
  int Bob = sum - Alice;
    cout << Alice - Bob << endl;
 
}


Measured memory_bytes: 256