akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n-r+1;
	int sum = 1;
	for(int i =s;i<=n;i++)
		sum *= i;
	return sum;
}
//int nCr1(int n, int r)
//int nCr2(int n, int r) 
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int N, K;
	cin >> N >> K;
	if (K != 1)
		cout << N - K;
	else
		cout << 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>


int main()
{
    ll a;
    INX(a);
    OUTX(a + a * a + a * a * a);


    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int c[3][3];
    int a[3],b[3];
    REP(i,3){
        REP(j,3){
            cin >> c[i][j];
        }
    }
    a[0]=0;
    REP(i,3){
        b[i]=c[0][i];
    }
    a[1]=c[1][0]-b[0];
    if(a[1]!=c[1][1]-b[1] || a[1]!=c[1][2]-b[2]){
        cout << "No" << endl;
        return 0;
    }
    a[2]=c[2][0]-b[0];
    if(a[2]!=c[2][1]-b[1] || a[2]!=c[2][2]-b[2]){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

typedef vector<ll> V;
typedef vector<V> VV;

vector<string> ans[11];
vector<VV> p[11];

signed main() {
  p[1].push_back({{1}});

  for (ll i=2; i<=10; i++) {
    for (auto nvv : p[i - 1]) {
      rep(j, nvv.size()) {
        nvv[j].push_back(i);
        p[i].push_back(nvv);
        nvv[j].pop_back();
      }
      nvv.push_back({i});
      p[i].push_back(nvv);
      nvv.pop_back();
    }
  }

  for (ll i=1; i<=10; i++) {
    for (const auto &vv : p[i]) {
      string s(i, '#');
      rep(k, vv.size()) {
        auto v = vv[k];
        char c = 'a' + k;
        for (auto j : v) {
          s[j-1] = c;
        }
      }
      ans[i].push_back(s);
    }
    sort(begin(ans[i]),end(ans[i]));
  }

  // dump #2
  ll N;
  cin >> N;
  for (const auto &s : ans[N]) {
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 53040
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace AtCoder
{
  class Program
  {
    static int Main(string[] args)
    {
      int input2 = int.Parse(Console.ReadLine());
      string[] input1 = Console.ReadLine().Split(' ');
      int start = int.Parse(input1[0]);
      int end = int.Parse(input1[1]);
      
      string result = "NG";
      for(int i = start; i <= end; i++)
      {
        if( i % input2 == 0)
        {
          result = "OK";
        }
      }
      
      Console.WriteLine(result);
      
      return 0;
    }
  }
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()

typedef long long lint;
typedef double Double;
typedef pair< int, int > pii;
typedef long long ll;

bool isleap(int y){
	if(y%400==0)return 1;
	if(y%100==0)return 0;
	return y%4==0;
}

int mo[]={31,28,31,30,31,30,31,31,30,31,30,31};

ll y1,m1,d1,y2,m2,d2;
ll s[410][12][32],c[410][12][32];
int r=1,ac;

ll calc(ll y,ll m,ll d){
	ll res=(y-1)/400*ac;
	y=(y-1)%400+1;
	
	return res+s[y][m][d];
}

ll ret;

int main() {
	for(int i=1;i<=400;++i){
		int f=isleap(i);
		for(int j=1;j<=12;++j){
			for(int d=1;d<=mo[j-1]+(f&&j==2);++d){
				int t=r%7==5&&d==13;
				ac+=t;
				c[i][j][d]=t;
				s[i][j][d]=ac;
				++r;
			}
		}
	}
	
	cin>>y1>>m1>>d1>>y2>>m2>>d2;
	ret=calc(y2,m2,d2)-calc(y1,m1,d1);
	y1=(y1-1)%400+1;
	ret+=c[y1][m1][d1];
	cout<<ret<<endl;
}


Measured memory_bytes: 3572
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B_014_47
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            //new Logic_A().Start();
            new Logic_B().Start();
            Console.ReadLine();
        }

        public class Logic_B
        {
            public void Start()
            {
                var str = Console.ReadLine().Split(' ');
                var W = Convert.ToInt32(str[0]);
                var H = Convert.ToInt32(str[1]);
                var N = Convert.ToInt32(str[2]);

                var maxX1 = 0;
                var minX2 = W;
                var maxY1 = 0;
                var minY2 = H;
                for (int i = 0; i < N; i++)
                {
                    var info = Console.ReadLine().Split(' ');

                    var a = Convert.ToInt32(info[2]);
                    switch (a)
                    {
                        case 1: maxX1 = Math.Max(maxX1, Convert.ToInt32(info[0])); break;
                        case 2: minX2 = Math.Min(minX2, Convert.ToInt32(info[0])); break;
                        case 3: maxY1 = Math.Max(maxY1, Convert.ToInt32(info[1])); break;
                        case 4: minY2 = Math.Min(minY2, Convert.ToInt32(info[1])); break;
                        default: break;
                    }
                }

                var result = (minX2 - maxX1) * (minY2 - maxY1);
                if ((minX2 - maxX1) < 0 || (minY2 - maxY1) < 0)
                {
                    result = 0;
                }
                Console.WriteLine(result);
            }
        }

        public class Logic_A
        {
            public void Start()
            {
                var str = Console.ReadLine().Split(' ');
                var a = Convert.ToInt32(str[0]);
                var b = Convert.ToInt32(str[1]);
                var c = Convert.ToInt32(str[2]);

                Console.WriteLine((a == b + c || b == a + c || c == a + b) ? "Yes" : "No");
            }
        }
    }
}

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

// --------------------------------------------------------------------------------
#define fast_IO	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL);
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------

string fun(ll n)
{
    string s;
    s="";
    while(n)
    {

        string temp = s;
        int r = n%26;
        if(r==0)
        {
            temp=('z');
            n = n/26-1;
        }
        else
        {
            temp=(r+'a'-1);
            n/=26;
        }
        s = temp +s ;
    }
    return s;
}

void solve()
{
    ll n;cin>>n;    
    cout<<fun(n)<<"\n";
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    
}

Measured memory_bytes: 3616
#include<stdio.h>
int D[7][7]={{},
{0,0,4,2,5,3,0},
{0,3,0,6,1,0,4},
{0,5,1,0,0,6,2},
{0,2,6,0,0,1,5},
{0,4,0,1,6,0,3},
{0,0,3,5,2,4,0}},G[7],N,i,t,f;
int sc(int d)
{
	int i;
	for(i=1;i<=6;i++)
		if(G[i]==d)
			return i;
}
int main()
{
	for(i=1;i<7;i++)scanf("%d",G+i);
	scanf("%d",&N);
	for(;N--;)
	{
		scanf("%d%d",&t,&f);
		printf("%d\n",G[D[sc(f)][sc(t)]]);
	}
	return 0;
}


Measured memory_bytes: 2056
import sys
sys.setrecursionlimit(10**9)

MOD=10**9+7
n,k=map(int,input().split())

def pow_mod(x,n):
  if n==0:
    return 1
  elif n==1:
    return x
  else:
    xn2=pow_mod(x,n//2)
    if n%2==0:
      return (xn2*xn2)%MOD
    else:
      return (xn2*xn2*x)%MOD

def fact_mod(a):
  if a<=1:
    return 1
  else:
    return a*fact_mod(a-1)%MOD
  
def perm_mod(n,a):
  if a==1:
    return n
  else:
    return (n*perm_mod(n-1,a-1))%MOD

def inv_mod(a):
  return pow_mod(a,MOD-2)%MOD
  
def comb_mod(na,fa):
  ainv=inv_mod(fa)
  return (na*ainv)%MOD
  
if k>=n-1:  
  #nHn=(2n-1)Cn
  perm=perm_mod(2*n-1,n)
  fact=fact_mod(n)
  comb=comb_mod(perm,fact)
  #print(perm,fact,comb)
  print(comb)
else:
  inv_table = [0]+[1]
  for i in range(2,k+1):
    inv_table+=[inv_table[MOD%i]*(MOD-int(MOD/i))%MOD]
  
  comb_sum=1
  fact=1
  comb1=1
  comb2=1
  for i in range(1,k+1):
    #comb1=comb1*(n-i+1)//i
    comb1=(comb1*(n-i+1)*inv_table[i])%MOD
    #comb2=comb2*(n-i)//i
    comb2=(comb2*(n-i)*inv_table[i])%MOD
    comb=(comb1*comb2)%MOD
    comb_sum+=comb
  
  print(comb_sum%MOD)


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

int main() {
  int N, l, r, k = 0;
  cin >> N;
  
//  cout << k << endl;
  
  for(int i = 0; i < N; i++) {
    cin >> l >> r;
//    cout << i+1 << ":";
//    cout << l << "-" << r << endl;
    k = k + (r - l +1);
  }

      cout << k << endl;
  
}

Measured memory_bytes: 3544
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
string color;
int   value;
string clor;
int main()
{
	int n;
	cin >> n;
	map<string, int> p;
	while (n--)
	{
		int type;
		cin >> type;
		switch (type)
		{
		case 0:
			cin >> color >> value;
			p[color] = value;
			break;
		case 1:
			cin >> clor;
			cout << p[clor] << endl;
			break;
		}
	}
}


Measured memory_bytes: 27900
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>

int main() {
  int w, h;
  while(cin >>h >>w && w){
    vector<string> v(h);
    REP(i, h) cin >>v[i];
    vector< vector<bool> > visited(h, vector<bool>(w, false));
    int ny = 0, nx = 0;
    while(v[ny][nx] != '.' && !visited[ny][nx]){
      visited[ny][nx] = true;
      if(v[ny][nx] == '>') ++nx;
      if(v[ny][nx] == '<') --nx;
      if(v[ny][nx] == 'v') ++ny;
      if(v[ny][nx] == '^') --ny;
    }
    if(!visited[ny][nx]) cout <<nx <<" " <<ny <<endl;
    else cout <<"LOOP" <<endl;
  }
  return 0;
}

Measured memory_bytes: 1260
#include <algorithm>
#include <cstdio>

const int N = 100000;

int a[N], b[N];

int main()
{
#ifdef LOCAL_JUDGE
    freopen("D.in", "r", stdin);
#endif
    int n, m;
    while (scanf("%d%d", &n, &m) == 2) {
        for (int i = 0; i < n; ++ i) {
            scanf("%d%d", a + i, b + i);
        }
        m ++;
        long long result = 0;
        for (int k = 0; k <= 31; ++ k) {
            if (m >> k & 1) {
                int mask = ~(m >> k & ~1) << k;
                long long sum = 0;
                for (int i = 0; i < n; ++ i) {
                    if ((a[i] & mask) == 0) {
                        sum += b[i];
                    }
                }
                result = std::max(result, sum);
            }
        }
        printf("%lld\n", result);
    }
}

Measured memory_bytes: 896
#include<iostream>
#include<string>

using namespace std;

int main(void) {
	char c;
	cin >> c;
	if ((c == 'a') || (c == 'i') || (c == 'u') || (c == 'e') || (c == 'o')) {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}


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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> vec;
  for(int i=0; i<n; i++){
    long long num;
    cin >> num;
    vec.push_back(num);
  }
  
  vector<pair<long long, long long>> info;
  for(int i=0; i<n; i++){
    long long smallerInA = 0;
    long long smallerInRemain = 0;
    for(int j=0; j<n; j++){
      if(i == j) continue;
      if(vec[i] > vec[j]) smallerInA++;
    }
    for(int j=i+1; j<n; j++){
      if(vec[i] > vec[j]) smallerInRemain++;
    }
    info.push_back(make_pair(smallerInA, smallerInRemain));
  }
  
  long long swapNum = 0;
  for(int i=0; i<n; i++){
   	long long a = info[i].first;
    long long b = info[i].second;
    long long tmp = a*(k-1);
    tmp %= 1000000007;
    tmp = b+tmp+b;
    tmp %= 1000000007;
    tmp = k * tmp;
    tmp %= 1000000007;
   	swapNum += tmp * modinv(2, 1000000007);
    swapNum %= 1000000007;
  }
  
  cout << swapNum << endl;
  return 0;
}
      

Measured memory_bytes: 384
import sys
INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
LIST = lambda: list(map(int, INPUT().split()))
sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    A = LIST()
    B = LIST()
    C = LIST()

    ans = 0
    for i in range(N):
        ans += B[A[i] - 1]
        if i != N-1 and A[i+1] - A[i] == 1: ans += C[A[i] - 1]

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38460
k = input()
con = {k:0}
num = 0
while 1:
    j = input().split()
    for n in range(len(j)):
        if j[n].lower() in con:
            con[j[n].lower() ] += 1
    else:
        if j[n] == "END_OF_TEXT":
            break
print(con[k])


Measured memory_bytes: 5560
#include<stdio.h>
#include<math.h>
 
int main(void)
{
	int a;
	long int n;
	scanf("%ld",&n);
	a=n % 10;
	if (a==2 || a==4 || a==5 || a==7 || a==9 )
		printf("hon");
	if (a==0 || a==1 || a==6 || a==8 )
		printf("pon");
	if (a==3 )	
		printf("bon");
	return 0;
 } 

Measured memory_bytes: 2140
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int mul(int a, int b) {
	return (a * b) % MOD; 
}

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

	//1110
	//0111
	//
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt_op = 0;
	int ans = 1;
	vector<int> t;
	for (int i = 0; i < 2 * n; i++) {
		if ((cnt_op % 2) == (s[i] == 'W')) {
			cnt_op++;
		} else {
			if (cnt_op <= 0) {
				cout << 0 << endl;
				exit(0);
			}
			ans = mul(ans, cnt_op);
			cnt_op--;
		}
	}
	for (int i = 1; i <= n; i++) {
		ans = mul(ans, i);
	}
	if (cnt_op != 0) {
		ans = 0;
	}
	cout << ans << endl;
	// for (auto x : t) {
	// 	cerr << x;
	// }
	// cerr << endl;
}


Measured memory_bytes: 720
import sys
input=sys.stdin.readline
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
    sub=list(map(int,input().split()))
    s.append(sub)
t=[]
for i in range(d):
    t.append(int(input()))

h=0
last=[-1]*26

for i in range(d):
    h+=s[i][t[i]-1]
    last[t[i]-1]=i
    for j in range(26):
        h-=c[j]*(i-last[j])
    print(h)


Measured memory_bytes: 74124
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		ArrayList<Integer> odd = new ArrayList<>();
		ArrayList<Integer> even = new ArrayList<>();
		for(int i=0; i<M; i++) {
			int A = sc.nextInt();
			if(A%2==0)
				even.add(A);
			else
				odd.add(A);
		}
		
		if(odd.size()>2) {
			System.out.println("Impossible");
		} else {
			ArrayList<Integer> list = new ArrayList<>();
			if(odd.size()>0)
				list.add(odd.get(0));
			list.addAll(even);
			if(odd.size()>1)
				list.add(odd.get(1));

			printList(list);
			
			if(list.size()==1) {
				if(list.get(0)>1) {
					list.set(0, list.get(0)-1);
					list.add(1);
				}
			} else {
				list.set(0, list.get(0)-1);
				list.set(list.size()-1, list.get(list.size()-1)-1);
				list.add(1, 2);
				if(list.get(0)==0)
					list.remove(0);
				if(list.get(list.size()-1)==0)
					list.remove(list.size()-1);
			}
			
			System.out.println(list.size());
			
			printList(list);
		}
		
		sc.close();
	}
	
	static void printList(ArrayList<Integer> list) {
		for(int i=0; i<list.size(); i++)
			System.out.print(list.get(i) + (i==list.size()-1 ? "\n" : " "));
	}
}

Measured memory_bytes: 9808
#include<stdio.h>
#define N 100
#define MAX 2001
#define W 0
#define Gr 1
#define B 2
int n,G[N][N],ws,way[N],pi[N],iro[N];
int prim();
int main(){
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    way[i]=MAX;
    pi[i]=-1;
    iro[i]=W;
    for(j=0;j<n;j++){
      scanf("%d",&G[i][j]);
    }
  }
  printf("%d\n",prim());
  return 0;
}
int prim(){
  int i,j,tar,ws,min;
  way[0]=0;
  while(1){
    min = MAX;
    tar=-1;
    for(i=0;i<n;i++){
      if(min > way[i] && iro[i] != B){
	tar=i;
	min = way[i];
      }
    }
    if(tar==-1) break;
    iro[tar]=B;
    for(j=0;j<n;j++){
      if(iro[j]!=B && G[tar][j] != -1){
	if(-1 < G[tar][j] && G[tar][j] <way[j]){
	  way[j]=G[tar][j];
	  pi[j]=tar;
	  iro[j]=Gr;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(pi[i]!=-1) ws += G[i][pi[i]];
  }  
  return ws;
}


Measured memory_bytes: 2052
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

llong gcd(llong x, llong y) {
    if (x < y) swap(x, y);
    if (y == 0) return x;
    return gcd(y, x % y);
}


int pro() {
    llong a, b, c, d;
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    if (a < b) return 0;
    if (d < b) return 0;
    if (b <= c + 1) return 1;
    llong g = gcd(b, d);
    llong s = ((c + 1 - a) % b + b) % b;
    llong e = ((b - 1 - a) % b + b) % b;
    if (s > e) e += b;
    if (s % g != 0 && s / g == e / g) return 1;
    return 0;
}


int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        printf(pro() ? "Yes\n" : "No\n");
    }
	return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
const int INF = 1 << 30;
using namespace std;
#define pp pair<int,int>
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
int main() {
	int a, b;
	string s;
	cin >> a >> b >> s;
	bool o = 1;
	TFOR(i, s.size()) {
		if (s[i] == '-'&&i != a)o = 0;
		if (i == a&&s[i] != '-')o = 0;
	}
	cout << (o? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll d, t, s;
    cin >> d >> t >> s;
    if(d <= t*s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

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

    vector<ll> a(m), b(m), c(m);
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        ll x = 0;
        for(int j = 0; j < b[i]; j++){
            ll ct ;
            cin >> ct;
            x += (1LL<<(ct-1));
        }
        c[i] = x;
    }
    ll MAX_VAL = 1LL<<60;
    vector<vector<ll>> dp(m+1,vector<ll>((1LL<<n), MAX_VAL));
    dp[0][0] = 0;

    for(int i = 0; i < m; i++){
        for(int j = 0; j < (1LL<<n); j++){
            if(dp[i][j] != MAX_VAL){
                dp[i+1][j|c[i]] = min(dp[i+1][j|c[i]],dp[i][j]+a[i]);
                dp[i+1][j] = min(dp[i][j],dp[i+1][j]);
            }
        }
    }
    if(dp[m][(1LL<<n)-1] == MAX_VAL){
        cout << -1 << endl;
    }else{
        cout << dp[m][(1LL<<n)-1] << endl;
    }
    return 0;

}


Measured memory_bytes: 32384
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  if(n%Sint(n)==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

void Bubblesort(string C[], int N){
    for (int i=0;i<N;i++){
        for (int j=N-1;j>i;j--){
            if (C[j].at(1)<C[j-1].at(1)){
                swap(C[j],C[j-1]);
            }
        }
    }
    for(int i=0;i<N;i++){
        if(i!=N-1){
            cout << C[i] << ' ';
        }else{
            cout << C[i] << endl;
        }
    }

}
void Selectionsort(string C[], int N){
    for (int i=0;i<N;i++){
        int minj = i;
        for (int j=i;j<N;j++){
            if (C[j].at(1)<C[minj].at(1)){
                minj = j;
            }
        }
        swap(C[i],C[minj]);
    }
    for(int i=0;i<N;i++){
        if(i!=N-1){
            cout << C[i] << ' ';
        }else{
            cout << C[i] << endl;
        }
    }
}
int instable(string C[], string ori[], int N){
    for (int i = 0; i < N; i++){
        for (int j = i + 1; j < N; j++){
            for (int a = 0; a < N; a++){
                for (int b = a + 1; b < N; b++){
                    if (ori[i].at(1) == ori[j].at(1) && ori[i] == C[b] && ori[j] == C[a]){
                        cout << "Not stable" << endl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << "Stable" << endl;
    return 0;
}
int main(){
    int N;
    cin >> N;
    string list1[N], list2[N], ori[N];
    for (int i=0; i<N; i++){
        cin >> list1[i];
        list2[i] = list1[i];
        ori[i] = list1[i];
    } 
    Bubblesort(list1, N);   //Bubblesortを実行することで引数であるlist1自体も変更されてしまう。
    instable(list1,ori,N);
    Selectionsort(list2, N);
    instable(list2,ori,N);
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 1000006, MAXM = 1003, Mod = 1000000007 , MAXLog = 20;


double area(int n, vector<pair<pair<int, int>, char>> &arr, double moment) {
    double mnx = LLONG_MAX, mxx = LLONG_MIN, mny = LLONG_MAX, mxy = LLONG_MIN;
    for (int i = 0; i < n; ++i) {
        double x = arr[i].first.first;
        double y = arr[i].first.second;
        if (arr[i].second == 'R') {
            x += moment;
        } else if (arr[i].second == 'L') {
            x -= moment;
        } else if (arr[i].second == 'U') {
            y += moment;
        } else {
            y -= moment;
        }
        mnx = min(mnx, x);
        mxx = max(mxx, x);
        mny = min(mny, y);
        mxy = max(mxy, y);
    }
//    cout << mxx << ' ' << mnx << ' ' << mxy << ' ' << mny << '\n';
    return 1.0 * (mxx - mnx) * (mxy - mny);
}


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;

    int n;
    cin >> n;
    vector<pair<pair<int, int>, char>> arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i].first.first >> arr[i].first.second >> arr[i].second;
    }

    double l = 0, r = inf;
    double ans = LLONG_MAX;
    for (int i = 0; i < 300; ++i) {
        double m1 = ( l * 2 + r ) / 3;
        double m2 = ( l + r * 2 ) / 3;
        double f1 = area(n, arr, m1);
        double f2 = area(n, arr, m2);
        if (f1 > f2) {
            l = m1;
        } else {
            r = m2;
        }
        ans = min(ans, min(f1, f2));
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 1408
import sys
input = sys.stdin.readline

mod = 998244353

n, k = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n+1)
dp[1] = 1

for i in range(1, n):
    dp[i+1] += dp[i]
    for l, r in lr:
        dp[i+1] += dp[max(i-l+1, 0)] - dp[max(i-r, 0)]
        dp[i+1] %= mod

print((dp[n]-dp[n-1])%mod)

Measured memory_bytes: 16736
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////





int main() {

	ll N;
	ll P[MAX];

	cin >> N;
	repn(i, N) cin >> P[i];

	ll Pinv[MAX];

	repn(i, N) Pinv[P[i]] = i;

	

	multiset<ll> st = {0,0,N+1,N+1};

	ll ans = 0;


	for (int i = N; i > 0; i--) {
		auto itr=st.insert(Pinv[i]);
		
		ll n = Pinv[i];

		ll b  =*--itr;
		ll a = *--itr;
		ll c = *++(++(++itr));
		ll d = *++itr;
		

		ans += ((n - b)*(d - c) + (b - a)*(c - n))*i;

		

	}

	cout << ans;

	





	system("PAUSE");
}

Measured memory_bytes: 11252
import sys
def input(): return sys.stdin.readline().strip()

mi = lambda: map(int, input().split())

L, R = mi()

m = 2019
if L // 2019 != R // 2019 or L % 2019 == 0 or R % 2019 == 0:
  m = 0
else:
  for i in range(L, R):
    for j in range(i+1, R+1):
      if i * j % 2019 < m:
        m = i * j % 2019
print(m)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	map<int,int>f;
	int ans = 0;
	for(int i=1;i<=n;i++){
		ans+=(f[i-a[i]]);
		f[a[i]+i]++;
	}
	cout<<ans;
}

Measured memory_bytes: 27944
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair < int,int > PII;
typedef pair < ll,ll > PLL;
#define pb push_back
//#all(x) (x).begin(),(x).end()

//int const N = 1;
int const MOD = 1e9 + 7;

ll bigmod(ll a, ll b)
{
    if(b==0)
        return 1 % MOD;
    ll x = bigmod(a,b/2);
    x = (x * x) % MOD;
    if(b%2)
        x = (x * a) % MOD;
    return x;
}

int const N = 1e5 + 10;

ll n, h[N];
ll dp[N] ;



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //memset(dp,-1,sizeof dp);
    int k;
    cin >> n >> k;

    for(int i = 0; i < n; i++)
        cin >> h[i] ;

    dp[0] = 0;

    for(int i = 1; i < n; i++)
    {
        dp[i] = 1e12;

        for(int K = 1; K <= k; K++)
        {
            if(i - K >= 0)
            {
                dp[i] = min(dp[i],abs(h[i] - h[i-K]) + dp[i-K]);
            }
        }
    }
    cout << dp[n-1] << '\n';
    return 0;
}




Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

bool solve(ll N) {
    if (N % 10 != 0) return true;
    else return false;
}

int main() {
    ll N; cin >> N;
    vector<ll> S(N);
    ll sum = 0;
    rep(i, N) {
        cin >> S[i]; sum += S[i];
    }
    sort(ALL(S));

    bool ok = true;
    if (sum % 10 == 0) {
        rep(i, N) {
            if (solve(S[i])) {
                sum -= S[i];
                cout << sum << endl;
                return 0;
            }
        }
        cout << 0 << endl;
    } else {
        cout << sum << endl;
    }
}

Measured memory_bytes: 3560
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int X = sc.nextInt();
      
      // 判定
      String result = "";
      if(X >= 30){
        result = "Yes";
      }else{
        result = "No";
      }
      
      // 出力
      System.out.println(result);
    }

}

Measured memory_bytes: 35632
#include <bits/stdc++.h>
using namespace std;
const int MAXN = (1<<19);

bool arbre[26][MAXN * 2];
void changer(int iArbre , int noeud , bool change)
{
	noeud += MAXN;
	arbre[iArbre][noeud] = change;
	noeud/=2;
	while (noeud > 0)
	{
		arbre[iArbre][noeud] = arbre[iArbre][noeud * 2] || arbre[iArbre][noeud * 2 + 1];
		noeud/=2;
	}
}
bool existe(int iArbre , int debut , int fin)
{
	debut += MAXN;
	fin += MAXN;
	bool ok = false;
	while (debut <= fin)
	{
		if (debut % 2 == 1)
		{
			ok = ok || arbre[iArbre][debut];
			debut++;
		}
		if (fin % 2 == 0)
		{
			ok = ok || arbre[iArbre][fin];
			fin--;
		}
		debut/=2;
		fin/=2;
	}
	return ok;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int N;
	cin >> N;
	string s;
	cin >> s;
	for (int i = 0 ; i < N ; i++)
	{
		changer(s[i] - 'a' , i , true);
	}
	int Q;
	cin >> Q;
	for (int i = 0 ;i < Q ; i++)
	{
		int type;
		cin >> type;
		if (type == 1)
		{
			int in; char c;
			cin >> in >> c;
			in--;
			changer(s[in] - 'a' , in , false);
			changer(c - 'a' , in , true);
			s[in] = c;
		}
		else
		{
			int debut , fin;
			cin >> debut >> fin; debut--; fin--;
			int nb = 0;
			for (int j = 0 ; j < 26 ; j++)
			{
				nb += existe(j , debut , fin);
			}
			cout<<nb<<endl;
		}
	}
}

Measured memory_bytes: 27548
#include<stdio.h>
#define min(a,b) ((a)<(b))?(a):(b)
int main(void)
{
  int n,t,s[2];
  scanf("%d%d",&n,&t);
  int ans=t;
  scanf("%d",&s[1]);
  for(int i=0;i<n-1;i++){
    s[0]=s[1];
    scanf("%d",&s[1]);
    ans+=min(s[1]-s[0],t);
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
//#define int long long
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
const int N = 200010, mod = 2147483647;
inline int read()
{
    register char cc = getchar(); register int cn(0), flus(1);
    while(cc < '0' || cc > '9') {if(cc == '-') flus = - flus; cc = getchar();}
    while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
    return cn * flus;
}
int a[N];
signed main()
{
	int n = read();
	rep(i, 2, n)
	{
		a[read()] ++; 
	}
	rep(i, 1, n)
	{
		printf("%d\n",a[i]);
	}
	return 0;
}

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

using namespace std;

typedef long long int lli;

lli gcd(lli a, lli b) {
    if(a < b) return gcd(b, a);
    lli r;
    
    while ((r=a%b)) {
        a = b;
        b = r;
    }

    return b;
}

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

    lli a, b, c, d;

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

    lli c1 = a/c, c2 = b/c, d1 = a/d, d2 = b/d;
    c1 -= (a%c) ? 0 : 1;
    d1 -= (a%d) ? 0 : 1;

    lli cd = (c*d)/gcd(c, d), cd1 = a/cd, cd2 = b/cd;
    cd1 -= (a%cd) ? 0 : 1;

    cout << (b-a+1) - (c2-c1) - (d2-d1) + (cd2-cd1) << endl;
    // cout << b-a+1 << " " << c2-c1 << " " << d2-d1 << " " << cd2-cd1 << 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 repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

string S;
void input()
{
    cin>>S;
    return;
}

void solve()
{
    int ans[S.length()]={0};
    int i=0,d=0;
    while(i+d<S.length()){
        i+=d; d=0;
        while(S[i+d]=='R'){
            ++d;
        }
        ans[i+d-1]+=d/2;
        ans[i+d]+=d/2;
        if(d%2) ans[i+d-1]++;

        i+=d; d=0;
        while(i+d<S.length() && S[i+d]=='L'){
            ++d;
        }
        ans[i-1]+=d/2;
        ans[i]+=d/2;
        if(d%2) ans[i]++;
    }
    rep(i,S.length()) cout<<ans[i]<<" ";
    cout<<endl;
    return;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

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

int main()
{
  int n[5], maxn = 0, ans = 0;
  for(int i = 0; i < 5; ++i)
  {
    cin >> n[i];
    maxn = max(maxn, 10 - (n[i] % 10 == 0 ? 10 : n[i] % 10));
    ans += n[i] + 10 - (n[i] % 10 == 0 ? 10 : n[i] % 10);
  }
  cout << ans - maxn << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> D(N);
  for(int i=0;i<N;i++){
    cin >> D.at(i);
  }
  sort(D.begin(),D.end());
  int sum=1;
  for(int i=0;i<N-1;i++){
    if(D.at(i)!=D.at(i+1)){
      sum++;
    }
  }
  cout << sum << endl;
}
  

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

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n) {int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
//is(string &s) {int c;for(;;){c=gcu();if(c=='\n'||c==' ')return true;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
//void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(' '),out(x);out('\n');}
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

int main() {
	int n;
	float w, h;
	while (scanf("%d,%f,%f", &n, &w, &h) != EOF) {
		if (w / (h * h) >= 25)
			out(n, '\n');
	}
}


Measured memory_bytes: 2600
#include <cstdio>

typedef long long i64;

const int N = 15, MOD = 1000000007;

int n, adj[N];
int ans, f[1 << N];

void init() {
  int m;
  scanf("%d%d", &n, &m);
  ans = 1;
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    adj[x] |= 1 << y;
    ans = 2 * ans % MOD;
  }
}

int main() {
  init();
  f[0] = 1;
  for (int s = 1; s < (1 << n); ++s) {
    if ((s ^ (s >> 1)) & 1) continue;
    for (int a = s; a; a = (a - 1) & s) {
      int b = s ^ a;
      int cur = f[b];
      if (!cur) continue;
      for (int i = 0; i < n; ++i) {
        if (a >> i & 1) cur = ((i64)cur << __builtin_popcount(adj[i] & b)) % MOD;
        if (b >> i & 1) cur = cur * ((1LL << __builtin_popcount(adj[i] & a)) - 1) % MOD;
      }
      f[s] = (f[s] + cur) % MOD;
    }
  }
  printf("%d\n", ((i64)ans - f[(1 << n) - 1] + MOD) % MOD);
  return 0;
}


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

int main(){
  int a,b,k;
  scanf("%d %d %d",&a,&b,&k);
  
  int count=0;
  for(int i=min(a,b);i>=0;i--){
    if(a%i==0&&b%i==0){
      count++;
      if(count==k){
        printf("%d",i);
        return 0;
      }
    }
  }
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

void solve() {
    float r;
    cin >> r;
    float pi = 3.14159;
    float ans = (float)2 * pi * r;

    cout << fixed << setprecision(4) << ans << "\n";
}

int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif

    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // int t;
    // cin>>t;

    // while(t--)
    solve();

    return 0;
}

Measured memory_bytes: 3776
/****************************************************
/@Author: Kirito
/@TIME:   2020-05-04
/@FILENAME: AC.cpp
/@REMARK:    
/****************************************************/
#include <bits/stdc++.h>
#define lowbit(x) (x&(-x))
#define CSE(x,y) memset(x,y,sizeof(x))
#define INF 0x3f3f3f3f
#define Abs(x) (x>=0?x:(-x))
#define FAST ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll , ll> pll;

const int maxn=1000;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.in","r",stdin);
#endif
    string x;
    cin>>x;
    if(x=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>

using namespace std;

int main()
{
    int a,b,t;
    long long x=0,y=0;
    cin>>a>>b;
    t=b;
    while(t--)
    {
        x=x*10+a;
    }
    t=a;
    while(t--)
    {
        y=y*10+b;
    }
    cout<<max(x,y);
    return 0;
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();

		int[] a = new int[N];
		int[] b = new int[N];
		int[] c = new int[N];

		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}

		int[][] dp = new int[N][3];

		dp[0][0] = a[0];
		dp[0][1] = b[0];
		dp[0][2] = c[0];

		for (int i = 1; i < N; i++) {
			dp[i][0] = Math.max(dp[i - 1][1], dp[i - 1][2]) + a[i];
			dp[i][1] = Math.max(dp[i - 1][0], dp[i - 1][2]) + b[i];
			dp[i][2] = Math.max(dp[i - 1][0], dp[i - 1][1]) + c[i];
		}

		out.println(Math.max(Math.max(dp[N - 1][0], dp[N - 1][1]), dp[N - 1][2]));

		sc.close();

	}

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

}


Measured memory_bytes: 95044
N,M=map(int,input().split())
hlist=list(map(int,input().split()))

graph=[set() for _ in range(N+1)]
for _ in range(M):
  a,b=map(int,input().split())
  graph[a].add(b)
  graph[b].add(a)
#print(graph)

answer=0
for i in range(1,N+1):
  for s in graph[i]:
    if hlist[i-1]<=hlist[s-1]:
      break
  else:
    answer+=1

print(answer)

Measured memory_bytes: 106632
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
    arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
    for (auto& i : arr) {
        fill_all(i, v);
    }
}

int32_t H, W;
int64_t dp[3000][3000][4];
int64_t item[3000][3000];
int64_t func(int h, int w, int c)
{
    if (c >= 4) { return -10000000000000000; }
    if (h >= H) { return -10000000000000000; }
    if (w >= W) { return -10000000000000000; }
    if (h == H - 1 && w == W - 1) {
        if (c < 3) {
            return item[h][w];
        }
        return 0;
    }

    auto& memo = dp[h][w][c];
    if (memo != -1) {
        return memo;
    }
    memo = std::max({(int64_t)0,  func(h + 1,w,0), func(h, w + 1, c),  func(h, w + 1, c + 1) + item[h][w] });
    if (c < 3) {
        memo = std::max(memo, func(h + 1, w, 0) + item[h][w]);
    }
    return memo;
}

int main()
{
    using std::endl;
    in.sync_with_stdio(false);
    out.sync_with_stdio(false);
    in.tie(nullptr);
    out.tie(nullptr);
    fill_all(dp, -1);
    in >> H >> W;
    int K;
    in >> K;
    for (size_t i = 0; i < K; i++)
    {
        int h, w;
        in >> h >> w; --h; --w;
        in >> item[h][w];
    }

    out << func(0, 0, 0) << endl;
}
#endif


Measured memory_bytes: 355336
N,M = map(int,input().split())
g = [[] for _ in range(N+1)]
for _ in range(M):
    a,b = map(int,input().split())
    g[a].append(b)
    g[b].append(a)
from collections import deque

queue = deque([1])
d = [None]*(N+1)
d[1]=None
while queue:
    now = queue.popleft()
    for i in g[now]:
        if d[i] is None:
            d[i]=now
            queue.append(i)
print("Yes")
for i in range(2,N+1):
    print(d[i])

Measured memory_bytes: 95100
#include <bits/stdc++.h>
#include <iomanip>
#include<algorithm>
#define ll long long
using namespace std;

int main() {
  ll K, sum = 0;
  cin >> K;
  for(ll i = 1; i <= K; i++) {
    for(ll j = 1; j <= K; j++) {
      for(ll k = 1; k <= K; k++) {
        sum += __gcd(i, __gcd(j, k));
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3608